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

DomCR / ACadSharp / 18721371977

22 Oct 2025 03:27PM UTC coverage: 78.088% (+0.2%) from 77.923%
18721371977

Pull #831

github

web-flow
Merge d24d9a0de into f84cb1d2a
Pull Request #831: Table entity refactor

7267 of 10095 branches covered (71.99%)

Branch coverage included in aggregate %.

619 of 718 new or added lines in 15 files covered. (86.21%)

3 existing lines in 2 files now uncovered.

27220 of 34069 relevant lines covered (79.9%)

107569.4 hits per line

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

85.11
/src/ACadSharp/IO/DXF/DxfStreamReader/DxfObjectsSectionReader.cs
1
using ACadSharp.Classes;
2
using ACadSharp.Entities;
3
using ACadSharp.IO.Templates;
4
using ACadSharp.Objects;
5
using ACadSharp.Objects.Evaluations;
6
using CSMath;
7
using System;
8
using System.Diagnostics;
9
using System.IO;
10
using System.Linq;
11
using static ACadSharp.IO.Templates.CadEvaluationGraphTemplate;
12
using static ACadSharp.IO.Templates.CadTableEntityTemplate;
13

14
namespace ACadSharp.IO.DXF
15
{
16
        internal class DxfObjectsSectionReader : DxfSectionReaderBase
17
        {
18
                public delegate bool ReadObjectDelegate<T>(CadTemplate template, DxfMap map) where T : CadObject;
19

20
                public DxfObjectsSectionReader(IDxfStreamReader reader, DxfDocumentBuilder builder)
21
                        : base(reader, builder)
242✔
22
                {
242✔
23
                }
242✔
24

25
                public override void Read()
26
                {
242✔
27
                        //Advance to the first value in the section
28
                        this._reader.ReadNext();
242✔
29

30
                        //Loop until the section ends
31
                        while (this._reader.ValueAsString != DxfFileToken.EndSection)
72,228✔
32
                        {
71,986✔
33
                                CadTemplate template = null;
71,986✔
34

35
                                try
36
                                {
71,986✔
37
                                        template = this.readObject();
71,986✔
38
                                }
71,986✔
39
                                catch (Exception ex)
×
40
                                {
×
41
                                        if (!this._builder.Configuration.Failsafe)
×
42
                                                throw;
×
43

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

46
                                        while (this._reader.DxfCode != DxfCode.Start)
×
47
                                                this._reader.ReadNext();
×
48
                                }
×
49

50
                                if (template == null)
71,986✔
51
                                        continue;
242✔
52

53
                                //Add the object and the template to the builder
54
                                this._builder.AddTemplate(template);
71,744✔
55
                        }
71,744✔
56
                }
242✔
57

58
                private CadTemplate readObject()
59
                {
71,986✔
60
                        switch (this._reader.ValueAsString)
71,986!
61
                        {
62
                                case DxfFileToken.ObjectPlaceholder:
63
                                        return this.readObjectCodes<AcdbPlaceHolder>(new CadNonGraphicalObjectTemplate(new AcdbPlaceHolder()), this.readObjectSubclassMap);
230✔
64
                                case DxfFileToken.ObjectDBColor:
65
                                        return this.readObjectCodes<BookColor>(new CadNonGraphicalObjectTemplate(new BookColor()), this.readBookColor);
228✔
66
                                case DxfFileToken.ObjectDictionary:
67
                                        return this.readObjectCodes<CadDictionary>(new CadDictionaryTemplate(), this.readDictionary);
23,376✔
68
                                case DxfFileToken.ObjectDictionaryWithDefault:
69
                                        return this.readObjectCodes<CadDictionaryWithDefault>(new CadDictionaryWithDefaultTemplate(), this.readDictionaryWithDefault);
230✔
70
                                case DxfFileToken.ObjectLayout:
71
                                        return this.readObjectCodes<Layout>(new CadLayoutTemplate(), this.readLayout);
942✔
72
                                case DxfFileToken.ObjectPlotSettings:
73
                                        return this.readObjectCodes<PlotSettings>(new CadNonGraphicalObjectTemplate(new PlotSettings()), this.readPlotSettings);
×
74
                                case DxfFileToken.ObjectEvalGraph:
75
                                        return this.readObjectCodes<EvaluationGraph>(new CadEvaluationGraphTemplate(), this.readEvaluationGraph);
532✔
76
                                case DxfFileToken.ObjectImageDefinition:
77
                                        return this.readObjectCodes<ImageDefinition>(new CadNonGraphicalObjectTemplate(new ImageDefinition()), this.readObjectSubclassMap);
228✔
78
                                case DxfFileToken.ObjectDictionaryVar:
79
                                        return this.readObjectCodes<DictionaryVariable>(new CadTemplate<DictionaryVariable>(new DictionaryVariable()), this.readObjectSubclassMap);
3,282✔
80
                                case DxfFileToken.ObjectPdfDefinition:
81
                                        return this.readObjectCodes<PdfUnderlayDefinition>(new CadNonGraphicalObjectTemplate(new PdfUnderlayDefinition()), this.readObjectSubclassMap);
228✔
82
                                case DxfFileToken.ObjectSortEntsTable:
83
                                        return this.readSortentsTable();
684✔
84
                                case DxfFileToken.ObjectImageDefinitionReactor:
85
                                        return this.readObjectCodes<ImageDefinitionReactor>(new CadNonGraphicalObjectTemplate(new ImageDefinitionReactor()), this.readObjectSubclassMap);
228✔
86
                                case DxfFileToken.ObjectProxyObject:
87
                                        return this.readObjectCodes<ProxyObject>(new CadNonGraphicalObjectTemplate(new ProxyObject()), this.readProxyObject);
×
88
                                case DxfFileToken.ObjectRasterVariables:
89
                                        return this.readObjectCodes<RasterVariables>(new CadNonGraphicalObjectTemplate(new RasterVariables()), this.readObjectSubclassMap);
228✔
90
                                case DxfFileToken.ObjectGroup:
91
                                        return this.readObjectCodes<Group>(new CadGroupTemplate(), this.readGroup);
456✔
92
                                case DxfFileToken.ObjectGeoData:
93
                                        return this.readObjectCodes<GeoData>(new CadGeoDataTemplate(), this.readGeoData);
2✔
94
                                case DxfFileToken.ObjectScale:
95
                                        return this.readObjectCodes<Scale>(new CadTemplate<Scale>(new Scale()), this.readScale);
7,794✔
96
                                case DxfFileToken.ObjectTableContent:
97
                                        return this.readObjectCodes<TableContent>(new CadTableContentTemplate(), this.readTableContent);
380✔
98
                                case DxfFileToken.ObjectVisualStyle:
99
                                        return this.readObjectCodes<VisualStyle>(new CadTemplate<VisualStyle>(new VisualStyle()), this.readVisualStyle);
5,520✔
100
                                case DxfFileToken.ObjectSpatialFilter:
101
                                        return this.readObjectCodes<SpatialFilter>(new CadSpatialFilterTemplate(), this.readSpatialFilter);
228✔
102
                                case DxfFileToken.ObjectMLeaderStyle:
103
                                        return this.readObjectCodes<MultiLeaderStyle>(new CadMLeaderStyleTemplate(), this.readMLeaderStyle);
472✔
104
                                case DxfFileToken.ObjectXRecord:
105
                                        return this.readObjectCodes<XRecord>(new CadXRecordTemplate(), this.readXRecord);
18,632✔
106
                                default:
107
                                        DxfMap map = DxfMap.Create<CadObject>();
8,086✔
108
                                        CadUnknownNonGraphicalObjectTemplate unknownEntityTemplate = null;
8,086✔
109
                                        if (this._builder.DocumentToBuild.Classes.TryGetByName(this._reader.ValueAsString, out Classes.DxfClass dxfClass))
8,086✔
110
                                        {
7,844✔
111
                                                //this._builder.Notify($"NonGraphicalObject not supported read as an UnknownNonGraphicalObject: {this._reader.ValueAsString}", NotificationType.NotImplemented);
112
                                                unknownEntityTemplate = new CadUnknownNonGraphicalObjectTemplate(new UnknownNonGraphicalObject(dxfClass));
7,844✔
113
                                        }
7,844✔
114
                                        else
115
                                        {
242✔
116
                                                //this._builder.Notify($"UnknownNonGraphicalObject not supported: {this._reader.ValueAsString}", NotificationType.NotImplemented);
117
                                        }
242✔
118

119
                                        this._reader.ReadNext();
8,086✔
120

121
                                        do
122
                                        {
384,542✔
123
                                                if (unknownEntityTemplate != null && this._builder.KeepUnknownEntities)
384,542✔
124
                                                {
38,532✔
125
                                                        this.readCommonCodes(unknownEntityTemplate, out bool isExtendedData, map);
38,532✔
126
                                                        if (isExtendedData)
38,532✔
127
                                                                continue;
48✔
128
                                                }
38,484✔
129

130
                                                this._reader.ReadNext();
384,494✔
131
                                        }
384,494✔
132
                                        while (this._reader.DxfCode != DxfCode.Start);
384,542✔
133

134
                                        return unknownEntityTemplate;
8,086✔
135
                        }
136
                }
71,986✔
137

138
                protected CadTemplate readObjectCodes<T>(CadTemplate template, ReadObjectDelegate<T> readObject)
139
                        where T : CadObject
140
                {
63,216✔
141
                        this._reader.ReadNext();
63,216✔
142

143
                        DxfMap map = DxfMap.Create<T>();
63,216✔
144

145
                        while (this._reader.DxfCode != DxfCode.Start)
978,121✔
146
                        {
914,905✔
147
                                if (!readObject(template, map))
914,905✔
148
                                {
312,417✔
149
                                        this.readCommonCodes(template, out bool isExtendedData, map);
312,417✔
150
                                        if (isExtendedData)
312,417✔
151
                                                continue;
6,069✔
152
                                }
306,348✔
153

154
                                if (this._reader.DxfCode != DxfCode.Start)
908,836✔
155
                                        this._reader.ReadNext();
889,596✔
156
                        }
908,836✔
157

158
                        return template;
63,216✔
159
                }
63,216✔
160

161
                private bool readProxyObject(CadTemplate template, DxfMap map)
162
                {
×
163
                        ProxyObject proxy = template.CadObject as ProxyObject;
×
164

165
                        switch (this._reader.Code)
×
166
                        {
167
                                case 90:
168
                                case 94:
169
                                //Undocumented
170
                                case 97:
171
                                case 71:
172
                                        return true;
×
173
                                case 95:
174
                                        int format = this._reader.ValueAsInt;
×
175
                                        proxy.Version = (ACadVersion)(format & 0xFFFF);
×
176
                                        proxy.MaintenanceVersion = (short)(format >> 16);
×
177
                                        return true;
×
178
                                case 91:
179
                                        var classId = this._reader.ValueAsShort;
×
180
                                        if (this._builder.DocumentToBuild.Classes.TryGetByClassNumber(classId, out DxfClass dxfClass))
×
181
                                        {
×
182
                                                proxy.DxfClass = dxfClass;
×
183
                                        }
×
184
                                        return true;
×
185
                                case 161:
186
                                        return true;
×
187
                                case 162:
188
                                        return true;
×
189
                                case 310:
190
                                        if (proxy.BinaryData == null)
×
191
                                        {
×
192
                                                proxy.BinaryData = new MemoryStream();
×
193
                                        }
×
194
                                        proxy.BinaryData.Write(this._reader.ValueAsBinaryChunk, 0, this._reader.ValueAsBinaryChunk.Length);
×
195
                                        return true;
×
196
                                case 311:
197
                                        if (proxy.Data == null)
×
198
                                        {
×
199
                                                proxy.Data = new MemoryStream();
×
200
                                        }
×
201
                                        proxy.Data.Write(this._reader.ValueAsBinaryChunk, 0, this._reader.ValueAsBinaryChunk.Length);
×
202
                                        return true;
×
203
                                default:
204
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.ProxyObject]);
×
205
                        }
206
                }
×
207

208
                private bool readObjectSubclassMap(CadTemplate template, DxfMap map)
209
                {
27,438✔
210
                        switch (this._reader.Code)
27,438✔
211
                        {
212
                                default:
213
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
27,438✔
214
                        }
215
                }
27,438✔
216

217
                private bool readPlotSettings(CadTemplate template, DxfMap map)
218
                {
29,830✔
219
                        switch (this._reader.Code)
29,830✔
220
                        {
221
                                default:
222
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.PlotSettings]);
29,830✔
223
                        }
224
                }
29,830✔
225

226
                private bool readEvaluationGraph(CadTemplate template, DxfMap map)
227
                {
3,648✔
228
                        CadEvaluationGraphTemplate tmp = template as CadEvaluationGraphTemplate;
3,648✔
229
                        EvaluationGraph evGraph = tmp.CadObject;
3,648✔
230

231
                        switch (this._reader.Code)
3,648✔
232
                        {
233
                                case 91:
234
                                        while (this._reader.Code == 91)
3,572✔
235
                                        {
3,040✔
236
                                                GraphNodeTemplate nodeTemplate = new GraphNodeTemplate();
3,040✔
237
                                                EvaluationGraph.Node node = nodeTemplate.Node;
3,040✔
238

239
                                                node.Index = this._reader.ValueAsInt;
3,040✔
240

241
                                                this._reader.ExpectedCode(93);
3,040✔
242
                                                node.Flags = this._reader.ValueAsInt;
3,040✔
243

244
                                                this._reader.ExpectedCode(95);
3,040✔
245
                                                node.NextNodeIndex = this._reader.ValueAsInt;
3,040✔
246

247
                                                this._reader.ExpectedCode(360);
3,040✔
248
                                                nodeTemplate.ExpressionHandle = this._reader.ValueAsHandle;
3,040✔
249

250
                                                this._reader.ExpectedCode(92);
3,040✔
251
                                                node.Data1 = this._reader.ValueAsInt;
3,040✔
252
                                                this._reader.ExpectedCode(92);
3,040✔
253
                                                node.Data2 = this._reader.ValueAsInt;
3,040✔
254
                                                this._reader.ExpectedCode(92);
3,040✔
255
                                                node.Data3 = this._reader.ValueAsInt;
3,040✔
256
                                                this._reader.ExpectedCode(92);
3,040✔
257
                                                node.Data4 = this._reader.ValueAsInt;
3,040✔
258

259
                                                this._reader.ReadNext();
3,040✔
260

261
                                                tmp.NodeTemplates.Add(nodeTemplate);
3,040✔
262
                                        }
3,040✔
263

264
                                        return this.checkObjectEnd(template, map, this.readEvaluationGraph);
532✔
265
                                case 92:
266
                                        //Edges
267
                                        while (this._reader.Code == 92)
2,508✔
268
                                        {
2,280✔
269
                                                this._reader.ExpectedCode(93);
2,280✔
270
                                                this._reader.ExpectedCode(94);
2,280✔
271
                                                this._reader.ExpectedCode(91);
2,280✔
272
                                                this._reader.ExpectedCode(91);
2,280✔
273
                                                this._reader.ExpectedCode(92);
2,280✔
274
                                                this._reader.ExpectedCode(92);
2,280✔
275
                                                this._reader.ExpectedCode(92);
2,280✔
276
                                                this._reader.ExpectedCode(92);
2,280✔
277
                                                this._reader.ExpectedCode(92);
2,280✔
278

279
                                                this._reader.ReadNext();
2,280✔
280
                                        }
2,280✔
281

282
                                        return this.checkObjectEnd(template, map, this.readEvaluationGraph);
228✔
283
                                default:
284
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.EvalGraph]);
2,888✔
285
                        }
286
                }
3,648✔
287

288
                private bool readLayout(CadTemplate template, DxfMap map)
289
                {
60,712✔
290
                        CadLayoutTemplate tmp = template as CadLayoutTemplate;
60,712✔
291

292
                        switch (this._reader.Code)
60,712✔
293
                        {
294
                                case 330:
295
                                        tmp.PaperSpaceBlockHandle = this._reader.ValueAsHandle;
1,884✔
296
                                        return true;
1,884✔
297
                                case 331:
298
                                        tmp.LasActiveViewportHandle = (this._reader.ValueAsHandle);
914✔
299
                                        return true;
914✔
300
                                default:
301
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Layout]))
57,914✔
302
                                        {
29,830✔
303
                                                return this.readPlotSettings(template, map);
29,830✔
304
                                        }
305
                                        return true;
28,084✔
306
                        }
307
                }
60,712✔
308

309
                private bool readGroup(CadTemplate template, DxfMap map)
310
                {
5,928✔
311
                        CadGroupTemplate tmp = template as CadGroupTemplate;
5,928✔
312

313
                        switch (this._reader.Code)
5,928✔
314
                        {
315
                                case 70:
316
                                        return true;
456✔
317
                                case 340:
318
                                        tmp.Handles.Add(this._reader.ValueAsHandle);
2,736✔
319
                                        return true;
2,736✔
320
                                default:
321
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
2,736✔
322
                        }
323
                }
5,928✔
324

325
                private bool readGeoData(CadTemplate template, DxfMap map)
326
                {
102✔
327
                        CadGeoDataTemplate tmp = template as CadGeoDataTemplate;
102✔
328

329
                        switch (this._reader.Code)
102✔
330
                        {
331
                                case 40 when tmp.CadObject.Version == GeoDataVersion.R2009:
2✔
332
                                        tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
333
                                                tmp.CadObject.ReferencePoint.X,
1✔
334
                                                this._reader.ValueAsDouble,
1✔
335
                                                tmp.CadObject.ReferencePoint.Z
1✔
336
                                                );
1✔
337
                                        return true;
1✔
338
                                case 41 when tmp.CadObject.Version == GeoDataVersion.R2009:
2✔
339
                                        tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
340
                                                this._reader.ValueAsDouble,
1✔
341
                                                tmp.CadObject.ReferencePoint.Y,
1✔
342
                                                tmp.CadObject.ReferencePoint.Z
1✔
343
                                                );
1✔
344
                                        return true;
1✔
345
                                case 42 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
346
                                        tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
347
                                                tmp.CadObject.ReferencePoint.X,
1✔
348
                                                tmp.CadObject.ReferencePoint.Y,
1✔
349
                                                this._reader.ValueAsDouble
1✔
350
                                                );
1✔
351
                                        return true;
1✔
352
                                case 46 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
353
                                        tmp.CadObject.HorizontalUnitScale = this._reader.ValueAsDouble;
1✔
354
                                        return true;
1✔
355
                                case 52 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
356
                                        double angle = System.Math.PI / 2.0 - this._reader.ValueAsAngle;
1✔
357
                                        tmp.CadObject.NorthDirection = new CSMath.XY(Math.Cos(angle), Math.Sin(angle));
1✔
358
                                        return true;
1✔
359
                                // Number of Geo-Mesh points
360
                                case 93:
361
                                        var npts = this._reader.ValueAsInt;
3✔
362
                                        for (int i = 0; i < npts; i++)
54✔
363
                                        {
24✔
364
                                                this._reader.ReadNext();
24✔
365
                                                double sourceX = this._reader.ValueAsDouble;
24✔
366
                                                this._reader.ReadNext();
24✔
367
                                                double sourceY = this._reader.ValueAsDouble;
24✔
368

369
                                                this._reader.ReadNext();
24✔
370
                                                double destX = this._reader.ValueAsDouble;
24✔
371
                                                this._reader.ReadNext();
24✔
372
                                                double destY = this._reader.ValueAsDouble;
24✔
373

374
                                                tmp.CadObject.Points.Add(new GeoData.GeoMeshPoint
24✔
375
                                                {
24✔
376
                                                        Source = new CSMath.XY(sourceX, sourceY),
24✔
377
                                                        Destination = new CSMath.XY(destX, destY)
24✔
378
                                                });
24✔
379
                                        }
24✔
380
                                        return true;
3✔
381
                                // Number of Geo-Mesh points
382
                                case 96:
383
                                        var nfaces = this._reader.ValueAsInt;
2✔
384
                                        for (int i = 0; i < nfaces; i++)
4!
385
                                        {
×
386
                                                this._reader.ReadNext();
×
387
                                                Debug.Assert(this._reader.Code == 97);
×
388
                                                int index1 = this._reader.ValueAsInt;
×
389
                                                this._reader.ReadNext();
×
390
                                                Debug.Assert(this._reader.Code == 98);
×
391
                                                int index2 = this._reader.ValueAsInt;
×
392
                                                this._reader.ReadNext();
×
393
                                                Debug.Assert(this._reader.Code == 99);
×
394
                                                int index3 = this._reader.ValueAsInt;
×
395

396
                                                tmp.CadObject.Faces.Add(new GeoData.GeoMeshFace
×
397
                                                {
×
398
                                                        Index1 = index1,
×
399
                                                        Index2 = index2,
×
400
                                                        Index3 = index3
×
401
                                                });
×
402
                                        }
×
403
                                        return true;
2✔
404
                                case 303:
405
                                        tmp.CadObject.CoordinateSystemDefinition += this._reader.ValueAsString;
13✔
406
                                        return true;
13✔
407
                                //Obsolete codes for version GeoDataVersion.R2009
408
                                case 3:
409
                                case 4:
410
                                case 14:
411
                                case 24:
412
                                case 15:
413
                                case 25:
414
                                case 43:
415
                                case 44:
416
                                case 45:
417
                                case 94:
418
                                case 293:
419
                                case 16:
420
                                case 26:
421
                                case 17:
422
                                case 27:
423
                                case 54:
424
                                case 140:
425
                                case 304:
426
                                case 292:
427
                                        return true;
19✔
428
                                default:
429
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
60✔
430
                        }
431
                }
102✔
432

433
                private bool readScale(CadTemplate template, DxfMap map)
434
                {
69,942✔
435
                        switch (this._reader.Code)
69,942✔
436
                        {
437
                                // Undocumented codes
438
                                case 70:
439
                                        //Always 0
440
                                        return true;
7,794✔
441
                                default:
442
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Scale]);
62,148✔
443
                        }
444
                }
69,942✔
445

446
                private bool readLinkedData(CadTemplate template, DxfMap map)
447
                {
10,032✔
448
                        switch (this._reader.Code)
10,032✔
449
                        {
450
                                default:
451
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.LinkedData]);
10,032✔
452
                        }
453
                }
10,032✔
454

455
                private bool readTableContent(CadTemplate template, DxfMap map)
456
                {
15,504✔
457
                        switch (this._reader.Code)
15,504✔
458
                        {
459
                                case 90:
460
                                        //Column count
461
                                        return true;
1,140✔
462
                                case 91:
463
                                        //Row count
464
                                        return true;
1,140✔
465
                                case 300 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableColumn, StringComparison.InvariantCultureIgnoreCase):
2,432✔
466
                                        //Read Column
467
                                        this.readTableColumn();
1,444✔
468
                                        return true;
1,444✔
469
                                case 301 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableRow, StringComparison.InvariantCultureIgnoreCase):
1,900✔
470
                                        //Read Row
471
                                        this.readTableRow();
1,748✔
472
                                        return true;
1,748✔
473
                                default:
474
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.TableLinkedTableData]))
10,032!
475
                                        {
10,032✔
476
                                                return this.readLinkedData(template, map);
10,032✔
477
                                        }
NEW
478
                                        return true;
×
479
                        }
480
                }
15,504✔
481

482
                private TableEntity.Column readTableColumn()
483
                {
1,444✔
484
                        this._reader.ReadNext();
1,444✔
485

486
                        TableEntity.Column column = new TableEntity.Column();
1,444✔
487

488
                        bool end = false;
1,444✔
489
                        while (this._reader.DxfCode != DxfCode.Start)
4,332!
490
                        {
4,332✔
491
                                switch (this._reader.Code)
4,332!
492
                                {
493
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataColumn_BEGIN, StringComparison.InvariantCultureIgnoreCase):
4,332✔
494
                                                this.readLinkedTableColumn(column);
1,444✔
495
                                                break;
1,444✔
496
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.FormattedTableDataColumn_BEGIN, StringComparison.InvariantCultureIgnoreCase):
2,888✔
497
                                                this.readFormattedTableColumn(column);
1,444✔
498
                                                break;
1,444✔
499
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableColumnBegin, StringComparison.InvariantCultureIgnoreCase):
1,444!
500
                                                this.readTableColumn(column);
1,444✔
501
                                                end = true;
1,444✔
502
                                                break;
1,444✔
503
                                        default:
NEW
504
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableColumn)} method.", NotificationType.None);
×
NEW
505
                                                break;
×
506
                                }
507

508
                                if (end)
4,332✔
509
                                {
1,444✔
510
                                        return column;
1,444✔
511
                                }
512

513
                                this._reader.ReadNext();
2,888✔
514
                        }
2,888✔
515

NEW
516
                        return column;
×
517
                }
1,444✔
518

519
                private TableEntity.Row readTableRow()
520
                {
1,748✔
521
                        this._reader.ReadNext();
1,748✔
522

523
                        TableEntity.Row row = new TableEntity.Row();
1,748✔
524

525
                        bool end = false;
1,748✔
526
                        while (this._reader.DxfCode != DxfCode.Start)
14,136✔
527
                        {
14,060✔
528
                                switch (this._reader.Code)
14,060✔
529
                                {
530
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataRow_BEGIN, StringComparison.InvariantCultureIgnoreCase):
7,144✔
531
                                                this.readLinkedTableRow(row);
1,824✔
532
                                                break;
1,824✔
533
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.FormattedTableDataRow_BEGIN, StringComparison.InvariantCultureIgnoreCase):
5,320✔
534
                                                this.readFormattedTableRow(row);
1,672✔
535
                                                break;
1,672✔
536
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableRowBegin, StringComparison.InvariantCultureIgnoreCase):
3,648✔
537
                                                this.readTableRow(row);
1,672✔
538
                                                end = true;
1,672✔
539
                                                break;
1,672✔
540
                                        default:
541
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableRow)} method.", NotificationType.None);
8,892✔
542
                                                break;
8,892✔
543
                                }
544

545
                                if (end)
14,060✔
546
                                {
1,672✔
547
                                        return row;
1,672✔
548
                                }
549

550
                                this._reader.ReadNext();
12,388✔
551
                        }
12,388✔
552

553
                        return row;
76✔
554
                }
1,748✔
555

556
                private void readTableRow(TableEntity.Row row)
557
                {
1,672✔
558
                        this._reader.ReadNext();
1,672✔
559

560
                        bool end = false;
1,672✔
561
                        while (this._reader.DxfCode != DxfCode.Start)
5,016✔
562
                        {
5,016✔
563
                                switch (this._reader.Code)
5,016!
564
                                {
565
                                        case 40:
566
                                                row.Height = this._reader.ValueAsDouble;
1,672✔
567
                                                break;
1,672✔
568
                                        case 90:
569
                                                //styleID
570
                                                break;
1,672✔
571
                                        case 309:
572
                                                end = this._reader.ValueAsString.Equals("TABLEROW_END", StringComparison.InvariantCultureIgnoreCase);
1,672✔
573
                                                break;
1,672✔
574
                                        default:
NEW
575
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableRow)} method.", NotificationType.None);
×
NEW
576
                                                break;
×
577
                                }
578

579
                                if (end)
5,016✔
580
                                {
1,672✔
581
                                        break;
1,672✔
582
                                }
583

584
                                this._reader.ReadNext();
3,344✔
585
                        }
3,344✔
586
                }
1,672✔
587

588
                private void readFormattedTableRow(TableEntity.Row row)
589
                {
1,672✔
590
                        this._reader.ReadNext();
1,672✔
591

592
                        bool end = false;
1,672✔
593
                        while (this._reader.DxfCode != DxfCode.Start)
5,016✔
594
                        {
5,016✔
595
                                switch (this._reader.Code)
5,016!
596
                                {
597
                                        case 300 when this._reader.ValueAsString.Equals("ROWTABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
1,672!
598
                                                break;
1,672✔
599
                                        case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
1,672!
600
                                                this.readStyleOverride(new CadCellStyleTemplate(row.CellStyleOverride));
1,672✔
601
                                                break;
1,672✔
602
                                        case 309:
603
                                                end = this._reader.ValueAsString.Equals("FORMATTEDTABLEDATAROW_END", StringComparison.InvariantCultureIgnoreCase);
1,672✔
604
                                                break;
1,672✔
605
                                        default:
NEW
606
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableRow)} method.", NotificationType.None);
×
NEW
607
                                                break;
×
608
                                }
609

610
                                if (end)
5,016✔
611
                                {
1,672✔
612
                                        break;
1,672✔
613
                                }
614

615
                                this._reader.ReadNext();
3,344✔
616
                        }
3,344✔
617
                }
1,672✔
618

619
                private void readTableColumn(TableEntity.Column column)
620
                {
1,444✔
621
                        this._reader.ReadNext();
1,444✔
622

623
                        bool end = false;
1,444✔
624
                        while (this._reader.DxfCode != DxfCode.Start)
4,332✔
625
                        {
4,332✔
626
                                switch (this._reader.Code)
4,332!
627
                                {
NEW
628
                                        case 1 when this._reader.ValueAsString.Equals("TABLECOLUMN_BEGIN", StringComparison.InvariantCultureIgnoreCase):
×
NEW
629
                                                break;
×
630
                                        case 1:
NEW
631
                                                end = true;
×
NEW
632
                                                break;
×
633
                                        case 40:
634
                                                column.Width = this._reader.ValueAsDouble;
1,444✔
635
                                                break;
1,444✔
636
                                        case 90:
637
                                                //StyleId
638
                                                break;
1,444✔
639
                                        case 309:
640
                                                end = this._reader.ValueAsString.Equals("TABLECOLUMN_END", StringComparison.InvariantCultureIgnoreCase);
1,444✔
641
                                                break;
1,444✔
642
                                        default:
NEW
643
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableColumn)} method.", NotificationType.None);
×
NEW
644
                                                break;
×
645
                                }
646

647
                                if (end)
4,332✔
648
                                {
1,444✔
649
                                        break;
1,444✔
650
                                }
651

652
                                this._reader.ReadNext();
2,888✔
653
                        }
2,888✔
654
                }
1,444✔
655

656
                private void readLinkedTableColumn(TableEntity.Column column)
657
                {
1,444✔
658
                        this._reader.ReadNext();
1,444✔
659

660
                        bool end = false;
1,444✔
661
                        while (this._reader.DxfCode != DxfCode.Start)
5,776✔
662
                        {
5,776✔
663
                                switch (this._reader.Code)
5,776!
664
                                {
NEW
665
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataColumn_BEGIN, StringComparison.InvariantCultureIgnoreCase):
×
NEW
666
                                                break;
×
667
                                        case 1:
NEW
668
                                                end = true;
×
NEW
669
                                                break;
×
670
                                        case 91:
671
                                                column.CustomData = this._reader.ValueAsInt;
1,444✔
672
                                                break;
1,444✔
673
                                        case 300:
674
                                                column.Name = this._reader.ValueAsString;
1,444✔
675
                                                break;
1,444✔
676
                                        case 301 when this._reader.ValueAsString.Equals(DxfFileToken.CustomData, StringComparison.InvariantCultureIgnoreCase):
1,444!
677
                                                this.readCustomData();
1,444✔
678
                                                break;
1,444✔
679
                                        case 309:
680
                                                end = this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataColumn_END, StringComparison.InvariantCultureIgnoreCase);
1,444✔
681
                                                break;
1,444✔
682
                                        default:
NEW
683
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableColumn)} method.", NotificationType.None);
×
NEW
684
                                                break;
×
685
                                }
686

687
                                if (end)
5,776✔
688
                                {
1,444✔
689
                                        break;
1,444✔
690
                                }
691

692
                                this._reader.ReadNext();
4,332✔
693
                        }
4,332✔
694
                }
1,444✔
695

696
                private void readLinkedTableRow(TableEntity.Row row)
697
                {
1,824✔
698
                        this._reader.ReadNext();
1,824✔
699

700
                        bool end = false;
1,824✔
701
                        while (this._reader.DxfCode != DxfCode.Start)
14,972✔
702
                        {
14,820✔
703
                                if (this._reader.Code == 40 && this._reader.ValueAsDouble == 7.491035367212169)
14,820!
NEW
704
                                {
×
705

NEW
706
                                }
×
707

708
                                switch (this._reader.Code)
14,820!
709
                                {
NEW
710
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataRow_BEGIN, StringComparison.InvariantCultureIgnoreCase):
✔
NEW
711
                                                break;
×
712
                                        case 90:
713
                                                if (this._reader.Position == 49606)
1,824!
NEW
714
                                                {
×
NEW
715
                                                }
×
716
                                                break;
1,824✔
717
                                        case 91:
718
                                                row.CustomData = this._reader.ValueAsInt;
1,672✔
719
                                                break;
1,672✔
720
                                        case 300 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectCell, StringComparison.InvariantCultureIgnoreCase):
6,384✔
721
                                                this.readCell();
6,384✔
722
                                                break;
6,384✔
723
                                        case 301 when this._reader.ValueAsString.Equals(DxfFileToken.CustomData, StringComparison.InvariantCultureIgnoreCase):
1,672✔
724
                                                this.readCustomData();
1,672✔
725
                                                break;
1,672✔
726
                                        case 309:
727
                                                end = this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataRow_END, StringComparison.InvariantCultureIgnoreCase);
1,672✔
728
                                                break;
1,672✔
729
                                        default:
730
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableRow)} method.", NotificationType.None);
1,596✔
731
                                                break;
1,596✔
732
                                }
733

734
                                if (end)
14,820✔
735
                                {
1,672✔
736
                                        break;
1,672✔
737
                                }
738

739
                                this._reader.ReadNext();
13,148✔
740
                        }
13,148✔
741
                }
1,824✔
742

743
                private TableEntity.Cell readCell()
744
                {
6,384✔
745
                        this._reader.ReadNext();
6,384✔
746

747
                        TableEntity.Cell cell = new TableEntity.Cell();
6,384✔
748

749
                        bool end = false;
6,384✔
750
                        while (this._reader.DxfCode != DxfCode.Start)
20,140✔
751
                        {
19,988✔
752
                                switch (this._reader.Code)
19,988✔
753
                                {
754
                                        case 1 when this._reader.ValueAsString.Equals("LINKEDTABLEDATACELL_BEGIN", StringComparison.InvariantCultureIgnoreCase):
18,848✔
755
                                                this.readLinkedTableCell(cell);
6,384✔
756
                                                break;
6,384✔
757
                                        case 1 when this._reader.ValueAsString.Equals("FORMATTEDTABLEDATACELL_BEGIN", StringComparison.InvariantCultureIgnoreCase):
12,464✔
758
                                                this.readFormattedTableCell(cell);
6,232✔
759
                                                break;
6,232✔
760
                                        case 1 when this._reader.ValueAsString.Equals("TABLECELL_BEGIN", StringComparison.InvariantCultureIgnoreCase):
6,232✔
761
                                                this.readTableCell(cell);
6,232✔
762
                                                end = true;
6,232✔
763
                                                break;
6,232✔
764
                                        default:
765
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCell)} method.", NotificationType.None);
1,140✔
766
                                                break;
1,140✔
767
                                }
768

769
                                if (end)
19,988✔
770
                                {
6,232✔
771
                                        return cell;
6,232✔
772
                                }
773

774
                                this._reader.ReadNext();
13,756✔
775
                        }
13,756✔
776

777
                        return cell;
152✔
778
                }
6,384✔
779

780
                private void readTableCell(TableEntity.Cell cell)
781
                {
6,232✔
782
                        var map = DxfClassMap.Create(cell.GetType(), "TABLECELL_BEGIN");
6,232✔
783

784
                        this._reader.ReadNext();
6,232✔
785

786
                        bool end = false;
6,232✔
787
                        while (this._reader.DxfCode != DxfCode.Start)
19,456✔
788
                        {
19,456✔
789
                                switch (this._reader.Code)
19,456✔
790
                                {
791
                                        case 309:
792
                                                end = this._reader.ValueAsString.Equals("TABLECELL_END", StringComparison.InvariantCultureIgnoreCase);
6,232✔
793
                                                break;
6,232✔
794
                                        default:
795
                                                if (!this.tryAssignCurrentValue(cell, map))
13,224✔
796
                                                {
456✔
797
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableCell)} {this._reader.Position}.", NotificationType.None);
456✔
798
                                                }
456✔
799
                                                break;
13,224✔
800
                                }
801

802
                                if (end)
19,456✔
803
                                {
6,232✔
804
                                        break;
6,232✔
805
                                }
806

807
                                this._reader.ReadNext();
13,224✔
808
                        }
13,224✔
809
                }
6,232✔
810

811

812
                private void readFormattedTableCell(TableEntity.Cell cell)
813
                {
6,232✔
814
                        var map = DxfClassMap.Create(cell.GetType(), "FORMATTEDTABLEDATACELL_BEGIN");
6,232✔
815

816
                        this._reader.ReadNext();
6,232✔
817

818
                        bool end = false;
6,232✔
819
                        while (this._reader.DxfCode != DxfCode.Start)
12,464✔
820
                        {
12,464✔
821
                                switch (this._reader.Code)
12,464!
822
                                {
823
                                        case 300 when this._reader.ValueAsString.Equals("CELLTABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
6,232!
824
                                                this.readCellTableFormat(cell);
6,232✔
825
                                                continue;
6,232✔
826
                                        case 309:
827
                                                end = this._reader.ValueAsString.Equals("FORMATTEDTABLEDATACELL_END", StringComparison.InvariantCultureIgnoreCase);
6,232✔
828
                                                break;
6,232✔
829
                                        default:
NEW
830
                                                if (!this.tryAssignCurrentValue(cell, map))
×
NEW
831
                                                {
×
NEW
832
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableCell)} {this._reader.Position}.", NotificationType.None);
×
NEW
833
                                                }
×
NEW
834
                                                break;
×
835
                                }
836

837
                                if (end)
6,232!
838
                                {
6,232✔
839
                                        break;
6,232✔
840
                                }
841

NEW
842
                                this._reader.ReadNext();
×
NEW
843
                        }
×
844
                }
6,232✔
845

846
                private void readCellTableFormat(TableEntity.Cell cell)
847
                {
6,232✔
848
                        var map = DxfClassMap.Create(cell.GetType(), "CELLTABLEFORMAT");
6,232✔
849

850
                        this._reader.ReadNext();
6,232✔
851

852
                        bool end = false;
6,232✔
853
                        while (this._reader.Code == 1)
12,464✔
854
                        {
6,232✔
855
                                switch (this._reader.Code)
6,232!
856
                                {
857
                                        case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
6,232!
858
                                                this.readStyleOverride(new CadCellStyleTemplate(cell.StyleOverride));
6,232✔
859
                                                break;
6,232✔
NEW
860
                                        case 1 when this._reader.ValueAsString.Equals("CELLSTYLE_BEGIN", StringComparison.InvariantCultureIgnoreCase):
×
NEW
861
                                                this.readCellStyle(new CadCellStyleTemplate());
×
NEW
862
                                                break;
×
863
                                        default:
NEW
864
                                                if (!this.tryAssignCurrentValue(cell, map))
×
NEW
865
                                                {
×
NEW
866
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellTableFormat)} {this._reader.Position}.", NotificationType.None);
×
NEW
867
                                                }
×
NEW
868
                                                break;
×
869
                                }
870

871
                                if (end)
6,232!
NEW
872
                                {
×
NEW
873
                                        break;
×
874
                                }
875

876
                                this._reader.ReadNext();
6,232✔
877
                        }
6,232✔
878
                }
6,232✔
879

880
                private void readCellStyle(CadCellStyleTemplate template)
NEW
881
                {
×
882
                        //var map = DxfClassMap.Create(cell.GetType(), "CELLTABLEFORMAT");
883

NEW
884
                        this._reader.ReadNext();
×
885

NEW
886
                        bool end = false;
×
NEW
887
                        while (this._reader.Code != 1)
×
NEW
888
                        {
×
NEW
889
                                switch (this._reader.Code)
×
890
                                {
891
                                        case 309:
NEW
892
                                                end = this._reader.ValueAsString.Equals("CELLSTYLE_END", StringComparison.InvariantCultureIgnoreCase);
×
NEW
893
                                                break;
×
894
                                        default:
895
                                                //if (!this.tryAssignCurrentValue(cell, map))
NEW
896
                                                {
×
NEW
897
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellStyle)} {this._reader.Position}.", NotificationType.None);
×
NEW
898
                                                }
×
NEW
899
                                                break;
×
900
                                }
901

NEW
902
                                if (end)
×
NEW
903
                                {
×
NEW
904
                                        break;
×
905
                                }
906

NEW
907
                                this._reader.ReadNext();
×
NEW
908
                        }
×
NEW
909
                }
×
910

911
                private void readLinkedTableCell(TableEntity.Cell cell)
912
                {
6,384✔
913
                        var map = DxfClassMap.Create(cell.GetType(), "LINKEDTABLEDATACELL_BEGIN");
6,384✔
914

915
                        this._reader.ReadNext();
6,384✔
916

917
                        bool end = false;
6,384✔
918
                        while (this._reader.DxfCode != DxfCode.Start)
63,992✔
919
                        {
63,840✔
920
                                switch (this._reader.Code)
63,840✔
921
                                {
922
                                        case 95:
923
                                                //BL 95 Number of cell contents
924
                                                break;
6,232✔
925
                                        case 301 when this._reader.ValueAsString.Equals(DxfFileToken.CustomData, StringComparison.InvariantCultureIgnoreCase):
6,384✔
926
                                                this.readCustomData();
6,384✔
927
                                                break;
6,384✔
928
                                        case 302 when this._reader.ValueAsString.Equals("CONTENT", StringComparison.InvariantCultureIgnoreCase):
4,864✔
929
                                                this.readLinkedTableCellContent();
4,864✔
930
                                                break;
4,864✔
931
                                        case 309:
932
                                                end = this._reader.ValueAsString.Equals("LINKEDTABLEDATACELL_END", StringComparison.InvariantCultureIgnoreCase);
6,232✔
933
                                                break;
6,232✔
934
                                        default:
935
                                                if (!this.tryAssignCurrentValue(cell, map))
40,128✔
936
                                                {
13,832✔
937
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableCell)} {this._reader.Position}.", NotificationType.None);
13,832✔
938
                                                }
13,832✔
939
                                                break;
40,128✔
940
                                }
941

942
                                if (end)
63,840✔
943
                                {
6,232✔
944
                                        break;
6,232✔
945
                                }
946

947
                                this._reader.ReadNext();
57,608✔
948
                        }
57,608✔
949
                }
6,384✔
950

951
                private void readLinkedTableCellContent()
952
                {
4,864✔
953
                        TableEntity.CellContent content = new TableEntity.CellContent();
4,864✔
954
                        var map = DxfClassMap.Create(content.GetType(), "CONTENT");
4,864✔
955

956
                        this._reader.ReadNext();
4,864✔
957

958
                        bool end = false;
4,864✔
959
                        while (this._reader.DxfCode != DxfCode.Start)
9,728✔
960
                        {
9,728✔
961
                                switch (this._reader.Code)
9,728!
962
                                {
963
                                        case 1 when this._reader.ValueAsString.Equals("FORMATTEDCELLCONTENT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
9,728✔
964
                                                readFormattedCellContent();
4,864✔
965
                                                end = true;
4,864✔
966
                                                break;
4,864✔
967
                                        case 1 when this._reader.ValueAsString.Equals("CELLCONTENT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
4,864!
968
                                                readCellContent();
4,864✔
969
                                                break;
4,864✔
970
                                        default:
NEW
971
                                                if (!this.tryAssignCurrentValue(content, map))
×
NEW
972
                                                {
×
NEW
973
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableCellContent)} {this._reader.Position}.", NotificationType.None);
×
NEW
974
                                                }
×
NEW
975
                                                break;
×
976
                                }
977

978
                                if (end)
9,728✔
979
                                {
4,864✔
980
                                        break;
4,864✔
981
                                }
982

983
                                this._reader.ReadNext();
4,864✔
984
                        }
4,864✔
985
                }
4,864✔
986

987
                private void readCellContent()
988
                {
4,864✔
989
                        TableEntity.CellContent content = new TableEntity.CellContent();
4,864✔
990
                        var map = DxfClassMap.Create(content.GetType(), "CELLCONTENT_BEGIN");
4,864✔
991

992
                        this._reader.ReadNext();
4,864✔
993

994
                        bool end = false;
4,864✔
995
                        while (this._reader.DxfCode != DxfCode.Start)
19,456✔
996
                        {
19,456✔
997
                                switch (this._reader.Code)
19,456✔
998
                                {
999
                                        case 91:
1000
                                                break;
4,864✔
1001
                                        case 300 when this._reader.ValueAsString.Equals("VALUE", StringComparison.InvariantCultureIgnoreCase):
4,408✔
1002
                                                this.readDataMapValue();
4,408✔
1003
                                                break;
4,408✔
1004
                                        case 309:
1005
                                                end = this._reader.ValueAsString.Equals("CELLCONTENT_END", StringComparison.InvariantCultureIgnoreCase);
4,864✔
1006
                                                break;
4,864✔
1007
                                        default:
1008
                                                if (!this.tryAssignCurrentValue(content, map))
5,320✔
1009
                                                {
456✔
1010
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellContent)} {this._reader.Position}.", NotificationType.None);
456✔
1011
                                                }
456✔
1012
                                                break;
5,320✔
1013
                                }
1014

1015
                                if (end)
19,456✔
1016
                                {
4,864✔
1017
                                        break;
4,864✔
1018
                                }
1019

1020
                                this._reader.ReadNext();
14,592✔
1021
                        }
14,592✔
1022
                }
4,864✔
1023

1024
                private void readFormattedCellContent()
1025
                {
4,864✔
1026
                        TableEntity.ContentFormat format = new();
4,864✔
1027
                        CadTableCellContentFormatTemplate template = new CadTableCellContentFormatTemplate(format);
4,864✔
1028
                        var map = DxfClassMap.Create(format.GetType(), "FORMATTEDCELLCONTENT");
4,864✔
1029

1030
                        this._reader.ReadNext();
4,864✔
1031

1032
                        bool end = false;
4,864✔
1033
                        while (this._reader.DxfCode != DxfCode.Start)
14,592✔
1034
                        {
14,592✔
1035
                                switch (this._reader.Code)
14,592✔
1036
                                {
1037
                                        case 300 when this._reader.ValueAsString.Equals("CONTENTFORMAT", StringComparison.InvariantCultureIgnoreCase):
4,864✔
1038
                                                readContentFormat(template);
4,864✔
1039
                                                break;
4,864✔
1040
                                        case 309:
1041
                                                end = this._reader.ValueAsString.Equals("FORMATTEDCELLCONTENT_END", StringComparison.InvariantCultureIgnoreCase);
4,864✔
1042
                                                break;
4,864✔
1043
                                        default:
1044
                                                if (!this.tryAssignCurrentValue(format, map))
4,864!
NEW
1045
                                                {
×
NEW
1046
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedCellContent)} method.", NotificationType.None);
×
NEW
1047
                                                }
×
1048
                                                break;
4,864✔
1049
                                }
1050

1051
                                if (end)
14,592✔
1052
                                {
4,864✔
1053
                                        break;
4,864✔
1054
                                }
1055

1056
                                this._reader.ReadNext();
9,728✔
1057
                        }
9,728✔
1058
                }
4,864✔
1059

1060
                private void readContentFormat(CadTableCellContentFormatTemplate template)
1061
                {
11,248✔
1062
                        var format = template.Format;
11,248✔
1063
                        var map = DxfClassMap.Create(format.GetType(), "CONTENTFORMAT_BEGIN");
11,248✔
1064

1065
                        this._reader.ReadNext();
11,248✔
1066

1067
                        bool end = false;
11,248✔
1068
                        while (this._reader.DxfCode != DxfCode.Start)
146,224✔
1069
                        {
146,224✔
1070
                                switch (this._reader.Code)
146,224✔
1071
                                {
1072
                                        case 1 when this._reader.ValueAsString.Equals("CONTENTFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
11,248✔
1073
                                                break;
11,248✔
1074
                                        case 309:
1075
                                                end = this._reader.ValueAsString.Equals("CONTENTFORMAT_END", StringComparison.InvariantCultureIgnoreCase);
11,248✔
1076
                                                break;
11,248✔
1077
                                        case 340:
1078
                                                template.TextStyleHandle = this._reader.ValueAsHandle;
11,248✔
1079
                                                break;
11,248✔
1080
                                        default:
1081
                                                if (!this.tryAssignCurrentValue(format, map))
112,480!
NEW
1082
                                                {
×
NEW
1083
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readContentFormat)} method.", NotificationType.None);
×
NEW
1084
                                                }
×
1085
                                                break;
112,480✔
1086
                                }
1087

1088
                                if (end)
146,224✔
1089
                                {
11,248✔
1090
                                        break;
11,248✔
1091
                                }
1092

1093
                                this._reader.ReadNext();
134,976✔
1094
                        }
134,976✔
1095
                }
11,248✔
1096

1097
                private void readFormattedTableColumn(TableEntity.Column column)
1098
                {
1,444✔
1099
                        this._reader.ReadNext();
1,444✔
1100

1101
                        bool end = false;
1,444✔
1102
                        while (this._reader.DxfCode != DxfCode.Start)
4,332✔
1103
                        {
4,332✔
1104
                                switch (this._reader.Code)
4,332!
1105
                                {
1106
                                        case 300 when this._reader.ValueAsString.Equals("COLUMNTABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
1,444!
1107
                                                break;
1,444✔
1108
                                        case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
1,444!
1109
                                                this.readStyleOverride(new CadCellStyleTemplate(column.CellStyleOverride));
1,444✔
1110
                                                break;
1,444✔
1111
                                        case 309:
1112
                                                end = this._reader.ValueAsString.Equals(DxfFileToken.FormattedTableDataColumn_END, StringComparison.InvariantCultureIgnoreCase);
1,444✔
1113
                                                break;
1,444✔
1114
                                        default:
NEW
1115
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableColumn)} method.", NotificationType.None);
×
NEW
1116
                                                break;
×
1117
                                }
1118

1119
                                if (end)
4,332✔
1120
                                {
1,444✔
1121
                                        break;
1,444✔
1122
                                }
1123

1124
                                this._reader.ReadNext();
2,888✔
1125
                        }
2,888✔
1126
                }
1,444✔
1127

1128
                private void readStyleOverride(CadCellStyleTemplate template)
1129
                {
9,348✔
1130
                        var style = template.Format as TableEntity.CellStyle;
9,348✔
1131
                        var mapstyle = DxfClassMap.Create(style.GetType(), "TABLEFORMAT_BEGIN");
9,348✔
1132
                        var mapformat = DxfClassMap.Create(typeof(TableEntity.ContentFormat), "TABLEFORMAT_BEGIN");
9,348✔
1133

1134
                        this._reader.ReadNext();
9,348✔
1135

1136
                        bool end = false;
9,348✔
1137
                        TableEntity.CellEdgeFlags currBorder = TableEntity.CellEdgeFlags.Unknown;
9,348✔
1138
                        while (this._reader.DxfCode != DxfCode.Start)
103,892✔
1139
                        {
103,892✔
1140
                                switch (this._reader.Code)
103,892!
1141
                                {
1142
                                        case 95:
1143
                                                currBorder = (TableEntity.CellEdgeFlags)this._reader.ValueAsInt;
13,984✔
1144
                                                break;
13,984✔
NEW
1145
                                        case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
✔
NEW
1146
                                                break;
×
1147
                                        case 300 when this._reader.ValueAsString.Equals("CONTENTFORMAT", StringComparison.InvariantCultureIgnoreCase):
6,384✔
1148
                                                readContentFormat(new CadTableCellContentFormatTemplate(new TableEntity.ContentFormat()));
6,384✔
1149
                                                break;
6,384✔
1150
                                        case 301 when this._reader.ValueAsString.Equals("MARGIN", StringComparison.InvariantCultureIgnoreCase):
3,192✔
1151
                                                this.readCellMargin(template);
3,192✔
1152
                                                break;
3,192✔
1153
                                        case 302 when this._reader.ValueAsString.Equals("GRIDFORMAT", StringComparison.InvariantCultureIgnoreCase):
13,984✔
1154
                                                TableEntity.CellBorder border = new TableEntity.CellBorder(currBorder);
13,984✔
1155
                                                this.readGridFormat(template, border);
13,984✔
1156
                                                break;
13,984✔
1157
                                        case 309:
1158
                                                end = this._reader.ValueAsString.Equals("TABLEFORMAT_END", StringComparison.InvariantCultureIgnoreCase);
9,348✔
1159
                                                break;
9,348✔
1160
                                        default:
1161
                                                if (!this.tryAssignCurrentValue(style, mapstyle) && !this.tryAssignCurrentValue(style, mapformat))
57,000!
NEW
1162
                                                {
×
NEW
1163
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readStyleOverride)} method.", NotificationType.None);
×
NEW
1164
                                                }
×
1165
                                                break;
57,000✔
1166
                                }
1167

1168
                                if (end)
103,892✔
1169
                                {
9,348✔
1170
                                        break;
9,348✔
1171
                                }
1172

1173
                                this._reader.ReadNext();
94,544✔
1174
                        }
94,544✔
1175
                }
9,348✔
1176

1177
                private void readGridFormat(CadCellStyleTemplate template, TableEntity.CellBorder border)
1178
                {
13,984✔
1179
                        var map = DxfClassMap.Create(border.GetType(), nameof(TableEntity.CellBorder));
13,984✔
1180

1181
                        this._reader.ReadNext();
13,984✔
1182

1183
                        bool end = false;
13,984✔
1184
                        while (this._reader.DxfCode != DxfCode.Start)
125,856✔
1185
                        {
125,856✔
1186
                                switch (this._reader.Code)
125,856✔
1187
                                {
1188
                                        case 1 when this._reader.ValueAsString.Equals("GRIDFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
13,984✔
1189
                                                break;
13,984✔
1190
                                        case 340:
1191
                                                template.BorderLinetypePairs.Add(new Tuple<TableEntity.CellBorder, ulong>(border, this._reader.ValueAsHandle));
13,984✔
1192
                                                break;
13,984✔
1193
                                        case 309:
1194
                                                end = this._reader.ValueAsString.Equals("GRIDFORMAT_END", StringComparison.InvariantCultureIgnoreCase);
13,984✔
1195
                                                break;
13,984✔
1196
                                        default:
1197
                                                if (!this.tryAssignCurrentValue(border, map))
83,904!
NEW
1198
                                                {
×
NEW
1199
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readGridFormat)} method.", NotificationType.None);
×
NEW
1200
                                                }
×
1201
                                                break;
83,904✔
1202
                                }
1203

1204
                                if (end)
125,856✔
1205
                                {
13,984✔
1206
                                        break;
13,984✔
1207
                                }
1208

1209
                                this._reader.ReadNext();
111,872✔
1210
                        }
111,872✔
1211
                }
13,984✔
1212

1213
                private void readCellMargin(CadCellStyleTemplate template)
1214
                {
3,192✔
1215
                        var style = template.Format as TableEntity.CellStyle;
3,192✔
1216

1217
                        this._reader.ReadNext();
3,192✔
1218

1219
                        bool end = false;
3,192✔
1220
                        int i = 0;
3,192✔
1221
                        while (this._reader.DxfCode != DxfCode.Start)
25,536✔
1222
                        {
25,536✔
1223
                                switch (this._reader.Code)
25,536!
1224
                                {
1225
                                        case 1 when this._reader.ValueAsString.Equals("CELLMARGIN_BEGIN", StringComparison.InvariantCultureIgnoreCase):
3,192!
1226
                                                break;
3,192✔
1227
                                        case 40:
1228
                                                switch (i)
19,152✔
1229
                                                {
1230
                                                        case 0:
1231
                                                                style.VerticalMargin = this._reader.ValueAsDouble;
3,192✔
1232
                                                                break;
3,192✔
1233
                                                        case 1:
1234
                                                                style.HorizontalMargin = this._reader.ValueAsDouble;
3,192✔
1235
                                                                break;
3,192✔
1236
                                                        case 2:
1237
                                                                style.BottomMargin = this._reader.ValueAsDouble;
3,192✔
1238
                                                                break;
3,192✔
1239
                                                        case 3:
1240
                                                                style.RightMargin = this._reader.ValueAsDouble;
3,192✔
1241
                                                                break;
3,192✔
1242
                                                        case 4:
1243
                                                                style.MarginHorizontalSpacing = this._reader.ValueAsDouble;
3,192✔
1244
                                                                break;
3,192✔
1245
                                                        case 5:
1246
                                                                style.MarginVerticalSpacing = this._reader.ValueAsDouble;
3,192✔
1247
                                                                break;
3,192✔
1248
                                                }
1249

1250
                                                i++;
19,152✔
1251
                                                break;
19,152✔
1252
                                        case 309:
1253
                                                end = this._reader.ValueAsString.Equals("CELLMARGIN_END", StringComparison.InvariantCultureIgnoreCase);
3,192✔
1254
                                                break;
3,192✔
1255
                                        default:
NEW
1256
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellMargin)} method.", NotificationType.None);
×
NEW
1257
                                                break;
×
1258
                                }
1259

1260
                                if (end)
25,536✔
1261
                                {
3,192✔
1262
                                        break;
3,192✔
1263
                                }
1264

1265
                                this._reader.ReadNext();
22,344✔
1266
                        }
22,344✔
1267
                }
3,192✔
1268

1269
                private void readCustomData()
1270
                {
9,500✔
1271
                        this._reader.ReadNext();
9,500✔
1272

1273
                        int ndata = 0;
9,500✔
1274
                        bool end = false;
9,500✔
1275
                        while (this._reader.DxfCode != DxfCode.Start)
88,388✔
1276
                        {
88,236✔
1277
                                switch (this._reader.Code)
88,236✔
1278
                                {
1279
                                        case 1 when this._reader.ValueAsString.Equals("DATAMAP_BEGIN", StringComparison.InvariantCultureIgnoreCase):
9,500✔
1280
                                                break;
9,500✔
1281
                                        case 90:
1282
                                                ndata = this._reader.ValueAsInt;
9,652✔
1283
                                                break;
9,652✔
1284
                                        case 300:
1285
                                                //Name
1286
                                                break;
6,232✔
1287
                                        case 301 when this._reader.ValueAsString.Equals("DATAMAP_VALUE", StringComparison.InvariantCultureIgnoreCase):
6,232✔
1288
                                                this.readDataMapValue();
6,232✔
1289
                                                break;
6,232✔
1290
                                        case 309:
1291
                                                end = this._reader.ValueAsString.Equals("DATAMAP_END", StringComparison.InvariantCultureIgnoreCase);
9,348✔
1292
                                                break;
9,348✔
1293
                                        default:
1294
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCustomData)} method.", NotificationType.None);
47,272✔
1295
                                                break;
47,272✔
1296
                                }
1297

1298
                                if (end)
88,236✔
1299
                                {
9,348✔
1300
                                        break;
9,348✔
1301
                                }
1302

1303
                                this._reader.ReadNext();
78,888✔
1304
                        }
78,888✔
1305
                }
9,500✔
1306

1307
                private void readDataMapValue()
1308
                {
10,640✔
1309
                        TableEntity.CellValue value = new TableEntity.CellValue();
10,640✔
1310
                        var map = DxfClassMap.Create(value.GetType(), "DATAMAP_VALUE");
10,640✔
1311

1312
                        this._reader.ReadNext();
10,640✔
1313

1314
                        bool end = false;
10,640✔
1315
                        while (this._reader.DxfCode != DxfCode.Start)
392,160✔
1316
                        {
392,008✔
1317
                                switch (this._reader.Code)
392,008✔
1318
                                {
1319
                                        case 140:
1320
                                                break;
15,732✔
1321
                                        case 304:
1322
                                                end = this._reader.ValueAsString.Equals("ACVALUE_END", StringComparison.InvariantCultureIgnoreCase);
10,488✔
1323
                                                break;
10,488✔
1324
                                        default:
1325
                                                if (!this.tryAssignCurrentValue(value, map))
365,788✔
1326
                                                {
174,344✔
1327
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readDataMapValue)} method.", NotificationType.None);
174,344✔
1328
                                                }
174,344✔
1329
                                                break;
365,788✔
1330
                                }
1331

1332
                                if (end)
392,008✔
1333
                                {
10,488✔
1334
                                        break;
10,488✔
1335
                                }
1336

1337
                                this._reader.ReadNext();
381,520✔
1338
                        }
381,520✔
1339
                }
10,640✔
1340

1341
                private bool readVisualStyle(CadTemplate template, DxfMap map)
1342
                {
411,192✔
1343
                        switch (this._reader.Code)
411,192✔
1344
                        {
1345
                                // Undocumented codes
1346
                                case 176:
1347
                                case 177:
1348
                                case 420:
1349
                                        return true;
141,178✔
1350
                                default:
1351
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.VisualStyle]);
270,014✔
1352
                        }
1353
                }
411,192✔
1354

1355
                private bool readSpatialFilter(CadTemplate template, DxfMap map)
1356
                {
4,788✔
1357
                        CadSpatialFilterTemplate tmp = template as CadSpatialFilterTemplate;
4,788✔
1358
                        SpatialFilter filter = tmp.CadObject as SpatialFilter;
4,788✔
1359

1360
                        switch (this._reader.Code)
4,788✔
1361
                        {
1362
                                case 10:
1363
                                        filter.BoundaryPoints.Add(new CSMath.XY(this._reader.ValueAsDouble, 0));
456✔
1364
                                        return true;
456✔
1365
                                case 20:
1366
                                        var pt = filter.BoundaryPoints.LastOrDefault();
456✔
1367
                                        filter.BoundaryPoints.Add(new CSMath.XY(pt.X, this._reader.ValueAsDouble));
456✔
1368
                                        return true;
456✔
1369
                                case 40:
1370
                                        if (filter.ClipFrontPlane && !tmp.HasFrontPlane)
456!
1371
                                        {
×
1372
                                                filter.FrontDistance = this._reader.ValueAsDouble;
×
1373
                                                tmp.HasFrontPlane = true;
×
1374
                                        }
×
1375

1376
                                        double[] array = new double[16]
456✔
1377
                                        {
456✔
1378
                                                0.0, 0.0, 0.0, 0.0,
456✔
1379
                                                0.0, 0.0, 0.0, 0.0,
456✔
1380
                                                0.0, 0.0, 0.0, 0.0,
456✔
1381
                                                0.0, 0.0, 0.0, 1.0
456✔
1382
                                        };
456✔
1383

1384
                                        for (int i = 0; i < 12; i++)
11,856✔
1385
                                        {
5,472✔
1386
                                                array[i] = this._reader.ValueAsDouble;
5,472✔
1387

1388
                                                if (i < 11)
5,472✔
1389
                                                {
5,016✔
1390
                                                        this._reader.ReadNext();
5,016✔
1391
                                                }
5,016✔
1392
                                        }
5,472✔
1393

1394
                                        if (tmp.InsertTransformRead)
456!
1395
                                        {
×
1396
                                                filter.InsertTransform = new Matrix4(array);
×
1397
                                                tmp.InsertTransformRead = true;
×
1398
                                        }
×
1399
                                        else
1400
                                        {
456✔
1401
                                                filter.InverseInsertTransform = new Matrix4(array);
456✔
1402
                                        }
456✔
1403

1404
                                        return true;
456✔
1405
                                case 73:
1406
                                default:
1407
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.SpatialFilter]);
3,420✔
1408
                        }
1409
                }
4,788✔
1410

1411
                private bool readMLeaderStyle(CadTemplate template, DxfMap map)
1412
                {
21,648✔
1413
                        var tmp = template as CadMLeaderStyleTemplate;
21,648✔
1414

1415
                        switch (this._reader.Code)
21,648✔
1416
                        {
1417
                                case 179:
1418
                                        return true;
242✔
1419
                                case 340:
1420
                                        tmp.LeaderLineTypeHandle = this._reader.ValueAsHandle;
472✔
1421
                                        return true;
472✔
1422
                                case 342:
1423
                                        tmp.MTextStyleHandle = this._reader.ValueAsHandle;
472✔
1424
                                        return true;
472✔
1425
                                default:
1426
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
20,462✔
1427
                        }
1428
                }
21,648✔
1429

1430
                private bool readXRecord(CadTemplate template, DxfMap map)
1431
                {
71,640✔
1432
                        CadXRecordTemplate tmp = template as CadXRecordTemplate;
71,640✔
1433

1434
                        switch (this._reader.Code)
71,640✔
1435
                        {
1436
                                case 100 when this._reader.ValueAsString == DxfSubclassMarker.XRecord:
18,632✔
1437
                                        this.readXRecordEntries(tmp);
18,632✔
1438
                                        return true;
18,632✔
1439
                                default:
1440
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.XRecord]);
53,008✔
1441
                        }
1442
                }
71,640✔
1443

1444
                private void readXRecordEntries(CadXRecordTemplate template)
1445
                {
18,632✔
1446
                        this._reader.ReadNext();
18,632✔
1447

1448
                        while (this._reader.DxfCode != DxfCode.Start)
993,532✔
1449
                        {
974,900✔
1450
                                switch (this._reader.GroupCodeValue)
974,900!
1451
                                {
1452
                                        case GroupCodeValueType.Handle:
1453
                                                template.AddHandleReference(this._reader.Code, this._reader.ValueAsHandle);
×
1454
                                                break;
×
1455
                                        default:
1456
                                                template.CadObject.CreateEntry(this._reader.Code, this._reader.Value);
974,900✔
1457
                                                break;
974,900✔
1458
                                }
1459

1460
                                this._reader.ReadNext();
974,900✔
1461
                        }
974,900✔
1462
                }
18,632✔
1463

1464
                private bool readBookColor(CadTemplate template, DxfMap map)
1465
                {
1,634✔
1466
                        CadNonGraphicalObjectTemplate tmp = template as CadNonGraphicalObjectTemplate;
1,634✔
1467
                        BookColor color = tmp.CadObject as BookColor;
1,634✔
1468

1469
                        switch (this._reader.Code)
1,634✔
1470
                        {
1471
                                case 430:
1472
                                        color.Name = this._reader.ValueAsString;
190✔
1473
                                        return true;
190✔
1474
                                default:
1475
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.DbColor]);
1,444✔
1476
                        }
1477
                }
1,634✔
1478

1479
                private bool readDictionary(CadTemplate template, DxfMap map)
1480
                {
220,727✔
1481
                        CadDictionaryTemplate tmp = template as CadDictionaryTemplate;
220,727✔
1482
                        CadDictionary cadDictionary = tmp.CadObject;
220,727✔
1483

1484
                        switch (this._reader.Code)
220,727✔
1485
                        {
1486
                                case 280:
1487
                                        cadDictionary.HardOwnerFlag = this._reader.ValueAsBool;
16,007✔
1488
                                        return true;
16,007✔
1489
                                case 281:
1490
                                        cadDictionary.ClonningFlags = (DictionaryCloningFlags)this._reader.Value;
23,606✔
1491
                                        return true;
23,606✔
1492
                                case 3:
1493
                                        tmp.Entries.Add(this._reader.ValueAsString, null);
50,227✔
1494
                                        return true;
50,227✔
1495
                                case 350: // Soft-owner ID/handle to entry object 
1496
                                case 360: // Hard-owner ID/handle to entry object
1497
                                        tmp.Entries[tmp.Entries.LastOrDefault().Key] = this._reader.ValueAsHandle;
50,227✔
1498
                                        return true;
50,227✔
1499
                                default:
1500
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Dictionary]);
80,660✔
1501
                        }
1502
                }
220,727✔
1503

1504
                private bool readDictionaryWithDefault(CadTemplate template, DxfMap map)
1505
                {
2,070✔
1506
                        CadDictionaryWithDefaultTemplate tmp = template as CadDictionaryWithDefaultTemplate;
2,070✔
1507

1508
                        switch (this._reader.Code)
2,070✔
1509
                        {
1510
                                case 340:
1511
                                        tmp.DefaultEntryHandle = this._reader.ValueAsHandle;
230✔
1512
                                        return true;
230✔
1513
                                default:
1514
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.DictionaryWithDefault]))
1,840!
1515
                                        {
1,840✔
1516
                                                return this.readDictionary(template, map);
1,840✔
1517
                                        }
1518
                                        return true;
×
1519
                        }
1520
                }
2,070✔
1521

1522
                private CadTemplate readSortentsTable()
1523
                {
684✔
1524
                        SortEntitiesTable sortTable = new SortEntitiesTable();
684✔
1525
                        CadSortensTableTemplate template = new CadSortensTableTemplate(sortTable);
684✔
1526

1527
                        //Jump the 0 marker
1528
                        this._reader.ReadNext();
684✔
1529

1530
                        this.readCommonObjectData(template);
684✔
1531

1532
                        System.Diagnostics.Debug.Assert(DxfSubclassMarker.SortentsTable == this._reader.ValueAsString);
684✔
1533

1534
                        //Jump the 100 marker
1535
                        this._reader.ReadNext();
684✔
1536

1537
                        (ulong?, ulong?) pair = (null, null);
684✔
1538

1539
                        while (this._reader.DxfCode != DxfCode.Start)
5,016✔
1540
                        {
4,332✔
1541
                                switch (this._reader.Code)
4,332!
1542
                                {
1543
                                        case 5:
1544
                                                pair.Item1 = this._reader.ValueAsHandle;
1,824✔
1545
                                                break;
1,824✔
1546
                                        case 330:
1547
                                                template.BlockOwnerHandle = this._reader.ValueAsHandle;
684✔
1548
                                                break;
684✔
1549
                                        case 331:
1550
                                                pair.Item2 = this._reader.ValueAsHandle;
1,824✔
1551
                                                break;
1,824✔
1552
                                        default:
1553
                                                this._builder.Notify($"Group Code not handled {this._reader.GroupCodeValue} for {typeof(SortEntitiesTable)}, code : {this._reader.Code} | value : {this._reader.ValueAsString}");
×
1554
                                                break;
×
1555
                                }
1556

1557
                                if (pair.Item1.HasValue && pair.Item2.HasValue)
4,332✔
1558
                                {
1,824✔
1559
                                        template.Values.Add((pair.Item1.Value, pair.Item2.Value));
1,824✔
1560
                                        pair = (null, null);
1,824✔
1561
                                }
1,824✔
1562

1563
                                this._reader.ReadNext();
4,332✔
1564
                        }
4,332✔
1565

1566
                        return template;
684✔
1567
                }
684✔
1568
        }
1569
}
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