예제 #1
0
        public override void ExecuteResult(HttpContext context)
        {
            LibViewModel viewModel = LibViewModel.CreateSuccessJSONResponseViewModel();

            viewModel.ResultData = this._data;

            ExceptionHelper.TrueThrow <ArgumentNullException>(context == null, "context is null!");
            HttpResponse response = context.Response;

            response.ContentType     = _contentType;
            response.ContentEncoding = _contentEncoding;

            //var json = JsonHelper.Serialize(viewModel);
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(viewModel);

            if (context.Request.Headers["UseGZip"] == ((int)UseGZip.ReturnData).ToString() || context.Request.Headers["UseGZip"] == ((int)UseGZip.Both).ToString())
            {
                DateTime start  = DateTime.Now;
                var      base64 = GZipHelper.Compress(json);
                DateTime end    = DateTime.Now;
                TimeSpan span   = end - start;
                response.Headers.Add("GZip-Time", span.TotalMilliseconds.ToString());
                response.Write(base64);
            }
            else
            {
                response.Write(json);
            }

            HttpContext.Current.ApplicationInstance.CompleteRequest();
            // response.End();
        }
예제 #2
0
    /// <summary>
    /// Saves user data to Unity's PlayerPrefs
    /// </summary>
    public void Save(bool isExitSave = false)
    {
        StandaloneSavedData sData = new StandaloneSavedData();

        sData.SettingsVersion    = SettingsVersion;
        sData.Users              = Users;
        sData.CurrentUser        = User.Name;
        sData.AvatarId           = User.AvatarId;
        sData.CurrentLevelNumber = User.CurrentLevelNumber;
        sData.LevelsCompleted    = User.LevelsCompleted;

        // options
        sData.MusicVolume            = User.MusicVolume;
        sData.SoundVolume            = User.SoundVolume;
        sData.LastTrack              = User.LastTrack;
        sData.DontShowExitGameWindow = User.DontShowExitGameWindow;
        sData.Alarms = User.Alarms;

        string json = GZipHelper.Compress(JsonUtility.ToJson(sData));

        PlayerPrefs.SetString(Consts.APP_SHORTNAME, json);
        Debug.Log("SETTINGS: Saving to local device.");
        PlayerPrefs.SetInt("SettingsVersion", SettingsVersion);
        PlayerPrefs.Save();
    }
예제 #3
0
        public override void SendAsync(byte[] data, int offset, int lenght)
        {
            if (this.Socket == null)
            {
                return;
            }

            byte[] buffer = this._isCompress
                ? this.BuilderPack(GZipHelper.Compress(data, offset, lenght))
                : this.BuilderPack(data, offset, lenght);

            var awaiter = HandlerSaeaPool.Take();

            awaiter.Saea.SetBuffer(buffer, 0, buffer.Length);

            Interlocked.Increment(ref _intervalIsUseChannel);
            SaeaExHelper.SendAsync(this.Socket, awaiter, (a, e) =>
            {
                Interlocked.Decrement(ref _intervalIsUseChannel);

                this.HandlerSaeaPool.Return(awaiter);
                this.SendTransferredBytes = a.Saea.Buffer.Length;
                this.NotifyEventHandler?.Invoke(TcpSocketCompletionNotify.OnSend, this);
            });
        }
        protected virtual SearchCondition ExtraQuery()
        {
            SearchCondition con   = null;
            var             query = HttpContext.Request.Query["q"];

            if (!string.IsNullOrEmpty(query))
            {
                var logger = _ILoggerFactory.CreateLogger(this.GetType().FullName);
                logger.LogInformation("准备解析查询字符串内容 q={query}", query);
                var temp = GZipHelper.DecompressString(query);
                var s    = JsonConvert.DeserializeObject <SearchConditionWrap>(temp);
                if (!string.IsNullOrEmpty(s.SearchType))
                {
                    var t = TypeHelper.GetTypeOfName("LJH.RegionMonitor.Model", s.SearchType);
                    if (t != null)
                    {
                        con = JsonConvert.DeserializeObject(s.Search, t) as SearchCondition;
                        logger.LogInformation("解析查询字符串内容 type={type} con={con}", s.SearchType, con == null ? "null" : Newtonsoft.Json.JsonConvert.SerializeObject(con));
                    }
                    else
                    {
                        logger.LogWarning("解析查询字符串失败");
                    }
                }
                else
                {
                    logger.LogWarning("解析查询字符串失败");
                }
            }
            return(con);
        }
예제 #5
0
    /// <summary>
    /// Loads user data from Unity's PlayerPrefs
    /// </summary>
    public void Load()
    {
        Debug.Log("SETTINGS: Start Loading");

        if (PlayerPrefs.HasKey(Consts.APP_SHORTNAME))
        {
            Debug.Log("SETTINGS: Loading from local device...");
            string rawStringBinaryData = PlayerPrefs.GetString(Consts.APP_SHORTNAME);
            StandaloneSavedData standaloneSavedData = null;
            try
            {
                string decompressedJSON = GZipHelper.Decompress(rawStringBinaryData);
                standaloneSavedData = JsonUtility.FromJson <StandaloneSavedData>(decompressedJSON);
            }
            catch (Exception ex)
            {
                Debug.Log("SETTING: Error parsing local saved settings object.\n" + ex.Message);
            }
            LoadSettingsFromSavedData(standaloneSavedData);
        }
        else
        {
            Debug.Log("SETTINGS: No saved settings found. Creating new settings.");
            ResetSettings();
            Save();
            Load();
        }
    }
        private void OnBinaryMessageReceived(WebSocket webSocket, byte[] buffer)
        {
            Debug.Log("Binary Message received from server. Length: " + buffer.Length);
            labelMessage.text = "Length:" + buffer.Length;
            SocketResponse socketResponse;

            try
            {
                buffer         = GZipHelper.Decompress(DESHelper.DecodeBytes(buffer, AppContext.GetInstance().getDesKey()));
                socketResponse = Serializer.Deserialize <SocketResponse>(new MemoryStream(buffer));
            }
            catch (Exception)
            {
                Debug.LogError("SocketResponse parse error");
                ShowMessage(ErrorCode.EC_PARSE_DATA_ERROR);
                DataHelper.GetInstance().CleanProfile(dbManager);
                return;
            }

            if (socketResponse != null)
            {
                String code = socketResponse.p1;
                if (!"0".Equals(code))
                {
                    ShowMessage(code);
                }
                else
                {
                    HandleSocketResponse(socketResponse);
                }
            }
        }
예제 #7
0
        /// <summary>
        /// 生成控制器
        /// </summary>
        /// <param name="table">表名</param>
        /// <returns></returns>
        public string GetCodeBuilderController(string table)
        {
            StringBuilder sbController = new StringBuilder();

            sbController.Append("using AnJie.ERP.Business;\r\n");
            sbController.Append("using AnJie.ERP.Entity;\r\n");
            sbController.Append("using AnJie.ERP.Utilities;\r\n");
            sbController.Append("using System;\r\n");
            sbController.Append("using System.Collections;\r\n");
            sbController.Append("using System.Collections.Generic;\r\n");
            sbController.Append("using System.Data;\r\n");
            sbController.Append("using System.Linq;\r\n");
            sbController.Append("using System.Web;\r\n");
            sbController.Append("using System.Web.Mvc;\r\n\r\n");

            sbController.Append("namespace AnJie.ERP.WebApp.Areas." + AreasName + ".Controllers\r\n");
            sbController.Append("{\r\n");

            sbController.Append("    /// <summary>\r\n");
            sbController.Append("    /// " + ClassName + "控制器\r\n");
            sbController.Append("    /// </summary>\r\n");
            sbController.Append("    public class " + ControllerName + " : PublicController<" + EntityName + ">\r\n");
            sbController.Append("    {\r\n");
            sbController.Append("    }\r\n");
            sbController.Append("}");
            WriteCodeBuilder(table + "\\" + ControllerName + ".cs", sbController.ToString());

            string strFilePath = "~/CodeMatic/" + table;
            string strZipPath  = "~/CodeMatic/" + table + ".zip";

            GZipHelper.ZipFile(strFilePath, strZipPath);
            DirFileHelper.DeleteDirectory("~/CodeMatic/" + table);
            return(sbController.ToString());
        }
예제 #8
0
        public void TestZipUnzipSucceeds()
        {
            //// ARRANGE

            var source = new byte[992];

            for (int i = 0; i < source.Length; i++)
            {
                source[i] = 42;
            }

            //// ACT

            var zippedSource = GZipHelper.Zip(source);

            Assert.AreEqual(29, zippedSource.Length);

            var unzipped = GZipHelper.Unzip(zippedSource);

            //// ASSERT

            Assert.AreEqual(992, unzipped.Length);

            for (int i = 0; i < 992; i++)
            {
                Assert.AreEqual(source[i], unzipped[i]);
            }
        }
예제 #9
0
        protected FileContentResult ProcesarArchivo(Archivo archivo)
        {
            byte[] contenido = null;
            if (archivo.Contenido != null)
            {
                contenido = GZipHelper.Decompress(Convert.FromBase64String(archivo.Contenido));
                if (archivo.TipoMime.Contains("text/", StringComparison.OrdinalIgnoreCase))
                {
                    contenido = EncodingHelper.ConvertToUTF8(contenido, _configuration["OracleConfiguration:CharacterSet"]);
                }
            }
            else if (archivo.Url != null)
            {
                using (var webClient = new WebClient())
                {
                    contenido = webClient.DownloadData(archivo.Url);
                }
            }

            if (archivo.Extension.Equals(RiskConstants.FORMATO_HTML, StringComparison.OrdinalIgnoreCase) &&
                HtmlHelper.ObtenerMetaContent(contenido, RiskConstants.META_FORMAT).Equals(RiskConstants.FORMATO_PDF, StringComparison.OrdinalIgnoreCase))
            {
                contenido         = PdfHelper.ConvertToPdf(contenido);
                archivo.Extension = RiskConstants.FORMATO_PDF.ToLower();
                archivo.TipoMime  = MediaTypeNames.Application.Pdf;
            }

            return(File(contenido, archivo.TipoMime, string.Concat(archivo.Nombre, ".", archivo.Extension)));
        }
예제 #10
0
파일: NetClient.cs 프로젝트: iwy81/JMS
        public unsafe void WriteServiceData(byte[] data)
        {
            //第一位表示gzip,第二位表示keepclient
            int flag = 0;

            if (data.Length > CompressionMinSize)
            {
                data = GZipHelper.Compress(data);
                flag = 1;
            }

            if (KeepAlive)
            {
                flag |= 2;
            }

            byte[] tosend = new byte[data.Length + 4];
            flag |= (data.Length << 2);

            fixed(byte *ptrData = data)
            {
                Marshal.Copy(new IntPtr(ptrData), tosend, 4, data.Length);
            }

            byte *ptr = (byte *)&flag;

            Marshal.Copy(new IntPtr(ptr), tosend, 0, 4);

            this.Write(tosend);
        }
 public void SetDeriveExcel(string JsonColumn, string JsonData, string JsonFooter, string FileName)
 {
     CookieHelper.WriteCookie("JsonColumn_DeriveExcel", GZipHelper.Compress(JsonColumn));
     CookieHelper.WriteCookie("JsonData_DeriveExcel", GZipHelper.Compress(JsonData));
     CookieHelper.WriteCookie("JsonFooter_DeriveExcel", GZipHelper.Compress(JsonFooter));
     CookieHelper.WriteCookie("FileName_DeriveExcel", GZipHelper.Compress(FileName));
 }
예제 #12
0
        protected Archivo ProcesarArchivo(GuardarArchivoRequestBody requestBody)
        {
            string contenido = string.Empty;
            string url       = string.Empty;

            if (requestBody.Archivo != null)
            {
                if (requestBody.Archivo.Length > 0)
                {
                    using (var ms = new MemoryStream())
                    {
                        requestBody.Archivo.CopyTo(ms);
                        contenido = Convert.ToBase64String(GZipHelper.Compress(ms.ToArray()));
                    }
                }
            }
            else if (requestBody.Url != null)
            {
                url = requestBody.Url;
            }


            return(new Archivo
            {
                Contenido = contenido,
                Url = url,
                Nombre = requestBody.Nombre,
                Extension = requestBody.Extension
            });
        }
예제 #13
0
파일: NetClient.cs 프로젝트: iwy81/JMS
        public byte[] ReadServiceDataBytes()
        {
            try
            {
                var flag = this.ReadInt();
                if (flag == 1179010630)
                {
                    return(new byte[0]);
                }

                var isgzip = (flag & 1) == 1;
                this.KeepAlive = (flag & 2) == 2;
                var len   = flag >> 2;
                var datas = this.ReceiveDatas(len);
                if (isgzip)
                {
                    datas = GZipHelper.Decompress(datas);
                }
                return(datas);
            }
            catch (System.IO.IOException ex)
            {
                if (ex.InnerException is SocketException)
                {
                    throw ex.InnerException;
                }
                throw ex;
            }
        }
예제 #14
0
        /// <summary>
        /// 发送数据并接收服务端返回的数据。
        /// 注:只有压缩请求数据包和解压请求返回的数据包
        /// </summary>
        /// <param name="originalDataBytes"></param>
        /// <returns></returns>
        public byte[] SendData(byte[] originalDataBytes)
        {
            var compressData = GZipHelper.GetCompressedDataBytes(originalDataBytes);
            var request      = this.CreateHttpWebRequest(compressData.Length);

            using (var requestStream = request.GetRequestStream())
            {
                requestStream.Write(compressData, 0, compressData.Length);
            }

            HttpWebResponse response;

            try
            {
                response = request.GetResponse() as HttpWebResponse;
            }
            catch (WebException exception)
            {
                response = exception.Response as HttpWebResponse;
            }
            var responseData   = this.ReadData(response);
            var decompressData = GZipHelper.GetDeCompressedDataBytes(responseData);

            return(decompressData);
        }
예제 #15
0
    private bool Decompress(byte[] data)
    {
        for (int i = 0; i < _response.fileDesc.Count; ++i)
        {
            SlgPB.FileDesc desc = _response.fileDesc[i];

            MemoryStream stream = new MemoryStream();
            stream.Write(data, desc.start, desc.length);

            try
            {
                byte[] buffer = stream.ToArray();
                buffer = GZipHelper.Decompress(buffer);
                if (buffer != null)
                {
                    if (!SaveFile(buffer, desc.name))
                    {
                        return(false);
                    }
                }
            }
            catch (System.Exception e)
            {
                return(false);
            }
        }

        return(true);
    }
예제 #16
0
        public override void SendAsync(byte[] data, int offset, int length)
        {
            if (this._disposable == 1)
            {
                return;
            }

            byte[] bytes = GZipHelper.Compress(data, offset, length);
            if ((SessionWorkType)_session.AppTokens[0] == SessionWorkType.ManagerSession)
            {
                byte[] body = new byte[sizeof(Int64) + sizeof(Int32) + bytes.Length];
                BitConverter.GetBytes(this.RemoteId).CopyTo(body, 0);
                BitConverter.GetBytes(bytes.Length).CopyTo(body, 8);
                bytes.CopyTo(body, 12);

                MessageHelper.SendMessage(_session, MessageHead.Msg_MessageData, body);
            }
            else
            {
                byte[] body = new byte[bytes.Length + sizeof(Int32)];
                BitConverter.GetBytes(bytes.Length).CopyTo(body, 0);
                bytes.CopyTo(body, 4);

                _session.SendAsync(body, 0, body.Length);
            }
        }
예제 #17
0
        public void TestZipUnzipRandomSucceeds()
        {
            //// ARRANGE

            var source = new byte[992];

            var r = new Random(42);

            r.NextBytes(source);

            //// ACT

            var zippedSource = GZipHelper.Zip(source);

            Assert.AreEqual(1015, zippedSource.Length);

            var unzipped = GZipHelper.Unzip(zippedSource);

            //// ASSERT

            Assert.AreEqual(992, unzipped.Length);

            for (int i = 0; i < 992; i++)
            {
                Assert.AreEqual(source[i], unzipped[i]);
            }
        }
예제 #18
0
        public static byte[] SerializeXmlWithoutNamespaces(object instance, bool compress = false)
        {
            if (instance == null)
            {
                return(null);
            }

            using (var ms = new MemoryStream())
            {
                var xsn = new XmlSerializerNamespaces();
                xsn.Add(string.Empty, string.Empty);

                var settings = new XmlWriterSettings {
                    OmitXmlDeclaration = true, Encoding = new UTF8Encoding(false)
                };
                //settings.Indent = true;
                //settings.IndentChars = "\t";
                //settings.NewLineChars = Environment.NewLine;
                //settings.ConformanceLevel = ConformanceLevel.Document;


                var xmls = new XmlSerializer(instance.GetType());
                using (var writer = XmlWriter.Create(ms, settings))
                {
                    xmls.Serialize(writer, instance, xsn, null, null);
                }
                return(compress ? GZipHelper.Compress(ms.ToArray()) : ms.ToArray());
            }
        }
예제 #19
0
        public static byte[] SerializeXml(object instance, bool compress = false)
        {
            if (instance == null)
            {
                return(null);
            }

            using (var ms = new MemoryStream())
            {
                var xmls = new XmlSerializer(instance.GetType());
                //var xsn = new XmlSerializerNamespaces();
                //xsn.Add(string.Empty, null);
                //xmls.Serialize(ms, instance, xsn);

                using (var xmlWriter = new XmlTextWriter(ms, null)
                {
                    Formatting = Formatting.Indented, Indentation = 2
                })
                {
                    xmls.Serialize(xmlWriter, instance, null, null, null);
                }

                return(compress ? GZipHelper.Compress(ms.ToArray()) : ms.ToArray());
            }
        }
예제 #20
0
        private void ReceviedHQData(object sender, DataReceivedEventArgs args)
        {
            var msg = GZipHelper.GZipDecompressString(args.Data);

            if (msg.IndexOf("ping") != -1) //响应心跳包
            {
                HQLastTime    = DateTime.Now;
                SendHQXinTiao = false;
                var reponseData = msg.Replace("ping", "pong");
                SendHQSubscribeTopic(reponseData);
            }
            else
            {
                JObject jomsg = (JObject)JsonConvert.DeserializeObject(msg);
                if (jomsg.Property("ch") != null)
                {
                    string type = jomsg["ch"].ToString();
                    if (type.Contains("depth"))
                    {
                        QueryQuote5(jomsg);
                    }
                    else if (type.Contains("trade"))
                    {
                        QueryChengJiaoJia(jomsg);
                    }
                }
            }
        }
예제 #21
0
        private static void ReceviedMsg(object sender, DataReceivedEventArgs e)
        {
            var msg = GZipHelper.GZipDecompressString(e.Data);

            if (msg.IndexOf("ping") != -1) //响应心跳包
            {
                var reponseData = msg.Replace("ping", "pong");
                websocket.Send(reponseData);
            }
            else//接收消息
            {
                if (msg.IndexOf("status") < 0)
                {
                    if (msg.IndexOf("depth") >= 0)
                    {
                        //System.Diagnostics.Trace.WriteLine(msg);
                        OnMessage?.Invoke(null, new HuoBiMessageReceivedEventArgs(msg));
                    }
                    else if (msg.IndexOf("kline") >= 0)
                    {
                    }
                    else if (msg.IndexOf("trade") >= 0)
                    {
                        OnMessage?.Invoke(null, new HuoBiMessageReceivedEventArgs(msg));
                    }
                }
            }
        }
예제 #22
0
 public T Decompress <T>(byte[] zipBuffer)
 {
     byte[] buffer = GZipHelper.Decompress(zipBuffer);
     using (MemoryStream stream = new MemoryStream(buffer))
     {
         return(Deserialize <T>(stream));
     }
 }
예제 #23
0
        public void Test()
        {
            var temp        = "abc123!@#";
            var comressed   = GZipHelper.GZipCompressString(temp);
            var decomressed = GZipHelper.GZipDecompressString(comressed);

            Assert.AreEqual(temp, decomressed);
        }
        protected virtual void SendToBefore(TcpSocketSaeaSession session, byte[] data)
        {
            //为解决延迟发送导致的accessId不安全问题
            var accessIdObj = Thread.GetData(Thread.GetNamedDataSlot("AccessId"));
            var accessId    = accessIdObj.IsNull() ? GetAccessId(session) : accessIdObj.ConvertTo <long>();

            SendTo(session, WrapAccessId(GZipHelper.Compress(data, 0, data.Length), accessId));
        }
예제 #25
0
        public string Stream1(int i)
        {
            var    persons = BuildModel();
            string json    = JsonConvert.SerializeObject(persons);
            var    result  = GZipHelper.GZipCompressString(json);

            return(result);
        }
예제 #26
0
        private byte[] TakeHeadAndMessage(TcpSocketSaeaSession session)
        {
            var length = session.CompletedBuffer.Length - sizeof(long);
            var bytes  = new byte[length];

            Array.Copy(session.CompletedBuffer, sizeof(long), bytes, 0, length);
            return(GZipHelper.Decompress(bytes));
        }
        public override void OnMessage()
        {
            var defineHeadSize = sizeof(int);

            if (ListByteBuffer.Count < defineHeadSize)
            {
                return;
            }

            byte[] lenBytes   = ListByteBuffer.GetRange(0, defineHeadSize).ToArray();
            int    packageLen = BitConverter.ToInt32(lenBytes, 0);

            if (packageLen < 0 || packageLen > ApplicationConfiguartion.Options.MaxPacketSize || packageLen < 25) //数据不合法 或 小于大概ack固定长度
            {
                this.Log(LogOutLevelType.Error, $"Type:{ConnectionWorkType.ToString()} 长度不合法!");
                this.CloseSession();
                return;
            }

            if (packageLen + defineHeadSize > ListByteBuffer.Count)
            {
                return;
            }

            this._ackRetainData = ListByteBuffer.GetRange(defineHeadSize, packageLen).ToArray();
            ListByteBuffer.RemoveRange(0, packageLen + defineHeadSize);

            var longSize    = sizeof(long);
            var packageBody = GZipHelper.Decompress(_ackRetainData, longSize, _ackRetainData.Length - longSize);
            var messageHead = TakeMessageHead(packageBody);

            if (messageHead == ACK_HEAD)
            {
                var ack = PacketSerializeHelper.DeserializePacket <AckPacket>(TakeMessage(packageBody));

                this._accessId = ack.AccessId;

                if (ValidityAccessIdWithKey((ConnectionWorkType)ack.Type, ack.AccessId, ack.AccessKey))
                {
                    this.ApportionTypeHandlerEvent?.Invoke(this, (ConnectionWorkType)ack.Type);
                }
                else
                {
                    if ((ConnectionWorkType)ack.Type == ConnectionWorkType.MainApplicationConnection)
                    {
                        var midData = MessageHelper.CopyMessageHeadTo(MessageHead.MID_ACCESS_KEY_WRONG);
                        this.CurrentSession.SendAsync(midData.BuilderHeadPacket());
                    }
                    this.Log(LogOutLevelType.Debug, $"Type:{((ConnectionWorkType)ack.Type).ToString()} AccessId:{ack.AccessId} 或AccessKey:{ack.AccessKey} 验证失败,登陆不成功!");
                    this.CloseSession();
                }
            }
            else
            {
                this.CloseSession();
                this.Log(LogOutLevelType.Warning, $"未知消息,连接被关闭!");
            }
        }
예제 #28
0
        public static async Task <WebSocketMessageContext> ToBinaryContextAsync(this WebSocketReceiveResult result,
                                                                                IStreamCompressor compressor,
                                                                                byte[] input)
        {
            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            var content = input.Split();

            byte[] header = content.Item1;
            byte[] body   = content.Item2;

            var  webSocketContext = new WebSocketMessageContext();
            bool isCompressed     = GZipHelper.IsGZipBody(body);

            if (isCompressed)
            {
                body = await compressor.DeCompressAsync(body);
            }

            using (var ms = new MemoryStream(header))
                using (var sr = new StreamReader(ms))
                {
                    var data = await sr.ReadToEndAsync();

                    if (data != null)
                    {
                        try
                        {
                            webSocketContext.Header = JsonConvert.DeserializeObject <Dictionary <string, object> >(data);
                        }
                        catch (Exception ex)
                        {
                            webSocketContext.Header = new Dictionary <string, object>
                            {
                                ["Exception"] = ex.Message,
                                ["Unknown"]   = "Unknown binary message!"
                            };
                        }
                    }
                }

            using (var ms = new MemoryStream(body))
                using (var sr = new StreamReader(ms))
                {
                    var data = await sr.ReadToEndAsync();

                    webSocketContext.Value = data;
                }

            webSocketContext.Length      = input.Length;
            webSocketContext.MessageType = WebSocketMessageType.Binary;
            webSocketContext.Command     = WebSocketCommands.DataSend;

            return(webSocketContext);
        }
예제 #29
0
        private void PackageProcess()
        {
            if (this._isCompress)
            {
                CompletedBuffer = GZipHelper.Decompress(CompletedBuffer);
            }

            this.NotifyEventHandler?.Invoke(TcpSocketCompletionNotify.OnDataReceived, this);
        }
 virtual public void CopyTo(VirtualCollection <T> target)
 {
     Flush();
     GZipHelper.CopyStream(StoreStream, target.StoreStream);
     IndexBlock[] indexList = new IndexBlock[Index.Count];
     Index.CopyTo(indexList);
     target.Index    = new List <IndexBlock>(indexList);
     target.Transfer = Transfer;
 }