本文整理汇总了C#中Dicom.Network.RawPDU.ReadPDU方法的典型用法代码示例。如果您正苦于以下问题:C# RawPDU.ReadPDU方法的具体用法?C# RawPDU.ReadPDU怎么用?C# RawPDU.ReadPDU使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dicom.Network.RawPDU
的用法示例。
在下文中一共展示了RawPDU.ReadPDU方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessNextPDU
private bool ProcessNextPDU()
{
RawPDU raw = new RawPDU(_network);
if (raw.Type == 0x04) {
if (_dimse == null) {
_dimse = new DcmDimseInfo();
}
}
try {
raw.ReadPDU();
switch (raw.Type) {
case 0x01: {
_assoc = new DcmAssociate();
AAssociateRQ pdu = new AAssociateRQ(_assoc);
pdu.Read(raw);
Log.Info("{0} <- Association request:\n{1}", LogID, Associate.ToString());
OnReceiveAssociateRequest(_assoc);
return true;
}
case 0x02: {
AAssociateAC pdu = new AAssociateAC(_assoc);
pdu.Read(raw);
Log.Info("{0} <- Association accept:\n{1}", LogID, Associate.ToString());
OnReceiveAssociateAccept(_assoc);
return true;
}
case 0x03: {
AAssociateRJ pdu = new AAssociateRJ();
pdu.Read(raw);
Log.Info("{0} <- Association reject [result: {1}; source: {2}; reason: {3}]", LogID, pdu.Result, pdu.Source, pdu.Reason);
OnReceiveAssociateReject(pdu.Result, pdu.Source, pdu.Reason);
return true;
}
case 0x04: {
PDataTF pdu = new PDataTF();
pdu.Read(raw);
//Log.Debug("{0} <- P-Data-TF", LogID);
return ProcessPDataTF(pdu);
}
case 0x05: {
AReleaseRQ pdu = new AReleaseRQ();
pdu.Read(raw);
Log.Info("{0} <- Association release request", LogID);
OnReceiveReleaseRequest();
return true;
}
case 0x06: {
AReleaseRP pdu = new AReleaseRP();
pdu.Read(raw);
Log.Info("{0} <- Association release response", LogID);
OnReceiveReleaseResponse();
return true;
}
case 0x07: {
AAbort pdu = new AAbort();
pdu.Read(raw);
Log.Info("{0} <- Association abort: {1} - {2}", LogID, pdu.Source, pdu.Reason);
OnReceiveAbort(pdu.Source, pdu.Reason);
return true;
}
case 0xFF: {
return false;
}
default:
throw new DicomNetworkException("Unknown PDU type");
}
} catch (SocketException) {
throw;
} catch (Exception e) {
#if DEBUG
Log.Error("{0} -> Error reading PDU [type: 0x{1:x2}]: {2}", LogID, raw.Type, e.ToString());
#else
Log.Error("{0} -> Error reading PDU [type: 0x{1:x2}]: {2}", LogID, raw.Type, e.Message);
#endif
OnNetworkError(e);
//String file = String.Format(@"{0}\Errors\{1}.pdu",
// Dicom.Debug.GetStartDirectory(), DateTime.Now.Ticks);
//Directory.CreateDirectory(Dicom.Debug.GetStartDirectory() + @"\Errors");
//raw.Save(file);
return false;
}
}