コード例 #1
0
ファイル: CmdProtocol.cs プロジェクト: BillyWu/Granitypark
        /// <summary>
        /// 按照指定格式格式化响应结果
        /// </summary>
        /// <param name="response">响应数据字符串</param>
        /// <returns>返回格式化后的字符串</returns>
        private string FormatResponse(byte[] response)
        {
            if (null == response || response.Length < 1)
            {
                return("");
            }
            string info = CommandBase.Parse(response, !IsAscii);

            //恢复转义字符
            if (Exchanges != "")
            {
                string[] strExs = Exchanges.Split('#');
                for (int i = 0; i < strExs.Length; i++)
                {
                    string[] _a = strExs[i].Split('/');
                    info = comparse.SpecialRestore(info, _a[1], _a[0]);
                }
            }
            string state = "";

            if (info.StartsWith("") && info.EndsWith(""))
            {
                info = info.Replace("", "02").Replace("", "03");
            }
            return(comparse.AnalysisEateryResults(info, this.outterParam, dvParam, false, ref state));
        }
コード例 #2
0
        /// <summary>
        /// 按照指定格式格式化响应结果
        /// </summary>
        /// <param name="response">响应数据字符串</param>
        /// <returns>返回格式化后的字符串</returns>
        public string FormatResponse(byte[] response)
        {
            if (null == response || response.Length < 1)
            {
                return("");
            }
            string info = CommandBase.Parse(response, !IsAscii);

            //恢复转义字符
            if (!string.IsNullOrEmpty(Exchanges))
            {
                string[] strExs = Exchanges.Split('#');
                for (int i = 0; i < strExs.Length; i++)
                {
                    string[] _a = strExs[i].Split('/');
                    info = comparse.SpecialRestore(info, _a[1], _a[0]);
                }
            }
            string state = "";

            if (info.StartsWith("") && info.EndsWith(""))
            {
                info = info.Replace("", "02").Replace("", "03");
            }
            try
            {
                info = comparse.AnalysisEateryResults(info, this.outterParam, this.dvParam, false, ref state);
            }
            catch
            {
                info = "@{状态}=响应解析错误,@Success=false";
            }
            return(info);
        }