コード例 #1
0
 private void Save(object sender, RoutedEventArgs e)
 {
     try
     {
         XmlFileReaderUtility.WriteModsToConfig(activeMods, modConfig);
         MessageBox.Show("File saved succesfully.");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #2
0
 private void PopulateMainModList()
 {
     mainModList.Items.Clear();
     foreach (string item in XmlFileReaderUtility.ReadModsFromModsConfig())
     {
         activeMods.Add(item);
         mainModList.Items.Add(item);
     }
     if (mainModList.Items.Count == 0)
     {
         mainModList.Items.Add("No mods found");
     }
 }
コード例 #3
0
 public MainWindow()
 {
     InitializeComponent();
     try
     {
         modConfig = XmlFileReaderUtility.GetModsConfig();
         PopulateMainModList();
         SetVersion();
         OpenFileSelectDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Issue starting ModSorter.");
         Application.Current.Shutdown();
     }
 }
コード例 #4
0
        private void TryLoadFolder(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            if (!Directory.Exists(path))
            {
                return;
            }

            foreach (Mod item in XmlFileReaderUtility.GetModNamesFromFiles(path + Path.DirectorySeparatorChar + "Mods"))
            {
                AddModToLists(item);
            }

            if (path.ToUpper().Contains("STEAM"))
            {
                string workShopFolder = XmlFileReaderUtility.GetWorkShopFolder(path);

                if (!Directory.Exists(workShopFolder))
                {
                    MessageBox.Show("Thought there was a Steam workshop folder here, but can't find it.");
                }
                else
                {
                    foreach (Mod mod in XmlFileReaderUtility.GetModNamesFromFiles(workShopFolder))
                    {
                        AddModToLists(mod);
                    }
                }
            }
            backedUpActiveMods = new List <string>(activeMods);
            backedUpAllMods    = new List <Mod>(allMods);

            PurgeModsThatWentMissing();

            backedUpView = new List <CheckBox>(mainModList.Items.Count);
            foreach (CheckBox checkBox in mainModList.Items.Cast <CheckBox>())
            {
                backedUpView.Add(checkBox);
            }
        }
コード例 #5
0
        private void LoadModsFromSave(object sender, RoutedEventArgs e)
        {
            var dir = Directory.Exists(XmlFileReaderUtility.directory) ? XmlFileReaderUtility.directory : string.Empty;

            Ookii.Dialogs.Wpf.VistaOpenFileDialog dialog = new Ookii.Dialogs.Wpf.VistaOpenFileDialog
            {
                Filter           = "yoursavefile.rws (*.rws)|*.rws",
                InitialDirectory = dir
            };
            if (dialog.ShowDialog() == true)
            {
                var list = XmlFileReaderUtility.ReadModsFromSaveFile(dialog.FileName);

                if (list.Any())
                {
                    LoadModsFromList(list);
                }
            }
        }
コード例 #6
0
 private void SetVersion()
 {
     version.Content = "RW config version: " + XmlFileReaderUtility.GetModsConfigVersion();
 }
コード例 #7
0
ファイル: Mod.cs プロジェクト: zach-hill/ModSorter
 public bool IsCompatible()
 => supportedVersions.Any(x => x == XmlFileReaderUtility.GetModsConfigVersion());