private void Save(object sender, RoutedEventArgs e) { try { XmlFileReaderUtility.WriteModsToConfig(activeMods, modConfig); MessageBox.Show("File saved succesfully."); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
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"); } }
public MainWindow() { InitializeComponent(); try { modConfig = XmlFileReaderUtility.GetModsConfig(); PopulateMainModList(); SetVersion(); OpenFileSelectDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Issue starting ModSorter."); Application.Current.Shutdown(); } }
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); } }
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); } } }
private void SetVersion() { version.Content = "RW config version: " + XmlFileReaderUtility.GetModsConfigVersion(); }
public bool IsCompatible() => supportedVersions.Any(x => x == XmlFileReaderUtility.GetModsConfigVersion());