mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36: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:
@@ -28,6 +28,9 @@ namespace Awake.Core
|
||||
/// </summary>
|
||||
public class Manager
|
||||
{
|
||||
private static readonly CompositeFormat AwakeMinutes = System.Text.CompositeFormat.Parse(Properties.Resources.AWAKE_MINUTES);
|
||||
private static readonly CompositeFormat AwakeHours = System.Text.CompositeFormat.Parse(Properties.Resources.AWAKE_HOURS);
|
||||
|
||||
private static BlockingCollection<ExecutionState> _stateQueue;
|
||||
|
||||
private static CancellationTokenSource _tokenSource;
|
||||
@@ -276,9 +279,9 @@ namespace Awake.Core
|
||||
{
|
||||
Dictionary<string, int> optionsList = new Dictionary<string, int>
|
||||
{
|
||||
{ string.Format(CultureInfo.InvariantCulture, Resources.AWAKE_MINUTES, 30), 1800 },
|
||||
{ string.Format(CultureInfo.InvariantCulture, AwakeMinutes, 30), 1800 },
|
||||
{ Resources.AWAKE_1_HOUR, 3600 },
|
||||
{ string.Format(CultureInfo.InvariantCulture, Resources.AWAKE_HOURS, 2), 7200 },
|
||||
{ string.Format(CultureInfo.InvariantCulture, AwakeHours, 2), 7200 },
|
||||
};
|
||||
return optionsList;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,11 @@ namespace Awake
|
||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
|
||||
private static ManualResetEvent _exitSignal = new ManualResetEvent(false);
|
||||
internal static readonly string[] AliasesConfigOption = new[] { "--use-pt-config", "-c" };
|
||||
internal static readonly string[] AliasesDisplayOption = new[] { "--display-on", "-d" };
|
||||
internal static readonly string[] AliasesTimeOption = new[] { "--time-limit", "-t" };
|
||||
internal static readonly string[] AliasesPidOption = new[] { "--pid", "-p" };
|
||||
internal static readonly string[] AliasesExpireAtOption = new[] { "--expire-at", "-e" };
|
||||
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
@@ -86,7 +91,7 @@ namespace Awake
|
||||
Logger.LogInfo("Parsing parameters...");
|
||||
|
||||
Option<bool> configOption = new(
|
||||
aliases: new[] { "--use-pt-config", "-c" },
|
||||
aliases: AliasesConfigOption,
|
||||
getDefaultValue: () => false,
|
||||
description: $"Specifies whether {Core.Constants.AppName} will be using the PowerToys configuration file for managing the state.")
|
||||
{
|
||||
@@ -95,7 +100,7 @@ namespace Awake
|
||||
};
|
||||
|
||||
Option<bool> displayOption = new(
|
||||
aliases: new[] { "--display-on", "-d" },
|
||||
aliases: AliasesDisplayOption,
|
||||
getDefaultValue: () => true,
|
||||
description: "Determines whether the display should be kept awake.")
|
||||
{
|
||||
@@ -104,7 +109,7 @@ namespace Awake
|
||||
};
|
||||
|
||||
Option<uint> timeOption = new(
|
||||
aliases: new[] { "--time-limit", "-t" },
|
||||
aliases: AliasesTimeOption,
|
||||
getDefaultValue: () => 0,
|
||||
description: "Determines the interval, in seconds, during which the computer is kept awake.")
|
||||
{
|
||||
@@ -113,7 +118,7 @@ namespace Awake
|
||||
};
|
||||
|
||||
Option<int> pidOption = new(
|
||||
aliases: new[] { "--pid", "-p" },
|
||||
aliases: AliasesPidOption,
|
||||
getDefaultValue: () => 0,
|
||||
description: $"Bind the execution of {Core.Constants.AppName} to another process. When the process ends, the system will resume managing the current sleep and display state.")
|
||||
{
|
||||
@@ -122,7 +127,7 @@ namespace Awake
|
||||
};
|
||||
|
||||
Option<string> expireAtOption = new(
|
||||
aliases: new[] { "--expire-at", "-e" },
|
||||
aliases: AliasesExpireAtOption,
|
||||
getDefaultValue: () => string.Empty,
|
||||
description: $"Determines the end date/time when {Core.Constants.AppName} will back off and let the system manage the current sleep and display state.")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user