Files
PowerToys/src/modules/previewpane/SvgPreviewHandler/Settings.cs
gokcekantarci a94b3eec39 .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.
2023-12-28 13:37:13 +03:00

75 lines
2.3 KiB
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.Library;
namespace SvgPreviewHandler
{
internal sealed class Settings
{
private static readonly SettingsUtils ModuleSettings = new SettingsUtils();
public int ColorMode
{
get
{
try
{
return ModuleSettings.GetSettings<PowerPreviewSettings>(PowerPreviewSettings.ModuleName).Properties.SvgBackgroundColorMode.Value;
}
catch (FileNotFoundException)
{
return PowerPreviewProperties.DefaultSvgBackgroundColorMode;
}
}
}
public Color SolidColor
{
get
{
try
{
var colorString = ModuleSettings.GetSettings<PowerPreviewSettings>(PowerPreviewSettings.ModuleName).Properties.SvgBackgroundSolidColor.Value;
return ColorTranslator.FromHtml(colorString);
}
catch (FileNotFoundException)
{
return ColorTranslator.FromHtml(PowerPreviewProperties.DefaultSvgBackgroundSolidColor);
}
}
}
public Color ThemeColor
{
get
{
if (string.Equals(Common.UI.ThemeManager.GetWindowsBaseColor(), "dark", StringComparison.OrdinalIgnoreCase))
{
return Color.FromArgb(30, 30, 30); // #1e1e1e
}
else
{
return Color.White;
}
}
}
public int CheckeredShade
{
get
{
try
{
return ModuleSettings.GetSettings<PowerPreviewSettings>(PowerPreviewSettings.ModuleName).Properties.SvgBackgroundCheckeredShade.Value;
}
catch (FileNotFoundException)
{
return PowerPreviewProperties.DefaultSvgBackgroundCheckeredShade;
}
}
}
}
}