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);
 }
Exemplo n.º 2
0
        private static MemoryPropertyBag SaveLocationContainer(IStorePropertyBag storeObject, StorePropertyDefinition[] properties)
        {
            MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag();

            memoryPropertyBag.PreLoadStoreProperty <StorePropertyDefinition>(properties, storeObject.GetProperties(properties));
            return(memoryPropertyBag);
        }
Exemplo n.º 3
0
        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);
        }
        private static IStorePropertyBag CloneToWritablePropertyBag(IStorePropertyBag propertyBag, ICollection <PropertyDefinition> loadedProperties)
        {
            MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag();

            memoryPropertyBag.LoadFromStorePropertyBag(propertyBag, loadedProperties);
            return(memoryPropertyBag.AsIStorePropertyBag());
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
0
 internal MemoryPropertyBag(MemoryPropertyBag propertyBag) : base(propertyBag)
 {
     this.ExTimeZone             = propertyBag.ExTimeZone;
     this.HasAllPropertiesLoaded = propertyBag.HasAllPropertiesLoaded;
     if (propertyBag.propertyValues != null && propertyBag.propertyValues.Count > 0)
     {
         this.propertyValues = new Dictionary <PropertyDefinition, object>(propertyBag.propertyValues);
     }
 }
Exemplo n.º 7
0
        public IStorePropertyBag Convert(ADRawEntry adObject)
        {
            MemoryPropertyBag memoryPropertyBag = new MemoryPropertyBag();
            IStorePropertyBag storePropertyBag  = memoryPropertyBag.AsIStorePropertyBag();

            this.Convert(adObject, storePropertyBag);
            memoryPropertyBag.SetAllPropertiesLoaded();
            return(storePropertyBag);
        }
Exemplo n.º 8
0
        internal PropertyBag GetMailboxPropertyBag()
        {
            MemoryPropertyBag memoryPropertyBag = this.mailboxPropertyBag;

            if (memoryPropertyBag == null)
            {
                memoryPropertyBag = DefaultFolderContext.SaveLocationContainer(this.Session.Mailbox, DefaultFolderInfo.MailboxProperties);
                if (this.isSessionOpenStage)
                {
                    this.mailboxPropertyBag = memoryPropertyBag;
                }
            }
            return(memoryPropertyBag);
        }
Exemplo n.º 9
0
        internal static IEnumerable <PropValue> ResolveProperties(MemoryPropertyBag client, MemoryPropertyBag server, MemoryPropertyBag original, AcrProfile profile)
        {
            ConflictResolutionResult resolutionResult = profile.ResolveConflicts(MasterCategoryList.GetPropValuesToResolve(client, server, original, profile));

            if (resolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                throw new Exception();
            }
            foreach (PropertyConflict conflict in resolutionResult.PropertyConflicts)
            {
                yield return(new PropValue(InternalSchema.ToStorePropertyDefinition(conflict.PropertyDefinition), conflict.ResolvedValue));
            }
            yield break;
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
 internal static ReplyTo CreateInstance(IStorePropertyBag storePropertyBag)
 {
     if (storePropertyBag.GetValueOrDefault <bool>(MessageItemSchema.ReplyToNamesExists, false) && storePropertyBag.GetValueOrDefault <bool>(MessageItemSchema.ReplyToBlobExists, false))
     {
         string valueOrDefault  = storePropertyBag.GetValueOrDefault <string>(InternalSchema.MapiReplyToNames, null);
         byte[] valueOrDefault2 = storePropertyBag.GetValueOrDefault <byte[]>(InternalSchema.MapiReplyToBlob, null);
         if (valueOrDefault != null && valueOrDefault2 != null)
         {
             PropertyBag propertyBag = new MemoryPropertyBag();
             propertyBag[InternalSchema.MapiReplyToNames] = valueOrDefault;
             propertyBag[InternalSchema.MapiReplyToBlob]  = valueOrDefault2;
             return(new ReplyTo(propertyBag));
         }
     }
     return(null);
 }
Exemplo n.º 12
0
        internal static Likers CreateInstance(IDictionary <PropertyDefinition, object> propertyBag)
        {
            object obj;

            if (propertyBag.TryGetValue(InternalSchema.LikersBlob, out obj))
            {
                byte[] array = obj as byte[];
                if (array != null)
                {
                    PropertyBag propertyBag2 = new MemoryPropertyBag();
                    propertyBag2[InternalSchema.MapiLikersBlob] = array;
                    return(new Likers(propertyBag2));
                }
            }
            return(null);
        }
Exemplo n.º 13
0
        internal PropertyBag GetInboxOrConfigurationFolderPropertyBag()
        {
            MemoryPropertyBag memoryPropertyBag = this.inboxConfigurationPropertyBag;

            if (memoryPropertyBag == null)
            {
                using (Folder folder = this.OpenInboxOrConfigurationFolder())
                {
                    memoryPropertyBag = DefaultFolderContext.SaveLocationContainer(folder, DefaultFolderInfo.InboxOrConfigurationFolderProperties);
                }
                if (this.isSessionOpenStage)
                {
                    this.inboxConfigurationPropertyBag = memoryPropertyBag;
                }
            }
            return(memoryPropertyBag);
        }
Exemplo n.º 14
0
 internal ConversionItemParticipants(MemoryPropertyBag propertyBag, bool skipSkippable)
 {
     this.propertyBag   = propertyBag;
     this.skipSkippable = skipSkippable;
 }
Exemplo n.º 15
0
 private MasterCategoryList(MemoryPropertyBag propertyBagToAssume)
 {
     this.propertyBag = propertyBagToAssume;
 }
        private static void WritePropValue(BinaryWriter writer, PropertyDefinition prop, MemoryPropertyBag propertyBag)
        {
            PropertyTagPropertyDefinition propertyTagPropertyDefinition = (PropertyTagPropertyDefinition)prop;

            writer.Write(propertyTagPropertyDefinition.PropertyTag);
            object   obj       = propertyBag.TryGetProperty(propertyTagPropertyDefinition);
            PropType propType  = ((PropTag)propertyTagPropertyDefinition.PropertyTag).ValueType();
            PropType propType2 = propType;

            if (propType2 <= PropType.Binary)
            {
                if (propType2 == PropType.Int)
                {
                    ExternalUserCollection.WriteIntValue(writer, (int)obj);
                    return;
                }
                if (propType2 == PropType.String)
                {
                    ExternalUserCollection.WriteStringValue(writer, (string)obj);
                    return;
                }
                if (propType2 == PropType.Binary)
                {
                    ExternalUserCollection.WriteByteValue(writer, (byte[])obj);
                    return;
                }
            }
            else
            {
                if (propType2 == PropType.IntArray)
                {
                    ExternalUserCollection.WriteArrayValue <int>(writer, (int[])obj, new ExternalUserCollection.WriteValue <int>(ExternalUserCollection.WriteIntValue));
                    return;
                }
                if (propType2 == PropType.StringArray)
                {
                    ExternalUserCollection.WriteArrayValue <string>(writer, (string[])obj, new ExternalUserCollection.WriteValue <string>(ExternalUserCollection.WriteStringValue));
                    return;
                }
                if (propType2 == PropType.BinaryArray)
                {
                    ExternalUserCollection.WriteArrayValue <byte[]>(writer, (byte[][])obj, new ExternalUserCollection.WriteValue <byte[]>(ExternalUserCollection.WriteByteValue));
                    return;
                }
            }
            writer.Write(0U);
        }
Exemplo n.º 17
0
 internal ExternalUser(MemoryPropertyBag propertyBag)
 {
     this.propertyBag = propertyBag;
 }
Exemplo n.º 18
0
 public ExceptionInfo(VersionedId versionedId, ExDateTime occurrenceDateId, ExDateTime originalStartTime, ExDateTime startTime, ExDateTime endTime, ModificationType modificationType, MemoryPropertyBag propertyBag) : base(versionedId, occurrenceDateId, originalStartTime, startTime, endTime)
 {
     this.ModificationType = modificationType;
     this.PropertyBag      = propertyBag;
 }
Exemplo n.º 19
0
        private static Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve> GetPropValuesToResolve(MemoryPropertyBag client, MemoryPropertyBag server, MemoryPropertyBag original, AcrProfile profile)
        {
            Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve> dictionary = new Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve>();
            HashSet <PropertyDefinition> propertiesNeededForResolution = profile.GetPropertiesNeededForResolution(Util.CompositeEnumerator <PropertyDefinition>(new IEnumerable <PropertyDefinition>[]
            {
                client.Keys,
                server.Keys
            }));

            foreach (PropertyDefinition propertyDefinition in propertiesNeededForResolution)
            {
                dictionary.Add(propertyDefinition, new AcrPropertyProfile.ValuesToResolve(client.TryGetProperty(propertyDefinition), server.TryGetProperty(propertyDefinition), (original != null) ? original.TryGetProperty(propertyDefinition) : null));
            }
            return(dictionary);
        }
Exemplo n.º 20
0
 private Category(MemoryPropertyBag propertyBagToAssume)
 {
     this.propertyBag          = propertyBagToAssume;
     this.categoryLastTimeUsed = new Category.CategoryLastTimeUsed(this);
 }