Skip to content

Commit cd3a344

Browse files
committed
Minor update to fix the flag editor malfunctioning
1 parent 3d289f0 commit cd3a344

8 files changed

Lines changed: 290 additions & 18 deletions

File tree

‎Config/LatestReleaseTag.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2024.03.02
1+
v2024.12.18

‎ProjectSrc/Bootstrapper/StudioBootstrapper.cs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public class StudioBootstrapper
5656

5757
public Channel Channel { get; set; } = "LIVE";
5858
public string OverrideStudioDirectory { get; set; } = "";
59+
public string OverrideGuid { get; set; } = "";
5960

6061
public bool CanShutdownStudio { get; set; } = true;
6162
public bool CanForceStudioShutdown { get; set; } = false;
@@ -768,6 +769,9 @@ public async Task<bool> Bootstrap(string targetVersion = "")
768769
var getVersionInfo = GetCurrentVersionInfo(currentChannel, versionRegistry, targetVersion);
769770
ClientVersionInfo versionInfo = await getVersionInfo.ConfigureAwait(true);
770771

772+
if (OverrideGuid != "")
773+
versionInfo = new ClientVersionInfo(versionInfo.Channel, versionInfo.Version, OverrideGuid);
774+
771775
string studioDir = GetLocalStudioDirectory();
772776
buildVersion = versionInfo.VersionGuid;
773777

‎ProjectSrc/Forms/FlagEditor.cs‎

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Drawing;
66
using System.IO;
77
using System.Linq;
8+
using System.Net;
89
using System.Threading.Tasks;
910
using System.Windows.Forms;
1011

@@ -180,11 +181,15 @@ private void refreshFlags()
180181

181182
private async void InitializeEditor()
182183
{
183-
string localAppData = Environment.GetEnvironmentVariable("LocalAppData");
184+
var flagNames = new HashSet<string>();
185+
186+
var studioPath = StudioBootstrapper.GetStudioPath();
187+
FlagScanner.PerformScan(studioPath, flagNames);
184188

189+
string localAppData = Environment.GetEnvironmentVariable("LocalAppData");
185190
string settingsDir = Path.Combine(localAppData, "Roblox", "ClientSettings");
186-
string settingsPath = Path.Combine(settingsDir, "StudioAppSettings.json");
187191

192+
string settingsPath = Path.Combine(settingsDir, "StudioAppSettings.json");
188193
string lastExecVersion = versionRegistry.LastExecutedVersion;
189194
string versionGuid = versionRegistry.VersionGuid;
190195

@@ -228,7 +233,6 @@ private async void InitializeEditor()
228233
}
229234

230235
// Initialize flag browser
231-
string[] flagNames = flagRegistry.Keys.ToArray();
232236
string[] flagNameStrings = Array.Empty<string>();
233237

234238
string settings = File.ReadAllText(settingsPath);
@@ -241,6 +245,56 @@ private async void InitializeEditor()
241245
json = data.ToObject<Dictionary<string, string>>();
242246
}
243247

248+
/*
249+
Dictionary<string, string> webJson;
250+
251+
using (WebClient http = new WebClient())
252+
{
253+
http.Headers.Set("UserAgent", "RobloxStudioModManager");
254+
var rawData = await http.DownloadStringTaskAsync($"https://clientsettingscdn.roblox.com/v2/settings/application/PCStudioApp");
255+
256+
using (var reader = new StringReader(rawData))
257+
using (var jsonReader = new JsonTextReader(reader))
258+
{
259+
var data = JObject.Load(jsonReader);
260+
var appSettings = data["applicationSettings"];
261+
webJson = appSettings.ToObject<Dictionary<string, string>>();
262+
}
263+
}*/
264+
265+
foreach (var key in flagNames)
266+
{
267+
if (!json.ContainsKey(key))
268+
{
269+
string flagClass = "";
270+
271+
if (key.StartsWith("SF"))
272+
flagClass = "SF";
273+
else if (key.StartsWith("DF"))
274+
flagClass = "DF";
275+
else if (key.StartsWith("F"))
276+
flagClass = "F";
277+
278+
if (flagClass != "")
279+
{
280+
var prefix = key.Substring(flagClass.Length);
281+
282+
foreach (var pair in flagTypes)
283+
{
284+
if (prefix.StartsWith(pair.Key))
285+
{
286+
json.Add(key, pair.Value);
287+
break;
288+
}
289+
}
290+
}
291+
else
292+
{
293+
json.Add(key, "??");
294+
}
295+
}
296+
}
297+
244298
int numFlags = json.Count;
245299
var flagSetup = new List<FVariable>(numFlags);
246300
var autoComplete = new AutoCompleteStringCollection();
@@ -267,14 +321,17 @@ private async void InitializeEditor()
267321
if (!flagRegistry.TryGetValue(key, out var flag))
268322
flag = new FVariable(key, value);
269323

270-
autoComplete.Add(flag.Name);
324+
if (flag.Type == "")
325+
continue;
326+
327+
autoComplete.Add(flag.Key);
271328
flagSetup.Add(flag);
272329
}
273330

274331
flagSearchFilter.AutoCompleteCustomSource = autoComplete;
275332

276333
allFlags = flagSetup
277-
.OrderBy(flag => flag.Name)
334+
.OrderBy(flag => flag.Key)
278335
.ToList();
279336

280337
refreshFlags();
@@ -468,10 +525,6 @@ private void overrideDataGridView_CellEndEdit(object sender, DataGridViewCellEve
468525
{
469526
badInput = !int.TryParse(value, out int _);
470527
}
471-
else if (flagType.EndsWith("Log", format))
472-
{
473-
badInput = !byte.TryParse(value, out byte _);
474-
}
475528

476529
if (flagLookup.ContainsKey(flagKey))
477530
{

‎ProjectSrc/Forms/Launcher.cs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,16 @@ private async void editExplorerIcons_Click(object sender, EventArgs e)
361361
private async void launchStudio_Click(object sender = null, EventArgs e = null)
362362
{
363363
// var channel = getSelectedChannel();
364+
var overrideGuid = "";
365+
366+
if (args != null && args.Length > 0 && args[0].StartsWith("version-"))
367+
overrideGuid = args[0];
364368

365369
var bootstrapper = new StudioBootstrapper
366370
{
367371
ForceInstall = forceRebuild.Checked,
368372
ApplyModManagerPatches = true,
373+
OverrideGuid = overrideGuid,
369374
Channel = channel
370375
};
371376

‎ProjectSrc/Program.cs‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static class Program
1818
public const string RepoOwner = "MaximumADHD";
1919
public const string RepoName = "Roblox-Studio-Mod-Manager";
2020

21-
public const string ReleaseTag = "v2024.03.02";
21+
public const string ReleaseTag = "v2024.12.18";
2222
public static readonly string BaseConfigUrl = $"https://raw.githubusercontent.com/{RepoOwner}/{RepoName}/{RepoBranch}/Config/";
2323

2424
public static readonly RegistryKey LegacyRegistry = Registry.CurrentUser.GetSubKey("SOFTWARE", "Roblox Studio Mod Manager");
@@ -155,14 +155,10 @@ static void Main(string[] args)
155155
File.WriteAllText(stateFile, json);
156156
}
157157

158-
try
159-
{
160-
State = JsonConvert.DeserializeObject<ModManagerState>(json);
161-
}
162-
catch
163-
{
158+
State = JsonConvert.DeserializeObject<ModManagerState>(json);
159+
160+
if (State == null)
164161
State = new ModManagerState();
165-
}
166162

167163
// Make sure HTTPS uses TLS 1.2
168164
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

‎ProjectSrc/RobloxStudioModManager.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@
172172
<Compile Include="History\*.cs" />
173173
<Compile Include="Utility\AppState.cs" />
174174
<Compile Include="Utility\CustomFlag.cs" />
175+
<Compile Include="Utility\FlagScanner.cs" />
175176
<Compile Include="Utility\FVariable.cs" />
176177
<Compile Include="Utility\KnownRoot.cs" />
177178
<Compile Include="Utility\OrdinalSortJson.cs" />

0 commit comments

Comments
 (0)