예제 #1
0
        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;
        }
예제 #2
0
        private void updateAddStatus()
        {
            EntryField.Text = DBCUtil.currEntry().ToString();
            string change = String.Format("Added title with ID {0}", DBCUtil.currEntry());

            updateStatus(change);
        }
예제 #3
0
        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();
        }
예제 #4
0
        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;
        }
예제 #5
0
        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]));
            }
        }
예제 #6
0
        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();
        }
예제 #7
0
        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);
        }
예제 #8
0
 public static int nextInGameOrder()
 {
     return(int.Parse(DBCUtil.getColumnValue(36)) + 1);
 }
예제 #9
0
 public static int nextEntry()
 {
     return(int.Parse(DBCUtil.getColumnValue(0)) + 1);
 }
예제 #10
0
 public Application()
 {
     InitializeComponent();
     DBCUtil.dbcToCsv();
     titleList = null;
 }