Example #1
0
        /// <summary>
        /// Copies the values of this profile into another profile.
        /// </summary>
        /// <param name="profile">The profile in which to copy the values.</param>
        /// <param name="overrideValues">If <c>false</c>, the values already present in the targt profile won't be overriden.</param>
        public void CopyTo(SettingsProfile profile, bool overrideValues)
        {
            lock (SettingsContainer.SettingsLock)
            {
                foreach (var setting in Settings)
                {
                    if (!overrideValues && profile.Settings.ContainsKey(setting.Key))
                    {
                        continue;
                    }

                    profile.SetValue(setting.Key, setting.Value.Value);
                }
            }
        }
Example #2
0
 internal void DecodeSettings([NotNull] SettingsDictionary settingsDictionary, SettingsProfile profile)
 {
     lock (SettingsLock)
     {
         foreach (var settings in settingsDictionary)
         {
             SettingsKey key;
             var         value      = settings.Value;
             object      finalValue = value;
             if (settingsKeys.TryGetValue(settings.Key, out key))
             {
                 finalValue = key.ConvertValue(value);
             }
             profile.SetValue(settings.Key, finalValue);
         }
     }
 }