Esempio n. 1
0
 static string GetExePath(string subName)
 {
     try
     {
         var key = LocalMachine.OpenSubKey($"SOFTWARE\\{subName}");
         if (key == null)
         {
             key = CurrentUser.OpenSubKey($"SOFTWARE\\{subName}");
             if (key == null)
             {
                 key = ClassesRoot.OpenSubKey($"VirtualStore\\MACHINE\\SOFTWARE\\{subName}");
                 if (key == null)
                 {
                     return(null);
                 }
             }
         }
         var path = key.GetValue("Installed Path") as string;
         if (File.Exists(path))
         {
             path = Path.GetDirectoryName(path);
         }
         return(string.IsNullOrEmpty(path) || !Directory.Exists(path) ? null : path);
     }
     catch { return(null); }
 }
Esempio n. 2
0
 public static void SetResolution(int W, int H)
 {
     using (var regKey = ClassesRoot.OpenSubKey(
                @"VirtualStore\MACHINE\SOFTWARE\Wow6432Node\Bethesda Softworks\Morrowind", true))
     {
         regKey.SetValue("Screen Width", W);
         regKey.SetValue("Screen Height", H);
     }
 }
Esempio n. 3
0
        public static string GetResolution()
        {
            string regRes = null;

            using (var regKey = ClassesRoot.OpenSubKey(
                       @"VirtualStore\MACHINE\SOFTWARE\Wow6432Node\Bethesda Softworks\Morrowind"))
            {
                string W = regKey.GetValue("Screen Width")?.ToString();
                string H = regKey.GetValue("Screen Height")?.ToString();

                regRes = $"{W}x{H}";
            }

            return(regRes);
        }