Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted string.Format to interpolated string #463

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/XamlMath.Shared/DefaultTexFontParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@

private readonly XElement rootElement;

public DefaultTexFontParser(IFontProvider fontProvider)

Check warning on line 45 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / main.macos

Non-nullable field 'rootElement' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 45 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / nuget-push

Non-nullable field 'rootElement' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 45 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / main.linux

Non-nullable field 'rootElement' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 45 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / main.windows

Non-nullable field 'rootElement' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
{
_fontProvider = fontProvider;

using var resource = typeof(XamlMathResourceMarker).Assembly.ReadResource(resourceName);
var doc = XDocument.Load(resource);
this.rootElement = doc.Root;

Check warning on line 51 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / main.macos

Possible null reference assignment.

Check warning on line 51 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / nuget-push

Possible null reference assignment.

Check warning on line 51 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / main.linux

Possible null reference assignment.

Check warning on line 51 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / main.windows

Possible null reference assignment.

this.parsedTextStyles = CreateParseTextStyleMappings(doc.Root);

Check warning on line 53 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / main.macos

Possible null reference argument for parameter 'root' in 'IReadOnlyDictionary<string, IReadOnlyList<CharFont>> DefaultTexFontParser.CreateParseTextStyleMappings(XElement root)'.

Check warning on line 53 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / nuget-push

Possible null reference argument for parameter 'root' in 'IReadOnlyDictionary<string, IReadOnlyList<CharFont>> DefaultTexFontParser.CreateParseTextStyleMappings(XElement root)'.

Check warning on line 53 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / main.linux

Possible null reference argument for parameter 'root' in 'IReadOnlyDictionary<string, IReadOnlyList<CharFont>> DefaultTexFontParser.CreateParseTextStyleMappings(XElement root)'.

Check warning on line 53 in src/XamlMath.Shared/DefaultTexFontParser.cs

View workflow job for this annotation

GitHub Actions / main.windows

Possible null reference argument for parameter 'root' in 'IReadOnlyDictionary<string, IReadOnlyList<CharFont>> DefaultTexFontParser.CreateParseTextStyleMappings(XElement root)'.
}

public IReadOnlyList<TexFontInfo> GetFontDescriptions()
Expand Down Expand Up @@ -78,7 +78,7 @@
ProcessCharElement(charElement, fontInfo);

if (result[fontId] != null)
throw new InvalidOperationException(string.Format("Multiple entries for font with ID {0}.", fontId));
throw new InvalidOperationException($"Multiple entries for font with ID {fontId}.");
result[fontId] = fontInfo;
}
}
Expand Down Expand Up @@ -143,7 +143,6 @@
var codeMapping = rangeTypeMappings[code];

var textStyleName = mappingElement.AttributeValue("textStyle");
var textStyleMapping = parsedTextStyles[textStyleName];

var charFonts = parsedTextStyles[textStyleName];
Debug.Assert(charFonts[codeMapping] != null);
Expand Down
2 changes: 1 addition & 1 deletion src/XamlMath.Shared/DelimiterMappingNotFoundException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace XamlMath;
public sealed class DelimiterMappingNotFoundException : Exception
{
internal DelimiterMappingNotFoundException(char delimiter)
: base(string.Format("Cannot find delimeter mapping for the character '{0}'.", delimiter))
: base($"Cannot find delimeter mapping for the character '{delimiter}'.")
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace XamlMath.Exceptions;
public sealed class TextStyleMappingNotFoundException : TexException
{
internal TextStyleMappingNotFoundException(string textStyleName)
: base(string.Format("Cannot find mapping for the style with name '{0}'.", textStyleName))
: base($"Cannot find mapping for the style with name '{textStyleName}'.")
{
}
}
2 changes: 1 addition & 1 deletion src/XamlMath.Shared/FormulaNotFoundException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace XamlMath;
public sealed class FormulaNotFoundException : Exception
{
internal FormulaNotFoundException(string formulaName)
: base(string.Format("Cannot find predefined formula with name '{0}'.", formulaName))
: base($"Cannot find predefined formula with name '{formulaName}'.")
{
}
}
2 changes: 1 addition & 1 deletion src/XamlMath.Shared/SymbolMappingNotFoundException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace XamlMath;
public sealed class SymbolMappingNotFoundException : Exception
{
internal SymbolMappingNotFoundException(string symbolName)
: base(string.Format("Cannot find mapping for the symbol with name '{0}'.", symbolName))
: base($"Cannot find mapping for the symbol with name '{symbolName}'.")
{
}
}
2 changes: 1 addition & 1 deletion src/XamlMath.Shared/SymbolNotFoundException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace XamlMath;
public sealed class SymbolNotFoundException : Exception
{
internal SymbolNotFoundException(string symbolName)
: base(string.Format("Cannot find symbol with the name '{0}'.", symbolName))
: base($"Cannot find symbol with the name '{symbolName}'.")
{
}
}
Loading