public OpenWithUwp(OpenWith File, string ProgID)
 {
     this.File   = File;
     this.ProgID = ProgID;
     using (RegistryKey classesRoot = RegistryKey.OpenBaseKey(RegistryHive.ClassesRoot, RegistryView.Default))
     {
         using (RegistryKey progId = classesRoot.OpenSubKey(this.ProgID))
         {
             using (RegistryKey applicationInfo = progId.OpenSubKey("Application"))
             {
                 string nameUnexpanded = (string)applicationInfo.GetValue("ApplicationName");
                 if (nameUnexpanded[0] == '@')
                 {
                     StringBuilder sb = new StringBuilder();
                     SHLoadIndirectString(nameUnexpanded, sb, sb.Capacity, IntPtr.Zero);
                     this.Name = sb.ToString();
                 }
                 else
                 {
                     this.Name = nameUnexpanded;
                 }
                 this.AppUserModelID = (string)applicationInfo.GetValue("AppUserModelID");
             }
         }
     }
 }
 public OpenWithExe(OpenWith File, string ProgID)
 {
     this.File   = File;
     this.ProgID = ProgID;
     using (RegistryKey classesRoot = RegistryKey.OpenBaseKey(RegistryHive.ClassesRoot, RegistryView.Default))
     {
         using (RegistryKey progid = classesRoot.OpenSubKey(ProgID))
         {
             using (RegistryKey shell = progid.OpenSubKey("shell"))
             {
                 using (RegistryKey open = shell.OpenSubKey("open"))
                 {
                     if (open == null)
                     {
                         using (RegistryKey edit = shell.OpenSubKey("edit"))
                         {
                             if (edit == null)
                             {
                                 throw new InvalidOperationException();
                             }
                             using (RegistryKey command = edit.OpenSubKey("command"))
                             {
                                 string commandText = (string)command.GetValue("");
                                 exeCommand = commandText.Replace("%1", File.FilePath);
                                 string          exePath = SplitArgs(exeCommand)[0];
                                 FileVersionInfo fvi     = FileVersionInfo.GetVersionInfo(exePath);
                                 this.Name = fvi.ProductName;
                             }
                         }
                     }
                     else
                     {
                         using (RegistryKey command = open.OpenSubKey("command"))
                         {
                             string commandText = (string)command.GetValue("");
                             exeCommand = commandText.Replace("%1", File.FilePath);
                             string          exePath = SplitArgs(exeCommand)[0];
                             FileVersionInfo fvi     = FileVersionInfo.GetVersionInfo(exePath);
                             this.Name = fvi.ProductName;
                         }
                     }
                 }
             }
         }
     }
 }