v1.4.0: Build channel support, use rbxcdn, cleanup

thanks clonetrooper for reminding me rbxcdn exists - don't know why i used s3 directly since it's so much slower
This commit is contained in:
pizzaboxer 2022-08-26 12:48:35 +01:00
parent 4c0e7f5896
commit 0a2382d590
13 changed files with 377 additions and 126 deletions

View File

@ -9,8 +9,8 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<Platforms>AnyCPU;x86</Platforms>
<ApplicationIcon>Bloxstrap.ico</ApplicationIcon>
<Version>1.3.0</Version>
<FileVersion>1.3.0.0</FileVersion>
<Version>1.4.0</Version>
<FileVersion>1.4.0.0</FileVersion>
<UseWPF>True</UseWPF>
</PropertyGroup>

View File

@ -89,11 +89,11 @@ namespace Bloxstrap
Client.Timeout = TimeSpan.FromMinutes(10);
}
public void Initialize(BootstrapperStyle bootstrapperStyle, string? launchCommandLine = null)
public void Initialize(string? launchCommandLine = null)
{
LaunchCommandLine = launchCommandLine;
switch (bootstrapperStyle)
switch (Program.Settings.BootstrapperStyle)
{
case BootstrapperStyle.VistaDialog:
Application.Run(new VistaDialog(this));
@ -128,12 +128,7 @@ namespace Bloxstrap
await CheckLatestVersion();
if (!Directory.Exists(VersionFolder) || Program.Settings.VersionGuid != VersionGuid)
{
Debug.WriteLineIf(!Directory.Exists(VersionFolder), $"Installing latest version (!Directory.Exists({VersionFolder}))");
Debug.WriteLineIf(Program.Settings.VersionGuid != VersionGuid, $"Installing latest version ({Program.Settings.VersionGuid} != {VersionGuid})");
await InstallLatestVersion();
}
ApplyModifications();
@ -156,7 +151,7 @@ namespace Bloxstrap
{
Dialog.Message = "Connecting to Roblox...";
VersionGuid = await Client.GetStringAsync($"{Program.BaseUrlSetup}/version");
VersionGuid = await Client.GetStringAsync($"{DeployManager.BaseUrl}/version");
VersionFolder = Path.Combine(Directories.Versions, VersionGuid);
VersionPackageManifest = await PackageManifest.Get(VersionGuid);
}
@ -587,7 +582,7 @@ namespace Bloxstrap
private async void DownloadPackage(Package package)
{
string packageUrl = $"{Program.BaseUrlSetup}/{VersionGuid}-{package.Name}";
string packageUrl = $"{DeployManager.BaseUrl}/{VersionGuid}-{package.Name}";
string packageLocation = Path.Combine(Directories.Downloads, package.Signature);
string robloxPackageLocation = Path.Combine(Program.LocalAppData, "Roblox", "Downloads", package.Signature);

View File

@ -97,25 +97,13 @@ namespace Bloxstrap.Dialogs.BootstrapperStyles
public virtual void ShowSuccess(string message)
{
MessageBox.Show(
message,
Program.ProjectName,
MessageBoxButtons.OK,
MessageBoxIcon.Information
);
Program.ShowMessageBox(message, MessageBoxIcon.Information);
Program.Exit();
}
public virtual void ShowError(string message)
{
MessageBox.Show(
$"An error occurred while starting Roblox\n\nDetails: {message}",
Program.ProjectName,
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
Program.ShowMessageBox($"An error occurred while starting Roblox\n\nDetails: {message}", MessageBoxIcon.Error);
Program.Exit();
}
@ -129,11 +117,10 @@ namespace Bloxstrap.Dialogs.BootstrapperStyles
public void PromptShutdown()
{
DialogResult result = MessageBox.Show(
DialogResult result = Program.ShowMessageBox(
"Roblox is currently running, but needs to close. Would you like close Roblox now?",
Program.ProjectName,
MessageBoxButtons.OKCancel,
MessageBoxIcon.Information
MessageBoxIcon.Information,
MessageBoxButtons.OKCancel
);
if (result != DialogResult.OK)

View File

@ -45,6 +45,10 @@
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.StyleSelection = new System.Windows.Forms.ListBox();
this.InstallationTab = new System.Windows.Forms.TabPage();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.ToggleShowAllChannels = new System.Windows.Forms.CheckBox();
this.LabelChannelInfo = new System.Windows.Forms.Label();
this.SelectChannel = new System.Windows.Forms.ComboBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.LabelModFolderInstall = new System.Windows.Forms.Label();
this.ButtonOpenModFolder = new System.Windows.Forms.Button();
@ -67,6 +71,7 @@
((System.ComponentModel.ISupportInitialize)(this.IconPreview)).BeginInit();
this.groupBox2.SuspendLayout();
this.InstallationTab.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox4.SuspendLayout();
this.GroupBoxInstallLocation.SuspendLayout();
this.panel1.SuspendLayout();
@ -259,6 +264,7 @@
//
// InstallationTab
//
this.InstallationTab.Controls.Add(this.groupBox6);
this.InstallationTab.Controls.Add(this.groupBox4);
this.InstallationTab.Controls.Add(this.GroupBoxInstallLocation);
this.InstallationTab.Location = new System.Drawing.Point(4, 24);
@ -269,6 +275,53 @@
this.InstallationTab.Text = "Installation";
this.InstallationTab.UseVisualStyleBackColor = true;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.ToggleShowAllChannels);
this.groupBox6.Controls.Add(this.LabelChannelInfo);
this.groupBox6.Controls.Add(this.SelectChannel);
this.groupBox6.Location = new System.Drawing.Point(5, 158);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(422, 56);
this.groupBox6.TabIndex = 3;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Build Channel";
//
// ToggleShowAllChannels
//
this.ToggleShowAllChannels.AutoSize = true;
this.ToggleShowAllChannels.BackColor = System.Drawing.Color.White;
this.ToggleShowAllChannels.Location = new System.Drawing.Point(289, 0);
this.ToggleShowAllChannels.Name = "ToggleShowAllChannels";
this.ToggleShowAllChannels.Padding = new System.Windows.Forms.Padding(7, 0, 0, 0);
this.ToggleShowAllChannels.Size = new System.Drawing.Size(127, 19);
this.ToggleShowAllChannels.TabIndex = 2;
this.ToggleShowAllChannels.Text = "Show all channels";
this.ToggleShowAllChannels.UseVisualStyleBackColor = false;
this.ToggleShowAllChannels.CheckedChanged += new System.EventHandler(this.ToggleShowAllChannels_CheckedChanged);
//
// LabelChannelInfo
//
this.LabelChannelInfo.Location = new System.Drawing.Point(134, 18);
this.LabelChannelInfo.Name = "LabelChannelInfo";
this.LabelChannelInfo.Size = new System.Drawing.Size(282, 28);
this.LabelChannelInfo.TabIndex = 1;
this.LabelChannelInfo.Text = "Getting latest deploy, please wait...";
this.LabelChannelInfo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// SelectChannel
//
this.SelectChannel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.SelectChannel.DropDownWidth = 265;
this.SelectChannel.FormattingEnabled = true;
this.SelectChannel.Location = new System.Drawing.Point(9, 21);
this.SelectChannel.Name = "SelectChannel";
this.SelectChannel.Size = new System.Drawing.Size(120, 23);
this.SelectChannel.TabIndex = 0;
this.InfoTooltip.SetToolTip(this.SelectChannel, "Choose what deploy channel to use.\r\nThe default channel is LIVE.\r\nYou should only" +
" change this if you\'re know exactly what you\'re doing.\r\n");
this.SelectChannel.SelectedValueChanged += new System.EventHandler(this.SelectChannel_SelectedValueChanged);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.LabelModFolderInstall);
@ -444,6 +497,8 @@
((System.ComponentModel.ISupportInitialize)(this.IconPreview)).EndInit();
this.groupBox2.ResumeLayout(false);
this.InstallationTab.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.GroupBoxInstallLocation.ResumeLayout(false);
@ -486,5 +541,9 @@
private CheckBox ToggleCheckForUpdates;
private Button ButtonOpenModFolder;
private Label LabelModFolderInstall;
private GroupBox groupBox6;
private ComboBox SelectChannel;
private Label LabelChannelInfo;
private CheckBox ToggleShowAllChannels;
}
}

View File

@ -7,11 +7,13 @@ using Bloxstrap.Dialogs.BootstrapperStyles;
using Bloxstrap.Enums;
using Bloxstrap.Helpers;
using Bloxstrap.Helpers.Integrations;
using Bloxstrap.Models;
namespace Bloxstrap.Dialogs
{
public partial class Preferences : Form
{
#region Properties
private static readonly IReadOnlyDictionary<string, BootstrapperStyle> SelectableStyles = new Dictionary<string, BootstrapperStyle>()
{
{ "Vista (2009 - 2011)", BootstrapperStyle.VistaDialog },
@ -32,40 +34,33 @@ namespace Bloxstrap.Dialogs
{ "2019", BootstrapperIcon.Icon2019 },
};
private BootstrapperStyle? _selectedStyle;
private BootstrapperIcon? _selectedIcon;
private BootstrapperStyle SelectedStyle
private string ChannelInfo
{
get => _selectedStyle ?? BootstrapperStyle.ProgressDialog;
set
{
if (_selectedStyle == value)
if (this.InvokeRequired)
{
this.Invoke(new Action(() => { this.LabelChannelInfo.Text = value; }));
}
else
{
this.LabelChannelInfo.Text = value;
}
}
}
#endregion
#region Core
private async Task GetChannelInfo(string channel)
{
ChannelInfo = "Getting latest deploy, please wait...";
VersionDeploy info = await DeployManager.GetLastDeploy(channel);
if (info.FileVersion is null || info.Date is null)
return;
_selectedStyle = value;
int index = SelectableStyles.Values.ToList().IndexOf(value);
this.StyleSelection.SetSelected(index, true);
}
}
private BootstrapperIcon SelectedIcon
{
get => _selectedIcon ?? BootstrapperIcon.IconBloxstrap;
set
{
if (_selectedIcon == value)
return;
_selectedIcon = value;
int index = SelectableIcons.Values.ToList().IndexOf(value);
this.IconSelection.SetSelected(index, true);
this.IconPreview.BackgroundImage = IconManager.GetBitmapResource(value);
}
ChannelInfo = $"Last deploy:\nv{info.FileVersion} @ {info.Date}";
}
public Preferences()
@ -89,21 +84,21 @@ namespace Bloxstrap.Dialogs
this.InstallLocation.Text = Program.BaseDirectory;
}
foreach (var style in SelectableStyles)
{
this.StyleSelection.Items.Add(style.Key);
}
foreach (var icon in SelectableIcons)
{
this.IconSelection.Items.Add(icon.Key);
}
if (!Environment.Is64BitOperatingSystem)
this.ToggleRFUEnabled.Enabled = false;
SelectedStyle = Program.Settings.BootstrapperStyle;
SelectedIcon = Program.Settings.BootstrapperIcon;
// set data sources for list controls
this.StyleSelection.DataSource = SelectableStyles.Keys.ToList();
this.IconSelection.DataSource = SelectableIcons.Keys.ToList();
if (DeployManager.ChannelsAbstracted.Contains(Program.Settings.Channel))
this.SelectChannel.DataSource = DeployManager.ChannelsAbstracted;
else
this.ToggleShowAllChannels.Checked = true;
// populate preferences
this.StyleSelection.Text = SelectableStyles.FirstOrDefault(x => x.Value == Program.Settings.BootstrapperStyle).Key;
this.IconSelection.Text = SelectableIcons.FirstOrDefault(x => x.Value == Program.Settings.BootstrapperIcon).Key;
this.ToggleCheckForUpdates.Checked = Program.Settings.CheckForUpdates;
@ -115,26 +110,19 @@ namespace Bloxstrap.Dialogs
this.ToggleDeathSound.Checked = Program.Settings.UseOldDeathSound;
this.ToggleMouseCursor.Checked = Program.Settings.UseOldMouseCursor;
this.SelectChannel.Text = Program.Settings.Channel;
}
#endregion
private void InstallLocationBrowseButton_Click(object sender, EventArgs e)
#region Dialog Events
private void ToggleShowAllChannels_CheckedChanged(object sender, EventArgs e)
{
DialogResult result = this.InstallLocationBrowseDialog.ShowDialog();
if (this.ToggleShowAllChannels.Checked)
this.SelectChannel.DataSource = DeployManager.ChannelsAll;
else
this.SelectChannel.DataSource = DeployManager.ChannelsAbstracted;
if (result == DialogResult.OK)
this.InstallLocation.Text = this.InstallLocationBrowseDialog.SelectedPath;
}
private void StyleSelection_SelectedIndexChanged(object sender, EventArgs e)
{
string selected = this.StyleSelection.Text;
SelectedStyle = SelectableStyles[selected];
}
private void IconSelection_SelectedIndexChanged(object sender, EventArgs e)
{
string selected = this.IconSelection.Text;
SelectedIcon = SelectableIcons[selected];
}
private void SaveButton_Click(object sender, EventArgs e)
@ -143,7 +131,7 @@ namespace Bloxstrap.Dialogs
if (String.IsNullOrEmpty(installLocation))
{
Program.ShowMessageBox(MessageBoxIcon.Error, "You must set an install location");
Program.ShowMessageBox("You must set an install location", MessageBoxIcon.Error);
return;
}
@ -166,12 +154,12 @@ namespace Bloxstrap.Dialogs
}
catch (UnauthorizedAccessException)
{
Program.ShowMessageBox(MessageBoxIcon.Error, $"{Program.ProjectName} does not have write access to the install location you selected. Please choose another install location.");
Program.ShowMessageBox($"{Program.ProjectName} does not have write access to the install location you selected. Please choose another install location.", MessageBoxIcon.Error);
return;
}
catch (Exception ex)
{
Program.ShowMessageBox(MessageBoxIcon.Error, ex.Message);
Program.ShowMessageBox(ex.Message, MessageBoxIcon.Error);
return;
}
@ -186,7 +174,7 @@ namespace Bloxstrap.Dialogs
if (Program.BaseDirectory is not null && Program.BaseDirectory != installLocation)
{
Program.ShowMessageBox(MessageBoxIcon.Information, $"{Program.ProjectName} will install to the new location you've set the next time it runs.");
Program.ShowMessageBox($"{Program.ProjectName} will install to the new location you've set the next time it runs.", MessageBoxIcon.Information);
Program.Settings.VersionGuid = "";
@ -205,19 +193,14 @@ namespace Bloxstrap.Dialogs
}
}
Program.Settings.BootstrapperStyle = SelectedStyle;
Program.Settings.BootstrapperIcon = SelectedIcon;
this.Close();
}
private void PreviewButton_Click(object sender, EventArgs e)
{
Program.Settings.BootstrapperIcon = SelectedIcon;
this.Visible = false;
switch (SelectedStyle)
switch (Program.Settings.BootstrapperStyle)
{
case BootstrapperStyle.VistaDialog:
new VistaDialog().ShowDialog();
@ -243,6 +226,33 @@ namespace Bloxstrap.Dialogs
this.Visible = true;
}
private void Preferences_Load(object sender, EventArgs e)
{
this.Activate();
}
#endregion
#region Preference Events
private void StyleSelection_SelectedIndexChanged(object sender, EventArgs e)
{
if (!this.Visible)
return;
Program.Settings.BootstrapperStyle = SelectableStyles[this.StyleSelection.Text];
}
private void IconSelection_SelectedIndexChanged(object sender, EventArgs e)
{
BootstrapperIcon icon = SelectableIcons[this.IconSelection.Text];
this.IconPreview.BackgroundImage = IconManager.GetBitmapResource(icon);
if (!this.Visible)
return;
Program.Settings.BootstrapperIcon = icon;
}
private void ToggleDiscordRichPresence_CheckedChanged(object sender, EventArgs e)
{
Program.Settings.UseDiscordRichPresence = this.ToggleRPCButtons.Enabled = this.ToggleDiscordRichPresence.Checked;
@ -253,6 +263,11 @@ namespace Bloxstrap.Dialogs
Program.Settings.HideRPCButtons = this.ToggleRPCButtons.Checked;
}
private void RFUWebsite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Utilities.OpenWebsite($"https://github.com/{RbxFpsUnlocker.ProjectRepository}");
}
private void ToggleRFUEnabled_CheckedChanged(object sender, EventArgs e)
{
Program.Settings.RFUEnabled = this.ToggleRFUAutoclose.Enabled = this.ToggleRFUEnabled.Checked;
@ -263,6 +278,14 @@ namespace Bloxstrap.Dialogs
Program.Settings.RFUAutoclose = this.ToggleRFUAutoclose.Checked;
}
private void InstallLocationBrowseButton_Click(object sender, EventArgs e)
{
DialogResult result = this.InstallLocationBrowseDialog.ShowDialog();
if (result == DialogResult.OK)
this.InstallLocation.Text = this.InstallLocationBrowseDialog.SelectedPath;
}
private void ToggleDeathSound_CheckedChanged(object sender, EventArgs e)
{
Program.Settings.UseOldDeathSound = this.ToggleDeathSound.Checked;
@ -273,24 +296,25 @@ namespace Bloxstrap.Dialogs
Program.Settings.UseOldMouseCursor = this.ToggleMouseCursor.Checked;
}
private void ToggleCheckForUpdates_CheckedChanged(object sender, EventArgs e)
{
Program.Settings.CheckForUpdates = this.ToggleCheckForUpdates.Checked;
}
private void RFUWebsite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Utilities.OpenWebsite($"https://github.com/{RbxFpsUnlocker.ProjectRepository}");
}
private void ButtonOpenModFolder_Click(object sender, EventArgs e)
{
Process.Start("explorer.exe", Directories.Modifications);
}
private void Preferences_Load(object sender, EventArgs e)
private void SelectChannel_SelectedValueChanged(object sender, EventArgs e)
{
this.Activate();
}
Task.Run(() => GetChannelInfo(Program.Settings.Channel));
if (!this.Visible)
return;
Program.Settings.Channel = this.SelectChannel.Text;
}
private void ToggleCheckForUpdates_CheckedChanged(object sender, EventArgs e)
{
Program.Settings.CheckForUpdates = this.ToggleCheckForUpdates.Checked;
}
#endregion
}
}

View File

@ -63,4 +63,7 @@
<metadata name="InstallLocationBrowseDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="InfoTooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>222, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,154 @@
using System.IO;
using System.Net.Http;
using Bloxstrap.Models;
namespace Bloxstrap.Helpers
{
public class DeployManager
{
#region Properties
public const string DefaultBaseUrl = "https://setup.rbxcdn.com";
public static string BaseUrl { get; private set; } = DefaultBaseUrl;
public static readonly string DefaultChannel = "LIVE";
public static string Channel { set => BaseUrl = BuildBaseUrl(value); }
// basically any channel that has had a deploy within the past month with a windowsplayer build
public static readonly List<string> ChannelsAbstracted = new List<string>()
{
"LIVE",
"ZAvatarTeam",
"ZCanary",
"ZIntegration",
"ZLive",
"ZNext",
"ZPublic",
"ZSocialTeam"
};
// why not?
public static readonly List<string> ChannelsAll = new List<string>()
{
"LIVE",
"Ganesh",
"ZAvatarTeam",
"ZBugFixBoost-Mutex-Revert",
"ZBugFixCLI-54676-Test",
"ZBugFixCLI-55214-Master",
"ZCanary",
"ZCanary1",
"ZCanary2",
"ZCanaryApps",
"ZClientIntegration",
"ZClientWatcher",
"ZFeatureBaseline",
"ZFeatureBoost_Removal_Test_In_Prod",
"ZFeatureFMOD-20115",
"ZFeatureFMOD-Recording-Test",
"ZFeatureHSR2CDNPlayTest",
"ZFeatureHSR2CDNPlayTest2",
"ZFeatureInstance-Parent-Weak-Ptr",
"ZFeatureInstance-Parent-Weak-Ptr-2",
"ZFeatureLTCG1",
"ZFeatureLuaIInline1",
"ZFeatureQt5.15",
"ZFeatureRail",
"ZFeatureRetchecksV2",
"ZFeatureSubsystemAtomic",
"ZFeatureSubsystemHttpClient",
"ZFeatureTelemLife",
"ZFeatureUse-New-RapidJson-In-Flag-Loading",
"ZIntegration",
"ZIntegration1",
"ZLang",
"ZLive",
"ZLive1",
"ZLoom",
"ZNext",
"ZProject512-Boost-Remove-Mutex-1",
"ZProject516-Boost-Remove-Mutex-Network",
"ZPublic",
"ZQtitanStudio",
"ZQTitanStudioRelease",
"ZReleaseVS2019",
"ZSocialTeam",
"ZStIntegration",
"ZStudioInt1",
"ZStudioInt2",
"ZStudioInt3",
"ZStudioInt4",
"ZStudioInt5",
"ZStudioInt6",
"ZStudioInt7",
"ZStudioInt8",
"ZTesting",
"ZVS2019"
};
#endregion
private static string BuildBaseUrl(string channel)
{
if (channel == DefaultChannel)
return DefaultBaseUrl;
else
return $"{DefaultBaseUrl}/channel/{channel.ToLower()}";
}
public static async Task<VersionDeploy> GetLastDeploy(string channel)
{
string baseUrl = BuildBaseUrl(channel);
string deployHistory = "";
string lastDeploy = "";
using (HttpClient client = new())
{
deployHistory = await client.GetStringAsync($"{baseUrl}/DeployHistory.txt");
}
using (StringReader reader = new(deployHistory))
{
string? line;
while ((line = await reader.ReadLineAsync()) is not null)
{
if (line.Contains("WindowsPlayer"))
lastDeploy = line;
}
}
if (String.IsNullOrEmpty(lastDeploy))
throw new Exception($"Could not get latest deploy for channel {channel}");
// here's to hoping roblox doesn't change their deployment entry format
// (last time they did so was may 2021 so we should be fine?)
// example entry: 'New WindowsPlayer version-29fb7cdd06e84001 at 8/23/2022 2:07:27 PM, file version: 0, 542, 100, 5420251, git hash: b98d6b2bea36fa2161f48cca979fb620bb0c24fd ...'
lastDeploy = lastDeploy[18..]; // 'version-29fb7cdd06e84001 at 8/23/2022 2:07:27 PM, file version: 0, 542, 100, 5420251, git hash: b98d6b2bea36fa2161f48cca979fb620bb0c24fd ...'
string versionGuid = lastDeploy[..lastDeploy.IndexOf(" at")]; // 'version-29fb7cdd06e84001'
lastDeploy = lastDeploy[(versionGuid.Length + 4)..]; // '8/23/2022 2:07:27 PM, file version: 0, 542, 100, 5420251, git hash: b98d6b2bea36fa2161f48cca979fb620bb0c24fd ...'
string date = lastDeploy[..lastDeploy.IndexOf(", file")]; // '8/23/2022 2:07:27 PM'
lastDeploy = lastDeploy[(date.Length + 16)..]; // '0, 542, 100, 5420251, git hash: b98d6b2bea36fa2161f48cca979fb620bb0c24fd ...'
string fileVersion = "";
if (lastDeploy.Contains("git hash"))
{
// ~may 2021 entry: ends like 'file version: 0, 542, 100, 5420251, git hash: b98d6b2bea36fa2161f48cca979fb620bb0c24fd ...'
fileVersion = lastDeploy[..lastDeploy.IndexOf(", git")]; // '0, 542, 100, 5420251'
}
else
{
// pre-may 2021 entry: ends like 'file version: 0, 448, 0, 411122...'
fileVersion = lastDeploy[..lastDeploy.IndexOf("...")]; // '0, 448, 0, 411122'
}
// convert to traditional version format
fileVersion = fileVersion.Replace(" ", "").Replace(',', '.');
return new VersionDeploy { VersionGuid = versionGuid, Date = date, FileVersion = fileVersion };
}
}
}

View File

@ -9,16 +9,17 @@ namespace Bloxstrap.Helpers
// map uri keys to command line args
private static readonly IReadOnlyDictionary<string, string> UriKeyArgMap = new Dictionary<string, string>()
{
// excluding roblox-player, browsertrackerid and channel
// excluding roblox-player and browsertrackerid
{ "launchmode", "--" },
{ "gameinfo", "-t " },
{ "placelauncherurl", "-j "},
// { "launchtime", "--launchtime=" }, we'll set this when launching the game client
{ "robloxLocale", "--rloc " },
{ "gameLocale", "--gloc " },
{ "channel", "-channel " }
};
public static string Parse(string protocol)
public static string ParseUri(string protocol)
{
string[] keyvalPair;
string key;
@ -34,12 +35,25 @@ namespace Bloxstrap.Helpers
key = keyvalPair[0];
val = keyvalPair[1];
if (!UriKeyArgMap.ContainsKey(key))
if (!UriKeyArgMap.ContainsKey(key) || String.IsNullOrEmpty(val))
continue;
if (key == "placelauncherurl")
val = HttpUtility.UrlDecode(val).Replace("browserTrackerId", "lol");
if (key == "channel" && val != Program.Settings.Channel)
{
DialogResult result = Program.ShowMessageBox(
$"{Program.ProjectName} was launched with the Roblox build channel set to {val}, however your current preferred channel is {Program.Settings.Channel}.\n\n" +
$"Would you like to switch channels from {Program.Settings.Channel} to {val}?",
MessageBoxIcon.Question,
MessageBoxButtons.YesNo
);
if (result == DialogResult.Yes)
Program.Settings.Channel = val;
}
commandLine.Append(UriKeyArgMap[key] + val + " ");
}

View File

@ -72,7 +72,7 @@ namespace Bloxstrap.Helpers.RSMM
public static async Task<PackageManifest> Get(string versionGuid)
{
string pkgManifestUrl = $"{Program.BaseUrlSetup}/{versionGuid}-rbxPkgManifest.txt";
string pkgManifestUrl = $"{DeployManager.BaseUrl}/{versionGuid}-rbxPkgManifest.txt";
string pkgManifestData;
using (HttpClient http = new())

View File

@ -22,11 +22,10 @@ namespace Bloxstrap.Helpers
if (installedVersionInfo.ProductVersion != currentVersionInfo.ProductVersion)
{
DialogResult result = MessageBox.Show(
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?",
Program.ProjectName,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question
MessageBoxIcon.Question,
MessageBoxButtons.YesNo
);
if (result == DialogResult.Yes)
@ -66,11 +65,10 @@ namespace Bloxstrap.Helpers
if (currentVersion != latestVersion)
{
DialogResult result = MessageBox.Show(
DialogResult result = Program.ShowMessageBox(
$"A new version of {Program.ProjectName} is available\n\n[{latestVersion}]\n{releaseNotes}\n\nWould you like to download it?",
Program.ProjectName,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question
MessageBoxIcon.Question,
MessageBoxButtons.YesNo
);
if (result == DialogResult.Yes)

View File

@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Bloxstrap.Enums;
using Bloxstrap.Enums;
using Bloxstrap.Helpers;
namespace Bloxstrap.Models
{
public class SettingsFormat
{
public string Channel { get; set; } = DeployManager.DefaultChannel;
public string VersionGuid { get; set; } = "";
public bool CheckForUpdates { get; set; } = true;

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bloxstrap.Models
{
public class VersionDeploy
{
public string? VersionGuid { get; set; }
public string? Date { get; set; }
public string? FileVersion { get; set; }
}
}

View File

@ -14,7 +14,6 @@ namespace Bloxstrap
public const string ProjectName = "Bloxstrap";
public const string ProjectRepository = "pizzaboxer/bloxstrap";
public const string BaseUrlSetup = "https://s3.amazonaws.com/setup.roblox.com";
#region base64 stuff
// TODO: using IPFS as a reliable method for static asset storage instead of base64?
@ -32,10 +31,10 @@ namespace Bloxstrap
public static SettingsManager SettingsManager = new();
public static SettingsFormat Settings = SettingsManager.Settings;
public static void ShowMessageBox(MessageBoxIcon icon, string message)
// shorthand
public static DialogResult ShowMessageBox(string message, MessageBoxIcon icon = MessageBoxIcon.None, MessageBoxButtons buttons = MessageBoxButtons.OK)
{
MessageBox.Show(message, ProjectName, MessageBoxButtons.OK, icon);
return MessageBox.Show(message, ProjectName, buttons, icon);
}
public static void Exit()
@ -56,7 +55,7 @@ namespace Bloxstrap
if (Process.GetProcessesByName(ProjectName).Length > 1)
{
ShowMessageBox(MessageBoxIcon.Error, $"{ProjectName} is already running. Please close any currently open {ProjectName} window.\nIf you have Discord Rich Presence enabled, then close Roblox if it's running.");
ShowMessageBox($"{ProjectName} is already running. Please close any currently open {ProjectName} window.\nIf you have Discord Rich Presence enabled, then close Roblox if it's running.", MessageBoxIcon.Error);
return;
}
@ -107,7 +106,7 @@ namespace Bloxstrap
}
else if (args[0].StartsWith("roblox-player:"))
{
commandLine = Protocol.Parse(args[0]);
commandLine = Protocol.ParseUri(args[0]);
}
else if (args[0].StartsWith("roblox:"))
{
@ -123,8 +122,12 @@ namespace Bloxstrap
commandLine = "--app";
}
if (!String.IsNullOrEmpty(commandLine))
new Bootstrapper().Initialize(Settings.BootstrapperStyle, commandLine);
{
DeployManager.Channel = Settings.Channel;
new Bootstrapper().Initialize(commandLine);
}
SettingsManager.Save();
}