public async void TS_File_New_Click(object sender, EventArgs e) { Paths.Description = "Please select a Dump Directory"; string dumpDirectory = Paths.FolderPath; if (Paths.FolderResult != DialogResult.OK) { return; } string buildDirectory = configMan.GetDirectory("BuildDirectory", "Grim"); lManager.Enter(Sender.DATA, Level.NOTICE, "Building new client to:\n\t-{0}", buildDirectory); tab_disabled = true; await Task.Run(() => { try { core.Backups = false; core.BuildDataFiles(dumpDirectory, buildDirectory); } catch (Exception ex) { MessageBox.Show(ex.Message, "Build Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); lManager.Enter(Sender.DATA, Level.ERROR, ex); return; } finally { string msg = "Client build completed!"; MessageBox.Show(msg, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); lManager.Enter(Sender.DATA, Level.NOTICE, msg); if (configMan["ClearOnCreate", "Data"]) { core.Clear(); } else { display_data(); } core.Backups = true; } }); ts_status.Text = string.Empty; tab_disabled = false; }
void generate_file_list() { string dir = configMan.GetDirectory("Directory", "Flag"); if (!Directory.Exists(dir)) { string msg = string.Format("flag.directory does not exist!\n\tDirectory: {0}", dir); MessageBox.Show(msg, "Flag Utility Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); lManager.Enter(Sender.FLAG, Level.ERROR, msg); return; } string[] paths = Directory.GetFiles(dir); foreach (string filePath in paths) { lists.Add(Path.GetFileNameWithoutExtension(filePath)); } lManager.Enter(Sender.FLAG, Level.DEBUG, "{0} flag files loaded from {1}", paths.Length, dir); }