public void SaveSettings() { var path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var folderPath = Path.Combine(path, "My Games", GameName); SolisXML.ToXML(GameSettings, folderPath + @"\" + "Settings.xml"); Console.WriteLine("GameSettings were saved"); }
/// <summary> /// Checks if Settings file exists, if not then it will create a new settings file /// </summary> private void CheckSettingsFile() { var path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var folderPath = Path.Combine(path, "My Games", GameName); if (File.Exists(folderPath + @"\" + "Settings.xml")) { GameSettings = SolisXML.FromXML <SolisSettings>(folderPath + @"\" + "Settings.xml"); } else { Directory.CreateDirectory(folderPath); CreateSettingsFile(); } }