mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
[PTRun][WindowsSettings] Enable analyzer and fix warnings (#16942)
This commit is contained in:
committed by
GitHub
parent
94391775c8
commit
0d3aa3a187
@@ -40,7 +40,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
using var stream = assembly.GetManifestResourceStream(resourceName);
|
||||
if (stream is null)
|
||||
{
|
||||
throw new Exception("stream is null");
|
||||
throw new ArgumentNullException(nameof(stream), "stream is null");
|
||||
}
|
||||
|
||||
var options = new JsonSerializerOptions();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties;
|
||||
using Wox.Plugin.Logger;
|
||||
@@ -31,7 +32,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
// Translate Name
|
||||
if (!string.IsNullOrWhiteSpace(settings.Name))
|
||||
{
|
||||
var name = Resources.ResourceManager.GetString(settings.Name);
|
||||
var name = Resources.ResourceManager.GetString(settings.Name, CultureInfo.CurrentUICulture);
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
Log.Warn($"Resource string for [{settings.Name}] not found", typeof(TranslationHelper));
|
||||
@@ -43,7 +44,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
// Translate Type (App)
|
||||
if (!string.IsNullOrWhiteSpace(settings.Type))
|
||||
{
|
||||
var type = Resources.ResourceManager.GetString(settings.Type);
|
||||
var type = Resources.ResourceManager.GetString(settings.Type, CultureInfo.CurrentUICulture);
|
||||
if (string.IsNullOrEmpty(type))
|
||||
{
|
||||
Log.Warn($"Resource string for [{settings.Type}] not found", typeof(TranslationHelper));
|
||||
@@ -64,7 +65,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
continue;
|
||||
}
|
||||
|
||||
var translatedArea = Resources.ResourceManager.GetString(area);
|
||||
var translatedArea = Resources.ResourceManager.GetString(area, CultureInfo.CurrentUICulture);
|
||||
if (string.IsNullOrEmpty(translatedArea))
|
||||
{
|
||||
Log.Warn($"Resource string for [{area}] not found", typeof(TranslationHelper));
|
||||
@@ -88,7 +89,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
continue;
|
||||
}
|
||||
|
||||
var translatedAltName = Resources.ResourceManager.GetString(altName);
|
||||
var translatedAltName = Resources.ResourceManager.GetString(altName, CultureInfo.CurrentUICulture);
|
||||
if (string.IsNullOrEmpty(translatedAltName))
|
||||
{
|
||||
Log.Warn($"Resource string for [{altName}] not found", typeof(TranslationHelper));
|
||||
@@ -103,7 +104,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
// Translate Note
|
||||
if (!string.IsNullOrWhiteSpace(settings.Note))
|
||||
{
|
||||
var note = Resources.ResourceManager.GetString(settings.Note);
|
||||
var note = Resources.ResourceManager.GetString(settings.Note, CultureInfo.CurrentUICulture);
|
||||
if (string.IsNullOrEmpty(note))
|
||||
{
|
||||
Log.Warn($"Resource string for [{settings.Note}] not found", typeof(TranslationHelper));
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
|
||||
|
||||
// Search for Area only on queries with action char.
|
||||
if (area.Contains(query.Search.Replace(":", string.Empty), StringComparison.CurrentCultureIgnoreCase)
|
||||
&& query.Search.EndsWith(":"))
|
||||
&& query.Search.EndsWith(":", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<Nullable>enable</Nullable>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<AnalysisMode>Recommended</AnalysisMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
||||
Reference in New Issue
Block a user