private static bool TryReadEntry(BinaryReader reader, out ExternalUser user) { if (reader.ReadUInt32() == ExternalUserCollection.ptagLocalDirectoryEntryId) { uint num = reader.ReadUInt32(); MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag(); int num2 = 0; while ((long)num2 < (long)((ulong)num)) { uint num3 = reader.ReadUInt32(); object obj = ExternalUserCollection.ReadPropValue(reader, ((PropTag)num3).ValueType(), reader.ReadUInt32()); if (obj != null) { PropertyTagPropertyDefinition prop = PropertyTagPropertyDefinition.CreateCustom(string.Empty, num3); memoryPropertyBag.PreLoadStoreProperty(prop, obj, (int)num); } num2++; } memoryPropertyBag.SetAllPropertiesLoaded(); IDirectPropertyBag directPropertyBag = memoryPropertyBag; if (directPropertyBag.IsLoaded(InternalSchema.MemberSIDLocalDirectory) && directPropertyBag.IsLoaded(InternalSchema.MemberExternalIdLocalDirectory) && directPropertyBag.IsLoaded(InternalSchema.MemberEmailLocalDirectory)) { if (!directPropertyBag.IsLoaded(InternalSchema.MemberName)) { memoryPropertyBag[InternalSchema.MemberName] = directPropertyBag.GetValue(InternalSchema.MemberEmailLocalDirectory); } user = new ExternalUser(memoryPropertyBag); return(true); } } user = null; return(false); }
public IStorePropertyBag Convert(ADRawEntry adObject) { MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag(); IStorePropertyBag storePropertyBag = memoryPropertyBag.AsIStorePropertyBag(); this.Convert(adObject, storePropertyBag); memoryPropertyBag.SetAllPropertiesLoaded(); return(storePropertyBag); }
internal static PropertyBag AggregateAsPropertyBag(PropertyAggregationContext context, IEnumerable <PropertyDefinition> properties) { MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag(); foreach (PropertyDefinition propertyDefinition in properties) { ApplicationAggregatedProperty applicationAggregatedProperty = propertyDefinition as ApplicationAggregatedProperty; if (applicationAggregatedProperty != null) { applicationAggregatedProperty.Aggregate(context, memoryPropertyBag); } } memoryPropertyBag.SetAllPropertiesLoaded(); return(memoryPropertyBag); }