public static Message <PDataTF> ReadPDFData(NetworkBinaryReader dr, bool firstByteRead = false, int i = 0) { PDataTF pdata = null; pdata = new PDataTF(); if (!firstByteRead) { dr.Skip(1); } dr.Skip(1); // PDU ID and Reserved Null Byte var lengthBytes = dr.Take(4); int length = LengthReader.ReadBigEndian(lengthBytes); using (DICOMBinaryReader dbr = dr.GetSubStream(length)) { while (dbr.StreamPosition < dbr.StreamLength) { PDVItem item = ItemReader.ReadPDVItem(dbr); pdata.Items.Add(item); } } return(new Message <PDataTF> { Payload = pdata, Type = MessageType.PDATA_TF }); }
internal virtual void Write(PDataTF data) { throw new SystemException(); }
public void Write(PDataTF data) { FireWrite(data); try { lock (stream) { state.Write(data); } } catch (IOException ioe) { if (assocListener != null) { assocListener.Error(assoc, ioe); } throw ioe; } }
internal override void Write(PDataTF tf) { try { tf.WriteTo(m_fsm.stream); } catch (IOException e) { m_fsm.ChangeState(m_fsm.STA1); throw e; } }
public void Write(IDimse dimse) { lock (this) { pcid = dimse.PresentationContextId(); String tsUID = fsm.GetAcceptedTransferSyntaxUID(pcid); if (tsUID == null) { throw new SystemException(); } (dimse).TransferSyntaxUniqueId = tsUID; fsm.FireWrite(dimse); if (pDataTF == null) { pDataTF = new PDataTF(fsm.WriteMaxLength); } pDataTF.OpenPDV(pcid, cmd = true); Stream outs = new PDataTFOutputStream(this); IDicomCommand c = dimse.DicomCommand; try { c.Write(outs); } finally { outs.Close(); } if (c.HasDataset()) { pDataTF.OpenPDV(pcid, cmd = false); outs = new PDataTFOutputStream(this); try { dimse.WriteTo(outs, tsUID); } finally { outs.Close(); } } FlushPDataTF(); } }