mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-20 06:47:56 +08:00
Switch to use ArgumentNullException.ThrowIfNull
This commit is contained in:
parent
f2680f051e
commit
132a6cc489
@ -16,10 +16,7 @@ internal static class LayoutHelper
|
|||||||
public static LayoutInfo CalculateLayoutInfo(
|
public static LayoutInfo CalculateLayoutInfo(
|
||||||
LayoutConfig layoutConfig)
|
LayoutConfig layoutConfig)
|
||||||
{
|
{
|
||||||
if (layoutConfig is null)
|
ArgumentNullException.ThrowIfNull(layoutConfig);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(layoutConfig));
|
|
||||||
}
|
|
||||||
|
|
||||||
var builder = new LayoutInfo.Builder
|
var builder = new LayoutInfo.Builder
|
||||||
{
|
{
|
||||||
|
@ -11,15 +11,9 @@ namespace Awake.Core
|
|||||||
{
|
{
|
||||||
public static void AddRange<T>(this ICollection<T> target, IEnumerable<T> source)
|
public static void AddRange<T>(this ICollection<T> target, IEnumerable<T> source)
|
||||||
{
|
{
|
||||||
if (target == null)
|
ArgumentNullException.ThrowIfNull(target);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(target));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (source == null)
|
ArgumentNullException.ThrowIfNull(source);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(source));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var element in source)
|
foreach (var element in source)
|
||||||
{
|
{
|
||||||
|
@ -28,10 +28,7 @@ namespace ColorPicker.Common
|
|||||||
|
|
||||||
public void AddRange(IEnumerable<T> list)
|
public void AddRange(IEnumerable<T> list)
|
||||||
{
|
{
|
||||||
if (list == null)
|
ArgumentNullException.ThrowIfNull(list);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
_suppressNotification = true;
|
_suppressNotification = true;
|
||||||
|
|
||||||
|
@ -20,10 +20,7 @@ namespace FancyZonesEditor.Utils
|
|||||||
|
|
||||||
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
|
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
|
||||||
{
|
{
|
||||||
if (execute == null)
|
ArgumentNullException.ThrowIfNull(execute);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(execute));
|
|
||||||
}
|
|
||||||
|
|
||||||
_execute = execute;
|
_execute = execute;
|
||||||
_canExecute = canExecute;
|
_canExecute = canExecute;
|
||||||
|
@ -20,10 +20,7 @@ namespace FancyZonesEditor.Utils
|
|||||||
|
|
||||||
public RelayCommand(Action<T> execute, Predicate<T> canExecute)
|
public RelayCommand(Action<T> execute, Predicate<T> canExecute)
|
||||||
{
|
{
|
||||||
if (execute == null)
|
ArgumentNullException.ThrowIfNull(execute);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(execute));
|
|
||||||
}
|
|
||||||
|
|
||||||
_execute = execute;
|
_execute = execute;
|
||||||
_canExecute = canExecute;
|
_canExecute = canExecute;
|
||||||
|
@ -27,10 +27,7 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
|
|||||||
|
|
||||||
public void Init(PluginInitContext context)
|
public void Init(PluginInitContext context)
|
||||||
{
|
{
|
||||||
if (context == null)
|
ArgumentNullException.ThrowIfNull(context);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(context));
|
|
||||||
}
|
|
||||||
|
|
||||||
_context = context;
|
_context = context;
|
||||||
_context.API.ThemeChanged += OnThemeChanged;
|
_context.API.ThemeChanged += OnThemeChanged;
|
||||||
@ -39,10 +36,7 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
|
|||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse
|
// Parse
|
||||||
ConvertModel convertModel = InputInterpreter.Parse(query);
|
ConvertModel convertModel = InputInterpreter.Parse(query);
|
||||||
|
@ -85,10 +85,7 @@ namespace Community.PowerToys.Run.Plugin.ValueGenerator
|
|||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
var results = new List<Result>();
|
var results = new List<Result>();
|
||||||
try
|
try
|
||||||
|
@ -53,10 +53,7 @@ namespace Community.PowerToys.Run.Plugin.WebSearch
|
|||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
if (query is null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
var results = new List<Result>();
|
var results = new List<Result>();
|
||||||
|
|
||||||
|
@ -23,10 +23,7 @@ namespace Microsoft.Plugin.Folder
|
|||||||
|
|
||||||
public IEnumerable<IItemResult> Results(string actionKeyword, string search)
|
public IEnumerable<IItemResult> Results(string actionKeyword, string search)
|
||||||
{
|
{
|
||||||
if (search == null)
|
ArgumentNullException.ThrowIfNull(search);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(search));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_environmentHelper.IsEnvironmentVariable(search))
|
if (!_environmentHelper.IsEnvironmentVariable(search))
|
||||||
{
|
{
|
||||||
|
@ -56,10 +56,7 @@ namespace Microsoft.Plugin.Folder
|
|||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
var expandedName = FolderHelper.Expand(query.Search);
|
var expandedName = FolderHelper.Expand(query.Search);
|
||||||
|
|
||||||
@ -80,10 +77,7 @@ namespace Microsoft.Plugin.Folder
|
|||||||
|
|
||||||
public static IEnumerable<Result> GetFolderPluginResults(Query query)
|
public static IEnumerable<Result> GetFolderPluginResults(Query query)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
var expandedName = FolderHelper.Expand(query.Search);
|
var expandedName = FolderHelper.Expand(query.Search);
|
||||||
|
|
||||||
|
@ -11,10 +11,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
|||||||
{
|
{
|
||||||
public bool IsEnvironmentVariable(string search)
|
public bool IsEnvironmentVariable(string search)
|
||||||
{
|
{
|
||||||
if (search == null)
|
ArgumentNullException.ThrowIfNull(search);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(search));
|
|
||||||
}
|
|
||||||
|
|
||||||
return search.StartsWith('%');
|
return search.StartsWith('%');
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
|||||||
|
|
||||||
public IEnumerable<FolderLink> GetUserFolderResults(string query)
|
public IEnumerable<FolderLink> GetUserFolderResults(string query)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using OrdinalIgnoreCase since this is internal
|
// Using OrdinalIgnoreCase since this is internal
|
||||||
return _folderLinks.FolderLinks()
|
return _folderLinks.FolderLinks()
|
||||||
@ -35,10 +32,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
|||||||
|
|
||||||
public bool IsDriveOrSharedFolder(string search)
|
public bool IsDriveOrSharedFolder(string search)
|
||||||
{
|
{
|
||||||
if (search == null)
|
ArgumentNullException.ThrowIfNull(search);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(search));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using Ordinal this is internal and we're comparing symbols
|
// Using Ordinal this is internal and we're comparing symbols
|
||||||
if (search.StartsWith(@"\\", StringComparison.Ordinal))
|
if (search.StartsWith(@"\\", StringComparison.Ordinal))
|
||||||
@ -79,10 +73,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
|||||||
|
|
||||||
public static string Expand(string search)
|
public static string Expand(string search)
|
||||||
{
|
{
|
||||||
if (search == null)
|
ArgumentNullException.ThrowIfNull(search);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(search));
|
|
||||||
}
|
|
||||||
|
|
||||||
search = Environment.ExpandEnvironmentVariables(search);
|
search = Environment.ExpandEnvironmentVariables(search);
|
||||||
|
|
||||||
|
@ -24,10 +24,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
|||||||
|
|
||||||
public IEnumerable<IItemResult> Query(string querySearch)
|
public IEnumerable<IItemResult> Query(string querySearch)
|
||||||
{
|
{
|
||||||
if (querySearch == null)
|
ArgumentNullException.ThrowIfNull(querySearch);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(querySearch));
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetEnvironmentVariables(querySearch)
|
return GetEnvironmentVariables(querySearch)
|
||||||
.OrderBy(v => v.Title)
|
.OrderBy(v => v.Title)
|
||||||
|
@ -84,10 +84,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
|||||||
|
|
||||||
public IEnumerable<IItemResult> Query(string search)
|
public IEnumerable<IItemResult> Query(string search)
|
||||||
{
|
{
|
||||||
if (search == null)
|
ArgumentNullException.ThrowIfNull(search);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(search));
|
|
||||||
}
|
|
||||||
|
|
||||||
var processed = Process(search);
|
var processed = Process(search);
|
||||||
|
|
||||||
|
@ -14,20 +14,14 @@ namespace Microsoft.Plugin.Folder.Sources
|
|||||||
{
|
{
|
||||||
public bool Execute(string sanitizedPath, IPublicAPI contextApi)
|
public bool Execute(string sanitizedPath, IPublicAPI contextApi)
|
||||||
{
|
{
|
||||||
if (contextApi == null)
|
ArgumentNullException.ThrowIfNull(contextApi);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(contextApi));
|
|
||||||
}
|
|
||||||
|
|
||||||
return OpenFileOrFolder(sanitizedPath, contextApi);
|
return OpenFileOrFolder(sanitizedPath, contextApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ExecuteSanitized(string search, IPublicAPI contextApi)
|
public bool ExecuteSanitized(string search, IPublicAPI contextApi)
|
||||||
{
|
{
|
||||||
if (contextApi == null)
|
ArgumentNullException.ThrowIfNull(contextApi);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(contextApi));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Execute(SanitizedPath(search), contextApi);
|
return Execute(SanitizedPath(search), contextApi);
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
|||||||
|
|
||||||
public List<SearchResult> ExecuteQuery(ISearchQueryHelper queryHelper, string keyword)
|
public List<SearchResult> ExecuteQuery(ISearchQueryHelper queryHelper, string keyword)
|
||||||
{
|
{
|
||||||
if (queryHelper == null)
|
ArgumentNullException.ThrowIfNull(queryHelper);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(queryHelper));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SearchResult> results = new List<SearchResult>();
|
List<SearchResult> results = new List<SearchResult>();
|
||||||
|
|
||||||
@ -70,15 +67,9 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
|||||||
|
|
||||||
public static void ModifyQueryHelper(ref ISearchQueryHelper queryHelper, string pattern)
|
public static void ModifyQueryHelper(ref ISearchQueryHelper queryHelper, string pattern)
|
||||||
{
|
{
|
||||||
if (pattern == null)
|
ArgumentNullException.ThrowIfNull(pattern);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(pattern));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queryHelper == null)
|
ArgumentNullException.ThrowIfNull(queryHelper);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(queryHelper));
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert file pattern if it is not '*'. Don't create restriction for '*' as it includes all files.
|
// convert file pattern if it is not '*'. Don't create restriction for '*' as it includes all files.
|
||||||
if (pattern != "*")
|
if (pattern != "*")
|
||||||
@ -101,10 +92,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
|||||||
|
|
||||||
public static void InitQueryHelper(out ISearchQueryHelper queryHelper, ISearchManager manager, int maxCount, bool displayHiddenFiles)
|
public static void InitQueryHelper(out ISearchQueryHelper queryHelper, ISearchManager manager, int maxCount, bool displayHiddenFiles)
|
||||||
{
|
{
|
||||||
if (manager == null)
|
ArgumentNullException.ThrowIfNull(manager);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(manager));
|
|
||||||
}
|
|
||||||
|
|
||||||
// SystemIndex catalog is the default catalog in Windows
|
// SystemIndex catalog is the default catalog in Windows
|
||||||
ISearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex");
|
ISearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex");
|
||||||
@ -136,10 +124,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
|||||||
|
|
||||||
public IEnumerable<SearchResult> Search(string keyword, ISearchManager manager, string pattern = "*", int maxCount = 30)
|
public IEnumerable<SearchResult> Search(string keyword, ISearchManager manager, string pattern = "*", int maxCount = 30)
|
||||||
{
|
{
|
||||||
if (manager == null)
|
ArgumentNullException.ThrowIfNull(manager);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(manager));
|
|
||||||
}
|
|
||||||
|
|
||||||
ISearchQueryHelper queryHelper;
|
ISearchQueryHelper queryHelper;
|
||||||
InitQueryHelper(out queryHelper, manager, maxCount, DisplayHiddenFiles);
|
InitQueryHelper(out queryHelper, manager, maxCount, DisplayHiddenFiles);
|
||||||
|
@ -155,10 +155,7 @@ namespace Microsoft.Plugin.Program
|
|||||||
|
|
||||||
public List<ContextMenuResult> LoadContextMenus(Result selectedResult)
|
public List<ContextMenuResult> LoadContextMenus(Result selectedResult)
|
||||||
{
|
{
|
||||||
if (selectedResult == null)
|
ArgumentNullException.ThrowIfNull(selectedResult);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(selectedResult));
|
|
||||||
}
|
|
||||||
|
|
||||||
var menuOptions = new List<ContextMenuResult>();
|
var menuOptions = new List<ContextMenuResult>();
|
||||||
if (selectedResult.ContextData is IProgram program)
|
if (selectedResult.ContextData is IProgram program)
|
||||||
@ -173,15 +170,9 @@ namespace Microsoft.Plugin.Program
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (runProcess == null)
|
ArgumentNullException.ThrowIfNull(runProcess);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(runProcess));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info == null)
|
ArgumentNullException.ThrowIfNull(info);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
runProcess(info);
|
runProcess(info);
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
|
|
||||||
public static PackageWrapper GetWrapperFromPackage(Package package)
|
public static PackageWrapper GetWrapperFromPackage(Package package)
|
||||||
{
|
{
|
||||||
if (package == null)
|
ArgumentNullException.ThrowIfNull(package);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(package));
|
|
||||||
}
|
|
||||||
|
|
||||||
string path;
|
string path;
|
||||||
try
|
try
|
||||||
|
@ -47,10 +47,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
|
|
||||||
public UWP(IPackage package)
|
public UWP(IPackage package)
|
||||||
{
|
{
|
||||||
if (package == null)
|
ArgumentNullException.ThrowIfNull(package);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(package));
|
|
||||||
}
|
|
||||||
|
|
||||||
Name = package.Name;
|
Name = package.Name;
|
||||||
FullName = package.FullName;
|
FullName = package.FullName;
|
||||||
|
@ -91,10 +91,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
|
|
||||||
public Result Result(string query, string queryArguments, IPublicAPI api)
|
public Result Result(string query, string queryArguments, IPublicAPI api)
|
||||||
{
|
{
|
||||||
if (api == null)
|
ArgumentNullException.ThrowIfNull(api);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(api));
|
|
||||||
}
|
|
||||||
|
|
||||||
var score = Score(query);
|
var score = Score(query);
|
||||||
if (score <= 0)
|
if (score <= 0)
|
||||||
@ -130,10 +127,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
|
|
||||||
public List<ContextMenuResult> ContextMenus(string queryArguments, IPublicAPI api)
|
public List<ContextMenuResult> ContextMenus(string queryArguments, IPublicAPI api)
|
||||||
{
|
{
|
||||||
if (api == null)
|
ArgumentNullException.ThrowIfNull(api);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(api));
|
|
||||||
}
|
|
||||||
|
|
||||||
var contextMenus = new List<ContextMenuResult>();
|
var contextMenus = new List<ContextMenuResult>();
|
||||||
|
|
||||||
@ -229,10 +223,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
|
|
||||||
public UWPApplication(IAppxManifestApplication manifestApp, UWP package)
|
public UWPApplication(IAppxManifestApplication manifestApp, UWP package)
|
||||||
{
|
{
|
||||||
if (manifestApp == null)
|
ArgumentNullException.ThrowIfNull(manifestApp);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(manifestApp));
|
|
||||||
}
|
|
||||||
|
|
||||||
var hr = manifestApp.GetAppUserModelId(out var tmpUserModelId);
|
var hr = manifestApp.GetAppUserModelId(out var tmpUserModelId);
|
||||||
UserModelId = AppxPackageHelper.CheckHRAndReturnOrThrow(hr, tmpUserModelId);
|
UserModelId = AppxPackageHelper.CheckHRAndReturnOrThrow(hr, tmpUserModelId);
|
||||||
|
@ -205,10 +205,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
|
|
||||||
public Result Result(string query, string queryArguments, IPublicAPI api)
|
public Result Result(string query, string queryArguments, IPublicAPI api)
|
||||||
{
|
{
|
||||||
if (api == null)
|
ArgumentNullException.ThrowIfNull(api);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(api));
|
|
||||||
}
|
|
||||||
|
|
||||||
var score = Score(query);
|
var score = Score(query);
|
||||||
if (score <= 0)
|
if (score <= 0)
|
||||||
@ -274,10 +271,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
|
|
||||||
public List<ContextMenuResult> ContextMenus(string queryArguments, IPublicAPI api)
|
public List<ContextMenuResult> ContextMenus(string queryArguments, IPublicAPI api)
|
||||||
{
|
{
|
||||||
if (api == null)
|
ArgumentNullException.ThrowIfNull(api);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(api));
|
|
||||||
}
|
|
||||||
|
|
||||||
var contextMenus = new List<ContextMenuResult>();
|
var contextMenus = new List<ContextMenuResult>();
|
||||||
|
|
||||||
@ -605,10 +599,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
// Function to get the application type, given the path to the application
|
// Function to get the application type, given the path to the application
|
||||||
public static ApplicationType GetAppTypeFromPath(string path)
|
public static ApplicationType GetAppTypeFromPath(string path)
|
||||||
{
|
{
|
||||||
if (path == null)
|
ArgumentNullException.ThrowIfNull(path);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
string extension = Extension(path);
|
string extension = Extension(path);
|
||||||
|
|
||||||
@ -640,10 +631,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
// Function to get the Win32 application, given the path to the application
|
// Function to get the Win32 application, given the path to the application
|
||||||
public static Win32Program GetAppFromPath(string path)
|
public static Win32Program GetAppFromPath(string path)
|
||||||
{
|
{
|
||||||
if (path == null)
|
ArgumentNullException.ThrowIfNull(path);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
Win32Program app;
|
Win32Program app;
|
||||||
switch (GetAppTypeFromPath(path))
|
switch (GetAppTypeFromPath(path))
|
||||||
@ -985,10 +973,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
|
|
||||||
public static IList<Win32Program> All(ProgramPluginSettings settings)
|
public static IList<Win32Program> All(ProgramPluginSettings settings)
|
||||||
{
|
{
|
||||||
if (settings == null)
|
ArgumentNullException.ThrowIfNull(settings);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settings));
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -14,10 +14,7 @@ namespace Microsoft.Plugin.Program.Storage
|
|||||||
// On the first occurrence of a different file path, the existing app path is to be returned without removing any more elements from the queue.
|
// On the first occurrence of a different file path, the existing app path is to be returned without removing any more elements from the queue.
|
||||||
public static async Task<string> GetAppPathFromQueueAsync(ConcurrentQueue<string> eventHandlingQueue, int dequeueDelay)
|
public static async Task<string> GetAppPathFromQueueAsync(ConcurrentQueue<string> eventHandlingQueue, int dequeueDelay)
|
||||||
{
|
{
|
||||||
if (eventHandlingQueue == null)
|
ArgumentNullException.ThrowIfNull(eventHandlingQueue);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(eventHandlingQueue));
|
|
||||||
}
|
|
||||||
|
|
||||||
string previousAppPath = string.Empty;
|
string previousAppPath = string.Empty;
|
||||||
|
|
||||||
|
@ -52,10 +52,7 @@ namespace Microsoft.Plugin.Shell
|
|||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Result> results = new List<Result>();
|
List<Result> results = new List<Result>();
|
||||||
string cmd = query.Search;
|
string cmd = query.Search;
|
||||||
|
@ -26,15 +26,9 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
|||||||
/// <returns>returns the index location of each of the letters of the matches</returns>
|
/// <returns>returns the index location of each of the letters of the matches</returns>
|
||||||
internal static List<int> FindBestFuzzyMatch(string text, string searchText)
|
internal static List<int> FindBestFuzzyMatch(string text, string searchText)
|
||||||
{
|
{
|
||||||
if (searchText == null)
|
ArgumentNullException.ThrowIfNull(searchText);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(searchText));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (text == null)
|
ArgumentNullException.ThrowIfNull(text);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using CurrentCulture since this is user facing
|
// Using CurrentCulture since this is user facing
|
||||||
searchText = searchText.ToLower(CultureInfo.CurrentCulture);
|
searchText = searchText.ToLower(CultureInfo.CurrentCulture);
|
||||||
@ -86,10 +80,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
|||||||
/// <returns>a list of the possible combinations that match the search text</returns>
|
/// <returns>a list of the possible combinations that match the search text</returns>
|
||||||
internal static List<List<int>> GetAllMatchIndexes(bool[,] matches)
|
internal static List<List<int>> GetAllMatchIndexes(bool[,] matches)
|
||||||
{
|
{
|
||||||
if (matches == null)
|
ArgumentNullException.ThrowIfNull(matches);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(matches));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<List<int>> results = new List<List<int>>();
|
List<List<int>> results = new List<List<int>>();
|
||||||
|
|
||||||
@ -127,10 +118,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
|||||||
/// <returns>an integer representing the score</returns>
|
/// <returns>an integer representing the score</returns>
|
||||||
internal static int CalculateScoreForMatches(List<int> matches)
|
internal static int CalculateScoreForMatches(List<int> matches)
|
||||||
{
|
{
|
||||||
if (matches == null)
|
ArgumentNullException.ThrowIfNull(matches);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(matches));
|
|
||||||
}
|
|
||||||
|
|
||||||
var score = 0;
|
var score = 0;
|
||||||
|
|
||||||
|
@ -33,10 +33,7 @@ namespace Microsoft.Plugin.WindowWalker
|
|||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
_cancellationTokenSource?.Cancel();
|
_cancellationTokenSource?.Cancel();
|
||||||
_cancellationTokenSource?.Dispose();
|
_cancellationTokenSource?.Dispose();
|
||||||
|
@ -57,10 +57,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
|||||||
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)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
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))
|
||||||
|
@ -36,15 +36,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
|||||||
/// <returns>Number translator for target culture</returns>
|
/// <returns>Number translator for target culture</returns>
|
||||||
public static NumberTranslator Create(CultureInfo sourceCulture, CultureInfo targetCulture)
|
public static NumberTranslator Create(CultureInfo sourceCulture, CultureInfo targetCulture)
|
||||||
{
|
{
|
||||||
if (sourceCulture == null)
|
ArgumentNullException.ThrowIfNull(sourceCulture);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(sourceCulture));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetCulture == null)
|
ArgumentNullException.ThrowIfNull(targetCulture);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(targetCulture));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new NumberTranslator(sourceCulture, targetCulture);
|
return new NumberTranslator(sourceCulture, targetCulture);
|
||||||
}
|
}
|
||||||
|
@ -80,15 +80,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Service.Helpers
|
|||||||
|
|
||||||
public static void ChangeStatus(ServiceResult serviceResult, Action action, IPublicAPI contextAPI)
|
public static void ChangeStatus(ServiceResult serviceResult, Action action, IPublicAPI contextAPI)
|
||||||
{
|
{
|
||||||
if (serviceResult == null)
|
ArgumentNullException.ThrowIfNull(serviceResult);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(serviceResult));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contextAPI == null)
|
ArgumentNullException.ThrowIfNull(contextAPI);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(contextAPI));
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -141,10 +135,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Service.Helpers
|
|||||||
|
|
||||||
private static string GetResultSubTitle(ServiceController serviceController)
|
private static string GetResultSubTitle(ServiceController serviceController)
|
||||||
{
|
{
|
||||||
if (serviceController == null)
|
ArgumentNullException.ThrowIfNull(serviceController);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(serviceController));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $"{Resources.wox_plugin_service_status}: {GetLocalizedStatus(serviceController.Status)} - {Resources.wox_plugin_service_startup}: {GetLocalizedStartType(serviceController.StartType, serviceController.ServiceName)} - {Resources.wox_plugin_service_name}: {serviceController.ServiceName}";
|
return $"{Resources.wox_plugin_service_status}: {GetLocalizedStatus(serviceController.Status)} - {Resources.wox_plugin_service_startup}: {GetLocalizedStartType(serviceController.StartType, serviceController.ServiceName)} - {Resources.wox_plugin_service_name}: {serviceController.ServiceName}";
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Service
|
|||||||
|
|
||||||
public ServiceResult(ServiceController serviceController)
|
public ServiceResult(ServiceController serviceController)
|
||||||
{
|
{
|
||||||
if (serviceController == null)
|
ArgumentNullException.ThrowIfNull(serviceController);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(serviceController));
|
|
||||||
}
|
|
||||||
|
|
||||||
ServiceName = serviceController.ServiceName;
|
ServiceName = serviceController.ServiceName;
|
||||||
DisplayName = serviceController.DisplayName;
|
DisplayName = serviceController.DisplayName;
|
||||||
|
@ -63,10 +63,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate
|
|||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(paramName: nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
return SearchController.ExecuteSearch(query, IconTheme);
|
return SearchController.ExecuteSearch(query, IconTheme);
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,7 @@ namespace PowerLauncher.Helper
|
|||||||
|
|
||||||
public static void SetDragImage(this IDataObject dataObject, IntPtr hBitmap, int width, int height)
|
public static void SetDragImage(this IDataObject dataObject, IntPtr hBitmap, int width, int height)
|
||||||
{
|
{
|
||||||
if (dataObject == null)
|
ArgumentNullException.ThrowIfNull(dataObject);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(dataObject));
|
|
||||||
}
|
|
||||||
|
|
||||||
IDragSourceHelper dragDropHelper = (IDragSourceHelper)new DragDropHelper();
|
IDragSourceHelper dragDropHelper = (IDragSourceHelper)new DragDropHelper();
|
||||||
ShDragImage dragImage = new ShDragImage
|
ShDragImage dragImage = new ShDragImage
|
||||||
|
@ -75,10 +75,7 @@ namespace PowerLauncher.Helper
|
|||||||
|
|
||||||
public static FamilyTypeface ChooseRegularFamilyTypeface(this FontFamily family)
|
public static FamilyTypeface ChooseRegularFamilyTypeface(this FontFamily family)
|
||||||
{
|
{
|
||||||
if (family == null)
|
ArgumentNullException.ThrowIfNull(family);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(family));
|
|
||||||
}
|
|
||||||
|
|
||||||
return family.FamilyTypefaces.OrderBy(o =>
|
return family.FamilyTypefaces.OrderBy(o =>
|
||||||
{
|
{
|
||||||
@ -90,10 +87,7 @@ namespace PowerLauncher.Helper
|
|||||||
|
|
||||||
public static FamilyTypeface ConvertFromInvariantStringsOrNormal(this FontFamily family, string style, string weight, string stretch)
|
public static FamilyTypeface ConvertFromInvariantStringsOrNormal(this FontFamily family, string style, string weight, string stretch)
|
||||||
{
|
{
|
||||||
if (family == null)
|
ArgumentNullException.ThrowIfNull(family);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(family));
|
|
||||||
}
|
|
||||||
|
|
||||||
var styleObj = GetFontStyleFromInvariantStringOrNormal(style);
|
var styleObj = GetFontStyleFromInvariantStringOrNormal(style);
|
||||||
var weightObj = GetFontWeightFromInvariantStringOrNormal(weight);
|
var weightObj = GetFontWeightFromInvariantStringOrNormal(weight);
|
||||||
|
@ -165,10 +165,7 @@ namespace PowerLauncher.Plugin
|
|||||||
|
|
||||||
public static List<Result> QueryForPlugin(PluginPair pair, Query query, bool delayedExecution = false)
|
public static List<Result> QueryForPlugin(PluginPair pair, Query query, bool delayedExecution = false)
|
||||||
{
|
{
|
||||||
if (pair == null)
|
ArgumentNullException.ThrowIfNull(pair);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(pair));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pair.IsPluginInitialized)
|
if (!pair.IsPluginInitialized)
|
||||||
{
|
{
|
||||||
@ -249,15 +246,9 @@ namespace PowerLauncher.Plugin
|
|||||||
|
|
||||||
public static void UpdatePluginMetadata(List<Result> results, PluginMetadata metadata, Query query)
|
public static void UpdatePluginMetadata(List<Result> results, PluginMetadata metadata, Query query)
|
||||||
{
|
{
|
||||||
if (results == null)
|
ArgumentNullException.ThrowIfNull(results);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(results));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (metadata == null)
|
ArgumentNullException.ThrowIfNull(metadata);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(metadata));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var r in results)
|
foreach (var r in results)
|
||||||
{
|
{
|
||||||
|
@ -12,10 +12,7 @@ namespace PowerLauncher.Plugin
|
|||||||
{
|
{
|
||||||
public static Dictionary<PluginPair, Query> Build(string text)
|
public static Dictionary<PluginPair, Query> Build(string text)
|
||||||
{
|
{
|
||||||
if (text == null)
|
ArgumentNullException.ThrowIfNull(text);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
text = text.Trim();
|
text = text.Trim();
|
||||||
int longestActionKeywordLength = 0;
|
int longestActionKeywordLength = 0;
|
||||||
|
@ -1003,15 +1003,9 @@ namespace PowerLauncher.ViewModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateResultView(List<Result> list, string originQuery, CancellationToken ct)
|
public void UpdateResultView(List<Result> list, string originQuery, CancellationToken ct)
|
||||||
{
|
{
|
||||||
if (list == null)
|
ArgumentNullException.ThrowIfNull(list);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (originQuery == null)
|
ArgumentNullException.ThrowIfNull(originQuery);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(originQuery));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var result in list)
|
foreach (var result in list)
|
||||||
{
|
{
|
||||||
|
@ -263,10 +263,7 @@ namespace PowerLauncher.ViewModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddResults(List<Result> newRawResults, CancellationToken ct)
|
public void AddResults(List<Result> newRawResults, CancellationToken ct)
|
||||||
{
|
{
|
||||||
if (newRawResults == null)
|
ArgumentNullException.ThrowIfNull(newRawResults);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(newRawResults));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ResultViewModel> newResults = new List<ResultViewModel>(newRawResults.Count);
|
List<ResultViewModel> newResults = new List<ResultViewModel>(newRawResults.Count);
|
||||||
foreach (Result r in newRawResults)
|
foreach (Result r in newRawResults)
|
||||||
|
@ -20,20 +20,14 @@ namespace Wox.Infrastructure
|
|||||||
|
|
||||||
public static FuzzyMatcher Create(string query)
|
public static FuzzyMatcher Create(string query)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FuzzyMatcher(query, new MatchOption());
|
return new FuzzyMatcher(query, new MatchOption());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FuzzyMatcher Create(string query, MatchOption opt)
|
public static FuzzyMatcher Create(string query, MatchOption opt)
|
||||||
{
|
{
|
||||||
if (query == null)
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FuzzyMatcher(query, opt);
|
return new FuzzyMatcher(query, opt);
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,7 @@ namespace Wox.Infrastructure
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static long Debug(string message, Action action)
|
public static long Debug(string message, Action action)
|
||||||
{
|
{
|
||||||
if (action == null)
|
ArgumentNullException.ThrowIfNull(action);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(action));
|
|
||||||
}
|
|
||||||
|
|
||||||
var stopWatch = new System.Diagnostics.Stopwatch();
|
var stopWatch = new System.Diagnostics.Stopwatch();
|
||||||
stopWatch.Start();
|
stopWatch.Start();
|
||||||
@ -36,10 +33,7 @@ namespace Wox.Infrastructure
|
|||||||
|
|
||||||
public static long Normal(string message, Action action)
|
public static long Normal(string message, Action action)
|
||||||
{
|
{
|
||||||
if (action == null)
|
ArgumentNullException.ThrowIfNull(action);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(action));
|
|
||||||
}
|
|
||||||
|
|
||||||
var stopWatch = new System.Diagnostics.Stopwatch();
|
var stopWatch = new System.Diagnostics.Stopwatch();
|
||||||
stopWatch.Start();
|
stopWatch.Start();
|
||||||
@ -53,10 +47,7 @@ namespace Wox.Infrastructure
|
|||||||
|
|
||||||
public static void StartCount(string name, Action action)
|
public static void StartCount(string name, Action action)
|
||||||
{
|
{
|
||||||
if (action == null)
|
ArgumentNullException.ThrowIfNull(action);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(action));
|
|
||||||
}
|
|
||||||
|
|
||||||
var stopWatch = new System.Diagnostics.Stopwatch();
|
var stopWatch = new System.Diagnostics.Stopwatch();
|
||||||
stopWatch.Start();
|
stopWatch.Start();
|
||||||
|
@ -105,10 +105,7 @@ namespace Wox.Infrastructure.Storage
|
|||||||
|
|
||||||
public StoragePowerToysVersionInfo(string associatedFilePath, int type)
|
public StoragePowerToysVersionInfo(string associatedFilePath, int type)
|
||||||
{
|
{
|
||||||
if (associatedFilePath == null)
|
ArgumentNullException.ThrowIfNull(associatedFilePath);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(associatedFilePath));
|
|
||||||
}
|
|
||||||
|
|
||||||
FilePath = GetFilePath(associatedFilePath, type);
|
FilePath = GetFilePath(associatedFilePath, type);
|
||||||
|
|
||||||
|
@ -90,10 +90,7 @@ namespace Wox.Infrastructure
|
|||||||
return new MatchResult(false, UserSettingSearchPrecision);
|
return new MatchResult(false, UserSettingSearchPrecision);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt == null)
|
ArgumentNullException.ThrowIfNull(opt);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(opt));
|
|
||||||
}
|
|
||||||
|
|
||||||
query = query.Trim();
|
query = query.Trim();
|
||||||
|
|
||||||
|
@ -21,10 +21,7 @@ namespace Wox.Plugin
|
|||||||
|
|
||||||
public static bool IsAllowed(string language)
|
public static bool IsAllowed(string language)
|
||||||
{
|
{
|
||||||
if (language == null)
|
ArgumentNullException.ThrowIfNull(language);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(language));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using InvariantCulture since this is a command line arg
|
// Using InvariantCulture since this is a command line arg
|
||||||
return language.ToUpper(CultureInfo.InvariantCulture) == CSharp.ToUpper(CultureInfo.InvariantCulture)
|
return language.ToUpper(CultureInfo.InvariantCulture) == CSharp.ToUpper(CultureInfo.InvariantCulture)
|
||||||
|
@ -18,10 +18,7 @@ namespace Wox.Plugin.Common
|
|||||||
|
|
||||||
public static Process RunAsDifferentUser(ProcessStartInfo processStartInfo)
|
public static Process RunAsDifferentUser(ProcessStartInfo processStartInfo)
|
||||||
{
|
{
|
||||||
if (processStartInfo == null)
|
ArgumentNullException.ThrowIfNull(processStartInfo);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(processStartInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
processStartInfo.Verb = "RunAsUser";
|
processStartInfo.Verb = "RunAsUser";
|
||||||
var process = Process.Start(processStartInfo);
|
var process = Process.Start(processStartInfo);
|
||||||
|
@ -77,50 +77,35 @@ namespace Wox.Plugin.Logger
|
|||||||
|
|
||||||
public static void Info(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
public static void Info(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
||||||
{
|
{
|
||||||
if (fullClassName == null)
|
ArgumentNullException.ThrowIfNull(fullClassName);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(fullClassName));
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInternal(LogLevel.Info, message, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
LogInternal(LogLevel.Info, message, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Debug(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
public static void Debug(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
||||||
{
|
{
|
||||||
if (fullClassName == null)
|
ArgumentNullException.ThrowIfNull(fullClassName);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(fullClassName));
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInternal(LogLevel.Debug, message, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
LogInternal(LogLevel.Debug, message, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Warn(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
public static void Warn(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
||||||
{
|
{
|
||||||
if (fullClassName == null)
|
ArgumentNullException.ThrowIfNull(fullClassName);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(fullClassName));
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInternal(LogLevel.Warn, message, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
LogInternal(LogLevel.Warn, message, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Error(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
public static void Error(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
||||||
{
|
{
|
||||||
if (fullClassName == null)
|
ArgumentNullException.ThrowIfNull(fullClassName);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(fullClassName));
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInternal(LogLevel.Error, message, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
LogInternal(LogLevel.Error, message, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Exception(string message, System.Exception ex, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
public static void Exception(string message, System.Exception ex, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
||||||
{
|
{
|
||||||
if (fullClassName == null)
|
ArgumentNullException.ThrowIfNull(fullClassName);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(fullClassName));
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInternalException(message, ex, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
LogInternalException(message, ex, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,7 @@ namespace Wox.Plugin
|
|||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
ArgumentNullException.ThrowIfNull(value);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using Ordinal since this is used internally
|
// Using Ordinal since this is used internally
|
||||||
_title = value.Replace("\n", " ", StringComparison.Ordinal);
|
_title = value.Replace("\n", " ", StringComparison.Ordinal);
|
||||||
|
@ -34,20 +34,14 @@ namespace Wox.Plugin
|
|||||||
|
|
||||||
public void Remove(Result result)
|
public void Remove(Result result)
|
||||||
{
|
{
|
||||||
if (result == null)
|
ArgumentNullException.ThrowIfNull(result);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(result));
|
|
||||||
}
|
|
||||||
|
|
||||||
Records.Remove(result.ToString());
|
Records.Remove(result.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(Result result)
|
public void Add(Result result)
|
||||||
{
|
{
|
||||||
if (result == null)
|
ArgumentNullException.ThrowIfNull(result);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(result));
|
|
||||||
}
|
|
||||||
|
|
||||||
var key = result.ToString();
|
var key = result.ToString();
|
||||||
if (Records.TryGetValue(key, out var value))
|
if (Records.TryGetValue(key, out var value))
|
||||||
@ -81,10 +75,7 @@ namespace Wox.Plugin
|
|||||||
|
|
||||||
public UserSelectedRecordItem GetSelectedData(Result result)
|
public UserSelectedRecordItem GetSelectedData(Result result)
|
||||||
{
|
{
|
||||||
if (result == null)
|
ArgumentNullException.ThrowIfNull(result);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(result));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result != null && Records.TryGetValue(result.ToString(), out var value))
|
if (result != null && Records.TryGetValue(result.ToString(), out var value))
|
||||||
{
|
{
|
||||||
|
@ -24,10 +24,7 @@ namespace Microsoft.PowerToys.STATestExtension
|
|||||||
|
|
||||||
public override TestResult[] Execute(ITestMethod testMethod)
|
public override TestResult[] Execute(ITestMethod testMethod)
|
||||||
{
|
{
|
||||||
if (testMethod == null)
|
ArgumentNullException.ThrowIfNull(testMethod);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(testMethod));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
|
if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
|
||||||
{
|
{
|
||||||
|
@ -25,10 +25,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
|
|
||||||
public bool Compare(AppSpecificKeysDataModel arg)
|
public bool Compare(AppSpecificKeysDataModel arg)
|
||||||
{
|
{
|
||||||
if (arg == null)
|
ArgumentNullException.ThrowIfNull(arg);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(arg));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using Ordinal comparison for internal text
|
// Using Ordinal comparison for internal text
|
||||||
return OriginalKeys.Equals(arg.OriginalKeys, StringComparison.Ordinal) &&
|
return OriginalKeys.Equals(arg.OriginalKeys, StringComparison.Ordinal) &&
|
||||||
|
@ -34,10 +34,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
|
|
||||||
public FileLocksmithSettings(FileLocksmithLocalProperties localProperties)
|
public FileLocksmithSettings(FileLocksmithLocalProperties localProperties)
|
||||||
{
|
{
|
||||||
if (localProperties == null)
|
ArgumentNullException.ThrowIfNull(localProperties);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(localProperties));
|
|
||||||
}
|
|
||||||
|
|
||||||
Properties = new FileLocksmithProperties();
|
Properties = new FileLocksmithProperties();
|
||||||
Properties.ExtendedContextMenuOnly.Value = localProperties.ExtendedContextMenuOnly;
|
Properties.ExtendedContextMenuOnly.Value = localProperties.ExtendedContextMenuOnly;
|
||||||
|
@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
||||||
}
|
}
|
||||||
|
@ -225,10 +225,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
|
|
||||||
public void Update(ImageSize modifiedSize)
|
public void Update(ImageSize modifiedSize)
|
||||||
{
|
{
|
||||||
if (modifiedSize == null)
|
ArgumentNullException.ThrowIfNull(modifiedSize);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(modifiedSize));
|
|
||||||
}
|
|
||||||
|
|
||||||
Id = modifiedSize.Id;
|
Id = modifiedSize.Id;
|
||||||
Name = modifiedSize.Name;
|
Name = modifiedSize.Name;
|
||||||
|
@ -98,10 +98,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
IncludeFields = true,
|
IncludeFields = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
|
|
||||||
public PowerRenameSettings(PowerRenameLocalProperties localProperties)
|
public PowerRenameSettings(PowerRenameLocalProperties localProperties)
|
||||||
{
|
{
|
||||||
if (localProperties == null)
|
ArgumentNullException.ThrowIfNull(localProperties);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(localProperties));
|
|
||||||
}
|
|
||||||
|
|
||||||
Properties = new PowerRenameProperties();
|
Properties = new PowerRenameProperties();
|
||||||
Properties.PersistState.Value = localProperties.PersistState;
|
Properties.PersistState.Value = localProperties.PersistState;
|
||||||
|
@ -858,10 +858,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static JsonArray GetPTRunIgnoredSettings(JsonNode backupRetoreSettings)
|
private static JsonArray GetPTRunIgnoredSettings(JsonNode backupRetoreSettings)
|
||||||
{
|
{
|
||||||
if (backupRetoreSettings == null)
|
ArgumentNullException.ThrowIfNull(backupRetoreSettings);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(backupRetoreSettings));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (backupRetoreSettings["IgnoredPTRunSettings"] != null)
|
if (backupRetoreSettings["IgnoredPTRunSettings"] != null)
|
||||||
{
|
{
|
||||||
@ -876,10 +873,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static string[] GetIgnoredSettings(JsonNode backupRetoreSettings, string settingFileKey)
|
private static string[] GetIgnoredSettings(JsonNode backupRetoreSettings, string settingFileKey)
|
||||||
{
|
{
|
||||||
if (backupRetoreSettings == null)
|
ArgumentNullException.ThrowIfNull(backupRetoreSettings);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(backupRetoreSettings));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settingFileKey.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
|
if (settingFileKey.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -118,10 +118,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(version1));
|
throw new ArgumentNullException(nameof(version1));
|
||||||
}
|
}
|
||||||
else if (version2 == null)
|
else ArgumentNullException.ThrowIfNull(version2);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(version2));
|
|
||||||
}
|
|
||||||
|
|
||||||
var v1 = version1.Substring(1).Split('.').Select(int.Parse).ToArray();
|
var v1 = version1.Substring(1).Split('.').Select(int.Parse).ToArray();
|
||||||
var v2 = version2.Substring(1).Split('.').Select(int.Parse).ToArray();
|
var v2 = version2.Substring(1).Split('.').Select(int.Parse).ToArray();
|
||||||
|
@ -86,10 +86,7 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility
|
|||||||
|
|
||||||
public static void VerifyModuleIOProviderWasRead(Mock<IFile> provider, string module, int expectedCallCount)
|
public static void VerifyModuleIOProviderWasRead(Mock<IFile> provider, string module, int expectedCallCount)
|
||||||
{
|
{
|
||||||
if (provider == null)
|
ArgumentNullException.ThrowIfNull(provider);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(provider));
|
|
||||||
}
|
|
||||||
|
|
||||||
Expression<Func<string, bool>> filterExpression = ModuleFilterExpression(module);
|
Expression<Func<string, bool>> filterExpression = ModuleFilterExpression(module);
|
||||||
|
|
||||||
@ -110,10 +107,7 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility
|
|||||||
|
|
||||||
public static void VerifyGeneralSettingsIOProviderWasRead(Mock<IFile> provider, int expectedCallCount)
|
public static void VerifyGeneralSettingsIOProviderWasRead(Mock<IFile> provider, int expectedCallCount)
|
||||||
{
|
{
|
||||||
if (provider == null)
|
ArgumentNullException.ThrowIfNull(provider);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(provider));
|
|
||||||
}
|
|
||||||
|
|
||||||
IIOProviderMocks.VerifyIOReadWithStubFile(provider, SettingsFilterExpression, expectedCallCount);
|
IIOProviderMocks.VerifyIOReadWithStubFile(provider, SettingsFilterExpression, expectedCallCount);
|
||||||
}
|
}
|
||||||
|
@ -26,28 +26,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
public AlwaysOnTopViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<AlwaysOnTopSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
public AlwaysOnTopViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<AlwaysOnTopSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
||||||
{
|
{
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsUtils = settingsUtils;
|
SettingsUtils = settingsUtils;
|
||||||
|
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
InitializeEnabledValue();
|
InitializeEnabledValue();
|
||||||
|
|
||||||
// To obtain the settings configurations of AlwaysOnTop.
|
// To obtain the settings configurations of AlwaysOnTop.
|
||||||
if (moduleSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(moduleSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(moduleSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings = moduleSettingsRepository.SettingsConfig;
|
Settings = moduleSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -49,10 +49,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
Func<string, int> ipcMSGCallBackFunc)
|
Func<string, int> ipcMSGCallBackFunc)
|
||||||
{
|
{
|
||||||
// Obtain the general PowerToy settings configurations
|
// Obtain the general PowerToy settings configurations
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -46,27 +46,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
public FancyZonesViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FancyZonesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
|
public FancyZonesViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FancyZonesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
|
||||||
{
|
{
|
||||||
if (settingsUtils == null)
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsUtils));
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsUtils = settingsUtils;
|
SettingsUtils = settingsUtils;
|
||||||
|
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
settingsConfigFileFolder = configFileSubfolder;
|
settingsConfigFileFolder = configFileSubfolder;
|
||||||
|
|
||||||
// To obtain the settings configurations of Fancy zones.
|
// To obtain the settings configurations of Fancy zones.
|
||||||
if (moduleSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(moduleSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(moduleSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings = moduleSettingsRepository.SettingsConfig;
|
Settings = moduleSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -29,10 +29,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
||||||
|
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -83,10 +83,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
ResourceLoader = resourceLoader;
|
ResourceLoader = resourceLoader;
|
||||||
|
|
||||||
// To obtain the general settings configuration of PowerToys if it exists, else to create a new file and return the default configurations.
|
// To obtain the general settings configuration of PowerToys if it exists, else to create a new file and return the default configurations.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
UpdatingSettingsConfig = UpdatingSettings.LoadSettings();
|
UpdatingSettingsConfig = UpdatingSettings.LoadSettings();
|
||||||
|
@ -32,10 +32,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
||||||
|
|
||||||
// To obtain the general settings configurations of PowerToys.
|
// To obtain the general settings configurations of PowerToys.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -55,10 +55,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
public KeyboardManagerViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<List<KeysDataModel>, int> filterRemapKeysList)
|
public KeyboardManagerViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<List<KeysDataModel>, int> filterRemapKeysList)
|
||||||
{
|
{
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -29,19 +29,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
SettingsUtils = settingsUtils;
|
SettingsUtils = settingsUtils;
|
||||||
|
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
InitializeEnabledValue();
|
InitializeEnabledValue();
|
||||||
|
|
||||||
if (measureToolSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(measureToolSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(measureToolSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings = measureToolSettingsRepository.SettingsConfig;
|
Settings = measureToolSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
SettingsUtils = settingsUtils;
|
SettingsUtils = settingsUtils;
|
||||||
|
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
@ -42,10 +39,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
// To obtain the find my mouse settings, if the file exists.
|
// To obtain the find my mouse settings, if the file exists.
|
||||||
// If not, to create a file with the default settings and to return the default configurations.
|
// If not, to create a file with the default settings and to return the default configurations.
|
||||||
if (findMyMouseSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(findMyMouseSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(findMyMouseSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
FindMyMouseSettingsConfig = findMyMouseSettingsRepository.SettingsConfig;
|
FindMyMouseSettingsConfig = findMyMouseSettingsRepository.SettingsConfig;
|
||||||
_findMyMouseActivationMethod = FindMyMouseSettingsConfig.Properties.ActivationMethod.Value;
|
_findMyMouseActivationMethod = FindMyMouseSettingsConfig.Properties.ActivationMethod.Value;
|
||||||
@ -64,10 +58,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
_findMyMouseExcludedApps = FindMyMouseSettingsConfig.Properties.ExcludedApps.Value;
|
_findMyMouseExcludedApps = FindMyMouseSettingsConfig.Properties.ExcludedApps.Value;
|
||||||
_findMyMouseShakingMinimumDistance = FindMyMouseSettingsConfig.Properties.ShakingMinimumDistance.Value;
|
_findMyMouseShakingMinimumDistance = FindMyMouseSettingsConfig.Properties.ShakingMinimumDistance.Value;
|
||||||
|
|
||||||
if (mouseHighlighterSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(mouseHighlighterSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(mouseHighlighterSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseHighlighterSettingsConfig = mouseHighlighterSettingsRepository.SettingsConfig;
|
MouseHighlighterSettingsConfig = mouseHighlighterSettingsRepository.SettingsConfig;
|
||||||
string leftClickColor = MouseHighlighterSettingsConfig.Properties.LeftButtonClickColor.Value;
|
string leftClickColor = MouseHighlighterSettingsConfig.Properties.LeftButtonClickColor.Value;
|
||||||
@ -84,18 +75,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
_highlightFadeDurationMs = MouseHighlighterSettingsConfig.Properties.HighlightFadeDurationMs.Value;
|
_highlightFadeDurationMs = MouseHighlighterSettingsConfig.Properties.HighlightFadeDurationMs.Value;
|
||||||
_highlighterAutoActivate = MouseHighlighterSettingsConfig.Properties.AutoActivate.Value;
|
_highlighterAutoActivate = MouseHighlighterSettingsConfig.Properties.AutoActivate.Value;
|
||||||
|
|
||||||
if (mouseJumpSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(mouseJumpSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(mouseJumpSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseJumpSettingsConfig = mouseJumpSettingsRepository.SettingsConfig;
|
MouseJumpSettingsConfig = mouseJumpSettingsRepository.SettingsConfig;
|
||||||
MouseJumpSettingsConfig.Properties.ThumbnailSize.PropertyChanged += MouseJumpThumbnailSizePropertyChanged;
|
MouseJumpSettingsConfig.Properties.ThumbnailSize.PropertyChanged += MouseJumpThumbnailSizePropertyChanged;
|
||||||
|
|
||||||
if (mousePointerCrosshairsSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(mousePointerCrosshairsSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(mousePointerCrosshairsSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
MousePointerCrosshairsSettingsConfig = mousePointerCrosshairsSettingsRepository.SettingsConfig;
|
MousePointerCrosshairsSettingsConfig = mousePointerCrosshairsSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -379,10 +379,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
_uiDispatcherQueue = uiDispatcherQueue;
|
_uiDispatcherQueue = uiDispatcherQueue;
|
||||||
|
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
@ -470,10 +467,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
private void LoadViewModelFromSettings(MouseWithoutBordersSettings moduleSettings)
|
private void LoadViewModelFromSettings(MouseWithoutBordersSettings moduleSettings)
|
||||||
{
|
{
|
||||||
if (moduleSettings == null)
|
ArgumentNullException.ThrowIfNull(moduleSettings);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(moduleSettings));
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings = moduleSettings;
|
Settings = moduleSettings;
|
||||||
/* TODO: Error handling */
|
/* TODO: Error handling */
|
||||||
|
@ -41,25 +41,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
Func<string, int> ipcMSGCallBackFunc)
|
Func<string, int> ipcMSGCallBackFunc)
|
||||||
{
|
{
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
// To obtain the settings configurations of Fancy zones.
|
// To obtain the settings configurations of Fancy zones.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
||||||
|
|
||||||
if (pastePlainSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(pastePlainSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(pastePlainSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
_pastePlainSettings = pastePlainSettingsRepository.SettingsConfig;
|
_pastePlainSettings = pastePlainSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -29,10 +29,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
public PeekViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
public PeekViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
||||||
{
|
{
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -73,10 +73,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
public PowerAccentViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
public PowerAccentViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
||||||
{
|
{
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
@ -56,10 +56,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
this.isDark = isDark;
|
this.isDark = isDark;
|
||||||
|
|
||||||
// To obtain the general Settings configurations of PowerToys
|
// To obtain the general Settings configurations of PowerToys
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -73,25 +73,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
Func<string, int> ipcMSGCallBackFunc)
|
Func<string, int> ipcMSGCallBackFunc)
|
||||||
{
|
{
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
// To obtain the settings configurations of Fancy zones.
|
// To obtain the settings configurations of Fancy zones.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
||||||
|
|
||||||
if (powerOcrsettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(powerOcrsettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(powerOcrsettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
_powerOcrSettings = powerOcrsettingsRepository.SettingsConfig;
|
_powerOcrSettings = powerOcrsettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -30,19 +30,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
_settingsConfigFileFolder = configFileSubfolder;
|
_settingsConfigFileFolder = configFileSubfolder;
|
||||||
|
|
||||||
// To obtain the general Settings configurations of PowerToys
|
// To obtain the general Settings configurations of PowerToys
|
||||||
if (generalSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(generalSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(generalSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = generalSettingsRepository.SettingsConfig;
|
GeneralSettingsConfig = generalSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
// To obtain the PowerPreview settings if it exists.
|
// To obtain the PowerPreview settings if it exists.
|
||||||
// If the file does not exist, to create a new one and return the default settings configurations.
|
// If the file does not exist, to create a new one and return the default settings configurations.
|
||||||
if (moduleSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(moduleSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(moduleSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings = moduleSettingsRepository.SettingsConfig;
|
Settings = moduleSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -33,10 +33,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
_settingsConfigFileFolder = configFileSubfolder;
|
_settingsConfigFileFolder = configFileSubfolder;
|
||||||
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
||||||
|
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -22,10 +22,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
public RegistryPreviewViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<RegistryPreviewSettings> registryPreviewSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
public RegistryPreviewViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<RegistryPreviewSettings> registryPreviewSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
||||||
{
|
{
|
||||||
// To obtain the general settings configurations of PowerToys Settings.
|
// To obtain the general settings configurations of PowerToys Settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -34,19 +34,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
_settingsConfigFileFolder = configFileSubfolder;
|
_settingsConfigFileFolder = configFileSubfolder;
|
||||||
|
|
||||||
// To obtain the general PowerToys settings.
|
// To obtain the general PowerToys settings.
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
// To obtain the shortcut guide settings, if the file exists.
|
// To obtain the shortcut guide settings, if the file exists.
|
||||||
// If not, to create a file with the default settings and to return the default configurations.
|
// If not, to create a file with the default settings and to return the default configurations.
|
||||||
if (moduleSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(moduleSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(moduleSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings = moduleSettingsRepository.SettingsConfig;
|
Settings = moduleSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
@ -44,10 +44,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
PickFileDialog = pickFileDialog;
|
PickFileDialog = pickFileDialog;
|
||||||
|
|
||||||
if (settingsRepository == null)
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(settingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||||
|
|
||||||
@ -57,10 +54,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
_settingsConfigFileFolder = configFileSubfolder;
|
_settingsConfigFileFolder = configFileSubfolder;
|
||||||
|
|
||||||
if (videoConferenceSettingsRepository == null)
|
ArgumentNullException.ThrowIfNull(videoConferenceSettingsRepository);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(videoConferenceSettingsRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings = videoConferenceSettingsRepository.SettingsConfig;
|
Settings = videoConferenceSettingsRepository.SettingsConfig;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user