• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DomCR / ACadSharp / 30339613344

28 Jul 2026 07:45AM UTC coverage: 75.811% (-0.1%) from 75.927%
30339613344

push

github

web-flow
Merge pull request #1154 from domeitzinger/prototype1b-dwg-reader

Implement full Prototype1b section parsing

9167 of 13083 branches covered (70.07%)

Branch coverage included in aggregate %.

549 of 707 new or added lines in 31 files covered. (77.65%)

2 existing lines in 2 files now uncovered.

32923 of 42437 relevant lines covered (77.58%)

152242.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.44
/src/ACadSharp/IO/DXF/DxfStreamReader/DxfAcdsDataSectionReader.cs
1
using System;
2
using System.IO;
3

4
namespace ACadSharp.IO.DXF.DxfStreamReader;
5

6
internal class DxfAcdsDataSectionReader : DxfSectionReaderBase
7
{
8
        public DxfAcdsDataSectionReader(IDxfStreamReader reader, DxfDocumentBuilder builder)
9
                : base(reader, builder)
75✔
10
        {
75✔
11
        }
75✔
12

13
        public override void Read()
14
        {
75✔
15
                try
16
                {
75✔
17
                        //Advance to the first value in the section
18
                        this._reader.ReadNext();
75✔
19

20
                        //The section contains ACDSSCHEMA entries (schema definitions, skipped) and
21
                        //ACDSRECORD entries. A data record associates an owner entity with its
22
                        //ASM/ACIS payload:
23
                        //  2   AcDbDs::ID
24
                        //  320 <owner entity handle>
25
                        //  2   ASM_Data
26
                        //  94  <payload length in bytes>
27
                        //  310 <hex chunks with the binary payload>
28
                        //Schema definitions also nest records introduced by group code 101; those
29
                        //carry no 320/310 pairs so the accumulation below ignores them naturally.
30
                        bool inRecord = false;
75✔
31
                        ulong currentHandle = 0;
75✔
32
                        MemoryStream payload = null;
75✔
33

34
                        while (this._reader.ValueAsString != DxfFileToken.EndSection)
19,661✔
35
                        {
19,586✔
36
                                if (this._reader.DxfCode == DxfCode.Start)
19,586✔
37
                                {
718✔
38
                                        this.storeCurrentRecord(currentHandle, payload);
718✔
39

40
                                        inRecord = this._reader.ValueAsString == DxfFileToken.AcdsRecord;
718✔
41
                                        currentHandle = 0;
718✔
42
                                        payload = null;
718✔
43
                                }
718✔
44
                                else if (inRecord)
18,868✔
45
                                {
12,612✔
46
                                        switch (this._reader.Code)
12,612✔
47
                                        {
48
                                                case 320:
49
                                                        currentHandle = this._reader.ValueAsHandle;
279✔
50
                                                        break;
279✔
51
                                                case 310:
52
                                                        payload = payload ?? new MemoryStream();
10,659✔
53
                                                        byte[] chunk = this._reader.ValueAsBinaryChunk;
10,659✔
54
                                                        payload.Write(chunk, 0, chunk.Length);
10,659✔
55
                                                        break;
10,659✔
56
                                        }
57
                                }
12,612✔
58

59
                                this._reader.ReadNext();
19,586✔
60
                        }
19,586✔
61

62
                        this.storeCurrentRecord(currentHandle, payload);
75✔
63
                }
75✔
NEW
64
                catch (Exception ex)
×
NEW
65
                {
×
NEW
66
                        this._builder.Notify("An error occurred while reading the Prototype1b", NotificationType.Error, ex);
×
UNCOV
67
                }
×
68
        }
75✔
69

70
        private void storeCurrentRecord(ulong handle, MemoryStream payload)
71
        {
793✔
72
                if (handle == 0 || payload == null || payload.Length == 0)
793✔
73
                {
514✔
74
                        return;
514✔
75
                }
76

77
                this._builder.AcdsDataRecords[handle] = payload.ToArray();
279✔
78
        }
793✔
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc