private async void viewApiDumpClassic_Click(object sender, EventArgs e) { await lockWindowAndRunTask(async() => { string branch = getBranch(); string apiFilePath = await getApiDumpFilePath(branch); string apiJson = File.ReadAllText(apiFilePath); ReflectionDatabase api = ReflectionDatabase.Load(apiJson); ReflectionDumper dumper = new ReflectionDumper(api); string result = dumper.Run(); FileInfo info = new FileInfo(apiFilePath); string directory = info.DirectoryName; string resultPath = Path.Combine(directory, branch + "-api-dump.txt"); writeAndViewFile(resultPath, result); }); }
private async void compareVersions_Click(object sender, EventArgs e) { await lockWindowAndRunTask(async() => { string newBranch = getBranch(); bool fetchPrevious = (newBranch == "roblox"); string newApiFilePath = await getApiDumpFilePath(newBranch); string oldApiFilePath = await getApiDumpFilePath("roblox", fetchPrevious); setStatus("Reading the " + (fetchPrevious ? "Previous" : "Production") + " API..."); string oldApiJson = File.ReadAllText(oldApiFilePath); ReflectionDatabase oldApi = ReflectionDatabase.Load(oldApiJson); setStatus("Reading the " + (fetchPrevious ? "Production" : "New") + " API..."); string newApiJson = File.ReadAllText(newApiFilePath); ReflectionDatabase newApi = ReflectionDatabase.Load(newApiJson); setStatus("Comparing APIs..."); ReflectionDiffer differ = new ReflectionDiffer(); string result = differ.CompareDatabases(oldApi, newApi); if (result.Length > 0) { FileInfo info = new FileInfo(newApiFilePath); string directory = info.DirectoryName; string resultPath = Path.Combine(directory, newBranch + "-diff.txt"); writeAndViewFile(resultPath, result); } else { MessageBox.Show("No differences were found!", "Well, this is awkward...", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); }