Esempio n. 1
0
        private void openFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileName = "";

            var startupPath = Config.StartupPath;

            if (startupPath == "")
            {
                startupPath = Application.StartupPath;
            }
            openFileDialog1.InitialDirectory = startupPath;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Config.StartupPath = Path.GetDirectoryName(openFileDialog1.FileName);

                var saveFile = Model.SaveFile.FromPath(openFileDialog1.FileName);

                if (saveFile.Type != Enums.SaveFileType.Chapter)
                {
                    MessageBox.Show("This type of save is not supported yet. Only 'Chapter' saves are supported right now.");
                    return;
                }
                else
                {
                    _saveFile = saveFile;
                }

                UpdateTitleBar(openFileDialog1.FileName);

                _chapterSave = Model.ChapterSave.FromSaveFile(_saveFile);

                listBox1.DisplayMember = "CharacterID";
                listBox1.ValueMember   = "BinaryPosition"; // Sure, why not
                listBox1.Items.Clear();
                foreach (var character in _chapterSave.Characters)
                {
                    listBox1.Items.Add(character);
                }

                PopulatePickers();
                LoadChapterData();
                BindEventHandlers();

                tabControl1.Enabled = true;

                listBox1.SelectedIndex = 0;
            }
        }
Esempio n. 2
0
 private void ReadFromFile(SaveFile file)
 {
     _file = file;
     Read();
 }