void UnPack() { lock (_receiveBuffer) { var bytes = _receiveBuffer.ReadAllBytes(); _receiveArray.Write(bytes); if (_receiveArray.Length == 0) { return; } try { _iPackage.Unpack(_receiveArray, _receiveQueue); } catch (Exception e) { throw new Exception(e.ToString()); } } }
void UnPack() { if (_receiveBuffer.Reader.GetHowManyCountCanReadInThisBlock() > 0) // if there have bytes to read { var bytes = _receiveBuffer.ReadAllBytes(); _receiveArray.Write(bytes); } if (_receiveArray.Length == 0) { return; } lock (_receiveQueue) { try { _iPackage.Unpack(_receiveArray, _receiveQueue); } catch (Exception e) { throw new Exception(e.ToString()); } } }