// Token: 0x06000227 RID: 551 RVA: 0x00008860 File Offset: 0x00006A60
        public static bool IsWacActiveMonitoringRequest(HttpRequest request, HttpResponse response)
        {
            if (string.Equals(request.QueryString["owaatt"], "Exch_WopiTest", StringComparison.InvariantCultureIgnoreCase))
            {
                switch (WacRequest.GetRequestType(request))
                {
                case WacRequestType.CheckFile:
                {
                    DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(WacCheckFileResponse));
                    using (MemoryStream memoryStream = new MemoryStream())
                    {
                        dataContractJsonSerializer.WriteObject(memoryStream, WacActiveMonitoringHandler.DefaultCheckFileResponse());
                        memoryStream.Position = 0L;
                        response.OutputStream.Write(memoryStream.GetBuffer(), 0, (int)memoryStream.Length);
                        return(true);
                    }
                    break;
                }

                case WacRequestType.GetFile:
                    break;

                default:
                    return(false);
                }
                using (MemoryStream memoryStream2 = new MemoryStream(WacActiveMonitoringHandler.fileContentBytes))
                {
                    WacUtilities.WriteStreamBody(response, memoryStream2);
                    return(true);
                }
                return(false);
            }
            return(false);
        }
 // Token: 0x06000228 RID: 552 RVA: 0x00008938 File Offset: 0x00006B38
 private static WacCheckFileResponse DefaultCheckFileResponse()
 {
     WacActiveMonitoringHandler.Initialize();
     return(WacActiveMonitoringHandler.defaultMonitoringResponse);
 }
        void IHttpHandler.ProcessRequest(HttpContext context)
        {
            RequestDetailsLogger logger = OwaApplication.GetRequestDetailsLogger;
            string text = context.Request.QueryString["UserEmail"];

            logger.ActivityScope.SetProperty(OwaServerLogger.LoggerData.PrimarySmtpAddress, text);
            WacUtilities.SetEventId(logger, "WAC.BadRequest");
            context.Response.TrySkipIisCustomErrors = true;
            try
            {
                if (WacActiveMonitoringHandler.IsWacActiveMonitoringRequest(context.Request, context.Response))
                {
                    WacUtilities.SetEventId(logger, "WAC.ActiveMonitoring");
                }
                else
                {
                    WacRequest wacRequest = WacRequest.ParseWacRequest(text, context.Request);
                    WacRequestHandler.SetCommonResponseHeaders(wacRequest, context.Response);
                    string text2 = wacRequest.GetElapsedTime().TotalHours.ToString("0.00");
                    logger.ActivityScope.SetProperty(WacRequestHandlerMetadata.SessionElapsedTime, text2);
                    if (wacRequest.IsExpired())
                    {
                        throw new OwaInvalidRequestException(string.Concat(new object[]
                        {
                            "Can't process ",
                            wacRequest.RequestType,
                            " request because the Url has expired. Hours since start: ",
                            text2
                        }));
                    }
                    logger.Set(WacRequestHandlerMetadata.ExchangeSessionId, wacRequest.ExchangeSessionId);
                    switch (wacRequest.RequestType)
                    {
                    case WacRequestType.CheckFile:
                        WacUtilities.SetEventId(logger, "WAC.CheckFile");
                        WacRequestHandler.ProcessCheckFileRequest(context, wacRequest, logger);
                        goto IL_28B;

                    case WacRequestType.GetFile:
                        WacUtilities.SetEventId(logger, "WAC.GetFile");
                        WacRequestHandler.ProcessGetFileRequest(context, wacRequest, logger);
                        goto IL_28B;

                    case WacRequestType.Lock:
                        WacUtilities.SetEventId(logger, "WAC.Lock");
                        WacRequestHandler.IncrementLockCount(wacRequest);
                        goto IL_28B;

                    case WacRequestType.UnLock:
                        WacUtilities.SetEventId(logger, "WAC.Unlock");
                        WacRequestHandler.DecrementLockCount(wacRequest);
                        goto IL_28B;

                    case WacRequestType.RefreshLock:
                        WacUtilities.SetEventId(logger, "WAC.RefreshLock");
                        goto IL_28B;

                    case WacRequestType.PutFile:
                        WacUtilities.SetEventId(logger, "WAC.PutFile");
                        WacRequestHandler.ReplaceAttachmentContent(context.Request.InputStream, wacRequest);
                        goto IL_28B;

                    case WacRequestType.Cobalt:
                        WacUtilities.SetEventId(logger, "WAC.Cobalt");
                        WacRequestHandler.ProcessCobaltRequest(context, wacRequest, delegate(Enum key, string value)
                        {
                            logger.ActivityScope.SetProperty(key, value);
                        });
                        goto IL_28B;

                    case WacRequestType.DeleteFile:
                        WacUtilities.SetEventId(logger, "WAC.DeleteFile");
                        throw new OwaInvalidRequestException("Exchange does not support WAC's DeleteFile operation.");
                    }
                    WacUtilities.SetEventId(logger, "WAC.Unknown");
                    throw new OwaInvalidRequestException("Invalid request type");
                    IL_28B :;
                }
            }
            catch (Exception ex)
            {
                logger.ActivityScope.SetProperty(ServiceCommonMetadata.GenericErrors, ex.ToString());
                logger.ActivityScope.SetProperty(WacRequestHandlerMetadata.RequestUrl, context.Request.Url.ToString());
                logger.ActivityScope.SetProperty(WacRequestHandlerMetadata.UserAgent, context.Request.UserAgent);
                context.Response.Headers["X-WOPI-ServerError"] = ex.ToString();
                if (ex is OwaInvalidRequestException || ex is OwaOperationNotSupportedException || ex is OverBudgetException)
                {
                    context.Response.StatusCode = 404;
                }
                else
                {
                    context.Response.StatusCode = 500;
                }
            }
            finally
            {
                logger.ActivityScope.SetProperty(WacRequestHandlerMetadata.WopiServerName, context.Request.Headers["X-WOPI-ServerVersion"]);
                logger.ActivityScope.SetProperty(WacRequestHandlerMetadata.WopiClientVersion, context.Request.Headers["X-WOPI-InterfaceVersion"]);
                logger.ActivityScope.SetProperty(WacRequestHandlerMetadata.WopiCorrelationId, context.Request.Headers["X-WOPI-CorrelationID"]);
            }
        }