コード例 #1
0
        public void SendCommand(string command, params string[] list)
        {
            var cmd = UTF7Converter.Encode(String.Format(command, list));

            _writer.WriteLine("A" + (_prefix++).ToString() + ' ' + cmd);
            _writer.Flush();
        }
コード例 #2
0
        private string GetResponse()
        {
            string response = string.Empty;

            while (true)
            {
                string   line = UTF7Converter.Decode(_reader.ReadLine());
                string[] tags = line.Split(new char[] { ' ' });
                response += line + Environment.NewLine;
                if (tags[0].Substring(0, 1) == "A" &&
                    tags[1].Trim() == "OK" ||
                    tags[1].Trim() == "BAD" ||
                    tags[1].Trim() == "NO")
                {
                    break;
                }
            }

            return(response);
        }