internal static void Save(TopicHashCache cache, IXSOFactory xsoFactory, IMailboxSession session) { try { using (IFolder folder = xsoFactory.BindToFolder(session, DefaultFolderType.Inbox, new PropertyDefinition[] { FolderSchema.ConversationTopicHashEntries })) { using (MemoryStream memoryStream = new MemoryStream(cache.EstimatedSize)) { cache.Serialize(memoryStream); folder[FolderSchema.ConversationTopicHashEntries] = memoryStream.ToArray(); folder.Save(); } } } catch (IOException arg) { ExTraceGlobals.StorageTracer.TraceDebug <IOException>(0L, "TopicHashCache::Save. Encountered the following exception. Exception = {0}.", arg); } catch (StorageTransientException arg2) { ExTraceGlobals.StorageTracer.TraceDebug <StorageTransientException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg2); } catch (StoragePermanentException arg3) { ExTraceGlobals.StorageTracer.TraceDebug <StoragePermanentException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg3); } }
// Token: 0x060013AF RID: 5039 RVA: 0x00073030 File Offset: 0x00071230 public bool LoadData(IMailboxSession itemStore, IXSOFactory factory) { if (this.inboxFolderId == null) { StoreObjectId defaultFolderId = itemStore.GetDefaultFolderId(DefaultFolderType.Inbox); if (defaultFolderId != null) { this.inboxFolderId = defaultFolderId.ProviderLevelItemId; using (IFolder folder = factory.BindToFolder(itemStore, defaultFolderId)) { this.InboxItemCount = (long)folder.ItemCount; this.InboxUnreadCount = (long)folder.GetValueOrDefault <int>(FolderSchema.UnreadCount, 1); if (this.InboxUnreadCount == 0L) { this.InboxUnreadCount = 1L; ExTraceGlobals.PushNotificationAssistantTracer.TraceError <Guid, object>((long)this.GetHashCode(), "MailboxData.LoadData('{0}'): {1} - The UnreadCount coming from the folder is = 0", itemStore.MailboxGuid, TraceContext.Get()); } return(true); } } Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_FailedToResolveInboxFolderId, itemStore.MdbGuid.ToString(), new object[] { itemStore.MdbGuid, itemStore.MailboxGuid }); ExTraceGlobals.PushNotificationAssistantTracer.TraceWarning((long)this.GetHashCode(), "MailboxData.LoadData: {0} - Load Data: Inbox folder is null", new object[] { TraceContext.Get() }); return(false); } return(true); }
public static IUnseenItemsReader Create(IMailboxSession mailboxSession, IXSOFactory xsoFactory) { ArgumentValidator.ThrowIfNull("mailboxSession", mailboxSession); ArgumentValidator.ThrowIfNull("xsoFactory", xsoFactory); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); IFolder folder = xsoFactory.BindToFolder(mailboxSession, defaultFolderId); return(new UnseenItemsReader(folder)); }
private static void GetCalendarFolderProperties(IMailboxSession session, IXSOFactory xsoFactory, out int?calendarFolderVersion, out int?calendarItemCount) { calendarFolderVersion = null; calendarItemCount = null; using (IFolder folder = xsoFactory.BindToFolder(session, DefaultFolderType.Calendar)) { calendarFolderVersion = folder.GetValueOrDefault <int?>(FolderSchema.CalendarFolderVersion, null); calendarItemCount = folder.GetValueOrDefault <int?>(FolderSchema.ItemCount, null); } }
public static IPushNotificationStorage Find(IMailboxSession mailboxSession, IXSOFactory xsoFactory) { ArgumentValidator.ThrowIfNull("mailboxSession", mailboxSession); ArgumentValidator.ThrowIfNull("xsoFactory", xsoFactory); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.PushNotificationRoot); if (defaultFolderId != null) { return(new PushNotificationStorage(xsoFactory.BindToFolder(mailboxSession, defaultFolderId), PushNotificationStorage.GetTenantId(mailboxSession))); } return(null); }
public static IPushNotificationStorage Create(IMailboxSession mailboxSession, IXSOFactory xsoFactory, IOrganizationIdConvertor organizationIdConvertor) { ArgumentValidator.ThrowIfNull("mailboxSession", mailboxSession); ArgumentValidator.ThrowIfNull("xsoFactory", xsoFactory); IPushNotificationStorage pushNotificationStorage = PushNotificationStorage.Find(mailboxSession, xsoFactory); if (pushNotificationStorage != null) { return(pushNotificationStorage); } ArgumentValidator.ThrowIfNull("mailboxSession.MailboxOwner", mailboxSession.MailboxOwner); ArgumentValidator.ThrowIfNull("organizationIdConvertor", organizationIdConvertor); if (ExTraceGlobals.StorageNotificationSubscriptionTracer.IsTraceEnabled(TraceType.DebugTrace)) { ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug <string>(0L, "PushNotificationStorage.Create: Creating a new Notification Subscription folder for user {0}.", (mailboxSession.MailboxOwner.ObjectId != null) ? mailboxSession.MailboxOwner.ObjectId.ToDNString() : string.Empty); } StoreObjectId folderId = mailboxSession.CreateDefaultFolder(DefaultFolderType.PushNotificationRoot); IFolder folder = xsoFactory.BindToFolder(mailboxSession, folderId); return(new PushNotificationStorage(folder, PushNotificationStorage.GetTenantId(mailboxSession), xsoFactory)); }
internal static TopicHashCache Load(IXSOFactory xsoFactory, IMailboxSession session, int cacheSize) { TopicHashCache topicHashCache = new TopicHashCache(cacheSize); try { byte[] array = null; using (IFolder folder = xsoFactory.BindToFolder(session, DefaultFolderType.Inbox, new PropertyDefinition[] { FolderSchema.ConversationTopicHashEntries })) { array = (folder.TryGetProperty(FolderSchema.ConversationTopicHashEntries) as byte[]); } if (array != null) { using (MemoryStream memoryStream = new MemoryStream(array)) { topicHashCache.Deserialize(memoryStream); } } } catch (IOException arg) { ExTraceGlobals.StorageTracer.TraceDebug <IOException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg); topicHashCache = new TopicHashCache(cacheSize); } catch (StorageTransientException arg2) { ExTraceGlobals.StorageTracer.TraceDebug <StorageTransientException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg2); topicHashCache = new TopicHashCache(cacheSize); } catch (StoragePermanentException arg3) { ExTraceGlobals.StorageTracer.TraceDebug <StoragePermanentException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg3); topicHashCache = new TopicHashCache(cacheSize); } return(topicHashCache); }
// Token: 0x06000F1B RID: 3867 RVA: 0x0005A338 File Offset: 0x00058538 public static bool IsSyncRequired(Guid mailboxGuid, OrganizationId organizationId, out bool isLongRunningOp, IXSOFactory xsoFactory, IPublicFolderMailboxLoggerBase logger) { isLongRunningOp = false; bool flag = true; using (PublicFolderSession publicFolderSession = PublicFolderSession.OpenAsAdmin(organizationId, null, mailboxGuid, null, CultureInfo.CurrentCulture, string.Format("{0};Action={1}", "Client=TBA", "PublicFolderSplitHelper"), null)) { using (Folder folder = xsoFactory.BindToFolder(publicFolderSession, publicFolderSession.GetTombstonesRootFolderId()) as Folder) { using (UserConfiguration configuration = UserConfiguration.GetConfiguration(folder, new UserConfigurationName("PublicFolderSyncInfo", ConfigurationNameKind.Name), UserConfigurationTypes.Dictionary)) { IDictionary dictionary = configuration.GetDictionary(); int? num = dictionary.Contains("NumberOfFoldersToBeSynced") ? ((int?)dictionary["NumberOfFoldersToBeSynced"]) : null; int? num2 = dictionary.Contains("NumberOfFoldersSynced") ? ((int?)dictionary["NumberOfFoldersSynced"]) : null; int? num3 = (num == null) ? null : (num - (num2 ?? 0)); flag = (num3 == null || num3 > 0); isLongRunningOp = (flag && (num3 == null || num3 > PublicFolderSplitConfig.Instance.LongRunningSyncChangeCount)); logger.LogEvent(LogEventType.Statistics, string.Format("PublicFolderSplitHelper::IsSyncRequired - FTBS={0},FS={1},FTBSN={2}", num, num2, num3)); } } } return(flag); }