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

DomCR / ACadSharp / 13852624414

14 Mar 2025 08:23AM UTC coverage: 76.202% (-0.02%) from 76.22%
13852624414

Pull #581

github

web-flow
Merge 39f59258a into 5d7d96527
Pull Request #581: Implement Material

5495 of 7915 branches covered (69.43%)

Branch coverage included in aggregate %.

54 of 58 new or added lines in 3 files covered. (93.1%)

5 existing lines in 2 files now uncovered.

21658 of 27718 relevant lines covered (78.14%)

75611.38 hits per line

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

92.22
/src/ACadSharp/IO/DXF/DxfStreamReader/DxfObjectsSectionReader.cs
1
using ACadSharp.IO.Templates;
2
using ACadSharp.Objects;
3
using ACadSharp.Objects.Evaluations;
4
using System;
5
using System.Diagnostics;
6
using System.Linq;
7
using static ACadSharp.IO.Templates.CadEvaluationGraphTemplate;
8

9
namespace ACadSharp.IO.DXF
10
{
11
        internal class DxfObjectsSectionReader : DxfSectionReaderBase
12
        {
13
                public delegate bool ReadObjectDelegate<T>(CadTemplate template, DxfMap map) where T : CadObject;
14

15
                public DxfObjectsSectionReader(IDxfStreamReader reader, DxfDocumentBuilder builder)
16
                        : base(reader, builder)
206✔
17
                {
206✔
18
                }
206✔
19

20
                public override void Read()
21
                {
206✔
22
                        //Advance to the first value in the section
23
                        this._reader.ReadNext();
206✔
24

25
                        //Loop until the section ends
26
                        while (this._reader.ValueAsString != DxfFileToken.EndSection)
58,841✔
27
                        {
58,635✔
28
                                CadTemplate template = null;
58,635✔
29

30
                                try
31
                                {
58,635✔
32
                                        template = this.readObject();
58,635✔
33
                                }
58,635✔
34
                                catch (Exception ex)
×
35
                                {
×
36
                                        if (!this._builder.Configuration.Failsafe)
×
37
                                                throw;
×
38

39
                                        this._builder.Notify($"Error while reading an object at line {this._reader.Position}", NotificationType.Error, ex);
×
40

41
                                        while (this._reader.DxfCode != DxfCode.Start)
×
42
                                                this._reader.ReadNext();
×
43
                                }
×
44

45
                                if (template == null)
58,635✔
46
                                        continue;
368✔
47

48
                                //Add the object and the template to the builder
49
                                this._builder.AddTemplate(template);
58,267✔
50
                        }
58,267✔
51
                }
206✔
52

53
                private CadTemplate readObject()
54
                {
58,635✔
55
                        switch (this._reader.ValueAsString)
58,635!
56
                        {
57
                                case DxfFileToken.ObjectDBColor:
58
                                        return this.readObjectCodes<BookColor>(new CadNonGraphicalObjectTemplate(new BookColor()), this.readBookColor);
192✔
59
                                case DxfFileToken.ObjectDictionary:
60
                                        return this.readObjectCodes<CadDictionary>(new CadDictionaryTemplate(), this.readDictionary);
19,268✔
61
                                case DxfFileToken.ObjectDictionaryWithDefault:
62
                                        return this.readObjectCodes<CadDictionaryWithDefault>(new CadDictionaryWithDefaultTemplate(), this.readDictionaryWithDefault);
194✔
63
                                case DxfFileToken.ObjectLayout:
64
                                        return this.readObjectCodes<Layout>(new CadLayoutTemplate(), this.readLayout);
798✔
65
                                case DxfFileToken.ObjectEvalGraph:
66
                                        return this.readObjectCodes<EvaluationGraph>(new CadEvaluationGraphTemplate(), this.readEvaluationGraph);
192✔
67
                                case DxfFileToken.ObjectDictionaryVar:
68
                                        return this.readObjectCodes<DictionaryVariable>(new CadTemplate<DictionaryVariable>(new DictionaryVariable()), this.readObjectSubclassMap);
2,757✔
69
                                case DxfFileToken.ObjectPdfDefinition:
70
                                        return this.readObjectCodes<PdfUnderlayDefinition>(new CadNonGraphicalObjectTemplate(new PdfUnderlayDefinition()), this.readObjectSubclassMap);
×
71
                                case DxfFileToken.ObjectSortEntsTable:
72
                                        return this.readSortentsTable();
576✔
73
                                case DxfFileToken.ObjectGroup:
74
                                        return this.readObjectCodes<Group>(new CadGroupTemplate(), this.readGroup);
384✔
75
                                case DxfFileToken.ObjectGeoData:
76
                                        return this.readObjectCodes<GeoData>(new CadGeoDataTemplate(), this.readGeoData);
2✔
77
                                case DxfFileToken.ObjectScale:
78
                                        return this.readObjectCodes<Scale>(new CadTemplate<Scale>(new Scale()), this.readScale);
6,606✔
79
                                case DxfFileToken.ObjectTableContent:
80
                                        return this.readObjectCodes<TableContent>(new CadTableContentTemplate(), this.readTableContent);
384✔
81
                                case DxfFileToken.ObjectVisualStyle:
82
                                        return this.readObjectCodes<VisualStyle>(new CadTemplate<VisualStyle>(new VisualStyle()), this.readVisualStyle);
4,656✔
83
                                case DxfFileToken.ObjectXRecord:
84
                                        return this.readObjectCodes<XRecord>(new CadXRecordTemplate(), this.readXRecord);
15,154✔
85
                                default:
86
                                        DxfMap map = DxfMap.Create<CadObject>();
7,472✔
87
                                        CadUnknownNonGraphicalObjectTemplate unknownEntityTemplate = null;
7,472✔
88
                                        if (this._builder.DocumentToBuild.Classes.TryGetByName(this._reader.ValueAsString, out Classes.DxfClass dxfClass))
7,472✔
89
                                        {
7,104✔
90
                                                this._builder.Notify($"NonGraphicalObject not supported read as an UnknownNonGraphicalObject: {this._reader.ValueAsString}", NotificationType.NotImplemented);
7,104✔
91
                                                unknownEntityTemplate = new CadUnknownNonGraphicalObjectTemplate(new UnknownNonGraphicalObject(dxfClass));
7,104✔
92
                                        }
7,104✔
93
                                        else
94
                                        {
368✔
95
                                                this._builder.Notify($"UnknownNonGraphicalObject not supported: {this._reader.ValueAsString}", NotificationType.NotImplemented);
368✔
96
                                        }
368✔
97

98
                                        this._reader.ReadNext();
7,472✔
99

100
                                        do
101
                                        {
381,592✔
102
                                                if (unknownEntityTemplate != null && this._builder.KeepUnknownEntities)
381,592✔
103
                                                {
45,088✔
104
                                                        this.readCommonCodes(unknownEntityTemplate, out bool isExtendedData, map);
45,088✔
105
                                                        if (isExtendedData)
45,088✔
106
                                                                continue;
72✔
107
                                                }
45,016✔
108

109
                                                this._reader.ReadNext();
381,520✔
110
                                        }
381,520✔
111
                                        while (this._reader.DxfCode != DxfCode.Start);
381,592✔
112

113
                                        return unknownEntityTemplate;
7,472✔
114
                        }
115
                }
58,635✔
116

117
                protected CadTemplate readObjectCodes<T>(CadTemplate template, ReadObjectDelegate<T> readObject)
118
                        where T : CadObject
119
                {
50,587✔
120
                        this._reader.ReadNext();
50,587✔
121

122
                        DxfMap map = DxfMap.Create<T>();
50,587✔
123

124
                        while (this._reader.DxfCode != DxfCode.Start)
1,660,160✔
125
                        {
1,609,573✔
126
                                if (!readObject(template, map))
1,609,573✔
127
                                {
943,453✔
128
                                        this.readCommonCodes(template, out bool isExtendedData, map);
943,453✔
129
                                        if (isExtendedData)
943,453✔
130
                                                continue;
4,921✔
131
                                }
938,532✔
132

133
                                if (this._reader.DxfCode != DxfCode.Start)
1,604,652✔
134
                                        this._reader.ReadNext();
1,589,306✔
135
                        }
1,604,652✔
136

137
                        return template;
50,587✔
138
                }
50,587✔
139

140
                private bool readObjectSubclassMap(CadTemplate template, DxfMap map)
141
                {
16,542✔
142
                        switch (this._reader.Code)
16,542✔
143
                        {
144
                                default:
145
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
16,542✔
146
                        }
147
                }
16,542✔
148

149
                private bool readPlotSettings(CadTemplate template, DxfMap map)
150
                {
25,252✔
151
                        switch (this._reader.Code)
25,252✔
152
                        {
153
                                default:
154
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.PlotSettings]);
25,252✔
155
                        }
156
                }
25,252✔
157

158
                private bool readEvaluationGraph(CadTemplate template, DxfMap map)
159
                {
1,536✔
160
                        CadEvaluationGraphTemplate tmp = template as CadEvaluationGraphTemplate;
1,536✔
161
                        EvaluationGraph evGraph = tmp.CadObject;
1,536✔
162

163
                        switch (this._reader.Code)
1,536✔
164
                        {
165
                                case 91:
166
                                        while (this._reader.Code == 91)
2,496✔
167
                                        {
2,304✔
168
                                                GraphNodeTemplate nodeTemplate = new GraphNodeTemplate();
2,304✔
169
                                                EvaluationGraph.Node node = nodeTemplate.Node;
2,304✔
170

171
                                                node.Index = this._reader.ValueAsInt;
2,304✔
172

173
                                                this._reader.ExpectedCode(93);
2,304✔
174
                                                node.Flags = this._reader.ValueAsInt;
2,304✔
175

176
                                                this._reader.ExpectedCode(95);
2,304✔
177
                                                node.NextNodeIndex = this._reader.ValueAsInt;
2,304✔
178

179
                                                this._reader.ExpectedCode(360);
2,304✔
180
                                                nodeTemplate.ExpressionHandle = this._reader.ValueAsHandle;
2,304✔
181

182
                                                this._reader.ExpectedCode(92);
2,304✔
183
                                                node.Data1 = this._reader.ValueAsInt;
2,304✔
184
                                                this._reader.ExpectedCode(92);
2,304✔
185
                                                node.Data2 = this._reader.ValueAsInt;
2,304✔
186
                                                this._reader.ExpectedCode(92);
2,304✔
187
                                                node.Data3 = this._reader.ValueAsInt;
2,304✔
188
                                                this._reader.ExpectedCode(92);
2,304✔
189
                                                node.Data4 = this._reader.ValueAsInt;
2,304✔
190

191
                                                this._reader.ReadNext();
2,304✔
192

193
                                                tmp.NodeTemplates.Add(nodeTemplate);
2,304✔
194
                                        }
2,304✔
195

196
                                        return this.checkObjectEnd(template, map, this.readEvaluationGraph);
192✔
197
                                case 92:
198
                                        //Edges
199
                                        while (this._reader.Code == 92)
2,112✔
200
                                        {
1,920✔
201
                                                this._reader.ExpectedCode(93);
1,920✔
202
                                                this._reader.ExpectedCode(94);
1,920✔
203
                                                this._reader.ExpectedCode(91);
1,920✔
204
                                                this._reader.ExpectedCode(91);
1,920✔
205
                                                this._reader.ExpectedCode(92);
1,920✔
206
                                                this._reader.ExpectedCode(92);
1,920✔
207
                                                this._reader.ExpectedCode(92);
1,920✔
208
                                                this._reader.ExpectedCode(92);
1,920✔
209
                                                this._reader.ExpectedCode(92);
1,920✔
210

211
                                                this._reader.ReadNext();
1,920✔
212
                                        }
1,920✔
213

214
                                        return this.checkObjectEnd(template, map, this.readEvaluationGraph);
192✔
215
                                default:
216
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.EvalGraph]);
1,152✔
217
                        }
218
                }
1,536✔
219

220
                private bool readLayout(CadTemplate template, DxfMap map)
221
                {
51,406✔
222
                        CadLayoutTemplate tmp = template as CadLayoutTemplate;
51,406✔
223

224
                        switch (this._reader.Code)
51,406✔
225
                        {
226
                                case 330:
227
                                        tmp.PaperSpaceBlockHandle = this._reader.ValueAsHandle;
1,596✔
228
                                        return true;
1,596✔
229
                                case 331:
230
                                        tmp.LasActiveViewportHandle = (this._reader.ValueAsHandle);
770✔
231
                                        return true;
770✔
232
                                default:
233
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Layout]))
49,040✔
234
                                        {
25,252✔
235
                                                return this.readPlotSettings(template, map);
25,252✔
236
                                        }
237
                                        return true;
23,788✔
238
                        }
239
                }
51,406✔
240

241
                private bool readGroup(CadTemplate template, DxfMap map)
242
                {
4,992✔
243
                        CadGroupTemplate tmp = template as CadGroupTemplate;
4,992✔
244

245
                        switch (this._reader.Code)
4,992✔
246
                        {
247
                                case 70:
248
                                        return true;
384✔
249
                                case 340:
250
                                        tmp.Handles.Add(this._reader.ValueAsHandle);
2,304✔
251
                                        return true;
2,304✔
252
                                default:
253
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
2,304✔
254
                        }
255
                }
4,992✔
256

257
                private bool readGeoData(CadTemplate template, DxfMap map)
258
                {
102✔
259
                        CadGeoDataTemplate tmp = template as CadGeoDataTemplate;
102✔
260

261
                        switch (this._reader.Code)
102✔
262
                        {
263
                                case 40 when tmp.CadObject.Version == GeoDataVersion.R2009:
2✔
264
                                        tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
265
                                                tmp.CadObject.ReferencePoint.X,
1✔
266
                                                this._reader.ValueAsDouble,
1✔
267
                                                tmp.CadObject.ReferencePoint.Z
1✔
268
                                                );
1✔
269
                                        return true;
1✔
270
                                case 41 when tmp.CadObject.Version == GeoDataVersion.R2009:
2✔
271
                                        tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
272
                                                this._reader.ValueAsDouble,
1✔
273
                                                tmp.CadObject.ReferencePoint.Y,
1✔
274
                                                tmp.CadObject.ReferencePoint.Z
1✔
275
                                                );
1✔
276
                                        return true;
1✔
277
                                case 42 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
278
                                        tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
279
                                                tmp.CadObject.ReferencePoint.X,
1✔
280
                                                tmp.CadObject.ReferencePoint.Y,
1✔
281
                                                this._reader.ValueAsDouble
1✔
282
                                                );
1✔
283
                                        return true;
1✔
284
                                case 46 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
285
                                        tmp.CadObject.HorizontalUnitScale = this._reader.ValueAsDouble;
1✔
286
                                        return true;
1✔
287
                                case 52 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
288
                                        double angle = System.Math.PI / 2.0 - this._reader.ValueAsAngle;
1✔
289
                                        tmp.CadObject.NorthDirection = new CSMath.XY(Math.Cos(angle), Math.Sin(angle));
1✔
290
                                        return true;
1✔
291
                                // Number of Geo-Mesh points
292
                                case 93:
293
                                        var npts = this._reader.ValueAsInt;
3✔
294
                                        for (int i = 0; i < npts; i++)
54✔
295
                                        {
24✔
296
                                                this._reader.ReadNext();
24✔
297
                                                double sourceX = this._reader.ValueAsDouble;
24✔
298
                                                this._reader.ReadNext();
24✔
299
                                                double sourceY = this._reader.ValueAsDouble;
24✔
300

301
                                                this._reader.ReadNext();
24✔
302
                                                double destX = this._reader.ValueAsDouble;
24✔
303
                                                this._reader.ReadNext();
24✔
304
                                                double destY = this._reader.ValueAsDouble;
24✔
305

306
                                                tmp.CadObject.Points.Add(new GeoData.GeoMeshPoint
24✔
307
                                                {
24✔
308
                                                        Source = new CSMath.XY(sourceX, sourceY),
24✔
309
                                                        Destination = new CSMath.XY(destX, destY)
24✔
310
                                                });
24✔
311
                                        }
24✔
312
                                        return true;
3✔
313
                                // Number of Geo-Mesh points
314
                                case 96:
315
                                        var nfaces = this._reader.ValueAsInt;
2✔
316
                                        for (int i = 0; i < nfaces; i++)
4!
317
                                        {
×
318
                                                this._reader.ReadNext();
×
319
                                                Debug.Assert(this._reader.Code == 97);
×
320
                                                int index1 = this._reader.ValueAsInt;
×
321
                                                this._reader.ReadNext();
×
322
                                                Debug.Assert(this._reader.Code == 98);
×
323
                                                int index2 = this._reader.ValueAsInt;
×
324
                                                this._reader.ReadNext();
×
325
                                                Debug.Assert(this._reader.Code == 99);
×
326
                                                int index3 = this._reader.ValueAsInt;
×
327

328
                                                tmp.CadObject.Faces.Add(new GeoData.GeoMeshFace
×
329
                                                {
×
330
                                                        Index1 = index1,
×
331
                                                        Index2 = index2,
×
332
                                                        Index3 = index3
×
333
                                                });
×
334
                                        }
×
335
                                        return true;
2✔
336
                                case 303:
337
                                        tmp.CadObject.CoordinateSystemDefinition += this._reader.ValueAsString;
13✔
338
                                        return true;
13✔
339
                                //Obsolete codes for version GeoDataVersion.R2009
340
                                case 3:
341
                                case 4:
342
                                case 14:
343
                                case 24:
344
                                case 15:
345
                                case 25:
346
                                case 43:
347
                                case 44:
348
                                case 45:
349
                                case 94:
350
                                case 293:
351
                                case 16:
352
                                case 26:
353
                                case 17:
354
                                case 27:
355
                                case 54:
356
                                case 140:
357
                                case 304:
358
                                case 292:
359
                                        return true;
19✔
360
                                default:
361
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
60✔
362
                        }
363
                }
102✔
364

365
                private bool readScale(CadTemplate template, DxfMap map)
366
                {
59,250✔
367
                        switch (this._reader.Code)
59,250✔
368
                        {
369
                                // Undocumented codes
370
                                case 70:
371
                                        //Always 0
372
                                        return true;
6,606✔
373
                                default:
374
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Scale]);
52,644✔
375
                        }
376
                }
59,250✔
377

378
                private bool readTableContent(CadTemplate template, DxfMap map)
379
                {
888,576✔
380
                        switch (this._reader.Code)
888,576✔
381
                        {
382
                                default:
383
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.TableContent]);
888,576✔
384
                        }
385
                }
888,576✔
386

387
                private bool readVisualStyle(CadTemplate template, DxfMap map)
388
                {
346,908✔
389
                        switch (this._reader.Code)
346,908✔
390
                        {
391
                                // Undocumented codes
392
                                case 176:
393
                                case 177:
394
                                case 420:
395
                                        return true;
119,122✔
396
                                default:
397
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.VisualStyle]);
227,786✔
398
                        }
399
                }
346,908✔
400

401
                private bool readXRecord(CadTemplate template, DxfMap map)
402
                {
58,184✔
403
                        CadXRecordTemplate tmp = template as CadXRecordTemplate;
58,184✔
404

405
                        switch (this._reader.Code)
58,184✔
406
                        {
407
                                case 100 when this._reader.ValueAsString == DxfSubclassMarker.XRecord:
15,154✔
408
                                        this.readXRecordEntries(tmp);
15,154✔
409
                                        return true;
15,154✔
410
                                default:
411
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.XRecord]);
43,030✔
412
                        }
413
                }
58,184✔
414

415
                private void readXRecordEntries(CadXRecordTemplate template)
416
                {
15,154✔
417
                        this._reader.ReadNext();
15,154✔
418

419
                        while (this._reader.DxfCode != DxfCode.Start)
830,680✔
420
                        {
815,526✔
421
                                switch (this._reader.GroupCodeValue)
815,526!
422
                                {
423
                                        case GroupCodeValueType.Handle:
NEW
424
                                                template.AddHandleReference(this._reader.Code, this._reader.ValueAsHandle);
×
NEW
425
                                                break;
×
426
                                        default:
427
                                                template.CadObject.CreateEntry(this._reader.Code, this._reader.Value);
815,526✔
428
                                                break;
815,526✔
429
                                }
430

431
                                this._reader.ReadNext();
815,526✔
432
                        }
815,526✔
433
                }
15,154✔
434

435
                private bool readBookColor(CadTemplate template, DxfMap map)
436
                {
1,376✔
437
                        CadNonGraphicalObjectTemplate tmp = template as CadNonGraphicalObjectTemplate;
1,376✔
438
                        BookColor color = tmp.CadObject as BookColor;
1,376✔
439

440
                        switch (this._reader.Code)
1,376✔
441
                        {
442
                                case 430:
443
                                        color.Name = this._reader.ValueAsString;
160✔
444
                                        return true;
160✔
445
                                default:
446
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.DbColor]);
1,216✔
447
                        }
448
                }
1,376✔
449

450
                private bool readDictionary(CadTemplate template, DxfMap map)
451
                {
180,699✔
452
                        CadDictionaryTemplate tmp = template as CadDictionaryTemplate;
180,699✔
453
                        CadDictionary cadDictionary = tmp.CadObject;
180,699✔
454

455
                        switch (this._reader.Code)
180,699✔
456
                        {
457
                                case 280:
458
                                        cadDictionary.HardOwnerFlag = this._reader.ValueAsBool;
13,185✔
459
                                        return true;
13,185✔
460
                                case 281:
461
                                        cadDictionary.ClonningFlags = (DictionaryCloningFlags)this._reader.Value;
19,462✔
462
                                        return true;
19,462✔
463
                                case 3:
464
                                        tmp.Entries.Add(this._reader.ValueAsString, null);
40,814✔
465
                                        return true;
40,814✔
466
                                case 350: // Soft-owner ID/handle to entry object 
467
                                case 360: // Hard-owner ID/handle to entry object
468
                                        tmp.Entries[tmp.Entries.LastOrDefault().Key] = this._reader.ValueAsHandle;
40,814✔
469
                                        return true;
40,814✔
470
                                default:
471
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Dictionary]);
66,424✔
472
                        }
473
                }
180,699✔
474

475
                private bool readDictionaryWithDefault(CadTemplate template, DxfMap map)
476
                {
1,746✔
477
                        CadDictionaryWithDefaultTemplate tmp = template as CadDictionaryWithDefaultTemplate;
1,746✔
478

479
                        switch (this._reader.Code)
1,746✔
480
                        {
481
                                case 340:
482
                                        tmp.DefaultEntryHandle = this._reader.ValueAsHandle;
194✔
483
                                        return true;
194✔
484
                                default:
485
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.DictionaryWithDefault]))
1,552!
486
                                        {
1,552✔
487
                                                return this.readDictionary(template, map);
1,552✔
488
                                        }
489
                                        return true;
×
490
                        }
491
                }
1,746✔
492

493
                private CadTemplate readSortentsTable()
494
                {
576✔
495
                        SortEntitiesTable sortTable = new SortEntitiesTable();
576✔
496
                        CadSortensTableTemplate template = new CadSortensTableTemplate(sortTable);
576✔
497

498
                        //Jump the 0 marker
499
                        this._reader.ReadNext();
576✔
500

501
                        this.readCommonObjectData(template);
576✔
502

503
                        System.Diagnostics.Debug.Assert(DxfSubclassMarker.SortentsTable == this._reader.ValueAsString);
576✔
504

505
                        //Jump the 100 marker
506
                        this._reader.ReadNext();
576✔
507

508
                        (ulong?, ulong?) pair = (null, null);
576✔
509

510
                        while (this._reader.DxfCode != DxfCode.Start)
4,224✔
511
                        {
3,648✔
512
                                switch (this._reader.Code)
3,648!
513
                                {
514
                                        case 5:
515
                                                pair.Item1 = this._reader.ValueAsHandle;
1,536✔
516
                                                break;
1,536✔
517
                                        case 330:
518
                                                template.BlockOwnerHandle = this._reader.ValueAsHandle;
576✔
519
                                                break;
576✔
520
                                        case 331:
521
                                                pair.Item2 = this._reader.ValueAsHandle;
1,536✔
522
                                                break;
1,536✔
523
                                        default:
524
                                                this._builder.Notify($"Group Code not handled {this._reader.GroupCodeValue} for {typeof(SortEntitiesTable)}, code : {this._reader.Code} | value : {this._reader.ValueAsString}");
×
525
                                                break;
×
526
                                }
527

528
                                if (pair.Item1.HasValue && pair.Item2.HasValue)
3,648✔
529
                                {
1,536✔
530
                                        template.Values.Add((pair.Item1.Value, pair.Item2.Value));
1,536✔
531
                                        pair = (null, null);
1,536✔
532
                                }
1,536✔
533

534
                                this._reader.ReadNext();
3,648✔
535
                        }
3,648✔
536

537
                        return template;
576✔
538
                }
576✔
539
        }
540
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc