Make rbxfpsunlocker updating more reliable (#46)

depending on file timestamps suck
This commit is contained in:
pizzaboxer 2022-11-14 18:07:02 +00:00
parent 7295a8eec7
commit a39ce6bf81
7 changed files with 14 additions and 12 deletions

View File

@ -121,7 +121,10 @@ namespace Bloxstrap
//if (Program.IsFirstRun) //if (Program.IsFirstRun)
// Dialog.ShowSuccess($"{Program.ProjectName} has been installed"); // Dialog.ShowSuccess($"{Program.ProjectName} has been installed");
//else //else
await StartRoblox();
Program.SettingsManager.Save();
await StartRoblox();
Program.Exit(); Program.Exit();
} }

View File

@ -34,7 +34,7 @@
<GroupBox Grid.Column="0" Header="Discord Rich Presence" Margin="10,10,5,5"> <GroupBox Grid.Column="0" Header="Discord Rich Presence" Margin="10,10,5,5">
<StackPanel VerticalAlignment="Center"> <StackPanel VerticalAlignment="Center">
<CheckBox x:Name="CheckBoxDRPEnabled" Content=" Show game activity" Margin="5" VerticalAlignment="Top" IsChecked="{Binding DRPEnabled, Mode=TwoWay}" /> <CheckBox x:Name="CheckBoxDRPEnabled" Content=" Show game activity" Margin="5" VerticalAlignment="Top" IsChecked="{Binding DRPEnabled, Mode=TwoWay}" />
<CheckBox x:Name="CheckBoxDRPButtons" Content=" Show activity buttons" Margin="5" VerticalAlignment="Top" IsEnabled="{Binding IsChecked, ElementName=CheckBoxDRPEnabled, Mode=OneWay}" IsChecked="{Binding DRPButtons, Mode=TwoWay}" /> <CheckBox x:Name="CheckBoxDRPButtons" Content=" Allow others to join" Margin="5" VerticalAlignment="Top" IsEnabled="{Binding IsChecked, ElementName=CheckBoxDRPEnabled, Mode=OneWay}" IsChecked="{Binding DRPButtons, Mode=TwoWay}" />
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
<GroupBox Grid.Column="1" Header="FPS Unlocking" Margin="5,10,10,5"> <GroupBox Grid.Column="1" Header="FPS Unlocking" Margin="5,10,10,5">

View File

@ -71,7 +71,6 @@ namespace Bloxstrap.Helpers.Integrations
ActivityMachineAddress = ""; ActivityMachineAddress = "";
await SetPresence(); await SetPresence();
} }
} }
public async void MonitorGameActivity() public async void MonitorGameActivity()

View File

@ -70,25 +70,19 @@ namespace Bloxstrap.Helpers.Integrations
return; return;
} }
DateTime lastReleasePublish;
string downloadUrl;
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.Assets is null) if (releaseInfo is null || releaseInfo.Assets is null)
return; return;
lastReleasePublish = DateTime.Parse(releaseInfo.CreatedAt); string downloadUrl = releaseInfo.Assets[0].BrowserDownloadUrl;
downloadUrl = releaseInfo.Assets[0].BrowserDownloadUrl;
Directory.CreateDirectory(folderLocation); Directory.CreateDirectory(folderLocation);
if (File.Exists(fileLocation)) if (File.Exists(fileLocation))
{ {
DateTime lastDownload = File.GetCreationTimeUtc(fileLocation);
// no new release published, return // no new release published, return
if (lastDownload > lastReleasePublish) if (Program.Settings.RFUVersion == releaseInfo.TagName)
return; return;
CheckIfRunning(); CheckIfRunning();
@ -112,6 +106,8 @@ namespace Bloxstrap.Helpers.Integrations
{ {
await File.WriteAllTextAsync(settingsLocation, Settings); await File.WriteAllTextAsync(settingsLocation, Settings);
} }
Program.Settings.RFUVersion = releaseInfo.TagName;
} }
} }
} }

View File

@ -4,6 +4,9 @@ namespace Bloxstrap.Models
{ {
public class GithubRelease public class GithubRelease
{ {
[JsonPropertyName("tag_name")]
public string TagName { get; set; } = null!;
[JsonPropertyName("name")] [JsonPropertyName("name")]
public string Name { get; set; } = null!; public string Name { get; set; } = null!;

View File

@ -19,6 +19,8 @@ namespace Bloxstrap.Models
public bool RFUEnabled { get; set; } = false; public bool RFUEnabled { get; set; } = false;
public bool RFUAutoclose { get; set; } = false; public bool RFUAutoclose { get; set; } = false;
public string RFUVersion { get; set; } = "";
public bool UseOldDeathSound { get; set; } = true; public bool UseOldDeathSound { get; set; } = true;
public bool UseOldMouseCursor { get; set; } = false; public bool UseOldMouseCursor { get; set; } = false;
} }

View File

@ -132,7 +132,6 @@ namespace Bloxstrap
} }
#endif #endif
if (!String.IsNullOrEmpty(commandLine)) if (!String.IsNullOrEmpty(commandLine))
{ {
DeployManager.Channel = Settings.Channel; DeployManager.Channel = Settings.Channel;