コード例 #1
0
ファイル: ItemWriter.cs プロジェクト: DMIAOCHEN/Evil-DICOM
 public static void WriteUserInfo(DICOMBinaryWriter dw, UserInfo info)
 {
     dw.Write((byte) ItemType.USER_INFO);
     dw.WriteNullBytes(1); // Reserved Null Byte
     var body = new byte[0];
     using (var stream = new MemoryStream()) //Will write inner object to get length
     {
         using (var wr = new DICOMBinaryWriter(stream))
         {
             WriteMaxLength(wr, info.MaxPDULength);
             WriteImplementationClassUID(wr, info.ImplementationUID);
             WriteAsyncOperations(wr, info.AsynchronousOperations);
             WriteImplementationVersion(wr, info.ImplementationVersion);
             body = stream.ToArray();
         }
     }
     LengthWriter.WriteBigEndian(dw, body.Length, 2);
     dw.Write(body);
 }
コード例 #2
0
ファイル: ItemReader.cs プロジェクト: DMIAOCHEN/Evil-DICOM
 public static UserInfo ReadUserInfo(DICOMBinaryReader dr)
 {
     AssertItemType(dr, "User Info", ItemType.USER_INFO);
     var ui = new UserInfo();
     dr.Skip(2); // PDU ID and Reserved Null Byte
     int length = LengthReader.ReadBigEndian(dr, 2);
     if (length > 0)
     {
         ui.MaxPDULength = (int) ReadMaxLength(dr);
         ui.ImplementationUID = ReadImplementationClassUID(dr);
         if (dr.Peek(1)[0] == (byte) ItemType.ASYNCHRONOUS_OPERATIONS_WINDOW)
         {
             ui.AsynchronousOperations = ReadAsyncOperations(dr);
         }
         ui.ImplementationVersion = ReadImplementationVersion(dr);
     }
     return ui;
 }