private void Load(IList <UserOptionPropertyDefinition> properties) { using (UserConfiguration userConfiguration = this.GetUserConfiguration()) { if (userConfiguration != null) { IDictionary dictionary = userConfiguration.GetDictionary(); for (int i = 0; i < properties.Count; i++) { UserOptionPropertyDefinition userOptionPropertyDefinition = properties[i]; string propertyName = userOptionPropertyDefinition.PropertyName; object originalValue = dictionary[userOptionPropertyDefinition.PropertyName]; this.optionProperties[userOptionPropertyDefinition] = new UserOptions.UserOptionPropertyValue(userOptionPropertyDefinition.GetValidatedProperty(originalValue), false); ExTraceGlobals.UserOptionsDataTracer.TraceDebug((long)this.GetHashCode(), "Loaded property: {0}", new object[] { this.optionProperties[userOptionPropertyDefinition].Value }); } } else { string value = WebPartUtilities.TryGetLocalMachineTimeZone(); UserOptionPropertyDefinition propertyDefinition = UserOptionPropertySchema.GetPropertyDefinition(UserOptionPropertySchema.UserOptionPropertyID.TimeZone); this.optionProperties[propertyDefinition] = new UserOptions.UserOptionPropertyValue(value, false); } } }
private void Commit(IList <UserOptionPropertyDefinition> properties) { using (UserConfiguration userConfiguration = this.GetUserConfiguration()) { IDictionary dictionary = userConfiguration.GetDictionary(); Type typeFromHandle = typeof(int); for (int i = 0; i < properties.Count; i++) { UserOptionPropertyDefinition userOptionPropertyDefinition = properties[i]; string propertyName = userOptionPropertyDefinition.PropertyName; if (userOptionPropertyDefinition.PropertyType == typeFromHandle) { dictionary[userOptionPropertyDefinition.PropertyName] = (int)this.optionProperties[userOptionPropertyDefinition].Value; } else { dictionary[userOptionPropertyDefinition.PropertyName] = this.optionProperties[userOptionPropertyDefinition].Value; } this.optionProperties[userOptionPropertyDefinition].IsModified = false; ExTraceGlobals.UserOptionsDataTracer.TraceDebug((long)this.GetHashCode(), "Committed property: {0}", new object[] { this.optionProperties[userOptionPropertyDefinition].Value }); } try { userConfiguration.Save(); } catch (StoragePermanentException ex) { ExTraceGlobals.UserOptionsDataTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Failed to save configuration data. Error: {0}. Stack: {1}.", ex.Message, ex.StackTrace); throw; } catch (StorageTransientException ex2) { ExTraceGlobals.UserOptionsDataTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Failed to save configuration data. Error: {0}. Stack: {1}.", ex2.Message, ex2.StackTrace); throw; } } }
private object this[UserOptionPropertySchema.UserOptionPropertyID propertyID] { get { UserOptionPropertyDefinition propertyDefinition = UserOptionPropertySchema.GetPropertyDefinition(propertyID); object obj; if (this.optionProperties.ContainsKey(propertyDefinition) && this.optionProperties[propertyDefinition] != null) { obj = this.optionProperties[propertyDefinition].Value; } else { obj = propertyDefinition.GetValidatedProperty(null); } ExTraceGlobals.UserOptionsDataTracer.TraceDebug <string, object>((long)this.GetHashCode(), "Get property: '{0}'; value: '{1}'", propertyDefinition.PropertyName, obj); return(obj); } set { UserOptionPropertyDefinition propertyDefinition = UserOptionPropertySchema.GetPropertyDefinition(propertyID); UserOptions.UserOptionPropertyValue userOptionPropertyValue = new UserOptions.UserOptionPropertyValue(propertyDefinition.GetValidatedProperty(value), true); if (!this.optionProperties.ContainsKey(propertyDefinition)) { this.optionProperties.Add(propertyDefinition, userOptionPropertyValue); this.isSynced = false; ExTraceGlobals.UserOptionsDataTracer.TraceDebug <string, object>((long)this.GetHashCode(), "Set property: '{0}'; value: '{1}'", propertyDefinition.PropertyName, this.optionProperties[propertyDefinition].Value); return; } if (this.optionProperties[propertyDefinition] == null || !userOptionPropertyValue.Value.Equals(this.optionProperties[propertyDefinition].Value)) { this.optionProperties[propertyDefinition] = userOptionPropertyValue; this.isSynced = false; ExTraceGlobals.UserOptionsDataTracer.TraceDebug <string, object>((long)this.GetHashCode(), "Set property: '{0}'; value: '{1}'", propertyDefinition.PropertyName, this.optionProperties[propertyDefinition].Value); } } }
// Token: 0x0600167D RID: 5757 RVA: 0x00083EDC File Offset: 0x000820DC public override bool Equals(object value) { UserOptionPropertyDefinition userOptionPropertyDefinition = value as UserOptionPropertyDefinition; return(userOptionPropertyDefinition != null && (string.Equals(this.name, userOptionPropertyDefinition.name, StringComparison.OrdinalIgnoreCase) && this.guid.Equals(userOptionPropertyDefinition.guid)) && this.type.Equals(userOptionPropertyDefinition.type)); }