public void Import(byte[] data, int start, int count) { try { if (mCheckSize == null) { mCheckSize = new CheckSize(); } while (count > 0) { if (!mLoading) { mCheckSize.Reset(); mStream = new System.IO.MemoryStream(); mLoading = true; } if (mCheckSize.Length == -1) { while (count > 0 && mCheckSize.Length == -1) { mCheckSize.Import(data[start]); start++; count--; } } else { if (mCheckSize.Length > Application.PacketMaxsize) { Channel.Dispose(); "Data Overflow max length is {0}".ThrowError<Exception>(Application.PacketMaxsize); } if (OnImport(data, ref start, ref count)) { mLoading = false; if (this.Receive != null) { mStream.Position = 0; PackageReceiveArgs e = new PackageReceiveArgs(); e.Channel = this.Channel; e.Message = GetMessage(mStream); Receive(this, e); } } } } } catch (Exception e_) { throw e_; } }
public void Import(byte[] data, int start, int count) { try { if (mCheckSize == null) { mCheckSize = new CheckSize(); } while (count > 0) { if (!mLoading) { mCheckSize.Reset(); mStream = new System.IO.MemoryStream(); mLoading = true; } if (mCheckSize.Length == -1) { while (count > 0 && mCheckSize.Length == -1) { mCheckSize.Import(data[start]); start++; count--; } } else { if (mCheckSize.Length > Application.PacketMaxsize) { Channel.Dispose(); "Data Overflow max length is {0}".ThrowError <Exception>(Application.PacketMaxsize); } if (OnImport(data, ref start, ref count)) { mLoading = false; if (this.Receive != null) { mStream.Position = 0; PackageReceiveArgs e = new PackageReceiveArgs(); e.Channel = this.Channel; e.Message = GetMessage(mStream); Receive(this, e); } } } } } catch (Exception e_) { throw e_; } }
public void Import(byte[] data, int start, int count) { try { if (mCheckSize == null) { mCheckSize = new CheckSize(); mCheckSize.LittleEndian = LittleEndian; } while (count > 0) { if (!mLoading) { mCheckSize.Reset(); mStream.SetLength(0); mStream.Position = 0; mLoading = true; } if (mCheckSize.Length == -1) { while (count > 0 && mCheckSize.Length == -1) { mCheckSize.Import(data[start]); start++; count--; } } else { if (OnImport(data, ref start, ref count)) { mLoading = false; if (Receive != null) { mStream.Position = 0; Receive(mStream); } } } } } catch (Exception e_) { throw e_; } }
public void Import(byte[] data, int start, int count) { try { if (mCheckSize == null) { mCheckSize = new CheckSize(); mCheckSize.LittleEndian = LittleEndian; } while (count > 0) { if (!mLoading) { mCheckSize.Reset(); mStream.SetLength(0); mStream.Position = 0; mLoading = true; } if (mCheckSize.Length == -1) { while (count > 0 && mCheckSize.Length == -1) { mCheckSize.Import(data[start]); start++; count--; } } else { if (OnImport(data, ref start, ref count)) { mLoading = false; if (Receive != null) { mStream.Position = 0; Receive(mStream); } } } } } catch (Exception e_) { throw e_; } }
public void Reset() { mCheckSize = null; mLoading = false; }
public void Reset() { mCheckSize = null; mLoading = false; }