当前位置: 首页>>代码示例>>C#>>正文


C# RawPDU.ReadPDU方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:JeanLedesma,项目名称:mdcm,代码行数:85,代码来源:DcmNetworkBase.cs


注:本文中的Dicom.Network.RawPDU.ReadPDU方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。