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);
 }
Exemple #2
0
        private void UpdateAttachmentTableCache()
        {
            if (this.attachmentTablePropertyBag != null)
            {
                bool flag = false;
                foreach (NativeStorePropertyDefinition propertyDefinition in this.attachmentTablePropertySet)
                {
                    PropertyError propertyError = ((IDirectPropertyBag)this.attachmentTablePropertyBag).GetValue(propertyDefinition) as PropertyError;
                    if (propertyError != null && propertyError.PropertyErrorCode == PropertyErrorCode.PropertyValueTruncated)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    return;
                }
            }
            MemoryPropertyBag  memoryPropertyBag = new MemoryPropertyBag();
            IDirectPropertyBag directPropertyBag = memoryPropertyBag;

            foreach (NativeStorePropertyDefinition propertyDefinition2 in this.attachmentTablePropertySet)
            {
                object value = ((IDirectPropertyBag)this.persistablePropertyBag).GetValue(propertyDefinition2);
                directPropertyBag.SetValue(propertyDefinition2, value);
            }
            memoryPropertyBag.ClearChangeInfo();
            memoryPropertyBag.Context.Session   = this.attachmentTablePropertyBag.Context.Session;
            memoryPropertyBag.Context.CoreState = this.attachmentTablePropertyBag.Context.CoreState;
            this.attachmentTablePropertyBag     = memoryPropertyBag;
        }
Exemple #3
0
 internal Stream InternalOpenBodyStream(StorePropertyDefinition bodyProperty, PropertyOpenMode openMode)
 {
     if (openMode != PropertyOpenMode.ReadOnly)
     {
         IDirectPropertyBag directPropertyBag = (IDirectPropertyBag)this.coreItem.PropertyBag;
         directPropertyBag.SetValue(InternalSchema.TextBody, Body.TextNotFoundPropertyError);
         directPropertyBag.SetValue(InternalSchema.HtmlBody, Body.HtmlNotFoundPropertyError);
         directPropertyBag.SetValue(InternalSchema.RtfBody, Body.RtfNotFoundPropertyError);
     }
     return(this.coreItem.PropertyBag.OpenPropertyStream(bodyProperty, openMode));
 }
Exemple #4
0
        internal static Category Load(IEnumerable <PropValue> propValues)
        {
            Category           category          = new Category();
            IDirectPropertyBag directPropertyBag = category.propertyBag;

            foreach (PropValue propValue in propValues)
            {
                directPropertyBag.SetValue(propValue.Property, propValue.Value);
            }
            category.propertyBag.SetAllPropertiesLoaded();
            category.propertyBag.ClearChangeInfo();
            category.ValidateAndFillInDefaults();
            return(category);
        }
Exemple #5
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);
            }
        }
Exemple #6
0
        internal void UndoTnef()
        {
            this.CheckDisposed("UndoTnef");
            this.ClearRecipientTable();
            this.ClearAttachmentTable();
            foreach (PropertyDefinition propertyDefinition in InboundMessageWriter.UndoPropertyList)
            {
                this.coreItem.PropertyBag.Delete(propertyDefinition);
            }
            PersistablePropertyBag persistablePropertyBag = CoreObject.GetPersistablePropertyBag(this.CoreItem);
            IDirectPropertyBag     directPropertyBag      = persistablePropertyBag;

            directPropertyBag.SetValue(InternalSchema.ItemClass, "IPM.Note");
            MessageItem messageItem = this.coreItem as MessageItem;

            if (messageItem != null)
            {
                messageItem.ReplyTo.Clear();
            }
        }
Exemple #7
0
        private void ResetAttachMethod(int newAttachMethod)
        {
            this.CheckDisposed("TransformAttachment");
            if (this.attachMethod == newAttachMethod)
            {
                return;
            }
            if (this.attachMethod == 5 || (this.attachMethod != null && newAttachMethod == 5))
            {
                StorageGlobals.ContextTraceError(ExTraceGlobals.CcInboundMimeTracer, "MessageAttachmentWriter::TransformAttachment: wrong attachment transformation.");
                throw new ConversionFailedException(ConversionFailureReason.CorruptContent, null);
            }
            IDirectPropertyBag propertyBag = this.coreAttachment.PropertyBag;

            this.attachMethod = new int?(newAttachMethod);
            propertyBag.SetValue(InternalSchema.AttachMethod, newAttachMethod);
            if (newAttachMethod == 1 && this.data != null)
            {
                propertyBag.SetValue(InternalSchema.AttachDataBin, this.data);
                this.data = null;
            }
        }