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,6 +118,9 @@ namespace Bloxstrap
await RbxFpsUnlocker.CheckInstall(); await RbxFpsUnlocker.CheckInstall();
if (Program.IsFirstRun)
Dialog.ShowSuccess($"{Program.ProjectName} has been installed");
else
await StartRoblox(); await StartRoblox();
Program.Exit(); Program.Exit();
@ -293,6 +296,8 @@ namespace Bloxstrap
uninstallKey.SetValue("Publisher", Program.ProjectName); uninstallKey.SetValue("Publisher", Program.ProjectName);
uninstallKey.SetValue("ModifyPath", $"\"{Directories.App}\" -preferences"); uninstallKey.SetValue("ModifyPath", $"\"{Directories.App}\" -preferences");
uninstallKey.SetValue("UninstallString", $"\"{Directories.App}\" -uninstall"); 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(); uninstallKey.Close();
} }

View File

@ -48,7 +48,7 @@
<StackPanel VerticalAlignment="Center"> <StackPanel VerticalAlignment="Center">
<CheckBox x:Name="CheckBoxModDeathSound" Content=" Use old death sound" Margin="5" IsChecked="{Binding ModOldDeathSound, Mode=TwoWay}" /> <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}" /> <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> </StackPanel>
</GroupBox> </GroupBox>
</StackPanel> </StackPanel>
@ -68,7 +68,7 @@
<Button Grid.Column="1" x:Name="ButtonInstallLocationBrowse" Content="Browse..." Margin="5,0,0,0" Click="ButtonLocationBrowse_Click" /> <Button Grid.Column="1" x:Name="ButtonInstallLocationBrowse" Content="Browse..." Margin="5,0,0,0" Click="ButtonLocationBrowse_Click" />
</Grid> </Grid>
</GroupBox> </GroupBox>
<GroupBox Header="Channel" VerticalAlignment="Top" Margin="10, 5, 10, 0"> <GroupBox Header="Channel" VerticalAlignment="Top" Margin="10, 5, 10, 5">
<StackPanel VerticalAlignment="Center"> <StackPanel VerticalAlignment="Center">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -81,6 +81,7 @@
<TextBlock x:Name="TextBlockChannelInfo" Text="{Binding ChannelInfo, Mode=OneWay}" TextWrapping="Wrap" Margin="5" /> <TextBlock x:Name="TextBlockChannelInfo" Text="{Binding ChannelInfo, Mode=OneWay}" TextWrapping="Wrap" Margin="5" />
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
<CheckBox Content=" Check for Bloxstrap updates on startup" IsChecked="{Binding CheckForUpdates, Mode=TwoWay}" Margin="10,5,10,5" />
</StackPanel> </StackPanel>
</TabItem> </TabItem>
<TabItem Padding="5"> <TabItem Padding="5">

View File

@ -200,7 +200,7 @@ namespace Bloxstrap.Dialogs
} }
public bool ModFolderButtonEnabled { get; } = !Program.IsFirstRun; 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 #endregion
#region Installation #region Installation
@ -267,6 +267,12 @@ namespace Bloxstrap.Dialogs
OnPropertyChanged(); OnPropertyChanged();
} }
} }
public bool CheckForUpdates
{
get => Program.Settings.CheckForUpdates;
set => Program.Settings.CheckForUpdates = value;
}
#endregion #endregion
#region Style #region Style

View File

@ -30,7 +30,7 @@ namespace Bloxstrap.Helpers.Integrations
if (Program.BaseDirectory is null) if (Program.BaseDirectory is null)
return; 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 fileLocation = Path.Combine(folderLocation, "rbxfpsunlocker.exe");
string settingsLocation = Path.Combine(folderLocation, "settings"); 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"); 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; return;
lastReleasePublish = DateTime.Parse(releaseInfo.CreatedAt); lastReleasePublish = DateTime.Parse(releaseInfo.CreatedAt);
downloadUrl = releaseInfo.Assets![0].BrowserDownloadUrl!; downloadUrl = releaseInfo.Assets[0].BrowserDownloadUrl;
Directory.CreateDirectory(folderLocation); Directory.CreateDirectory(folderLocation);

View File

@ -11,10 +11,10 @@ namespace Bloxstrap.Helpers
{ {
public class Updater public class Updater
{ {
public static bool CheckInstalledVersion() public static void CheckInstalledVersion()
{ {
if (Environment.ProcessPath is null || !File.Exists(Directories.App) || Environment.ProcessPath == Directories.App) 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 // if downloaded version doesn't match, replace installed version with downloaded version
FileVersionInfo currentVersionInfo = FileVersionInfo.GetVersionInfo(Environment.ProcessPath); FileVersionInfo currentVersionInfo = FileVersionInfo.GetVersionInfo(Environment.ProcessPath);
@ -23,7 +23,7 @@ namespace Bloxstrap.Helpers
if (installedVersionInfo.ProductVersion != currentVersionInfo.ProductVersion) if (installedVersionInfo.ProductVersion != currentVersionInfo.ProductVersion)
{ {
DialogResult result = Program.ShowMessageBox( 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, MessageBoxIcon.Question,
MessageBoxButtons.YesNo MessageBoxButtons.YesNo
); );
@ -32,11 +32,18 @@ namespace Bloxstrap.Helpers
{ {
File.Delete(Directories.App); File.Delete(Directories.App);
File.Copy(Environment.ProcessPath, 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() public static async Task Check()
@ -44,8 +51,8 @@ namespace Bloxstrap.Helpers
if (Environment.ProcessPath is null) if (Environment.ProcessPath is null)
return; return;
if (!Program.IsFirstRun && CheckInstalledVersion()) if (!Program.IsFirstRun)
return; CheckInstalledVersion();
if (!Program.Settings.CheckForUpdates) if (!Program.Settings.CheckForUpdates)
return; return;

View File

@ -5,13 +5,13 @@ namespace Bloxstrap.Models
public class GithubRelease public class GithubRelease
{ {
[JsonPropertyName("name")] [JsonPropertyName("name")]
public string? Name { get; set; } public string Name { get; set; } = null!;
[JsonPropertyName("body")] [JsonPropertyName("body")]
public string? Body { get; set; } public string Body { get; set; } = null!;
[JsonPropertyName("created_at")] [JsonPropertyName("created_at")]
public string? CreatedAt { get; set; } public string CreatedAt { get; set; } = null!;
[JsonPropertyName("assets")] [JsonPropertyName("assets")]
public List<GithubReleaseAsset>? Assets { get; set; } public List<GithubReleaseAsset>? Assets { get; set; }
@ -20,6 +20,9 @@ namespace Bloxstrap.Models
public class GithubReleaseAsset public class GithubReleaseAsset
{ {
[JsonPropertyName("browser_download_url")] [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; return;
} }
new PreferencesWPF().ShowDialog(); new Preferences().ShowDialog();
} }
else if (args[0].StartsWith("roblox-player:")) else if (args[0].StartsWith("roblox-player:"))
{ {