Esempio n. 1
0
        private static bool Execute_CSI_Command(CSI_COMMAND Command, DataStream <int> ParameterStream)
        {
            switch (Command)
            {
            case CSI_COMMAND.SGR:
            {
                return(Execute_SGR_Command(ParameterStream));
            }

            case CSI_COMMAND.XLOG:    /* Custom Commands */
            {
                return(Execute_XLOG_Command(ParameterStream));
            }
            }

            return(true);
        }
Esempio n. 2
0
        private static int Emulate(StringPtr Str)
        {
            int Count          = 0;
            var CompiledBlocks = Compile_Command_Blocks(Str);

            foreach (CSI_BLOCK Block in CompiledBlocks)
            {
                if (Block.CmdByte.HasValue)
                {
                    CSI_COMMAND Command         = (CSI_COMMAND)Block.CmdByte;
                    var         ParameterStream = new DataStream <int>(Block.Parameters, Int32.MinValue);

                    while (!ParameterStream.atEnd)
                    {
                        try
                        {
                            if (!Execute_CSI_Command(Command, ParameterStream))
                            {
                                throw new Exception($"Failure while emulating VirtualTerminal command @ \"{Block}\"");
                            }
                        }
                        catch (SgrError ex)
                        {
                            Debugger.Break();
                            throw ex;
                        }
                    }

                    Debug.Assert(ParameterStream.atEnd);
                }

                Console.Write(Block.Text);
                Count += Block.Text.AsMemory().Length;
            }


            return(Count);
        }