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);
 }
예제 #2
0
        public override void Load(ICollection <PropertyDefinition> properties)
        {
            base.CheckDisposed("Load");
            if (!this.attachmentProvider.ExistsInCollection(this))
            {
                throw new ObjectNotFoundException(ServerStrings.InvalidAttachmentNumber);
            }
            ICollection <NativeStorePropertyDefinition> collection = null;

            if (properties != InternalSchema.ContentConversionProperties)
            {
                collection = StorePropertyDefinition.GetNativePropertyDefinitions <PropertyDefinition>(PropertyDependencyType.AllRead, properties);
                properties = collection.ToArray <NativeStorePropertyDefinition>();
            }
            if (this.persistablePropertyBag == null)
            {
                bool flag = false;
                if (collection != null)
                {
                    IDirectPropertyBag currentPropertyBag = this.CurrentPropertyBag;
                    using (IEnumerator <NativeStorePropertyDefinition> enumerator = collection.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            NativeStorePropertyDefinition propertyDefinition = enumerator.Current;
                            if (!currentPropertyBag.IsLoaded(propertyDefinition))
                            {
                                flag = true;
                                break;
                            }
                        }
                        goto IL_8A;
                    }
                }
                flag = true;
IL_8A:
                if (flag)
                {
                    this.OnOpenConnection(properties);
                    return;
                }
            }
            else
            {
                this.persistablePropertyBag.Load(properties);
                this.attachmentProvider.OnAttachmentLoad(this);
            }
        }