Skip to content

Commit

Permalink
Add description for OneClick registry keys
Browse files Browse the repository at this point in the history
Adds a description to protocol handler registry keys when setting up OneClick install.
  • Loading branch information
Stevoisiak committed Jan 19, 2021
1 parent 3b9dc22 commit 140dde1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ModAssistant/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ private async Task ArgumentHandler(string[] args)
}
else
{
OneClickInstaller.Register(args[1], true);
OneClickInstaller.Register(args[1], true, args[2]);
}

Update = false;
GUI = false;
args = Shift(args, 2);
args = Shift(args, args.Length);
break;

case "--unregister":
Expand Down
8 changes: 6 additions & 2 deletions ModAssistant/Classes/OneClickInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private static async Task Playlist(Uri uri)
await API.Playlists.DownloadAll(uri);
}

public static void Register(string Protocol, bool Background = false)
public static void Register(string Protocol, bool Background = false, string Description = null)
{
if (IsRegistered(Protocol) == true)
return;
Expand All @@ -75,6 +75,10 @@ public static void Register(string Protocol, bool Background = false)

if (ProtocolKey.GetValue("OneClick-Provider", "").ToString() != "ModAssistant")
{
if (Description != null)
{
ProtocolKey.SetValue("", Description, RegistryValueKind.String);
}
ProtocolKey.SetValue("URL Protocol", "", RegistryValueKind.String);
ProtocolKey.SetValue("OneClick-Provider", "ModAssistant", RegistryValueKind.String);
CommandKey.SetValue("", $"\"{Utils.ExePath}\" \"--install\" \"%1\"");
Expand All @@ -84,7 +88,7 @@ public static void Register(string Protocol, bool Background = false)
}
else
{
Utils.StartAsAdmin($"\"--register\" \"{Protocol}\"");
Utils.StartAsAdmin($"\"--register\" \"{Protocol}\" \"{Description}\"");
}
}
catch (Exception e)
Expand Down
6 changes: 3 additions & 3 deletions ModAssistant/Pages/Options.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private void CloseWindowOnFinish_Unchecked(object sender, RoutedEventArgs e)

public void ModelSaberProtocolHandler_Checked(object sender, RoutedEventArgs e)
{
OneClickInstaller.Register("modelsaber");
OneClickInstaller.Register("modelsaber", Description: "URL:ModelSaber OneClick Install");
}

public void ModelSaberProtocolHandler_Unchecked(object sender, RoutedEventArgs e)
Expand All @@ -147,7 +147,7 @@ public void ModelSaberProtocolHandler_Unchecked(object sender, RoutedEventArgs e

public void BeatSaverProtocolHandler_Checked(object sender, RoutedEventArgs e)
{
OneClickInstaller.Register("beatsaver");
OneClickInstaller.Register("beatsaver", Description: "URL:BeatSaver OneClick Install");
}

public void BeatSaverProtocolHandler_Unchecked(object sender, RoutedEventArgs e)
Expand All @@ -156,7 +156,7 @@ public void BeatSaverProtocolHandler_Unchecked(object sender, RoutedEventArgs e)
}
public void PlaylistsProtocolHandler_Checked(object sender, RoutedEventArgs e)
{
OneClickInstaller.Register("bsplaylist");
OneClickInstaller.Register("bsplaylist", Description: "URL:BeatSaver Playlist OneClick Install");
}

public void PlaylistsProtocolHandler_Unchecked(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 140dde1

Please sign in to comment.