public void Configure(IConfiguration configuration) { string path = configuration.GetValue("AppDataFolder", string.Empty); if (!string.IsNullOrEmpty(path)) { AppDataFolder = path; if (!Directory.Exists(AppDataFolder)) { Directory.CreateDirectory(AppDataFolder); } Preferences = new UserPreferences(Path.Combine(AppDataFolder, UserPreferencesFilename)); } }
public void Reload() { UserPreferences data; if (File.Exists(_path)) { byte[] bytes = File.ReadAllBytes(_path); string json = System.Text.Encoding.UTF8.GetString(bytes); data = JsonConvert.DeserializeObject <UserPreferences>(json); } else { data = new UserPreferences(); } CheckForUpdatesAtStartup = data.CheckForUpdatesAtStartup; LastProjectLocation = data.LastProjectLocation; ShowSetupWizardAtStartup = data.ShowSetupWizardAtStartup; }
public AppSettings() { AppPath = AppDataFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Preferences = new UserPreferences(Path.Combine(AppDataFolder, UserPreferencesFilename)); }