mirror of
https://github.com/greenshot/greenshot
synced 2025-07-05 20:42:14 -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())
|
||||
{
|
||||
using RegistryKey officeKey = Registry.LocalMachine.OpenSubKey(strRootKey + "\\" + officeVersion);
|
||||
if (officeKey is null) continue;
|
||||
|
||||
using RegistryKey programKey = officeKey.OpenSubKey(strKeyName);
|
||||
if (programKey is null) continue;
|
||||
|
||||
using RegistryKey installRootKey = programKey.OpenSubKey("InstallRoot");
|
||||
using RegistryKey installRootKey = Registry.LocalMachine.OpenSubKey($@"{strRootKey}\{officeVersion}\{strKeyName}\InstallRoot");
|
||||
if (installRootKey == null) continue;
|
||||
|
||||
return installRootKey.GetValue("Path") + "\\" + exeName;
|
||||
return $@"{installRootKey.GetValue("Path")}\{exeName}";
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue