rename get program methods

This commit is contained in:
Jeremy Wu
2019-10-24 12:57:07 +11:00
parent 50896ee23b
commit 210e219778

View File

@@ -317,14 +317,14 @@ namespace Wox.Plugin.Program.Programs
{ {
if (root != null) if (root != null)
{ {
programs.AddRange(ProgramsFromRegistryKey(root)); programs.AddRange(GetProgramsFromRegistry(root));
} }
} }
using (var root = Registry.CurrentUser.OpenSubKey(appPaths)) using (var root = Registry.CurrentUser.OpenSubKey(appPaths))
{ {
if (root != null) if (root != null)
{ {
programs.AddRange(ProgramsFromRegistryKey(root)); programs.AddRange(GetProgramsFromRegistry(root));
} }
} }
@@ -336,16 +336,16 @@ namespace Wox.Plugin.Program.Programs
return filtered; return filtered;
} }
private static IEnumerable<Win32> ProgramsFromRegistryKey(RegistryKey root) private static IEnumerable<Win32> GetProgramsFromRegistry(RegistryKey root)
{ {
return root return root
.GetSubKeyNames() .GetSubKeyNames()
.Select(x => GetProgramRegistryPath(root, x)) .Select(x => GetProgramPathFromRegistrySubKeys(root, x))
.Distinct() .Distinct()
.Select(x => ProgramFromRegistrySubkey(x)); .Select(x => GetProgramFromPath(x));
} }
private static string GetProgramRegistryPath(RegistryKey root, string subkey) private static string GetProgramPathFromRegistrySubKeys(RegistryKey root, string subkey)
{ {
var path = string.Empty; var path = string.Empty;
@@ -365,7 +365,7 @@ namespace Wox.Plugin.Program.Programs
return path = path.Trim('"', ' '); return path = path.Trim('"', ' ');
} }
private static Win32 ProgramFromRegistrySubkey(string path) private static Win32 GetProgramFromPath(string path)
{ {
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
return new Win32(); return new Win32();