public static void Save() { string file = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Application.ProductName), Resources.SettingsPath); try { string directory = Path.GetDirectoryName(file); if (directory != null && !Directory.Exists(directory)) { Directory.CreateDirectory(directory); } Data.Save(file); } catch (Exception ex) { Exceptions.Show(string.Format(Strings.SettingsSaveException, Resources.SettingsPath), ex); } }
public static void Save() { // Remove all templates that are manually created Data.Data.General.Templates.Templates = Data.Data.General.Templates.Templates.Where(x => !string.IsNullOrWhiteSpace(x.Name) && x.TemplateIndex > 0).ToList(); LoadTemplates(); string file = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Application.ProductName), Resources.SettingsPath); try { string directory = Path.GetDirectoryName(file); if (directory != null && !Directory.Exists(directory)) { Directory.CreateDirectory(directory); } Data.Save(file); } catch (IOException ex) { Exceptions.Show(string.Format(Strings.SettingsSaveException, Resources.SettingsPath), ex); } }