Пример #1
0
        public TCommand(byte[] bytesCommand, int len)
        {
            _argList = new ArrayList();

            string strCommand = Encoding.Unicode.GetString(bytesCommand, 0, len);
            string[] list = strCommand.Split('|');

            if (list == null)
            {
                _commandStyle = CommandStyleEnum.cNone;
                return;
            }

            if (list.Length == 0)
            {
                _commandStyle = CommandStyleEnum.cNone;
                return;
            }

            for (int i = 0; i < list.Length; i++)
            {
                if (i == 0)
                {
                    try
                    {
                        int intCommandStyle = Convert.ToInt32(list[i]);
                        _commandStyle = (CommandStyleEnum)intCommandStyle;
                    }
                    catch (Exception)
                    {
                        _commandStyle = CommandStyleEnum.cNone;
                        return;
                    }
                }
                else
                {
                    _argList.Add((string)list[i]);
                }
            }
        }
Пример #2
0
 public TCommand(CommandStyleEnum style)
 {
     _commandStyle = style;
     _argList = new ArrayList();
 }