Esempio n. 1
0
        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
            });
        }
Esempio n. 2
0
 internal virtual void Write(PDataTF data)
 {
     throw new SystemException();
 }
Esempio n. 3
0
 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;
     }
 }
Esempio n. 4
0
 internal override void Write(PDataTF tf)
 {
     try {
         tf.WriteTo(m_fsm.stream);
     }
     catch (IOException e) {
         m_fsm.ChangeState(m_fsm.STA1);
         throw e;
     }
 }
Esempio n. 5
0
 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();
     }
 }