private void BtnStart_Click(object sender, EventArgs e) { btnStart.Enabled = false; txtLog.Text += "STARTING\r\n"; txtLog.Update(); BBL bbl = new BBL(); bbl.load(txtBBL.Text); string[] files = Directory.GetFiles(txtDir.Text, "*.bbc"); foreach (string file in files) { BBC bbc = new BBC(); txtLog.Text += file + "\r\n"; txtLog.Update(); string error = bbc.load(file); if (error != null) { txtLog.Text = "[ERROR][" + file + "] " + error + "\r\n"; txtLog.Update(); } bbl.removeBlocks(bbc); } bbl.save(txtOutput.Text); txtLog.Text += "DONE\r\n"; btnStart.Enabled = true; }
private async void BtnStart_Click(object sender, EventArgs e) { btnStart.Enabled = false; txtLog.Text += "STARTING\r\n"; txtLog.Update(); BBL bbl = new BBL(); bbl.load(txtBBL.Text); while (txtDir.Text.EndsWith("\\") || txtDir.Text.EndsWith("/")) { txtDir.Text = txtDir.Text.Substring(0, txtDir.Text.Length - 1); } Dictionary <string, int> result = bbl.plant(txtDir.Text); foreach (KeyValuePair <string, int> file in result) { txtLog.Text += file.Key + "\r\n"; switch (file.Value) { case 0: break; case 1: txtLog.Text += "[NO FILE] " + file.Key + "\r\n"; break; case 2: txtLog.Text += "[READ/WRITE ERROR] " + file.Key + "\r\n"; break; default: txtLog.Text += "[UNKNOWN:" + file.Value + "] " + file.Key + "\r\n"; break; } txtLog.Update(); } txtLog.Text += "DONE\r\n"; btnStart.Enabled = true; }