mirror of
https://github.com/greenshot/greenshot
synced 2025-07-06 04:52:16 -07:00
Optimized the code to find the office executable even more.
This commit is contained in:
parent
3e88093846
commit
af3c22c38c
1 changed files with 2 additions and 9 deletions
|
@ -35,16 +35,9 @@ internal static class OfficeUtils
|
||||||
|
|
||||||
foreach (string officeVersion in rootKey.GetSubKeyNames().Where(r => r.Contains(".")).Reverse())
|
foreach (string officeVersion in rootKey.GetSubKeyNames().Where(r => r.Contains(".")).Reverse())
|
||||||
{
|
{
|
||||||
using RegistryKey officeKey = Registry.LocalMachine.OpenSubKey(strRootKey + "\\" + officeVersion);
|
using RegistryKey installRootKey = Registry.LocalMachine.OpenSubKey($@"{strRootKey}\{officeVersion}\{strKeyName}\InstallRoot");
|
||||||
if (officeKey is null) continue;
|
|
||||||
|
|
||||||
using RegistryKey programKey = officeKey.OpenSubKey(strKeyName);
|
|
||||||
if (programKey is null) continue;
|
|
||||||
|
|
||||||
using RegistryKey installRootKey = programKey.OpenSubKey("InstallRoot");
|
|
||||||
if (installRootKey == null) continue;
|
if (installRootKey == null) continue;
|
||||||
|
return $@"{installRootKey.GetValue("Path")}\{exeName}";
|
||||||
return installRootKey.GetValue("Path") + "\\" + exeName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue