Exemplo n.º 1
0
        internal void AddProperty(PropertyDefinition propDefinition, object value)
        {
            this.CheckDisposed("AddProperty");
            if (propDefinition.Equals(InternalSchema.AttachMethod))
            {
                int newAttachMethod = (int)value;
                this.ResetAttachMethod(newAttachMethod);
            }
            if (!propDefinition.Equals(InternalSchema.AttachDataBin))
            {
                this.coreAttachment.PropertyBag[propDefinition] = value;
                return;
            }
            int?num            = this.attachMethod;
            int valueOrDefault = num.GetValueOrDefault();

            if (num == null)
            {
                this.data = (byte[])value;
                return;
            }
            if (valueOrDefault != 1)
            {
                return;
            }
            this.coreAttachment.PropertyBag.SetProperty(propDefinition, value);
        }
Exemplo n.º 2
0
 public object this[PropertyDefinition propertyDefinition]
 {
     get
     {
         if (propertyDefinition.Equals(InternalSchema.ItemClass) && !string.IsNullOrEmpty(this.MessageClass))
         {
             return(this.MessageClass);
         }
         if (propertyDefinition.Equals(MessageItemSchema.IsRead))
         {
             return(this.IsRead);
         }
         if (propertyDefinition.Equals(InternalSchema.ItemId) && this.Id != null && this.Id.NativeId != null)
         {
             return(this.Id.NativeId);
         }
         if (propertyDefinition.Equals(ItemSchema.ReceivedTime) && this.FilterDate != null)
         {
             return(this.FilterDate.Value);
         }
         if (propertyDefinition.Equals(ItemSchema.ConversationId) && this.ConversationId != null)
         {
             return(this.ConversationId);
         }
         return(new PropertyError(propertyDefinition, PropertyErrorCode.NotFound));
     }
 }
Exemplo n.º 3
0
        public void Equals_TwoDifferentDefinitionsWithSameValues_ReturnsTrue()
        {
            var definition1 = new PropertyDefinition("propertyName", typeof(Property <string>));
            var definition2 = new PropertyDefinition("propertyName", typeof(Property <string>));

            Assert.IsTrue(definition1.Equals(definition2));
        }
Exemplo n.º 4
0
 internal Stream CreatePropertyStream(PropertyDefinition property)
 {
     this.CheckDisposed("CreatePropertyStream");
     if (property.Equals(InternalSchema.AttachDataBin))
     {
         this.ResetAttachMethod(1);
     }
     return(this.coreAttachment.PropertyBag.OpenPropertyStream(property, PropertyOpenMode.Create));
 }
Exemplo n.º 5
0
 internal bool?TryGetValue(PropertyDefinition propertyDefinition, int flag)
 {
     if (propertyDefinition.Equals(InternalSchema.Flags))
     {
         if ((this.markMsgFlagsForRead & flag) == 0)
         {
             return(null);
         }
         return(new bool?((this.msgFlags & flag) != 0));
     }
     else
     {
         if (propertyDefinition != InternalSchema.MessageStatus)
         {
             throw new InvalidOperationException();
         }
         if ((this.markMsgStatusForRead & flag) == 0)
         {
             return(null);
         }
         return(new bool?((this.msgStatus & flag) != 0));
     }
 }
Exemplo n.º 6
0
 private void AdjustOccurrenceColumnsForExpansion(object[] occurrence, PropertyDefinition[] columns, OccurrenceInfo occurrenceInfo, int codePage, byte[] createdTimeZoneBlobCache, bool isException)
 {
     for (int i = 0; i < columns.Length; i++)
     {
         PropertyDefinition propertyDefinition = columns[i];
         if (propertyDefinition.Equals(InternalSchema.ItemId))
         {
             occurrence[i] = occurrenceInfo.VersionedId;
         }
         else if (propertyDefinition.Equals(InternalSchema.IsRecurring))
         {
             occurrence[i] = true;
         }
         else if (propertyDefinition.Equals(InternalSchema.IsException))
         {
             occurrence[i] = isException;
         }
         else if (propertyDefinition.Equals(InternalSchema.AppointmentRecurring))
         {
             occurrence[i] = false;
         }
         else if (propertyDefinition.Equals(InternalSchema.AppointmentRecurrenceBlob))
         {
             occurrence[i] = new PropertyError(columns[i], PropertyErrorCode.NotFound);
         }
         else if (propertyDefinition.Equals(InternalSchema.MapiStartTime) || propertyDefinition.Equals(InternalSchema.MapiPRStartDate))
         {
             occurrence[i] = occurrenceInfo.StartTime;
         }
         else if (propertyDefinition.Equals(InternalSchema.MapiEndTime) || propertyDefinition.Equals(InternalSchema.MapiPREndDate))
         {
             occurrence[i] = occurrenceInfo.EndTime;
         }
         else if (propertyDefinition.Equals(InternalSchema.TimeZoneDefinitionStart) || propertyDefinition.Equals(InternalSchema.TimeZoneDefinitionEnd))
         {
             if (occurrence[i] is PropertyError)
             {
                 occurrence[i] = createdTimeZoneBlobCache;
             }
         }
         else if (propertyDefinition.Equals(InternalSchema.ItemClass))
         {
             occurrence[i] = (isException ? (occurrence[i] = "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}") : (occurrence[i] = "IPM.Appointment.Occurrence"));
         }
         else if (propertyDefinition.Equals(InternalSchema.GlobalObjectId))
         {
             object obj   = occurrence[Array.IndexOf <PropertyDefinition>(columns, InternalSchema.CleanGlobalObjectId)];
             byte[] array = obj as byte[];
             if (array != null)
             {
                 occurrence[i] = new GlobalObjectId(array)
                 {
                     Date = ((OccurrenceStoreObjectId)occurrenceInfo.VersionedId.ObjectId).OccurrenceId
                 }.Bytes;
             }
             else
             {
                 PropertyError propertyError = obj as PropertyError;
                 occurrence[i] = new PropertyError(InternalSchema.GlobalObjectId, propertyError.PropertyErrorCode, propertyError.PropertyErrorDescription);
             }
         }
         else if (propertyDefinition.Equals(InternalSchema.Codepage))
         {
             occurrence[i] = codePage;
         }
     }
 }
Exemplo n.º 7
0
		public void Equals_TwoDifferentDefinitionsWithSameValues_ReturnsTrue() {
			var definition1 = new PropertyDefinition("propertyName", typeof(Property<string>));
			var definition2 = new PropertyDefinition("propertyName", typeof(Property<string>));
			Assert.IsTrue(definition1.Equals(definition2));
		}