public PDataTFStream(NetworkBase networkBase, byte pcid, uint max, uint total, bool combineCommandData) { _command = true; _pcid = pcid; _max = max; _pdu = new PDataTF(); _buffer = new MemoryStream((int)total + 1024); _networkBase = networkBase; _combineCommandData = combineCommandData; }
private void WritePDU(bool last) { if (_pdu.PDVs.Count == 0 || ((CurrentPduSize() + 6) < _max && GetBufferLength() > 0)) { CreatePDV(last); } if (_pdu.PDVs.Count > 0) { if (last) { _pdu.PDVs[_pdu.PDVs.Count - 1].IsLastFragment = true; } RawPDU raw = _pdu.Write(); _networkBase.EnqueuePdu(raw); if (OnTick != null) { OnTick(); } _pdu = new PDataTF(); } }