internal override void Recover(DefaultFolder defaultFolder, Exception e, ref DefaultFolderData defaultFolderData)
 {
     try
     {
         defaultFolder.RemoveForRecover(ref defaultFolderData);
         defaultFolder.CreateInternal(ref defaultFolderData);
     }
     catch (StoragePermanentException innerException)
     {
         throw new CorruptDataException(ServerStrings.ExCorruptDataRecoverError(defaultFolder.ToString()), innerException);
     }
     catch (StorageTransientException innerException2)
     {
         throw new CorruptDataException(ServerStrings.ExCorruptDataRecoverError(defaultFolder.ToString()), innerException2);
     }
 }
        private void VerifyFromFavoriteSendersFolderEntryId(DefaultFolderContext context)
        {
            CultureInfo   defaultFoldersCulture = context.Session.SharedDataManager.DefaultFoldersCulture;
            DefaultFolder defaultFolder         = this.DefaultFolders[54];

            if (defaultFolder == null || defaultFolder.FolderId == null)
            {
                ExTraceGlobals.DefaultFoldersTracer.TraceDebug((long)this.GetHashCode(), "DefaultFolderManager::VerifyFromFavoriteSendersFolderEntryId. MyContacts folder information or the folder id is null. Returning.");
                return;
            }
            DefaultFolder defaultFolder2 = this.DefaultFolders[63];

            if (defaultFolder2 == null || defaultFolder2.FolderId == null)
            {
                ExTraceGlobals.DefaultFoldersTracer.TraceDebug((long)this.GetHashCode(), "DefaultFolderManager::VerifyFromFavoriteSendersFolderEntryId. FromFavoriteSenders folder or the folder id is null. Returning.");
                return;
            }
            if (!defaultFolder.FolderId.Equals(defaultFolder2.FolderId))
            {
                ExTraceGlobals.DefaultFoldersTracer.TraceDebug((long)this.GetHashCode(), "DefaultFolderManager::VerifyFromFavoriteSendersFolderEntryId. FromFavoriteSenders folder id doesn't match MyContacts folder id. Returning.");
                return;
            }
            string localizableDisplayName  = DefaultFolderManager.GetLocalizableDisplayName(DefaultFolderType.MyContacts, defaultFoldersCulture);
            string localizableDisplayName2 = DefaultFolderManager.GetLocalizableDisplayName(DefaultFolderType.FromFavoriteSenders, defaultFoldersCulture);

            if (localizableDisplayName.Equals(localizableDisplayName2, StringComparison.OrdinalIgnoreCase))
            {
                ExTraceGlobals.DefaultFoldersTracer.TraceDebug <string, CultureInfo>((long)this.GetHashCode(), "DefaultFolderManager::VerifyFromFavoriteSendersFolderEntryId. FromFavoriteSenders display name matches MyContacts display name '{0}' in culture {1}. Returning.", localizableDisplayName, defaultFoldersCulture);
                return;
            }
            ExTraceGlobals.DefaultFoldersTracer.TraceDebug((long)this.GetHashCode(), "DefaultFolderManager::VerifyFromFavoriteSendersFolderEntryId. Deleting and recreating FromFavoriteSenders and MyContacts folders to fix folder id conflict.");
            defaultFolder.RemoveForRecover();
            defaultFolder2.RemoveForRecover();
            DefaultFolderType[] foldersToInit = new DefaultFolderType[]
            {
                DefaultFolderType.MyContacts,
                DefaultFolderType.FromFavoriteSenders
            };
            this.CacheDefaultFolders(context, foldersToInit);
        }
        internal bool TryFixDefaultFolderId(DefaultFolderType defaultFolderType, out StoreObjectId id)
        {
            EnumValidator.ThrowIfInvalid <DefaultFolderType>(defaultFolderType);
            DefaultFolder defaultFolder = this.GetDefaultFolder(defaultFolderType);

            try
            {
                defaultFolder.RemoveForRecover();
                defaultFolder.Create();
            }
            catch (ObjectNotFoundException)
            {
                id = null;
                return(false);
            }
            catch (NotSupportedException)
            {
                id = null;
                return(false);
            }
            return(defaultFolder.TryGetFolderId(out id));
        }
Esempio n. 4
0
 internal override void Recover(DefaultFolder defaultFolder, Exception e, ref DefaultFolderData defaultFolderData)
 {
     defaultFolder.RemoveForRecover(ref defaultFolderData);
 }