Ejemplo n.º 1
0
        private void LoadSettings(string basePath)
        {
            if (!basePath.EndsWith(Path.DirectorySeparatorChar))
            {
                basePath += Path.DirectorySeparatorChar;
            }

            GeneralSettingsWrapper gsw = JsonConvert.DeserializeObject <GeneralSettingsWrapper>(File.ReadAllText(basePath + "settings.general.json"));

            _generalSettings = gsw.GeneralSettings;

            AnalyzerSettingsWrapper asw = JsonConvert.DeserializeObject <AnalyzerSettingsWrapper>(File.ReadAllText(basePath + "settings.analyzer.json"));

            _analyzerSettings = asw.AnalyzerSettings;

            if (!_generalSettings.Application.ProfitTrailerMonitorURL.EndsWith("/"))
            {
                _generalSettings.Application.ProfitTrailerMonitorURL += "/";
            }

            if (File.Exists(basePath + "settings.secure.json"))
            {
                SecureSettingsWrapper ssw = JsonConvert.DeserializeObject <SecureSettingsWrapper>(File.ReadAllText(basePath + "settings.secure.json"));
                _secureSettings = ssw.SecureSettings;
            }
        }
Ejemplo n.º 2
0
        public void WriteAnalyzerSettings()
        {
            AnalyzerSettingsWrapper asWrapper = new AnalyzerSettingsWrapper();

            asWrapper.AnalyzerSettings = this.AnalyzerSettings;

            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.NullValueHandling    = NullValueHandling.Ignore;
            settings.DefaultValueHandling = DefaultValueHandling.Ignore;

            FileHelper.CreateBackup(_basePath + "settings.analyzer.json", _basePath, "settings.analyzer.json.backup");

            FileHelper.WriteTextToFile(_basePath, "settings.analyzer.json", JsonConvert.SerializeObject(asWrapper, Formatting.Indented, settings));
        }