Don't launch Roblox after install/update

This commit is contained in:
pizzaboxer 2022-10-05 21:01:41 +01:00
parent 350b655060
commit 4c5bdb3488
7 changed files with 43 additions and 21 deletions

View File

@ -118,7 +118,10 @@ namespace Bloxstrap
await RbxFpsUnlocker.CheckInstall();
await StartRoblox();
if (Program.IsFirstRun)
Dialog.ShowSuccess($"{Program.ProjectName} has been installed");
else
await StartRoblox();
Program.Exit();
}
@ -293,6 +296,8 @@ namespace Bloxstrap
uninstallKey.SetValue("Publisher", Program.ProjectName);
uninstallKey.SetValue("ModifyPath", $"\"{Directories.App}\" -preferences");
uninstallKey.SetValue("UninstallString", $"\"{Directories.App}\" -uninstall");
uninstallKey.SetValue("URLInfoAbout", $"https://github.com/{Program.ProjectRepository}");
uninstallKey.SetValue("URLUpdateInfo", $"https://github.com/{Program.ProjectRepository}/releases/latest");
uninstallKey.Close();
}

View File

@ -48,7 +48,7 @@
<StackPanel VerticalAlignment="Center">
<CheckBox x:Name="CheckBoxModDeathSound" Content=" Use old death sound" Margin="5" IsChecked="{Binding ModOldDeathSound, Mode=TwoWay}" />
<CheckBox x:Name="CheckBoxModMouseCursor" Content=" Use old mouse cursor" Margin="5" IsChecked="{Binding ModOldMouseCursor, Mode=TwoWay}" />
<Button x:Name="ButtonOpenModFolder" Content="Open folder" VerticalAlignment="Bottom" Height="23" Margin="5,5,5,5" Click="ButtonOpenModFolder_Click" />
<Button x:Name="ButtonOpenModFolder" Content="{Binding ModFolderButtonText, Mode=OneTime}" IsEnabled="{Binding ModFolderButtonEnabled, Mode=OneTime}" VerticalAlignment="Bottom" Height="23" Margin="5,5,5,5" Click="ButtonOpenModFolder_Click" />
</StackPanel>
</GroupBox>
</StackPanel>
@ -68,7 +68,7 @@
<Button Grid.Column="1" x:Name="ButtonInstallLocationBrowse" Content="Browse..." Margin="5,0,0,0" Click="ButtonLocationBrowse_Click" />
</Grid>
</GroupBox>
<GroupBox Header="Channel" VerticalAlignment="Top" Margin="10, 5, 10, 0">
<GroupBox Header="Channel" VerticalAlignment="Top" Margin="10, 5, 10, 5">
<StackPanel VerticalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
@ -81,6 +81,7 @@
<TextBlock x:Name="TextBlockChannelInfo" Text="{Binding ChannelInfo, Mode=OneWay}" TextWrapping="Wrap" Margin="5" />
</StackPanel>
</GroupBox>
<CheckBox Content=" Check for Bloxstrap updates on startup" IsChecked="{Binding CheckForUpdates, Mode=TwoWay}" Margin="10,5,10,5" />
</StackPanel>
</TabItem>
<TabItem Padding="5">

View File

@ -200,7 +200,7 @@ namespace Bloxstrap.Dialogs
}
public bool ModFolderButtonEnabled { get; } = !Program.IsFirstRun;
public string ModFolderButtonText { get; } = Program.IsFirstRun ? "Install Bloxstrap first to add custom mods" : "Open mod folder";
public string ModFolderButtonText { get; } = Program.IsFirstRun ? "Custom mods can be added after installing Bloxstrap" : "Open mod folder";
#endregion
#region Installation
@ -267,6 +267,12 @@ namespace Bloxstrap.Dialogs
OnPropertyChanged();
}
}
public bool CheckForUpdates
{
get => Program.Settings.CheckForUpdates;
set => Program.Settings.CheckForUpdates = value;
}
#endregion
#region Style

View File

@ -30,7 +30,7 @@ namespace Bloxstrap.Helpers.Integrations
if (Program.BaseDirectory is null)
return;
string folderLocation = Path.Combine(Program.BaseDirectory, "Integrations", "rbxfpsunlocker");
string folderLocation = Path.Combine(Program.BaseDirectory, "Integrations\\rbxfpsunlocker");
string fileLocation = Path.Combine(folderLocation, "rbxfpsunlocker.exe");
string settingsLocation = Path.Combine(folderLocation, "settings");
@ -47,11 +47,11 @@ namespace Bloxstrap.Helpers.Integrations
var releaseInfo = await Utilities.GetJson<GithubRelease>($"https://api.github.com/repos/{ProjectRepository}/releases/latest");
if (releaseInfo is null || releaseInfo.CreatedAt is null || releaseInfo.Assets is null)
if (releaseInfo is null || releaseInfo.Assets is null)
return;
lastReleasePublish = DateTime.Parse(releaseInfo.CreatedAt);
downloadUrl = releaseInfo.Assets![0].BrowserDownloadUrl!;
downloadUrl = releaseInfo.Assets[0].BrowserDownloadUrl;
Directory.CreateDirectory(folderLocation);

View File

@ -11,10 +11,10 @@ namespace Bloxstrap.Helpers
{
public class Updater
{
public static bool CheckInstalledVersion()
public static void CheckInstalledVersion()
{
if (Environment.ProcessPath is null || !File.Exists(Directories.App) || Environment.ProcessPath == Directories.App)
return false;
return;
// if downloaded version doesn't match, replace installed version with downloaded version
FileVersionInfo currentVersionInfo = FileVersionInfo.GetVersionInfo(Environment.ProcessPath);
@ -23,7 +23,7 @@ namespace Bloxstrap.Helpers
if (installedVersionInfo.ProductVersion != currentVersionInfo.ProductVersion)
{
DialogResult result = Program.ShowMessageBox(
$"The version of {Program.ProjectName} you've launched is newer than the version you currently have installed.\nWould you like to update your currently installed version?",
$"The version of {Program.ProjectName} you've launched is different to the version you currently have installed.\nWould you like to update your currently installed version?",
MessageBoxIcon.Question,
MessageBoxButtons.YesNo
);
@ -32,11 +32,18 @@ namespace Bloxstrap.Helpers
{
File.Delete(Directories.App);
File.Copy(Environment.ProcessPath, Directories.App);
return true;
Program.ShowMessageBox(
$"{Program.ProjectName} has been updated to v{currentVersionInfo.ProductVersion}",
MessageBoxIcon.Information,
MessageBoxButtons.OK
);
Environment.Exit(0);
}
}
return false;
return;
}
public static async Task Check()
@ -44,8 +51,8 @@ namespace Bloxstrap.Helpers
if (Environment.ProcessPath is null)
return;
if (!Program.IsFirstRun && CheckInstalledVersion())
return;
if (!Program.IsFirstRun)
CheckInstalledVersion();
if (!Program.Settings.CheckForUpdates)
return;

View File

@ -5,13 +5,13 @@ namespace Bloxstrap.Models
public class GithubRelease
{
[JsonPropertyName("name")]
public string? Name { get; set; }
public string Name { get; set; } = null!;
[JsonPropertyName("body")]
public string? Body { get; set; }
public string Body { get; set; } = null!;
[JsonPropertyName("created_at")]
public string? CreatedAt { get; set; }
public string CreatedAt { get; set; } = null!;
[JsonPropertyName("assets")]
public List<GithubReleaseAsset>? Assets { get; set; }
@ -20,6 +20,9 @@ namespace Bloxstrap.Models
public class GithubReleaseAsset
{
[JsonPropertyName("browser_download_url")]
public string? BrowserDownloadUrl { get; set; }
public string BrowserDownloadUrl { get; set; } = null!;
[JsonPropertyName("name")]
public string Name { get; set; } = null!;
}
}

View File

@ -111,7 +111,7 @@ namespace Bloxstrap
return;
}
new PreferencesWPF().ShowDialog();
new Preferences().ShowDialog();
}
else if (args[0].StartsWith("roblox-player:"))
{