fix setup dialog issue

This commit is contained in:
Frank Skare
2020-12-15 18:12:10 +01:00
parent cab7c6d49b
commit 3ed71444a7
3 changed files with 5 additions and 9 deletions

View File

@@ -12,6 +12,8 @@
- Audio devices can be shown in the menu under: View > Show Audio Devices - Audio devices can be shown in the menu under: View > Show Audio Devices
- Audio devices can be shown on the command line with --audio-device=help - Audio devices can be shown on the command line with --audio-device=help
- Protocols can be shown in the menu under: View > Show Protocols - Protocols can be shown in the menu under: View > Show Protocols
- Allow mpv.net to start from different startup locations
without showing the setup dialog.
5.4.8.5 Beta 5.4.8.5 Beta

View File

@@ -195,9 +195,9 @@ namespace mpvnet
public static void ShowSetup() public static void ShowSetup()
{ {
string path = RegistryHelp.GetString(RegistryHelp.ApplicationKey, "SetupDialog"); int value = RegistryHelp.GetInt(RegistryHelp.ApplicationKey, Folder.Startup);
if (path != Folder.Startup) if (value != 1)
{ {
if (Msg.ShowQuestion("Would you like to setup mpv.net?", if (Msg.ShowQuestion("Would you like to setup mpv.net?",
"The setup allows to create a start menu shortcut, file associations and " + "The setup allows to create a start menu shortcut, file associations and " +
@@ -207,7 +207,7 @@ namespace mpvnet
else else
Msg.Show("The setup dialog can be found in the context menu at:\n\nTools > Setup"); Msg.Show("The setup dialog can be found in the context menu at:\n\nTools > Setup");
RegistryHelp.SetValue(RegistryHelp.ApplicationKey, "SetupDialog", Folder.Startup); RegistryHelp.SetValue(RegistryHelp.ApplicationKey, Folder.Startup, 1);
} }
} }
} }

View File

@@ -25,12 +25,6 @@ public class RegistryHelp
return !(value is int) ? defaultValue : (int)value; return !(value is int) ? defaultValue : (int)value;
} }
public static bool GetBool(string path, string name, bool defaultValue = false)
{
object val = GetValue(path, name, defaultValue);
return val is bool ? (bool)val : defaultValue;
}
public static object GetValue(string path, string name, object defaultValue = null) public static object GetValue(string path, string name, object defaultValue = null)
{ {
using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5))) using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5)))