Skip to content

Commit

Permalink
added carrier box to spansh form
Browse files Browse the repository at this point in the history
  • Loading branch information
mck-9061 committed Feb 18, 2023
1 parent 469c77a commit cfa28cc
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 12 deletions.
22 changes: 11 additions & 11 deletions MultiCarrierManager/Forms/CATSForm.Designer.cs

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

3 changes: 3 additions & 0 deletions MultiCarrierManager/Forms/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public Form1() {
InitializeComponent();
this.Shown += new System.EventHandler(this.Form1_Shown);
}
// lord above why did I not use objects for this....
// i wrote this fucking code like 2 months ago why is it this bad
// what was i thinking
List<Tuple<string, JObject>> carriers = new List<Tuple<string, JObject>>();

private WebClient client = new WebClient();
Expand Down
27 changes: 26 additions & 1 deletion MultiCarrierManager/Forms/SpanshRouteForm.Designer.cs

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

43 changes: 43 additions & 0 deletions MultiCarrierManager/Forms/SpanshRouteForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,48 @@ private async void button1_Click(object sender, EventArgs e) {

Close();
}

private void SpanshRouteForm_Load(object sender, EventArgs e) {
if (Program.settings.GetTritium) {
label2.Text = "Select carrier for Tritium requirements:";
comboBox1.Enabled = true;

// Populate combo box with carriers
string[] files = Directory.GetFiles("carriers");
foreach (string file in files) {
string text = File.ReadAllText(file);
JObject carrier = JObject.Parse(text);
string name = ConvertHex(carrier["name"]["vanityName"].ToString());
comboBox1.Items.Add(name);
}
} else {
label2.Text = "Turn on Tritium requirements in settings to select carrier.";
comboBox1.Enabled = false;
}
}

public string ConvertHex(String hexString)
{
try
{
string ascii = string.Empty;

for (int i = 0; i < hexString.Length; i += 2)
{
String hs = string.Empty;

hs = hexString.Substring(i,2);
uint decval = System.Convert.ToUInt32(hs, 16);
char character = System.Convert.ToChar(decval);
ascii += character;

}

return ascii;
}
catch (Exception ex) { Console.WriteLine(ex.Message); }

return string.Empty;
}
}
}

0 comments on commit cfa28cc

Please sign in to comment.