private void CharDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (CharDataGrid.SelectedIndex == -1)
            {
                Close();
                return;
            }

            Choice = (CharSaves)CharDataGrid.SelectedItem;
            Close();
        }
        public List <CharSaves> LoadCharSet()
        {
            List <CharSaves> output = new List <CharSaves>();

            string PathX = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), App.ToolBin, "Saves");

            if (!Directory.Exists(PathX))
            {
                System.Windows.MessageBox.Show("Could not find CMTool/Saves Directory: " + PathX);
                return(output);
            }

            var files = Directory.GetFiles(PathX, "*.json*");

            foreach (var file in files)
            {
                CharSaves load = JsonConvert.DeserializeObject <CharSaves>(File.ReadAllText(file));
                output.Add(load);
            }

            return(output);
        }
Exemple #3
0
        public List <CharSaves> LoadCharSet()
        {
            List <CharSaves> output = new List <CharSaves>();

            string PathX = SaveSettings.Default.ProfileDirectory;

            if (!Directory.Exists(PathX))
            {
                System.Windows.MessageBox.Show("Could not find CMTool/Saves Directory: " + PathX);
                return(output);
            }

            var files = Directory.GetFiles(PathX, "*.cma*").Union(Directory.GetFiles(PathX, "*.json*")).ToArray();

            foreach (var file in files)
            {
                CharSaves load = JsonConvert.DeserializeObject <CharSaves>(File.ReadAllText(file));
                output.Add(load);
            }

            return(output);
        }