mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
.NET 8 Upgrade Silenced Errors Fix (#30469)
* [Dev][Build] .NET 8 Upgrade Silenced errors first fix. * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1859 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1854. * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1860 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1861 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1862 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1863 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1864 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1865 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA2208 * [Dev][Build] .NET 8 Upgrade Silenced errors. CS9191 * [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check * [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check * [Dev][Build] .NET 8 Upgrade Silenced errors. - CompositeFormat variables used more than once in the same file were assigned to a single variable. - GetProcessesByName logic fix. - String comparion fix. - ArgumentOutOfRangeException message change. * [Dev][Build] .NET 8 Upgrade Silenced errors. - Null check added. - static readonly CompositeFormat added for all fields.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace SvgPreviewHandler
|
||||
@@ -39,14 +40,17 @@ namespace SvgPreviewHandler
|
||||
|
||||
private readonly Settings settings = new();
|
||||
|
||||
private static readonly CompositeFormat HtmlTemplateSolidColorCompositeFormat = System.Text.CompositeFormat.Parse(HtmlTemplateSolidColor);
|
||||
private static readonly CompositeFormat HtmlTemplateCheckeredCompositeFormat = System.Text.CompositeFormat.Parse(HtmlTemplateCheckered);
|
||||
|
||||
public string GeneratePreview(string svgData)
|
||||
{
|
||||
var colorMode = (SvgPreviewColorMode)settings.ColorMode;
|
||||
return colorMode switch
|
||||
{
|
||||
SvgPreviewColorMode.SolidColor => string.Format(CultureInfo.InvariantCulture, HtmlTemplateSolidColor, ColorTranslator.ToHtml(settings.SolidColor), svgData),
|
||||
SvgPreviewColorMode.Checkered => string.Format(CultureInfo.InvariantCulture, HtmlTemplateCheckered, GetConfiguredCheckeredShadeImage(), svgData),
|
||||
SvgPreviewColorMode.Default or _ => string.Format(CultureInfo.InvariantCulture, HtmlTemplateSolidColor, ColorTranslator.ToHtml(settings.ThemeColor), svgData),
|
||||
SvgPreviewColorMode.SolidColor => string.Format(CultureInfo.InvariantCulture, HtmlTemplateSolidColorCompositeFormat, ColorTranslator.ToHtml(settings.SolidColor), svgData),
|
||||
SvgPreviewColorMode.Checkered => string.Format(CultureInfo.InvariantCulture, HtmlTemplateCheckeredCompositeFormat, GetConfiguredCheckeredShadeImage(), svgData),
|
||||
SvgPreviewColorMode.Default or _ => string.Format(CultureInfo.InvariantCulture, HtmlTemplateSolidColorCompositeFormat, ColorTranslator.ToHtml(settings.ThemeColor), svgData),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user