public static async Task <ClientVersionInfo> Get(string buildType = "WindowsStudio", string branch = "roblox") { string jsonUrl = $"https://clientsettingscdn.{branch}.com/v2/client-version/{buildType}"; using (WebClient http = new WebClient()) { var getJsonData = http.DownloadStringTaskAsync(jsonUrl); string jsonData = await getJsonData.ConfigureAwait(false); var json = Program.ReadJsonDictionary(jsonData); var versionInfo = new ClientVersionInfo(); if (json.TryGetValue("version", out string version)) { versionInfo.Version = version; } if (json.TryGetValue("clientVersionUpload", out string versionGuid)) { versionInfo.VersionGuid = versionGuid; } return(versionInfo); } }
public static async Task <ClientVersionInfo> Get(string buildType = "WindowsStudio", string branch = "roblox") { string jsonUrl = $"https://clientsettings.{branch}.com/v1/client-version/{buildType}"; using (WebClient http = new WebClient()) { string jsonData = await http.DownloadStringTaskAsync(jsonUrl); jsonData = jsonData.Replace('{', ' '); if (jsonData.Contains("bootstrap")) { int boot = jsonData.IndexOf("bootstrap"); jsonData = jsonData.Substring(0, boot - 2); } else { jsonData = jsonData.Replace('}', ' '); } var versionInfo = new ClientVersionInfo(); jsonData = jsonData.Trim(); foreach (string kvPairStr in jsonData.Split(',')) { string[] kvPair = kvPairStr.Split(':'); string key = kvPair[0] .Replace('"', ' ') .Trim(); string val = kvPair[1] .Replace('"', ' ') .Trim(); if (key == "version") { versionInfo.Version = val; continue; } else if (key == "clientVersionUpload") { versionInfo.Guid = val; continue; } Console.WriteLine("Unhandled key: {0}?", key); } return(versionInfo); } }
// This does a quick check of /versionQTStudio without resolving // if its the proper version-guid for gametest builds. This should // make gametest update checks faster... at least for 64-bit users. public static async Task <string> GetFastVersionGuid(string branch) { if (branch == "roblox") { string binaryType = GetStudioBinaryType(); var info = await ClientVersionInfo.Get(binaryType); return(info.Guid); } else { string fastUrl = $"https://s3.amazonaws.com/setup.{branch}.com/versionQTStudio"; return(await http.DownloadStringTaskAsync(fastUrl)); } }
private async void editFVariables_Click(object sender, EventArgs e) { bool allow = true; // Create a warning prompt if the user hasn't disabled this warning. var warningDisabled = Program.GetBool("Disable Flag Warning"); if (!warningDisabled) { SystemSounds.Hand.Play(); allow = false; Form warningPrompt = createFlagWarningPrompt(); warningPrompt.ShowDialog(); DialogResult result = warningPrompt.DialogResult; if (result == DialogResult.Yes) { Program.SetValue("Disable Flag Warning", warningPrompt.Enabled); allow = true; } } if (allow) { string branch = (string)branchSelect.SelectedItem; Enabled = false; UseWaitCursor = true; ClientVersionInfo info = await RobloxStudioInstaller.GetCurrentVersionInfo(branch); Hide(); await RobloxStudioInstaller.BringUpToDate(branch, info.Guid, "Some newer flags might be missing."); FlagEditor editor = new FlagEditor(branch); editor.ShowDialog(); Show(); BringToFront(); Enabled = true; UseWaitCursor = false; } }
public static async Task <ClientVersionInfo> Get(string buildType = "WindowsStudio", string branch = "roblox") { string jsonUrl = $"https://clientsettingscdn.{branch}.com/v1/client-version/{buildType}"; using (WebClient http = new WebClient()) { string jsonData = await http.DownloadStringTaskAsync(jsonUrl); var json = Program.ReadJsonDictionary(jsonData); var versionInfo = new ClientVersionInfo(); json.TryGetValue("version", out versionInfo.Version); json.TryGetValue("clientVersionUpload", out versionInfo.Guid); return(versionInfo); } }
public static async Task <StudioDeployLogs> Get(string branch) { StudioDeployLogs logs = null; if (LogCache.ContainsKey(branch)) { logs = LogCache[branch]; } else { logs = new StudioDeployLogs(branch); } var getDeployHistory = HistoryCache.GetDeployHistory(branch); string deployHistory = await getDeployHistory.ConfigureAwait(false); if (logs.LastDeployHistory != deployHistory) { int maxVersion = int.MaxValue; if (branch == "roblox") { string binaryType = StudioBootstrapper.GetStudioBinaryType(); var getInfo = ClientVersionInfo.Get(binaryType); var info = await getInfo.ConfigureAwait(false); int version = info.Version .Split('.') .Select(int.Parse) .Skip(1) .First(); maxVersion = version; } logs.LastDeployHistory = deployHistory; logs.UpdateLogs(deployHistory, maxVersion); } return(logs); }
private async void editExplorerIcons_Click(object sender, EventArgs e) { Enabled = false; UseWaitCursor = true; string branch = (string)branchSelect.SelectedItem; ClientVersionInfo info = await RobloxStudioInstaller.GetCurrentVersionInfo(branch); Hide(); await RobloxStudioInstaller.BringUpToDate(branch, info.Guid, "The explorer icons may have received an update."); var editor = new ExplorerIconEditor(branch); editor.ShowDialog(); Show(); BringToFront(); Enabled = true; UseWaitCursor = false; }
private async void editExplorerIcons_Click(object sender, EventArgs e) { Enabled = false; UseWaitCursor = true; string branch = (string)branchSelect.SelectedItem; ClientVersionInfo info = await StudioBootstrapper.GetCurrentVersionInfo(branch); Hide(); await StudioBootstrapper.BringUpToDate(branch, info.Guid, "对象图标可能已被更新。"); var editor = new ClassIconEditor(branch); editor.ShowDialog(); Show(); BringToFront(); Enabled = true; UseWaitCursor = false; }
public async Task RunInstaller(string branch) { restore(); setStatus("Checking for updates"); echo("Checking build installation..."); string currentBranch = Program.GetString("BuildBranch", "roblox"); string currentVersion = versionRegistry.GetString("VersionGuid"); bool shouldInstall = (forceInstall || currentBranch != branch); string fastVersion = await GetFastVersionGuid(currentBranch); if (branch == "roblox") { buildVersion = fastVersion; } ClientVersionInfo versionInfo = null; if (shouldInstall || fastVersion != currentVersion) { if (currentBranch != "roblox") { echo("Possible update detected, verifying..."); } versionInfo = await GetCurrentVersionInfo(branch, fastVersion); buildVersion = versionInfo.Guid; } else { buildVersion = fastVersion; } if (currentVersion != buildVersion || shouldInstall) { echo("This build needs to be installed!"); bool studioClosed = await shutdownStudioProcesses(); if (studioClosed) { string binaryType = GetStudioBinaryType(); string studioDir = GetStudioDirectory(); string versionId = versionInfo.Version; restore(); setStatus($"Installing Version {versionId} of Roblox Studio..."); var taskQueue = new List <Task>(); echo("Grabbing package manifest..."); List <PackageManifest> pkgManifest = await PackageManifest.Get(branch, buildVersion); echo("Grabbing file manifest..."); fileManifest = await FileManifest.Get(branch, buildVersion); progressBar.Maximum = 1; progressBar.Value = 0; progressBar.Style = ProgressBarStyle.Continuous; progressBar.Refresh(); foreach (PackageManifest package in pkgManifest) { Task installer = Task.Run(() => installPackage(package)); taskQueue.Add(installer); } await Task.WhenAll(taskQueue.ToArray()); echo("Writing AppSettings.xml..."); string appSettings = Path.Combine(studioDir, "AppSettings.xml"); File.WriteAllText(appSettings, appSettingsXml); setStatus("Deleting unused files..."); await deleteUnusedFiles(); progressBar.Style = ProgressBarStyle.Marquee; progressBar.Refresh(); Program.SetValue("BuildBranch", branch); versionRegistry.SetValue("Version", versionId); versionRegistry.SetValue("VersionGuid", buildVersion); } else { progressBar.Style = ProgressBarStyle.Marquee; progressBar.Refresh(); echo("Update cancelled. Launching on current branch and version."); } } else { echo("This version of Roblox Studio has been installed!"); } setStatus("Configuring Roblox Studio..."); echo("Updating registry protocols..."); Program.UpdateStudioRegistryProtocols(); if (exitWhenClosed) { echo("Applying flag configuration..."); FlagEditor.ApplyFlags(); echo("Patching explorer icons..."); await ExplorerIconEditor.PatchExplorerIcons(); } setStatus("Starting Roblox Studio..."); echo("Roblox Studio is up to date!"); await Task.Delay(1000); }
public static async Task <ClientVersionInfo> GetCurrentVersionInfo(string branch, string fastVersionGuid = "") { string binaryType = GetStudioBinaryType(); if (branch == "roblox") { return(await ClientVersionInfo.Get(binaryType)); } if (fastVersionGuid != "") { string latestGuid; if (binaryType == "WindowsStudio64") { latestGuid = versionRegistry.GetString("LatestGuid_x86"); } else { latestGuid = versionRegistry.GetString("LatestGuid_x64"); } // If we already determined the fast version guid is pointing // to the other version of Roblox Studio, fallback to the // version data that has been cached already. if (fastVersionGuid == latestGuid) { string versionId = versionRegistry.GetString("Version"); string versionGuid = versionRegistry.GetString("VersionGuid"); ClientVersionInfo proxy = new ClientVersionInfo() { Version = versionId, Guid = versionGuid }; return(proxy); } } // Unfortunately as of right now, the ClientVersionInfo end-point on // gametest isn't available to the public, so I have to use some hacks // with the DeployHistory.txt file to figure out what version guid to use. var logData = await StudioDeployLogs.Get(branch); var currentLogs = logData.CurrentLogs; int numLogs = currentLogs.Count; DeployLog latest = currentLogs[numLogs - 1]; DeployLog prev = currentLogs[numLogs - 2]; DeployLog build_x86, build_x64; // If these builds aren't using the same perforce changelist, // then the 64-bit version hasn't been deployed yet. There is // usually a ~5 minute gap between the new 32-bit version being // deployed, and the 64-bit version proceeding it. if (prev.Changelist != latest.Changelist) { build_x86 = latest; build_x64 = prev; } else { build_x86 = prev; build_x64 = latest; } var info = new ClientVersionInfo(); if (binaryType == "WindowsStudio64") { info.Version = build_x64.ToString(); info.Guid = build_x64.VersionGuid; } else { info.Version = build_x86.ToString(); info.Guid = build_x86.VersionGuid; } versionRegistry.SetValue("LatestGuid_x86", build_x86.VersionGuid); versionRegistry.SetValue("LatestGuid_x64", build_x64.VersionGuid); return(info); }
public static async Task <ClientVersionInfo> GetCurrentVersionInfo(string branch, string fastGuid = "") { string targetVersion = Program.GetString("TargetVersion"); if (targetVersion != "") { return(await GetTargetVersionInfo(branch, targetVersion)); } string binaryType = GetStudioBinaryType(); bool is64Bit = Environment.Is64BitOperatingSystem; if (branch == "roblox") { return(await ClientVersionInfo.Get(binaryType)); } if (fastGuid == "") { fastGuid = await GetFastVersionGuid(branch); } string latestFastGuid = versionRegistry.GetString("LatestFastGuid"); var info = new ClientVersionInfo(); if (latestFastGuid == fastGuid) { string version = versionRegistry.GetString("Version"); info.Version = version; string latest_x86 = versionRegistry.GetString("LatestGuid_x86"); string latest_x64 = versionRegistry.GetString("LatestGuid_x64"); if (latestFastGuid == latest_x64 && is64Bit) { info.Guid = latest_x64; return(info); } if (latestFastGuid == latest_x86 && !is64Bit) { info.Guid = latest_x86; return(info); } } // Unfortunately the ClientVersionInfo end-point on sitetest // isn't available to the public, so I have to parse the // DeployHistory.txt file on their setup s3 bucket. var logData = await StudioDeployLogs.Get(branch); DeployLog build_x86 = logData.CurrentLogs_x86.Last(); DeployLog build_x64 = logData.CurrentLogs_x64.Last(); if (is64Bit) { info.Version = build_x64.VersionId; info.Guid = build_x64.VersionGuid; } else { info.Version = build_x86.VersionId; info.Guid = build_x86.VersionGuid; } versionRegistry.SetValue("LatestFastGuid", fastGuid); versionRegistry.SetValue("LatestGuid_x86", build_x86.VersionGuid); versionRegistry.SetValue("LatestGuid_x64", build_x64.VersionGuid); return(info); }
public async Task RunInstaller(string branch, bool setStartEvent = false) { restore(); setStatus("检查更新中"); echo("检查该构建版本是否可安装..."); string currentBranch = Program.GetString("BuildBranch", "roblox"); string currentVersion = versionRegistry.GetString("VersionGuid"); bool shouldInstall = (forceInstall || currentBranch != branch); string fastVersion = await GetFastVersionGuid(currentBranch); ClientVersionInfo versionInfo = null; if (shouldInstall || fastVersion != currentVersion) { if (currentBranch != "roblox") { echo("发现已有更新,验证中..."); } versionInfo = await GetCurrentVersionInfo(branch, fastVersion); buildVersion = versionInfo.Guid; } else { buildVersion = fastVersion; } if (currentVersion != buildVersion || shouldInstall) { echo("此构建版本需要安装!"); bool studioClosed = await shutdownStudioProcesses(); if (studioClosed) { string binaryType = GetStudioBinaryType(); string studioDir = GetStudioDirectory(); string versionId = versionInfo.Version; restore(); setStatus($"正在安装版本为 {versionId} 的 Roblox Studio..."); var taskQueue = new List <Task>(); writtenFiles = new HashSet <string>(); echo("正在获取版本元信息..."); var pkgManifest = await PackageManifest.Get(branch, buildVersion); echo("正在获取文件元信息..."); fileManifest = await FileManifest.Get(branch, buildVersion); progressBar.Maximum = 5000; progressBar.Value = 0; progressBar.Style = ProgressBarStyle.Continuous; progressBar.Refresh(); foreach (var package in pkgManifest) { Task installer = Task.Run(() => installPackage(branch, package)); taskQueue.Add(installer); } await Task.WhenAll(taskQueue); echo("正在写入 AppSettings.xml..."); string appSettings = Path.Combine(studioDir, "AppSettings.xml"); File.WriteAllText(appSettings, appSettingsXml); setStatus("正在搜索未使用的文件..."); await deleteUnusedFiles(); progressBar.Style = ProgressBarStyle.Marquee; progressBar.Refresh(); Program.SetValue("BuildBranch", branch); versionRegistry.SetValue("Version", versionId); versionRegistry.SetValue("VersionGuid", buildVersion); } else { progressBar.Style = ProgressBarStyle.Marquee; progressBar.Refresh(); echo("更新已取消,正在启动当前已有分支版本..."); } } else { echo("该版本安装成功!"); } setStatus("正在配置 Roblox Studio..."); echo("正在更新注册表..."); Program.UpdateStudioRegistryProtocols(); if (exitWhenClosed) { echo("应用参数配置中..."); FlagEditor.ApplyFlags(); echo("修改浏览窗口图标中..."); await ClassIconEditor.PatchExplorerIcons(); } setStatus("正在启动 Roblox Studio..."); echo("Roblox Studio 已为最新版!"); if (setStartEvent) { SystemEvent start = new SystemEvent("RobloxStudioModManagerStart"); autoExitTask = Task.Run(async() => { bool started = await start.WaitForEvent(); start.Close(); if (started) { await Task.Delay(500); Application.Exit(); } }); StartEvent = start; } }