Esempio n. 1
0
        protected virtual ExitCode ChangeSetting(IClientSettings clientSettings, SettingsLocation location, ChangeType changeType)
        {
            // Don't want to save defaults for options that apply directly to this command
            List<string> settingsToSkip = new List<string>();
            settingsToSkip.AddRange(StandardOptions.List);
            settingsToSkip.AddRange(StandardOptions.Add);
            settingsToSkip.AddRange(StandardOptions.Remove);

            foreach (var setting in this.Arguments.Options)
            {
                if (settingsToSkip.Contains(setting.Key, StringComparer.OrdinalIgnoreCase)) { continue; }
                bool success = false;
                switch (changeType)
                {
                    case ChangeType.Add:
                        this.Loggers[LoggerType.Status].Write(XTaskStrings.DefaultsSavingProgress, setting.Key);
                        success = clientSettings.SaveSetting(location, setting.Key, setting.Value);
                        break;
                    case ChangeType.Remove:
                        this.Loggers[LoggerType.Status].Write(XTaskStrings.DefaultsRemovingProgress, setting.Key);
                        success = clientSettings.RemoveSetting(location, setting.Key);
                        break;
                }

                this.Loggers[LoggerType.Status].WriteLine(success ? XTaskStrings.Succeeded : XTaskStrings.Failed);
            }

            return ExitCode.Success;
        }
Esempio n. 2
0
        /// <summary>
        /// Reconstructs the <see cref="CloudConfig"/> from a <see cref="JSONObject"/>.
        /// </summary>
        /// <param name="jsonObject"><see cref="JSONObject"/> containing the <see cref="CloudConfig"/>.</param>
        private void FromJSONObject(JSONObject jsonObject)
        {
            if (!jsonObject.HasFields(achievementIDsName, leaderboardIDsName, cloudVariablesName, appleSupportedName, googleSupportedName,
                                      amazonSupportedName, androidPlatformName, googleAppIDName, googleSetupRunName, debugModeEnabledName, versionName))
            {
                throw new SerializationException("JSONObject missing fields, cannot deserialize to " + typeof(CloudConfig).Name);
            }

            AchievementIDs   = EditorJsonHelper.Convert <List <PlatformIdData> >(jsonObject[achievementIDsName]);
            LeaderboardIDs   = EditorJsonHelper.Convert <List <PlatformIdData> >(jsonObject[leaderboardIDsName]);
            CloudVariables   = EditorJsonHelper.Convert <List <CloudVariableData> >(jsonObject[cloudVariablesName]);
            AppleSupported   = jsonObject[appleSupportedName].B;
            GoogleSupported  = jsonObject[googleSupportedName].B;
            AmazonSupported  = jsonObject[amazonSupportedName].B;
            AndroidPlatform  = (AndroidBuildPlatform)Enum.Parse(typeof(AndroidBuildPlatform), jsonObject[androidPlatformName].String);
            GoogleAppID      = jsonObject[googleAppIDName].String;
            GoogleSetupRun   = jsonObject[googleSetupRunName].B;
            DebugModeEnabled = jsonObject[debugModeEnabledName].B;
            Version          = jsonObject[versionName].String;
            if (jsonObject.HasFields(apiKeyName))
            {
                ApiKey = jsonObject[apiKeyName].String;
            }

            if (jsonObject.HasFields(settingsLocationName))
            {
                SettingsLocation = (SettingsLocation)Enum.Parse(typeof(SettingsLocation), jsonObject[settingsLocationName].String);
            }
        }
Esempio n. 3
0
 protected ClientSettingsView(string settingsSection, SettingsLocation settingsLocation, IConfigurationManager configurationManager, IFileService fileService)
 {
     ConfigurationManager = configurationManager;
     FileService = fileService;
     SettingsSection = settingsSection;
     SettingsLocation = settingsLocation;
 }
Esempio n. 4
0
        protected virtual ExitCode ChangeSetting(IClientSettings clientSettings, SettingsLocation location, ChangeType changeType)
        {
            // Don't want to save defaults for options that apply directly to this command
            List <string> settingsToSkip = new List <string>();

            settingsToSkip.AddRange(StandardOptions.List);
            settingsToSkip.AddRange(StandardOptions.Add);
            settingsToSkip.AddRange(StandardOptions.Remove);

            foreach (var setting in this.Arguments.Options)
            {
                if (settingsToSkip.Contains(setting.Key, StringComparer.OrdinalIgnoreCase))
                {
                    continue;
                }
                bool success = false;
                switch (changeType)
                {
                case ChangeType.Add:
                    this.Loggers[LoggerType.Status].Write(XTaskStrings.DefaultsSavingProgress, setting.Key);
                    success = clientSettings.SaveSetting(location, setting.Key, setting.Value);
                    break;

                case ChangeType.Remove:
                    this.Loggers[LoggerType.Status].Write(XTaskStrings.DefaultsRemovingProgress, setting.Key);
                    success = clientSettings.RemoveSetting(location, setting.Key);
                    break;
                }

                this.Loggers[LoggerType.Status].WriteLine(success ? XTaskStrings.Succeeded : XTaskStrings.Failed);
            }

            return(ExitCode.Success);
        }
Esempio n. 5
0
        public async Task <bool> ClearSettingsAsync(SettingsLocation location)
        {
            var msg      = new ServiceMessage <SettingsLocation>(ServiceCommand.ClearSettings, location);
            var response = await _client.SendRequestAsync(msg);

            return(response.Command == ServiceCommand.ResponseOk);
        }
Esempio n. 6
0
 protected ClientSettingsView(string settingsSection, SettingsLocation settingsLocation, IConfigurationManager configurationManager, IFileService fileService)
 {
     ConfigurationManager = configurationManager;
     FileService          = fileService;
     SettingsSection      = settingsSection;
     SettingsLocation     = settingsLocation;
 }
Esempio n. 7
0
        public bool SaveSetting(SettingsLocation location, string name, string value)
        {
            if (!this.settingsViews.ContainsKey(location))
            {
                return(false);
            }

            return(this.settingsViews[location].SaveSetting(name, value));
        }
Esempio n. 8
0
        public static void Save <T>(this T objectToSerialize, string name, SettingsLocation location)
        {
            string file = GetLocationPath(name, location);

            using (var stream = new FileStream(file, FileMode.Create))
            {
                new XmlSerializer(typeof(T)).Serialize(stream, objectToSerialize);
            }
        }
 /// <summary>
 /// Set a string property.
 /// </summary>
 /// <param name="name">Name of the value.</param>
 /// <param name="value">Value to set.</param>
 /// <param name="location">Where to save the setting.</param>
 public void SetString(string name, string value, SettingsLocation location) {
     if ((location & SettingsLocation.Project) != 0) {
         lock (classLock) {
             projectSettings.SetString(name, value);
             Save();
         }
     }
     if ((location & SettingsLocation.System) != 0) systemSettings.SetString(name, value);
 }
Esempio n. 10
0
        public bool RemoveSetting(SettingsLocation location, string name)
        {
            if (!_settingsViews.ContainsKey(location))
            {
                return false;
            }

            return _settingsViews[location].RemoveSetting(name);
        }
Esempio n. 11
0
        public bool RemoveSetting(SettingsLocation location, string name)
        {
            if (!_settingsViews.ContainsKey(location))
            {
                return(false);
            }

            return(_settingsViews[location].RemoveSetting(name));
        }
Esempio n. 12
0
        public bool SaveSetting(SettingsLocation location, string name, string value)
        {
            if (!this.settingsViews.ContainsKey(location))
            {
                return false;
            }

            return this.settingsViews[location].SaveSetting(name, value);
        }
Esempio n. 13
0
        public static T Load <T>(string name, SettingsLocation location)
        {
            string file = GetLocationPath(name, location);

            using (var stream = new FileStream(file, FileMode.Open))
            {
                XmlSerializer s = new XmlSerializer(typeof(T));
                return((T)s.Deserialize(stream));
            }
        }
Esempio n. 14
0
        public Settings LoadSettings(SettingsLocation location)
        {
            var key = GetKey(location);

            if (key != null)
            {
                return(LoadFromRegistry(key));
            }
            return(null);
        }
 /// <summary>
 /// Determine whether a setting is set.
 /// </summary>
 /// <param name="name">Name of the value to query.</param>
 /// <param name="location">Where to search for the setting.</param>
 public bool HasKey(string name, SettingsLocation location) {
     bool hasKey = false;
     if ((location & SettingsLocation.Project) != 0) {
         lock (classLock) {
             LoadIfEmpty();
             hasKey |= projectSettings.HasKey(name);
         }
     }
     if (!hasKey && (location & SettingsLocation.System) != 0) {
         hasKey |= systemSettings.HasKey(name);
     }
     return hasKey;
 }
 /// <summary>
 /// Get a string property.
 /// </summary>
 /// <param name="name">Name of the value.</param>
 /// <param name="defaultValue">Default value of the property if it isn't set.</param>
 /// <param name="location">Where to read the setting from.</param>
 public string GetString(string name, string defaultValue, SettingsLocation location) {
     string value = defaultValue;
     if ((location & SettingsLocation.System) != 0) {
         value = systemSettings.GetString(name, value);
     }
     if ((location & SettingsLocation.Project) != 0) {
         lock (classLock) {
             LoadIfEmpty();
             value = projectSettings.GetString(name, value);
         }
     }
     return value;
 }
 /// <summary>
 /// Get a float property.
 /// </summary>
 /// <param name="name">Name of the value.</param>
 /// <param name="defaultValue">Default value of the property if it isn't set.</param>
 /// <param name="location">Where to read the setting from.</param>
 public float GetFloat(string name, float defaultValue, SettingsLocation location) {
     float value = defaultValue;
     if ((location & SettingsLocation.System) != 0) {
         value = systemSettings.GetFloat(name, value);
     }
     if ((location & SettingsLocation.Project) != 0) {
         lock (classLock) {
             LoadIfEmpty();
             value = projectSettings.GetFloat(name, value);
         }
     }
     return value;
 }
 /// <summary>
 /// Get a bool property.
 /// </summary>
 /// <param name="name">Name of the value.</param>
 /// <param name="defaultValue">Default value of the property if it isn't set.</param>
 /// <param name="location">Where to read the setting from.</param>
 public bool GetBool(string name, bool defaultValue, SettingsLocation location) {
     bool value = defaultValue;
     if ((location & SettingsLocation.System) != 0) {
         value = systemSettings.GetBool(name, value);
     }
     if ((location & SettingsLocation.Project) != 0) {
         lock (classLock) {
             LoadIfEmpty();
             value = projectSettings.GetBool(name, value);
         }
     }
     return value;
 }
Esempio n. 19
0
        /// <summary>
        /// Gets the file path for the given location's configuration file
        /// </summary>
        public string GetConfigurationPath(SettingsLocation location)
        {
            IConfiguration configuration = GetConfiguration(location);

            if (configuration != null)
            {
                return(configuration.FilePath);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 20
0
        public void MoveSettings(Settings settings)
        {
            SettingsLocation location         = (SettingsLocation)settings["SettingsLocation"];
            string           existingLocation = settings.FileName;
            string           newLocation      = null;

            switch (location)
            {
            case SettingsLocation.Portable:
                newLocation = this.PortableConfigFile;
                break;

            case SettingsLocation.Local:
                newLocation = this.LocalConfigFile;
                break;

            case SettingsLocation.Roaming:
                newLocation = this.RoamingConfigFile;
                break;

            default:
                break;
            }

            if (string.Compare(existingLocation, newLocation, StringComparison.OrdinalIgnoreCase) == 0)
            {
                // no change!
            }
            else
            {
                try
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(newLocation));
                    if (File.Exists(newLocation))
                    {
                        File.Delete(newLocation);
                    }
                    if (File.Exists(existingLocation))
                    {
                        File.Move(existingLocation, newLocation);
                    }
                    settings.FileName      = newLocation;
                    this._settingsLocation = location;
                }
                finally
                {
                    // revert the change
                    settings["SettingsLocation"] = (int)this._settingsLocation;
                }
            }
        }
Esempio n. 21
0
        private static string GetLocationPath(string name, SettingsLocation location)
        {
            switch (location)
            {
            case SettingsLocation.PublicDocuments:
                return(Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), name + ".xml"));

            case SettingsLocation.Local:
                return(Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), name + ".xml"));

            default:
                throw new Exception("SettingsLocation enum value not handled");
            }
        }
 /// <summary>
 /// Set a float property.
 /// </summary>
 /// <param name="name">Name of the value.</param>
 /// <param name="value">Value to set.</param>
 /// <param name="location">Where to save the setting.</param>
 public void SetFloat(string name, float value, SettingsLocation location)
 {
     if ((location & SettingsLocation.Project) != 0)
     {
         lock (classLock) {
             LoadIfEmpty();
             projectSettings.SetFloat(name, value);
             Save();
         }
     }
     if ((location & SettingsLocation.System) != 0)
     {
         systemSettings.SetFloat(name, value);
     }
 }
Esempio n. 23
0
        public void LoadSettings(Settings settings, bool testing)
        {
            if (testing)
            {
                // always start with no settings.
                if (File.Exists(this.TemporaryConfigFile))
                {
                    File.Delete(this.TemporaryConfigFile);
                }
                settings.Load(this.TemporaryConfigFile);
                settings["SettingsLocation"] = (int)SettingsLocation.Roaming;
            }
            else
            {
                // allow user to have a local settings file (xcopy deployable).
                SettingsLocation location = SettingsLocation.Portable;
                var path = PortableConfigFile;
                if (!File.Exists(path))
                {
                    path     = LocalConfigFile;
                    location = SettingsLocation.Local;
                }
                if (!File.Exists(path))
                {
                    path     = RoamingConfigFile;
                    location = SettingsLocation.Roaming;
                }

                if (File.Exists(path))
                {
                    Debug.WriteLine(path);
                    settings.Load(path);
                    settings["SettingsLocation"] = (int)location;
                    _settingsLocation            = location;
                }
                else if (File.Exists(PortableTemplateFile))
                {
                    // brand new user, so load the template
                    settings.Load(PortableTemplateFile);
                    settings.FileName = path; // but store it in RoamingConfigFile.
                }

                if (string.IsNullOrEmpty(settings.FileName))
                {
                    settings.FileName = path;
                }
            }
        }
Esempio n. 24
0
        protected IConfiguration GetConfiguration(SettingsLocation location)
        {
            switch (location)
            {
            case SettingsLocation.Local:
                return(GetConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal));

            case SettingsLocation.Roaming:
                return(GetConfiguration(ConfigurationUserLevel.PerUserRoaming));

            case SettingsLocation.RunningExecutable:
                return(GetConfiguration(ConfigurationUserLevel.None));

            case SettingsLocation.ContainingExecutable:
                return(GetContainingConfigurationIfDifferent());
            }
            return(null);
        }
Esempio n. 25
0
 public static IClientSettingsView Create(string settingsSection, SettingsLocation settingsLocation, IConfigurationManager configurationManager, IFileService fileService)
 {
     try
     {
         ClientSettingsView view = new ClientSettingsView(settingsSection, settingsLocation, configurationManager, fileService);
         if (!view.Initialize())
         {
             return(null);
         }
         return(view);
     }
     catch (Exception e)
     {
         // We don't have rights most likely, go ahead and return null
         Debug.WriteLine("Could not create settings for '{0}': {1}", settingsLocation, e.Message);
         return(null);
     }
 }
Esempio n. 26
0
        private static RegistryKey GetKey(SettingsLocation location)
        {
            switch (location)
            {
            case SettingsLocation.User:
            {
                return(Registry.CurrentUser);
            }

            case SettingsLocation.System:
            {
                return(Registry.LocalMachine);
            }

            default:
                return(null);
            }
        }
Esempio n. 27
0
        public String GetSettingsDir(SettingsLocation location)
        {
            String settingsDir = String.Empty;

            if (location == SettingsLocation.AppDataDir)
            {
                settingsDir = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ares");
            }
            else if (location == SettingsLocation.AppDir)
            {
                settingsDir = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
            }
            else
            {
                settingsDir = CustomSettingsDirectory;
            }
            return(settingsDir);
        }
Esempio n. 28
0
 public static IClientSettingsView Create(string settingsSection, SettingsLocation settingsLocation, IConfigurationManager configurationManager, IFileService fileService)
 {
     try
     {
         ClientSettingsView view = new ClientSettingsView(settingsSection, settingsLocation, configurationManager, fileService);
         if (!view.Initialize())
         {
             return null;
         }
         return view;
     }
     catch (Exception e)
     {
         // We don't have rights most likely, go ahead and return null
         Debug.WriteLine("Could not create settings for '{0}': {1}", settingsLocation, e.Message);
         return null;
     }
 }
Esempio n. 29
0
        public Task <bool> RemoveSettingsAsync(SettingsLocation location)
        {
            var key = GetKey(location);

            try
            {
                DeleteSettingsKey(key);
                return(Task.FromResult(true));
            }
            catch (Exception ex) when(ex is SecurityException || ex is UnauthorizedAccessException)
            {
            }
            catch (ArgumentException)
            {
                //Subkey doesn't exist
                return(Task.FromResult(true));
            }

            return(_proxy?.ClearSettingsAsync(location) ?? Task.FromResult(false));
        }
Esempio n. 30
0
            public UserSettings(Settings s)
            {
                this._settings = s;

                this._theme  = (ColorTheme)this._settings["Theme"];
                _lightColors = (ThemeColors)this._settings["LightColors"];
                _darkColors  = (ThemeColors)this._settings["DarkColors"];
                LoadColors();
                _updateLocation      = this._settings.GetString("UpdateLocation");
                _enableUpdate        = this._settings.GetBoolean("UpdateEnabled");
                _disableDefaultXslt  = this._settings.GetBoolean("DisableDefaultXslt");
                _autoFormatOnSave    = this._settings.GetBoolean("AutoFormatOnSave");
                _treeIndent          = this._settings.GetInteger("TreeIndent");
                _noByteOrderMark     = this._settings.GetBoolean("NoByteOrderMark");
                _indentLevel         = this._settings.GetInteger("IndentLevel");
                _indentChar          = (IndentChar)this._settings["IndentChar"];
                _newLineChars        = this._settings.GetString("NewLineChars");
                _language            = this._settings.GetString("Language");
                _settingsLocation    = (SettingsLocation)this._settings.GetInteger("SettingsLocation", (int)SettingsLocation.Roaming);
                _maximumLineLength   = this._settings.GetInteger("MaximumLineLength");
                _autoFormatLongLines = this._settings.GetBoolean("AutoFormatLongLines");
                _ignoreDTD           = this._settings.GetBoolean("IgnoreDTD");
                _enableXsltScripts   = this._settings.GetBoolean("EnableXsltScripts");
                _webBrowser          = (this._settings.GetString("BrowserVersion") == "WebBrowser") ? WebBrowserVersion.WinformsWebBrowser : WebBrowserVersion.WebView2;

                this._font = this._settings.GetFont();

                this._xmlDiffIgnoreChildOrder = this._settings.GetBoolean("XmlDiffIgnoreChildOrder");
                this._xmlDiffIgnoreComments   = this._settings.GetBoolean("XmlDiffIgnoreComments");
                this._xmlDiffIgnorePI         = this._settings.GetBoolean("XmlDiffIgnorePI");
                this._xmlDiffIgnoreWhitespace = this._settings.GetBoolean("XmlDiffIgnoreWhitespace");
                this._xmlDiffIgnoreNamespaces = this._settings.GetBoolean("XmlDiffIgnoreNamespaces");
                this._xmlDiffIgnorePrefixes   = this._settings.GetBoolean("XmlDiffIgnorePrefixes");
                this._xmlDiffIgnoreXmlDecl    = this._settings.GetBoolean("XmlDiffIgnoreXmlDecl");
                this._xmlDiffIgnoreDtd        = this._settings.GetBoolean("XmlDiffIgnoreDtd");
                this._allowAnalytics          = this._settings.GetBoolean("AllowAnalytics");
                this._textEditor = this._settings.GetString("TextEditor");
            }
        /// <summary>
        /// Locates default settings file from one of the locations based on search order
        /// </summary>
        /// <param name="fileLocation">location of the file to return</param>
        /// <param name="locationDetected">where file was located</param>
        /// <returns>true if file found, false if not</returns>
        public static bool LocateDefaultSettings(out string fileLocation, out SettingsLocation locationDetected)
        {
            fileLocation     = string.Empty;
            locationDetected = SettingsLocation.NotDetected;

            // First look into user profile folder
            fileLocation = GetProperSettingsLocation();
            if (File.Exists(fileLocation))
            {
                locationDetected = SettingsLocation.UserAppDataFolder;
                return(true);
            }

            // then if not found - try to detect in Program data folder
            string detectionFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);

            fileLocation = AttachFileSubpath(detectionFolder);
            if (File.Exists(fileLocation))
            {
                locationDetected = SettingsLocation.AppDataFolder;
                return(true);
            }

            detectionFolder = Assembly.GetEntryAssembly().Location;
            detectionFolder = Path.GetDirectoryName(detectionFolder);
            if (detectionFolder != null)
            {
                fileLocation = Path.Combine(detectionFolder, "defsettings.xml");
                if (File.Exists(fileLocation))
                {
                    locationDetected = SettingsLocation.ProgramFolder;
                    return(true);
                }
            }


            return(false);
        }
Esempio n. 32
0
        public Task <bool> SaveSettingsAsync(Settings settings, SettingsLocation location)
        {
            var         key         = GetKey(location);
            RegistryKey settingsKey = null;
            bool        hasAccess   = true;

            try
            {
                settingsKey = CreateSettingsKey(key);
            }
            catch (Exception ex) when(ex is SecurityException || ex is UnauthorizedAccessException)
            {
                hasAccess = false;
            }

            if (hasAccess)
            {
                SaveToRegistry(settings, settingsKey);
                return(_proxy?.ReloadSettingsAsync() ?? NoProxyRealoadResult());
            }

            return(_proxy?.ApplySettingsAsync(settings, location) ?? Task.FromResult(false));
        }
        /// <summary>
        /// Locates default settings file from one of the locations based on search order
        /// </summary>
        /// <param name="fileLocation">location of the file to return</param>
        /// <param name="locationDetected">where file was located</param>
        /// <returns>true if file found, false if not</returns>
        public static bool LocateDefaultSettings(out string fileLocation, out SettingsLocation locationDetected)
        {
            fileLocation = string.Empty;
            locationDetected = SettingsLocation.NotDetected;

            // First look into user profile folder
            fileLocation = GetProperSettingsLocation();
            if (File.Exists(fileLocation))
            {
                locationDetected = SettingsLocation.UserAppDataFolder;
                return true;
            }

            // then if not found - try to detect in Program data folder
            string detectionFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
            fileLocation = AttachFileSubpath(detectionFolder);
            if (File.Exists(fileLocation))
            {
                locationDetected = SettingsLocation.AppDataFolder;
                return true;
            }

            detectionFolder = Assembly.GetEntryAssembly().Location;
            detectionFolder = Path.GetDirectoryName(detectionFolder);
            if (detectionFolder != null)
            {
                fileLocation = Path.Combine(detectionFolder, "defsettings.xml");
                if (File.Exists(fileLocation))
                {
                    locationDetected = SettingsLocation.ProgramFolder;
                    return true;
                }
            }


            return false;
        }
Esempio n. 34
0
 public ClientSetting(string name, string value, SettingsLocation location)
     : base(name, value)
 {
     Location = location;
 }
Esempio n. 35
0
 public string GetConfigurationPath(SettingsLocation location)
 {
     return(GetConfigurationPath(location));
 }
Esempio n. 36
0
 /// <summary>
 /// Gets the file path for the given location's configuration file
 /// </summary>
 public string GetConfigurationPath(SettingsLocation location)
 {
     IConfiguration configuration = GetConfiguration(location);
     if (configuration != null)
     {
         return configuration.FilePath;
     }
     else
     {
         return null;
     }
 }
Esempio n. 37
0
 private TestClientSettingsView(string settingsSection, SettingsLocation settingsLocation)
     : base(settingsSection, settingsLocation)
 {
 }
Esempio n. 38
0
 protected IConfiguration GetConfiguration(SettingsLocation location)
 {
     switch (location)
     {
         case SettingsLocation.Local:
             return GetConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
         case SettingsLocation.Roaming:
             return GetConfiguration(ConfigurationUserLevel.PerUserRoaming);
         case SettingsLocation.RunningExecutable:
             return GetConfiguration(ConfigurationUserLevel.None);
         case SettingsLocation.ContainingExecutable:
             return GetContainingConfigurationIfDifferent();
     }
     return null;
 }
Esempio n. 39
0
 public static IConfiguration TestGetConfiguration(SettingsLocation location)
 {
     return ClientSettingsView.GetConfiguration(location);
 }
Esempio n. 40
0
 public string GetConfigurationPath(SettingsLocation location)
 {
     return GetConfigurationPath(location);
 }
 public bool RemoveSetting(SettingsLocation location, string name)
 {
     return(_clientSettings.RemoveSetting(location, name));
 }
Esempio n. 42
0
 public TestClientSettingsView(IConfigurationManager configurationManager, IFileService fileService, string settingsSection = "testsettings", SettingsLocation settingsLocation = SettingsLocation.Executable) :
     base(settingsSection, settingsLocation, configurationManager, fileService) { }
Esempio n. 43
0
 protected ClientSettingsView(string settingsSection, SettingsLocation settingsLocation)
 {
     this.SettingsSection = settingsSection;
     this.SettingsLocation = settingsLocation;
 }
Esempio n. 44
0
 public string GetConfigurationPath(SettingsLocation location)
 {
     return ClientSettingsView.GetConfigurationPath(location);
 }
 public bool SaveSetting(SettingsLocation location, string name, string value)
 {
     return(_clientSettings.SaveSetting(location, name, value));
 }
Esempio n. 46
0
 public IConfiguration TestGetConfiguration(SettingsLocation location)
 {
     return this.GetConfiguration(location);
 }