private void InternalSetValidatedStoreProperty(PropertyDefinition propertyDefinition, object value)
        {
            this.EnsureInternalDataStructuresAllocated(8);
            Array array = value as Array;

            if (array != null)
            {
                value = MemoryPropertyBag.ClonePropertyValue <Array>(array);
            }
            else if (value is DateTime)
            {
                ExTimeZoneHelperForMigrationOnly.CheckValidationLevel(false, ExTimeZoneHelperForMigrationOnly.ValidationLevel.Low, "MemoryPropertyBag.InternalSetValidatedStoreProperty: System.DateTime", new object[0]);
                value = new ExDateTime(this.ExTimeZone, (DateTime)value);
            }
            else if (value is ExDateTime)
            {
                ((ExDateTime)value).CheckExpectedTimeZone(this.ExTimeZone, ExTimeZoneHelperForMigrationOnly.ValidationLevel.High);
                value = this.ExTimeZone.ConvertDateTime((ExDateTime)value);
            }
            object originalValue = null;
            StorePropertyDefinition storePropertyDefinition = InternalSchema.ToStorePropertyDefinition(propertyDefinition);
            bool flag = (storePropertyDefinition.PropertyFlags & PropertyFlags.TrackChange) == PropertyFlags.TrackChange;

            if (!(value is PropertyError) && flag && this.propertyValues.ContainsKey(propertyDefinition))
            {
                originalValue = this.propertyValues[propertyDefinition];
            }
            this.propertyValues[propertyDefinition] = value;
            if (this.deletedProperties != null)
            {
                this.deletedProperties.Remove(propertyDefinition);
            }
            this.ChangedProperties.TryAdd(propertyDefinition);
            this.AddTrackingInformation(storePropertyDefinition, PropertyTrackingInformation.Modified, originalValue);
        }
 public EndDateRecurrenceRange(ExDateTime startDate, ExDateTime endDate)
 {
     ExTimeZoneHelperForMigrationOnly.CheckValidationLevel(startDate.TimeZone == endDate.TimeZone, ExTimeZoneHelperForMigrationOnly.ValidationLevel.Mid, "EndDateRecurrenceRange constructor.\nstartDate.TimeZone={0}\nendDateTime.TimeZone={1}", new object[]
     {
         startDate.TimeZone,
         endDate.TimeZone
     });
     this.StartDate = startDate;
     this.EndDate   = endDate;
 }
Example #3
0
        public static ExTimeZone GetExTimeZoneFromItem(Item item)
        {
            ExTimeZone exTimeZone = TimeZoneHelper.GetRecurringTimeZoneFromPropertyBag(item.PropertyBag);

            if (exTimeZone == null)
            {
                exTimeZone = TimeZoneHelper.GetTimeZoneFromProperties("Customized Time Zone", null, item.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneDefinitionStart));
            }
            if (exTimeZone == null)
            {
                if (item.Session != null && item.Session.ExTimeZone != ExTimeZone.UtcTimeZone)
                {
                    exTimeZone = item.Session.ExTimeZone;
                }
                else
                {
                    ExTimeZoneHelperForMigrationOnly.CheckValidationLevel(false, ExTimeZoneHelperForMigrationOnly.ValidationLevel.Low, "TimeZoneHelper.GetTimeZoneFromItem: no time zone", new object[0]);
                    exTimeZone = ExTimeZone.CurrentTimeZone;
                }
            }
            return(exTimeZone);
        }
Example #4
0
 internal void WritePropValue(PropTag propertyTag, object value)
 {
     this.WriteInt((int)propertyTag);
     if (value is int)
     {
         this.WriteInt((int)value);
         return;
     }
     if (value is bool)
     {
         this.WritePropValueBool((bool)value);
         return;
     }
     if (value is DateTime)
     {
         ExTimeZoneHelperForMigrationOnly.CheckValidationLevel(false, ExTimeZoneHelperForMigrationOnly.ValidationLevel.High, "OutlookBlobWriter.WritePropValue is being passed a DateTime argument.", new object[0]);
         this.WritePropValueDateTime((DateTime)value);
         return;
     }
     if (value is DateTime[])
     {
         ExTimeZoneHelperForMigrationOnly.CheckValidationLevel(false, ExTimeZoneHelperForMigrationOnly.ValidationLevel.High, "OutlookBlobWriter.WritePropValue is being passed a DateTime[] argument.", new object[0]);
         DateTime[] array = (DateTime[])value;
         this.WriteInt(array.Length);
         foreach (DateTime dateTime in array)
         {
             this.WritePropValueDateTime(dateTime);
         }
         return;
     }
     if (value is ExDateTime)
     {
         this.WritePropValueDateTime((DateTime)((ExDateTime)value));
         return;
     }
     if (value is ExDateTime[])
     {
         ExDateTime[] array3 = (ExDateTime[])value;
         this.WriteInt(array3.Length);
         foreach (ExDateTime exDateTime in array3)
         {
             this.WritePropValueDateTime((DateTime)exDateTime);
         }
         return;
     }
     if (value is string)
     {
         this.WritePropValueString((string)value, propertyTag.ValueType());
         return;
     }
     if (value is string[])
     {
         string[] array5 = (string[])value;
         this.WriteInt(array5.Length);
         foreach (string value2 in array5)
         {
             this.WritePropValueString(value2, propertyTag.ValueType());
         }
         return;
     }
     if (value is byte[])
     {
         byte[] array7 = (byte[])value;
         this.WriteShort((short)array7.Length);
         this.WriteByteArray(array7);
         return;
     }
     if (value is byte[][])
     {
         byte[][] array8 = (byte[][])value;
         this.WriteInt(array8.Length);
         foreach (byte[] array10 in array8)
         {
             this.WriteInt(array10.Length);
             this.WriteByteArray(array10);
         }
         return;
     }
     throw new NotSupportedException();
 }