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


C# RawPDU.ReadByte方法代码示例

本文整理汇总了C#中Dicom.Network.RawPDU.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# RawPDU.ReadByte方法的具体用法?C# RawPDU.ReadByte怎么用?C# RawPDU.ReadByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dicom.Network.RawPDU的用法示例。


在下文中一共展示了RawPDU.ReadByte方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

		/// <summary>
		/// Reads A-ASSOCIATE-RJ from PDU buffer
		/// </summary>
		/// <param name="raw">PDU buffer</param>
		public void Read(RawPDU raw) {
			raw.ReadByte("Reserved");
			_rt = (DicomRejectResult)raw.ReadByte("Result");
			_so = (DicomRejectSource)raw.ReadByte("Source");
			_rn = (DicomRejectReason)raw.ReadByte("Reason");
		}
开发者ID:dremerdt,项目名称:fo-dicom,代码行数:10,代码来源:PDU.cs

示例2: Read

        /// <summary>
        /// Reads A-ASSOCIATE-RQ from PDU buffer
        /// </summary>
        /// <param name="raw">PDU buffer</param>
        public void Read(RawPDU raw)
        {
            uint l = raw.Length - 6;

            raw.ReadUInt16("Version");
            raw.SkipBytes("Reserved", 2);
            _assoc.CalledAE = raw.ReadString("Called AE", 16);
            _assoc.CallingAE = raw.ReadString("Calling AE", 16);
            raw.SkipBytes("Reserved", 32);
            l -= 2 + 2 + 16 + 16 + 32;

            while (l > 0)
            {
                byte type = raw.ReadByte("Item-Type");
                raw.SkipBytes("Reserved", 1);
                ushort il = raw.ReadUInt16("Item-Length");

                l -= 4 + (uint)il;

                if (type == 0x10)
                {
                    // Application Context
                    raw.SkipBytes("Application Context", il);
                }
                else if (type == 0x20)
                {
                    // Presentation Context
                    byte id = raw.ReadByte("Presentation Context ID");
                    raw.SkipBytes("Reserved", 3);
                    il -= 4;

                    while (il > 0)
                    {
                        byte pt = raw.ReadByte("Presentation Context Item-Type");
                        raw.SkipBytes("Reserved", 1);
                        ushort pl = raw.ReadUInt16("Presentation Context Item-Length");
                        string sx = raw.ReadString("Presentation Context Syntax UID", pl);
                        if (pt == 0x30)
                        {
                            var pc = new DicomPresentationContext(id, DicomUID.Parse(sx));
                            _assoc.PresentationContexts.Add(pc);
                        }
                        else if (pt == 0x40)
                        {
                            var pc = _assoc.PresentationContexts[id];
                            pc.AddTransferSyntax(DicomTransferSyntax.Parse(sx));
                        }
                        il -= (ushort)(4 + pl);
                    }
                }
                else if (type == 0x50)
                {
                    // User Information
                    while (il > 0)
                    {
                        byte ut = raw.ReadByte("User Information Item-Type");
                        raw.SkipBytes("Reserved", 1);
                        ushort ul = raw.ReadUInt16("User Information Item-Length");
                        il -= (ushort)(4 + ul);
                        if (ut == 0x51)
                        {
                            _assoc.MaximumPDULength = raw.ReadUInt32("Max PDU Length");
                        }
                        else if (ut == 0x52)
                        {
                            _assoc.RemoteImplementationClassUID =
                                new DicomUID(
                                    raw.ReadString("Implementation Class UID", ul),
                                    "Implementation Class UID",
                                    DicomUidType.Unknown);
                        }
                        else if (ut == 0x55)
                        {
                            _assoc.RemoteImplementationVersion = raw.ReadString("Implementation Version", ul);
                        }
                        else if (ut == 0x53)
                        {
                            _assoc.MaxAsyncOpsInvoked = raw.ReadUInt16("Asynchronous Operations Invoked");
                            _assoc.MaxAsyncOpsPerformed = raw.ReadUInt16("Asynchronous Operations Performed");
                        }
                        else if (ut == 0x54)
                        {
                            var asul = raw.ReadUInt16("Abstract Syntax Item-Length");
                            var syntax = raw.ReadString("Abstract Syntax UID", asul);
                            var userRole = raw.ReadByte("SCU role");
                            var providerRole = raw.ReadByte("SCP role");
                            var pc =
                                _assoc.PresentationContexts.FirstOrDefault(
                                    context => context.AbstractSyntax.UID.Equals(syntax));
                            if (pc != null)
                            {
                                pc.UserRole = userRole == 0x01;
                                pc.ProviderRole = providerRole == 0x01;
                            }
                        }
                        else if (ut == 0x56)
//.........这里部分代码省略.........
开发者ID:aerik,项目名称:fo-dicom,代码行数:101,代码来源:PDU.cs

示例3: Read

        /// <summary>
        /// Reads A-ASSOCIATE-AC from PDU buffer
        /// </summary>
        /// <param name="raw">PDU buffer</param>
        public void Read(RawPDU raw)
        {
            uint l = raw.Length;
            ushort c = 0;

            raw.ReadUInt16("Version");
            raw.SkipBytes("Reserved", 2);
            raw.SkipBytes("Reserved", 16);
            raw.SkipBytes("Reserved", 16);
            raw.SkipBytes("Reserved", 32);
            l -= 68;

            while (l > 0) {
                byte type = raw.ReadByte("Item-Type");
                l -= 1;

                if (type == 0x10) {
                    // Application Context
                    raw.SkipBytes("Reserved", 1);
                    c = raw.ReadUInt16("Item-Length");
                    raw.SkipBytes("Value", (int)c);
                    l -= 3 + (uint)c;
                } else

                if (type == 0x21) {
                    // Presentation Context
                    raw.ReadByte("Reserved");
                    ushort pl = raw.ReadUInt16("Presentation Context Item-Length");
                    byte id = raw.ReadByte("Presentation Context ID");
                    raw.ReadByte("Reserved");
                    byte res = raw.ReadByte("Presentation Context Result/Reason");
                    raw.ReadByte("Reserved");
                    l -= (uint)pl + 3;
                    pl -= 4;

                    // Presentation Context Transfer Syntax
                    raw.ReadByte("Presentation Context Item-Type (0x40)");
                    raw.ReadByte("Reserved");
                    ushort tl = raw.ReadUInt16("Presentation Context Item-Length");
                    string tx = raw.ReadString("Presentation Context Syntax UID", tl);
                    pl -= (ushort)(tl + 4);

                    _assoc.SetPresentationContextResult(id, (DcmPresContextResult)res);
                    _assoc.SetAcceptedTransferSyntax(id, DicomTransferSyntax.Lookup(tx));
                } else

                if (type == 0x50) {
                    // User Information
                    raw.ReadByte("Reserved");
                    ushort il = raw.ReadUInt16("User Information Item-Length");
                    l -= (uint)(il + 3);
                    while (il > 0) {
                        byte ut = raw.ReadByte("User Item-Type");
                        raw.ReadByte("Reserved");
                        ushort ul = raw.ReadUInt16("User Item-Length");
                        il -= (ushort)(ul + 4);
                        if (ut == 0x51) {
                            _assoc.MaximumPduLength = raw.ReadUInt32("Max PDU Length");
                        } else if (ut == 0x52) {
                            _assoc.ImplementationClass = DicomUID.Lookup(raw.ReadString("Implementation Class UID", ul));
                        } else if (ut == 0x53) {
                            _assoc.AsyncOpsInvoked = raw.ReadUInt16("Asynchronous Operations Invoked");
                            _assoc.AsyncOpsPerformed = raw.ReadUInt16("Asynchronous Operations Performed");
                        } else if (ut == 0x55) {
                            _assoc.ImplementationVersion = raw.ReadString("Implementation Version", ul);
                        } else {
                            raw.SkipBytes("User Item Value", (int)ul);
                        }
                    }
                }

                else {
                    raw.SkipBytes("Reserved", 1);
                    ushort il = raw.ReadUInt16("User Item-Length");
                    raw.SkipBytes("Unknown User Item", il);
                    l -= (uint)(il + 3);
                }
            }
        }
开发者ID:hide1980,项目名称:mdcm,代码行数:83,代码来源:PDU.cs


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