Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add description for OneClick registry keys #293

Merged
merged 2 commits into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Stevoisiak marked this conversation as resolved.
Show resolved Hide resolved
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