예제 #1
0
        public PDataTFStream(NetworkBase networkBase, byte pcid, uint max, bool combineCommandData)
        {
            _command = true;
            _pcid    = pcid;
            _max     = max;
            _pdu     = new PDataTFWrite(max);
            _pdu.CreatePDV(pcid);

            _networkBase        = networkBase;
            _combineCommandData = combineCommandData;
            BytesWritten        = 0;
        }
예제 #2
0
        public override void Write(byte[] buffer, int offset, int count)
        {
            BytesWritten += count;

            int off = offset;
            int c   = count;

            while (c > 0)
            {
                int bytesToWrite = Math.Min(c, (int)_pdu.GetRemaining());
                AppendBuffer(buffer, off, bytesToWrite);
                c   -= bytesToWrite;
                off += bytesToWrite;

                if (_pdu.GetRemaining() == 0)
                {
                    WritePDU(false);
                    _pdu.CreatePDV(_pcid);
                }
            }
        }