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

DomCR / ACadSharp / 27505372359

14 Jun 2026 04:40PM UTC coverage: 77.012% (+0.04%) from 76.972%
27505372359

push

github

web-flow
Merge pull request #1114 from DomCR/BLOCKLINEARPARAMETER-transfer

Blocklinearparameter transfer

8757 of 12339 branches covered (70.97%)

Branch coverage included in aggregate %.

1284 of 1546 new or added lines in 8 files covered. (83.05%)

19 existing lines in 1 file now uncovered.

31539 of 39985 relevant lines covered (78.88%)

155513.74 hits per line

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

82.79
/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
using static ACadSharp.IO.Templates.CadTableStyleTemplate;
15

16
namespace ACadSharp.IO.DXF.DxfStreamReader;
17

18
internal class DxfObjectsSectionReader : DxfSectionReaderBase
19
{
20
        public delegate bool ReadObjectDelegate<T>(CadTemplate template, DxfMap map) where T : CadObject;
21

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

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

32
                //Loop until the section ends
33
                while (this._reader.ValueAsString != DxfFileToken.EndSection)
82,063✔
34
                {
81,841✔
35
                        CadTemplate template = null;
81,841✔
36

37
                        try
38
                        {
81,841✔
39
                                template = this.readObject();
81,841✔
40
                        }
81,841✔
NEW
41
                        catch (Exception ex)
×
UNCOV
42
                        {
×
NEW
43
                                if (!this._builder.Configuration.Failsafe)
×
NEW
44
                                        throw;
×
45

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

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

52
                        if (template == null)
81,841✔
NEW
53
                                continue;
×
54

55
                        //Add the object and the template to the builder
56
                        this._builder.AddTemplate(template);
81,841✔
57
                }
81,841✔
58
        }
222✔
59

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

154
                                this._reader.ReadNext();
3,498✔
155

156
                                do
157
                                {
244,237✔
158
                                        if (unknownEntityTemplate != null && this._builder.KeepUnknownEntities)
244,237!
159
                                        {
27,840✔
160
                                                this.readCommonCodes(unknownEntityTemplate, out bool isExtendedData, map);
27,840✔
161
                                                if (isExtendedData)
27,840✔
NEW
162
                                                        continue;
×
163
                                        }
27,840✔
164

165
                                        this._reader.ReadNext();
244,237✔
166
                                }
244,237✔
167
                                while (this._reader.DxfCode != DxfCode.Start);
244,237✔
168

169
                                return unknownEntityTemplate;
3,498✔
170
                }
171
        }
81,841✔
172

173
        protected CadTemplate readObjectCodes<T>(CadTemplate template, ReadObjectDelegate<T> readObject)
174
                where T : CadObject
175
        {
77,731✔
176
                this._reader.ReadNext();
77,731✔
177

178
                DxfMap map = DxfMap.Create<T>();
77,731✔
179

180
                while (this._reader.DxfCode != DxfCode.Start)
1,123,013✔
181
                {
1,045,282✔
182
                        if (!readObject(template, map))
1,045,282✔
183
                        {
252,908✔
184
                                this.readCommonCodes(template, out bool isExtendedData, map);
252,908✔
185
                                if (isExtendedData)
252,908✔
186
                                        continue;
3,377✔
187
                        }
249,531✔
188

189
                        if (this.lockPointer)
1,041,905✔
190
                        {
2,728✔
191
                                this.lockPointer = false;
2,728✔
192
                                continue;
2,728✔
193
                        }
194

195
                        if (this._reader.DxfCode != DxfCode.Start)
1,039,177✔
196
                        {
1,008,436✔
197
                                this._reader.ReadNext();
1,008,436✔
198
                        }
1,008,436✔
199
                }
1,039,177✔
200

201
                return template;
77,731✔
202
        }
77,731✔
203

204
        private bool readFieldList(CadTemplate template, DxfMap map)
NEW
205
        {
×
NEW
206
                var tmp = template as CadFieldListTemplate;
×
207

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

223
        private bool readField(CadTemplate template, DxfMap map)
NEW
224
        {
×
NEW
225
                var tmp = template as CadFieldTemplate;
×
226

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

257
        private bool readProxyObject(CadTemplate template, DxfMap map)
NEW
258
        {
×
NEW
259
                CadProxyObjectTemplate tmp = template as CadProxyObjectTemplate;
×
NEW
260
                ProxyObject proxy = template.CadObject as ProxyObject;
×
261

NEW
262
                switch (this._reader.Code)
×
263
                {
264
                        case 90:
265
                        case 94:
266
                        //Undocumented
267
                        case 97:
268
                        case 71:
NEW
269
                                return true;
×
270
                        case 95:
NEW
271
                                int format = this._reader.ValueAsInt;
×
NEW
272
                                proxy.Version = (ACadVersion)(format & 0xFFFF);
×
NEW
273
                                proxy.MaintenanceVersion = (short)(format >> 16);
×
NEW
274
                                return true;
×
275
                        case 91:
NEW
276
                                var classId = this._reader.ValueAsShort;
×
NEW
277
                                if (this._builder.DocumentToBuild.Classes.TryGetByClassNumber(classId, out DxfClass dxfClass))
×
NEW
278
                                {
×
NEW
279
                                        proxy.DxfClass = dxfClass;
×
NEW
280
                                }
×
NEW
281
                                return true;
×
282
                        case 161:
NEW
283
                                return true;
×
284
                        case 162:
NEW
285
                                return true;
×
286
                        case 310:
NEW
287
                                if (proxy.BinaryData == null)
×
NEW
288
                                {
×
NEW
289
                                        proxy.BinaryData = new MemoryStream();
×
NEW
290
                                }
×
NEW
291
                                proxy.BinaryData.Write(this._reader.ValueAsBinaryChunk, 0, this._reader.ValueAsBinaryChunk.Length);
×
NEW
292
                                return true;
×
293
                        case 311:
NEW
294
                                if (proxy.Data == null)
×
NEW
295
                                {
×
NEW
296
                                        proxy.Data = new MemoryStream();
×
NEW
297
                                }
×
NEW
298
                                proxy.Data.Write(this._reader.ValueAsBinaryChunk, 0, this._reader.ValueAsBinaryChunk.Length);
×
NEW
299
                                return true;
×
300
                        case 330:
301
                        case 340:
302
                        case 350:
303
                        case 360:
NEW
304
                                tmp.Entries.Add(this._reader.ValueAsHandle);
×
NEW
305
                                return true;
×
306
                        default:
NEW
307
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.ProxyObject]);
×
308
                }
NEW
309
        }
×
310

311
        private bool readObjectSubclassMap(CadTemplate template, DxfMap map)
312
        {
24,486✔
313
                switch (this._reader.Code)
24,486✔
314
                {
315
                        default:
316
                                if (string.IsNullOrEmpty(this.currentSubclass))
24,486✔
317
                                {
15,378✔
318
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
15,378✔
319
                                }
320
                                else
321
                                {
9,108✔
322
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[this.currentSubclass]);
9,108✔
323
                                }
324
                }
325
        }
24,486✔
326

327
        private bool readAnnotScaleObjectContextData(CadTemplate template, DxfMap map)
NEW
328
        {
×
NEW
329
                var tmp = template as CadAnnotScaleObjectContextDataTemplate;
×
NEW
330
                switch (this._reader.Code)
×
331
                {
332
                        case 340:
NEW
333
                                tmp.ScaleHandle = this._reader.ValueAsHandle;
×
NEW
334
                                return true;
×
335
                        default:
NEW
336
                                if (string.IsNullOrEmpty(this.currentSubclass))
×
NEW
337
                                {
×
NEW
338
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
×
339
                                }
340
                                else
NEW
341
                                {
×
NEW
342
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[this.currentSubclass]);
×
343
                                }
344
                }
NEW
345
        }
×
346

347
        private bool readPlotSettings(CadTemplate template, DxfMap map)
348
        {
28,012✔
349
                switch (this._reader.Code)
28,012✔
350
                {
351
                        default:
352
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.PlotSettings]);
28,012✔
353
                }
354
        }
28,012✔
355

356
        private bool readEvaluationGraph(CadTemplate template, DxfMap map)
357
        {
3,296✔
358
                CadEvaluationGraphTemplate tmp = template as CadEvaluationGraphTemplate;
3,296✔
359
                EvaluationGraph evGraph = tmp.CadObject;
3,296✔
360

361
                switch (this._reader.Code)
3,296✔
362
                {
363
                        case 91:
364
                                while (this._reader.Code == 91)
3,222✔
365
                                {
2,742✔
366
                                        GraphNodeTemplate nodeTemplate = new GraphNodeTemplate();
2,742✔
367
                                        EvaluationGraph.Node node = nodeTemplate.Node;
2,742✔
368

369
                                        node.Index = this._reader.ValueAsInt;
2,742✔
370

371
                                        this._reader.ExpectedCode(93);
2,742✔
372
                                        node.Flags = this._reader.ValueAsInt;
2,742✔
373

374
                                        this._reader.ExpectedCode(95);
2,742✔
375
                                        node.NextNodeIndex = this._reader.ValueAsInt;
2,742✔
376

377
                                        this._reader.ExpectedCode(360);
2,742✔
378
                                        nodeTemplate.ExpressionHandle = this._reader.ValueAsHandle;
2,742✔
379

380
                                        this._reader.ExpectedCode(92);
2,742✔
381
                                        node.Data1 = this._reader.ValueAsInt;
2,742✔
382
                                        this._reader.ExpectedCode(92);
2,742✔
383
                                        node.Data2 = this._reader.ValueAsInt;
2,742✔
384
                                        this._reader.ExpectedCode(92);
2,742✔
385
                                        node.Data3 = this._reader.ValueAsInt;
2,742✔
386
                                        this._reader.ExpectedCode(92);
2,742✔
387
                                        node.Data4 = this._reader.ValueAsInt;
2,742✔
388

389
                                        this._reader.ReadNext();
2,742✔
390

391
                                        tmp.NodeTemplates.Add(nodeTemplate);
2,742✔
392
                                }
2,742✔
393

394
                                this.lockPointer = true;
480✔
395
                                return true;
480✔
396
                        case 92:
397
                                //Edges
398
                                while (this._reader.Code == 92)
2,266✔
399
                                {
2,058✔
400
                                        this._reader.ExpectedCode(93);
2,058✔
401
                                        this._reader.ExpectedCode(94);
2,058✔
402
                                        this._reader.ExpectedCode(91);
2,058✔
403
                                        this._reader.ExpectedCode(91);
2,058✔
404
                                        this._reader.ExpectedCode(92);
2,058✔
405
                                        this._reader.ExpectedCode(92);
2,058✔
406
                                        this._reader.ExpectedCode(92);
2,058✔
407
                                        this._reader.ExpectedCode(92);
2,058✔
408
                                        this._reader.ExpectedCode(92);
2,058✔
409

410
                                        this._reader.ReadNext();
2,058✔
411
                                }
2,058✔
412

413
                                this.lockPointer = true;
208✔
414
                                return true;
208✔
415
                        default:
416
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.EvalGraph]);
2,608✔
417
                }
418
        }
3,296✔
419

420
        private bool readLayout(CadTemplate template, DxfMap map)
421
        {
55,272✔
422
                CadLayoutTemplate tmp = template as CadLayoutTemplate;
55,272✔
423

424
                switch (this._reader.Code)
55,272✔
425
                {
426
                        case 330 when template.OwnerHandle.HasValue:
1,716✔
427
                                tmp.PaperSpaceBlockHandle = this._reader.ValueAsHandle;
858✔
428
                                return true;
858✔
429
                        case 331:
430
                                tmp.LasActiveViewportHandle = (this._reader.ValueAsHandle);
822✔
431
                                return true;
822✔
432
                        default:
433
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Layout]))
53,592✔
434
                                {
28,012✔
435
                                        return this.readPlotSettings(template, map);
28,012✔
436
                                }
437
                                return true;
25,580✔
438
                }
439
        }
55,272✔
440

441
        private bool readGroup(CadTemplate template, DxfMap map)
442
        {
5,304✔
443
                CadGroupTemplate tmp = template as CadGroupTemplate;
5,304✔
444

445
                switch (this._reader.Code)
5,304✔
446
                {
447
                        case 70:
448
                                return true;
408✔
449
                        case 340:
450
                                tmp.Handles.Add(this._reader.ValueAsHandle);
2,448✔
451
                                return true;
2,448✔
452
                        default:
453
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
2,448✔
454
                }
455
        }
5,304✔
456

457
        private bool readGeoData(CadTemplate template, DxfMap map)
458
        {
102✔
459
                CadGeoDataTemplate tmp = template as CadGeoDataTemplate;
102✔
460

461
                switch (this._reader.Code)
102✔
462
                {
463
                        case 40 when tmp.CadObject.Version == GeoDataVersion.R2009:
2✔
464
                                tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
465
                                        tmp.CadObject.ReferencePoint.X,
1✔
466
                                        this._reader.ValueAsDouble,
1✔
467
                                        tmp.CadObject.ReferencePoint.Z
1✔
468
                                        );
1✔
469
                                return true;
1✔
470
                        case 41 when tmp.CadObject.Version == GeoDataVersion.R2009:
2✔
471
                                tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
472
                                        this._reader.ValueAsDouble,
1✔
473
                                        tmp.CadObject.ReferencePoint.Y,
1✔
474
                                        tmp.CadObject.ReferencePoint.Z
1✔
475
                                        );
1✔
476
                                return true;
1✔
477
                        case 42 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
478
                                tmp.CadObject.ReferencePoint = new CSMath.XYZ(
1✔
479
                                        tmp.CadObject.ReferencePoint.X,
1✔
480
                                        tmp.CadObject.ReferencePoint.Y,
1✔
481
                                        this._reader.ValueAsDouble
1✔
482
                                        );
1✔
483
                                return true;
1✔
484
                        case 46 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
485
                                tmp.CadObject.HorizontalUnitScale = this._reader.ValueAsDouble;
1✔
486
                                return true;
1✔
487
                        case 52 when tmp.CadObject.Version == GeoDataVersion.R2009:
1✔
488
                                double angle = System.Math.PI / 2.0 - this._reader.ValueAsAngle;
1✔
489
                                tmp.CadObject.NorthDirection = new CSMath.XY(Math.Cos(angle), Math.Sin(angle));
1✔
490
                                return true;
1✔
491
                        // Number of Geo-Mesh points
492
                        case 93:
493
                                var npts = this._reader.ValueAsInt;
3✔
494
                                for (int i = 0; i < npts; i++)
54✔
495
                                {
24✔
496
                                        this._reader.ReadNext();
24✔
497
                                        double sourceX = this._reader.ValueAsDouble;
24✔
498
                                        this._reader.ReadNext();
24✔
499
                                        double sourceY = this._reader.ValueAsDouble;
24✔
500

501
                                        this._reader.ReadNext();
24✔
502
                                        double destX = this._reader.ValueAsDouble;
24✔
503
                                        this._reader.ReadNext();
24✔
504
                                        double destY = this._reader.ValueAsDouble;
24✔
505

506
                                        tmp.CadObject.Points.Add(new GeoData.GeoMeshPoint
24✔
507
                                        {
24✔
508
                                                Source = new CSMath.XY(sourceX, sourceY),
24✔
509
                                                Destination = new CSMath.XY(destX, destY)
24✔
510
                                        });
24✔
511
                                }
24✔
512
                                return true;
3✔
513
                        // Number of Geo-Mesh points
514
                        case 96:
515
                                var nfaces = this._reader.ValueAsInt;
2✔
516
                                for (int i = 0; i < nfaces; i++)
4!
UNCOV
517
                                {
×
NEW
518
                                        this._reader.ReadNext();
×
NEW
519
                                        Debug.Assert(this._reader.Code == 97);
×
NEW
520
                                        int index1 = this._reader.ValueAsInt;
×
NEW
521
                                        this._reader.ReadNext();
×
NEW
522
                                        Debug.Assert(this._reader.Code == 98);
×
NEW
523
                                        int index2 = this._reader.ValueAsInt;
×
NEW
524
                                        this._reader.ReadNext();
×
NEW
525
                                        Debug.Assert(this._reader.Code == 99);
×
NEW
526
                                        int index3 = this._reader.ValueAsInt;
×
527

NEW
528
                                        tmp.CadObject.Faces.Add(new GeoData.GeoMeshFace
×
NEW
529
                                        {
×
NEW
530
                                                Index1 = index1,
×
NEW
531
                                                Index2 = index2,
×
NEW
532
                                                Index3 = index3
×
NEW
533
                                        });
×
UNCOV
534
                                }
×
535
                                return true;
2✔
536
                        case 303:
537
                                tmp.CadObject.CoordinateSystemDefinition += this._reader.ValueAsString;
13✔
538
                                return true;
13✔
539
                        //Obsolete codes for version GeoDataVersion.R2009
540
                        case 3:
541
                        case 4:
542
                        case 14:
543
                        case 24:
544
                        case 15:
545
                        case 25:
546
                        case 43:
547
                        case 44:
548
                        case 45:
549
                        case 94:
550
                        case 293:
551
                        case 16:
552
                        case 26:
553
                        case 17:
554
                        case 27:
555
                        case 54:
556
                        case 140:
557
                        case 304:
558
                        case 292:
559
                                return true;
19✔
560
                        default:
561
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
60✔
562
                }
563
        }
102✔
564

565
        private bool readMaterial(CadTemplate template, DxfMap map)
566
        {
44,764✔
567
                CadMaterialTemplate tmp = template as CadMaterialTemplate;
44,764✔
568
                List<double> arr = null;
44,764✔
569

570
                switch (this._reader.Code)
44,764!
571
                {
572
                        case 43:
573
                                arr = new();
1,434✔
574
                                for (int i = 0; i < 16; i++)
48,756✔
575
                                {
22,944✔
576
                                        Debug.Assert(this._reader.Code == 43);
22,944✔
577

578
                                        arr.Add(this._reader.ValueAsDouble);
22,944✔
579

580
                                        this._reader.ReadNext();
22,944✔
581
                                }
22,944✔
582

583
                                tmp.CadObject.DiffuseMatrix = new CSMath.Matrix4(arr.ToArray());
1,434✔
584
                                return this.checkObjectEnd(template, map, this.readMaterial);
1,434✔
585
                        case 47:
NEW
586
                                arr = new();
×
NEW
587
                                for (int i = 0; i < 16; i++)
×
UNCOV
588
                                {
×
NEW
589
                                        Debug.Assert(this._reader.Code == 47);
×
590

NEW
591
                                        arr.Add(this._reader.ValueAsDouble);
×
592

NEW
593
                                        this._reader.ReadNext();
×
NEW
594
                                }
×
595

NEW
596
                                tmp.CadObject.SpecularMatrix = new CSMath.Matrix4(arr.ToArray());
×
NEW
597
                                return this.checkObjectEnd(template, map, this.readMaterial);
×
598
                        case 49:
599
                                arr = new();
210✔
600
                                for (int i = 0; i < 16; i++)
7,140✔
601
                                {
3,360✔
602
                                        Debug.Assert(this._reader.Code == 49);
3,360✔
603

604
                                        arr.Add(this._reader.ValueAsDouble);
3,360✔
605

606
                                        this._reader.ReadNext();
3,360✔
607
                                }
3,360✔
608

609
                                tmp.CadObject.ReflectionMatrix = new CSMath.Matrix4(arr.ToArray());
210✔
610
                                return this.checkObjectEnd(template, map, this.readMaterial);
210✔
611
                        case 142:
612
                                arr = new();
210✔
613
                                for (int i = 0; i < 16; i++)
7,140✔
614
                                {
3,360✔
615
                                        Debug.Assert(this._reader.Code == 142);
3,360✔
616

617
                                        arr.Add(this._reader.ValueAsDouble);
3,360✔
618

619
                                        this._reader.ReadNext();
3,360✔
620
                                }
3,360✔
621

622
                                tmp.CadObject.OpacityMatrix = new CSMath.Matrix4(arr.ToArray());
210✔
623
                                return this.checkObjectEnd(template, map, this.readMaterial);
210✔
624
                        case 144:
625
                                arr = new();
1,230✔
626
                                for (int i = 0; i < 16; i++)
41,820✔
627
                                {
19,680✔
628
                                        Debug.Assert(this._reader.Code == 144);
19,680✔
629

630
                                        arr.Add(this._reader.ValueAsDouble);
19,680✔
631

632
                                        this._reader.ReadNext();
19,680✔
633
                                }
19,680✔
634

635
                                tmp.CadObject.BumpMatrix = new CSMath.Matrix4(arr.ToArray());
1,230✔
636
                                return this.checkObjectEnd(template, map, this.readMaterial);
1,230✔
637
                        case 147:
NEW
638
                                arr = new();
×
NEW
639
                                for (int i = 0; i < 16; i++)
×
NEW
640
                                {
×
NEW
641
                                        Debug.Assert(this._reader.Code == 147);
×
642

NEW
643
                                        arr.Add(this._reader.ValueAsDouble);
×
644

NEW
645
                                        this._reader.ReadNext();
×
NEW
646
                                }
×
647

NEW
648
                                tmp.CadObject.RefractionMatrix = new CSMath.Matrix4(arr.ToArray());
×
NEW
649
                                return this.checkObjectEnd(template, map, this.readMaterial);
×
650
                        default:
651
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
41,680✔
652
                }
653
        }
44,764✔
654

655
        private bool readScale(CadTemplate template, DxfMap map)
656
        {
62,370✔
657
                switch (this._reader.Code)
62,370✔
658
                {
659
                        // Undocumented codes
660
                        case 70:
661
                                //Always 0
662
                                return true;
6,930✔
663
                        default:
664
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Scale]);
55,440✔
665
                }
666
        }
62,370✔
667

668
        private void readLinkedData(CadTemplate template, DxfMap map)
669
        {
340✔
670
                CadTableContentTemplate tmp = template as CadTableContentTemplate;
340✔
671
                LinkedData linkedData = tmp.CadObject;
340✔
672

673
                this._reader.ReadNext();
340✔
674

675
                while (this._reader.DxfCode != DxfCode.Start && this._reader.DxfCode != DxfCode.Subclass)
1,020!
676
                {
680✔
677
                        switch (this._reader.Code)
680✔
678
                        {
679
                                default:
680
                                        if (!this.tryAssignCurrentValue(linkedData, map.SubClasses[DxfSubclassMarker.LinkedData]))
680!
NEW
681
                                        {
×
NEW
682
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedData)} {this._reader.Position}.", NotificationType.None);
×
NEW
683
                                        }
×
684
                                        break;
680✔
685
                        }
686

687
                        this._reader.ReadNext();
680✔
688
                }
680✔
689
        }
340✔
690

691
        private bool readTableContent(CadTemplate template, DxfMap map)
692
        {
2,516✔
693
                switch (this._reader.Code)
2,516✔
694
                {
695
                        case 100 when this._reader.ValueAsString.Equals(DxfSubclassMarker.TableContent, StringComparison.InvariantCultureIgnoreCase):
1,292✔
696
                                this.readTableContentSubclass(template, map);
272✔
697
                                this.lockPointer = true;
272✔
698
                                return true;
272✔
699
                        case 100 when this._reader.ValueAsString.Equals(DxfSubclassMarker.FormattedTableData, StringComparison.InvariantCultureIgnoreCase):
1,020✔
700
                                this.readFormattedTableDataSubclass(template, map);
272✔
701
                                this.lockPointer = true;
272✔
702
                                return true;
272✔
703
                        case 100 when this._reader.ValueAsString.Equals(DxfSubclassMarker.LinkedTableData, StringComparison.InvariantCultureIgnoreCase):
748✔
704
                                this.readLinkedTableDataSubclass(template, map);
340✔
705
                                this.lockPointer = true;
340✔
706
                                return true;
340✔
707
                        case 100 when this._reader.ValueAsString.Equals(DxfSubclassMarker.LinkedData, StringComparison.InvariantCultureIgnoreCase):
408✔
708
                                this.readLinkedData(template, map);
340✔
709
                                this.lockPointer = true;
340✔
710
                                return true;
340✔
711
                        default:
712
                                return false;
1,292✔
713
                }
714
        }
2,516✔
715

716
        private void readTableContentSubclass(CadTemplate template, DxfMap map)
717
        {
272✔
718
                CadTableContentTemplate tmp = template as CadTableContentTemplate;
272✔
719
                TableContent tableContent = tmp.CadObject;
272✔
720

721
                this._reader.ReadNext();
272✔
722

723
                while (this._reader.DxfCode != DxfCode.Start && this._reader.DxfCode != DxfCode.Subclass)
544✔
724
                {
272✔
725
                        switch (this._reader.Code)
272!
726
                        {
727
                                case 340:
728
                                        tmp.SytleHandle = this._reader.ValueAsHandle;
272✔
729
                                        break;
272✔
730
                                default:
NEW
731
                                        if (!this.tryAssignCurrentValue(tableContent, map.SubClasses[DxfSubclassMarker.TableContent]))
×
NEW
732
                                        {
×
NEW
733
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableContentSubclass)} {this._reader.Position}.", NotificationType.None);
×
NEW
734
                                        }
×
NEW
735
                                        break;
×
736
                        }
737

738
                        this._reader.ReadNext();
272✔
739
                }
272✔
740
        }
272✔
741

742
        private void readFormattedTableDataSubclass(CadTemplate template, DxfMap map)
743
        {
272✔
744
                CadTableContentTemplate tmp = template as CadTableContentTemplate;
272✔
745
                FormattedTableData formattedTable = tmp.CadObject;
272✔
746

747
                this._reader.ReadNext();
272✔
748

749
                TableEntity.CellRange cellRange = null;
272✔
750
                while (this._reader.DxfCode != DxfCode.Start && this._reader.DxfCode != DxfCode.Subclass)
2,448!
751
                {
2,176✔
752
                        switch (this._reader.Code)
2,176!
753
                        {
754
                                case 90:
755
                                        break;
272✔
756
                                case 91:
757
                                        if (cellRange == null)
408✔
758
                                        {
408✔
759
                                                cellRange = new();
408✔
760
                                                formattedTable.MergedCellRanges.Add(cellRange);
408✔
761
                                        }
408✔
762
                                        cellRange.TopRowIndex = this._reader.ValueAsInt;
408✔
763
                                        break;
408✔
764
                                case 92:
765
                                        if (cellRange == null)
408!
766
                                        {
×
NEW
767
                                                cellRange = new();
×
NEW
768
                                                formattedTable.MergedCellRanges.Add(cellRange);
×
769
                                        }
×
770
                                        cellRange.LeftColumnIndex = this._reader.ValueAsInt;
408✔
771
                                        break;
408✔
772
                                case 93:
773
                                        if (cellRange == null)
408!
774
                                        {
×
NEW
775
                                                cellRange = new();
×
NEW
776
                                                formattedTable.MergedCellRanges.Add(cellRange);
×
777
                                        }
×
778
                                        cellRange.BottomRowIndex = this._reader.ValueAsInt;
408✔
779
                                        break;
408✔
780
                                case 94:
781
                                        if (cellRange == null)
408!
UNCOV
782
                                        {
×
NEW
783
                                                cellRange = new();
×
NEW
784
                                                formattedTable.MergedCellRanges.Add(cellRange);
×
UNCOV
785
                                        }
×
786
                                        cellRange.RightColumnIndex = this._reader.ValueAsInt;
408✔
787
                                        cellRange = null;
408✔
788
                                        break;
408✔
789
                                case 300 when this._reader.ValueAsString.Equals("TABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
272!
790
                                        this.readStyleOverride(new CadCellStyleTemplate(formattedTable.CellStyleOverride));
272✔
791
                                        break;
272✔
792
                                default:
NEW
793
                                        if (!this.tryAssignCurrentValue(formattedTable, map.SubClasses[DxfSubclassMarker.FormattedTableData]))
×
UNCOV
794
                                        {
×
NEW
795
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableDataSubclass)} {this._reader.Position}.", NotificationType.None);
×
UNCOV
796
                                        }
×
NEW
797
                                        break;
×
798
                        }
799

800
                        this._reader.ReadNext();
2,176✔
801
                }
2,176✔
802
        }
272✔
803

804
        private void readLinkedTableDataSubclass(CadTemplate template, DxfMap map)
805
        {
340✔
806
                CadTableContentTemplate tmp = template as CadTableContentTemplate;
340✔
807
                TableContent tableContent = tmp.CadObject;
340✔
808

809
                this._reader.ReadNext();
340✔
810

811
                while (this._reader.DxfCode != DxfCode.Start && this._reader.DxfCode != DxfCode.Subclass)
4,488!
812
                {
4,148✔
813
                        switch (this._reader.Code)
4,148✔
814
                        {
815
                                case 90:
816
                                        //Column count
817
                                        break;
340✔
818
                                case 91:
819
                                        //Row count
820
                                        break;
340✔
821
                                //Unknown
822
                                case 92:
823
                                        break;
272✔
824
                                case 300 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableColumn, StringComparison.InvariantCultureIgnoreCase):
1,292✔
825
                                        //Read Column
826
                                        this.readTableColumn();
1,292✔
827
                                        break;
1,292✔
828
                                case 301 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableRow, StringComparison.InvariantCultureIgnoreCase):
1,564✔
829
                                        //Read Row
830
                                        this.readTableRow();
1,564✔
831
                                        break;
1,564✔
832
                                default:
833
                                        if (!this.tryAssignCurrentValue(tableContent, map.SubClasses[DxfSubclassMarker.LinkedTableData]))
340✔
834
                                        {
340✔
835
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableDataSubclass)} {this._reader.Position}.", NotificationType.None);
340✔
836
                                        }
340✔
837
                                        break;
340✔
838
                        }
839

840
                        this._reader.ReadNext();
4,148✔
841
                }
4,148✔
842
        }
340✔
843

844

845
        private TableEntity.Column readTableColumn()
846
        {
1,292✔
847
                this._reader.ReadNext();
1,292✔
848

849
                TableEntity.Column column = new TableEntity.Column();
1,292✔
850

851
                bool end = false;
1,292✔
852
                while (this._reader.DxfCode != DxfCode.Start)
3,876!
853
                {
3,876✔
854
                        switch (this._reader.Code)
3,876!
855
                        {
856
                                case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataColumn_BEGIN, StringComparison.InvariantCultureIgnoreCase):
3,876✔
857
                                        this.readLinkedTableColumn(column);
1,292✔
858
                                        break;
1,292✔
859
                                case 1 when this._reader.ValueAsString.Equals(DxfFileToken.FormattedTableDataColumn_BEGIN, StringComparison.InvariantCultureIgnoreCase):
2,584✔
860
                                        this.readFormattedTableColumn(column);
1,292✔
861
                                        break;
1,292✔
862
                                case 1 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableColumnBegin, StringComparison.InvariantCultureIgnoreCase):
1,292!
863
                                        this.readTableColumn(column);
1,292✔
864
                                        end = true;
1,292✔
865
                                        break;
1,292✔
866
                                default:
NEW
867
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableColumn)} method.", NotificationType.None);
×
NEW
868
                                        break;
×
869
                        }
870

871
                        if (end)
3,876✔
872
                        {
1,292✔
873
                                return column;
1,292✔
874
                        }
875

876
                        this._reader.ReadNext();
2,584✔
877
                }
2,584✔
878

NEW
879
                return column;
×
880
        }
1,292✔
881

882
        private TableEntity.Row readTableRow()
883
        {
1,564✔
884
                this._reader.ReadNext();
1,564✔
885

886
                TableEntity.Row row = new TableEntity.Row();
1,564✔
887

888
                bool end = false;
1,564✔
889
                while (this._reader.DxfCode != DxfCode.Start)
12,648✔
890
                {
12,580✔
891
                        switch (this._reader.Code)
12,580✔
892
                        {
893
                                case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataRow_BEGIN, StringComparison.InvariantCultureIgnoreCase):
6,392✔
894
                                        this.readLinkedTableRow(row);
1,632✔
895
                                        break;
1,632✔
896
                                case 1 when this._reader.ValueAsString.Equals(DxfFileToken.FormattedTableDataRow_BEGIN, StringComparison.InvariantCultureIgnoreCase):
4,760✔
897
                                        this.readFormattedTableRow(row);
1,496✔
898
                                        break;
1,496✔
899
                                case 1 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectTableRowBegin, StringComparison.InvariantCultureIgnoreCase):
3,264✔
900
                                        this.readTableRow(row);
1,496✔
901
                                        end = true;
1,496✔
902
                                        break;
1,496✔
903
                                default:
904
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableRow)} method.", NotificationType.None);
7,956✔
905
                                        break;
7,956✔
906
                        }
907

908
                        if (end)
12,580✔
909
                        {
1,496✔
910
                                return row;
1,496✔
911
                        }
912

913
                        this._reader.ReadNext();
11,084✔
914
                }
11,084✔
915

916
                return row;
68✔
917
        }
1,564✔
918

919
        private void readTableRow(TableEntity.Row row)
920
        {
1,496✔
921
                this._reader.ReadNext();
1,496✔
922

923
                bool end = false;
1,496✔
924
                while (this._reader.DxfCode != DxfCode.Start)
4,488✔
925
                {
4,488✔
926
                        switch (this._reader.Code)
4,488!
927
                        {
928
                                case 40:
929
                                        row.Height = this._reader.ValueAsDouble;
1,496✔
930
                                        break;
1,496✔
931
                                case 90:
932
                                        //styleID
933
                                        break;
1,496✔
934
                                case 309:
935
                                        end = this._reader.ValueAsString.Equals("TABLEROW_END", StringComparison.InvariantCultureIgnoreCase);
1,496✔
936
                                        break;
1,496✔
937
                                default:
NEW
938
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableRow)} method.", NotificationType.None);
×
NEW
939
                                        break;
×
940
                        }
941

942
                        if (end)
4,488✔
943
                        {
1,496✔
944
                                break;
1,496✔
945
                        }
946

947
                        this._reader.ReadNext();
2,992✔
948
                }
2,992✔
949
        }
1,496✔
950

951
        private void readFormattedTableRow(TableEntity.Row row)
952
        {
1,496✔
953
                this._reader.ReadNext();
1,496✔
954

955
                bool end = false;
1,496✔
956
                while (this._reader.DxfCode != DxfCode.Start)
4,488✔
957
                {
4,488✔
958
                        switch (this._reader.Code)
4,488!
959
                        {
960
                                case 300 when this._reader.ValueAsString.Equals("ROWTABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
1,496!
961
                                        break;
1,496✔
962
                                case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
1,496!
963
                                        this.readStyleOverride(new CadCellStyleTemplate(row.CellStyleOverride));
1,496✔
964
                                        break;
1,496✔
965
                                case 309:
966
                                        end = this._reader.ValueAsString.Equals("FORMATTEDTABLEDATAROW_END", StringComparison.InvariantCultureIgnoreCase);
1,496✔
967
                                        break;
1,496✔
968
                                default:
NEW
969
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableRow)} method.", NotificationType.None);
×
NEW
970
                                        break;
×
971
                        }
972

973
                        if (end)
4,488✔
974
                        {
1,496✔
975
                                break;
1,496✔
976
                        }
977

978
                        this._reader.ReadNext();
2,992✔
979
                }
2,992✔
980
        }
1,496✔
981

982
        private void readTableColumn(TableEntity.Column column)
983
        {
1,292✔
984
                this._reader.ReadNext();
1,292✔
985

986
                bool end = false;
1,292✔
987
                while (this._reader.DxfCode != DxfCode.Start)
3,876✔
988
                {
3,876✔
989
                        switch (this._reader.Code)
3,876!
990
                        {
NEW
991
                                case 1 when this._reader.ValueAsString.Equals("TABLECOLUMN_BEGIN", StringComparison.InvariantCultureIgnoreCase):
×
NEW
992
                                        break;
×
993
                                case 1:
NEW
994
                                        end = true;
×
NEW
995
                                        break;
×
996
                                case 40:
997
                                        column.Width = this._reader.ValueAsDouble;
1,292✔
998
                                        break;
1,292✔
999
                                case 90:
1000
                                        //StyleId
1001
                                        break;
1,292✔
1002
                                case 309:
1003
                                        end = this._reader.ValueAsString.Equals("TABLECOLUMN_END", StringComparison.InvariantCultureIgnoreCase);
1,292✔
1004
                                        break;
1,292✔
1005
                                default:
NEW
1006
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableColumn)} method.", NotificationType.None);
×
NEW
1007
                                        break;
×
1008
                        }
1009

1010
                        if (end)
3,876✔
1011
                        {
1,292✔
1012
                                break;
1,292✔
1013
                        }
1014

1015
                        this._reader.ReadNext();
2,584✔
1016
                }
2,584✔
1017
        }
1,292✔
1018

1019
        private void readLinkedTableColumn(TableEntity.Column column)
1020
        {
1,292✔
1021
                this._reader.ReadNext();
1,292✔
1022

1023
                bool end = false;
1,292✔
1024
                while (this._reader.DxfCode != DxfCode.Start)
5,168✔
1025
                {
5,168✔
1026
                        switch (this._reader.Code)
5,168!
1027
                        {
NEW
1028
                                case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataColumn_BEGIN, StringComparison.InvariantCultureIgnoreCase):
×
NEW
1029
                                        break;
×
1030
                                case 1:
NEW
1031
                                        end = true;
×
NEW
1032
                                        break;
×
1033
                                case 91:
1034
                                        column.CustomData = this._reader.ValueAsInt;
1,292✔
1035
                                        break;
1,292✔
1036
                                case 300:
1037
                                        column.Name = this._reader.ValueAsString;
1,292✔
1038
                                        break;
1,292✔
1039
                                case 301 when this._reader.ValueAsString.Equals(DxfFileToken.CustomData, StringComparison.InvariantCultureIgnoreCase):
1,292!
1040
                                        this.readCustomData();
1,292✔
1041
                                        break;
1,292✔
1042
                                case 309:
1043
                                        end = this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataColumn_END, StringComparison.InvariantCultureIgnoreCase);
1,292✔
1044
                                        break;
1,292✔
1045
                                default:
NEW
1046
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableColumn)} method.", NotificationType.None);
×
NEW
1047
                                        break;
×
1048
                        }
1049

1050
                        if (end)
5,168✔
1051
                        {
1,292✔
1052
                                break;
1,292✔
1053
                        }
1054

1055
                        this._reader.ReadNext();
3,876✔
1056
                }
3,876✔
1057
        }
1,292✔
1058

1059
        private void readLinkedTableRow(TableEntity.Row row)
1060
        {
1,632✔
1061
                this._reader.ReadNext();
1,632✔
1062

1063
                bool end = false;
1,632✔
1064
                while (this._reader.DxfCode != DxfCode.Start)
13,396✔
1065
                {
13,260✔
1066
                        switch (this._reader.Code)
13,260!
1067
                        {
NEW
1068
                                case 1 when this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataRow_BEGIN, StringComparison.InvariantCultureIgnoreCase):
✔
NEW
1069
                                        break;
×
1070
                                case 90:
1071
                                        break;
1,632✔
1072
                                case 91:
1073
                                        row.CustomData = this._reader.ValueAsInt;
1,496✔
1074
                                        break;
1,496✔
1075
                                case 300 when this._reader.ValueAsString.Equals(DxfFileToken.ObjectCell, StringComparison.InvariantCultureIgnoreCase):
5,712✔
1076
                                        this.readCell();
5,712✔
1077
                                        break;
5,712✔
1078
                                case 301 when this._reader.ValueAsString.Equals(DxfFileToken.CustomData, StringComparison.InvariantCultureIgnoreCase):
1,496✔
1079
                                        this.readCustomData();
1,496✔
1080
                                        break;
1,496✔
1081
                                case 309:
1082
                                        end = this._reader.ValueAsString.Equals(DxfFileToken.LinkedTableDataRow_END, StringComparison.InvariantCultureIgnoreCase);
1,496✔
1083
                                        break;
1,496✔
1084
                                default:
1085
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableRow)} method.", NotificationType.None);
1,428✔
1086
                                        break;
1,428✔
1087
                        }
1088

1089
                        if (end)
13,260✔
1090
                        {
1,496✔
1091
                                break;
1,496✔
1092
                        }
1093

1094
                        this._reader.ReadNext();
11,764✔
1095
                }
11,764✔
1096
        }
1,632✔
1097

1098
        private TableEntity.Cell readCell()
1099
        {
5,712✔
1100
                this._reader.ReadNext();
5,712✔
1101

1102
                TableEntity.Cell cell = new TableEntity.Cell();
5,712✔
1103
                CadTableCellTemplate template = new CadTableCellTemplate(cell);
5,712✔
1104

1105
                bool end = false;
5,712✔
1106
                while (this._reader.DxfCode != DxfCode.Start)
18,020✔
1107
                {
17,884✔
1108
                        switch (this._reader.Code)
17,884✔
1109
                        {
1110
                                case 1 when this._reader.ValueAsString.Equals("LINKEDTABLEDATACELL_BEGIN", StringComparison.InvariantCultureIgnoreCase):
16,864✔
1111
                                        this.readLinkedTableCell(cell);
5,712✔
1112
                                        break;
5,712✔
1113
                                case 1 when this._reader.ValueAsString.Equals("FORMATTEDTABLEDATACELL_BEGIN", StringComparison.InvariantCultureIgnoreCase):
11,152✔
1114
                                        this.readFormattedTableCell(cell);
5,576✔
1115
                                        break;
5,576✔
1116
                                case 1 when this._reader.ValueAsString.Equals("TABLECELL_BEGIN", StringComparison.InvariantCultureIgnoreCase):
5,576✔
1117
                                        this.readTableCell(cell);
5,576✔
1118
                                        end = true;
5,576✔
1119
                                        break;
5,576✔
1120
                                default:
1121
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCell)} method.", NotificationType.None);
1,020✔
1122
                                        break;
1,020✔
1123
                        }
1124

1125
                        if (end)
17,884✔
1126
                        {
5,576✔
1127
                                return cell;
5,576✔
1128
                        }
1129

1130
                        this._reader.ReadNext();
12,308✔
1131
                }
12,308✔
1132

1133
                return cell;
136✔
1134
        }
5,712✔
1135

1136
        private void readTableCell(TableEntity.Cell cell)
1137
        {
5,576✔
1138
                var map = DxfClassMap.Create(cell.GetType(), "TABLECELL_BEGIN");
5,576✔
1139

1140
                this._reader.ReadNext();
5,576✔
1141

1142
                bool end = false;
5,576✔
1143
                while (this._reader.DxfCode != DxfCode.Start)
17,408✔
1144
                {
17,408✔
1145
                        switch (this._reader.Code)
17,408✔
1146
                        {
1147
                                //Unknown
1148
                                case 40:
1149
                                case 41:
1150
                                        break;
272✔
1151
                                case 309:
1152
                                        end = this._reader.ValueAsString.Equals("TABLECELL_END", StringComparison.InvariantCultureIgnoreCase);
5,576✔
1153
                                        break;
5,576✔
1154
                                case 330:
1155
                                        //Unknown handle
1156
                                        break;
136✔
1157
                                default:
1158
                                        if (!this.tryAssignCurrentValue(cell, map))
11,424!
UNCOV
1159
                                        {
×
NEW
1160
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readTableCell)} {this._reader.Position}.", NotificationType.None);
×
UNCOV
1161
                                        }
×
1162
                                        break;
11,424✔
1163
                        }
1164

1165
                        if (end)
17,408✔
1166
                        {
5,576✔
1167
                                break;
5,576✔
1168
                        }
1169

1170
                        this._reader.ReadNext();
11,832✔
1171
                }
11,832✔
1172
        }
5,576✔
1173

1174
        private void readFormattedTableCell(TableEntity.Cell cell)
1175
        {
5,576✔
1176
                var map = DxfClassMap.Create(cell.GetType(), "FORMATTEDTABLEDATACELL_BEGIN");
5,576✔
1177

1178
                this._reader.ReadNext();
5,576✔
1179

1180
                bool end = false;
5,576✔
1181
                while (this._reader.DxfCode != DxfCode.Start)
11,152✔
1182
                {
11,152✔
1183
                        switch (this._reader.Code)
11,152!
1184
                        {
1185
                                case 300 when this._reader.ValueAsString.Equals("CELLTABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
5,576!
1186
                                        this.readCellTableFormat(cell);
5,576✔
1187
                                        continue;
5,576✔
1188
                                case 309:
1189
                                        end = this._reader.ValueAsString.Equals("FORMATTEDTABLEDATACELL_END", StringComparison.InvariantCultureIgnoreCase);
5,576✔
1190
                                        break;
5,576✔
1191
                                default:
NEW
1192
                                        if (!this.tryAssignCurrentValue(cell, map))
×
NEW
1193
                                        {
×
NEW
1194
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableCell)} {this._reader.Position}.", NotificationType.None);
×
NEW
1195
                                        }
×
NEW
1196
                                        break;
×
1197
                        }
1198

1199
                        if (end)
5,576!
1200
                        {
5,576✔
1201
                                break;
5,576✔
1202
                        }
1203

UNCOV
1204
                        this._reader.ReadNext();
×
NEW
1205
                }
×
1206
        }
5,576✔
1207

1208
        private void readCellTableFormat(TableEntity.Cell cell)
1209
        {
5,576✔
1210
                var map = DxfClassMap.Create(cell.GetType(), "CELLTABLEFORMAT");
5,576✔
1211

1212
                this._reader.ReadNext();
5,576✔
1213

1214
                bool end = false;
5,576✔
1215
                while (this._reader.Code == 1)
11,152✔
1216
                {
5,576✔
1217
                        switch (this._reader.Code)
5,576!
1218
                        {
1219
                                case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
5,576!
1220
                                        this.readStyleOverride(new CadCellStyleTemplate(cell.StyleOverride));
5,576✔
1221
                                        break;
5,576✔
NEW
1222
                                case 1 when this._reader.ValueAsString.Equals("CELLSTYLE_BEGIN", StringComparison.InvariantCultureIgnoreCase):
×
NEW
1223
                                        this.readCellStyle(new CadCellStyleTemplate());
×
NEW
1224
                                        break;
×
1225
                                default:
NEW
1226
                                        if (!this.tryAssignCurrentValue(cell, map))
×
NEW
1227
                                        {
×
NEW
1228
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellTableFormat)} {this._reader.Position}.", NotificationType.None);
×
NEW
1229
                                        }
×
NEW
1230
                                        break;
×
1231
                        }
1232

1233
                        if (end)
5,576!
UNCOV
1234
                        {
×
NEW
1235
                                break;
×
1236
                        }
1237

1238
                        this._reader.ReadNext();
5,576✔
1239
                }
5,576✔
1240
        }
5,576✔
1241

1242
        private void readCellStyle(CadCellStyleTemplate template)
NEW
1243
        {
×
1244
                //var map = DxfClassMap.Create(cell.GetType(), "CELLTABLEFORMAT");
1245

NEW
1246
                this._reader.ReadNext();
×
1247

NEW
1248
                bool end = false;
×
NEW
1249
                while (this._reader.Code != 1)
×
NEW
1250
                {
×
NEW
1251
                        switch (this._reader.Code)
×
1252
                        {
1253
                                case 309:
NEW
1254
                                        end = this._reader.ValueAsString.Equals("CELLSTYLE_END", StringComparison.InvariantCultureIgnoreCase);
×
NEW
1255
                                        break;
×
1256
                                default:
1257
                                        //if (!this.tryAssignCurrentValue(cell, map))
NEW
1258
                                        {
×
NEW
1259
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellStyle)} {this._reader.Position}.", NotificationType.None);
×
NEW
1260
                                        }
×
NEW
1261
                                        break;
×
1262
                        }
1263

NEW
1264
                        if (end)
×
UNCOV
1265
                        {
×
NEW
1266
                                break;
×
1267
                        }
1268

NEW
1269
                        this._reader.ReadNext();
×
UNCOV
1270
                }
×
NEW
1271
        }
×
1272

1273
        private void readLinkedTableCell(TableEntity.Cell cell)
1274
        {
5,712✔
1275
                var map = DxfClassMap.Create(cell.GetType(), "LINKEDTABLEDATACELL_BEGIN");
5,712✔
1276

1277
                this._reader.ReadNext();
5,712✔
1278

1279
                bool end = false;
5,712✔
1280
                while (this._reader.DxfCode != DxfCode.Start)
57,256✔
1281
                {
57,120✔
1282
                        switch (this._reader.Code)
57,120✔
1283
                        {
1284
                                case 95:
1285
                                        //BL 95 Number of cell contents
1286
                                        break;
5,576✔
1287
                                case 301 when this._reader.ValueAsString.Equals(DxfFileToken.CustomData, StringComparison.InvariantCultureIgnoreCase):
5,712✔
1288
                                        this.readCustomData();
5,712✔
1289
                                        break;
5,712✔
1290
                                case 302 when this._reader.ValueAsString.Equals("CONTENT", StringComparison.InvariantCultureIgnoreCase):
4,352✔
1291
                                        var c = this.readLinkedTableCellContent();
4,352✔
1292
                                        break;
4,352✔
1293
                                case 309:
1294
                                        end = this._reader.ValueAsString.Equals("LINKEDTABLEDATACELL_END", StringComparison.InvariantCultureIgnoreCase);
5,576✔
1295
                                        break;
5,576✔
1296
                                default:
1297
                                        if (!this.tryAssignCurrentValue(cell, map))
35,904✔
1298
                                        {
12,376✔
1299
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableCell)} {this._reader.Position}.", NotificationType.None);
12,376✔
1300
                                        }
12,376✔
1301
                                        break;
35,904✔
1302
                        }
1303

1304
                        if (end)
57,120✔
1305
                        {
5,576✔
1306
                                break;
5,576✔
1307
                        }
1308

1309
                        this._reader.ReadNext();
51,544✔
1310
                }
51,544✔
1311
        }
5,712✔
1312

1313
        private CadTableCellContentTemplate readLinkedTableCellContent()
1314
        {
4,352✔
1315
                TableEntity.CellContent content = new TableEntity.CellContent();
4,352✔
1316
                CadTableCellContentTemplate template = new CadTableCellContentTemplate(content);
4,352✔
1317
                var map = DxfClassMap.Create(content.GetType(), "CONTENT");
4,352✔
1318

1319
                this._reader.ReadNext();
4,352✔
1320

1321
                bool end = false;
4,352✔
1322
                while (this._reader.DxfCode != DxfCode.Start)
8,704✔
1323
                {
8,704✔
1324
                        switch (this._reader.Code)
8,704!
1325
                        {
1326
                                case 1 when this._reader.ValueAsString.Equals("FORMATTEDCELLCONTENT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
8,704✔
1327
                                        readFormattedCellContent();
4,352✔
1328
                                        end = true;
4,352✔
1329
                                        break;
4,352✔
1330
                                case 1 when this._reader.ValueAsString.Equals("CELLCONTENT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
4,352!
1331
                                        readCellContent(template);
4,352✔
1332
                                        break;
4,352✔
1333
                                default:
NEW
1334
                                        if (!this.tryAssignCurrentValue(content, map))
×
NEW
1335
                                        {
×
NEW
1336
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readLinkedTableCellContent)} {this._reader.Position}.", NotificationType.None);
×
NEW
1337
                                        }
×
NEW
1338
                                        break;
×
1339
                        }
1340

1341
                        if (end)
8,704✔
1342
                        {
4,352✔
1343
                                break;
4,352✔
1344
                        }
1345

1346
                        this._reader.ReadNext();
4,352✔
1347
                }
4,352✔
1348

1349
                return template;
4,352✔
1350
        }
4,352✔
1351

1352
        private void readCellContent(CadTableCellContentTemplate template)
1353
        {
4,352✔
1354
                TableEntity.CellContent content = template.Content;
4,352✔
1355
                var map = DxfClassMap.Create(content.GetType(), "CELLCONTENT_BEGIN");
4,352✔
1356

1357
                this._reader.ReadNext();
4,352✔
1358

1359
                bool end = false;
4,352✔
1360
                while (this._reader.DxfCode != DxfCode.Start)
17,408✔
1361
                {
17,408✔
1362
                        switch (this._reader.Code)
17,408✔
1363
                        {
1364
                                case 91:
1365
                                        break;
4,352✔
1366
                                case 300 when this._reader.ValueAsString.Equals("VALUE", StringComparison.InvariantCultureIgnoreCase):
3,944✔
1367
                                        var valueTemplate = this.readCadValue(content.CadValue);
3,944✔
1368
                                        template.CadValueTemplate = valueTemplate;
3,944✔
1369
                                        break;
3,944✔
1370
                                case 309:
1371
                                        end = this._reader.ValueAsString.Equals("CELLCONTENT_END", StringComparison.InvariantCultureIgnoreCase);
4,352✔
1372
                                        break;
4,352✔
1373
                                case 340:
1374
                                        template.BlockRecordHandle = this._reader.ValueAsHandle;
408✔
1375
                                        break;
408✔
1376
                                default:
1377
                                        if (!this.tryAssignCurrentValue(content, map))
4,352!
NEW
1378
                                        {
×
NEW
1379
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellContent)} {this._reader.Position}.", NotificationType.None);
×
NEW
1380
                                        }
×
1381
                                        break;
4,352✔
1382
                        }
1383

1384
                        if (end)
17,408✔
1385
                        {
4,352✔
1386
                                break;
4,352✔
1387
                        }
1388

1389
                        this._reader.ReadNext();
13,056✔
1390
                }
13,056✔
1391
        }
4,352✔
1392

1393
        private void readFormattedCellContent()
1394
        {
4,352✔
1395
                TableStyle.ContentFormat format = new();
4,352✔
1396
                CellContentFormatTemplate template = new CellContentFormatTemplate(format);
4,352✔
1397
                var map = DxfClassMap.Create(format.GetType(), "FORMATTEDCELLCONTENT");
4,352✔
1398

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

1401
                bool end = false;
4,352✔
1402
                while (this._reader.DxfCode != DxfCode.Start)
13,056✔
1403
                {
13,056✔
1404
                        switch (this._reader.Code)
13,056✔
1405
                        {
1406
                                case 300 when this._reader.ValueAsString.Equals("CONTENTFORMAT", StringComparison.InvariantCultureIgnoreCase):
4,352✔
1407
                                        readContentFormat(template);
4,352✔
1408
                                        break;
4,352✔
1409
                                case 309:
1410
                                        end = this._reader.ValueAsString.Equals("FORMATTEDCELLCONTENT_END", StringComparison.InvariantCultureIgnoreCase);
4,352✔
1411
                                        break;
4,352✔
1412
                                default:
1413
                                        if (!this.tryAssignCurrentValue(format, map))
4,352!
NEW
1414
                                        {
×
NEW
1415
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedCellContent)} method.", NotificationType.None);
×
NEW
1416
                                        }
×
1417
                                        break;
4,352✔
1418
                        }
1419

1420
                        if (end)
13,056✔
1421
                        {
4,352✔
1422
                                break;
4,352✔
1423
                        }
1424

1425
                        this._reader.ReadNext();
8,704✔
1426
                }
8,704✔
1427
        }
4,352✔
1428

1429
        private void readContentFormat(CellContentFormatTemplate template)
1430
        {
10,200✔
1431
                var format = template.Format;
10,200✔
1432
                var map = DxfClassMap.Create(format.GetType(), "CONTENTFORMAT_BEGIN");
10,200✔
1433

1434
                this._reader.ReadNext();
10,200✔
1435

1436
                bool end = false;
10,200✔
1437
                while (this._reader.DxfCode != DxfCode.Start)
132,600✔
1438
                {
132,600✔
1439
                        switch (this._reader.Code)
132,600✔
1440
                        {
1441
                                case 1 when this._reader.ValueAsString.Equals("CONTENTFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
10,200✔
1442
                                        break;
10,200✔
1443
                                case 309:
1444
                                        end = this._reader.ValueAsString.Equals("CONTENTFORMAT_END", StringComparison.InvariantCultureIgnoreCase);
10,200✔
1445
                                        break;
10,200✔
1446
                                case 340:
1447
                                        template.TextStyleHandle = this._reader.ValueAsHandle;
10,200✔
1448
                                        break;
10,200✔
1449
                                default:
1450
                                        if (!this.tryAssignCurrentValue(format, map))
102,000!
NEW
1451
                                        {
×
NEW
1452
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readContentFormat)} method.", NotificationType.None);
×
NEW
1453
                                        }
×
1454
                                        break;
102,000✔
1455
                        }
1456

1457
                        if (end)
132,600✔
1458
                        {
10,200✔
1459
                                break;
10,200✔
1460
                        }
1461

1462
                        this._reader.ReadNext();
122,400✔
1463
                }
122,400✔
1464
        }
10,200✔
1465

1466
        private void readFormattedTableColumn(TableEntity.Column column)
1467
        {
1,292✔
1468
                this._reader.ReadNext();
1,292✔
1469

1470
                bool end = false;
1,292✔
1471
                while (this._reader.DxfCode != DxfCode.Start)
3,876✔
1472
                {
3,876✔
1473
                        switch (this._reader.Code)
3,876!
1474
                        {
1475
                                case 300 when this._reader.ValueAsString.Equals("COLUMNTABLEFORMAT", StringComparison.InvariantCultureIgnoreCase):
1,292!
1476
                                        break;
1,292✔
1477
                                case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
1,292!
1478
                                        this.readStyleOverride(new CadCellStyleTemplate(column.CellStyleOverride));
1,292✔
1479
                                        break;
1,292✔
1480
                                case 309:
1481
                                        end = this._reader.ValueAsString.Equals(DxfFileToken.FormattedTableDataColumn_END, StringComparison.InvariantCultureIgnoreCase);
1,292✔
1482
                                        break;
1,292✔
1483
                                default:
NEW
1484
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readFormattedTableColumn)} method.", NotificationType.None);
×
NEW
1485
                                        break;
×
1486
                        }
1487

1488
                        if (end)
3,876✔
1489
                        {
1,292✔
1490
                                break;
1,292✔
1491
                        }
1492

1493
                        this._reader.ReadNext();
2,584✔
1494
                }
2,584✔
1495
        }
1,292✔
1496

1497
        private void readStyleOverride(CadCellStyleTemplate template)
1498
        {
8,636✔
1499
                var style = template.Format as TableStyle.CellStyle;
8,636✔
1500
                var mapstyle = DxfClassMap.Create(style.GetType(), "TABLEFORMAT_STYLE");
8,636✔
1501
                var mapformat = DxfClassMap.Create(typeof(TableStyle.ContentFormat), "TABLEFORMAT_BEGIN");
8,636✔
1502

1503
                this._reader.ReadNext();
8,636✔
1504

1505
                bool end = false;
8,636✔
1506
                var currBorder = TableStyle.CellEdgeFlags.Unknown;
8,636✔
1507
                while (this._reader.DxfCode != DxfCode.Start)
95,132✔
1508
                {
95,132✔
1509
                        switch (this._reader.Code)
95,132✔
1510
                        {
1511
                                case 95:
1512
                                        currBorder = (TableStyle.CellEdgeFlags)this._reader.ValueAsInt;
12,512✔
1513
                                        break;
12,512✔
1514
                                case 1 when this._reader.ValueAsString.Equals("TABLEFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
272✔
1515
                                        break;
272✔
1516
                                case 300 when this._reader.ValueAsString.Equals("CONTENTFORMAT", StringComparison.InvariantCultureIgnoreCase):
5,848✔
1517
                                        readContentFormat(new CellContentFormatTemplate(new TableStyle.ContentFormat()));
5,848✔
1518
                                        break;
5,848✔
1519
                                case 301 when this._reader.ValueAsString.Equals("MARGIN", StringComparison.InvariantCultureIgnoreCase):
2,992✔
1520
                                        this.readCellMargin(template);
2,992✔
1521
                                        break;
2,992✔
1522
                                case 302 when this._reader.ValueAsString.Equals("GRIDFORMAT", StringComparison.InvariantCultureIgnoreCase):
12,512✔
1523
                                        TableStyle.CellBorder border = new TableStyle.CellBorder(currBorder);
12,512✔
1524
                                        this.readGridFormat(template, border);
12,512✔
1525
                                        break;
12,512✔
1526
                                case 309:
1527
                                        end = this._reader.ValueAsString.Equals("TABLEFORMAT_END", StringComparison.InvariantCultureIgnoreCase);
8,636✔
1528
                                        break;
8,636✔
1529
                                default:
1530
                                        if (!this.tryAssignCurrentValue(style, mapstyle) && !this.tryAssignCurrentValue(style, mapformat))
52,360!
NEW
1531
                                        {
×
NEW
1532
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readStyleOverride)} method.", NotificationType.None);
×
NEW
1533
                                        }
×
1534
                                        break;
52,360✔
1535
                        }
1536

1537
                        if (end)
95,132✔
1538
                        {
8,636✔
1539
                                break;
8,636✔
1540
                        }
1541

1542
                        this._reader.ReadNext();
86,496✔
1543
                }
86,496✔
1544
        }
8,636✔
1545

1546
        private void readGridFormat(CadCellStyleTemplate template, TableStyle.CellBorder border)
1547
        {
12,512✔
1548
                var map = DxfClassMap.Create(border.GetType(), nameof(TableStyle.CellBorder));
12,512✔
1549

1550
                this._reader.ReadNext();
12,512✔
1551

1552
                bool end = false;
12,512✔
1553
                while (this._reader.DxfCode != DxfCode.Start)
112,608✔
1554
                {
112,608✔
1555
                        switch (this._reader.Code)
112,608✔
1556
                        {
1557
                                case 1 when this._reader.ValueAsString.Equals("GRIDFORMAT_BEGIN", StringComparison.InvariantCultureIgnoreCase):
12,512✔
1558
                                        break;
12,512✔
1559
                                case 62:
1560
                                        border.Color = new Color(this._reader.ValueAsShort);
12,512✔
1561
                                        break;
12,512✔
1562
                                case 92:
1563
                                        border.LineWeight = (LineWeightType)this._reader.ValueAsInt;
12,512✔
1564
                                        break;
12,512✔
1565
                                case 93:
1566
                                        border.IsInvisible = this._reader.ValueAsBool;
12,512✔
1567
                                        break;
12,512✔
1568
                                case 340:
1569
                                        template.BorderLineTypePairs.Add(new Tuple<TableStyle.CellBorder, ulong>(border, this._reader.ValueAsHandle));
12,512✔
1570
                                        break;
12,512✔
1571
                                case 309:
1572
                                        end = this._reader.ValueAsString.Equals("GRIDFORMAT_END", StringComparison.InvariantCultureIgnoreCase);
12,512✔
1573
                                        break;
12,512✔
1574
                                default:
1575
                                        if (!this.tryAssignCurrentValue(border, map))
37,536!
NEW
1576
                                        {
×
NEW
1577
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readGridFormat)} method.", NotificationType.None);
×
NEW
1578
                                        }
×
1579
                                        break;
37,536✔
1580
                        }
1581

1582
                        if (end)
112,608✔
1583
                        {
12,512✔
1584
                                break;
12,512✔
1585
                        }
1586

1587
                        this._reader.ReadNext();
100,096✔
1588
                }
100,096✔
1589
        }
12,512✔
1590

1591
        private void readCellMargin(CadCellStyleTemplate template)
1592
        {
2,992✔
1593
                var style = template.Format as TableStyle.CellStyle;
2,992✔
1594

1595
                this._reader.ReadNext();
2,992✔
1596

1597
                bool end = false;
2,992✔
1598
                int i = 0;
2,992✔
1599
                while (this._reader.DxfCode != DxfCode.Start)
23,936✔
1600
                {
23,936✔
1601
                        switch (this._reader.Code)
23,936!
1602
                        {
1603
                                case 1 when this._reader.ValueAsString.Equals("CELLMARGIN_BEGIN", StringComparison.InvariantCultureIgnoreCase):
2,992!
1604
                                        break;
2,992✔
1605
                                case 40:
1606
                                        switch (i)
17,952✔
1607
                                        {
1608
                                                case 0:
1609
                                                        style.VerticalMargin = this._reader.ValueAsDouble;
2,992✔
1610
                                                        break;
2,992✔
1611
                                                case 1:
1612
                                                        style.HorizontalMargin = this._reader.ValueAsDouble;
2,992✔
1613
                                                        break;
2,992✔
1614
                                                case 2:
1615
                                                        style.BottomMargin = this._reader.ValueAsDouble;
2,992✔
1616
                                                        break;
2,992✔
1617
                                                case 3:
1618
                                                        style.RightMargin = this._reader.ValueAsDouble;
2,992✔
1619
                                                        break;
2,992✔
1620
                                                case 4:
1621
                                                        style.MarginHorizontalSpacing = this._reader.ValueAsDouble;
2,992✔
1622
                                                        break;
2,992✔
1623
                                                case 5:
1624
                                                        style.MarginVerticalSpacing = this._reader.ValueAsDouble;
2,992✔
1625
                                                        break;
2,992✔
1626
                                        }
1627

1628
                                        i++;
17,952✔
1629
                                        break;
17,952✔
1630
                                case 309:
1631
                                        end = this._reader.ValueAsString.Equals("CELLMARGIN_END", StringComparison.InvariantCultureIgnoreCase);
2,992✔
1632
                                        break;
2,992✔
1633
                                default:
NEW
1634
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCellMargin)} method.", NotificationType.None);
×
NEW
1635
                                        break;
×
1636
                        }
1637

1638
                        if (end)
23,936✔
1639
                        {
2,992✔
1640
                                break;
2,992✔
1641
                        }
1642

1643
                        this._reader.ReadNext();
20,944✔
1644
                }
20,944✔
1645
        }
2,992✔
1646

1647
        private void readCustomData()
1648
        {
8,500✔
1649
                this._reader.ReadNext();
8,500✔
1650

1651
                int ndata = 0;
8,500✔
1652
                bool end = false;
8,500✔
1653
                while (this._reader.DxfCode != DxfCode.Start)
79,084✔
1654
                {
78,948✔
1655
                        switch (this._reader.Code)
78,948✔
1656
                        {
1657
                                case 1 when this._reader.ValueAsString.Equals("DATAMAP_BEGIN", StringComparison.InvariantCultureIgnoreCase):
8,500✔
1658
                                        break;
8,500✔
1659
                                case 90:
1660
                                        ndata = this._reader.ValueAsInt;
8,636✔
1661
                                        break;
8,636✔
1662
                                case 300:
1663
                                        //Name
1664
                                        break;
5,576✔
1665
                                case 301 when this._reader.ValueAsString.Equals("DATAMAP_VALUE", StringComparison.InvariantCultureIgnoreCase):
5,576✔
1666
                                        this.readDataMapValue();
5,576✔
1667
                                        break;
5,576✔
1668
                                case 309:
1669
                                        end = this._reader.ValueAsString.Equals("DATAMAP_END", StringComparison.InvariantCultureIgnoreCase);
8,364✔
1670
                                        break;
8,364✔
1671
                                default:
1672
                                        this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readCustomData)} method.", NotificationType.None);
42,296✔
1673
                                        break;
42,296✔
1674
                        }
1675

1676
                        if (end)
78,948✔
1677
                        {
8,364✔
1678
                                break;
8,364✔
1679
                        }
1680

1681
                        this._reader.ReadNext();
70,584✔
1682
                }
70,584✔
1683
        }
8,500✔
1684

1685
        private void readDataMapValue()
1686
        {
5,576✔
1687
                CadValue value = new();
5,576✔
1688
                var map = DxfClassMap.Create(value.GetType(), "DATAMAP_VALUE");
5,576✔
1689

1690
                this._reader.ReadNext();
5,576✔
1691

1692
                bool end = false;
5,576✔
1693
                while (this._reader.DxfCode != DxfCode.Start)
324,088✔
1694
                {
323,952✔
1695
                        switch (this._reader.Code)
323,952✔
1696
                        {
1697
                                case 11:
1698
                                case 21:
1699
                                case 31:
1700
                                        //Value as point
1701
                                        break;
408✔
1702
                                case 91:
1703
                                case 92:
1704
                                        //Value as int
1705
                                        break;
41,072✔
1706
                                case 140:
1707
                                        //Value as double
1708
                                        break;
13,532✔
1709
                                case 310:
1710
                                        //Value as byte array
1711
                                        break;
136✔
1712
                                case 304:
1713
                                        end = this._reader.ValueAsString.Equals(DxfFileToken.ValueEnd, StringComparison.InvariantCultureIgnoreCase);
5,440✔
1714
                                        break;
5,440✔
1715
                                default:
1716
                                        if (!this.tryAssignCurrentValue(value, map))
263,364✔
1717
                                        {
149,056✔
1718
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} value {this._reader.ValueAsString} at {nameof(readDataMapValue)} method.", NotificationType.None);
149,056✔
1719
                                        }
149,056✔
1720
                                        break;
263,364✔
1721
                        }
1722

1723
                        if (end)
323,952✔
1724
                        {
5,440✔
1725
                                break;
5,440✔
1726
                        }
1727

1728
                        this._reader.ReadNext();
318,512✔
1729
                }
318,512✔
1730
        }
5,576✔
1731

1732
        private bool readVisualStyle(CadTemplate template, DxfMap map)
1733
        {
405,496✔
1734
                switch (this._reader.Code)
405,496✔
1735
                {
1736
                        // Undocumented codes
1737
                        case 176:
1738
                        case 177:
1739
                        case 420:
1740
                                return true;
132,434✔
1741
                        default:
1742
                                //Avoid noise while is not implemented
1743
                                return true;
273,062✔
1744
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.VisualStyle]);
1745
                }
1746
        }
405,496✔
1747

1748
        private bool readSpatialFilter(CadTemplate template, DxfMap map)
1749
        {
4,284✔
1750
                CadSpatialFilterTemplate tmp = template as CadSpatialFilterTemplate;
4,284✔
1751
                SpatialFilter filter = tmp.CadObject as SpatialFilter;
4,284✔
1752

1753
                switch (this._reader.Code)
4,284✔
1754
                {
1755
                        case 10:
1756
                                filter.BoundaryPoints.Add(new CSMath.XY(this._reader.ValueAsDouble, 0));
408✔
1757
                                return true;
408✔
1758
                        case 20:
1759
                                var pt = filter.BoundaryPoints.LastOrDefault();
408✔
1760
                                filter.BoundaryPoints[filter.BoundaryPoints.Count - 1] = new CSMath.XY(pt.X, this._reader.ValueAsDouble);
408✔
1761
                                return true;
408✔
1762
                        case 40:
1763
                                if (filter.ClipFrontPlane && !tmp.HasFrontPlane)
408!
UNCOV
1764
                                {
×
NEW
1765
                                        filter.FrontDistance = this._reader.ValueAsDouble;
×
NEW
1766
                                        tmp.HasFrontPlane = true;
×
NEW
1767
                                        return true;
×
1768
                                }
1769

1770
                                double[] array = new double[16]
408✔
1771
                                {
408✔
1772
                                        0.0, 0.0, 0.0, 0.0,
408✔
1773
                                        0.0, 0.0, 0.0, 0.0,
408✔
1774
                                        0.0, 0.0, 0.0, 0.0,
408✔
1775
                                        0.0, 0.0, 0.0, 1.0
408✔
1776
                                };
408✔
1777

1778
                                for (int i = 0; i < 12; i++)
10,608✔
1779
                                {
4,896✔
1780
                                        array[i] = this._reader.ValueAsDouble;
4,896✔
1781

1782
                                        if (i < 11)
4,896✔
1783
                                        {
4,488✔
1784
                                                this._reader.ReadNext();
4,488✔
1785
                                        }
4,488✔
1786
                                }
4,896✔
1787

1788
                                if (tmp.InsertTransformRead)
408!
UNCOV
1789
                                {
×
NEW
1790
                                        filter.InsertTransform = new Matrix4(array);
×
NEW
1791
                                        tmp.InsertTransformRead = true;
×
UNCOV
1792
                                }
×
1793
                                else
1794
                                {
408✔
1795
                                        filter.InverseInsertTransform = new Matrix4(array);
408✔
1796
                                }
408✔
1797

1798
                                return true;
408✔
1799
                        case 73:
1800
                        default:
1801
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.SpatialFilter]);
3,060✔
1802
                }
1803
        }
4,284✔
1804

1805
        private bool readMLineStyle(CadTemplate template, DxfMap map)
1806
        {
3,570✔
1807
                var tmp = template as CadMLineStyleTemplate;
3,570✔
1808
                var mLineStyle = template.CadObject as MLineStyle;
3,570✔
1809

1810
                switch (this._reader.Code)
3,570✔
1811
                {
1812
                        case 6:
1813
                                var t = tmp.ElementTemplates.LastOrDefault();
420✔
1814
                                if (t == null)
420!
UNCOV
1815
                                {
×
NEW
1816
                                        return true;
×
1817
                                }
1818
                                t.LineTypeName = this._reader.ValueAsString;
420✔
1819
                                return true;
420✔
1820
                        case 49:
1821
                                MLineStyle.Element element = new MLineStyle.Element();
420✔
1822
                                CadMLineStyleTemplate.ElementTemplate elementTemplate = new CadMLineStyleTemplate.ElementTemplate(element);
420✔
1823
                                element.Offset = this._reader.ValueAsDouble;
420✔
1824

1825
                                tmp.ElementTemplates.Add(elementTemplate);
420✔
1826
                                mLineStyle.AddElement(element);
420✔
1827
                                return true;
420✔
1828
                        default:
1829
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
2,730✔
1830
                }
1831
        }
3,570✔
1832

1833
        private bool readTableStyle(CadTemplate template, DxfMap map)
1834
        {
19,025✔
1835
                var tmp = template as CadTableStyleTemplate;
19,025✔
1836
                var style = tmp.CadObject;
19,025✔
1837
                var cellStyle = tmp.CurrentCellStyleTemplate?.CellStyle;
19,025✔
1838

1839
                switch (this._reader.Code)
19,025!
1840
                {
1841
                        case 7:
1842
                                tmp.CreateCurrentCellStyleTemplate();
630✔
1843
                                tmp.CurrentCellStyleTemplate.TextStyleName = this._reader.ValueAsString;
630✔
1844
                                return true;
630✔
1845
                        case 94:
NEW
1846
                                cellStyle.Alignment = this._reader.ValueAsInt;
×
NEW
1847
                                return true;
×
1848
                        case 62:
1849
                                cellStyle.Color = new Color(this._reader.ValueAsShort);
630✔
1850
                                return true;
630✔
1851
                        case 63:
1852
                                cellStyle.BackgroundColor = new Color(this._reader.ValueAsShort);
630✔
1853
                                return true;
630✔
1854
                        case 140:
1855
                                cellStyle.TextHeight = this._reader.ValueAsDouble;
630✔
1856
                                return true;
630✔
1857
                        case 170:
1858
                                cellStyle.CellAlignment = (TableStyle.CellAlignmentType)this._reader.ValueAsShort;
630✔
1859
                                return true;
630✔
1860
                        case 283:
1861
                                cellStyle.IsFillColorOn = this._reader.ValueAsBool;
630✔
1862
                                return true;
630✔
1863
                        case 90:
1864
                                cellStyle.Type = (TableStyle.CellStyleType)this._reader.ValueAsShort;
426✔
1865
                                return true;
426✔
1866
                        case 91:
1867
                                cellStyle.StyleClass = (TableStyle.CellStyleClass)this._reader.ValueAsShort;
426✔
1868
                                return true;
426✔
1869
                        case 1:
1870
                                //Undocumented
1871
                                return true;
426✔
1872
                        case 274:
1873
                                cellStyle.TopBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
630✔
1874
                                return true;
630✔
1875
                        case 275:
1876
                                cellStyle.HorizontalInsideBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
630✔
1877
                                return true;
630✔
1878
                        case 276:
1879
                                cellStyle.BottomBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
630✔
1880
                                return true;
630✔
1881
                        case 277:
1882
                                cellStyle.LeftBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
630✔
1883
                                return true;
630✔
1884
                        case 278:
1885
                                cellStyle.VerticalInsideBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
630✔
1886
                                return true;
630✔
1887
                        case 279:
1888
                                cellStyle.RightBorder.LineWeight = (LineWeightType)this._reader.ValueAsInt;
630✔
1889
                                return true;
630✔
1890
                        case 284:
1891
                                cellStyle.TopBorder.IsInvisible = this._reader.ValueAsBool;
630✔
1892
                                return true;
630✔
1893
                        case 285:
1894
                                cellStyle.HorizontalInsideBorder.IsInvisible = this._reader.ValueAsBool;
630✔
1895
                                return true;
630✔
1896
                        case 286:
1897
                                cellStyle.BottomBorder.IsInvisible = this._reader.ValueAsBool;
630✔
1898
                                return true;
630✔
1899
                        case 287:
1900
                                cellStyle.LeftBorder.IsInvisible = this._reader.ValueAsBool;
630✔
1901
                                return true;
630✔
1902
                        case 288:
1903
                                cellStyle.VerticalInsideBorder.IsInvisible = this._reader.ValueAsBool;
630✔
1904
                                return true;
630✔
1905
                        case 289:
1906
                                cellStyle.RightBorder.IsInvisible = this._reader.ValueAsBool;
630✔
1907
                                return true;
630✔
1908
                        case 64:
1909
                                cellStyle.TopBorder.Color = new Color(this._reader.ValueAsShort);
630✔
1910
                                return true;
630✔
1911
                        case 65:
1912
                                cellStyle.HorizontalInsideBorder.Color = new Color(this._reader.ValueAsShort);
630✔
1913
                                return true;
630✔
1914
                        case 66:
1915
                                cellStyle.BottomBorder.Color = new Color(this._reader.ValueAsShort);
630✔
1916
                                return true;
630✔
1917
                        case 67:
1918
                                cellStyle.LeftBorder.Color = new Color(this._reader.ValueAsShort);
630✔
1919
                                return true;
630✔
1920
                        case 68:
1921
                                cellStyle.VerticalInsideBorder.Color = new Color(this._reader.ValueAsShort);
630✔
1922
                                return true;
630✔
1923
                        case 69:
1924
                                cellStyle.RightBorder.Color = new Color(this._reader.ValueAsShort);
630✔
1925
                                return true;
630✔
1926
                        default:
1927
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
2,627✔
1928
                }
1929
        }
19,025✔
1930

1931
        private bool readMLeaderStyle(CadTemplate template, DxfMap map)
1932
        {
19,268✔
1933
                var tmp = template as CadMLeaderStyleTemplate;
19,268✔
1934

1935
                switch (this._reader.Code)
19,268✔
1936
                {
1937
                        case 179:
1938
                                return true;
214✔
1939
                        case 340:
1940
                                tmp.LeaderLineTypeHandle = this._reader.ValueAsHandle;
420✔
1941
                                return true;
420✔
1942
                        case 342:
1943
                                tmp.MTextStyleHandle = this._reader.ValueAsHandle;
420✔
1944
                                return true;
420✔
1945
                        default:
1946
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
18,214✔
1947
                }
1948
        }
19,268✔
1949

1950
        private bool readEvaluationExpression(CadTemplate template, DxfMap map)
1951
        {
18,106✔
1952
                CadEvaluationExpressionTemplate tmp = template as CadEvaluationExpressionTemplate;
18,106✔
1953

1954
                switch (this._reader.Code)
18,106✔
1955
                {
1956
                        case 1:
1957
                                this._reader.ExpectedCode(70);
1,234✔
1958
                                this._reader.ExpectedCode(140);
1,234✔
1959
                                return true;
1,234✔
1960
                        default:
1961
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.EvalGraphExpr]);
16,872✔
1962
                }
1963
        }
18,106✔
1964

1965
        private bool readBlockElement(CadTemplate template, DxfMap map)
1966
        {
9,058✔
1967
                CadBlockElementTemplate tmp = template as CadBlockElementTemplate;
9,058✔
1968

1969
                switch (this._reader.Code)
9,058✔
1970
                {
1971
                        default:
1972
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockElement]))
9,058✔
1973
                                {
8,234✔
1974
                                        return this.readEvaluationExpression(template, map);
8,234✔
1975
                                }
1976
                                return true;
824✔
1977
                }
1978
        }
9,058✔
1979

1980
        private bool readBlockAction(CadTemplate template, DxfMap map)
1981
        {
20✔
1982
                CadBlockActionTemplate tmp = template as CadBlockActionTemplate;
20✔
1983

1984
                switch (this._reader.Code)
20✔
1985
                {
1986
                        default:
1987
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockAction]))
20✔
1988
                                {
15✔
1989
                                        return this.readBlockElement(template, map);
15✔
1990
                                }
1991
                                return true;
5✔
1992
                }
1993
        }
20✔
1994

1995
        private bool readBlockActionBasePt(CadTemplate template, DxfMap map)
1996
        {
31✔
1997
                CadBlockActionBasePtTemplate tmp = template as CadBlockActionBasePtTemplate;
31✔
1998

1999
                switch (this._reader.Code)
31✔
2000
                {
2001
                        default:
2002
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockActionBasePt]))
31✔
2003
                                {
20✔
2004
                                        return this.readBlockAction(template, map);
20✔
2005
                                }
2006
                                return true;
11✔
2007
                }
2008
        }
31✔
2009

2010
        private bool readBlockRotationAction(CadTemplate template, DxfMap map)
2011
        {
33✔
2012
                CadBlockRotationActionTemplate tmp = template as CadBlockRotationActionTemplate;
33✔
2013

2014
                switch (this._reader.Code)
33✔
2015
                {
2016
                        default:
2017
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockRotationAction]))
33✔
2018
                                {
31✔
2019
                                        return this.readBlockActionBasePt(template, map);
31✔
2020
                                }
2021
                                return true;
2✔
2022
                }
2023
        }
33✔
2024

2025
        private bool readBlockParameter(CadTemplate template, DxfMap map)
2026
        {
6,980✔
2027
                CadBlockParameterTemplate tmp = template as CadBlockParameterTemplate;
6,980✔
2028

2029
                switch (this._reader.Code)
6,980✔
2030
                {
2031
                        default:
2032
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockParameter]))
6,980✔
2033
                                {
6,365✔
2034
                                        return this.readBlockElement(template, map);
6,365✔
2035
                                }
2036
                                return true;
615✔
2037
                }
2038
        }
6,980✔
2039

2040
        private bool readBlock1PtParameter(CadTemplate template, DxfMap map)
2041
        {
4,510✔
2042
                CadBlock1PtParameterTemplate tmp = template as CadBlock1PtParameterTemplate;
4,510✔
2043

2044
                switch (this._reader.Code)
4,510✔
2045
                {
2046
                        default:
2047
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Block1PtParameter]))
4,510✔
2048
                                {
3,485✔
2049
                                        return this.readBlockParameter(template, map);
3,485✔
2050
                                }
2051
                                return true;
1,025✔
2052
                }
2053
        }
4,510✔
2054

2055
        private bool readBlock2PtParameter(CadTemplate template, DxfMap map)
2056
        {
4,319✔
2057
                var tmp = template as CadBlock2PtParameterTemplate;
4,319✔
2058

2059
                switch (this._reader.Code)
4,319✔
2060
                {
2061
                        //Stores always 4 entries using this code
2062
                        case 91:
2063
                                return true;
824✔
2064
                        default:
2065
                                if (!this.tryAssignCurrentValue(template.CadObject, map))
3,495!
2066
                                {
3,495✔
2067
                                        return this.readBlockParameter(template, map);
3,495✔
2068
                                }
NEW
2069
                                return true;
×
2070
                }
2071
        }
4,319✔
2072

2073
        private bool readBlockVisibilityParameter(CadTemplate template, DxfMap map)
2074
        {
5,740✔
2075
                CadBlockVisibilityParameterTemplate tmp = template as CadBlockVisibilityParameterTemplate;
5,740✔
2076

2077
                switch (this._reader.Code)
5,740✔
2078
                {
2079
                        case 92:
2080
                                var stateCount = this._reader.ValueAsInt;
205✔
2081
                                for (int i = 0; i < stateCount; i++)
2,050✔
2082
                                {
820✔
2083
                                        this._reader.ReadNext();
820✔
2084
                                        tmp.StateTemplates.Add(this.readState());
820✔
2085
                                }
820✔
2086
                                return true;
205✔
2087
                        case 93 when this.currentSubclass == DxfSubclassMarker.BlockVisibilityParameter:
410✔
2088
                                var entityCount = this._reader.ValueAsInt;
205✔
2089
                                for (int i = 0; i < entityCount; i++)
828✔
2090
                                {
209✔
2091
                                        this._reader.ReadNext();
209✔
2092
                                        tmp.EntityHandles.Add(this._reader.ValueAsHandle);
209✔
2093
                                }
209✔
2094
                                return true;
205✔
2095
                        default:
2096
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockVisibilityParameter]))
5,330✔
2097
                                {
4,510✔
2098
                                        return this.readBlock1PtParameter(template, map);
4,510✔
2099
                                }
2100
                                return true;
820✔
2101
                }
2102
        }
5,740✔
2103

2104
        private bool readBlockLinearParameter(CadTemplate template, DxfMap map)
2105
        {
10,250✔
2106
                var tmp = template as CadBlockLinearParameterTemplate;
10,250✔
2107

2108
                switch (this._reader.Code)
10,250✔
2109
                {
2110
                        default:
2111
                                if (!this.tryAssignCurrentValue(template.CadObject, map))
10,250✔
2112
                                {
4,305✔
2113
                                        return this.readBlock2PtParameter(template, map);
4,305✔
2114
                                }
2115
                                return true;
5,945✔
2116
                }
2117
        }
10,250✔
2118

2119
        private bool readBlockRotationParameter(CadTemplate template, DxfMap map)
2120
        {
49✔
2121
                var tmp = template as CadBlockRotationParameterTemplate;
49✔
2122

2123
                switch (this._reader.Code)
49✔
2124
                {
2125
                        default:
2126
                                if (!this.tryAssignCurrentValue(template.CadObject, map))
49✔
2127
                                {
14✔
2128
                                        return this.readBlock2PtParameter(template, map);
14✔
2129
                                }
2130
                                return true;
35✔
2131
                }
2132
        }
49✔
2133

2134
        private CadBlockVisibilityParameterTemplate.StateTemplate readState()
2135
        {
820✔
2136
                var state = new BlockVisibilityParameter.State();
820✔
2137
                var template = new CadBlockVisibilityParameterTemplate.StateTemplate(state);
820✔
2138

2139
                List<int> expectedCodes = new List<int>();
820✔
2140
                expectedCodes.Add(303);
820✔
2141
                expectedCodes.Add(94);
820✔
2142
                expectedCodes.Add(95);
820✔
2143

2144
                while (this._reader.DxfCode != DxfCode.Start)
2,460✔
2145
                {
2,460✔
2146
                        expectedCodes.Remove(this._reader.Code);
2,460✔
2147

2148
                        switch (this._reader.Code)
2,460!
2149
                        {
2150
                                case 303:
2151
                                        state.Name = this._reader.ValueAsString;
820✔
2152
                                        break;
820✔
2153
                                case 94:
2154
                                        var count = this._reader.ValueAsInt;
820✔
2155
                                        for (int i = 0; i < count; i++)
2,888✔
2156
                                        {
624✔
2157
                                                this._reader.ReadNext();
624✔
2158
                                                template.EntityHandles.Add(this._reader.ValueAsHandle);
624✔
2159
                                        }
624✔
2160
                                        break;
820✔
2161
                                case 95:
2162
                                        count = this._reader.ValueAsInt;
820✔
2163
                                        for (int i = 0; i < count; i++)
6,536✔
2164
                                        {
2,448✔
2165
                                                this._reader.ReadNext();
2,448✔
2166
                                                template.ExpressionHandles.Add(this._reader.ValueAsHandle);
2,448✔
2167
                                        }
2,448✔
2168
                                        break;
820✔
2169
                                default:
NEW
2170
                                        return template;
×
2171
                        }
2172

2173
                        if (!expectedCodes.Any())
2,460✔
2174
                        {
820✔
2175
                                break;
820✔
2176
                        }
2177

2178
                        this._reader.ReadNext();
1,640✔
2179
                }
1,640✔
2180

2181
                return template;
820✔
2182
        }
820✔
2183

2184
        private bool readBlockGrip(CadTemplate template, DxfMap map)
2185
        {
4,120✔
2186
                CadBlockGripTemplate tmp = template as CadBlockGripTemplate;
4,120✔
2187

2188
                switch (this._reader.Code)
4,120✔
2189
                {
2190
                        default:
2191
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockGrip]))
4,120✔
2192
                                {
2,678✔
2193
                                        return this.readBlockElement(template, map);
2,678✔
2194
                                }
2195
                                return true;
1,442✔
2196
                }
2197
        }
4,120✔
2198

2199
        private bool readBlockRotationGrip(CadTemplate template, DxfMap map)
2200
        {
20✔
2201
                CadBlockRotationGripTemplate tmp = template as CadBlockRotationGripTemplate;
20✔
2202

2203
                switch (this._reader.Code)
20✔
2204
                {
2205
                        default:
2206
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockRotationGrip]))
20!
2207
                                {
20✔
2208
                                        return this.readBlockGrip(template, map);
20✔
2209
                                }
NEW
2210
                                return true;
×
2211
                }
2212
        }
20✔
2213

2214
        private bool readBlockVisibilityGrip(CadTemplate template, DxfMap map)
2215
        {
4,100✔
2216
                CadBlockVisibilityGripTemplate tmp = template as CadBlockVisibilityGripTemplate;
4,100✔
2217

2218
                switch (this._reader.Code)
4,100✔
2219
                {
2220
                        default:
2221
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockVisibilityGrip]))
4,100!
2222
                                {
4,100✔
2223
                                        return this.readBlockGrip(template, map);
4,100✔
2224
                                }
NEW
2225
                                return true;
×
2226
                }
2227
        }
4,100✔
2228

2229
        private bool readBlockRepresentationData(CadTemplate template, DxfMap map)
2230
        {
1,692✔
2231
                CadBlockRepresentationDataTemplate tmp = template as CadBlockRepresentationDataTemplate;
1,692✔
2232

2233
                switch (this._reader.Code)
1,692✔
2234
                {
2235
                        case 340:
2236
                                tmp.BlockHandle = this._reader.ValueAsHandle;
282✔
2237
                                return true;
282✔
2238
                        default:
2239
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
1,410✔
2240
                }
2241
        }
1,692✔
2242

2243
        private bool readBlockGripExpression(CadTemplate template, DxfMap map)
2244
        {
12,340✔
2245
                CadBlockGripExpressionTemplate tmp = template as CadBlockGripExpressionTemplate;
12,340✔
2246

2247
                switch (this._reader.Code)
12,340✔
2248
                {
2249
                        default:
2250
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.BlockGripExpression]))
12,340✔
2251
                                {
9,872✔
2252
                                        return this.readEvaluationExpression(template, map);
9,872✔
2253
                                }
2254
                                return true;
2,468✔
2255
                }
2256
        }
12,340✔
2257

2258
        private bool readXRecord(CadTemplate template, DxfMap map)
2259
        {
120,380✔
2260
                CadXRecordTemplate tmp = template as CadXRecordTemplate;
120,380✔
2261

2262
                switch (this._reader.Code)
120,380✔
2263
                {
2264
                        case 100 when this._reader.ValueAsString == DxfSubclassMarker.XRecord:
30,741✔
2265
                                this.readXRecordEntries(tmp);
30,741✔
2266
                                return true;
30,741✔
2267
                        default:
2268
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.XRecord]);
89,639✔
2269
                }
2270
        }
120,380✔
2271

2272
        private void readXRecordEntries(CadXRecordTemplate template)
2273
        {
30,741✔
2274
                this._reader.ReadNext();
30,741✔
2275

2276
                while (this._reader.DxfCode != DxfCode.Start)
2,559,621✔
2277
                {
2,528,880✔
2278
                        switch (this._reader.GroupCodeValue)
2,528,880✔
2279
                        {
2280
                                case GroupCodeValueType.Point3D:
2281
                                        var code = this._reader.Code;
3,085✔
2282
                                        var x = this._reader.ValueAsDouble;
3,085✔
2283
                                        this._reader.ReadNext();
3,085✔
2284
                                        var y = this._reader.ValueAsDouble;
3,085✔
2285
                                        this._reader.ReadNext();
3,085✔
2286
                                        var z = this._reader.ValueAsDouble;
3,085✔
2287
                                        XYZ pt = new XYZ(x, y, z);
3,085✔
2288
                                        template.CadObject.CreateEntry(code, pt);
3,085✔
2289
                                        break;
3,085✔
2290
                                case GroupCodeValueType.Handle:
2291
                                case GroupCodeValueType.ObjectId:
2292
                                case GroupCodeValueType.ExtendedDataHandle:
2293
                                        template.AddHandleReference(this._reader.Code, this._reader.ValueAsHandle);
12,794✔
2294
                                        break;
12,794✔
2295
                                default:
2296
                                        template.CadObject.CreateEntry(this._reader.Code, this._reader.Value);
2,513,001✔
2297
                                        break;
2,513,001✔
2298
                        }
2299

2300
                        this._reader.ReadNext();
2,528,880✔
2301
                }
2,528,880✔
2302
        }
30,741✔
2303

2304
        private bool readBookColor(CadTemplate template, DxfMap map)
2305
        {
1,462✔
2306
                CadNonGraphicalObjectTemplate tmp = template as CadNonGraphicalObjectTemplate;
1,462✔
2307
                BookColor color = tmp.CadObject as BookColor;
1,462✔
2308

2309
                switch (this._reader.Code)
1,462✔
2310
                {
2311
                        case 430:
2312
                                color.Name = this._reader.ValueAsString;
170✔
2313
                                return true;
170✔
2314
                        default:
2315
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.DbColor]);
1,292✔
2316
                }
2317
        }
1,462✔
2318

2319
        private bool readDimensionAssociation(CadTemplate template, DxfMap map)
2320
        {
5,712✔
2321
                CadDimensionAssociationTemplate tmp = template as CadDimensionAssociationTemplate;
5,712✔
2322
                DimensionAssociation dimassoc = tmp.CadObject;
5,712✔
2323

2324
                switch (this._reader.Code)
5,712✔
2325
                {
2326
                        case 1 when this._reader.ValueAsString.Equals(DimensionAssociation.OsnapPointRefClassName):
816✔
2327
                                if (dimassoc.AssociativityFlags.HasFlag(AssociativityFlags.FirstPointReference)
816✔
2328
                                        && dimassoc.FirstPointRef == null)
816✔
2329
                                {
204✔
2330
                                        dimassoc.FirstPointRef = new DimensionAssociation.OsnapPointRef();
204✔
2331
                                        this.readOsnapPointRef(dimassoc.FirstPointRef);
204✔
2332
                                        this.lockPointer = true;
204✔
2333
                                        return true;
204✔
2334
                                }
2335

2336
                                if (dimassoc.AssociativityFlags.HasFlag(AssociativityFlags.SecondPointReference)
612!
2337
                                        && dimassoc.SecondPointRef == null)
612✔
2338
                                {
612✔
2339
                                        dimassoc.SecondPointRef = new DimensionAssociation.OsnapPointRef();
612✔
2340
                                        this.readOsnapPointRef(dimassoc.SecondPointRef);
612✔
2341
                                        this.lockPointer = true;
612✔
2342
                                        return true;
612✔
2343
                                }
2344

NEW
2345
                                if (dimassoc.AssociativityFlags.HasFlag(AssociativityFlags.ThirdPointReference)
×
NEW
2346
                                        && dimassoc.ThirdPointRef == null)
×
NEW
2347
                                {
×
NEW
2348
                                        dimassoc.ThirdPointRef = new DimensionAssociation.OsnapPointRef();
×
NEW
2349
                                        this.readOsnapPointRef(dimassoc.ThirdPointRef);
×
NEW
2350
                                        this.lockPointer = true;
×
NEW
2351
                                        return true;
×
2352
                                }
2353

NEW
2354
                                if (dimassoc.AssociativityFlags.HasFlag(AssociativityFlags.FourthPointReference)
×
NEW
2355
                                        && dimassoc.FourthPointRef == null)
×
UNCOV
2356
                                {
×
NEW
2357
                                        dimassoc.FourthPointRef = new DimensionAssociation.OsnapPointRef();
×
NEW
2358
                                        this.readOsnapPointRef(dimassoc.FourthPointRef);
×
NEW
2359
                                        this.lockPointer = true;
×
NEW
2360
                                        return true;
×
2361
                                }
2362

NEW
2363
                                return true;
×
2364
                        case 330 when template.OwnerHandle.HasValue:
1,224✔
2365
                                tmp.DimensionHandle = this._reader.ValueAsHandle;
612✔
2366
                                return true;
612✔
2367
                        default:
2368
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
4,284✔
2369
                }
2370
        }
5,712✔
2371

2372
        private CadDimensionAssociationTemplate.OsnapPointRefTemplate readOsnapPointRef(DimensionAssociation.OsnapPointRef osnapPoint)
2373
        {
816✔
2374
                var template = new CadDimensionAssociationTemplate.OsnapPointRefTemplate(osnapPoint);
816✔
2375

2376
                this._reader.ReadNext();
816✔
2377

2378
                bool end = false;
816✔
2379
                while (!end)
8,976✔
2380
                {
8,160✔
2381
                        switch (this._reader.Code)
8,160!
2382
                        {
2383
                                case 10:
2384
                                        osnapPoint.OsnapPoint = new XYZ(
816✔
2385
                                                this._reader.ValueAsDouble,
816✔
2386
                                                osnapPoint.OsnapPoint.Y,
816✔
2387
                                                osnapPoint.OsnapPoint.Z
816✔
2388
                                                );
816✔
2389
                                        break;
816✔
2390
                                case 20:
2391
                                        osnapPoint.OsnapPoint = new XYZ(
816✔
2392
                                                osnapPoint.OsnapPoint.X,
816✔
2393
                                                this._reader.ValueAsDouble,
816✔
2394
                                                osnapPoint.OsnapPoint.Z
816✔
2395
                                                );
816✔
2396
                                        break;
816✔
2397
                                case 30:
2398
                                        osnapPoint.OsnapPoint = new XYZ(
816✔
2399
                                        osnapPoint.OsnapPoint.X,
816✔
2400
                                        osnapPoint.OsnapPoint.Y,
816✔
2401
                                        this._reader.ValueAsDouble
816✔
2402
                                        );
816✔
2403
                                        break;
816✔
2404
                                case 40:
2405
                                        osnapPoint.GeometryParameter = this._reader.ValueAsDouble;
816✔
2406
                                        break;
816✔
2407
                                case 72:
2408
                                        osnapPoint.ObjectOsnapType = (ObjectOsnapType)this._reader.ValueAsShort;
816✔
2409
                                        break;
816✔
2410
                                case 73:
2411
                                        osnapPoint.SubentType = (SubentType)this._reader.ValueAsShort;
816✔
2412
                                        break;
816✔
2413
                                case 74:
NEW
2414
                                        osnapPoint.IntersectionSubType = (SubentType)this._reader.ValueAsShort;
×
NEW
2415
                                        break;
×
2416
                                case 75:
2417
                                        osnapPoint.HasLastPointRef = this._reader.ValueAsBool;
816✔
2418
                                        break;
816✔
2419
                                case 91:
2420
                                        osnapPoint.GsMarker = this._reader.ValueAsInt;
816✔
2421
                                        break;
816✔
2422
                                case 92:
NEW
2423
                                        osnapPoint.IntersectionGsMarker = this._reader.ValueAsInt;
×
NEW
2424
                                        break;
×
2425
                                case 331:
2426
                                        template.ObjectHandle = this._reader.ValueAsHandle;
816✔
2427
                                        break;
816✔
2428
                                case 302:
2429
                                case 332:
2430
                                        //What are these?
NEW
2431
                                        break;
×
2432
                                default:
2433
                                        end = true;
816✔
2434
                                        continue;
816✔
2435
                        }
2436

2437
                        this._reader.ReadNext();
7,344✔
2438
                }
7,344✔
2439

2440
                return template;
816✔
2441
        }
816✔
2442

2443
        private bool readDictionary(CadTemplate template, DxfMap map)
2444
        {
236,625✔
2445
                CadDictionaryTemplate tmp = template as CadDictionaryTemplate;
236,625✔
2446
                CadDictionary cadDictionary = tmp.CadObject;
236,625✔
2447

2448
                switch (this._reader.Code)
236,625✔
2449
                {
2450
                        case 280:
2451
                                cadDictionary.HardOwnerFlag = this._reader.ValueAsBool;
15,861✔
2452
                                return true;
15,861✔
2453
                        case 281:
2454
                                cadDictionary.ClonningFlags = (DictionaryCloningFlags)this._reader.Value;
22,728✔
2455
                                return true;
22,728✔
2456
                        case 3:
2457
                                tmp.Entries.Add(this._reader.ValueAsString, null);
60,508✔
2458
                                return true;
60,508✔
2459
                        case 350: // Soft-owner ID/handle to entry object 
2460
                        case 360: // Hard-owner ID/handle to entry object
2461
                                tmp.Entries[tmp.Entries.LastOrDefault().Key] = this._reader.ValueAsHandle;
60,508✔
2462
                                return true;
60,508✔
2463
                        default:
2464
                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Dictionary]);
77,020✔
2465
                }
2466
        }
236,625✔
2467

2468
        private bool readDictionaryWithDefault(CadTemplate template, DxfMap map)
2469
        {
1,890✔
2470
                CadDictionaryWithDefaultTemplate tmp = template as CadDictionaryWithDefaultTemplate;
1,890✔
2471

2472
                switch (this._reader.Code)
1,890✔
2473
                {
2474
                        case 340:
2475
                                tmp.DefaultEntryHandle = this._reader.ValueAsHandle;
210✔
2476
                                return true;
210✔
2477
                        default:
2478
                                if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.DictionaryWithDefault]))
1,680!
2479
                                {
1,680✔
2480
                                        return this.readDictionary(template, map);
1,680✔
2481
                                }
NEW
2482
                                return true;
×
2483
                }
2484
        }
1,890✔
2485

2486
        private CadTemplate readSortentsTable()
2487
        {
612✔
2488
                SortEntitiesTable sortTable = new SortEntitiesTable();
612✔
2489
                CadSortensTableTemplate template = new CadSortensTableTemplate(sortTable);
612✔
2490

2491
                //Jump the 0 marker
2492
                this._reader.ReadNext();
612✔
2493

2494
                this.readCommonObjectData(template);
612✔
2495

2496
                System.Diagnostics.Debug.Assert(DxfSubclassMarker.SortentsTable == this._reader.ValueAsString);
612✔
2497

2498
                //Jump the 100 marker
2499
                this._reader.ReadNext();
612✔
2500

2501
                (ulong?, ulong?) pair = (null, null);
612✔
2502

2503
                while (this._reader.DxfCode != DxfCode.Start)
4,488✔
2504
                {
3,876✔
2505
                        switch (this._reader.Code)
3,876!
2506
                        {
2507
                                case 5:
2508
                                        pair.Item1 = this._reader.ValueAsHandle;
1,632✔
2509
                                        break;
1,632✔
2510
                                case 330:
2511
                                        template.BlockOwnerHandle = this._reader.ValueAsHandle;
612✔
2512
                                        break;
612✔
2513
                                case 331:
2514
                                        pair.Item2 = this._reader.ValueAsHandle;
1,632✔
2515
                                        break;
1,632✔
2516
                                default:
NEW
2517
                                        this._builder.Notify($"Group Code not handled {this._reader.GroupCodeValue} for {typeof(SortEntitiesTable)}, code : {this._reader.Code} | value : {this._reader.ValueAsString}");
×
NEW
2518
                                        break;
×
2519
                        }
2520

2521
                        if (pair.Item1.HasValue && pair.Item2.HasValue)
3,876✔
2522
                        {
1,632✔
2523
                                template.Values.Add((pair.Item1.Value, pair.Item2.Value));
1,632✔
2524
                                pair = (null, null);
1,632✔
2525
                        }
1,632✔
2526

2527
                        this._reader.ReadNext();
3,876✔
2528
                }
3,876✔
2529

2530
                return template;
612✔
2531
        }
612✔
2532
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc