private void button1_Click(object sender, EventArgs e) { if (!add) { add = true; delete = false; load = false; MTitleField.Enabled = true; FTitleField.Enabled = true; EntryField.Enabled = false; return; } string fTitle = FTitleField.Text; string mTitle = MTitleField.Text; string titleRow = DBCUtil.formatEntry(fTitle, mTitle); DBCUtil.addTitle(titleRow); DBCUtil.csvToDbc(); if (titleList != null) { titleList.addOption(DBCUtil.formatDBCRow(titleRow)); } updateAddStatus(); load = false; }
private void updateAddStatus() { EntryField.Text = DBCUtil.currEntry().ToString(); string change = String.Format("Added title with ID {0}", DBCUtil.currEntry()); updateStatus(change); }
private void DeleteTitle_Click(object sender, EventArgs e) { if (!delete && !load) { delete = true; add = false; MTitleField.Enabled = false; FTitleField.Enabled = false; EntryField.Enabled = true; return; } string data = getLine(); if (data == null) { return; } string tempFile = Path.GetTempFileName(); List <string> linesToKeep = File.ReadLines("CharTitles.dbc.csv").Where(line => line != data).ToList(); File.WriteAllLines(tempFile, linesToKeep); File.Delete("CharTitles.dbc.csv"); File.Move(tempFile, "CharTitles.dbc.csv"); DBCUtil.csvToDbc(); if (titleList != null) { titleList.removeOption(DBCUtil.formatDBCRow(data)); } updateDeleteStatus(); }
private void selectTitle() { string selectedItem = listView.GetItemText(listView.SelectedItem); if (selectedItem == string.Empty) { return; } int titleID = int.Parse(DBCUtil.getColumnValue(0, selectedItem)); application.select(titleID); application.delete = true; }
private void addOptions() { List <String> lines = DBCUtil.readRows(); for (int i = 0; i < lines.Count; i++) { if (i == 0) { continue; } listView.Items.Add(DBCUtil.formatDBCRow(lines[i])); } }
private void loadTitle() { string data = getLine(); if (data == null) { return; } MTitleField.Text = DBCUtil.getColumnValue(2, data).Replace("\"", ""); FTitleField.Text = DBCUtil.getColumnValue(19, data).Replace("\"", ""); updateLoadStatus(); }
private string getLine() { if (EntryField.Text == string.Empty) { return(null); } int targetEntry = int.Parse(EntryField.Text); string data = DBCUtil.findTitleRow(targetEntry); if (data == null) { updateStatus(String.Format("Could not find title with entry {0}", targetEntry)); return(null); } return(data); }
public static int nextInGameOrder() { return(int.Parse(DBCUtil.getColumnValue(36)) + 1); }
public static int nextEntry() { return(int.Parse(DBCUtil.getColumnValue(0)) + 1); }
public Application() { InitializeComponent(); DBCUtil.dbcToCsv(); titleList = null; }