private object ConvertValue(ADPropertyDefinition propertyDefinition, PropValue propValue) { if (propValue.IsError() || propValue.IsNull()) { return(null); } PropType propType = propValue.PropType; object[] values; if (propType <= PropType.SysTime) { if (propType <= PropType.Boolean) { if (propType != PropType.Int && propType != PropType.Boolean) { goto IL_174; } } else { switch (propType) { case PropType.AnsiString: values = new object[] { this.encoding.GetString(propValue.GetBytes()) }; goto IL_18F; case PropType.String: break; default: if (propType != PropType.SysTime) { goto IL_174; } break; } } } else if (propType <= PropType.Binary) { if (propType != PropType.Guid) { if (propType != PropType.Binary) { goto IL_174; } values = new object[] { propValue.RawValue }; goto IL_18F; } } else { switch (propType) { case PropType.AnsiStringArray: values = Array.ConvertAll <byte[], object>(propValue.GetBytesArray(), (byte[] bytesValue) => this.encoding.GetString(bytesValue)); goto IL_18F; case PropType.StringArray: values = Array.ConvertAll <string, object>(propValue.GetStringArray(), (string stringValue) => stringValue); goto IL_18F; default: if (propType != PropType.BinaryArray) { goto IL_174; } values = Array.ConvertAll <byte[], object>(propValue.GetBytesArray(), (byte[] bytesValue) => bytesValue); goto IL_18F; } } values = new object[] { propValue.RawValue.ToString() }; goto IL_18F; IL_174: throw new InvalidOperationException(string.Format("Property type {0} is not supported", propValue.GetType())); object result; try { IL_18F: result = ADValueConvertor.GetValueFromDirectoryAttributeValues(propertyDefinition, values); } catch (DataValidationException arg) { NspiPropertyMap.Tracer.TraceWarning <string, DataValidationException>((long)this.GetHashCode(), "Unable to handle property {0} because it has invalid value, exception: {1}", propertyDefinition.Name, arg); result = null; } return(result); }