Пример #1
0
        public static string Do <T>(string Token, string CommandName, string DesServer, T ParamData)
        {
            try
            {
                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(T));
                MemoryStream stream = new MemoryStream();
                serializer.WriteObject(stream, ParamData);
                stream.Position = 0;

                StreamReader sr        = new StreamReader(stream);
                string       resultStr = sr.ReadToEnd();
                sr.Close();
                stream.Close();

                byte[] _callbytes = WcfDataCompressControl.Compress(resultStr);
                using (SinoMoniterCommand.SinoMonitorCommandClient _sc = new SinoMoniterCommand.SinoMonitorCommandClient())
                {
                    byte[] _ret = _sc.DoCommand(Token, CommandName, DesServer, _callbytes);

                    string _decodeDate = WcfDataCompressControl.UnCompress(_ret);
                    return(_decodeDate);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public static string Do(string Token, string CommandName, string DesServer, byte[] ParamData)
        {
            using (SinoMoniterCommand.SinoMonitorCommandClient _sc = new SinoMoniterCommand.SinoMonitorCommandClient())
            {
                byte[] _ret = _sc.DoCommand(Token, CommandName, DesServer, ParamData);

                string _decodeDate = WcfDataCompressControl.UnCompress(_ret);
                return(_decodeDate);
            }
        }