Esempio n. 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));
            }
        }
Esempio n. 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;
        }
Esempio n. 3
0
 public AppSettings()
 {
     AppPath     = AppDataFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
     Preferences = new UserPreferences(Path.Combine(AppDataFolder, UserPreferencesFilename));
 }