Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
[DownloadBuildList] repoint URL
Browse files Browse the repository at this point in the history
[ProcessBuildList] rewrite parser
[UI] minor text fixes
[Misc] minor code cleanup
  • Loading branch information
Helios747 committed Jun 14, 2017
1 parent 2c19f9f commit 01bb802
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 120 deletions.
14 changes: 6 additions & 8 deletions DolphinBisectTool/Backend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,18 @@ class Backend

int m_first_index;
int m_second_index;
public string m_major_version;
List<int> m_build_list;
List<string> m_build_list;

public Backend(int first_index, int second_index, List<int> build_list, string major_version)
public Backend(int first_index, int second_index, List<string> build_list)
{
m_first_index = first_index;
m_second_index = second_index;
m_build_list = build_list;
m_major_version = major_version;
}

public void Bisect(string boot_title = "")
{
string base_url = "https://dl.dolphin-emu.org/builds/dolphin-master-" + m_major_version + "-";
string base_url = "https://dl.dolphin-emu.org/builds/dolphin-master-";
int test_index = 0;
RunBuild run_build = new RunBuild();

Expand All @@ -47,7 +45,7 @@ public void Bisect(string boot_title = "")

test_index = m_first_index == -1 ? (0 + m_second_index) / 2 : (m_first_index + m_second_index) / 2;

Download(base_url + m_build_list[test_index] + "-x64.7z", m_major_version, m_build_list[test_index]);
Download(base_url + m_build_list[test_index] + "-x64.7z", m_build_list[test_index]);

if (!string.IsNullOrEmpty(boot_title))
run_build.Run(boot_title);
Expand All @@ -68,11 +66,11 @@ public void Bisect(string boot_title = "")

if (open_url == UserInput.Yes)
{
Process.Start("https://dolp.in/" + m_major_version + "-" + m_build_list[test_index+1]);
Process.Start("https://dolp.in/" + m_build_list[test_index+1]);
}
}

public void Download(string url, string major_version, int version)
public void Download(string url, string version)
{
// Windows will throw an error if you have the folder you're trying to delete open in
// explorer. It will remove the contents but error out on the folder removal. That's
Expand Down
2 changes: 1 addition & 1 deletion DolphinBisectTool/DownloadBuildList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Download()
this.UpdateProgress(100, "Parsing build list", ProgressBarStyle.Marquee);
};

client.DownloadFileAsync(new Uri("https://dl.dolphin-emu.org/builds/"), "buildindex");
client.DownloadFileAsync(new Uri("https://www.dolphin-emu.org/download/buildlist"), "buildindex");
}
}
}
Expand Down
65 changes: 4 additions & 61 deletions DolphinBisectTool/MainWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 8 additions & 35 deletions DolphinBisectTool/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace DolphinBisectTool
public partial class MainWindow : Form
{

List<int> m_build_list;
List<string> m_build_list;
static string s_major_version = "5.0";

DownloadBuildList m_download_build_list = new DownloadBuildList();
Expand All @@ -30,12 +30,12 @@ private UserInput BisectUserDialog(int build, bool final_trigger)
DialogResult result;
if (!final_trigger)
{
result = MessageBox.Show("Tested build " + s_major_version + "-" + m_build_list[build] + ". Did the bug happen in this build?",
result = MessageBox.Show("Tested build " + m_build_list[build] + ". Did the bug happen in this build?",
"Bisect", MessageBoxButtons.YesNoCancel);
}
else
{
result = MessageBox.Show("Build " + s_major_version + "-" + m_build_list[build] + " may be the cause of your issue. " +
result = MessageBox.Show("Build " + m_build_list[build] + " may be the cause of your issue. " +
"Do you want to open the URL for that build?", "Notice",
MessageBoxButtons.YesNo);
start_button.Enabled = true;
Expand Down Expand Up @@ -72,9 +72,6 @@ private void start_button_Click(object sender, EventArgs e)
{
int first_build;

if (radio_stable.Checked)
first_build = 0;
else
first_build = first_dev_build.SelectedIndex;

if (second_dev_build.SelectedIndex <= first_build)
Expand All @@ -85,7 +82,7 @@ private void start_button_Click(object sender, EventArgs e)

start_button.Enabled = false;

Backend backend = new Backend(first_build, second_dev_build.SelectedIndex, m_build_list, s_major_version);
Backend backend = new Backend(first_build, second_dev_build.SelectedIndex, m_build_list);
backend.BisectEvent += BisectUserDialog;
backend.UpdateProgress += ChangeProgressBar;

Expand Down Expand Up @@ -121,12 +118,12 @@ public void ChangeProgressBar(int value, string text, ProgressBarStyle style)
}
}

private void PopulateComboBoxes(List<int> list)
private void PopulateComboBoxes(List<string> list)
{
foreach (int i in list)
foreach (string i in list)
{
first_dev_build.Items.Add(s_major_version + "-" + i);
second_dev_build.Items.Add(s_major_version + "-" + i);
first_dev_build.Items.Add(i);
second_dev_build.Items.Add(i);
}

first_dev_build.SelectedIndex = 0;
Expand All @@ -138,30 +135,6 @@ private void EnableUI()
{
Enabled = true;
download_label.Visible = false;
radio_development.Enabled = true;
radio_stable.Select();
}

private void rbFirstStable_CheckedChanged(object sender, EventArgs e)
{
if (radio_stable.Checked)
{
first_stable_label.Text = "Version 4.0.2 will be tested against";
first_stable_label.Visible = true;
first_stable_label.Enabled = true;
first_dev_build.Enabled = false;
first_dev_build.Visible = false;
}
}

private void rbFirstDevelopment_CheckedChanged(object sender, EventArgs e)
{
if (radio_development.Checked)
{
first_stable_label.Visible = false;
first_dev_build.Enabled = true;
first_dev_build.Visible = true;
}
}
}
}
19 changes: 5 additions & 14 deletions DolphinBisectTool/ProcessBuildList.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;

namespace DolphinBisectTool
{
class ProcessBuildList
{
public List<int> Run(string s_major_version)
public List<string> Run(string s_major_version)
{
List<int> result = new List<int>();
Regex regex = new Regex(@"(?<=dolphin-master-" + s_major_version + @"-)(\d{1,4})(?=-x64.7z)");

using (StreamReader reader = new StreamReader("buildindex"))
{
string current_line;
while ((current_line = reader.ReadLine()) != null)
{
int stripped_build_num;
if (int.TryParse(regex.Match(current_line).Value, out stripped_build_num))
{
result.Add(stripped_build_num);
}
}
string raw_data = reader.ReadLine();
string refined_data = raw_data.Replace("\"", "").Replace("[", "").Replace("]", "").Replace(" ", "");

result.Sort();
List<string> result = refined_data.Split(',').ToList();
return result;
}
}
Expand Down
1 change: 0 additions & 1 deletion DolphinBisectTool/RunBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public void Run(string title = "")
using (var runner = new Process())
{
runner.StartInfo.WorkingDirectory = starting_directory;
// This is probably gross.
runner.StartInfo.FileName = starting_directory + string.Join("", match);
runner.StartInfo.UseShellExecute = false;
if (!string.IsNullOrEmpty(title))
Expand Down

0 comments on commit 01bb802

Please sign in to comment.