Skip to content

Commit

Permalink
Attempting to patch launch failure issue.
Browse files Browse the repository at this point in the history
I believe this is being caused by an exception related to some registry
keys. I have wrapped these into try/catch blocks so they don't hault the
program from launching. This should hopefully stop the issue from
persisting.
  • Loading branch information
MaximumADHD committed Oct 26, 2018
1 parent 564494f commit c83ec94
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
Binary file modified RobloxStudioModManager.exe
Binary file not shown.
16 changes: 6 additions & 10 deletions src/Launcher.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Web;
using System.Windows.Forms;

namespace RobloxStudioModManager
Expand Down Expand Up @@ -219,18 +217,16 @@ private async void launchStudio_Click(object sender = null, EventArgs e = null)

private void Launcher_Load(object sender, EventArgs e)
{

if (args != null)
openStudioDirectory.Enabled = false;

object registrySave = Program.ModManagerRegistry.GetValue("BuildBranch");

if (registrySave != null)

try
{
string build = registrySave as string;
branchSelect.SelectedIndex = branchSelect.Items.IndexOf(build);
string build = Program.ModManagerRegistry.GetValue("BuildBranch") as string;
int index = branchSelect.Items.IndexOf(build);
branchSelect.SelectedIndex = Math.Max(index, 0);
}
else
catch
{
branchSelect.SelectedIndex = 0;
}
Expand Down
24 changes: 17 additions & 7 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ namespace RobloxStudioModManager
static class Program
{
public static RegistryKey ModManagerRegistry = GetSubKey(Registry.CurrentUser, "SOFTWARE", "Roblox Studio Mod Manager");
private static string _ = ""; // Default key/value used for stuff in UpdateStudioRegistryProtocols.
private const string _ = ""; // Default key/value used for stuff in UpdateStudioRegistryProtocols.

public static RegistryKey GetSubKey(RegistryKey key, params string[] path)
{
string constructedPath = "";

foreach (string p in path)
constructedPath = Path.Combine(constructedPath, p);

Expand Down Expand Up @@ -84,14 +85,23 @@ private static bool validateCertificate(object sender, X509Certificate certifica
static void Main(string[] args)
{
// Delete deprecated startup protocol if it exists.
bool registryInit = bool.Parse(ModManagerRegistry.GetValue("Initialized Startup Protocol", "False") as string);
try
{
bool registryInit = bool.Parse(ModManagerRegistry.GetValue("Initialized Startup Protocol", "False") as string);

if (registryInit)
{
string myPath = Application.ExecutablePath;

if (registryInit)
RegistryKey startUpBin = GetSubKey(Registry.CurrentUser, "SOFTWARE", "Microsoft", "Windows", "CurrentVersion", "Run");
startUpBin.DeleteValue("RobloxStudioModManager");

ModManagerRegistry.SetValue("Initialized Startup Protocol", false);
}
}
catch
{
string myPath = Application.ExecutablePath;
RegistryKey startUpBin = GetSubKey(Registry.CurrentUser, "SOFTWARE", "Microsoft", "Windows", "CurrentVersion", "Run");
startUpBin.DeleteValue("RobloxStudioModManager");
ModManagerRegistry.SetValue("Initialized Startup Protocol", false);
Console.WriteLine("Ran into problem while removing deprecated startup protocol. Ignoring for now?");
}

// Add Roblox HTTPS validation
Expand Down
2 changes: 1 addition & 1 deletion src/RobloxInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public async Task<string> RunInstaller(string branch, bool forceInstall = false)
setStatus("Writing AppSettings.xml");
progressBar.Style = ProgressBarStyle.Marquee;

Program.ModManagerRegistry.SetValue("Buildbranch", branch);
Program.ModManagerRegistry.SetValue("BuildBranch", branch);
Program.ModManagerRegistry.SetValue("BuildVersion", buildVersion);

echo("Writing AppSettings.xml...");
Expand Down

0 comments on commit c83ec94

Please sign in to comment.