mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
[CodeQuality]Address C# static analyzer suggestions (#29765)
* Address static analyzer suggestions * address feedback
This commit is contained in:
committed by
GitHub
parent
22000228e2
commit
5e7d5d1f7f
@@ -44,7 +44,7 @@ namespace ImageResizer.ViewModels
|
|||||||
{
|
{
|
||||||
if (_batch.Files.Count == 0)
|
if (_batch.Files.Count == 0)
|
||||||
{
|
{
|
||||||
_batch.Files.AddRange(view?.OpenPictureFiles());
|
_batch.Files.AddRange(view.OpenPictureFiles());
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentPage = new InputViewModel(_settings, this, view, _batch);
|
CurrentPage = new InputViewModel(_settings, this, view, _batch);
|
||||||
|
|||||||
@@ -55,15 +55,12 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
|||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
|
|
||||||
bool isGlobalQuery = string.IsNullOrEmpty(query.ActionKeyword);
|
bool isGlobalQuery = string.IsNullOrEmpty(query.ActionKeyword);
|
||||||
CultureInfo inputCulture = _inputUseEnglishFormat ? new CultureInfo("en-us") : CultureInfo.CurrentCulture;
|
CultureInfo inputCulture = _inputUseEnglishFormat ? new CultureInfo("en-us") : CultureInfo.CurrentCulture;
|
||||||
CultureInfo outputCulture = _outputUseEnglishFormat ? new CultureInfo("en-us") : CultureInfo.CurrentCulture;
|
CultureInfo outputCulture = _outputUseEnglishFormat ? new CultureInfo("en-us") : CultureInfo.CurrentCulture;
|
||||||
|
|
||||||
if (query == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Happens if the user has only typed the action key so far
|
// Happens if the user has only typed the action key so far
|
||||||
if (string.IsNullOrEmpty(query.Search))
|
if (string.IsNullOrEmpty(query.Search))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -560,7 +560,7 @@ namespace PowerLauncher
|
|||||||
|
|
||||||
// To populate the AutoCompleteTextBox as soon as the selection is changed or set.
|
// To populate the AutoCompleteTextBox as soon as the selection is changed or set.
|
||||||
// Setting it here instead of when the text is changed as there is a delay in executing the query and populating the result
|
// Setting it here instead of when the text is changed as there is a delay in executing the query and populating the result
|
||||||
if (_viewModel.Results != null && !string.IsNullOrEmpty(SearchBox.QueryTextBox.Text))
|
if (!string.IsNullOrEmpty(SearchBox.QueryTextBox.Text))
|
||||||
{
|
{
|
||||||
SearchBox.AutoCompleteTextBlock.Text = MainViewModel.GetAutoCompleteText(
|
SearchBox.AutoCompleteTextBlock.Text = MainViewModel.GetAutoCompleteText(
|
||||||
_viewModel.Results.SelectedIndex,
|
_viewModel.Results.SelectedIndex,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ using System.Reflection;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using global::PowerToys.GPOWrapper;
|
using global::PowerToys.GPOWrapper;
|
||||||
using ManagedCommon;
|
|
||||||
using PowerLauncher.Properties;
|
using PowerLauncher.Properties;
|
||||||
using Wox.Infrastructure.Storage;
|
using Wox.Infrastructure.Storage;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
@@ -60,12 +59,14 @@ namespace PowerLauncher.Plugin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Return a comparable produce version.
|
// Return a comparable product version.
|
||||||
var fileVersion = FileVersionInfo.GetVersionInfo(x.ExecuteFilePath);
|
var fileVersion = FileVersionInfo.GetVersionInfo(x.ExecuteFilePath);
|
||||||
return ((uint)fileVersion.ProductMajorPart << 48)
|
|
||||||
| ((uint)fileVersion.ProductMinorPart << 32)
|
// Convert each part to an unsigned 32 bit integer, then extend to 64 bit.
|
||||||
| ((uint)fileVersion.ProductBuildPart << 16)
|
return ((ulong)(uint)fileVersion.ProductMajorPart << 48)
|
||||||
| ((uint)fileVersion.ProductPrivatePart);
|
| ((ulong)(uint)fileVersion.ProductMinorPart << 32)
|
||||||
|
| ((ulong)(uint)fileVersion.ProductBuildPart << 16)
|
||||||
|
| (ulong)(uint)fileVersion.ProductPrivatePart;
|
||||||
}
|
}
|
||||||
catch (System.IO.FileNotFoundException)
|
catch (System.IO.FileNotFoundException)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -226,9 +226,7 @@ namespace Wox.Infrastructure
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int? ind = spaceIndices.OrderBy(item => (firstMatchIndex - item)).Where(item => firstMatchIndex > item).FirstOrDefault();
|
return spaceIndices.OrderBy(item => (firstMatchIndex - item)).Where(item => firstMatchIndex > item).FirstOrDefault(-1);
|
||||||
int closestSpaceIndex = ind ?? -1;
|
|
||||||
return closestSpaceIndex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,13 +48,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
AddFlyoutMenuItem(ModuleType.MeasureTool);
|
AddFlyoutMenuItem(ModuleType.MeasureTool);
|
||||||
AddFlyoutMenuItem(ModuleType.ShortcutGuide);
|
AddFlyoutMenuItem(ModuleType.ShortcutGuide);
|
||||||
|
|
||||||
|
updatingSettingsConfig = UpdatingSettings.LoadSettings();
|
||||||
if (updatingSettingsConfig == null)
|
if (updatingSettingsConfig == null)
|
||||||
{
|
{
|
||||||
updatingSettingsConfig = new UpdatingSettings();
|
updatingSettingsConfig = new UpdatingSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
updatingSettingsConfig = UpdatingSettings.LoadSettings();
|
|
||||||
|
|
||||||
if (updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToInstall || updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToDownload)
|
if (updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToInstall || updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToDownload)
|
||||||
{
|
{
|
||||||
IsUpdateAvailable = true;
|
IsUpdateAvailable = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user