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

DomCR / ACadSharp / 22711149797

05 Mar 2026 09:24AM UTC coverage: 76.651% (-0.02%) from 76.673%
22711149797

Pull #895

github

web-flow
Merge 8498cb17c into f2f8e99ec
Pull Request #895: Issue 536 dimassoc object

8363 of 11856 branches covered (70.54%)

Branch coverage included in aggregate %.

193 of 276 new or added lines in 9 files covered. (69.93%)

2 existing lines in 1 file now uncovered.

30101 of 38325 relevant lines covered (78.54%)

149252.89 hits per line

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

81.34
/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.Collections.Generic;
9
using System.Diagnostics;
10
using System.IO;
11
using System.Linq;
12
using static ACadSharp.IO.Templates.CadEvaluationGraphTemplate;
13
using static ACadSharp.IO.Templates.CadTableEntityTemplate;
14

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

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

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

31
                        //Loop until the section ends
32
                        while (this._reader.ValueAsString != DxfFileToken.EndSection)
77,599✔
33
                        {
77,390✔
34
                                CadTemplate template = null;
77,390✔
35

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

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

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

51
                                if (template == null)
77,390✔
52
                                        continue;
×
53

54
                                //Add the object and the template to the builder
55
                                this._builder.AddTemplate(template);
77,390✔
56
                        }
77,390✔
57
                }
209✔
58

59
                private CadTemplate readObject()
60
                {
77,390✔
61
                        this.currentSubclass = string.Empty;
77,390✔
62
                        switch (this._reader.ValueAsString)
77,390!
63
                        {
64
                                case DxfFileToken.BlkRefObjectContextData:
65
                                        return this.readObjectCodes<BlockReferenceObjectContextData>(new CadAnnotScaleObjectContextDataTemplate(new BlockReferenceObjectContextData()), this.readAnnotScaleObjectContextData);
×
66
                                case DxfFileToken.MTextAttributeObjectContextData:
67
                                        return this.readObjectCodes<MTextAttributeObjectContextData>(new CadAnnotScaleObjectContextDataTemplate(new MTextAttributeObjectContextData()), this.readAnnotScaleObjectContextData);
×
68
                                case DxfFileToken.ObjectPlaceholder:
69
                                        return this.readObjectCodes<AcdbPlaceHolder>(new CadNonGraphicalObjectTemplate(new AcdbPlaceHolder()), this.readObjectSubclassMap);
197✔
70
                                case DxfFileToken.ObjectDBColor:
71
                                        return this.readObjectCodes<BookColor>(new CadNonGraphicalObjectTemplate(new BookColor()), this.readBookColor);
192✔
72
                                case DxfFileToken.ObjectDimensionAssociation:
73
                                        return this.readObjectCodes<DimensionAssociation>(new CadDimensionAssociationTemplate(), this.readDimensionAssociation);
576✔
74
                                case DxfFileToken.ObjectDictionary:
75
                                        return this.readObjectCodes<CadDictionary>(new CadDictionaryTemplate(), this.readDictionary);
21,325✔
76
                                case DxfFileToken.ObjectDictionaryWithDefault:
77
                                        return this.readObjectCodes<CadDictionaryWithDefault>(new CadDictionaryWithDefaultTemplate(), this.readDictionaryWithDefault);
197✔
78
                                case DxfFileToken.ObjectLayout:
79
                                        return this.readObjectCodes<Layout>(new CadLayoutTemplate(), this.readLayout);
807✔
80
                                case DxfFileToken.ObjectPlotSettings:
81
                                        return this.readObjectCodes<PlotSettings>(new CadNonGraphicalObjectTemplate(new PlotSettings()), this.readPlotSettings);
×
82
                                case DxfFileToken.ObjectEvalGraph:
83
                                        return this.readObjectCodes<EvaluationGraph>(new CadEvaluationGraphTemplate(), this.readEvaluationGraph);
451✔
84
                                case DxfFileToken.ObjectImageDefinition:
85
                                        return this.readObjectCodes<ImageDefinition>(new CadNonGraphicalObjectTemplate(new ImageDefinition()), this.readObjectSubclassMap);
192✔
86
                                case DxfFileToken.ObjectDictionaryVar:
87
                                        return this.readObjectCodes<DictionaryVariable>(new CadTemplate<DictionaryVariable>(new DictionaryVariable()), this.readObjectSubclassMap);
2,814✔
88
                                case DxfFileToken.ObjectPdfDefinition:
89
                                        return this.readObjectCodes<PdfUnderlayDefinition>(new CadNonGraphicalObjectTemplate(new PdfUnderlayDefinition()), this.readObjectSubclassMap);
192✔
90
                                case DxfFileToken.ObjectSortEntsTable:
91
                                        return this.readSortentsTable();
576✔
92
                                case DxfFileToken.ObjectImageDefinitionReactor:
93
                                        return this.readObjectCodes<ImageDefinitionReactor>(new CadNonGraphicalObjectTemplate(new ImageDefinitionReactor()), this.readObjectSubclassMap);
192✔
94
                                case DxfFileToken.ObjectProxyObject:
95
                                        return this.readObjectCodes<ProxyObject>(new CadProxyObjectTemplate(), this.readProxyObject);
×
96
                                case DxfFileToken.ObjectRasterVariables:
97
                                        return this.readObjectCodes<RasterVariables>(new CadNonGraphicalObjectTemplate(new RasterVariables()), this.readObjectSubclassMap);
192✔
98
                                case DxfFileToken.ObjectGroup:
99
                                        return this.readObjectCodes<Group>(new CadGroupTemplate(), this.readGroup);
384✔
100
                                case DxfFileToken.ObjectGeoData:
101
                                        return this.readObjectCodes<GeoData>(new CadGeoDataTemplate(), this.readGeoData);
2✔
102
                                case DxfFileToken.ObjectMaterial:
103
                                        return this.readObjectCodes<Material>(new CadMaterialTemplate(), this.readMaterial);
2,127✔
104
                                case DxfFileToken.ObjectScale:
105
                                        return this.readObjectCodes<Scale>(new CadTemplate<Scale>(new Scale()), this.readScale);
6,705✔
106
                                case DxfFileToken.ObjectTableContent:
107
                                        return this.readObjectCodes<TableContent>(new CadTableContentTemplate(), this.readTableContent);
320✔
108
                                case DxfFileToken.ObjectVisualStyle:
109
                                        return this.readObjectCodes<VisualStyle>(new CadTemplate<VisualStyle>(new VisualStyle()), this.readVisualStyle);
4,728✔
110
                                case DxfFileToken.ObjectSpatialFilter:
111
                                        return this.readObjectCodes<SpatialFilter>(new CadSpatialFilterTemplate(), this.readSpatialFilter);
192✔
112
                                case DxfFileToken.ObjectMLineStyle:
113
                                        return this.readObjectCodes<MLineStyle>(new CadMLineStyleTemplate(), this.readMLineStyle);
209✔
114
                                case DxfFileToken.ObjectMLeaderStyle:
115
                                        return this.readObjectCodes<MultiLeaderStyle>(new CadMLeaderStyleTemplate(), this.readMLeaderStyle);
406✔
116
                                case DxfFileToken.ObjectTableStyle:
117
                                        return this.readObjectCodes<TableStyle>(new CadTableStyleTemplate(), this.readTableStyle);
197✔
118
                                case DxfFileToken.ObjectXRecord:
119
                                        return this.readObjectCodes<XRecord>(new CadXRecordTemplate(), this.readXRecord);
28,926✔
120
                                case DxfFileToken.ObjectBlockRepresentationData:
121
                                        return this.readObjectCodes<BlockRepresentationData>(new CadBlockRepresentationDataTemplate(), this.readBlockRepresentationData);
265✔
122
                                case DxfFileToken.ObjectBlockGripLocationComponent:
123
                                        return this.readObjectCodes<BlockGripExpression>(new CadBlockGripExpressionTemplate(), this.readBlockGripExpression);
1,158✔
124
                                case DxfFileToken.ObjectBlockVisibilityGrip:
125
                                        return this.readObjectCodes<BlockVisibilityGrip>(new CadBlockVisibilityGripTemplate(), this.readBlockVisibilityGrip);
193✔
126
                                case DxfFileToken.ObjectBlockVisibilityParameter:
127
                                        return this.readObjectCodes<BlockVisibilityParameter>(new CadBlockVisibilityParameterTemplate(), this.readBlockVisibilityParameter);
193✔
128
                                case DxfFileToken.ObjectBlockRotationParameter:
129
                                        return this.readObjectCodes<BlockRotationParameter>(new CadBlockRotationParameterTemplate(), this.readBlockRotationParameter);
1✔
130
                                case DxfFileToken.ObjectBlockRotationGrip:
131
                                        return this.readObjectCodes<BlockRotationGrip>(new CadBlockRotationGripTemplate(), this.readBlockRotationGrip);
1✔
132
                                case DxfFileToken.ObjectBlockRotateAction:
133
                                        return this.readObjectCodes<BlockRotationAction>(new CadBlockRotationActionTemplate(), this.readBlockRotationAction);
1✔
134
                                case DxfFileToken.ObjectField:
135
                                        return this.readObjectCodes<Field>(new CadFieldTemplate(new Field()), this.readField);
×
136
                                case DxfFileToken.ObjectFieldList:
137
                                        return this.readObjectCodes<FieldList>(new CadFieldListTemplate(new FieldList()), this.readFieldList);
×
138
                                default:
139
                                        DxfMap map = DxfMap.Create<CadObject>();
3,479✔
140
                                        CadUnknownNonGraphicalObjectTemplate unknownEntityTemplate = null;
3,479✔
141
                                        if (this._builder.DocumentToBuild.Classes.TryGetByName(this._reader.ValueAsString, out Classes.DxfClass dxfClass))
3,479!
142
                                        {
3,479✔
143
                                                this._builder.Notify($"NonGraphicalObject not supported read as an UnknownNonGraphicalObject: {this._reader.ValueAsString}", NotificationType.NotImplemented);
3,479✔
144
                                                unknownEntityTemplate = new CadUnknownNonGraphicalObjectTemplate(new UnknownNonGraphicalObject(dxfClass));
3,479✔
145
                                        }
3,479✔
146
                                        else
147
                                        {
×
148
                                                this._builder.Notify($"UnknownNonGraphicalObject not supported: {this._reader.ValueAsString}", NotificationType.NotImplemented);
×
149
                                        }
×
150

151
                                        this._reader.ReadNext();
3,479✔
152

153
                                        do
154
                                        {
239,583✔
155
                                                if (unknownEntityTemplate != null && this._builder.KeepUnknownEntities)
239,583!
156
                                                {
29,040✔
157
                                                        this.readCommonCodes(unknownEntityTemplate, out bool isExtendedData, map);
29,040✔
158
                                                        if (isExtendedData)
29,040✔
159
                                                                continue;
24✔
160
                                                }
29,016✔
161

162
                                                this._reader.ReadNext();
239,559✔
163
                                        }
239,559✔
164
                                        while (this._reader.DxfCode != DxfCode.Start);
239,583✔
165

166
                                        return unknownEntityTemplate;
3,479✔
167
                        }
168
                }
77,390✔
169

170
                protected CadTemplate readObjectCodes<T>(CadTemplate template, ReadObjectDelegate<T> readObject)
171
                        where T : CadObject
172
                {
73,335✔
173
                        this._reader.ReadNext();
73,335✔
174

175
                        DxfMap map = DxfMap.Create<T>();
73,335✔
176

177
                        while (this._reader.DxfCode != DxfCode.Start)
1,049,091✔
178
                        {
975,756✔
179
                                if (!readObject(template, map))
975,756✔
180
                                {
236,237✔
181
                                        this.readCommonCodes(template, out bool isExtendedData, map);
236,237✔
182
                                        if (isExtendedData)
236,237✔
183
                                                continue;
2,985✔
184
                                }
233,252✔
185

186
                                if (this.lockPointer)
972,771✔
187
                                {
2,566✔
188
                                        this.lockPointer = false;
2,566✔
189
                                        continue;
2,566✔
190
                                }
191

192
                                if (this._reader.DxfCode != DxfCode.Start)
970,205✔
193
                                {
941,279✔
194
                                        this._reader.ReadNext();
941,279✔
195
                                }
941,279✔
196
                        }
970,205✔
197

198
                        return template;
73,335✔
199
                }
73,335✔
200

201
                private bool readFieldList(CadTemplate template, DxfMap map)
202
                {
×
203
                        var tmp = template as CadFieldListTemplate;
×
204

205
                        switch (this._reader.Code)
×
206
                        {
207
                                case 100 when this._reader.ValueAsString == DxfSubclassMarker.IdSet:
×
208
                                        this.currentSubclass = this._reader.ValueAsString;
×
209
                                        return true;
×
210
                                case 90 when this.currentSubclass == DxfSubclassMarker.IdSet:
×
211
                                        return true;
×
212
                                case 330 when this.currentSubclass == DxfSubclassMarker.IdSet:
×
213
                                        tmp.OwnedObjectsHandlers.Add(this._reader.ValueAsHandle);
×
214
                                        return true;
×
215
                                default:
216
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.FieldList]);
×
217
                        }
218
                }
×
219

220
                private bool readField(CadTemplate template, DxfMap map)
221
                {
×
222
                        var tmp = template as CadFieldTemplate;
×
223

224
                        switch (this._reader.Code)
×
225
                        {
226
                                case 3:
227
                                        tmp.CadObject.FieldCode += this._reader.ValueAsString;
×
228
                                        return true;
×
229
                                //98 Length of format string
230
                                case 98:
231
                                        return true;
×
232
                                case 6:
233
                                        string key = this._reader.ValueAsString;
×
234
                                        var t = this.readCadValue(this._reader.ValueAsString);
×
235
                                        tmp.CadObject.Values.Add(key, t.CadValue);
×
236
                                        tmp.CadValueTemplates.Add(t);
×
237
                                        return true;
×
238
                                case 7:
239
                                        t = this.readCadValue(this._reader.ValueAsString);
×
240
                                        tmp.CadObject.Value = t.CadValue;
×
241
                                        tmp.CadValueTemplates.Add(t);
×
242
                                        return true;
×
243
                                case 331:
244
                                        tmp.CadObjectsHandles.Add(this._reader.ValueAsHandle);
×
245
                                        return true;
×
246
                                case 360:
247
                                        tmp.ChildrenHandles.Add(this._reader.ValueAsHandle);
×
248
                                        return true;
×
249
                                default:
250
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Field]);
×
251
                        }
252
                }
×
253

254
                private CadValueTemplate readCadValue(string name)
255
                {
×
256
                        this._reader.ReadNext();
×
257

258
                        CadValue value = new();
×
259
                        CadValueTemplate template = new(value);
×
260
                        var map = DxfClassMap.Create(value.GetType(), name);
×
261

262
                        while (this._reader.Code != 304)
×
263
                        {
×
264
                                switch (this._reader.Code)
×
265
                                {
266
                                        case 11:
267
                                                XYZ xyz = new XYZ();
×
268
                                                xyz.X = this._reader.ValueAsDouble;
×
269
                                                this._reader.ReadNext();
×
270
                                                xyz.Y = this._reader.ValueAsDouble;
×
271
                                                this._reader.ReadNext();
×
272
                                                xyz.Z = this._reader.ValueAsDouble;
×
273

274
                                                value.Value = xyz;
×
275
                                                break;
×
276
                                        case 91:
277
                                                value.Value = this._reader.ValueAsInt;
×
278
                                                break;
×
279
                                        case 140:
280
                                                value.Value = this._reader.ValueAsDouble;
×
281
                                                break;
×
282
                                        case 330:
283
                                                template.ValueHandle = this._reader.ValueAsHandle;
×
284
                                                break;
×
285
                                        default:
286
                                                if (!this.tryAssignCurrentValue(value, map))
×
287
                                                {
×
288
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCadValue)} method.", NotificationType.None);
×
289
                                                }
×
290
                                                break;
×
291
                                }
292

293
                                this._reader.ReadNext();
×
294
                        }
×
295

296
                        return template;
×
297
                }
×
298

299
                private bool readProxyObject(CadTemplate template, DxfMap map)
300
                {
×
301
                        CadProxyObjectTemplate tmp = template as CadProxyObjectTemplate;
×
302
                        ProxyObject proxy = template.CadObject as ProxyObject;
×
303

304
                        switch (this._reader.Code)
×
305
                        {
306
                                case 90:
307
                                case 94:
308
                                //Undocumented
309
                                case 97:
310
                                case 71:
311
                                        return true;
×
312
                                case 95:
313
                                        int format = this._reader.ValueAsInt;
×
314
                                        proxy.Version = (ACadVersion)(format & 0xFFFF);
×
315
                                        proxy.MaintenanceVersion = (short)(format >> 16);
×
316
                                        return true;
×
317
                                case 91:
318
                                        var classId = this._reader.ValueAsShort;
×
319
                                        if (this._builder.DocumentToBuild.Classes.TryGetByClassNumber(classId, out DxfClass dxfClass))
×
320
                                        {
×
321
                                                proxy.DxfClass = dxfClass;
×
322
                                        }
×
323
                                        return true;
×
324
                                case 161:
325
                                        return true;
×
326
                                case 162:
327
                                        return true;
×
328
                                case 310:
329
                                        if (proxy.BinaryData == null)
×
330
                                        {
×
331
                                                proxy.BinaryData = new MemoryStream();
×
332
                                        }
×
333
                                        proxy.BinaryData.Write(this._reader.ValueAsBinaryChunk, 0, this._reader.ValueAsBinaryChunk.Length);
×
334
                                        return true;
×
335
                                case 311:
336
                                        if (proxy.Data == null)
×
337
                                        {
×
338
                                                proxy.Data = new MemoryStream();
×
339
                                        }
×
340
                                        proxy.Data.Write(this._reader.ValueAsBinaryChunk, 0, this._reader.ValueAsBinaryChunk.Length);
×
341
                                        return true;
×
342
                                case 330:
343
                                case 340:
344
                                case 350:
345
                                case 360:
346
                                        tmp.Entries.Add(this._reader.ValueAsHandle);
×
347
                                        return true;
×
348
                                default:
349
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.ProxyObject]);
×
350
                        }
351
                }
×
352

353
                private bool readObjectSubclassMap(CadTemplate template, DxfMap map)
354
                {
23,355✔
355
                        switch (this._reader.Code)
23,355✔
356
                        {
357
                                default:
358
                                        if (string.IsNullOrEmpty(this.currentSubclass))
23,355✔
359
                                        {
14,655✔
360
                                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
14,655✔
361
                                        }
362
                                        else
363
                                        {
8,700✔
364
                                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[this.currentSubclass]);
8,700✔
365
                                        }
366
                        }
367
                }
23,355✔
368

369
                private bool readAnnotScaleObjectContextData(CadTemplate template, DxfMap map)
370
                {
×
371
                        var tmp = template as CadAnnotScaleObjectContextDataTemplate;
×
372
                        switch (this._reader.Code)
×
373
                        {
374
                                case 340:
375
                                        tmp.ScaleHandle = this._reader.ValueAsHandle;
×
376
                                        return true;
×
377
                                default:
378
                                        if (string.IsNullOrEmpty(this.currentSubclass))
×
379
                                        {
×
380
                                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
×
381
                                        }
382
                                        else
383
                                        {
×
384
                                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[this.currentSubclass]);
×
385
                                        }
386
                        }
387
                }
×
388

389
                private bool readPlotSettings(CadTemplate template, DxfMap map)
390
                {
26,341✔
391
                        switch (this._reader.Code)
26,341✔
392
                        {
393
                                default:
394
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.PlotSettings]);
26,341✔
395
                        }
396
                }
26,341✔
397

398
                private bool readEvaluationGraph(CadTemplate template, DxfMap map)
399
                {
3,096✔
400
                        CadEvaluationGraphTemplate tmp = template as CadEvaluationGraphTemplate;
3,096✔
401
                        EvaluationGraph evGraph = tmp.CadObject;
3,096✔
402

403
                        switch (this._reader.Code)
3,096✔
404
                        {
405
                                case 91:
406
                                        while (this._reader.Code == 91)
3,025✔
407
                                        {
2,574✔
408
                                                GraphNodeTemplate nodeTemplate = new GraphNodeTemplate();
2,574✔
409
                                                EvaluationGraph.Node node = nodeTemplate.Node;
2,574✔
410

411
                                                node.Index = this._reader.ValueAsInt;
2,574✔
412

413
                                                this._reader.ExpectedCode(93);
2,574✔
414
                                                node.Flags = this._reader.ValueAsInt;
2,574✔
415

416
                                                this._reader.ExpectedCode(95);
2,574✔
417
                                                node.NextNodeIndex = this._reader.ValueAsInt;
2,574✔
418

419
                                                this._reader.ExpectedCode(360);
2,574✔
420
                                                nodeTemplate.ExpressionHandle = this._reader.ValueAsHandle;
2,574✔
421

422
                                                this._reader.ExpectedCode(92);
2,574✔
423
                                                node.Data1 = this._reader.ValueAsInt;
2,574✔
424
                                                this._reader.ExpectedCode(92);
2,574✔
425
                                                node.Data2 = this._reader.ValueAsInt;
2,574✔
426
                                                this._reader.ExpectedCode(92);
2,574✔
427
                                                node.Data3 = this._reader.ValueAsInt;
2,574✔
428
                                                this._reader.ExpectedCode(92);
2,574✔
429
                                                node.Data4 = this._reader.ValueAsInt;
2,574✔
430

431
                                                this._reader.ReadNext();
2,574✔
432

433
                                                tmp.NodeTemplates.Add(nodeTemplate);
2,574✔
434
                                        }
2,574✔
435

436
                                        this.lockPointer = true;
451✔
437
                                        return true;
451✔
438
                                case 92:
439
                                        //Edges
440
                                        while (this._reader.Code == 92)
2,126✔
441
                                        {
1,931✔
442
                                                this._reader.ExpectedCode(93);
1,931✔
443
                                                this._reader.ExpectedCode(94);
1,931✔
444
                                                this._reader.ExpectedCode(91);
1,931✔
445
                                                this._reader.ExpectedCode(91);
1,931✔
446
                                                this._reader.ExpectedCode(92);
1,931✔
447
                                                this._reader.ExpectedCode(92);
1,931✔
448
                                                this._reader.ExpectedCode(92);
1,931✔
449
                                                this._reader.ExpectedCode(92);
1,931✔
450
                                                this._reader.ExpectedCode(92);
1,931✔
451

452
                                                this._reader.ReadNext();
1,931✔
453
                                        }
1,931✔
454

455
                                        this.lockPointer = true;
195✔
456
                                        return true;
195✔
457
                                default:
458
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.EvalGraph]);
2,450✔
459
                        }
460
                }
3,096✔
461

462
                private bool readLayout(CadTemplate template, DxfMap map)
463
                {
51,979✔
464
                        CadLayoutTemplate tmp = template as CadLayoutTemplate;
51,979✔
465

466
                        switch (this._reader.Code)
51,979✔
467
                        {
468
                                case 330 when template.OwnerHandle.HasValue:
1,614✔
469
                                        tmp.PaperSpaceBlockHandle = this._reader.ValueAsHandle;
807✔
470
                                        return true;
807✔
471
                                case 331:
472
                                        tmp.LasActiveViewportHandle = (this._reader.ValueAsHandle);
773✔
473
                                        return true;
773✔
474
                                default:
475
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Layout]))
50,399✔
476
                                        {
26,341✔
477
                                                return this.readPlotSettings(template, map);
26,341✔
478
                                        }
479
                                        return true;
24,058✔
480
                        }
481
                }
51,979✔
482

483
                private bool readGroup(CadTemplate template, DxfMap map)
484
                {
4,992✔
485
                        CadGroupTemplate tmp = template as CadGroupTemplate;
4,992✔
486

487
                        switch (this._reader.Code)
4,992✔
488
                        {
489
                                case 70:
490
                                        return true;
384✔
491
                                case 340:
492
                                        tmp.Handles.Add(this._reader.ValueAsHandle);
2,304✔
493
                                        return true;
2,304✔
494
                                default:
495
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
2,304✔
496
                        }
497
                }
4,992✔
498

499
                private bool readGeoData(CadTemplate template, DxfMap map)
500
                {
102✔
501
                        CadGeoDataTemplate tmp = template as CadGeoDataTemplate;
102✔
502

503
                        switch (this._reader.Code)
102✔
504
                        {
505
                                case 40 when tmp.CadObject.Version == GeoDataVersion.R2009:
2✔
506
                                        tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
507
                                                tmp.CadObject.ReferencePoint.X,
1✔
508
                                                this._reader.ValueAsDouble,
1✔
509
                                                tmp.CadObject.ReferencePoint.Z
1✔
510
                                                );
1✔
511
                                        return true;
1✔
512
                                case 41 when tmp.CadObject.Version == GeoDataVersion.R2009:
2✔
513
                                        tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
514
                                                this._reader.ValueAsDouble,
1✔
515
                                                tmp.CadObject.ReferencePoint.Y,
1✔
516
                                                tmp.CadObject.ReferencePoint.Z
1✔
517
                                                );
1✔
518
                                        return true;
1✔
519
                                case 42 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
520
                                        tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
521
                                                tmp.CadObject.ReferencePoint.X,
1✔
522
                                                tmp.CadObject.ReferencePoint.Y,
1✔
523
                                                this._reader.ValueAsDouble
1✔
524
                                                );
1✔
525
                                        return true;
1✔
526
                                case 46 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
527
                                        tmp.CadObject.HorizontalUnitScale = this._reader.ValueAsDouble;
1✔
528
                                        return true;
1✔
529
                                case 52 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
530
                                        double angle = System.Math.PI / 2.0 - this._reader.ValueAsAngle;
1✔
531
                                        tmp.CadObject.NorthDirection = new CSMath.XY(Math.Cos(angle), Math.Sin(angle));
1✔
532
                                        return true;
1✔
533
                                // Number of Geo-Mesh points
534
                                case 93:
535
                                        var npts = this._reader.ValueAsInt;
3✔
536
                                        for (int i = 0; i < npts; i++)
54✔
537
                                        {
24✔
538
                                                this._reader.ReadNext();
24✔
539
                                                double sourceX = this._reader.ValueAsDouble;
24✔
540
                                                this._reader.ReadNext();
24✔
541
                                                double sourceY = this._reader.ValueAsDouble;
24✔
542

543
                                                this._reader.ReadNext();
24✔
544
                                                double destX = this._reader.ValueAsDouble;
24✔
545
                                                this._reader.ReadNext();
24✔
546
                                                double destY = this._reader.ValueAsDouble;
24✔
547

548
                                                tmp.CadObject.Points.Add(new GeoData.GeoMeshPoint
24✔
549
                                                {
24✔
550
                                                        Source = new CSMath.XY(sourceX, sourceY),
24✔
551
                                                        Destination = new CSMath.XY(destX, destY)
24✔
552
                                                });
24✔
553
                                        }
24✔
554
                                        return true;
3✔
555
                                // Number of Geo-Mesh points
556
                                case 96:
557
                                        var nfaces = this._reader.ValueAsInt;
2✔
558
                                        for (int i = 0; i < nfaces; i++)
4!
559
                                        {
×
560
                                                this._reader.ReadNext();
×
561
                                                Debug.Assert(this._reader.Code == 97);
×
562
                                                int index1 = this._reader.ValueAsInt;
×
563
                                                this._reader.ReadNext();
×
564
                                                Debug.Assert(this._reader.Code == 98);
×
565
                                                int index2 = this._reader.ValueAsInt;
×
566
                                                this._reader.ReadNext();
×
567
                                                Debug.Assert(this._reader.Code == 99);
×
568
                                                int index3 = this._reader.ValueAsInt;
×
569

570
                                                tmp.CadObject.Faces.Add(new GeoData.GeoMeshFace
×
571
                                                {
×
572
                                                        Index1 = index1,
×
573
                                                        Index2 = index2,
×
574
                                                        Index3 = index3
×
575
                                                });
×
576
                                        }
×
577
                                        return true;
2✔
578
                                case 303:
579
                                        tmp.CadObject.CoordinateSystemDefinition += this._reader.ValueAsString;
13✔
580
                                        return true;
13✔
581
                                //Obsolete codes for version GeoDataVersion.R2009
582
                                case 3:
583
                                case 4:
584
                                case 14:
585
                                case 24:
586
                                case 15:
587
                                case 25:
588
                                case 43:
589
                                case 44:
590
                                case 45:
591
                                case 94:
592
                                case 293:
593
                                case 16:
594
                                case 26:
595
                                case 17:
596
                                case 27:
597
                                case 54:
598
                                case 140:
599
                                case 304:
600
                                case 292:
601
                                        return true;
19✔
602
                                default:
603
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
60✔
604
                        }
605
                }
102✔
606

607
                private bool readMaterial(CadTemplate template, DxfMap map)
608
                {
42,114✔
609
                        CadMaterialTemplate tmp = template as CadMaterialTemplate;
42,114✔
610
                        List<double> arr = null;
42,114✔
611

612
                        switch (this._reader.Code)
42,114!
613
                        {
614
                                case 43:
615
                                        arr = new();
1,349✔
616
                                        for (int i = 0; i < 16; i++)
45,866✔
617
                                        {
21,584✔
618
                                                Debug.Assert(this._reader.Code == 43);
21,584✔
619

620
                                                arr.Add(this._reader.ValueAsDouble);
21,584✔
621

622
                                                this._reader.ReadNext();
21,584✔
623
                                        }
21,584✔
624

625
                                        tmp.CadObject.DiffuseMatrix = new CSMath.Matrix4(arr.ToArray());
1,349✔
626
                                        return this.checkObjectEnd(template, map, this.readMaterial);
1,349✔
627
                                case 47:
628
                                        arr = new();
×
629
                                        for (int i = 0; i < 16; i++)
×
630
                                        {
×
631
                                                Debug.Assert(this._reader.Code == 47);
×
632

633
                                                arr.Add(this._reader.ValueAsDouble);
×
634

635
                                                this._reader.ReadNext();
×
636
                                        }
×
637

638
                                        tmp.CadObject.SpecularMatrix = new CSMath.Matrix4(arr.ToArray());
×
639
                                        return this.checkObjectEnd(template, map, this.readMaterial);
×
640
                                case 49:
641
                                        arr = new();
197✔
642
                                        for (int i = 0; i < 16; i++)
6,698✔
643
                                        {
3,152✔
644
                                                Debug.Assert(this._reader.Code == 49);
3,152✔
645

646
                                                arr.Add(this._reader.ValueAsDouble);
3,152✔
647

648
                                                this._reader.ReadNext();
3,152✔
649
                                        }
3,152✔
650

651
                                        tmp.CadObject.ReflectionMatrix = new CSMath.Matrix4(arr.ToArray());
197✔
652
                                        return this.checkObjectEnd(template, map, this.readMaterial);
197✔
653
                                case 142:
654
                                        arr = new();
197✔
655
                                        for (int i = 0; i < 16; i++)
6,698✔
656
                                        {
3,152✔
657
                                                Debug.Assert(this._reader.Code == 142);
3,152✔
658

659
                                                arr.Add(this._reader.ValueAsDouble);
3,152✔
660

661
                                                this._reader.ReadNext();
3,152✔
662
                                        }
3,152✔
663

664
                                        tmp.CadObject.OpacityMatrix = new CSMath.Matrix4(arr.ToArray());
197✔
665
                                        return this.checkObjectEnd(template, map, this.readMaterial);
197✔
666
                                case 144:
667
                                        arr = new();
1,157✔
668
                                        for (int i = 0; i < 16; i++)
39,338✔
669
                                        {
18,512✔
670
                                                Debug.Assert(this._reader.Code == 144);
18,512✔
671

672
                                                arr.Add(this._reader.ValueAsDouble);
18,512✔
673

674
                                                this._reader.ReadNext();
18,512✔
675
                                        }
18,512✔
676

677
                                        tmp.CadObject.BumpMatrix = new CSMath.Matrix4(arr.ToArray());
1,157✔
678
                                        return this.checkObjectEnd(template, map, this.readMaterial);
1,157✔
679
                                case 147:
680
                                        arr = new();
×
681
                                        for (int i = 0; i < 16; i++)
×
682
                                        {
×
683
                                                Debug.Assert(this._reader.Code == 147);
×
684

685
                                                arr.Add(this._reader.ValueAsDouble);
×
686

687
                                                this._reader.ReadNext();
×
688
                                        }
×
689

690
                                        tmp.CadObject.RefractionMatrix = new CSMath.Matrix4(arr.ToArray());
×
691
                                        return this.checkObjectEnd(template, map, this.readMaterial);
×
692
                                default:
693
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
39,214✔
694
                        }
695
                }
42,114✔
696

697
                private bool readScale(CadTemplate template, DxfMap map)
698
                {
60,141✔
699
                        switch (this._reader.Code)
60,141✔
700
                        {
701
                                // Undocumented codes
702
                                case 70:
703
                                        //Always 0
704
                                        return true;
6,705✔
705
                                default:
706
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Scale]);
53,436✔
707
                        }
708
                }
60,141✔
709

710
                private void readLinkedData(CadTemplate template, DxfMap map)
711
                {
320✔
712
                        CadTableContentTemplate tmp = template as CadTableContentTemplate;
320✔
713
                        LinkedData linkedData = tmp.CadObject;
320✔
714

715
                        this._reader.ReadNext();
320✔
716

717
                        while (this._reader.DxfCode != DxfCode.Start && this._reader.DxfCode != DxfCode.Subclass)
960!
718
                        {
640✔
719
                                switch (this._reader.Code)
640✔
720
                                {
721
                                        default:
722
                                                if (!this.tryAssignCurrentValue(linkedData, map.SubClasses[DxfSubclassMarker.LinkedData]))
640!
723
                                                {
×
724
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedData)} {this._reader.Position}.", NotificationType.None);
×
725
                                                }
×
726
                                                break;
640✔
727
                                }
728

729
                                this._reader.ReadNext();
640✔
730
                        }
640✔
731
                }
320✔
732

733
                private bool readTableContent(CadTemplate template, DxfMap map)
734
                {
2,368✔
735
                        switch (this._reader.Code)
2,368✔
736
                        {
737
                                case 100 when this._reader.ValueAsString.Equals(DxfSubclassMarker.TableContent, StringComparison.InvariantCultureIgnoreCase):
1,216✔
738
                                        this.readTableContentSubclass(template, map);
256✔
739
                                        this.lockPointer = true;
256✔
740
                                        return true;
256✔
741
                                case 100 when this._reader.ValueAsString.Equals(DxfSubclassMarker.FormattedTableData, StringComparison.InvariantCultureIgnoreCase):
960✔
742
                                        this.readFormattedTableDataSubclass(template, map);
256✔
743
                                        this.lockPointer = true;
256✔
744
                                        return true;
256✔
745
                                case 100 when this._reader.ValueAsString.Equals(DxfSubclassMarker.LinkedTableData, StringComparison.InvariantCultureIgnoreCase):
704✔
746
                                        this.readLinkedTableDataSubclass(template, map);
320✔
747
                                        this.lockPointer = true;
320✔
748
                                        return true;
320✔
749
                                case 100 when this._reader.ValueAsString.Equals(DxfSubclassMarker.LinkedData, StringComparison.InvariantCultureIgnoreCase):
384✔
750
                                        this.readLinkedData(template, map);
320✔
751
                                        this.lockPointer = true;
320✔
752
                                        return true;
320✔
753
                                default:
754
                                        return false;
1,216✔
755
                        }
756
                }
2,368✔
757

758
                private void readTableContentSubclass(CadTemplate template, DxfMap map)
759
                {
256✔
760
                        CadTableContentTemplate tmp = template as CadTableContentTemplate;
256✔
761
                        TableContent tableContent = tmp.CadObject;
256✔
762

763
                        this._reader.ReadNext();
256✔
764

765
                        while (this._reader.DxfCode != DxfCode.Start && this._reader.DxfCode != DxfCode.Subclass)
512✔
766
                        {
256✔
767
                                switch (this._reader.Code)
256!
768
                                {
769
                                        case 340:
770
                                                tmp.SytleHandle = this._reader.ValueAsHandle;
256✔
771
                                                break;
256✔
772
                                        default:
773
                                                if (!this.tryAssignCurrentValue(tableContent, map.SubClasses[DxfSubclassMarker.TableContent]))
×
774
                                                {
×
775
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableContentSubclass)} {this._reader.Position}.", NotificationType.None);
×
776
                                                }
×
777
                                                break;
×
778
                                }
779

780
                                this._reader.ReadNext();
256✔
781
                        }
256✔
782
                }
256✔
783

784
                private void readFormattedTableDataSubclass(CadTemplate template, DxfMap map)
785
                {
256✔
786
                        CadTableContentTemplate tmp = template as CadTableContentTemplate;
256✔
787
                        FormattedTableData formattedTable = tmp.CadObject;
256✔
788

789
                        this._reader.ReadNext();
256✔
790

791
                        TableEntity.CellRange cellRange = null;
256✔
792
                        while (this._reader.DxfCode != DxfCode.Start && this._reader.DxfCode != DxfCode.Subclass)
2,304!
793
                        {
2,048✔
794
                                switch (this._reader.Code)
2,048!
795
                                {
796
                                        case 90:
797
                                                break;
256✔
798
                                        case 91:
799
                                                if (cellRange == null)
384✔
800
                                                {
384✔
801
                                                        cellRange = new();
384✔
802
                                                        formattedTable.MergedCellRanges.Add(cellRange);
384✔
803
                                                }
384✔
804
                                                cellRange.TopRowIndex = this._reader.ValueAsInt;
384✔
805
                                                break;
384✔
806
                                        case 92:
807
                                                if (cellRange == null)
384!
808
                                                {
×
809
                                                        cellRange = new();
×
810
                                                        formattedTable.MergedCellRanges.Add(cellRange);
×
811
                                                }
×
812
                                                cellRange.LeftColumnIndex = this._reader.ValueAsInt;
384✔
813
                                                break;
384✔
814
                                        case 93:
815
                                                if (cellRange == null)
384!
816
                                                {
×
817
                                                        cellRange = new();
×
818
                                                        formattedTable.MergedCellRanges.Add(cellRange);
×
819
                                                }
×
820
                                                cellRange.BottomRowIndex = this._reader.ValueAsInt;
384✔
821
                                                break;
384✔
822
                                        case 94:
823
                                                if (cellRange == null)
384!
824
                                                {
×
825
                                                        cellRange = new();
×
826
                                                        formattedTable.MergedCellRanges.Add(cellRange);
×
827
                                                }
×
828
                                                cellRange.RightColumnIndex = this._reader.ValueAsInt;
384✔
829
                                                cellRange = null;
384✔
830
                                                break;
384✔
831
                                        case 300 when this._reader.ValueAsString.Equals("TABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
256!
832
                                                this.readStyleOverride(new CadCellStyleTemplate(formattedTable.CellStyleOverride));
256✔
833
                                                break;
256✔
834
                                        default:
835
                                                if (!this.tryAssignCurrentValue(formattedTable, map.SubClasses[DxfSubclassMarker.FormattedTableData]))
×
836
                                                {
×
837
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableDataSubclass)} {this._reader.Position}.", NotificationType.None);
×
838
                                                }
×
839
                                                break;
×
840
                                }
841

842
                                this._reader.ReadNext();
2,048✔
843
                        }
2,048✔
844
                }
256✔
845

846
                private void readLinkedTableDataSubclass(CadTemplate template, DxfMap map)
847
                {
320✔
848
                        CadTableContentTemplate tmp = template as CadTableContentTemplate;
320✔
849
                        TableContent tableContent = tmp.CadObject;
320✔
850

851
                        this._reader.ReadNext();
320✔
852

853
                        while (this._reader.DxfCode != DxfCode.Start && this._reader.DxfCode != DxfCode.Subclass)
4,224!
854
                        {
3,904✔
855
                                switch (this._reader.Code)
3,904✔
856
                                {
857
                                        case 90:
858
                                                //Column count
859
                                                break;
320✔
860
                                        case 91:
861
                                                //Row count
862
                                                break;
320✔
863
                                        //Unknown
864
                                        case 92:
865
                                                break;
256✔
866
                                        case 300 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableColumn, StringComparison.InvariantCultureIgnoreCase):
1,216✔
867
                                                //Read Column
868
                                                this.readTableColumn();
1,216✔
869
                                                break;
1,216✔
870
                                        case 301 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableRow, StringComparison.InvariantCultureIgnoreCase):
1,472✔
871
                                                //Read Row
872
                                                this.readTableRow();
1,472✔
873
                                                break;
1,472✔
874
                                        default:
875
                                                if (!this.tryAssignCurrentValue(tableContent, map.SubClasses[DxfSubclassMarker.LinkedTableData]))
320✔
876
                                                {
320✔
877
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableDataSubclass)} {this._reader.Position}.", NotificationType.None);
320✔
878
                                                }
320✔
879
                                                break;
320✔
880
                                }
881

882
                                this._reader.ReadNext();
3,904✔
883
                        }
3,904✔
884
                }
320✔
885

886

887
                private TableEntity.Column readTableColumn()
888
                {
1,216✔
889
                        this._reader.ReadNext();
1,216✔
890

891
                        TableEntity.Column column = new TableEntity.Column();
1,216✔
892

893
                        bool end = false;
1,216✔
894
                        while (this._reader.DxfCode != DxfCode.Start)
3,648!
895
                        {
3,648✔
896
                                switch (this._reader.Code)
3,648!
897
                                {
898
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataColumn_BEGIN, StringComparison.InvariantCultureIgnoreCase):
3,648✔
899
                                                this.readLinkedTableColumn(column);
1,216✔
900
                                                break;
1,216✔
901
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.FormattedTableDataColumn_BEGIN, StringComparison.InvariantCultureIgnoreCase):
2,432✔
902
                                                this.readFormattedTableColumn(column);
1,216✔
903
                                                break;
1,216✔
904
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableColumnBegin, StringComparison.InvariantCultureIgnoreCase):
1,216!
905
                                                this.readTableColumn(column);
1,216✔
906
                                                end = true;
1,216✔
907
                                                break;
1,216✔
908
                                        default:
909
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableColumn)} method.", NotificationType.None);
×
910
                                                break;
×
911
                                }
912

913
                                if (end)
3,648✔
914
                                {
1,216✔
915
                                        return column;
1,216✔
916
                                }
917

918
                                this._reader.ReadNext();
2,432✔
919
                        }
2,432✔
920

921
                        return column;
×
922
                }
1,216✔
923

924
                private TableEntity.Row readTableRow()
925
                {
1,472✔
926
                        this._reader.ReadNext();
1,472✔
927

928
                        TableEntity.Row row = new TableEntity.Row();
1,472✔
929

930
                        bool end = false;
1,472✔
931
                        while (this._reader.DxfCode != DxfCode.Start)
11,904✔
932
                        {
11,840✔
933
                                switch (this._reader.Code)
11,840✔
934
                                {
935
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataRow_BEGIN, StringComparison.InvariantCultureIgnoreCase):
6,016✔
936
                                                this.readLinkedTableRow(row);
1,536✔
937
                                                break;
1,536✔
938
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.FormattedTableDataRow_BEGIN, StringComparison.InvariantCultureIgnoreCase):
4,480✔
939
                                                this.readFormattedTableRow(row);
1,408✔
940
                                                break;
1,408✔
941
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableRowBegin, StringComparison.InvariantCultureIgnoreCase):
3,072✔
942
                                                this.readTableRow(row);
1,408✔
943
                                                end = true;
1,408✔
944
                                                break;
1,408✔
945
                                        default:
946
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableRow)} method.", NotificationType.None);
7,488✔
947
                                                break;
7,488✔
948
                                }
949

950
                                if (end)
11,840✔
951
                                {
1,408✔
952
                                        return row;
1,408✔
953
                                }
954

955
                                this._reader.ReadNext();
10,432✔
956
                        }
10,432✔
957

958
                        return row;
64✔
959
                }
1,472✔
960

961
                private void readTableRow(TableEntity.Row row)
962
                {
1,408✔
963
                        this._reader.ReadNext();
1,408✔
964

965
                        bool end = false;
1,408✔
966
                        while (this._reader.DxfCode != DxfCode.Start)
4,224✔
967
                        {
4,224✔
968
                                switch (this._reader.Code)
4,224!
969
                                {
970
                                        case 40:
971
                                                row.Height = this._reader.ValueAsDouble;
1,408✔
972
                                                break;
1,408✔
973
                                        case 90:
974
                                                //styleID
975
                                                break;
1,408✔
976
                                        case 309:
977
                                                end = this._reader.ValueAsString.Equals("TABLEROW_END", StringComparison.InvariantCultureIgnoreCase);
1,408✔
978
                                                break;
1,408✔
979
                                        default:
980
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableRow)} method.", NotificationType.None);
×
981
                                                break;
×
982
                                }
983

984
                                if (end)
4,224✔
985
                                {
1,408✔
986
                                        break;
1,408✔
987
                                }
988

989
                                this._reader.ReadNext();
2,816✔
990
                        }
2,816✔
991
                }
1,408✔
992

993
                private void readFormattedTableRow(TableEntity.Row row)
994
                {
1,408✔
995
                        this._reader.ReadNext();
1,408✔
996

997
                        bool end = false;
1,408✔
998
                        while (this._reader.DxfCode != DxfCode.Start)
4,224✔
999
                        {
4,224✔
1000
                                switch (this._reader.Code)
4,224!
1001
                                {
1002
                                        case 300 when this._reader.ValueAsString.Equals("ROWTABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
1,408!
1003
                                                break;
1,408✔
1004
                                        case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
1,408!
1005
                                                this.readStyleOverride(new CadCellStyleTemplate(row.CellStyleOverride));
1,408✔
1006
                                                break;
1,408✔
1007
                                        case 309:
1008
                                                end = this._reader.ValueAsString.Equals("FORMATTEDTABLEDATAROW_END", StringComparison.InvariantCultureIgnoreCase);
1,408✔
1009
                                                break;
1,408✔
1010
                                        default:
1011
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableRow)} method.", NotificationType.None);
×
1012
                                                break;
×
1013
                                }
1014

1015
                                if (end)
4,224✔
1016
                                {
1,408✔
1017
                                        break;
1,408✔
1018
                                }
1019

1020
                                this._reader.ReadNext();
2,816✔
1021
                        }
2,816✔
1022
                }
1,408✔
1023

1024
                private void readTableColumn(TableEntity.Column column)
1025
                {
1,216✔
1026
                        this._reader.ReadNext();
1,216✔
1027

1028
                        bool end = false;
1,216✔
1029
                        while (this._reader.DxfCode != DxfCode.Start)
3,648✔
1030
                        {
3,648✔
1031
                                switch (this._reader.Code)
3,648!
1032
                                {
1033
                                        case 1 when this._reader.ValueAsString.Equals("TABLECOLUMN_BEGIN", StringComparison.InvariantCultureIgnoreCase):
×
1034
                                                break;
×
1035
                                        case 1:
1036
                                                end = true;
×
1037
                                                break;
×
1038
                                        case 40:
1039
                                                column.Width = this._reader.ValueAsDouble;
1,216✔
1040
                                                break;
1,216✔
1041
                                        case 90:
1042
                                                //StyleId
1043
                                                break;
1,216✔
1044
                                        case 309:
1045
                                                end = this._reader.ValueAsString.Equals("TABLECOLUMN_END", StringComparison.InvariantCultureIgnoreCase);
1,216✔
1046
                                                break;
1,216✔
1047
                                        default:
1048
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableColumn)} method.", NotificationType.None);
×
1049
                                                break;
×
1050
                                }
1051

1052
                                if (end)
3,648✔
1053
                                {
1,216✔
1054
                                        break;
1,216✔
1055
                                }
1056

1057
                                this._reader.ReadNext();
2,432✔
1058
                        }
2,432✔
1059
                }
1,216✔
1060

1061
                private void readLinkedTableColumn(TableEntity.Column column)
1062
                {
1,216✔
1063
                        this._reader.ReadNext();
1,216✔
1064

1065
                        bool end = false;
1,216✔
1066
                        while (this._reader.DxfCode != DxfCode.Start)
4,864✔
1067
                        {
4,864✔
1068
                                switch (this._reader.Code)
4,864!
1069
                                {
1070
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataColumn_BEGIN, StringComparison.InvariantCultureIgnoreCase):
×
1071
                                                break;
×
1072
                                        case 1:
1073
                                                end = true;
×
1074
                                                break;
×
1075
                                        case 91:
1076
                                                column.CustomData = this._reader.ValueAsInt;
1,216✔
1077
                                                break;
1,216✔
1078
                                        case 300:
1079
                                                column.Name = this._reader.ValueAsString;
1,216✔
1080
                                                break;
1,216✔
1081
                                        case 301 when this._reader.ValueAsString.Equals(DxfFileToken.CustomData, StringComparison.InvariantCultureIgnoreCase):
1,216!
1082
                                                this.readCustomData();
1,216✔
1083
                                                break;
1,216✔
1084
                                        case 309:
1085
                                                end = this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataColumn_END, StringComparison.InvariantCultureIgnoreCase);
1,216✔
1086
                                                break;
1,216✔
1087
                                        default:
1088
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableColumn)} method.", NotificationType.None);
×
1089
                                                break;
×
1090
                                }
1091

1092
                                if (end)
4,864✔
1093
                                {
1,216✔
1094
                                        break;
1,216✔
1095
                                }
1096

1097
                                this._reader.ReadNext();
3,648✔
1098
                        }
3,648✔
1099
                }
1,216✔
1100

1101
                private void readLinkedTableRow(TableEntity.Row row)
1102
                {
1,536✔
1103
                        this._reader.ReadNext();
1,536✔
1104

1105
                        bool end = false;
1,536✔
1106
                        while (this._reader.DxfCode != DxfCode.Start)
12,608✔
1107
                        {
12,480✔
1108
                                switch (this._reader.Code)
12,480!
1109
                                {
1110
                                        case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataRow_BEGIN, StringComparison.InvariantCultureIgnoreCase):
✔
1111
                                                break;
×
1112
                                        case 90:
1113
                                                break;
1,536✔
1114
                                        case 91:
1115
                                                row.CustomData = this._reader.ValueAsInt;
1,408✔
1116
                                                break;
1,408✔
1117
                                        case 300 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectCell, StringComparison.InvariantCultureIgnoreCase):
5,376✔
1118
                                                this.readCell();
5,376✔
1119
                                                break;
5,376✔
1120
                                        case 301 when this._reader.ValueAsString.Equals(DxfFileToken.CustomData, StringComparison.InvariantCultureIgnoreCase):
1,408✔
1121
                                                this.readCustomData();
1,408✔
1122
                                                break;
1,408✔
1123
                                        case 309:
1124
                                                end = this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataRow_END, StringComparison.InvariantCultureIgnoreCase);
1,408✔
1125
                                                break;
1,408✔
1126
                                        default:
1127
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableRow)} method.", NotificationType.None);
1,344✔
1128
                                                break;
1,344✔
1129
                                }
1130

1131
                                if (end)
12,480✔
1132
                                {
1,408✔
1133
                                        break;
1,408✔
1134
                                }
1135

1136
                                this._reader.ReadNext();
11,072✔
1137
                        }
11,072✔
1138
                }
1,536✔
1139

1140
                private TableEntity.Cell readCell()
1141
                {
5,376✔
1142
                        this._reader.ReadNext();
5,376✔
1143

1144
                        TableEntity.Cell cell = new TableEntity.Cell();
5,376✔
1145
                        CadTableCellTemplate template = new CadTableCellTemplate(cell);
5,376✔
1146

1147
                        bool end = false;
5,376✔
1148
                        while (this._reader.DxfCode != DxfCode.Start)
16,960✔
1149
                        {
16,832✔
1150
                                switch (this._reader.Code)
16,832✔
1151
                                {
1152
                                        case 1 when this._reader.ValueAsString.Equals("LINKEDTABLEDATACELL_BEGIN", StringComparison.InvariantCultureIgnoreCase):
15,872✔
1153
                                                this.readLinkedTableCell(cell);
5,376✔
1154
                                                break;
5,376✔
1155
                                        case 1 when this._reader.ValueAsString.Equals("FORMATTEDTABLEDATACELL_BEGIN", StringComparison.InvariantCultureIgnoreCase):
10,496✔
1156
                                                this.readFormattedTableCell(cell);
5,248✔
1157
                                                break;
5,248✔
1158
                                        case 1 when this._reader.ValueAsString.Equals("TABLECELL_BEGIN", StringComparison.InvariantCultureIgnoreCase):
5,248✔
1159
                                                this.readTableCell(cell);
5,248✔
1160
                                                end = true;
5,248✔
1161
                                                break;
5,248✔
1162
                                        default:
1163
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCell)} method.", NotificationType.None);
960✔
1164
                                                break;
960✔
1165
                                }
1166

1167
                                if (end)
16,832✔
1168
                                {
5,248✔
1169
                                        return cell;
5,248✔
1170
                                }
1171

1172
                                this._reader.ReadNext();
11,584✔
1173
                        }
11,584✔
1174

1175
                        return cell;
128✔
1176
                }
5,376✔
1177

1178
                private void readTableCell(TableEntity.Cell cell)
1179
                {
5,248✔
1180
                        var map = DxfClassMap.Create(cell.GetType(), "TABLECELL_BEGIN");
5,248✔
1181

1182
                        this._reader.ReadNext();
5,248✔
1183

1184
                        bool end = false;
5,248✔
1185
                        while (this._reader.DxfCode != DxfCode.Start)
16,384✔
1186
                        {
16,384✔
1187
                                switch (this._reader.Code)
16,384✔
1188
                                {
1189
                                        //Unknown
1190
                                        case 40:
1191
                                        case 41:
1192
                                                break;
256✔
1193
                                        case 309:
1194
                                                end = this._reader.ValueAsString.Equals("TABLECELL_END", StringComparison.InvariantCultureIgnoreCase);
5,248✔
1195
                                                break;
5,248✔
1196
                                        case 330:
1197
                                                //Unknown handle
1198
                                                break;
128✔
1199
                                        default:
1200
                                                if (!this.tryAssignCurrentValue(cell, map))
10,752!
1201
                                                {
×
1202
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableCell)} {this._reader.Position}.", NotificationType.None);
×
1203
                                                }
×
1204
                                                break;
10,752✔
1205
                                }
1206

1207
                                if (end)
16,384✔
1208
                                {
5,248✔
1209
                                        break;
5,248✔
1210
                                }
1211

1212
                                this._reader.ReadNext();
11,136✔
1213
                        }
11,136✔
1214
                }
5,248✔
1215

1216
                private void readFormattedTableCell(TableEntity.Cell cell)
1217
                {
5,248✔
1218
                        var map = DxfClassMap.Create(cell.GetType(), "FORMATTEDTABLEDATACELL_BEGIN");
5,248✔
1219

1220
                        this._reader.ReadNext();
5,248✔
1221

1222
                        bool end = false;
5,248✔
1223
                        while (this._reader.DxfCode != DxfCode.Start)
10,496✔
1224
                        {
10,496✔
1225
                                switch (this._reader.Code)
10,496!
1226
                                {
1227
                                        case 300 when this._reader.ValueAsString.Equals("CELLTABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
5,248!
1228
                                                this.readCellTableFormat(cell);
5,248✔
1229
                                                continue;
5,248✔
1230
                                        case 309:
1231
                                                end = this._reader.ValueAsString.Equals("FORMATTEDTABLEDATACELL_END", StringComparison.InvariantCultureIgnoreCase);
5,248✔
1232
                                                break;
5,248✔
1233
                                        default:
1234
                                                if (!this.tryAssignCurrentValue(cell, map))
×
1235
                                                {
×
1236
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableCell)} {this._reader.Position}.", NotificationType.None);
×
1237
                                                }
×
1238
                                                break;
×
1239
                                }
1240

1241
                                if (end)
5,248!
1242
                                {
5,248✔
1243
                                        break;
5,248✔
1244
                                }
1245

1246
                                this._reader.ReadNext();
×
1247
                        }
×
1248
                }
5,248✔
1249

1250
                private void readCellTableFormat(TableEntity.Cell cell)
1251
                {
5,248✔
1252
                        var map = DxfClassMap.Create(cell.GetType(), "CELLTABLEFORMAT");
5,248✔
1253

1254
                        this._reader.ReadNext();
5,248✔
1255

1256
                        bool end = false;
5,248✔
1257
                        while (this._reader.Code == 1)
10,496✔
1258
                        {
5,248✔
1259
                                switch (this._reader.Code)
5,248!
1260
                                {
1261
                                        case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
5,248!
1262
                                                this.readStyleOverride(new CadCellStyleTemplate(cell.StyleOverride));
5,248✔
1263
                                                break;
5,248✔
1264
                                        case 1 when this._reader.ValueAsString.Equals("CELLSTYLE_BEGIN", StringComparison.InvariantCultureIgnoreCase):
×
1265
                                                this.readCellStyle(new CadCellStyleTemplate());
×
1266
                                                break;
×
1267
                                        default:
1268
                                                if (!this.tryAssignCurrentValue(cell, map))
×
1269
                                                {
×
1270
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellTableFormat)} {this._reader.Position}.", NotificationType.None);
×
1271
                                                }
×
1272
                                                break;
×
1273
                                }
1274

1275
                                if (end)
5,248!
1276
                                {
×
1277
                                        break;
×
1278
                                }
1279

1280
                                this._reader.ReadNext();
5,248✔
1281
                        }
5,248✔
1282
                }
5,248✔
1283

1284
                private void readCellStyle(CadCellStyleTemplate template)
1285
                {
×
1286
                        //var map = DxfClassMap.Create(cell.GetType(), "CELLTABLEFORMAT");
1287

1288
                        this._reader.ReadNext();
×
1289

1290
                        bool end = false;
×
1291
                        while (this._reader.Code != 1)
×
1292
                        {
×
1293
                                switch (this._reader.Code)
×
1294
                                {
1295
                                        case 309:
1296
                                                end = this._reader.ValueAsString.Equals("CELLSTYLE_END", StringComparison.InvariantCultureIgnoreCase);
×
1297
                                                break;
×
1298
                                        default:
1299
                                                //if (!this.tryAssignCurrentValue(cell, map))
1300
                                                {
×
1301
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellStyle)} {this._reader.Position}.", NotificationType.None);
×
1302
                                                }
×
1303
                                                break;
×
1304
                                }
1305

1306
                                if (end)
×
1307
                                {
×
1308
                                        break;
×
1309
                                }
1310

1311
                                this._reader.ReadNext();
×
1312
                        }
×
1313
                }
×
1314

1315
                private void readLinkedTableCell(TableEntity.Cell cell)
1316
                {
5,376✔
1317
                        var map = DxfClassMap.Create(cell.GetType(), "LINKEDTABLEDATACELL_BEGIN");
5,376✔
1318

1319
                        this._reader.ReadNext();
5,376✔
1320

1321
                        bool end = false;
5,376✔
1322
                        while (this._reader.DxfCode != DxfCode.Start)
53,888✔
1323
                        {
53,760✔
1324
                                switch (this._reader.Code)
53,760✔
1325
                                {
1326
                                        case 95:
1327
                                                //BL 95 Number of cell contents
1328
                                                break;
5,248✔
1329
                                        case 301 when this._reader.ValueAsString.Equals(DxfFileToken.CustomData, StringComparison.InvariantCultureIgnoreCase):
5,376✔
1330
                                                this.readCustomData();
5,376✔
1331
                                                break;
5,376✔
1332
                                        case 302 when this._reader.ValueAsString.Equals("CONTENT", StringComparison.InvariantCultureIgnoreCase):
4,096✔
1333
                                                var c = this.readLinkedTableCellContent();
4,096✔
1334
                                                break;
4,096✔
1335
                                        case 309:
1336
                                                end = this._reader.ValueAsString.Equals("LINKEDTABLEDATACELL_END", StringComparison.InvariantCultureIgnoreCase);
5,248✔
1337
                                                break;
5,248✔
1338
                                        default:
1339
                                                if (!this.tryAssignCurrentValue(cell, map))
33,792✔
1340
                                                {
11,648✔
1341
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableCell)} {this._reader.Position}.", NotificationType.None);
11,648✔
1342
                                                }
11,648✔
1343
                                                break;
33,792✔
1344
                                }
1345

1346
                                if (end)
53,760✔
1347
                                {
5,248✔
1348
                                        break;
5,248✔
1349
                                }
1350

1351
                                this._reader.ReadNext();
48,512✔
1352
                        }
48,512✔
1353
                }
5,376✔
1354

1355
                private CadTableCellContentTemplate readLinkedTableCellContent()
1356
                {
4,096✔
1357
                        TableEntity.CellContent content = new TableEntity.CellContent();
4,096✔
1358
                        CadTableCellContentTemplate template = new CadTableCellContentTemplate(content);
4,096✔
1359
                        var map = DxfClassMap.Create(content.GetType(), "CONTENT");
4,096✔
1360

1361
                        this._reader.ReadNext();
4,096✔
1362

1363
                        bool end = false;
4,096✔
1364
                        while (this._reader.DxfCode != DxfCode.Start)
8,192✔
1365
                        {
8,192✔
1366
                                switch (this._reader.Code)
8,192!
1367
                                {
1368
                                        case 1 when this._reader.ValueAsString.Equals("FORMATTEDCELLCONTENT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
8,192✔
1369
                                                readFormattedCellContent();
4,096✔
1370
                                                end = true;
4,096✔
1371
                                                break;
4,096✔
1372
                                        case 1 when this._reader.ValueAsString.Equals("CELLCONTENT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
4,096!
1373
                                                readCellContent(template);
4,096✔
1374
                                                break;
4,096✔
1375
                                        default:
1376
                                                if (!this.tryAssignCurrentValue(content, map))
×
1377
                                                {
×
1378
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableCellContent)} {this._reader.Position}.", NotificationType.None);
×
1379
                                                }
×
1380
                                                break;
×
1381
                                }
1382

1383
                                if (end)
8,192✔
1384
                                {
4,096✔
1385
                                        break;
4,096✔
1386
                                }
1387

1388
                                this._reader.ReadNext();
4,096✔
1389
                        }
4,096✔
1390

1391
                        return template;
4,096✔
1392
                }
4,096✔
1393

1394
                private void readCellContent(CadTableCellContentTemplate template)
1395
                {
4,096✔
1396
                        TableEntity.CellContent content = template.Content;
4,096✔
1397
                        var map = DxfClassMap.Create(content.GetType(), "CELLCONTENT_BEGIN");
4,096✔
1398

1399
                        this._reader.ReadNext();
4,096✔
1400

1401
                        bool end = false;
4,096✔
1402
                        while (this._reader.DxfCode != DxfCode.Start)
16,384✔
1403
                        {
16,384✔
1404
                                switch (this._reader.Code)
16,384✔
1405
                                {
1406
                                        case 91:
1407
                                                break;
4,096✔
1408
                                        case 300 when this._reader.ValueAsString.Equals("VALUE", StringComparison.InvariantCultureIgnoreCase):
3,712✔
1409
                                                this.readDataMapValue();
3,712✔
1410
                                                break;
3,712✔
1411
                                        case 309:
1412
                                                end = this._reader.ValueAsString.Equals("CELLCONTENT_END", StringComparison.InvariantCultureIgnoreCase);
4,096✔
1413
                                                break;
4,096✔
1414
                                        case 340:
1415
                                                template.BlockRecordHandle = this._reader.ValueAsHandle;
384✔
1416
                                                break;
384✔
1417
                                        default:
1418
                                                if (!this.tryAssignCurrentValue(content, map))
4,096!
1419
                                                {
×
1420
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellContent)} {this._reader.Position}.", NotificationType.None);
×
1421
                                                }
×
1422
                                                break;
4,096✔
1423
                                }
1424

1425
                                if (end)
16,384✔
1426
                                {
4,096✔
1427
                                        break;
4,096✔
1428
                                }
1429

1430
                                this._reader.ReadNext();
12,288✔
1431
                        }
12,288✔
1432
                }
4,096✔
1433

1434
                private void readFormattedCellContent()
1435
                {
4,096✔
1436
                        TableEntity.ContentFormat format = new();
4,096✔
1437
                        CadTableCellContentFormatTemplate template = new CadTableCellContentFormatTemplate(format);
4,096✔
1438
                        var map = DxfClassMap.Create(format.GetType(), "FORMATTEDCELLCONTENT");
4,096✔
1439

1440
                        this._reader.ReadNext();
4,096✔
1441

1442
                        bool end = false;
4,096✔
1443
                        while (this._reader.DxfCode != DxfCode.Start)
12,288✔
1444
                        {
12,288✔
1445
                                switch (this._reader.Code)
12,288✔
1446
                                {
1447
                                        case 300 when this._reader.ValueAsString.Equals("CONTENTFORMAT", StringComparison.InvariantCultureIgnoreCase):
4,096✔
1448
                                                readContentFormat(template);
4,096✔
1449
                                                break;
4,096✔
1450
                                        case 309:
1451
                                                end = this._reader.ValueAsString.Equals("FORMATTEDCELLCONTENT_END", StringComparison.InvariantCultureIgnoreCase);
4,096✔
1452
                                                break;
4,096✔
1453
                                        default:
1454
                                                if (!this.tryAssignCurrentValue(format, map))
4,096!
1455
                                                {
×
1456
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedCellContent)} method.", NotificationType.None);
×
1457
                                                }
×
1458
                                                break;
4,096✔
1459
                                }
1460

1461
                                if (end)
12,288✔
1462
                                {
4,096✔
1463
                                        break;
4,096✔
1464
                                }
1465

1466
                                this._reader.ReadNext();
8,192✔
1467
                        }
8,192✔
1468
                }
4,096✔
1469

1470
                private void readContentFormat(CadTableCellContentFormatTemplate template)
1471
                {
9,600✔
1472
                        var format = template.Format;
9,600✔
1473
                        var map = DxfClassMap.Create(format.GetType(), "CONTENTFORMAT_BEGIN");
9,600✔
1474

1475
                        this._reader.ReadNext();
9,600✔
1476

1477
                        bool end = false;
9,600✔
1478
                        while (this._reader.DxfCode != DxfCode.Start)
124,800✔
1479
                        {
124,800✔
1480
                                switch (this._reader.Code)
124,800✔
1481
                                {
1482
                                        case 1 when this._reader.ValueAsString.Equals("CONTENTFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
9,600✔
1483
                                                break;
9,600✔
1484
                                        case 309:
1485
                                                end = this._reader.ValueAsString.Equals("CONTENTFORMAT_END", StringComparison.InvariantCultureIgnoreCase);
9,600✔
1486
                                                break;
9,600✔
1487
                                        case 340:
1488
                                                template.TextStyleHandle = this._reader.ValueAsHandle;
9,600✔
1489
                                                break;
9,600✔
1490
                                        default:
1491
                                                if (!this.tryAssignCurrentValue(format, map))
96,000!
1492
                                                {
×
1493
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readContentFormat)} method.", NotificationType.None);
×
1494
                                                }
×
1495
                                                break;
96,000✔
1496
                                }
1497

1498
                                if (end)
124,800✔
1499
                                {
9,600✔
1500
                                        break;
9,600✔
1501
                                }
1502

1503
                                this._reader.ReadNext();
115,200✔
1504
                        }
115,200✔
1505
                }
9,600✔
1506

1507
                private void readFormattedTableColumn(TableEntity.Column column)
1508
                {
1,216✔
1509
                        this._reader.ReadNext();
1,216✔
1510

1511
                        bool end = false;
1,216✔
1512
                        while (this._reader.DxfCode != DxfCode.Start)
3,648✔
1513
                        {
3,648✔
1514
                                switch (this._reader.Code)
3,648!
1515
                                {
1516
                                        case 300 when this._reader.ValueAsString.Equals("COLUMNTABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
1,216!
1517
                                                break;
1,216✔
1518
                                        case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
1,216!
1519
                                                this.readStyleOverride(new CadCellStyleTemplate(column.CellStyleOverride));
1,216✔
1520
                                                break;
1,216✔
1521
                                        case 309:
1522
                                                end = this._reader.ValueAsString.Equals(DxfFileToken.FormattedTableDataColumn_END, StringComparison.InvariantCultureIgnoreCase);
1,216✔
1523
                                                break;
1,216✔
1524
                                        default:
1525
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableColumn)} method.", NotificationType.None);
×
1526
                                                break;
×
1527
                                }
1528

1529
                                if (end)
3,648✔
1530
                                {
1,216✔
1531
                                        break;
1,216✔
1532
                                }
1533

1534
                                this._reader.ReadNext();
2,432✔
1535
                        }
2,432✔
1536
                }
1,216✔
1537

1538
                private void readStyleOverride(CadCellStyleTemplate template)
1539
                {
8,128✔
1540
                        var style = template.Format as TableEntity.CellStyle;
8,128✔
1541
                        var mapstyle = DxfClassMap.Create(style.GetType(), "TABLEFORMAT_STYLE");
8,128✔
1542
                        var mapformat = DxfClassMap.Create(typeof(TableEntity.ContentFormat), "TABLEFORMAT_BEGIN");
8,128✔
1543

1544
                        this._reader.ReadNext();
8,128✔
1545

1546
                        bool end = false;
8,128✔
1547
                        TableEntity.CellEdgeFlags currBorder = TableEntity.CellEdgeFlags.Unknown;
8,128✔
1548
                        while (this._reader.DxfCode != DxfCode.Start)
89,536✔
1549
                        {
89,536✔
1550
                                switch (this._reader.Code)
89,536✔
1551
                                {
1552
                                        case 95:
1553
                                                currBorder = (TableEntity.CellEdgeFlags)this._reader.ValueAsInt;
11,776✔
1554
                                                break;
11,776✔
1555
                                        case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
256✔
1556
                                                break;
256✔
1557
                                        case 300 when this._reader.ValueAsString.Equals("CONTENTFORMAT", StringComparison.InvariantCultureIgnoreCase):
5,504✔
1558
                                                readContentFormat(new CadTableCellContentFormatTemplate(new TableEntity.ContentFormat()));
5,504✔
1559
                                                break;
5,504✔
1560
                                        case 301 when this._reader.ValueAsString.Equals("MARGIN", StringComparison.InvariantCultureIgnoreCase):
2,816✔
1561
                                                this.readCellMargin(template);
2,816✔
1562
                                                break;
2,816✔
1563
                                        case 302 when this._reader.ValueAsString.Equals("GRIDFORMAT", StringComparison.InvariantCultureIgnoreCase):
11,776✔
1564
                                                TableEntity.CellBorder border = new TableEntity.CellBorder(currBorder);
11,776✔
1565
                                                this.readGridFormat(template, border);
11,776✔
1566
                                                break;
11,776✔
1567
                                        case 309:
1568
                                                end = this._reader.ValueAsString.Equals("TABLEFORMAT_END", StringComparison.InvariantCultureIgnoreCase);
8,128✔
1569
                                                break;
8,128✔
1570
                                        default:
1571
                                                if (!this.tryAssignCurrentValue(style, mapstyle) && !this.tryAssignCurrentValue(style, mapformat))
49,280!
1572
                                                {
×
1573
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readStyleOverride)} method.", NotificationType.None);
×
1574
                                                }
×
1575
                                                break;
49,280✔
1576
                                }
1577

1578
                                if (end)
89,536✔
1579
                                {
8,128✔
1580
                                        break;
8,128✔
1581
                                }
1582

1583
                                this._reader.ReadNext();
81,408✔
1584
                        }
81,408✔
1585
                }
8,128✔
1586

1587
                private void readGridFormat(CadCellStyleTemplate template, TableEntity.CellBorder border)
1588
                {
11,776✔
1589
                        var map = DxfClassMap.Create(border.GetType(), nameof(TableEntity.CellBorder));
11,776✔
1590

1591
                        this._reader.ReadNext();
11,776✔
1592

1593
                        bool end = false;
11,776✔
1594
                        while (this._reader.DxfCode != DxfCode.Start)
105,984✔
1595
                        {
105,984✔
1596
                                switch (this._reader.Code)
105,984✔
1597
                                {
1598
                                        case 1 when this._reader.ValueAsString.Equals("GRIDFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
11,776✔
1599
                                                break;
11,776✔
1600
                                        case 62:
1601
                                                border.Color = new Color(this._reader.ValueAsShort);
11,776✔
1602
                                                break;
11,776✔
1603
                                        case 92:
1604
                                                border.LineWeight = (LineWeightType)this._reader.ValueAsInt;
11,776✔
1605
                                                break;
11,776✔
1606
                                        case 93:
1607
                                                border.IsInvisible = this._reader.ValueAsBool;
11,776✔
1608
                                                break;
11,776✔
1609
                                        case 340:
1610
                                                template.BorderLinetypePairs.Add(new Tuple<TableEntity.CellBorder, ulong>(border, this._reader.ValueAsHandle));
11,776✔
1611
                                                break;
11,776✔
1612
                                        case 309:
1613
                                                end = this._reader.ValueAsString.Equals("GRIDFORMAT_END", StringComparison.InvariantCultureIgnoreCase);
11,776✔
1614
                                                break;
11,776✔
1615
                                        default:
1616
                                                if (!this.tryAssignCurrentValue(border, map))
35,328!
1617
                                                {
×
1618
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readGridFormat)} method.", NotificationType.None);
×
1619
                                                }
×
1620
                                                break;
35,328✔
1621
                                }
1622

1623
                                if (end)
105,984✔
1624
                                {
11,776✔
1625
                                        break;
11,776✔
1626
                                }
1627

1628
                                this._reader.ReadNext();
94,208✔
1629
                        }
94,208✔
1630
                }
11,776✔
1631

1632
                private void readCellMargin(CadCellStyleTemplate template)
1633
                {
2,816✔
1634
                        var style = template.Format as TableEntity.CellStyle;
2,816✔
1635

1636
                        this._reader.ReadNext();
2,816✔
1637

1638
                        bool end = false;
2,816✔
1639
                        int i = 0;
2,816✔
1640
                        while (this._reader.DxfCode != DxfCode.Start)
22,528✔
1641
                        {
22,528✔
1642
                                switch (this._reader.Code)
22,528!
1643
                                {
1644
                                        case 1 when this._reader.ValueAsString.Equals("CELLMARGIN_BEGIN", StringComparison.InvariantCultureIgnoreCase):
2,816!
1645
                                                break;
2,816✔
1646
                                        case 40:
1647
                                                switch (i)
16,896✔
1648
                                                {
1649
                                                        case 0:
1650
                                                                style.VerticalMargin = this._reader.ValueAsDouble;
2,816✔
1651
                                                                break;
2,816✔
1652
                                                        case 1:
1653
                                                                style.HorizontalMargin = this._reader.ValueAsDouble;
2,816✔
1654
                                                                break;
2,816✔
1655
                                                        case 2:
1656
                                                                style.BottomMargin = this._reader.ValueAsDouble;
2,816✔
1657
                                                                break;
2,816✔
1658
                                                        case 3:
1659
                                                                style.RightMargin = this._reader.ValueAsDouble;
2,816✔
1660
                                                                break;
2,816✔
1661
                                                        case 4:
1662
                                                                style.MarginHorizontalSpacing = this._reader.ValueAsDouble;
2,816✔
1663
                                                                break;
2,816✔
1664
                                                        case 5:
1665
                                                                style.MarginVerticalSpacing = this._reader.ValueAsDouble;
2,816✔
1666
                                                                break;
2,816✔
1667
                                                }
1668

1669
                                                i++;
16,896✔
1670
                                                break;
16,896✔
1671
                                        case 309:
1672
                                                end = this._reader.ValueAsString.Equals("CELLMARGIN_END", StringComparison.InvariantCultureIgnoreCase);
2,816✔
1673
                                                break;
2,816✔
1674
                                        default:
1675
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellMargin)} method.", NotificationType.None);
×
1676
                                                break;
×
1677
                                }
1678

1679
                                if (end)
22,528✔
1680
                                {
2,816✔
1681
                                        break;
2,816✔
1682
                                }
1683

1684
                                this._reader.ReadNext();
19,712✔
1685
                        }
19,712✔
1686
                }
2,816✔
1687

1688
                private void readCustomData()
1689
                {
8,000✔
1690
                        this._reader.ReadNext();
8,000✔
1691

1692
                        int ndata = 0;
8,000✔
1693
                        bool end = false;
8,000✔
1694
                        while (this._reader.DxfCode != DxfCode.Start)
74,432✔
1695
                        {
74,304✔
1696
                                switch (this._reader.Code)
74,304✔
1697
                                {
1698
                                        case 1 when this._reader.ValueAsString.Equals("DATAMAP_BEGIN", StringComparison.InvariantCultureIgnoreCase):
8,000✔
1699
                                                break;
8,000✔
1700
                                        case 90:
1701
                                                ndata = this._reader.ValueAsInt;
8,128✔
1702
                                                break;
8,128✔
1703
                                        case 300:
1704
                                                //Name
1705
                                                break;
5,248✔
1706
                                        case 301 when this._reader.ValueAsString.Equals("DATAMAP_VALUE", StringComparison.InvariantCultureIgnoreCase):
5,248✔
1707
                                                this.readDataMapValue();
5,248✔
1708
                                                break;
5,248✔
1709
                                        case 309:
1710
                                                end = this._reader.ValueAsString.Equals("DATAMAP_END", StringComparison.InvariantCultureIgnoreCase);
7,872✔
1711
                                                break;
7,872✔
1712
                                        default:
1713
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCustomData)} method.", NotificationType.None);
39,808✔
1714
                                                break;
39,808✔
1715
                                }
1716

1717
                                if (end)
74,304✔
1718
                                {
7,872✔
1719
                                        break;
7,872✔
1720
                                }
1721

1722
                                this._reader.ReadNext();
66,432✔
1723
                        }
66,432✔
1724
                }
8,000✔
1725

1726
                private void readDataMapValue()
1727
                {
8,960✔
1728
                        TableEntity.CellValue value = new TableEntity.CellValue();
8,960✔
1729
                        var map = DxfClassMap.Create(value.GetType(), "DATAMAP_VALUE");
8,960✔
1730

1731
                        this._reader.ReadNext();
8,960✔
1732

1733
                        bool end = false;
8,960✔
1734
                        while (this._reader.DxfCode != DxfCode.Start)
330,240✔
1735
                        {
330,112✔
1736
                                switch (this._reader.Code)
330,112✔
1737
                                {
1738
                                        case 11:
1739
                                        case 21:
1740
                                        case 31:
1741
                                                //Value as point
1742
                                                break;
768✔
1743
                                        case 91:
1744
                                        case 92:
1745
                                                //Value as int
1746
                                                break;
38,912✔
1747
                                        case 140:
1748
                                                //Value as double
1749
                                                break;
13,248✔
1750
                                        case 310:
1751
                                                //Value as byte array
1752
                                                break;
256✔
1753
                                        case 304:
1754
                                                end = this._reader.ValueAsString.Equals("ACVALUE_END", StringComparison.InvariantCultureIgnoreCase);
8,832✔
1755
                                                break;
8,832✔
1756
                                        default:
1757
                                                if (!this.tryAssignCurrentValue(value, map))
268,096✔
1758
                                                {
106,880✔
1759
                                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readDataMapValue)} method.", NotificationType.None);
106,880✔
1760
                                                }
106,880✔
1761
                                                break;
268,096✔
1762
                                }
1763

1764
                                if (end)
330,112✔
1765
                                {
8,832✔
1766
                                        break;
8,832✔
1767
                                }
1768

1769
                                this._reader.ReadNext();
321,280✔
1770
                        }
321,280✔
1771
                }
8,960✔
1772

1773
                private bool readVisualStyle(CadTemplate template, DxfMap map)
1774
                {
379,506✔
1775
                        switch (this._reader.Code)
379,506✔
1776
                        {
1777
                                // Undocumented codes
1778
                                case 176:
1779
                                case 177:
1780
                                case 420:
1781
                                        return true;
123,592✔
1782
                                default:
1783
                                        //Avoid noise while is not implemented
1784
                                        return true;
255,914✔
1785
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.VisualStyle]);
1786
                        }
1787
                }
379,506✔
1788

1789
                private bool readSpatialFilter(CadTemplate template, DxfMap map)
1790
                {
4,032✔
1791
                        CadSpatialFilterTemplate tmp = template as CadSpatialFilterTemplate;
4,032✔
1792
                        SpatialFilter filter = tmp.CadObject as SpatialFilter;
4,032✔
1793

1794
                        switch (this._reader.Code)
4,032✔
1795
                        {
1796
                                case 10:
1797
                                        filter.BoundaryPoints.Add(new CSMath.XY(this._reader.ValueAsDouble, 0));
384✔
1798
                                        return true;
384✔
1799
                                case 20:
1800
                                        var pt = filter.BoundaryPoints.LastOrDefault();
384✔
1801
                                        filter.BoundaryPoints.Add(new CSMath.XY(pt.X, this._reader.ValueAsDouble));
384✔
1802
                                        return true;
384✔
1803
                                case 40:
1804
                                        if (filter.ClipFrontPlane && !tmp.HasFrontPlane)
384!
1805
                                        {
×
1806
                                                filter.FrontDistance = this._reader.ValueAsDouble;
×
1807
                                                tmp.HasFrontPlane = true;
×
1808
                                        }
×
1809

1810
                                        double[] array = new double[16]
384✔
1811
                                        {
384✔
1812
                                                0.0, 0.0, 0.0, 0.0,
384✔
1813
                                                0.0, 0.0, 0.0, 0.0,
384✔
1814
                                                0.0, 0.0, 0.0, 0.0,
384✔
1815
                                                0.0, 0.0, 0.0, 1.0
384✔
1816
                                        };
384✔
1817

1818
                                        for (int i = 0; i < 12; i++)
9,984✔
1819
                                        {
4,608✔
1820
                                                array[i] = this._reader.ValueAsDouble;
4,608✔
1821

1822
                                                if (i < 11)
4,608✔
1823
                                                {
4,224✔
1824
                                                        this._reader.ReadNext();
4,224✔
1825
                                                }
4,224✔
1826
                                        }
4,608✔
1827

1828
                                        if (tmp.InsertTransformRead)
384!
1829
                                        {
×
1830
                                                filter.InsertTransform = new Matrix4(array);
×
1831
                                                tmp.InsertTransformRead = true;
×
1832
                                        }
×
1833
                                        else
1834
                                        {
384✔
1835
                                                filter.InverseInsertTransform = new Matrix4(array);
384✔
1836
                                        }
384✔
1837

1838
                                        return true;
384✔
1839
                                case 73:
1840
                                default:
1841
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.SpatialFilter]);
2,880✔
1842
                        }
1843
                }
4,032✔
1844

1845
                private bool readMLineStyle(CadTemplate template, DxfMap map)
1846
                {
3,529✔
1847
                        var tmp = template as CadMLineStyleTemplate;
3,529✔
1848
                        var mLineStyle = template.CadObject as MLineStyle;
3,529✔
1849

1850
                        switch (this._reader.Code)
3,529✔
1851
                        {
1852
                                case 6:
1853
                                        var t = tmp.ElementTemplates.LastOrDefault();
418✔
1854
                                        if (t == null)
418!
1855
                                        {
×
1856
                                                return true;
×
1857
                                        }
1858
                                        t.LineTypeName = this._reader.ValueAsString;
418✔
1859
                                        return true;
418✔
1860
                                case 49:
1861
                                        MLineStyle.Element element = new MLineStyle.Element();
418✔
1862
                                        CadMLineStyleTemplate.ElementTemplate elementTemplate = new CadMLineStyleTemplate.ElementTemplate(element);
418✔
1863
                                        element.Offset = this._reader.ValueAsDouble;
418✔
1864

1865
                                        tmp.ElementTemplates.Add(elementTemplate);
418✔
1866
                                        mLineStyle.AddElement(element);
418✔
1867
                                        return true;
418✔
1868
                                default:
1869
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
2,693✔
1870
                        }
1871
                }
3,529✔
1872

1873
                private bool readTableStyle(CadTemplate template, DxfMap map)
1874
                {
17,845✔
1875
                        var tmp = template as CadTableStyleTemplate;
17,845✔
1876
                        var style = tmp.CadObject;
17,845✔
1877
                        var cellStyle = tmp.CurrentCellStyleTemplate?.CellStyle;
17,845✔
1878

1879
                        switch (this._reader.Code)
17,845!
1880
                        {
1881
                                case 7:
1882
                                        tmp.CreateCurrentCellStyleTemplate();
591✔
1883
                                        tmp.CurrentCellStyleTemplate.TextStyleName = this._reader.ValueAsString;
591✔
1884
                                        return true;
591✔
1885
                                case 94:
1886
                                        cellStyle.Alignment = this._reader.ValueAsInt;
×
1887
                                        return true;
×
1888
                                case 62:
1889
                                        cellStyle.Color = new Color(this._reader.ValueAsShort);
591✔
1890
                                        return true;
591✔
1891
                                case 63:
1892
                                        cellStyle.BackgroundColor = new Color(this._reader.ValueAsShort);
591✔
1893
                                        return true;
591✔
1894
                                case 140:
1895
                                        cellStyle.TextHeight = this._reader.ValueAsDouble;
591✔
1896
                                        return true;
591✔
1897
                                case 170:
1898
                                        cellStyle.CellAlignment = (TableEntity.Cell.CellAlignmentType)this._reader.ValueAsShort;
591✔
1899
                                        return true;
591✔
1900
                                case 283:
1901
                                        cellStyle.IsFillColorOn = this._reader.ValueAsBool;
591✔
1902
                                        return true;
591✔
1903
                                case 90:
1904
                                        cellStyle.Type = (TableEntity.CellStyleType)this._reader.ValueAsShort;
399✔
1905
                                        return true;
399✔
1906
                                case 91:
1907
                                        cellStyle.StyleClass = (TableEntity.CellStyleClass)this._reader.ValueAsShort;
399✔
1908
                                        return true;
399✔
1909
                                case 1:
1910
                                        //Undocumented
1911
                                        return true;
399✔
1912
                                case 274:
1913
                                        cellStyle.TopBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
591✔
1914
                                        return true;
591✔
1915
                                case 275:
1916
                                        cellStyle.HorizontalInsideBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
591✔
1917
                                        return true;
591✔
1918
                                case 276:
1919
                                        cellStyle.BottomBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
591✔
1920
                                        return true;
591✔
1921
                                case 277:
1922
                                        cellStyle.LeftBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
591✔
1923
                                        return true;
591✔
1924
                                case 278:
1925
                                        cellStyle.VerticalInsideBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
591✔
1926
                                        return true;
591✔
1927
                                case 279:
1928
                                        cellStyle.RightBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
591✔
1929
                                        return true;
591✔
1930
                                case 284:
1931
                                        cellStyle.TopBorder.IsInvisible = this._reader.ValueAsBool;
591✔
1932
                                        return true;
591✔
1933
                                case 285:
1934
                                        cellStyle.HorizontalInsideBorder.IsInvisible = this._reader.ValueAsBool;
591✔
1935
                                        return true;
591✔
1936
                                case 286:
1937
                                        cellStyle.BottomBorder.IsInvisible = this._reader.ValueAsBool;
591✔
1938
                                        return true;
591✔
1939
                                case 287:
1940
                                        cellStyle.LeftBorder.IsInvisible = this._reader.ValueAsBool;
591✔
1941
                                        return true;
591✔
1942
                                case 288:
1943
                                        cellStyle.VerticalInsideBorder.IsInvisible = this._reader.ValueAsBool;
591✔
1944
                                        return true;
591✔
1945
                                case 289:
1946
                                        cellStyle.RightBorder.IsInvisible = this._reader.ValueAsBool;
591✔
1947
                                        return true;
591✔
1948
                                case 64:
1949
                                        cellStyle.TopBorder.Color = new Color(this._reader.ValueAsShort);
591✔
1950
                                        return true;
591✔
1951
                                case 65:
1952
                                        cellStyle.HorizontalInsideBorder.Color = new Color(this._reader.ValueAsShort);
591✔
1953
                                        return true;
591✔
1954
                                case 66:
1955
                                        cellStyle.BottomBorder.Color = new Color(this._reader.ValueAsShort);
591✔
1956
                                        return true;
591✔
1957
                                case 67:
1958
                                        cellStyle.LeftBorder.Color = new Color(this._reader.ValueAsShort);
591✔
1959
                                        return true;
591✔
1960
                                case 68:
1961
                                        cellStyle.VerticalInsideBorder.Color = new Color(this._reader.ValueAsShort);
591✔
1962
                                        return true;
591✔
1963
                                case 69:
1964
                                        cellStyle.RightBorder.Color = new Color(this._reader.ValueAsShort);
591✔
1965
                                        return true;
591✔
1966
                                default:
1967
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
2,464✔
1968
                        }
1969
                }
17,845✔
1970

1971
                private bool readMLeaderStyle(CadTemplate template, DxfMap map)
1972
                {
18,636✔
1973
                        var tmp = template as CadMLeaderStyleTemplate;
18,636✔
1974

1975
                        switch (this._reader.Code)
18,636✔
1976
                        {
1977
                                case 179:
1978
                                        return true;
212✔
1979
                                case 340:
1980
                                        tmp.LeaderLineTypeHandle = this._reader.ValueAsHandle;
406✔
1981
                                        return true;
406✔
1982
                                case 342:
1983
                                        tmp.MTextStyleHandle = this._reader.ValueAsHandle;
406✔
1984
                                        return true;
406✔
1985
                                default:
1986
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
17,612✔
1987
                        }
1988
                }
18,636✔
1989

1990
                private bool readEvaluationExpression(CadTemplate template, DxfMap map)
1991
                {
13,737✔
1992
                        CadEvaluationExpressionTemplate tmp = template as CadEvaluationExpressionTemplate;
13,737✔
1993

1994
                        switch (this._reader.Code)
13,737✔
1995
                        {
1996
                                case 1:
1997
                                        this._reader.ExpectedCode(70);
1,158✔
1998
                                        this._reader.ExpectedCode(140);
1,158✔
1999
                                        return true;
1,158✔
2000
                                default:
2001
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.EvalGraphExpr]);
12,579✔
2002
                        }
2003
                }
13,737✔
2004

2005
                private bool readBlockElement(CadTemplate template, DxfMap map)
2006
                {
5,249✔
2007
                        CadBlockElementTemplate tmp = template as CadBlockElementTemplate;
5,249✔
2008

2009
                        switch (this._reader.Code)
5,249✔
2010
                        {
2011
                                default:
2012
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockElement]))
5,249✔
2013
                                        {
4,473✔
2014
                                                return this.readEvaluationExpression(template, map);
4,473✔
2015
                                        }
2016
                                        return true;
776✔
2017
                        }
2018
                }
5,249✔
2019

2020
                private bool readBlockAction(CadTemplate template, DxfMap map)
2021
                {
20✔
2022
                        CadBlockActionTemplate tmp = template as CadBlockActionTemplate;
20✔
2023

2024
                        switch (this._reader.Code)
20✔
2025
                        {
2026
                                default:
2027
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockAction]))
20✔
2028
                                        {
15✔
2029
                                                return this.readBlockElement(template, map);
15✔
2030
                                        }
2031
                                        return true;
5✔
2032
                        }
2033
                }
20✔
2034

2035
                private bool readBlockActionBasePt(CadTemplate template, DxfMap map)
2036
                {
31✔
2037
                        CadBlockActionBasePtTemplate tmp = template as CadBlockActionBasePtTemplate;
31✔
2038

2039
                        switch (this._reader.Code)
31✔
2040
                        {
2041
                                default:
2042
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockActionBasePt]))
31✔
2043
                                        {
20✔
2044
                                                return this.readBlockAction(template, map);
20✔
2045
                                        }
2046
                                        return true;
11✔
2047
                        }
2048
                }
31✔
2049

2050
                private bool readBlockRotationAction(CadTemplate template, DxfMap map)
2051
                {
33✔
2052
                        CadBlockRotationActionTemplate tmp = template as CadBlockRotationActionTemplate;
33✔
2053

2054
                        switch (this._reader.Code)
33✔
2055
                        {
2056
                                default:
2057
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockRotationAction]))
33✔
2058
                                        {
31✔
2059
                                                return this.readBlockActionBasePt(template, map);
31✔
2060
                                        }
2061
                                        return true;
2✔
2062
                        }
2063
                }
33✔
2064

2065
                private bool readBlockParameter(CadTemplate template, DxfMap map)
2066
                {
3,291✔
2067
                        CadBlockParameterTemplate tmp = template as CadBlockParameterTemplate;
3,291✔
2068

2069
                        switch (this._reader.Code)
3,291✔
2070
                        {
2071
                                default:
2072
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockParameter]))
3,291✔
2073
                                        {
2,712✔
2074
                                                return this.readBlockElement(template, map);
2,712✔
2075
                                        }
2076
                                        return true;
579✔
2077
                        }
2078
                }
3,291✔
2079

2080
                private bool readBlock1PtParameter(CadTemplate template, DxfMap map)
2081
                {
4,246✔
2082
                        CadBlock1PtParameterTemplate tmp = template as CadBlock1PtParameterTemplate;
4,246✔
2083

2084
                        switch (this._reader.Code)
4,246✔
2085
                        {
2086
                                default:
2087
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Block1PtParameter]))
4,246✔
2088
                                        {
3,281✔
2089
                                                return this.readBlockParameter(template, map);
3,281✔
2090
                                        }
2091
                                        return true;
965✔
2092
                        }
2093
                }
4,246✔
2094

2095
                private bool readBlock2PtParameter(CadTemplate template, DxfMap map)
2096
                {
14✔
2097
                        var tmp = template as CadBlock2PtParameterTemplate;
14✔
2098

2099
                        switch (this._reader.Code)
14✔
2100
                        {
2101
                                //Stores always 4 entries using this code
2102
                                case 91:
2103
                                        return true;
4✔
2104
                                default:
2105
                                        if (!this.tryAssignCurrentValue(template.CadObject, map))
10!
2106
                                        {
10✔
2107
                                                return this.readBlockParameter(template, map);
10✔
2108
                                        }
2109
                                        return true;
×
2110
                        }
2111
                }
14✔
2112

2113
                private bool readBlockVisibilityParameter(CadTemplate template, DxfMap map)
2114
                {
5,404✔
2115
                        CadBlockVisibilityParameterTemplate tmp = template as CadBlockVisibilityParameterTemplate;
5,404✔
2116

2117
                        switch (this._reader.Code)
5,404✔
2118
                        {
2119
                                case 92:
2120
                                        var stateCount = this._reader.ValueAsInt;
193✔
2121
                                        for (int i = 0; i < stateCount; i++)
1,930✔
2122
                                        {
772✔
2123
                                                this._reader.ReadNext();
772✔
2124
                                                tmp.StateTemplates.Add(this.readState());
772✔
2125
                                        }
772✔
2126
                                        return true;
193✔
2127
                                case 93 when this.currentSubclass == DxfSubclassMarker.BlockVisibilityParameter:
386✔
2128
                                        var entityCount = this._reader.ValueAsInt;
193✔
2129
                                        for (int i = 0; i < entityCount; i++)
780✔
2130
                                        {
197✔
2131
                                                this._reader.ReadNext();
197✔
2132
                                                tmp.EntityHandles.Add(this._reader.ValueAsHandle);
197✔
2133
                                        }
197✔
2134
                                        return true;
193✔
2135
                                default:
2136
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockVisibilityParameter]))
5,018✔
2137
                                        {
4,246✔
2138
                                                return this.readBlock1PtParameter(template, map);
4,246✔
2139
                                        }
2140
                                        return true;
772✔
2141
                        }
2142
                }
5,404✔
2143

2144
                private bool readBlockRotationParameter(CadTemplate template, DxfMap map)
2145
                {
49✔
2146
                        var tmp = template as CadBlockRotationParameterTemplate;
49✔
2147

2148
                        switch (this._reader.Code)
49✔
2149
                        {
2150
                                default:
2151
                                        if (!this.tryAssignCurrentValue(template.CadObject, map))
49✔
2152
                                        {
14✔
2153
                                                return this.readBlock2PtParameter(template, map);
14✔
2154
                                        }
2155
                                        return true;
35✔
2156
                        }
2157
                }
49✔
2158

2159
                private CadBlockVisibilityParameterTemplate.StateTemplate readState()
2160
                {
772✔
2161
                        var state = new BlockVisibilityParameter.State();
772✔
2162
                        var template = new CadBlockVisibilityParameterTemplate.StateTemplate(state);
772✔
2163

2164
                        List<int> expectedCodes = new List<int>();
772✔
2165
                        expectedCodes.Add(303);
772✔
2166
                        expectedCodes.Add(94);
772✔
2167
                        expectedCodes.Add(95);
772✔
2168

2169
                        while (this._reader.DxfCode != DxfCode.Start)
2,316✔
2170
                        {
2,316✔
2171
                                expectedCodes.Remove(this._reader.Code);
2,316✔
2172

2173
                                switch (this._reader.Code)
2,316!
2174
                                {
2175
                                        case 303:
2176
                                                state.Name = this._reader.ValueAsString;
772✔
2177
                                                break;
772✔
2178
                                        case 94:
2179
                                                var count = this._reader.ValueAsInt;
772✔
2180
                                                for (int i = 0; i < count; i++)
2,720✔
2181
                                                {
588✔
2182
                                                        this._reader.ReadNext();
588✔
2183
                                                        template.EntityHandles.Add(this._reader.ValueAsHandle);
588✔
2184
                                                }
588✔
2185
                                                break;
772✔
2186
                                        case 95:
2187
                                                count = this._reader.ValueAsInt;
772✔
2188
                                                for (int i = 0; i < count; i++)
6,152✔
2189
                                                {
2,304✔
2190
                                                        this._reader.ReadNext();
2,304✔
2191
                                                        template.ExpressionHandles.Add(this._reader.ValueAsHandle);
2,304✔
2192
                                                }
2,304✔
2193
                                                break;
772✔
2194
                                        default:
2195
                                                return template;
×
2196
                                }
2197

2198
                                if (!expectedCodes.Any())
2,316✔
2199
                                {
772✔
2200
                                        break;
772✔
2201
                                }
2202

2203
                                this._reader.ReadNext();
1,544✔
2204
                        }
1,544✔
2205

2206
                        return template;
772✔
2207
                }
772✔
2208

2209
                private bool readBlockGrip(CadTemplate template, DxfMap map)
2210
                {
3,880✔
2211
                        CadBlockGripTemplate tmp = template as CadBlockGripTemplate;
3,880✔
2212

2213
                        switch (this._reader.Code)
3,880✔
2214
                        {
2215
                                default:
2216
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockGrip]))
3,880✔
2217
                                        {
2,522✔
2218
                                                return this.readBlockElement(template, map);
2,522✔
2219
                                        }
2220
                                        return true;
1,358✔
2221
                        }
2222
                }
3,880✔
2223

2224
                private bool readBlockRotationGrip(CadTemplate template, DxfMap map)
2225
                {
20✔
2226
                        CadBlockRotationGripTemplate tmp = template as CadBlockRotationGripTemplate;
20✔
2227

2228
                        switch (this._reader.Code)
20✔
2229
                        {
2230
                                default:
2231
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockRotationGrip]))
20!
2232
                                        {
20✔
2233
                                                return this.readBlockGrip(template, map);
20✔
2234
                                        }
2235
                                        return true;
×
2236
                        }
2237
                }
20✔
2238

2239
                private bool readBlockVisibilityGrip(CadTemplate template, DxfMap map)
2240
                {
3,860✔
2241
                        CadBlockVisibilityGripTemplate tmp = template as CadBlockVisibilityGripTemplate;
3,860✔
2242

2243
                        switch (this._reader.Code)
3,860✔
2244
                        {
2245
                                default:
2246
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockVisibilityGrip]))
3,860!
2247
                                        {
3,860✔
2248
                                                return this.readBlockGrip(template, map);
3,860✔
2249
                                        }
2250
                                        return true;
×
2251
                        }
2252
                }
3,860✔
2253

2254
                private bool readBlockRepresentationData(CadTemplate template, DxfMap map)
2255
                {
1,590✔
2256
                        CadBlockRepresentationDataTemplate tmp = template as CadBlockRepresentationDataTemplate;
1,590✔
2257

2258
                        switch (this._reader.Code)
1,590✔
2259
                        {
2260
                                case 340:
2261
                                        tmp.BlockHandle = this._reader.ValueAsHandle;
265✔
2262
                                        return true;
265✔
2263
                                default:
2264
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
1,325✔
2265
                        }
2266
                }
1,590✔
2267

2268
                private bool readBlockGripExpression(CadTemplate template, DxfMap map)
2269
                {
11,580✔
2270
                        CadBlockGripExpressionTemplate tmp = template as CadBlockGripExpressionTemplate;
11,580✔
2271

2272
                        switch (this._reader.Code)
11,580✔
2273
                        {
2274
                                default:
2275
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockGripExpression]))
11,580✔
2276
                                        {
9,264✔
2277
                                                return this.readEvaluationExpression(template, map);
9,264✔
2278
                                        }
2279
                                        return true;
2,316✔
2280
                        }
2281
                }
11,580✔
2282

2283
                private bool readXRecord(CadTemplate template, DxfMap map)
2284
                {
113,272✔
2285
                        CadXRecordTemplate tmp = template as CadXRecordTemplate;
113,272✔
2286

2287
                        switch (this._reader.Code)
113,272✔
2288
                        {
2289
                                case 100 when this._reader.ValueAsString == DxfSubclassMarker.XRecord:
28,926✔
2290
                                        this.readXRecordEntries(tmp);
28,926✔
2291
                                        return true;
28,926✔
2292
                                default:
2293
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.XRecord]);
84,346✔
2294
                        }
2295
                }
113,272✔
2296

2297
                private void readXRecordEntries(CadXRecordTemplate template)
2298
                {
28,926✔
2299
                        this._reader.ReadNext();
28,926✔
2300

2301
                        while (this._reader.DxfCode != DxfCode.Start)
2,409,286✔
2302
                        {
2,380,360✔
2303
                                switch (this._reader.GroupCodeValue)
2,380,360✔
2304
                                {
2305
                                        case GroupCodeValueType.Point3D:
2306
                                                var code = this._reader.Code;
2,901✔
2307
                                                var x = this._reader.ValueAsDouble;
2,901✔
2308
                                                this._reader.ReadNext();
2,901✔
2309
                                                var y = this._reader.ValueAsDouble;
2,901✔
2310
                                                this._reader.ReadNext();
2,901✔
2311
                                                var z = this._reader.ValueAsDouble;
2,901✔
2312
                                                XYZ pt = new XYZ(x, y, z);
2,901✔
2313
                                                template.CadObject.CreateEntry(code, pt);
2,901✔
2314
                                                break;
2,901✔
2315
                                        case GroupCodeValueType.Handle:
2316
                                        case GroupCodeValueType.ObjectId:
2317
                                        case GroupCodeValueType.ExtendedDataHandle:
2318
                                                template.AddHandleReference(this._reader.Code, this._reader.ValueAsHandle);
12,041✔
2319
                                                break;
12,041✔
2320
                                        default:
2321
                                                template.CadObject.CreateEntry(this._reader.Code, this._reader.Value);
2,365,418✔
2322
                                                break;
2,365,418✔
2323
                                }
2324

2325
                                this._reader.ReadNext();
2,380,360✔
2326
                        }
2,380,360✔
2327
                }
28,926✔
2328

2329
                private bool readBookColor(CadTemplate template, DxfMap map)
2330
                {
1,376✔
2331
                        CadNonGraphicalObjectTemplate tmp = template as CadNonGraphicalObjectTemplate;
1,376✔
2332
                        BookColor color = tmp.CadObject as BookColor;
1,376✔
2333

2334
                        switch (this._reader.Code)
1,376✔
2335
                        {
2336
                                case 430:
2337
                                        color.Name = this._reader.ValueAsString;
160✔
2338
                                        return true;
160✔
2339
                                default:
2340
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.DbColor]);
1,216✔
2341
                        }
2342
                }
1,376✔
2343

2344
                private bool readDimensionAssociation(CadTemplate template, DxfMap map)
2345
                {
5,376✔
2346
                        CadDimensionAssociationTemplate tmp = template as CadDimensionAssociationTemplate;
5,376✔
2347
                        DimensionAssociation dimassoc = tmp.CadObject;
5,376✔
2348

2349
                        switch (this._reader.Code)
5,376✔
2350
                        {
2351
                                case 1 when this._reader.ValueAsString.Equals(DimensionAssociation.OsnapPointRefClassName):
768✔
2352
                                        if (dimassoc.AssociativityFlags.HasFlag(AssociativityFlags.FirstPointReference)
768✔
2353
                                                && dimassoc.FirstPointRef == null)
768✔
2354
                                        {
192✔
2355
                                                dimassoc.FirstPointRef = new DimensionAssociation.OsnapPointRef();
192✔
2356
                                                this.readOsnapPointRef(dimassoc.FirstPointRef);
192✔
2357
                                                this.lockPointer = true;
192✔
2358
                                                return true;
192✔
2359
                                        }
2360

2361
                                        if (dimassoc.AssociativityFlags.HasFlag(AssociativityFlags.SecondPointReference)
576!
2362
                                                && dimassoc.SecondPointRef == null)
576✔
2363
                                        {
576✔
2364
                                                dimassoc.SecondPointRef = new DimensionAssociation.OsnapPointRef();
576✔
2365
                                                this.readOsnapPointRef(dimassoc.SecondPointRef);
576✔
2366
                                                this.lockPointer = true;
576✔
2367
                                                return true;
576✔
2368
                                        }
2369

NEW
2370
                                        if (dimassoc.AssociativityFlags.HasFlag(AssociativityFlags.ThirdPointReference)
×
NEW
2371
                                                && dimassoc.ThirdPointRef == null)
×
NEW
2372
                                        {
×
NEW
2373
                                                dimassoc.ThirdPointRef = new DimensionAssociation.OsnapPointRef();
×
NEW
2374
                                                this.readOsnapPointRef(dimassoc.ThirdPointRef);
×
NEW
2375
                                                this.lockPointer = true;
×
NEW
2376
                                                return true;
×
2377
                                        }
2378

NEW
2379
                                        if (dimassoc.AssociativityFlags.HasFlag(AssociativityFlags.FourthPointReference)
×
NEW
2380
                                                && dimassoc.FourthPointRef == null)
×
NEW
2381
                                        {
×
NEW
2382
                                                dimassoc.FourthPointRef = new DimensionAssociation.OsnapPointRef();
×
NEW
2383
                                                this.readOsnapPointRef(dimassoc.FourthPointRef);
×
NEW
2384
                                                this.lockPointer = true;
×
NEW
2385
                                                return true;
×
2386
                                        }
2387

NEW
2388
                                        return true;
×
2389
                                case 330 when template.OwnerHandle.HasValue:
1,152✔
2390
                                        tmp.DimensionHandle = this._reader.ValueAsHandle;
576✔
2391
                                        return true;
576✔
2392
                                default:
2393
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
4,032✔
2394
                        }
2395
                }
5,376✔
2396

2397
                private CadDimensionAssociationTemplate.OsnapPointRefTemplate readOsnapPointRef(DimensionAssociation.OsnapPointRef osnapPoint)
2398
                {
768✔
2399
                        var template = new CadDimensionAssociationTemplate.OsnapPointRefTemplate(osnapPoint);
768✔
2400

2401
                        this._reader.ReadNext();
768✔
2402

2403
                        bool end = false;
768✔
2404
                        while (!end)
8,448✔
2405
                        {
7,680✔
2406
                                switch (this._reader.Code)
7,680!
2407
                                {
2408
                                        case 10:
2409
                                                osnapPoint.OsnapPoint = new XYZ(
768✔
2410
                                                        this._reader.ValueAsDouble,
768✔
2411
                                                        osnapPoint.OsnapPoint.Y,
768✔
2412
                                                        osnapPoint.OsnapPoint.Z
768✔
2413
                                                        );
768✔
2414
                                                break;
768✔
2415
                                        case 20:
2416
                                                osnapPoint.OsnapPoint = new XYZ(
768✔
2417
                                                        osnapPoint.OsnapPoint.X,
768✔
2418
                                                        this._reader.ValueAsDouble,
768✔
2419
                                                        osnapPoint.OsnapPoint.Z
768✔
2420
                                                        );
768✔
2421
                                                break;
768✔
2422
                                        case 30:
2423
                                                osnapPoint.OsnapPoint = new XYZ(
768✔
2424
                                                osnapPoint.OsnapPoint.X,
768✔
2425
                                                osnapPoint.OsnapPoint.Y,
768✔
2426
                                                this._reader.ValueAsDouble
768✔
2427
                                                );
768✔
2428
                                                break;
768✔
2429
                                        case 40:
2430
                                                osnapPoint.GeometryParameter = this._reader.ValueAsDouble;
768✔
2431
                                                break;
768✔
2432
                                        case 72:
2433
                                                osnapPoint.ObjectOsnapType = (ObjectOsnapType)this._reader.ValueAsShort;
768✔
2434
                                                break;
768✔
2435
                                        case 73:
2436
                                                osnapPoint.SubentType = (SubentType)this._reader.ValueAsShort;
768✔
2437
                                                break;
768✔
2438
                                        case 74:
NEW
2439
                                                osnapPoint.IntersectionSubType = (SubentType)this._reader.ValueAsShort;
×
NEW
2440
                                                break;
×
2441
                                        case 75:
2442
                                                osnapPoint.HasLastPointRef = this._reader.ValueAsBool;
768✔
2443
                                                break;
768✔
2444
                                        case 91:
2445
                                                osnapPoint.GsMarker = this._reader.ValueAsInt;
768✔
2446
                                                break;
768✔
2447
                                        case 92:
NEW
2448
                                                osnapPoint.IntersectionGsMarker = this._reader.ValueAsInt;
×
NEW
2449
                                                break;
×
2450
                                        case 331:
2451
                                                template.ObjectHandle = this._reader.ValueAsHandle;
768✔
2452
                                                break;
768✔
2453
                                        case 302:
2454
                                        case 332:
2455
                                                //What are these?
NEW
2456
                                                break;
×
2457
                                        default:
2458
                                                end = true;
768✔
2459
                                                continue;
768✔
2460
                                }
2461

2462
                                this._reader.ReadNext();
6,912✔
2463
                        }
6,912✔
2464

2465
                        return template;
768✔
2466
                }
768✔
2467

2468
                private bool readDictionary(CadTemplate template, DxfMap map)
2469
                {
224,204✔
2470
                        CadDictionaryTemplate tmp = template as CadDictionaryTemplate;
224,204✔
2471
                        CadDictionary cadDictionary = tmp.CadObject;
224,204✔
2472

2473
                        switch (this._reader.Code)
224,204✔
2474
                        {
2475
                                case 280:
2476
                                        cadDictionary.HardOwnerFlag = this._reader.ValueAsBool;
15,069✔
2477
                                        return true;
15,069✔
2478
                                case 281:
2479
                                        cadDictionary.ClonningFlags = (DictionaryCloningFlags)this._reader.Value;
21,522✔
2480
                                        return true;
21,522✔
2481
                                case 3:
2482
                                        tmp.Entries.Add(this._reader.ValueAsString, null);
57,371✔
2483
                                        return true;
57,371✔
2484
                                case 350: // Soft-owner ID/handle to entry object 
2485
                                case 360: // Hard-owner ID/handle to entry object
2486
                                        tmp.Entries[tmp.Entries.LastOrDefault().Key] = this._reader.ValueAsHandle;
57,371✔
2487
                                        return true;
57,371✔
2488
                                default:
2489
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Dictionary]);
72,871✔
2490
                        }
2491
                }
224,204✔
2492

2493
                private bool readDictionaryWithDefault(CadTemplate template, DxfMap map)
2494
                {
1,773✔
2495
                        CadDictionaryWithDefaultTemplate tmp = template as CadDictionaryWithDefaultTemplate;
1,773✔
2496

2497
                        switch (this._reader.Code)
1,773✔
2498
                        {
2499
                                case 340:
2500
                                        tmp.DefaultEntryHandle = this._reader.ValueAsHandle;
197✔
2501
                                        return true;
197✔
2502
                                default:
2503
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.DictionaryWithDefault]))
1,576!
2504
                                        {
1,576✔
2505
                                                return this.readDictionary(template, map);
1,576✔
2506
                                        }
2507
                                        return true;
×
2508
                        }
2509
                }
1,773✔
2510

2511
                private CadTemplate readSortentsTable()
2512
                {
576✔
2513
                        SortEntitiesTable sortTable = new SortEntitiesTable();
576✔
2514
                        CadSortensTableTemplate template = new CadSortensTableTemplate(sortTable);
576✔
2515

2516
                        //Jump the 0 marker
2517
                        this._reader.ReadNext();
576✔
2518

2519
                        this.readCommonObjectData(template);
576✔
2520

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

2523
                        //Jump the 100 marker
2524
                        this._reader.ReadNext();
576✔
2525

2526
                        (ulong?, ulong?) pair = (null, null);
576✔
2527

2528
                        while (this._reader.DxfCode != DxfCode.Start)
4,224✔
2529
                        {
3,648✔
2530
                                switch (this._reader.Code)
3,648!
2531
                                {
2532
                                        case 5:
2533
                                                pair.Item1 = this._reader.ValueAsHandle;
1,536✔
2534
                                                break;
1,536✔
2535
                                        case 330:
2536
                                                template.BlockOwnerHandle = this._reader.ValueAsHandle;
576✔
2537
                                                break;
576✔
2538
                                        case 331:
2539
                                                pair.Item2 = this._reader.ValueAsHandle;
1,536✔
2540
                                                break;
1,536✔
2541
                                        default:
2542
                                                this._builder.Notify($"Group Code not handled {this._reader.GroupCodeValue} for {typeof(SortEntitiesTable)}, code : {this._reader.Code} | value : {this._reader.ValueAsString}");
×
2543
                                                break;
×
2544
                                }
2545

2546
                                if (pair.Item1.HasValue && pair.Item2.HasValue)
3,648✔
2547
                                {
1,536✔
2548
                                        template.Values.Add((pair.Item1.Value, pair.Item2.Value));
1,536✔
2549
                                        pair = (null, null);
1,536✔
2550
                                }
1,536✔
2551

2552
                                this._reader.ReadNext();
3,648✔
2553
                        }
3,648✔
2554

2555
                        return template;
576✔
2556
                }
576✔
2557
        }
2558
}
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