Exemple #1
0
        public static List <LogInfo> Beep(EngineState s, CodeCommand cmd)
        {
            List <LogInfo> logs = new List <LogInfo>();

            Debug.Assert(cmd.Info.GetType() == typeof(CodeInfo_Beep));
            CodeInfo_Beep info = cmd.Info as CodeInfo_Beep;

            switch (info.Type)
            {
            case BeepType.OK:
                SystemSounds.Beep.Play();
                break;

            case BeepType.Error:
                SystemSounds.Hand.Play();
                break;

            case BeepType.Asterisk:
                SystemSounds.Asterisk.Play();
                break;

            case BeepType.Confirmation:
                SystemSounds.Question.Play();
                break;
            }

            logs.Add(new LogInfo(LogState.Success, $"Played sound [{info.Type}]", cmd));

            return(logs);
        }
        public void Beep_Template(EngineState s, string rawCode, BeepType beepType)
        {
            CodeParser  parser = new CodeParser(EngineTests.DummySection(), Global.Setting, EngineTests.Project.Compat);
            CodeCommand cmd    = parser.ParseStatement(rawCode);

            CodeInfo_Beep info = cmd.Info.Cast <CodeInfo_Beep>();

            Assert.IsTrue(info.Type == beepType);
        }
Exemple #3
0
        public void Beep_Template(EngineState s, string rawCode, BeepType beepType)
        {
            SectionAddress addr = EngineTests.DummySectionAddress();
            CodeCommand    cmd  = CodeParser.ParseStatement(rawCode, addr);

            Debug.Assert(cmd.Info.GetType() == typeof(CodeInfo_Beep));
            CodeInfo_Beep info = cmd.Info as CodeInfo_Beep;

            Assert.IsTrue(info.Type == beepType);
        }
Exemple #4
0
        public void Beep()
        {
            void Template(string rawCode, BeepType beepType)
            {
                CodeParser  parser = new CodeParser(EngineTests.DummySection(), Global.Setting, EngineTests.Project.Compat);
                CodeCommand cmd    = parser.ParseStatement(rawCode);

                CodeInfo_Beep info = cmd.Info.Cast <CodeInfo_Beep>();

                Assert.AreEqual(beepType, info.Type);
            }

            Template("Beep,OK", BeepType.OK);
            Template("Beep,Error", BeepType.Error);
            Template("Beep,Asterisk", BeepType.Asterisk);
            Template("Beep,Confirmation", BeepType.Confirmation);
        }