示例#1
0
 protected override void RunAction()
 {
     using (QueueViewerClient <ExtensibleMessageInfo> queueViewerClient = new QueueViewerClient <ExtensibleMessageInfo>((string)base.Server))
     {
         try
         {
             int num = 0;
             for (;;)
             {
                 byte[] array = queueViewerClient.ReadMessageBody(base.Identity, num, 65536);
                 if (array == null)
                 {
                     break;
                 }
                 num += array.Length;
                 BinaryFileDataObject binaryFileDataObject = new BinaryFileDataObject();
                 binaryFileDataObject.SetIdentity(base.Identity);
                 binaryFileDataObject.FileData = array;
                 base.WriteObject(binaryFileDataObject);
             }
         }
         catch (RpcException ex)
         {
             if (ex.ErrorCode == 1753 || ex.ErrorCode == 1727)
             {
                 base.WriteError(ErrorMapper.GetLocalizedException(ex.ErrorCode, null, base.Server), (ErrorCategory)1002, null);
             }
             throw;
         }
     }
 }
示例#2
0
 protected override void InternalProcessRecord()
 {
     try
     {
         int num = 10;
         while (num-- > 0)
         {
             try
             {
                 this.RunAction();
                 break;
             }
             catch (RpcException ex)
             {
                 if ((ex.ErrorCode != 1753 && ex.ErrorCode != 1727) || num == 0)
                 {
                     throw;
                 }
             }
         }
     }
     catch (QueueViewerException ex2)
     {
         base.WriteError(ErrorMapper.GetLocalizedException(ex2.ErrorCode, this.Identity, this.Server), ErrorCategory.InvalidOperation, null);
     }
     catch (RpcException ex3)
     {
         base.WriteError(ErrorMapper.GetLocalizedException(ex3.ErrorCode, null, this.Server), ErrorCategory.InvalidOperation, null);
     }
 }
示例#3
0
 protected override LocalizedException GetLocalizedException(Exception ex)
 {
     if (ex is QueueViewerException)
     {
         return(ErrorMapper.GetLocalizedException((ex as QueueViewerException).ErrorCode, null, this.Server));
     }
     if (ex is RpcException)
     {
         return(ErrorMapper.GetLocalizedException((ex as RpcException).ErrorCode, null, this.Server));
     }
     return(null);
 }
示例#4
0
        protected override void InternalProcessRecord()
        {
            ObjectType[] array      = null;
            int          totalCount = 0;
            int          num        = 0;

            try
            {
                int         num2        = 3;
                QueryFilter queryFilter = DateTimeConverter.ConvertQueryFilter(this.innerFilter);
                while (num2-- > 0)
                {
                    try
                    {
                        if (base.BookmarkObject != null)
                        {
                            ObjectType bookmarkObject = base.BookmarkObject;
                            bookmarkObject.ConvertDatesToUniversalTime();
                        }
                        QueueViewerInputObject queueViewerInputObject = new QueueViewerInputObject((base.BookmarkIndex <= 0) ? -1 : (base.BookmarkIndex - 1), base.BookmarkObject, base.IncludeBookmark, this.IncludeLatencyInfo.IsPresent, this.IncludeDetails.IsPresent, base.ResultSize.IsUnlimited ? int.MaxValue : base.ResultSize.Value, queryFilter, base.SearchForward, base.SortOrder);
                        using (QueueViewerClient <ObjectType> queueViewerClient = new QueueViewerClient <ObjectType>((string)this.Server))
                        {
                            if (!VersionedQueueViewerClient.UsePropertyBagBasedAPI(this.targetServer))
                            {
                                PagedDataObject bookmarkObject2 = null;
                                if (typeof(ObjectType) == typeof(ExtensibleQueueInfo))
                                {
                                    if (base.Filter != null)
                                    {
                                        this.innerFilter = new MonadFilter(base.Filter, this, ObjectSchema.GetInstance <QueueInfoSchema>()).InnerFilter;
                                    }
                                    this.InitializeInnerFilter <QueueInfo>(null, QueueInfoSchema.Identity);
                                    if (base.BookmarkObject != null)
                                    {
                                        bookmarkObject2 = new QueueInfo(base.BookmarkObject as ExtensibleQueueInfo);
                                    }
                                }
                                else
                                {
                                    if (base.Filter != null)
                                    {
                                        this.innerFilter = new MonadFilter(base.Filter, this, ObjectSchema.GetInstance <MessageInfoSchema>()).InnerFilter;
                                    }
                                    this.InitializeInnerFilter <MessageInfo>(MessageInfoSchema.Identity, MessageInfoSchema.Queue);
                                    if (base.BookmarkObject != null)
                                    {
                                        bookmarkObject2 = new MessageInfo(base.BookmarkObject as ExtensibleMessageInfo);
                                    }
                                }
                                queueViewerInputObject.QueryFilter = this.innerFilter;
                                List <SortOrderEntry> list = null;
                                if (queueViewerInputObject.SortOrder != null)
                                {
                                    list = new List <SortOrderEntry>();
                                    foreach (QueueViewerSortOrderEntry queueViewerSortOrderEntry in queueViewerInputObject.SortOrder)
                                    {
                                        list.Add(SortOrderEntry.Parse(queueViewerSortOrderEntry.ToString()));
                                    }
                                }
                                array = queueViewerClient.GetQueueViewerObjectPage(queueViewerInputObject.QueryFilter, (queueViewerInputObject.SortOrder != null) ? list.ToArray() : null, queueViewerInputObject.SearchForward, queueViewerInputObject.PageSize, bookmarkObject2, queueViewerInputObject.BookmarkIndex, queueViewerInputObject.IncludeBookmark, queueViewerInputObject.IncludeDetails, queueViewerInputObject.IncludeComponentLatencyInfo, ref totalCount, ref num);
                            }
                            else if (VersionedQueueViewerClient.UseCustomSerialization(this.targetServer))
                            {
                                array = queueViewerClient.GetPropertyBagBasedQueueViewerObjectPageCustomSerialization(queueViewerInputObject, ref totalCount, ref num);
                            }
                            else
                            {
                                array = queueViewerClient.GetPropertyBagBasedQueueViewerObjectPage(queueViewerInputObject, ref totalCount, ref num);
                            }
                            break;
                        }
                    }
                    catch (RpcException ex)
                    {
                        if ((ex.ErrorCode != 1753 && ex.ErrorCode != 1727) || num2 == 0)
                        {
                            throw;
                        }
                    }
                }
                if (base.ReturnPageInfo)
                {
                    base.WriteObject(new PagedPositionInfo(num + 1, totalCount));
                }
                DateTimeConverter.ConvertResultSet <ObjectType>(array);
                foreach (ObjectType dataObject in array)
                {
                    base.WriteResult(dataObject);
                }
            }
            catch (ParsingNonFilterablePropertyException ex2)
            {
                base.WriteError(ex2, ErrorCategory.InvalidArgument, ex2.PropertyName);
            }
            catch (QueueViewerException ex3)
            {
                base.WriteError(ErrorMapper.GetLocalizedException(ex3.ErrorCode, null, this.Server), ErrorCategory.InvalidOperation, null);
            }
            catch (RpcException ex4)
            {
                base.WriteError(ErrorMapper.GetLocalizedException(ex4.ErrorCode, null, this.Server), ErrorCategory.InvalidOperation, null);
            }
        }
示例#5
0
        public static LocalizedException GetLocalizedException(int errorCode, ObjectId identity, ServerIdParameter server)
        {
            if (errorCode == QVErrorCode.QV_E_OBJECT_NOT_FOUND)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.ObjectNotFound(ErrorMapper.GetIdentityString(identity))));
            }
            if (errorCode == QVErrorCode.QV_E_MULTIPLE_IDENTITY_MATCH)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.MultipleIdentityMatch(ErrorMapper.GetIdentityString(identity))));
            }
            if (errorCode == QVErrorCode.QV_E_INVALID_OPERATION)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.InvalidOperation(ErrorMapper.GetIdentityString(identity))));
            }
            if (errorCode == QVErrorCode.QV_E_INCOMPLETE_IDENTITY)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.IncompleteIdentity(ErrorMapper.GetIdentityString(identity))));
            }
            if (errorCode == QVErrorCode.QV_E_MESSAGE_NOT_SUSPENDED)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.MessageNotSuspended(ErrorMapper.GetIdentityString(identity))));
            }
            if (errorCode == QVErrorCode.QV_E_INVALID_IDENTITY_FOR_EQUALITY)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.InvalidIdentityForEquality));
            }
            if (errorCode == QVErrorCode.QV_E_AMBIGUOUS_PARAMETER_SET)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.AmbiguousParameterSet));
            }
            if (errorCode == QVErrorCode.QV_E_FILTER_TYPE_NOT_SUPPORTED)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.FilterTypeNotSupported));
            }
            if (errorCode == QVErrorCode.QV_E_TEXT_MATCHING_NOT_SUPPORTED)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.TextMatchingNotSupported));
            }
            if (errorCode == QVErrorCode.QV_E_INVALID_FIELD_NAME)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.InvalidFieldName));
            }
            if (errorCode == QVErrorCode.QV_E_TOO_MANY_RESULTS)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.TooManyResults));
            }
            if (errorCode == QVErrorCode.QV_E_INVALID_IDENTITY_STRING)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.InvalidIdentityString));
            }
            if (errorCode == QVErrorCode.QV_E_COMPARISON_NOT_SUPPORTED)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.ComparisonNotSupported));
            }
            if (errorCode == QVErrorCode.QV_E_RPC_SERVER_UNAVAILABLE)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.RpcUnavailable((string)server)));
            }
            if (errorCode == QVErrorCode.QV_E_ENDPOINT_NOT_REGISTERED || errorCode == QVErrorCode.QV_E_UNKNOWN_INTERFACE)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.RpcNotRegistered((string)server)));
            }
            if (errorCode == QVErrorCode.QV_E_INVALID_CLIENT_DATA)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.InvalidClientData));
            }
            if (errorCode == QVErrorCode.QV_E_INVALID_SERVER_DATA)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.InvalidServerData));
            }
            if (errorCode == QVErrorCode.QV_E_INVALID_SERVER_VERSION)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.InvalidServerVersion));
            }
            if (errorCode == QVErrorCode.QV_E_INVALID_SERVER_COLLECTION)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.InvalidServerCollection));
            }
            if (errorCode == QVErrorCode.QV_E_QUEUE_RESUBMIT_IN_PROGRESS)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.QueueResubmitInProgress));
            }
            if (errorCode == QVErrorCode.QV_E_REDIRECT_MESSAGE_IN_PROGRESS)
            {
                return(ErrorMapper.NewLocalizedException(errorCode, QueueViewerStrings.RedirectMessageInProgress));
            }
            Win32Exception ex = new Win32Exception(errorCode);

            return(new LocalizedException(QueueViewerStrings.GenericRpcError(ex.Message, (string)server), ex));
        }
示例#6
0
 private Exception GetDefaultException(RpcException ex)
 {
     return(ErrorMapper.GetLocalizedException(ex.ErrorCode, null, null));
 }