Exemplo n.º 1
0
        private void RenameSave_Click(object sender, EventArgs e)
        {
            if (listSaveStates.SelectedIndex < 0)
            {
                return;
            }

            var newSaveState = new NewSaveState(DialogAction.Rename, GetSaveNames(_categories[listCategories.SelectedIndex]));

            newSaveState.SaveStateName = _saveStates[listSaveStates.SelectedIndex].SaveStateName;
            newSaveState.ShowDialog();

            if (newSaveState.DialogResult == DialogResult.OK)
            {
                var config            = BlossomConfig.GetBlossomConfig();
                var categoryName      = _categories[listCategories.SelectedIndex].CategoryName;
                var originalSaveState = _categories[listCategories.SelectedIndex].SaveStates[listSaveStates.SelectedIndex];

                _categories[listCategories.SelectedIndex].SaveStates[listSaveStates.SelectedIndex] = Helper.RenameSave(originalSaveState, categoryName, newSaveState.SaveStateName);

                _saveStates = new BindingList <SaveState>(_categories[listCategories.SelectedIndex].SaveStates);

                BindSaves();
            }

            Helper.WriteSaveInfo(_categories);
        }
Exemplo n.º 2
0
 public ConfigForm()
 {
     InitializeComponent();
     BlossomConfig.LoadConfig();
     _config = BlossomConfig.GetBlossomConfig();
     UpdateTextBoxes();
 }
Exemplo n.º 3
0
        public static SaveState CreateSaveState(string categoryName, string saveStateName, string origAFilePath, string origBFilePath, string origCFilePath)
        {
            var config            = BlossomConfig.GetBlossomConfig();
            var shortenedCategory = new string(categoryName.Where(char.IsLetterOrDigit).ToArray());
            var shortenedState    = new string(saveStateName.Where(char.IsLetterOrDigit).ToArray());
            var save = new SaveState()
            {
                SaveStateName = saveStateName,
                CategoryName  = categoryName,
                FileAName     = $@"{shortenedCategory}-{shortenedState}-A-{Guid.NewGuid()}.txt",
                FileBName     = $@"{shortenedCategory}-{shortenedState}-B-{Guid.NewGuid()}.txt",
                FileCName     = $@"{shortenedCategory}-{shortenedState}-C-{Guid.NewGuid()}.txt"
            };

            try
            {
                File.Copy(origAFilePath, GetFullManagedSavePath(save.FileAName));
                File.Copy(origBFilePath, GetFullManagedSavePath(save.FileBName));
                File.Copy(origCFilePath, GetFullManagedSavePath(save.FileCName));
            }
            catch (Exception)
            {
            }
            return(save);
        }
Exemplo n.º 4
0
        public static void DeleteSave(SaveState saveState)
        {
            var config = BlossomConfig.GetBlossomConfig();

            try
            {
                File.Delete(GetFullManagedSavePath(saveState.FileAName));
                File.Delete(GetFullManagedSavePath(saveState.FileBName));
                File.Delete(GetFullManagedSavePath(saveState.FileCName));
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 5
0
        private void LoadSelectedSave_Click(object sender, EventArgs e)
        {
            var config      = BlossomConfig.GetBlossomConfig();
            var targetAPath = Path.Combine(config.OriginalSaveDirectory, $"{Helper.SaveFileBaseName}{_loadSlot}{Helper.AFileEnding}");
            var targetBPath = Path.Combine(config.OriginalSaveDirectory, $"{Helper.SaveFileBaseName}{_loadSlot}{Helper.BFileEnding}");
            var targetCPath = Path.Combine(config.OriginalSaveDirectory, $"{Helper.SaveFileBaseName}{_loadSlot}{Helper.CFileEnding}");

            var selectedSave = _saveStates[listSaveStates.SelectedIndex];

            try
            {
                File.Copy(Path.Combine(config.ManagedSaveDirectory, selectedSave.FileAName), targetAPath, true);
                File.Copy(Path.Combine(config.ManagedSaveDirectory, selectedSave.FileBName), targetBPath, true);
                File.Copy(Path.Combine(config.ManagedSaveDirectory, selectedSave.FileCName), targetCPath, true);
            }
            catch (Exception) { }
        }
Exemplo n.º 6
0
        public static string GetOriginalSavePath(int saveSlotNumber, string fileLetter)
        {
            string ending;

            if (fileLetter.Equals("A", StringComparison.InvariantCultureIgnoreCase))
            {
                ending = AFileEnding;
            }
            else if (fileLetter.Equals("B", StringComparison.InvariantCultureIgnoreCase))
            {
                ending = BFileEnding;
            }
            else
            {
                ending = CFileEnding;
            }

            var config = BlossomConfig.GetBlossomConfig();

            return(Path.Combine(config.OriginalSaveDirectory, $"{SaveFileBaseName}{saveSlotNumber}{ending}"));
        }
Exemplo n.º 7
0
        public static string GetFullManagedSavePath(string managedSaveFileName)
        {
            var config = BlossomConfig.GetBlossomConfig();

            return(Path.Combine(config.ManagedSaveDirectory, managedSaveFileName));
        }