This commit is contained in:
Frank Skare
2019-06-17 21:35:14 +02:00
parent 29a0eae3d5
commit 87e3d9ca3e
7 changed files with 35 additions and 26 deletions

View File

@@ -212,14 +212,18 @@ namespace mpvnet
public static void RemoveKey(string path)
{
GetRootKey(path).DeleteSubKeyTree(path.Substring(5), false);
try {
GetRootKey(path).DeleteSubKeyTree(path.Substring(5), false);
} catch { }
}
public static void RemoveValue(string path, string name)
{
using (RegistryKey rk = GetRootKey(path).OpenSubKey(path.Substring(5), true))
if (!(rk is null))
rk.DeleteValue(name, false);
try {
using (RegistryKey rk = GetRootKey(path).OpenSubKey(path.Substring(5), true))
if (!(rk is null))
rk.DeleteValue(name, false);
} catch {}
}
static RegistryKey GetRootKey(string path)

View File

@@ -13,8 +13,6 @@ namespace mpvnet
[STAThread]
static void Main()
{
Mutex mutex = new Mutex(true, "mpvnetProcessInstance", out bool isFirst);
try
{
string[] args = Environment.GetCommandLineArgs().Skip(1).ToArray();
@@ -27,6 +25,7 @@ namespace mpvnet
return;
}
Mutex mutex = new Mutex(true, "mpvnetProcessInstance", out bool isFirst);
App.Init();
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
@@ -56,15 +55,12 @@ namespace mpvnet
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
mutex.Dispose();
}
catch (Exception ex)
{
Msg.ShowException(ex);
}
finally
{
mutex.Dispose();
}
}
}
}