Exemplo n.º 1
0
        private void mergeCsvAtClick(object sender, EventArgs e)
        {
            string path_CSV2 = "";

            string[]   csvLines2;
            int        i, offset;
            CSV_Import single_entry;

            if (openCSV.ShowDialog() == DialogResult.OK)
            {
                path_CSV2 = openCSV.FileName;
                csvLines2 = File.ReadAllLines(@path_CSV2, Encoding.GetEncoding(1252));
                csvLines2 = csvLines2.Skip(1).ToArray();
                offsetListBox.Items.Clear();
                for (i = 0; i < csvLines2.Count(); i++)
                {
                    single_entry        = new CSV_Import();
                    offset              = Int32.Parse(csvLines2[i].Split(';')[0].Remove(0, 2), System.Globalization.NumberStyles.HexNumber);
                    single_entry.Offset = offset;
                    if (csvLines2[i].Split(';')[1] == "Y")
                    {
                        single_entry.Changed = true;
                    }
                    if (csvLines2[i].Split(';')[1] == "N")
                    {
                        single_entry.Changed = false;
                    }
                    if (csvLines2[i].Split(';')[2] == "")
                    {
                        single_entry.Repoint = 0;
                    }
                    if (csvLines2[i].Split(';')[2] != "")
                    {
                        single_entry.Repoint = Int32.Parse(csvLines2[i].Split(';')[2].Remove(0, 2), System.Globalization.NumberStyles.HexNumber);
                    }
                    single_entry.Text = csvLines2[i].Split(';')[3];
                    if (mainForm.getIndexBookmarkFromOffset(offset) == -1)
                    {
                        mainForm.data_CSV.Add(single_entry);
                    }
                }

                for (i = 0; i < mainForm.data_CSV.Count(); i++)
                {
                    if (mainForm.data_CSV[i].Repoint != 0)
                    {
                        offset = mainForm.data_CSV[i].Repoint;
                    }
                    else
                    {
                        offset = mainForm.data_CSV[i].Offset;
                    }
                    offsetListBox.Items.Add(offset.ToString("X6") + "\t   " + mainForm.data_CSV[i].Text);
                    mainForm.saveCsvAfterEditing(path_CSV);
                }
            }
        }
Exemplo n.º 2
0
        private void getDataFromPath(string path)
        {
            int        i, offset;
            CSV_Import single_entry;

            path_CSV = path;
            csvLines = File.ReadAllLines(@path_CSV, Encoding.GetEncoding(1252));
            csvLines = csvLines.Skip(1).ToArray();
            offsetListBox.Items.Clear();
            mainForm.data_CSV.Clear();
            for (i = 0; i < csvLines.Count(); i++)
            {
                single_entry        = new CSV_Import();
                single_entry.Offset = Int32.Parse(csvLines[i].Split(';')[0].Remove(0, 2), System.Globalization.NumberStyles.HexNumber);
                if (csvLines[i].Split(';')[1] == "Y")
                {
                    single_entry.Changed = true;
                }
                if (csvLines[i].Split(';')[1] == "N")
                {
                    single_entry.Changed = false;
                }
                if (csvLines[i].Split(';')[2] == "")
                {
                    single_entry.Repoint = 0;
                }
                if (csvLines[i].Split(';')[2] != "")
                {
                    single_entry.Repoint = Int32.Parse(csvLines[i].Split(';')[2].Remove(0, 2), System.Globalization.NumberStyles.HexNumber);
                }
                single_entry.Text = csvLines[i].Split(';')[3];
                mainForm.data_CSV.Add(single_entry);
            }

            for (i = 0; i < mainForm.data_CSV.Count(); i++)
            {
                if (mainForm.data_CSV[i].Repoint != 0)
                {
                    offset = mainForm.data_CSV[i].Repoint;
                }
                else
                {
                    offset = mainForm.data_CSV[i].Offset;
                }
                offsetListBox.Items.Add(offset.ToString("X6") + "\t   " + mainForm.data_CSV[i].Text);
            }
            addOffsetButton.Enabled         = true;
            addCsvToBookmarksButton.Enabled = true;
            loadOffsetButton.Enabled        = true;
            Properties.Settings.Default.lastBookmarkPath = path_CSV;
            Properties.Settings.Default.Save();
        }
Exemplo n.º 3
0
        private void addNewOffsetToListOnClick(object sender, EventArgs e)
        {
            int        offset = (int)mainForm.offsetBox.Value;
            CSV_Import single_entry;

            csvLines             = File.ReadAllLines(@path_CSV, Encoding.GetEncoding(1252));
            csvLines             = csvLines.Skip(1).ToArray();
            single_entry         = new CSV_Import();
            single_entry.Offset  = offset;
            single_entry.Changed = false;
            single_entry.Repoint = 0;
            single_entry.Text    = mainForm.textBox.Text;
            mainForm.data_CSV.Add(single_entry);
            offsetListBox.Items.Add(offset.ToString("X6") + "\t   " + mainForm.data_CSV[mainForm.data_CSV.Count - 1].Text);
            mainForm.saveCsvAfterEditing(path_CSV);
        }