Example #1
0
        private void DealwithCmd()
        {
            string s = GetCommandLine().Trim();

            if (s != "")
            {
                if (s.ToUpper().StartsWith("PRINT"))
                {
                    string[] splits = Regex.Split(s, @"\s{1,}");
                    if (splits.Length != 3)
                    {
                        throw new Exception("PRINT格式不对");
                    }
                    Packet c = new PrintPacket(splits[1], splits[2], CmdCB);
                    c.EcChannel = ec;
                    c.Send();
                }
                else
                {
                    CmdPacket c = new CmdPacket(s, CmdCB);
                    c.EcChannel = ec;
                    c.Send();
                }
            }
            else
            {
                richTextBox1.Text += "\r\n" + "请检查命令格式!";
                richTextBox1.Text += "\r\n" + (char)9632;
            }
        }
Example #2
0
 private void DealwithCmd()
 {
     string s = GetCommandLine().Trim();
     if (s != "")
     {
         if (s.ToUpper().StartsWith("PRINT"))
         {
             string[] splits=Regex.Split(s,@"\s{1,}");
             if (splits.Length != 3) { throw new Exception("PRINT格式不对"); }
             Packet c = new PrintPacket(splits[1], splits[2], CmdCB);
             c.EcChannel = ec;
             c.Send();
         }
         else
         {
             CmdPacket c = new CmdPacket(s, CmdCB);
             c.EcChannel = ec;
             c.Send();
         }
     }
     else
     {
         richTextBox1.Text += "\r\n" + "请检查命令格式!";
         richTextBox1.Text += "\r\n" + (char)9632;
     }
 }