예제 #1
0
 protected MailboxSyncProvider()
 {
     this.itemQueryOptimizationFilter = MailboxSyncProvider.falseFilterInstance;
     base..ctor();
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
 }
예제 #2
0
 private UserConfiguration(UserConfigurationName configurationName, UserConfigurationTypes type, IStorePropertyBag queryPropertyBag)
 {
     EnumValidator.AssertValid <UserConfigurationTypes>(type);
     this.queryPropertyBag = queryPropertyBag;
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
 }
예제 #3
0
        internal MessageAttachmentWriter(InboundMessageWriter messageWriter, int attachMethod)
        {
            StorageGlobals.TraceConstructIDisposable(this);
            this.messageWriter = messageWriter;
            AttachmentType attachmentType = CoreAttachmentCollection.GetAttachmentType(new int?(attachMethod));

            this.coreAttachment = this.CoreItem.AttachmentCollection.Create(attachmentType);
        }
예제 #4
0
 internal MessageAttachmentWriter(InboundMessageWriter messageWriter)
 {
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
     this.messageWriter  = messageWriter;
     this.coreAttachment = this.CoreItem.AttachmentCollection.InternalCreate(null);
     this.attachMethod   = null;
 }
예제 #5
0
 internal EventSubscription(EventQueue eventQueue, IEventHandler eventHandler)
 {
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
     this.eventQueue     = eventQueue;
     this.eventQueue.RegisterEventAvailableHandler(new EventQueue.EventAvailableHandler(this.EventAvailableHandler));
     this.eventHandler = eventHandler;
     ExTraceGlobals.EventTracer.TraceDebug <EventSubscription>((long)this.GetHashCode(), "EventSubscription::Constructor. {0}", this);
 }
예제 #6
0
 internal SearchFolderAsyncSearch(StoreSession session, StoreObjectId searchFolderId, AsyncCallback userCallback, object state)
 {
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
     this.state          = state;
     this.userCallback   = userCallback;
     this.asyncResult    = new SearchFolderAsyncSearch.SearchFolderAsyncResult(this);
     this.subscription   = Subscription.Create(session, new NotificationHandler(this.NotificationHandler), NotificationType.SearchComplete, searchFolderId, false);
 }
예제 #7
0
 internal InboundMessageWriter(ICoreItem item, InboundConversionOptions options, InboundAddressCache addressCache, ConversionLimitsTracker limitsTracker, MimeMessageLevel messageLevel)
 {
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker    = this.GetDisposeTracker();
     this.parent            = null;
     this.isTopLevelMessage = (messageLevel == MimeMessageLevel.TopLevelMessage);
     this.SetItem(item, options, false);
     this.SetAddressCache(addressCache, false);
     this.SetLimitsTracker(limitsTracker);
     this.componentType = ConversionComponentType.Message;
 }
예제 #8
0
 internal MapiPropertyBag(StoreSession storeSession, MapiProp mapiProp)
 {
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
     this.mapiProp       = mapiProp;
     this.exTimeZone     = storeSession.ExTimeZone;
     this.storeSession   = storeSession;
     if (mapiProp.DisposeTracker != null)
     {
         mapiProp.DisposeTracker.AddExtraDataWithStackTrace("MapiPropertyBag owns mapiProp at");
     }
 }
예제 #9
0
 public AllContactsCursor(MailboxSession session, PropertyDefinition[] properties, SortBy[] sortByProperties)
 {
     using (DisposeGuard disposeGuard = this.Guard())
     {
         Util.ThrowOnNullArgument(session, "session");
         Util.ThrowOnNullArgument(properties, "properties");
         StorageGlobals.TraceConstructIDisposable(this);
         this.disposeTracker   = this.GetDisposeTracker();
         this.session          = session;
         this.properties       = PropertyDefinitionCollection.Merge <PropertyDefinition>(AllContactsCursor.requiredProperties, properties);
         this.sortByProperties = sortByProperties;
         this.PrepareQuery();
         disposeGuard.Success();
     }
 }
예제 #10
0
        private InboundMessageWriter(InboundMessageWriter parent, ICoreItem item)
        {
            StorageGlobals.TraceConstructIDisposable(this);
            this.disposeTracker    = this.GetDisposeTracker();
            this.parent            = parent;
            this.isTopLevelMessage = false;
            this.SetItem(item, parent.ConversionOptions, true);
            ConversionLimitsTracker conversionLimitsTracker = parent.LimitsTracker;

            conversionLimitsTracker.StartEmbeddedMessage();
            InboundAddressCache addressCache = new InboundAddressCache(parent.ConversionOptions, conversionLimitsTracker, MimeMessageLevel.AttachedMessage);

            this.SetAddressCache(addressCache, true);
            this.SetLimitsTracker(conversionLimitsTracker);
            this.componentType = ConversionComponentType.Message;
        }
예제 #11
0
 internal StoreObject(ICoreObject coreObject, bool shallowDispose = false)
 {
     using (DisposeGuard disposeGuard = this.Guard())
     {
         StorageGlobals.TraceConstructIDisposable(this);
         this.disposeTracker = this.GetDisposeTracker();
         this.shallowDispose = shallowDispose;
         DisposableObject disposableObject = coreObject as DisposableObject;
         if (disposableObject != null && disposableObject.DisposeTracker != null)
         {
             disposableObject.DisposeTracker.AddExtraDataWithStackTrace("StoreObject (e.g. MessageItem) owns coreObject (e.g. CoreItem) at");
         }
         this.AttachCoreObject(coreObject);
         ((IDirectPropertyBag)this.PropertyBag).Context.StoreObject = this;
         disposeGuard.Success();
     }
 }
예제 #12
0
        private SyncStateStorage(Folder folder, DeviceSyncStateMetadata deviceMetadata, ISyncLogger syncLogger = null)
        {
            this.syncLogger = (syncLogger ?? TracingLogger.Singleton);
            StorageGlobals.TraceConstructIDisposable(this);
            this.disposeTracker = this.GetDisposeTracker();
            this.folder         = folder;
            this.DeviceMetadata = deviceMetadata;
            if (this.folder.DisplayName != this.DeviceMetadata.Id.CompositeKey)
            {
                throw new ArgumentException(string.Format("[SyncStateStorage.ctor] The folder name '{0}' and the metadata name '{1}' should match.", this.folder.DisplayName, deviceMetadata.Id));
            }
            this.creationTime = (ExDateTime)this.folder.TryGetProperty(StoreObjectSchema.CreationTime);
            long num = 0L;

            long.TryParse(this.folder.GetValueOrDefault <string>(SyncStateStorage.airsyncLockProp, "0"), NumberStyles.Any, CultureInfo.InvariantCulture, out num);
            this.airsyncLock      = ((num == 0L) ? ExDateTime.MinValue : ExDateTime.FromBinary(num));
            this.syncRootFolderId = folder.ParentId;
        }
예제 #13
0
 private Subscription(StoreSession storeSession, StoreObjectId storeObjectId, NotificationHandler handler, bool passthruCallback)
 {
     Util.ThrowOnNullArgument(storeSession, "storeSession");
     this.storeSession     = storeSession;
     this.itemId           = storeObjectId;
     this.handler          = handler;
     this.passthruCallback = passthruCallback;
     if (this.passthruCallback)
     {
         this.sink = new SubscriptionSink(this);
     }
     else
     {
         this.sink = new SubscriptionSink(storeSession.SubscriptionsManager, handler != null);
         storeSession.SubscriptionsManager.RegisterSubscription(this);
     }
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
 }
예제 #14
0
        internal RecipientTable(ICoreItem item)
        {
            bool flag = false;

            try
            {
                StorageGlobals.TraceConstructIDisposable(this);
                if (item.Session == null)
                {
                    this.recipientTable = null;
                }
                else
                {
                    this.mapiMessage  = (MapiMessage)CoreObject.GetPersistablePropertyBag(item).MapiProp;
                    this.storeSession = item.Session;
                    this.timeZone     = CoreObject.GetPersistablePropertyBag(item).ExTimeZone;
                    StoreSession storeSession = this.storeSession;
                    bool         flag2        = false;
                    try
                    {
                        if (storeSession != null)
                        {
                            storeSession.BeginMapiCall();
                            storeSession.BeginServerHealthCall();
                            flag2 = true;
                        }
                        if (StorageGlobals.MapiTestHookBeforeCall != null)
                        {
                            StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                        }
                        this.recipientTable = this.mapiMessage.GetRecipientTable();
                    }
                    catch (MapiPermanentException ex)
                    {
                        throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetRecipientTable, ex, storeSession, this, "{0}. MapiException = {1}.", new object[]
                        {
                            string.Format("RecipientTable::Storage.RecipientTable.", new object[0]),
                            ex
                        });
                    }
                    catch (MapiRetryableException ex2)
                    {
                        throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetRecipientTable, ex2, storeSession, this, "{0}. MapiException = {1}.", new object[]
                        {
                            string.Format("RecipientTable::Storage.RecipientTable.", new object[0]),
                            ex2
                        });
                    }
                    finally
                    {
                        try
                        {
                            if (storeSession != null)
                            {
                                storeSession.EndMapiCall();
                                if (flag2)
                                {
                                    storeSession.EndServerHealthCall();
                                }
                            }
                        }
                        finally
                        {
                            if (StorageGlobals.MapiTestHookAfterCall != null)
                            {
                                StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                            }
                        }
                    }
                }
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    base.Dispose();
                }
            }
        }
예제 #15
0
 internal Attachment(CoreAttachment coreAttachment)
 {
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
     this.coreAttachment = coreAttachment;
 }
예제 #16
0
        internal EventPump(EventPumpManager eventPumpManager, string server, Guid mdbGuid)
        {
            StorageGlobals.TraceConstructIDisposable(this);
            this.disposeTracker   = this.GetDisposeTracker();
            this.eventPumpManager = eventPumpManager;
            this.server           = server;
            this.mdbGuid          = mdbGuid;
            this.threadLimiter    = new EventPumpThreadLimiter(this);
            StoreSession storeSession = null;
            bool         flag         = false;

            try
            {
                if (storeSession != null)
                {
                    storeSession.BeginMapiCall();
                    storeSession.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                this.exRpcAdmin = ExRpcAdmin.Create("Client=EventPump", server, null, null, null);
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.ExFailedToCreateEventManager, ex, storeSession, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("EventPump::Constructor. Failed to create EventPump.", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.ExFailedToCreateEventManager, ex2, storeSession, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("EventPump::Constructor. Failed to create EventPump.", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (storeSession != null)
                    {
                        storeSession.EndMapiCall();
                        if (flag)
                        {
                            storeSession.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            StoreSession storeSession2 = null;
            bool         flag2         = false;

            try
            {
                if (storeSession2 != null)
                {
                    storeSession2.BeginMapiCall();
                    storeSession2.BeginServerHealthCall();
                    flag2 = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                this.mapiEventManager = MapiEventManager.Create(this.exRpcAdmin, Guid.Empty, this.mdbGuid);
            }
            catch (MapiPermanentException ex3)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.ExFailedToCreateEventManager, ex3, storeSession2, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("EventPump::Constructor. Failed to create EventPump.", new object[0]),
                    ex3
                });
            }
            catch (MapiRetryableException ex4)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.ExFailedToCreateEventManager, ex4, storeSession2, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("EventPump::Constructor. Failed to create EventPump.", new object[0]),
                    ex4
                });
            }
            finally
            {
                try
                {
                    if (storeSession2 != null)
                    {
                        storeSession2.EndMapiCall();
                        if (flag2)
                        {
                            storeSession2.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            this.lastEventCounter = this.ReadLastEventWatermark();
            this.RegisterMainPump(EventPump.PollingTimeSpan);
            ExTraceGlobals.EventTracer.TraceDebug <EventPump>((long)this.GetHashCode(), "EventPump::Constructor. {0}", this);
        }
        internal ExternalUserCollection(MailboxSession session)
        {
            this.data = new List <ExternalUser>();
            byte[]       entryId      = null;
            StoreSession storeSession = null;
            bool         flag         = false;

            try
            {
                if (storeSession != null)
                {
                    storeSession.BeginMapiCall();
                    storeSession.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                entryId = session.Mailbox.MapiStore.GetLocalDirectoryEntryId();
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotLookupEntryId, ex, storeSession, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("Unable to lookup Local Directory EntryID", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotLookupEntryId, ex2, storeSession, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("Unable to lookup Local Directory EntryID", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (storeSession != null)
                    {
                        storeSession.EndMapiCall();
                        if (flag)
                        {
                            storeSession.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            StoreObjectId messageId = StoreObjectId.FromProviderSpecificId(entryId, StoreObjectType.Message);

            this.directoryMessage = MessageItem.Bind(session, messageId, new PropertyDefinition[]
            {
                InternalSchema.LocalDirectory
            });
            try
            {
                this.directoryMessage.OpenAsReadWrite();
                try
                {
                    using (Stream stream = this.directoryMessage.OpenPropertyStream(InternalSchema.LocalDirectory, PropertyOpenMode.ReadOnly))
                    {
                        long length = stream.Length;
                        using (BinaryReader binaryReader = new BinaryReader(stream))
                        {
                            while (stream.Position < length)
                            {
                                ExternalUser item;
                                if (ExternalUserCollection.TryReadEntry(binaryReader, out item) && !this.Contains(item))
                                {
                                    this.data.Add(item);
                                }
                            }
                        }
                    }
                }
                catch (ObjectNotFoundException)
                {
                }
                catch (EndOfStreamException)
                {
                }
            }
            catch (StoragePermanentException)
            {
                if (this.directoryMessage != null)
                {
                    this.directoryMessage.Dispose();
                }
                throw;
            }
            catch (StorageTransientException)
            {
                if (this.directoryMessage != null)
                {
                    this.directoryMessage.Dispose();
                }
                throw;
            }
            StorageGlobals.TraceConstructIDisposable(this);
            this.disposeTracker = this.GetDisposeTracker();
        }
예제 #18
0
 protected MailboxSyncItem(Item item)
 {
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
     this.item           = item;
 }
 protected PersistablePropertyBag()
 {
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
 }