// Token: 0x06001CCB RID: 7371 RVA: 0x00073480 File Offset: 0x00071680
        public static void HandleRecoResult(string result, RequestParameters parameters, HttpContext httpContext, UserContext userContext, out string jsonResponse, out SpeechRecognitionProcessor.SpeechHttpStatus httpStatus)
        {
            jsonResponse = null;
            httpStatus   = SpeechRecognitionProcessor.SpeechHttpStatus.Success;
            if (string.IsNullOrEmpty(result))
            {
                return;
            }
            IMobileSpeechRecognitionResultHandler mobileSpeechRecognitionResultHandler = null;

            switch (parameters.RequestType)
            {
            case MobileSpeechRecoRequestType.FindPeople:
                mobileSpeechRecognitionResultHandler = new FindPeopleSpeechRecognitionResultHandler(parameters, userContext, httpContext);
                goto IL_95;

            case MobileSpeechRecoRequestType.CombinedScenarios:
                mobileSpeechRecognitionResultHandler = new CombinedScenarioRecognitionResultHandler(parameters, userContext, httpContext);
                goto IL_95;

            case MobileSpeechRecoRequestType.DaySearch:
                mobileSpeechRecognitionResultHandler = new DaySearchRecognitionResultHandler(parameters.TimeZone);
                goto IL_95;

            case MobileSpeechRecoRequestType.AppointmentCreation:
                mobileSpeechRecognitionResultHandler = new DateTimeandDurationRecognitionResultHandler(parameters.TimeZone);
                goto IL_95;
            }
            ExAssert.RetailAssert(false, "Invalid request type '{0}'", new object[]
            {
                parameters.RequestType
            });
IL_95:
            mobileSpeechRecognitionResultHandler.ProcessAndFormatSpeechRecognitionResults(result, out jsonResponse, out httpStatus);
        }
Exemple #2
0
        public void ProcessAndFormatSpeechRecognitionResults(string result, out string jsonResponse, out SpeechRecognitionProcessor.SpeechHttpStatus httpStatus)
        {
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>((long)this.GetHashCode(), "Entering CombinedScenariosRecognitionResultHandler.ProcessAndFormatSpeechRecognitionResults with results '{0}'", result);
            jsonResponse = null;
            httpStatus   = SpeechRecognitionProcessor.SpeechHttpStatus.Success;
            MobileSpeechRecoResultType            mobileSpeechRecoResultType           = SpeechRecognitionUtils.ParseMobileScenarioXML(result);
            IMobileSpeechRecognitionResultHandler mobileSpeechRecognitionResultHandler = null;

            switch (mobileSpeechRecoResultType)
            {
            case MobileSpeechRecoResultType.DaySearch:
                mobileSpeechRecognitionResultHandler = new DaySearchRecognitionResultHandler(this.parameters.TimeZone);
                break;

            case MobileSpeechRecoResultType.AppointmentCreation:
                mobileSpeechRecognitionResultHandler = new DateTimeandDurationRecognitionResultHandler(this.parameters.TimeZone);
                break;

            case MobileSpeechRecoResultType.FindPeople:
                mobileSpeechRecognitionResultHandler = new FindPeopleSpeechRecognitionResultHandler(this.parameters, this.userContext, this.httpContext);
                break;

            case MobileSpeechRecoResultType.EmailPeople:
                mobileSpeechRecognitionResultHandler = new EmailPeopleSpeechRecognitionResultHandler(this.parameters, this.userContext, this.httpContext);
                break;

            case MobileSpeechRecoResultType.None:
                mobileSpeechRecognitionResultHandler = null;
                break;

            default:
                ExAssert.RetailAssert(false, "Invalid result type '{0}'", new object[]
                {
                    mobileSpeechRecoResultType.ToString()
                });
                break;
            }
            string text = string.Empty;

            CombinedScenarioRecoResult[] obj;
            if (mobileSpeechRecoResultType == MobileSpeechRecoResultType.None)
            {
                obj = new CombinedScenarioRecoResult[0];
            }
            else
            {
                mobileSpeechRecognitionResultHandler.ProcessAndFormatSpeechRecognitionResults(result, out jsonResponse, out httpStatus);
                if (httpStatus != SpeechRecognitionProcessor.SpeechHttpStatus.Success)
                {
                    return;
                }
                CombinedScenarioRecoResult combinedScenarioRecoResult = new CombinedScenarioRecoResult();
                combinedScenarioRecoResult.RequestId = this.parameters.RequestId.ToString("N", CultureInfo.InvariantCulture);
                text = this.GetResultTextForLogging(result);
                combinedScenarioRecoResult.Text         = text;
                combinedScenarioRecoResult.JsonResponse = jsonResponse;
                combinedScenarioRecoResult.ResultType   = CombinedScenarioRecoResult.MapSpeechRecoResultTypeToCombinedRecoResultType(mobileSpeechRecoResultType);
                obj = new CombinedScenarioRecoResult[]
                {
                    combinedScenarioRecoResult
                };
            }
            jsonResponse = CombinedScenarioRecoResult.JsonSerialize(obj);
            this.CollectAndLogStatisticsInformation(mobileSpeechRecoResultType, text);
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>((long)this.GetHashCode(), "Return json from CombinedScenarioResult: '{0}'", jsonResponse);
        }