コード例 #1
0
        public static string GetStringList(string Bll, string Exc, object[] par)
        {
            ServiceReference1.FileTransportServiceClient ft = new ServiceReference1.FileTransportServiceClient();
            string strDS = string.Empty;

            try
            {
                byte[]       da = ft.GetStringList(Bll, Exc, par);
                MemoryStream ms = new MemoryStream();
                ms.Write(da, 0, da.Length);
                ms.Position = 0;
                DeflateStream ZipStream     = new DeflateStream(ms, CompressionMode.Decompress);
                MemoryStream  UnzipStream   = new MemoryStream();
                byte[]        sDecompressed = new byte[128];
                while (true)
                {
                    int bytesRead = ZipStream.Read(sDecompressed, 0, 128);
                    if (bytesRead == 0)
                    {
                        break;
                    }
                    UnzipStream.Write(sDecompressed, 0, bytesRead);
                }
                ZipStream.Close();
                ms.Close();
                UnzipStream.Position = 0;// 解压起始位置设置为头
                StreamReader sr = new StreamReader(UnzipStream);
                strDS = sr.ReadToEnd();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                ft.Close();
            }
            return(strDS);
        }