mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
more braces and whitespace style errors (#5951)
This commit is contained in:
@@ -36,7 +36,6 @@ namespace Microsoft.Plugin.Program.Programs.ApplicationActivationHelper
|
||||
[Guid("45BA127D-10A8-46EA-8AB7-56EA9078943C")]
|
||||
public class ApplicationActivationManager : IApplicationActivationManager
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)/*, PreserveSig*/]
|
||||
public extern IntPtr ActivateApplication([In] string appUserModelId, [In] string arguments, [In] ActivateOptions options, [Out] out uint processId);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using Windows.Foundation;
|
||||
|
||||
namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This is a simple wrapper class around the PackageCatalog to facilitate unit testing.
|
||||
/// </summary>
|
||||
|
||||
@@ -23,7 +23,9 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
|
||||
public string InstalledLocation { get; } = string.Empty;
|
||||
|
||||
public PackageWrapper() { }
|
||||
public PackageWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
public PackageWrapper(string Name, string FullName, string FamilyName, bool IsFramework, bool IsDevelopmentMode, string InstalledLocation)
|
||||
{
|
||||
@@ -65,8 +67,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
package.Id.FamilyName,
|
||||
package.IsFramework,
|
||||
package.IsDevelopmentMode,
|
||||
path
|
||||
);
|
||||
path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,10 +98,8 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
Where(a => a.IsNamespaceDeclaration).
|
||||
GroupBy(
|
||||
a => a.Name.Namespace == XNamespace.None ? string.Empty : a.Name.LocalName,
|
||||
a => XNamespace.Get(a.Value)
|
||||
).Select(
|
||||
g => g.First().ToString()
|
||||
).ToArray();
|
||||
a => XNamespace.Get(a.Value)).Select(
|
||||
g => g.First().ToString()).ToArray();
|
||||
return namespaces;
|
||||
}
|
||||
else
|
||||
@@ -116,9 +114,9 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
var versionFromNamespace = new Dictionary<string, PackageVersion>
|
||||
{
|
||||
{"http://schemas.microsoft.com/appx/manifest/foundation/windows10", PackageVersion.Windows10},
|
||||
{"http://schemas.microsoft.com/appx/2013/manifest", PackageVersion.Windows81},
|
||||
{"http://schemas.microsoft.com/appx/2010/manifest", PackageVersion.Windows8},
|
||||
{ "http://schemas.microsoft.com/appx/manifest/foundation/windows10", PackageVersion.Windows10 },
|
||||
{ "http://schemas.microsoft.com/appx/2013/manifest", PackageVersion.Windows81 },
|
||||
{ "http://schemas.microsoft.com/appx/2010/manifest", PackageVersion.Windows8 },
|
||||
};
|
||||
|
||||
foreach (var n in versionFromNamespace.Keys)
|
||||
|
||||
@@ -26,7 +26,6 @@ using static Microsoft.Plugin.Program.Programs.UWP;
|
||||
|
||||
namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
public class UWPApplication : IProgram
|
||||
{
|
||||
@@ -130,7 +129,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
Glyph = "\xE7EF",
|
||||
FontFamily = "Segoe MDL2 Assets",
|
||||
AcceleratorKey = Key.Enter,
|
||||
AcceleratorModifiers = (ModifierKeys.Control | ModifierKeys.Shift),
|
||||
AcceleratorModifiers = ModifierKeys.Control | ModifierKeys.Shift,
|
||||
Action = _ =>
|
||||
{
|
||||
string command = "shell:AppsFolder\\" + UniqueIdentifier;
|
||||
@@ -142,8 +141,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
Process.Start(info);
|
||||
return true;
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
contextMenus.Add(
|
||||
@@ -154,7 +152,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
Glyph = "\xE838",
|
||||
FontFamily = "Segoe MDL2 Assets",
|
||||
AcceleratorKey = Key.E,
|
||||
AcceleratorModifiers = (ModifierKeys.Control | ModifierKeys.Shift),
|
||||
AcceleratorModifiers = ModifierKeys.Control | ModifierKeys.Shift,
|
||||
Action = _ =>
|
||||
{
|
||||
Main.StartProcess(Process.Start, new ProcessStartInfo("explorer", Package.Location));
|
||||
|
||||
@@ -23,7 +23,6 @@ using Wox.Plugin;
|
||||
|
||||
namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
public class Win32Program : IProgram
|
||||
{
|
||||
@@ -211,7 +210,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
FileName = LnkResolvedPath ?? FullPath,
|
||||
WorkingDirectory = ParentDirectory,
|
||||
UseShellExecute = true
|
||||
UseShellExecute = true,
|
||||
};
|
||||
|
||||
Main.StartProcess(Process.Start, info);
|
||||
@@ -250,7 +249,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
Glyph = "\xE7EF",
|
||||
FontFamily = "Segoe MDL2 Assets",
|
||||
AcceleratorKey = Key.Enter,
|
||||
AcceleratorModifiers = (ModifierKeys.Control | ModifierKeys.Shift),
|
||||
AcceleratorModifiers = ModifierKeys.Control | ModifierKeys.Shift,
|
||||
Action = _ =>
|
||||
{
|
||||
var info = new ProcessStartInfo
|
||||
@@ -258,7 +257,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
FileName = FullPath,
|
||||
WorkingDirectory = ParentDirectory,
|
||||
Verb = "runas",
|
||||
UseShellExecute = true
|
||||
UseShellExecute = true,
|
||||
};
|
||||
|
||||
Task.Run(() => Main.StartProcess(Process.Start, info));
|
||||
@@ -276,7 +275,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
Glyph = "\xE838",
|
||||
FontFamily = "Segoe MDL2 Assets",
|
||||
AcceleratorKey = Key.E,
|
||||
AcceleratorModifiers = (ModifierKeys.Control | ModifierKeys.Shift),
|
||||
AcceleratorModifiers = ModifierKeys.Control | ModifierKeys.Shift,
|
||||
Action = _ =>
|
||||
{
|
||||
Main.StartProcess(Process.Start, new ProcessStartInfo("explorer", ParentDirectory));
|
||||
@@ -632,7 +631,6 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
// Function to obtain the list of applications, the locations of which have been added to the env variable PATH
|
||||
private static ParallelQuery<Win32Program> PathEnvironmentPrograms(IList<string> suffixes)
|
||||
{
|
||||
|
||||
// To get all the locations stored in the PATH env variable
|
||||
var pathEnvVariable = Environment.GetEnvironmentVariable("PATH");
|
||||
string[] searchPaths = pathEnvVariable.Split(Path.PathSeparator);
|
||||
@@ -756,17 +754,21 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
using (var key = root.OpenSubKey(subkey))
|
||||
{
|
||||
if (key == null)
|
||||
return string.Empty;
|
||||
|
||||
if (key == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var defaultValue = string.Empty;
|
||||
path = key.GetValue(defaultValue) as string;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return string.Empty;
|
||||
|
||||
// fix path like this: ""\"C:\\folder\\executable.exe\""
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
// fix path like this: ""\"C:\\folder\\executable.exe\""
|
||||
return path = path.Trim('"', ' ');
|
||||
}
|
||||
catch (Exception e) when (e is SecurityException || e is UnauthorizedAccessException)
|
||||
@@ -781,14 +783,18 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
|
||||
private static Win32Program GetProgramFromPath(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return new Win32Program();
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return new Win32Program();
|
||||
}
|
||||
|
||||
path = Environment.ExpandEnvironmentVariables(path);
|
||||
|
||||
if (!File.Exists(path))
|
||||
return new Win32Program();
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
return new Win32Program();
|
||||
}
|
||||
|
||||
var entry = CreateWin32Program(path);
|
||||
entry.ExecutableName = Path.GetFileName(path);
|
||||
|
||||
@@ -812,7 +818,6 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
public bool Equals(Win32Program app1, Win32Program app2)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(app1.Name) && !string.IsNullOrEmpty(app2.Name)
|
||||
&& !string.IsNullOrEmpty(app1.ExecutableName) && !string.IsNullOrEmpty(app2.ExecutableName)
|
||||
&& !string.IsNullOrEmpty(app1.FullPath) && !string.IsNullOrEmpty(app2.FullPath))
|
||||
|
||||
Reference in New Issue
Block a user