internal static PropertyValue Create(string rawStringValue, GlsProperty propertyDefinition) { string text = null; int num = -1; bool flag = false; ValidationError validationError = null; if (propertyDefinition.DataType == typeof(string)) { if (string.IsNullOrWhiteSpace(rawStringValue)) { text = (propertyDefinition.DefaultValue as string); } else { text = rawStringValue; } } else if (propertyDefinition.DataType == typeof(int)) { if (string.IsNullOrWhiteSpace(rawStringValue)) { num = (int)propertyDefinition.DefaultValue; } else if (!int.TryParse(rawStringValue, out num)) { string text2 = string.Format("ArgumentException: Unsupported {0} property data format:{1}", "int", rawStringValue); ExTraceGlobals.GLSTracer.TraceError(0L, text2); validationError = new GlsPropertyValidationError(new LocalizedString(text2), propertyDefinition, rawStringValue); num = (int)propertyDefinition.DefaultValue; } } else { if (!(propertyDefinition.DataType == typeof(bool))) { throw new ArgumentException(string.Format("unsupported PropertyDataType:{0}", propertyDefinition.DataType), "propertyDefinition.DataType"); } if (string.IsNullOrWhiteSpace(rawStringValue)) { flag = (bool)propertyDefinition.DefaultValue; } else if (!bool.TryParse(rawStringValue, out flag)) { int num2; if (int.TryParse(rawStringValue, out num2)) { flag = (num2 != 0); } else { string text3 = string.Format("ArgumentException: Unsupported {0} property data format:{1}", "boolean", rawStringValue); ExTraceGlobals.GLSTracer.TraceError(0L, text3); validationError = new GlsPropertyValidationError(new LocalizedString(text3), propertyDefinition, rawStringValue); flag = (bool)propertyDefinition.DefaultValue; } } } return(new PropertyValue(propertyDefinition.DataType, text, num, flag, validationError)); }
// Token: 0x06000C5C RID: 3164 RVA: 0x00038060 File Offset: 0x00036260 private static KeyValuePair <string, string>[] GetPropertyValues(KeyValuePair <DomainProperty, PropertyValue>[] properties) { KeyValuePair <string, string>[] array = new KeyValuePair <string, string> [properties.Length]; for (int i = 0; i < properties.Length; i++) { GlsProperty key = properties[i].Key; PropertyValue value = properties[i].Value; array[i] = new KeyValuePair <string, string>(key.Name, value.ToString()); } return(array); }
// Token: 0x06000C9B RID: 3227 RVA: 0x00038AEE File Offset: 0x00036CEE public GlsPropertyValidationError(LocalizedString description, GlsProperty propertyDefinition, object invalidData) : base(description, propertyDefinition.Name) { this.invalidData = invalidData; this.propertyDefinition = propertyDefinition; }