Beispiel #1
0
        internal static IEnumerable <StoreObjectId> GetSubfolders(IDiagnosticsSession tracer, Folder parentFolder, QueryFilter filter)
        {
            XsoUtil.< > c__DisplayClass6 CS$ < > 8__locals1 = new XsoUtil.< > c__DisplayClass6();
            CS$ < > 8__locals1.parentFolder = parentFolder;
            CS$ < > 8__locals1.filter       = filter;
            Util.ThrowOnNullArgument(CS$ < > 8__locals1.parentFolder, "parentFolder");
            Guid mailboxGuid = CS$ < > 8__locals1.parentFolder.Session.MailboxGuid;

            using (QueryResult queryResult = XsoUtil.TranslateXsoExceptionsWithReturnValue <QueryResult>(tracer, Strings.ConnectionToMailboxFailed(mailboxGuid), () => CS$ < > 8__locals1.parentFolder.FolderQuery(FolderQueryFlags.DeepTraversal, CS$ < > 8__locals1.filter, null, new PropertyDefinition[]
            {
                FolderSchema.Id
            })))
            {
                for (;;)
                {
                    object[][] folders = XsoUtil.TranslateXsoExceptionsWithReturnValue <object[][]>(tracer, Strings.ConnectionToMailboxFailed(mailboxGuid), () => queryResult.GetRows(10000));
                    if (folders == null || folders.Length == 0)
                    {
                        break;
                    }
                    foreach (object[] folderProps in folders)
                    {
                        if (folderProps[0] != null && !PropertyError.IsPropertyError(folderProps[0]))
                        {
                            yield return(StoreId.GetStoreObjectId((StoreId)folderProps[0]));
                        }
                    }
                }
            }
            yield break;
        }
Beispiel #2
0
        internal static TReturnValue TranslateXsoExceptionsWithReturnValue <TReturnValue>(IDiagnosticsSession tracer, LocalizedString errorString, XsoUtil.XsoExceptionHandlingFlags flags, Func <TReturnValue> xsoCall)
        {
            TReturnValue result = default(TReturnValue);

            XsoUtil.TranslateXsoExceptions(tracer, errorString, flags, delegate()
            {
                result = xsoCall();
            });
            return(result);
        }
            private object[][] GetRowsFromQuery(ref Folder folder, ref QueryResult result, TSort lastReturnedSortKey, int lastReturnedDocumentId)
            {
                QueryResult tempQueryResult = result;
                Folder      tempFolder      = folder;

                folder = null;
                result = null;
                object[][] result2;
                using (DisposeGuard disposeGuard = default(DisposeGuard))
                {
                    if (tempFolder == null)
                    {
                        tempFolder = XsoUtil.TranslateXsoExceptionsWithReturnValue <Folder>(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), () => Folder.Bind(this.session, this.folderId));
                        if (tempFolder == null)
                        {
                            return(CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult);
                        }
                        disposeGuard.Add <Folder>(tempFolder);
                        tempQueryResult = XsoUtil.TranslateXsoExceptionsWithReturnValue <QueryResult>(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound, () => tempFolder.ItemQuery(ItemQueryType.None, null, this.sortOrder, this.propertiesToRequest));
                        if (tempQueryResult == null)
                        {
                            return(CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult);
                        }
                        disposeGuard.Add <QueryResult>(tempQueryResult);
                        bool isSeekSuccessful = false;
                        XsoUtil.TranslateXsoExceptions(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound | XsoUtil.XsoExceptionHandlingFlags.DoNotExpectCorruptData, delegate()
                        {
                            if (this.sortProperty == ItemSchema.DocumentId)
                            {
                                tempQueryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(this.isAscending ? ComparisonOperator.GreaterThan : ComparisonOperator.LessThan, ItemSchema.DocumentId, lastReturnedSortKey), SeekToConditionFlags.None);
                            }
                            else
                            {
                                tempQueryResult.SeekToCondition(SeekReference.OriginBeginning, new OrFilter(new QueryFilter[]
                                {
                                    new AndFilter(new QueryFilter[]
                                    {
                                        new ComparisonFilter(this.isAscending ? ComparisonOperator.GreaterThanOrEqual : ComparisonOperator.LessThanOrEqual, this.sortProperty, lastReturnedSortKey),
                                        new ComparisonFilter(ComparisonOperator.GreaterThan, ItemSchema.DocumentId, lastReturnedDocumentId)
                                    }),
                                    new ComparisonFilter(this.isAscending ? ComparisonOperator.GreaterThan : ComparisonOperator.LessThan, this.sortProperty, lastReturnedSortKey)
                                }), SeekToConditionFlags.AllowExtendedFilters);
                            }
                            isSeekSuccessful = true;
                        });
                        if (!isSeekSuccessful)
                        {
                            return(CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult);
                        }
                    }
                    else
                    {
                        disposeGuard.Add <Folder>(tempFolder);
                        disposeGuard.Add <QueryResult>(tempQueryResult);
                    }
                    object[][] array = XsoUtil.TranslateXsoExceptionsWithReturnValue <object[][]>(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound | XsoUtil.XsoExceptionHandlingFlags.DoNotExpectCorruptData, () => tempQueryResult.GetRows(this.maxRowCount));
                    if (array == null)
                    {
                        result2 = CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult;
                    }
                    else
                    {
                        if (this.canCacheResult)
                        {
                            folder = tempFolder;
                            result = tempQueryResult;
                            disposeGuard.Success();
                        }
                        result2 = array;
                    }
                }
                return(result2);
            }
Beispiel #4
0
 internal static void TranslateXsoExceptions(IDiagnosticsSession tracer, LocalizedString errorString, XsoUtil.XsoExceptionHandlingFlags flags, Action xsoCall)
 {
     try
     {
         xsoCall();
     }
     catch (ConnectionFailedTransientException ex)
     {
         XsoUtil.TraceAndThrowTransientException(tracer, errorString, ex);
     }
     catch (ConnectionFailedPermanentException ex2)
     {
         XsoUtil.TraceAndThrowPermanentException(tracer, errorString, ex2);
     }
     catch (MailboxUnavailableException ex3)
     {
         XsoUtil.TraceAndThrowPermanentException(tracer, errorString, ex3);
     }
     catch (ObjectNotFoundException ex4)
     {
         if ((flags & XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound) == XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound)
         {
             tracer.SendInformationalWatsonReport(ex4, null);
             if ((flags & XsoUtil.XsoExceptionHandlingFlags.RethrowUnexpectedExceptions) == XsoUtil.XsoExceptionHandlingFlags.RethrowUnexpectedExceptions)
             {
                 XsoUtil.TraceAndThrowPermanentException(tracer, errorString, ex4);
             }
         }
         else
         {
             tracer.TraceDebug <LocalizedString, ObjectNotFoundException>("Error: {0}, exception: {1}", errorString, ex4);
         }
     }
     catch (CorruptDataException ex5)
     {
         if ((flags & XsoUtil.XsoExceptionHandlingFlags.DoNotExpectCorruptData) == XsoUtil.XsoExceptionHandlingFlags.DoNotExpectCorruptData)
         {
             tracer.SendInformationalWatsonReport(ex5, null);
             if ((flags & XsoUtil.XsoExceptionHandlingFlags.RethrowUnexpectedExceptions) == XsoUtil.XsoExceptionHandlingFlags.RethrowUnexpectedExceptions)
             {
                 XsoUtil.TraceAndThrowPermanentException(tracer, errorString, ex5);
             }
         }
         else
         {
             tracer.TraceDebug <LocalizedString, CorruptDataException>("Error: {0}, exception: {1}", errorString, ex5);
         }
     }
     catch (AccessDeniedException ex6)
     {
         tracer.SendWatsonReport(ex6);
         XsoUtil.TraceAndThrowPermanentException(tracer, errorString, ex6);
     }
     catch (StoragePermanentException ex7)
     {
         if (ex7.GetType() != typeof(StoragePermanentException))
         {
             tracer.SendInformationalWatsonReport(ex7, null);
         }
         if ((flags & XsoUtil.XsoExceptionHandlingFlags.RethrowUnexpectedExceptions) == XsoUtil.XsoExceptionHandlingFlags.RethrowUnexpectedExceptions)
         {
             XsoUtil.TraceAndThrowPermanentException(tracer, errorString, ex7);
         }
     }
     catch (StorageTransientException ex8)
     {
         if (ex8.GetType() != typeof(StorageTransientException))
         {
             tracer.SendInformationalWatsonReport(ex8, null);
         }
         if ((flags & XsoUtil.XsoExceptionHandlingFlags.RethrowUnexpectedExceptions) == XsoUtil.XsoExceptionHandlingFlags.RethrowUnexpectedExceptions)
         {
             XsoUtil.TraceAndThrowPermanentException(tracer, errorString, ex8);
         }
     }
 }
Beispiel #5
0
 internal static void TranslateXsoExceptions(IDiagnosticsSession tracer, LocalizedString errorString, Action xsoCall)
 {
     XsoUtil.TranslateXsoExceptions(tracer, errorString, XsoUtil.XsoExceptionHandlingFlags.None, xsoCall);
 }
Beispiel #6
0
 internal static TReturnValue TranslateXsoExceptionsWithReturnValue <TReturnValue>(IDiagnosticsSession tracer, LocalizedString errorString, Func <TReturnValue> xsoCall)
 {
     return(XsoUtil.TranslateXsoExceptionsWithReturnValue <TReturnValue>(tracer, errorString, XsoUtil.XsoExceptionHandlingFlags.None, xsoCall));
 }
Beispiel #7
0
        internal static string GetDefaultFolderName(MailboxSession session, StoreObjectId folderId)
        {
            DefaultFolderType defaultFolderType = session.IsDefaultFolderType(folderId);

            return(XsoUtil.GetDefaultFolderName(defaultFolderType));
        }