Example #1
0
    public void ChangeToolBarSelected()
    {
        currentInspected = toolBar[SelectedToolbarSlot];

        Gather g = currentInspected.GetComponent <Gather>();

        if (g != null)
        {
            if (!g.beingUsed)
            {
                toolBarSelectedImage.rectTransform.position = toolBar[SelectedToolbarSlot].ToolbarImage.rectTransform.position;
                Builder.instance.StopBuild();
                if (toolBar[SelectedToolbarSlot].myItem != null && toolBar[SelectedToolbarSlot].myItem.placaBle == true)
                {
                    Builder.instance.StartBuilder(toolBar[SelectedToolbarSlot].myItem);
                }
            }
        }
        else
        {
            toolBarSelectedImage.rectTransform.position = toolBar[SelectedToolbarSlot].ToolbarImage.rectTransform.position;
            Builder.instance.StopBuild();
            if (toolBar[SelectedToolbarSlot].myItem != null && toolBar[SelectedToolbarSlot].myItem.placaBle == true)
            {
                Builder.instance.StartBuilder(toolBar[SelectedToolbarSlot].myItem);
            }
        }
    }
        public void StartGameShouldSetStatusToStarted()
        {
            //Arrange

            var game = new Gather
            {
                Status = GameStatus.Registration
            };

            var gatherRepositoryMoq = new Mock <IDeletableEntityRepository <Gather> >();

            gatherRepositoryMoq.Setup(x => x.GetByIdAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(game));

            var gatherUserRepositoryMoq = new Mock <IDeletableEntityRepository <GatherUser> >();
            var userRepository          = new Mock <IDeletableEntityRepository <User> >();

            var service = new GatherService(gatherRepositoryMoq.Object, gatherUserRepositoryMoq.Object, userRepository.Object);

            //Act
            service.StartAsync("70400fb3-aed2-4876-aa9a-bcf8ba49ca9f").GetAwaiter().GetResult();

            //Assert
            Assert.Equal(GameStatus.Started, game.Status);
        }
Example #3
0
        public void Parallele_Ausführung() {
            var multipliziere1 = new Multipliziere_mit_sich_selbst();
            var multipliziere2 = new Multipliziere_mit_sich_selbst();
            var scatter = new Scatter<double>();
            var gather = new Gather<double>();

            scatter.Output1 += multipliziere1.Process;
            scatter.Output2 += multipliziere2.Process;
            multipliziere1.Result += gather.Input1;
            multipliziere2.Result += gather.Input2;

            var waitHandle = new AutoResetEvent(false);
            IEnumerable<double> result = null;
            gather.Result += x => {
                result = x;
                waitHandle.Set();
            };

            var dauer = Stopuhr.Starten(() => {
                scatter.Process(Zahlen(10000000));
                waitHandle.WaitOne();
                result.Last();
            });

            Console.WriteLine(dauer);
        }
Example #4
0
        public void TestElementWithParams()
        {
            var elem = new Gather(
                Promoter.ListOfOne(Gather.InputEnum.Dtmf),
                new Uri("https://example.com"),
                Twilio.Http.HttpMethod.Get,
                1,
                "speech_timeout",
                1,
                true,
                "finish_on_key",
                1,
                new Uri("https://example.com"),
                Twilio.Http.HttpMethod.Get,
                Gather.LanguageEnum.AfZa,
                "hints",
                true,
                true,
                true,
                Gather.SpeechModelEnum.Default,
                true
                );

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Gather input=\"dtmf\" action=\"https://example.com\" method=\"GET\" timeout=\"1\" speechTimeout=\"speech_timeout\" maxSpeechTime=\"1\" profanityFilter=\"true\" finishOnKey=\"finish_on_key\" numDigits=\"1\" partialResultCallback=\"https://example.com\" partialResultCallbackMethod=\"GET\" language=\"af-ZA\" hints=\"hints\" bargeIn=\"true\" debug=\"true\" actionOnEmptyResult=\"true\" speechModel=\"default\" enhanced=\"true\"></Gather>",
                elem.ToString()
                );
        }
 public virtual CollisionContent MakeCollisionContent(Gather g)
 {
     //  todo: I really should find the major modes, and align the AABB to
       //  those by rotating. Then counter-rotate when collision testing.
       //  Oh, well.
       CollisionContent cc = new CollisionContent();
       cc.Bounds = g.Bounds;
       Vector3 hd = cc.Bounds.HalfDim;
       Vector3 hc = cc.Bounds.Center;
       hd.X = Math.Max(hd.X, Math.Max(hd.Y, hd.Z));
       hd.Y = hd.X;
       hd.Z = hd.X;
       cc.Bounds.Lo = hc - hd;
       cc.Bounds.Hi = hc + hd;
       cc.Triangles = g.Triangles.ToArray();
       cc.Vertices = g.Vertices.ToArray();
       List<TreeNode> TreeNodes = new List<TreeNode>();
       int[] ixs = new int[cc.Triangles.Length];
       for (int i = 0; i < ixs.Length; ++i)
     ixs[i] = i;
       BuildNodes(cc, ixs, 0, ixs.Length, TreeNodes, cc.Bounds,
     g.BoundingSpheres.ToArray());
       cc.Nodes = TreeNodes.ToArray();
       for (int i = 0; i < ixs.Length; ++i)
       {
     cc.Triangles[i] = g.Triangles[ixs[i]];
     cc.Triangles[i].CalcColl(cc);
       }
       context.Logger.LogImportantMessage("Built CollisionContent with {0} triangles, {1} vertices, {2} cells",
     cc.Triangles.Length, cc.Vertices.Length, cc.Nodes.Length);
       return cc;
 }
Example #6
0
        private async Task <JObject> GetDataObject(ISkraprWorker worker)
        {
            var result = new JObject();

            foreach (var gatherProperty in Gather.Properties())
            {
                var propertyName = gatherProperty.Name;

                bool   awaitPromise = false;
                string gatherScript = null;
                switch (gatherProperty.Value.Type)
                {
                case JTokenType.String:
                    gatherScript = gatherProperty.Value.Value <string>();
                    break;

                case JTokenType.Object:
                    //TODO: Implement this -- objects can specify additional settings.
                    throw new NotImplementedException("Objects are not yet supported.");

                default:
                    throw new InvalidOperationException($"Unknown or invalid value for gather property {propertyName}: {gatherProperty.Value.Type}");
                }

                if (String.IsNullOrWhiteSpace(gatherScript))
                {
                    throw new InvalidOperationException($"A gather script must be specified for property {propertyName}");
                }

                var fnGatherScript   = $@"(function() {{
    'use strict';
    var result = {gatherScript}
    return JSON.stringify({{ result }});
}})();";
                var evaluateResponse = await worker.Session.Runtime.Evaluate(new Runtime.EvaluateCommand
                {
                    AwaitPromise          = awaitPromise,
                    Expression            = fnGatherScript,
                    IncludeCommandLineAPI = true,
                    ContextId             = worker.DevTools.CurrentFrameContext.Id,
                    ObjectGroup           = "Skrapr"
                });

                if (evaluateResponse.Result.Subtype == "error")
                {
                    throw new InvalidOperationException($"An error occurred while evaluating script on property '{propertyName}': {evaluateResponse.Result.Description}");
                }

                var strResult = evaluateResponse.Result.Value as string;
                if (strResult == null)
                {
                    throw new InvalidOperationException($"Unable to obtain the gather result for property {propertyName}");
                }

                var objResult = JToken.Parse(strResult);
                result.Add(propertyName, objResult["result"]);
            }

            return(result);
        }
Example #7
0
        private static void Main(string[] args) {
            var scatter = new Scatter<int>();

            //scatter.Output1 += x => {
            //    foreach (var t in x) {
            //        Console.WriteLine("#1: {0}", t);
            //    }
            //};
            //scatter.Output2 += x => {
            //    foreach (var t in x) {
            //        Console.WriteLine("#2: {0}", t);
            //    }
            //};

            //scatter.Process(Values());
            //Console.ReadLine();

            var gather = new Gather<int>();
            var worker1 = new Logger<int>();
            var worker2 = new Logger<int>();
            scatter.Output1 += worker1.Process;
            worker1.Result += gather.Input1;
            scatter.Output2 += worker2.Process;
            worker2.Result += gather.Input2;
            gather.Result += x => {
                foreach (var t in x) {
                    Console.WriteLine("#0: {0}", t);
                }
            };
            scatter.Process(Values());

            Console.ReadLine();
        }
Example #8
0
        private static VoiceResponse CreateVoiceResponsePolly(BotReponse botResponse)
        {
            var voiceResponse = new VoiceResponse();

            if (botResponse.endCall)
            {
                var text = "https://feedbackbotjp.azurewebsites.net/api/Polly" + "?text=" + System.Web.HttpUtility.UrlEncode(botResponse.ResponseText);
                voiceResponse.Append(new Play(new Uri(text)));
                voiceResponse.Hangup();

                // at this point we could persist our result in a db or put on a queue
            }
            else
            {
                var input = new List <InputEnum> {
                    InputEnum.Speech
                };
                var gather = new Gather(input: input, timeout: 30, numDigits: 1, language: "en-GB", speechTimeout: "1");

                var text = "https://feedbackbotjp.azurewebsites.net/api/Polly" + "?text=" + System.Web.HttpUtility.UrlEncode(botResponse.ResponseText);
                gather.Play(new Uri(text));

                //gather.Say(botResponse.ResponseText, Say.VoiceEnum.Man, language: Say.LanguageEnum.EnGb);
                voiceResponse.Append(gather);
            }

            return(voiceResponse);
        }
        public async Task <ActionResult> AuthenticateUser(string digits, string from)
        {
            var values = new Dictionary <string, string>
            {
                { "mobileNumber", from },
                { "secretKey", digits }
            };
            HttpResponseMessage httpResponse = await _webAPIRequest.PostAsAJson("http://localhost:3000/v1/customers/authorize", values);

            var isAuthenticated = JToken.Parse(httpResponse.Content.ReadAsStringAsync().Result);
            var response        = new VoiceResponse();

            if (string.Equals("true", Convert.ToString(isAuthenticated["status"]), StringComparison.OrdinalIgnoreCase))
            {
                var gather = new Gather(action: Url.ActionUri("WalletOptions", "Menu"), numDigits: 10, maxSpeechTime: 120);
                gather.Say("Your number is" + from + " Press 1 to Check your Balance. Press 2 to transfer your wallet money");
                response.Append(gather);
            }
            else
            {
                var gather = new Gather(action: Url.ActionUri("AuthenticateUser", "Menu"), numDigits: 6, maxSpeechTime: 120);
                gather.Say("Oops, incorrect secret key. Please enter your secret key to begin the transaction");
                response.Append(gather);
            }
            return(TwiML(response));
        }
Example #10
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    Character.Dispose();
                    Fight.Dispose();
                    Gather.Dispose();
                    Inventory.Dispose();
                    Jobs.Dispose();
                    Map.Dispose();
                    Npc.Dispose();
                    Mount.Dispose();
                    Storage.Dispose();
                    Exchange.Dispose();
                    Bid.Dispose();
                }

                Character = null;
                Fight     = null;
                Gather    = null;
                Inventory = null;
                Jobs      = null;
                Map       = null;
                Npc       = null;
                Mount     = null;
                Storage   = null;
                Exchange  = null;
                Bid       = null;

                _disposedValue = true;
            }
        }
Example #11
0
        public IActionResult Index()
        {
            var voiceResponse = new VoiceResponse();

            voiceResponse.Say("您好這邊是裕融企業", VoiceEnum.Alice, null, Say.LanguageEnum.ZhTw);

            var message = $"請問您是溫家宏先生嗎 請回答是或否謝謝";

            voiceResponse.Say(message, VoiceEnum.Alice, null, Say.LanguageEnum.ZhTw);

            Gather gather = new Gather(
                numDigits: 1,
                input: new List <InputEnum> {
                InputEnum.Speech
            },
                language: Twilio.TwiML.Voice.Gather.LanguageEnum.CmnHantTw,
                hints: "是,否",
                speechTimeout: "1",
                partialResultCallback: new Uri("https://conversationtemplate.azurewebsites.net/STT"),
                partialResultCallbackMethod: HttpMethod.Post,
                action: new Uri("https://conversationtemplate.azurewebsites.net/VoiceTest/Speechmessage"),
                method: HttpMethod.Post);

            voiceResponse.Append(gather);

            voiceResponse
            .Say("這是Gather的句子", VoiceEnum.Alice, null, Say.LanguageEnum.ZhTw);

            return(TwiML(voiceResponse));
        }
        public IActionResult Index()
        {
            var    parameters = ToDictionary(this.Request.Form);
            var    response   = new VoiceResponse();
            string CallSid    = "";

            parameters.TryGetValue("CallSid", out CallSid);

            if (!String.IsNullOrWhiteSpace(CallSid))
            {
                Call call = null;
                memoryCache.TryGetValue(CallSid, out call);
                // bool isExist = memoryCache.TryGetValue(AccountSid, out call);
                if (call != null)
                {
                    var gather = new Gather(action: new Uri(Auth.UrlPath + "/api/connect/"));
                    gather.Say("Spinga un numero per accettare la chiamata da GIupiter.com", voice: "alice", language: "it-IT");
                    response.Append(gather);
                    response.Say("Grazie Arrivederci!", voice: "alice", language: "it-IT");
                    response.Hangup();
                }
                else
                {
                    response.Say("Mi spiace c'è stato un errore!", voice: "alice", language: "it-IT");
                    response.Hangup();
                }
            }
            else
            {
                response.Say("Mi spiace c'è stato un errore cache!", voice: "alice", language: "it-IT");
                response.Hangup();
            }
            return(Content(response.ToString(), "application/xml"));
        }
Example #13
0
        public bool EncodeApply(int amount, out string applyKey, out string messages)
        {
            bool succeed = false;

            applyKey = string.Empty;
            messages = string.Empty;
            string baseUrl   = inputParameters["InterfaceAddress"];
            string clientId  = inputParameters["ClientId"];
            long   timeStamp = (long)(DateTime.Now - TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1))).TotalMilliseconds;
            string sign      = Tools.AESEncode(clientId + timeStamp, inputParameters["AESKey"]);
            Gather gather    = new Gather();

            gather.Url = $@"{baseUrl}{ApplySubAddress}/clientId={clientId}/num={amount}/timeStamp={timeStamp}/sign={sign}";
            string resultHtml = gather.GetHtml();

            if (resultHtml == string.Empty)
            {
                messages = gather.TraceInfo;
            }
            else
            {
                ResultObject jsonResult = JsonConvert.DeserializeObject <ResultObject>(resultHtml);
                if (jsonResult.status == 200)
                {
                    applyKey = jsonResult.fileid;
                    succeed  = true;
                }
                else
                {
                    messages = jsonResult.msg;
                }
            }
            return(succeed);
        }
Example #14
0
        public Gatherer <T> From <TProperty>(Expression <Func <T, TProperty> > propertyFunc, Func <Gatherer <TProperty>, Gatherer <TProperty> > gatherFunc)
        {
            var property = propertyFunc.AsPropertyInfo();
            var gatherer = gatherFunc(Gather.From(propertyFunc.Get(value)));

            gatherers.Add(property, gatherer);
            return(this);
        }
Example #15
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

            _gather = new Gather();
            _gather.Run();
            //AddTemplate();
        }
Example #16
0
 public void Setup() {
     waitHandle = new AutoResetEvent(false);
     sut = new Gather<int>();
     sut.Result += x => {
         result = x;
         waitHandle.Set();
     };
 }
        public TwiMLResult Get()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: new Uri("/api/voice"), numDigits: 1, timeout: 5);

            gather.Say("Please press 1 for sales or 2 for support.");
            response.Append(gather);
            return(TwiML(response));
        }
        public TwiMLResult GetAccountDetails()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("GetEndUserMobileNo", "Menu"), finishOnKey: "#", maxSpeechTime: 120);

            gather.Say("Enter the mobile number of a person whom you want to transfer money followed by #");
            response.Append(gather);

            return(TwiML(response));
        }
        public TwiMLResult Welcome()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.Action("Show", "Menu"), numDigits: 1);

            gather.Play("http://howtodocs.s3.amazonaws.com/et-phone.mp3", loop: 3);
            response.Gather(gather);

            return(TwiML(response));
        }
Example #20
0
    static void Main()
    {
        var response = new VoiceResponse();
        var gather   = new Gather(input: "speech", action: new Uri("/completed"));

        gather.Say("Welcome to Twilio, please tell us why you're calling");
        response.Append(gather);

        Console.WriteLine(response.ToString());;
    }
        public ActionResult Incoming()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(numDigits: 1, action: "/call/enqueue", method: "POST");

            gather.Say("For Programmable SMS, press one. For Voice, press any other key.");
            response.Gather(gather);

            return(TwiML(response));
        }
        public TwiMLResult Welcome()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("AuthenticateUser", "Menu"), numDigits: 6, maxSpeechTime: 120);

            gather.Say("Please enter your secret key to begin the transaction");
            response.Append(gather);

            return(TwiML(response));
        }
Example #23
0
    static void Main()
    {
        var response = new VoiceResponse();
        var gather   = new Gather(action: "/completed", input: "speech");

        gather.Say("Welcome to Twilio, please tell us why you're calling");
        response.Gather(gather);

        System.Console.WriteLine(response.ToString());
    }
Example #24
0
    static void Main()
    {
        var response = new VoiceResponse();
        var gather   = new Gather(input: "speech dtmf", numDigits: 1, timeout: 3);

        gather.Say("Please press 1 or say sales for sales.");
        response.Gather(gather);

        System.Console.WriteLine(response.ToString());
    }
Example #25
0
        public void TestEmptyElement()
        {
            var elem = new Gather();

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Gather></Gather>",
                elem.ToString()
                );
        }
Example #26
0
        public IActionResult Speechmessage(string SpeechResult)
        {
            var response = new VoiceResponse();
            var language = Say.LanguageEnum.ZhTw;

            //_logger.LogTrace(SpeechResult);
            //_logger.LogDebug(SpeechResult);
            _logger.LogInformation("Information  是否是本人 log SpeechResult ==========================================> " + SpeechResult);
            //_logger.LogWarning(SpeechResult);
            //_logger.LogError(SpeechResult);
            //_logger.LogCritical(SpeechResult);


            //string pattern = ("是");
            //Match match = Regex.Match(SpeechResult, pattern);
            //if (match.Success)

            switch (SpeechResult)
            {
            case "是":
                response.Say("溫家宏先生您好", VoiceEnum.Alice, null, language);

                Gather gather = new Gather(
                    input: new List <InputEnum> {
                    InputEnum.Speech
                },
                    language: Twilio.TwiML.Voice.Gather.LanguageEnum.CmnHantTw,
                    hints: "是,否",
                    speechTimeout: "1",
                    partialResultCallback: new Uri("https://conversationtemplate.azurewebsites.net/STT"),
                    partialResultCallbackMethod: HttpMethod.Post,
                    action: new Uri("https://conversationtemplate.azurewebsites.net/VoiceTest/SpeechSecond"),
                    method: HttpMethod.Post).Say("請問您本期因繳款想以繳清了嗎 請回答是或否謝謝", VoiceEnum.Alice, null, language);

                response.Append(gather);

                break;

            case "否":
                response.Say("很抱歉打擾您了", VoiceEnum.Alice, null, language);
                break;

            default:
                break;
            }


            response.Say("您好,這邊是裕融企業資訊中心,您聽到的是中文音訊測試", VoiceEnum.Alice, null, language);

            //Trace.Listeners.Add(new TextWriterTraceListener("SpeechResultOutput.log", "SpeechListener"));
            //Trace.TraceInformation(SpeechResult);
            //Trace.Flush();

            return(TwiML(response));
        }
        public TwiMLResult Index()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: new Uri("http://corey.ngrok.io/action"), input: new List <Gather.InputEnum> {
                Gather.InputEnum.Speech
            });

            gather.Say("Hi. I'm looking for Corey Weathers");
            response.Append(gather);
            return(TwiML(response));
        }
Example #28
0
        private TwiMLResult Planets1()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("Interconnect", "PhoneExchange"), numDigits: 1);

            gather.Say("Connecting your to your agent now ..., please wait ",
                       voice: "alice", language: "en-GB", loop: 1);

            response.Append(gather);
            return(TwiML(response));
        }
Example #29
0
    static void Main()
    {
        var response = new VoiceResponse();
        var gather   = new Gather(action: new Uri("/process_gather.php"), method: HttpMethod.Get);

        gather.Say("Enter something, or not");
        response.Append(gather);
        response.Redirect(new Uri("/process_gather.php?Digits=TIMEOUT"), method: HttpMethod.Get);

        Console.WriteLine(response.ToString());;
    }
    static void Main()
    {
        var response = new VoiceResponse();
        var gather   = new Gather(input: new [] { Gather.InputEnum.Speech, Gather
                                                  .InputEnum.Dtmf }.ToList(), timeout: 3, numDigits: 1);

        gather.Say("Please press 1 or say sales for sales.");
        response.Append(gather);

        Console.WriteLine(response.ToString());
    }
 public GatherResource(Gather gather)
 {
     Gather = gather;
     foreach (ItemType i in Gather.Input)
     {
         Preconditions.Add(new Tuple <string, object>("HasItem", i), true);
     }
     Effects.Add(new Tuple <string, object>("HasItem", Gather.Output), true);
     Duration = Gather.Duration;
     Cost     = Gather.Duration;
 }
Example #32
0
        public TwiMLResult Welcome()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("Show", "Menu"), numDigits: 1);

            gather.Say("Thank you for calling the Office of Personnel Management," +
                       "Press 1 to create a support ticket, press 2 to connect to your support agent.");
            response.Append(gather);

            return(TwiML(response));
        }
Example #33
0
 public Profile()
 {
     Hotspots           = new List <HotSpot>();
     Blackspots         = new List <HotSpot>();
     Items              = new List <string>();
     Gatherskills       = new List <string>();
     TeleportOnComplete = new Teleport();
     TeleportOnStart    = new Teleport();
     gear   = new Gear();
     gather = new Gather();
 }
Example #34
0
    static void Main()
    {
        var response = new VoiceResponse();
        var gather   = new Gather(method: "GET", action: "/process_gather.php");

        gather.Say("Enter something, or not");
        response.Gather(gather);
        response.Redirect("/process_gather.php?Digits=TIMEOUT", method: "GET");

        System.Console.WriteLine(response.ToString());
    }
Example #35
0
        /**
         * Reply to an incoming call with a sentence and a gather
         */
        public static void letsPlayAGame()
        {
            post("/incoming/call", (request, response) => {
                string json = ControllerHelpers.getBody(request);
                BandwidthCallbackMessageVoice callbackMessageVoice = APIHelper.JsonDeserialize <BandwidthCallbackMessageVoice>(json);

                string eventType = callbackMessageVoice.EventType;

                Response bxmlResponse = new Response();

                if ("initiate".Equals(eventType))
                {
                    SpeakSentence speakSentence = new SpeakSentence();
                    speakSentence.Sentence      = "lets play a game";

                    SpeakSentence speakSentence1 = new SpeakSentence();
                    speakSentence1.Sentence      = "What is the sum of 2 plus 3.  Enter the sum followed by the pound symbol.";

                    Gather gather            = new Gather();
                    gather.TerminatingDigits = "#";
                    gather.SpeakSentence     = speakSentence1;
                    //If the destination of the gather url is on the same server, a relative URL will work too
                    //gather.GatherUrl = "/incoming/call";
                    gather.GatherUrl = host + "/incoming/call";



                    bxmlResponse.Add(speakSentence);
                    bxmlResponse.Add(gather);
                }
                else if ("gather".Equals(eventType))
                {
                    string digits = callbackMessageVoice.Digits;

                    PlayAudio playAudio;

                    if ("5".Equals(digits))
                    {
                        //Correct
                        playAudio     = new PlayAudio();
                        playAudio.Url = "https://www23.online-convert.com/dl/web2/download-file/58b6885c-7ecc-4a55-b7ed-8a849e96965e/Smartest%20man%20alive.wav";
                    }
                    else
                    {
                        //Wrong
                        playAudio     = new PlayAudio();
                        playAudio.Url = "https://www8.online-convert.com/dl/web2/download-file/1eb741cf-9c40-4166-8a63-40cf70c06348/Never%20Gonna%20Give%20You%20Up%20Original.wav";
                    }
                    bxmlResponse.Add(playAudio);
                }

                return(bxmlResponse.ToXml());
            });
        }
Example #36
0
        public void Without_correlationId()
        {
            IMessage result = null;

            var sut = new Gather<string>("x");

            sut.Implementation(new Message("x.count", 2), null, null);

            sut.Implementation(new Message("x.stream", "a"), null, null);
            sut.Implementation(new Message("x.stream", "b"), _ => result = _, null);

            Assert.That(result.Data, Is.EqualTo(new[]{"a", "b"}));
        }
 public virtual void GatherCollision(NodeContent nc, Matrix x, Gather g)
 {
     negYCount = 0;
       MeshContent mc = nc as MeshContent;
       if (mc != null)
       {
     AppendGeometry(mc, x, g);
       }
       foreach (NodeContent cld in nc.Children)
       {
     GatherCollision(cld, x * cld.Transform, g);
       }
 }
        public Eindeutige_Stichwörter_ermitteln_parallel() {
            var dateinamen_suchen = new Dateinamen_suchen();
            var alle_Stichwörter_ermitteln1 = new Alle_Stichwörter_ermitteln();
            var alle_Stichwörter_ermitteln2 = new Alle_Stichwörter_ermitteln();
            var eindeutige_Stichwörter_filtern = new Eindeutige_Stichwörter_filtern();

            var scatter = new Scatter<string>();
            var gather = new Gather<string>();

            dateinamen_suchen.Result += scatter.Process;
            scatter.Output1 += alle_Stichwörter_ermitteln1.Process;
            scatter.Output2 += alle_Stichwörter_ermitteln2.Process;
            alle_Stichwörter_ermitteln1.Result += gather.Input1;
            alle_Stichwörter_ermitteln2.Result += gather.Input2;
            gather.Result += eindeutige_Stichwörter_filtern.Process;
            eindeutige_Stichwörter_filtern.Result += x => Result(x);

            process = path_und_SearchPattern =>
                dateinamen_suchen.Process(path_und_SearchPattern);
        }
Example #39
0
        public void With_correlationId()
        {
            IMessage result = null;

            var sut = new Gather<string>("x");

            var corrId1 = Guid.NewGuid();
            var corrId2 = Guid.NewGuid();

            sut.Implementation(new Message("x.count", 2, corrId1), null, null);
            sut.Implementation(new Message("x.count", 3, corrId2), null, null);

            sut.Implementation(new Message("x.stream", "a", corrId1), null, null);
            sut.Implementation(new Message("x.stream", "x", corrId2), null, null);
            sut.Implementation(new Message("x.stream", "y", corrId2), null, null);
            sut.Implementation(new Message("x.stream", "b", corrId1), _ => result = _, null);
            Assert.That(result.Data, Is.EqualTo(new[] { "a", "b" }));

            sut.Implementation(new Message("x.stream", "z", corrId2), _ => result = _, null);
            Assert.That(result.Data, Is.EqualTo(new[] { "x", "y", "z" }));
        }
 public virtual CollisionContent ProcessCollision(NodeContent nc)
 {
     Gather g = new Gather();
       GatherCollision(nc, Matrix.Identity, g);
       if (negYCount > g.Triangles.Count / 2)
       {
     context.Logger.LogImportantMessage("{0} of {1} triangles have down-facing normals",
       negYCount, g.Triangles.Count);
       }
       return MakeCollisionContent(g);
 }
Example #41
0
            static Gather()
            {
                None = new Gather { Name = "未安装采集盒", TypeNState = 0 };

                SD = new Gather { Name = "SD", TypeNState = 1 };

                GPRS = new Gather { Name = "GPRS", TypeNState = 2 };

                Lan = new Gather { Name = "Lan", TypeNState = 3 };
            }
 void AppendGeometry(MeshContent mc, Matrix x, Gather g)
 {
     int ta = 2;
       int tb = 1;
       if (SwapWindingOrder)
       {
     ta = 1;
     tb = 2;
       }
       int vBase = g.Vertices.Count;
       bool first = (g.Bounds.Lo == Vector3.Zero && g.Bounds.Hi == Vector3.Zero);
       foreach (Vector3 v in mc.Positions)
       {
     Vector3 vt = Vector3.Transform(v, x);
     g.Vertices.Add(vt);
     if (first)
     {
       first = false;
       g.Bounds.Set(vt, vt);
     }
     g.Bounds.Include(vt);
       }
       foreach (GeometryContent gc in mc.Geometry)
       {
     for (int i = 0, n = gc.Indices.Count - 2; i < n; i += 3)
     {
       Triangle t = new Triangle();
       t.VertexA = gc.Indices[i] + vBase;
       t.VertexB = gc.Indices[i + ta] + vBase;
       t.VertexC = gc.Indices[i + tb] + vBase;
       t.Normal = Vector3.Cross(g.Vertices[t.VertexB] - g.Vertices[t.VertexA], g.Vertices[t.VertexC] - g.Vertices[t.VertexB]);
       if (t.Normal.Y < 0)
       {
     ++negYCount;
       }
       if (t.Normal.LengthSquared() > 1e-10f)
       {
     t.Normal.Normalize();
       }
       else
       {
     context.Logger.LogImportantMessage("Normal is surprisingly short: {0} for tri {1}",
       t.Normal, i / 3);
     //  set some normal; I don't really care
     if (t.Normal.X > 0)
       t.Normal = Vector3.Right;
     else if (t.Normal.X < 0)
       t.Normal = Vector3.Left;
     else if (t.Normal.Z > 0)
       t.Normal = Vector3.Backward;
     else if (t.Normal.Z < 0)
       t.Normal = Vector3.Forward;
     else if (t.Normal.Y < 0)
       t.Normal = Vector3.Down;
     else
       t.Normal = Vector3.Up;
       }
       //  Assume the center of the bounding sphere is the center of the longest edge.
       //  This is true for any triangle that is right-angled or blunt. The center will
       float la = (g.Vertices[t.VertexB] - g.Vertices[t.VertexA]).Length();
       float lb = (g.Vertices[t.VertexC] - g.Vertices[t.VertexB]).Length();
       float lc = (g.Vertices[t.VertexA] - g.Vertices[t.VertexC]).Length();
       Vector3 c;
       if (la > lb)
     if (la > lc)
       c = (g.Vertices[t.VertexB] + g.Vertices[t.VertexA]) * 0.5f;
     else
       c = (g.Vertices[t.VertexA] + g.Vertices[t.VertexC]) * 0.5f;
       else
     if (lb > lc)
       c = (g.Vertices[t.VertexC] + g.Vertices[t.VertexB]) * 0.5f;
     else
       c = (g.Vertices[t.VertexA] + g.Vertices[t.VertexC]) * 0.5f;
       t.Distance = Vector3.Dot(t.Normal, c);
       g.Triangles.Add(t);
       float r = (g.Vertices[t.VertexA] - c).Length();
       r = Math.Max(r, (g.Vertices[t.VertexB] - c).Length());
       r = Math.Max(r, (g.Vertices[t.VertexC] - c).Length());
       BoundingSphere bs = new BoundingSphere(c, r);
       //  The center is somewhere inside for a triangle that is sharp.
       //  Calculate an alternative center to get a better bounding sphere.
       if (la < lb)
     if (la < lc)
       c = (g.Vertices[t.VertexC] * 2 + g.Vertices[t.VertexB] + g.Vertices[t.VertexA]) * 0.25f;
     else
       c = (g.Vertices[t.VertexB] * 2 + g.Vertices[t.VertexC] + g.Vertices[t.VertexA]) * 0.25f;
       else
     if (lb < lc)
       c = (g.Vertices[t.VertexA] * 2 + g.Vertices[t.VertexB] + g.Vertices[t.VertexC]) * 0.25f;
     else
       c = (g.Vertices[t.VertexB] * 2 + g.Vertices[t.VertexC] + g.Vertices[t.VertexA]) * 0.25f;
       r = (g.Vertices[t.VertexA] - c).Length();
       r = Math.Max(r, (g.Vertices[t.VertexB] - c).Length());
       r = Math.Max(r, (g.Vertices[t.VertexC] - c).Length());
       if (r < bs.Radius)
       {
     bs.Center = c;
     bs.Radius = r;
       }
       g.BoundingSpheres.Add(bs);
     }
       }
 }