mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 05:06:36 +02:00
Dev/crutkas/fixing warnings (#5161)
* new lines & braces * Tabs /space auto fix Co-authored-by: Clint Rutkas <crutkas@microsoft.com>
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
}
|
||||
|
||||
// Extensions for adding run as admin context menu item for applications
|
||||
private readonly string[] appExtensions = { ".exe", ".bat", ".appref-ms", ".lnk" };
|
||||
private readonly string[] appExtensions = { ".exe", ".bat", ".appref-ms", ".lnk" };
|
||||
|
||||
public ContextMenuLoader(PluginInitContext context)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
}
|
||||
|
||||
// Test to check if File can be Run as admin, if yes, we add a 'run as admin' context menu item
|
||||
if(CanFileBeRunAsAdmin(record.Path))
|
||||
if (CanFileBeRunAsAdmin(record.Path))
|
||||
{
|
||||
contextMenus.Add(CreateRunAsAdminContextMenu(record));
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
Title = _context.API.GetTranslation("Microsoft_plugin_indexer_copy_path"),
|
||||
Glyph = "\xE8C8",
|
||||
FontFamily = "Segoe MDL2 Assets",
|
||||
AcceleratorKey = Key.C,
|
||||
AcceleratorKey = Key.C,
|
||||
AcceleratorModifiers = ModifierKeys.Control,
|
||||
|
||||
Action = (context) =>
|
||||
@@ -128,7 +128,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
Task.Run(() => Helper.RunAsAdmin(record.Path));
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Exception($"|Microsoft.Plugin.Indexer.ContextMenu| Failed to run {record.Path} as admin, {e.Message}", e);
|
||||
return false;
|
||||
@@ -142,9 +142,9 @@ namespace Microsoft.Plugin.Indexer
|
||||
private bool CanFileBeRunAsAdmin(string path)
|
||||
{
|
||||
string fileExtension = Path.GetExtension(path);
|
||||
foreach(string extension in appExtensions)
|
||||
foreach (string extension in appExtensions)
|
||||
{
|
||||
if(extension.Equals(fileExtension, StringComparison.OrdinalIgnoreCase))
|
||||
if (extension.Equals(fileExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -169,7 +169,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
{
|
||||
Process.Start("explorer.exe", $" /select,\"{record.Path}\"");
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
var message = $"Fail to open file at {record.Path}";
|
||||
LogException(message, e);
|
||||
|
||||
@@ -14,10 +14,10 @@ namespace Microsoft.Plugin.Indexer.DriveDetection
|
||||
{
|
||||
using (RegistryKey regKey = Registry.LocalMachine.OpenSubKey(registryLocation))
|
||||
{
|
||||
if(regKey != null)
|
||||
if (regKey != null)
|
||||
{
|
||||
Object value = regKey.GetValue(valueName);
|
||||
if(value != null)
|
||||
if (value != null)
|
||||
{
|
||||
return (int)value;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||
resultDisposed = true;
|
||||
}
|
||||
|
||||
if(conn.State == System.Data.ConnectionState.Closed)
|
||||
if (conn.State == System.Data.ConnectionState.Closed)
|
||||
{
|
||||
connDisposed = true;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||
List<OleDBResult> oleDBResults = WindowsIndexerSearch.Query(queryHelper.ConnectionString, sqlQuery);
|
||||
|
||||
// Loop over all records from the database
|
||||
foreach(OleDBResult oleDBResult in oleDBResults)
|
||||
foreach (OleDBResult oleDBResult in oleDBResults)
|
||||
{
|
||||
if (oleDBResult.fieldData[0] == DBNull.Value || oleDBResult.fieldData[1] == DBNull.Value || oleDBResult.fieldData[2] == DBNull.Value)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||
Title = (string)oleDBResult.fieldData[1]
|
||||
};
|
||||
_Result.Add(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _Result;
|
||||
@@ -105,7 +105,8 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||
|
||||
public IEnumerable<SearchResult> Search(string keyword, string pattern = "*", int maxCount = 30)
|
||||
{
|
||||
lock(_lock){
|
||||
lock (_lock)
|
||||
{
|
||||
ISearchQueryHelper queryHelper;
|
||||
InitQueryHelper(out queryHelper, maxCount);
|
||||
ModifyQueryHelper(ref queryHelper, pattern);
|
||||
|
||||
Reference in New Issue
Block a user