Пример #1
0
        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));
            }
        }
Пример #2
0
        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;
        }
Пример #3
0
 public AppSettings()
 {
     AppPath     = AppDataFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
     Preferences = new UserPreferences(Path.Combine(AppDataFolder, UserPreferencesFilename));
 }