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

DomCR / ACadSharp / 18987310601

31 Oct 2025 11:09PM UTC coverage: 77.837% (+0.1%) from 77.732%
18987310601

Pull #851

github

web-flow
Merge 966d1431d into 481384afb
Pull Request #851: issue 845

6953 of 9729 branches covered (71.47%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

5 existing lines in 3 files now uncovered.

26735 of 33551 relevant lines covered (79.68%)

101997.21 hits per line

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

82.05
/src/ACadSharp/IO/DXF/DxfStreamReader/DxfSectionReaderBase.cs
1
using ACadSharp.Entities;
2
using ACadSharp.IO.Templates;
3
using ACadSharp.Objects;
4
using ACadSharp.Tables;
5
using ACadSharp.XData;
6
using CSMath;
7
using CSUtilities.Converters;
8
using System;
9
using System.Collections.Generic;
10
using System.Diagnostics;
11
using System.Linq;
12
using static ACadSharp.IO.Templates.CadMLeaderAnnotContextTemplate;
13

14
namespace ACadSharp.IO.DXF
15
{
16
        internal abstract class DxfSectionReaderBase
17
        {
18
                public delegate bool ReadEntityDelegate<T>(CadEntityTemplate template, DxfMap map, string subclass = null) where T : Entity;
19

20
                protected readonly IDxfStreamReader _reader;
21
                protected readonly DxfDocumentBuilder _builder;
22

23
                public DxfSectionReaderBase(IDxfStreamReader reader, DxfDocumentBuilder builder)
1,110✔
24
                {
1,110✔
25
                        this._reader = reader;
1,110✔
26
                        this._builder = builder;
1,110✔
27
                }
1,110✔
28

29
                public abstract void Read();
30

31
                protected void readCommonObjectData(out string name, out ulong handle, out ulong? ownerHandle, out ulong? xdictHandle, out HashSet<ulong> reactors)
32
                {
2,606✔
33
                        name = null;
2,606✔
34
                        handle = 0;
2,606✔
35
                        ownerHandle = null;
2,606✔
36
                        xdictHandle = null;
2,606✔
37
                        reactors = new HashSet<ulong>();
2,606✔
38

39
                        if (this._reader.DxfCode == DxfCode.Start
2,606!
40
                                        || this._reader.DxfCode == DxfCode.Subclass)
2,606✔
41
                                this._reader.ReadNext();
×
42

43
                        //Loop until the common data end
44
                        while (this._reader.DxfCode != DxfCode.Start
10,346✔
45
                                        && this._reader.DxfCode != DxfCode.Subclass)
10,346✔
46
                        {
7,740✔
47
                                switch (this._reader.Code)
7,740!
48
                                {
49
                                        //Table name
50
                                        case 2:
51
                                                name = this._reader.ValueAsString;
2,606✔
52
                                                break;
2,606✔
53
                                        //Handle
54
                                        case 5:
55
                                        case 105:
56
                                                handle = this._reader.ValueAsHandle;
2,286✔
57
                                                break;
2,286✔
58
                                        //Start of application - defined group
59
                                        case 102:
60
                                                this.readDefinedGroups(out xdictHandle, out reactors);
242✔
61
                                                break;
242✔
62
                                        //Soft - pointer ID / handle to owner BLOCK_RECORD object
63
                                        case 330:
64
                                                ownerHandle = this._reader.ValueAsHandle;
2,286✔
65
                                                break;
2,286✔
66
                                        case 71:
67
                                        //Number of entries for dimension style table
68
                                        case 340:
69
                                        //Dimension table has the handles of the styles at the begining
70
                                        default:
71
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} at line {this._reader.Position}.");
320✔
72
                                                break;
320✔
73
                                }
74

75
                                this._reader.ReadNext();
7,740✔
76
                        }
7,740✔
77
                }
2,606✔
78

79
                [Obsolete("Only needed for SortEntitiesTable but it should be removed")]
80
                protected void readCommonObjectData(CadTemplate template)
81
                {
684✔
82
                        while (this._reader.DxfCode != DxfCode.Subclass)
2,736✔
83
                        {
2,052✔
84
                                switch (this._reader.Code)
2,052!
85
                                {
86
                                        //object name
87
                                        case 0:
88
                                                Debug.Assert(template.CadObject.ObjectName == this._reader.ValueAsString);
×
89
                                                break;
×
90
                                        //Handle
91
                                        case 5:
92
                                                template.CadObject.Handle = this._reader.ValueAsHandle;
684✔
93
                                                break;
684✔
94
                                        //Start of application - defined group
95
                                        case 102:
96
                                                this.readDefinedGroups(template);
684✔
97
                                                break;
684✔
98
                                        //Soft - pointer ID / handle to owner BLOCK_RECORD object
99
                                        case 330:
100
                                                template.OwnerHandle = this._reader.ValueAsHandle;
684✔
101
                                                break;
684✔
102
                                        default:
103
                                                this._builder.Notify($"Unhandled dxf code {this._reader.Code} at line {this._reader.Position}.", NotificationType.None);
×
104
                                                break;
×
105
                                }
106

107
                                this._reader.ReadNext();
2,052✔
108
                        }
2,052✔
109
                }
684✔
110

111
                protected void readCommonCodes(CadTemplate template, out bool isExtendedData, DxfMap map = null)
112
                {
1,860,267✔
113
                        isExtendedData = false;
1,860,267✔
114

115
                        switch (this._reader.Code)
1,860,267✔
116
                        {
117
                                //Handle
118
                                case 5:
119
                                        template.CadObject.Handle = this._reader.ValueAsHandle;
332,924✔
120
                                        break;
332,924✔
121
                                //Check with mapper
122
                                case 100:
123
                                        if (map != null && !map.SubClasses.ContainsKey(this._reader.ValueAsString))
238,606!
124
                                        {
3,120✔
125
                                                this._builder.Notify($"[{template.CadObject.ObjectName}] Unidentified subclass {this._reader.ValueAsString}", NotificationType.Warning);
3,120✔
126
                                        }
3,120✔
127
                                        break;
238,606✔
128
                                //Start of application - defined group
129
                                case 102:
130
                                        this.readDefinedGroups(template);
67,170✔
131
                                        break;
67,170✔
132
                                //Soft - pointer ID / handle to owner BLOCK_RECORD object
133
                                case 330:
134
                                        template.OwnerHandle = this._reader.ValueAsHandle;
179,820✔
135
                                        break;
179,820✔
136
                                case 1001:
137
                                        isExtendedData = true;
29,735✔
138
                                        this.readExtendedData(template.EDataTemplateByAppName);
29,735✔
139
                                        break;
29,735✔
140
                                default:
141
                                        this._builder.Notify($"[{template.CadObject.SubclassMarker}] Unhandled dxf code {this._reader.Code} with value {this._reader.ValueAsString}", NotificationType.None);
1,012,012✔
142
                                        break;
1,012,012✔
143
                        }
144
                }
1,860,267✔
145

146
                protected CadEntityTemplate readEntity()
147
                {
174,378✔
148
                        switch (this._reader.ValueAsString)
174,378!
149
                        {
150
                                case DxfFileToken.EntityAttribute:
151
                                        return this.readEntityCodes<AttributeEntity>(new CadAttributeTemplate(new AttributeEntity()), this.readAttributeDefinition);
1,120✔
152
                                case DxfFileToken.EntityAttributeDefinition:
153
                                        return this.readEntityCodes<AttributeDefinition>(new CadAttributeTemplate(new AttributeDefinition()), this.readAttributeDefinition);
1,330✔
154
                                case DxfFileToken.EntityArc:
155
                                        return this.readEntityCodes<Arc>(new CadEntityTemplate<Arc>(), this.readArc);
812✔
156
                                case DxfFileToken.EntityBody:
157
                                        return this.readEntityCodes<CadBody>(new CadEntityTemplate<CadBody>(), this.readEntitySubclassMap);
×
158
                                case DxfFileToken.EntityCircle:
159
                                        return this.readEntityCodes<Circle>(new CadEntityTemplate<Circle>(), this.readEntitySubclassMap);
2,450✔
160
                                case DxfFileToken.EntityDimension:
161
                                        return this.readEntityCodes<Dimension>(new CadDimensionTemplate(), this.readDimension);
3,080✔
162
                                case DxfFileToken.Entity3DFace:
163
                                        return this.readEntityCodes<Face3D>(new CadEntityTemplate<Face3D>(), this.readEntitySubclassMap);
280✔
164
                                case DxfFileToken.EntityEllipse:
165
                                        return this.readEntityCodes<Ellipse>(new CadEntityTemplate<Ellipse>(), this.readEntitySubclassMap);
240✔
166
                                case DxfFileToken.EntityLeader:
167
                                        return this.readEntityCodes<Leader>(new CadLeaderTemplate(), this.readLeader);
240✔
168
                                case DxfFileToken.EntityLine:
169
                                        return this.readEntityCodes<Line>(new CadEntityTemplate<Line>(), this.readEntitySubclassMap);
73,024✔
170
                                case DxfFileToken.EntityLwPolyline:
171
                                        return this.readEntityCodes<LwPolyline>(new CadEntityTemplate<LwPolyline>(), this.readLwPolyline);
5,256✔
172
                                case DxfFileToken.EntityMesh:
173
                                        return this.readEntityCodes<Mesh>(new CadMeshTemplate(), this.readMesh);
480✔
174
                                case DxfFileToken.EntityHatch:
175
                                        return this.readEntityCodes<Hatch>(new CadHatchTemplate(), this.readHatch);
1,920✔
176
                                case DxfFileToken.EntityInsert:
177
                                        return this.readEntityCodes<Insert>(new CadInsertTemplate(), this.readInsert);
6,508✔
178
                                case DxfFileToken.EntityMText:
179
                                        return this.readEntityCodes<MText>(new CadTextEntityTemplate(new MText()), this.readTextEntity);
8,268✔
180
                                case DxfFileToken.EntityMLine:
181
                                        return this.readEntityCodes<MLine>(new CadMLineTemplate(), this.readMLine);
720✔
182
                                case DxfFileToken.EntityMultiLeader:
183
                                        return this.readEntityCodes<MultiLeader>(new CadMLeaderTemplate(), this.readMLeader);
3,600✔
184
                                case DxfFileToken.EntityPdfUnderlay:
185
                                        return this.readEntityCodes<PdfUnderlay>(new CadUnderlayTemplate<PdfUnderlayDefinition>(new PdfUnderlay()), this.readUnderlayEntity<PdfUnderlayDefinition>);
240✔
186
                                case DxfFileToken.EntityPoint:
187
                                        return this.readEntityCodes<Point>(new CadEntityTemplate<Point>(), this.readEntitySubclassMap);
10,724✔
188
                                case DxfFileToken.EntityPolyline:
189
                                        return this.readPolyline();
12,348✔
190
                                case DxfFileToken.EntityRay:
191
                                        return this.readEntityCodes<Ray>(new CadEntityTemplate<Ray>(), this.readEntitySubclassMap);
240✔
192
                                case DxfFileToken.EndSequence:
193
                                        return this.readEntityCodes<Seqend>(new CadEntityTemplate<Seqend>(), this.readEntitySubclassMap);
1,040✔
194
                                case DxfFileToken.EntitySolid:
195
                                        return this.readEntityCodes<Solid>(new CadEntityTemplate<Solid>(), this.readModelerGeometry);
16,316✔
196
                                case DxfFileToken.EntityTable:
197
                                        return this.readEntityCodes<TableEntity>(new CadTableEntityTemplate(), this.readTableEntity);
480✔
198
                                case DxfFileToken.EntityText:
199
                                        return this.readEntityCodes<TextEntity>(new CadTextEntityTemplate(new TextEntity()), this.readTextEntity);
16,390✔
200
                                case DxfFileToken.EntityTolerance:
201
                                        return this.readEntityCodes<Tolerance>(new CadToleranceTemplate(new Tolerance()), this.readTolerance);
720✔
202
                                case DxfFileToken.EntityVertex:
203
                                        return this.readEntityCodes<Entity>(new CadVertexTemplate(), this.readVertex);
2,880✔
204
                                case DxfFileToken.EntityViewport:
205
                                        return this.readEntityCodes<Viewport>(new CadViewportTemplate(), this.readViewport);
1,472✔
206
                                case DxfFileToken.EntityShape:
207
                                        return this.readEntityCodes<Shape>(new CadShapeTemplate(new Shape()), this.readShape);
280✔
208
                                case DxfFileToken.EntitySpline:
209
                                        return this.readEntityCodes<Spline>(new CadSplineTemplate(), this.readSpline);
480✔
210
                                case DxfFileToken.Entity3DSolid:
211
                                        return this.readEntityCodes<Solid3D>(new CadSolid3DTemplate(), this.readSolid3d);
480✔
212
                                case DxfFileToken.EntityRegion:
213
                                        return this.readEntityCodes<Region>(new CadEntityTemplate<Region>(), this.readModelerGeometry);
240✔
214
                                case DxfFileToken.EntityImage:
215
                                        return this.readEntityCodes<RasterImage>(new CadWipeoutBaseTemplate(new RasterImage()), this.readWipeoutBase);
240✔
216
                                case DxfFileToken.EntityWipeout:
217
                                        return this.readEntityCodes<Wipeout>(new CadWipeoutBaseTemplate(new Wipeout()), this.readWipeoutBase);
240✔
218
                                case DxfFileToken.EntityXline:
219
                                        return this.readEntityCodes<XLine>(new CadEntityTemplate<XLine>(), this.readEntitySubclassMap);
240✔
220
                                default:
221
                                        DxfMap map = DxfMap.Create<Entity>();
×
222
                                        CadUnknownEntityTemplate unknownEntityTemplate = null;
×
223
                                        if (this._builder.DocumentToBuild.Classes.TryGetByName(this._reader.ValueAsString, out Classes.DxfClass dxfClass))
×
224
                                        {
×
225
                                                this._builder.Notify($"Entity not supported read as an UnknownEntity: {this._reader.ValueAsString}", NotificationType.NotImplemented);
×
226
                                                unknownEntityTemplate = new CadUnknownEntityTemplate(new UnknownEntity(dxfClass));
×
227
                                        }
×
228
                                        else
229
                                        {
×
230
                                                this._builder.Notify($"Entity not supported: {this._reader.ValueAsString}", NotificationType.NotImplemented);
×
231
                                        }
×
232

233
                                        this._reader.ReadNext();
×
234

235
                                        do
236
                                        {
×
237
                                                if (unknownEntityTemplate != null && this._builder.KeepUnknownEntities)
×
238
                                                {
×
239
                                                        this.readCommonEntityCodes(unknownEntityTemplate, out bool isExtendedData, map);
×
240
                                                        if (isExtendedData)
×
241
                                                                continue;
×
242
                                                }
×
243

244
                                                this._reader.ReadNext();
×
245
                                        }
×
246
                                        while (this._reader.DxfCode != DxfCode.Start);
×
247

248
                                        return unknownEntityTemplate;
×
249
                        }
250
                }
174,378✔
251

252
                protected CadEntityTemplate readEntityCodes<T>(CadEntityTemplate template, ReadEntityDelegate<T> readEntity)
253
                        where T : Entity
254
                {
228,564✔
255
                        this._reader.ReadNext();
228,564✔
256

257
                        DxfMap map = DxfMap.Create<T>();
228,564✔
258

259
                        while (this._reader.DxfCode != DxfCode.Start)
3,097,294✔
260
                        {
2,868,730✔
261
                                if (!readEntity(template, map))
2,868,730✔
262
                                {
1,068,536✔
263
                                        this.readCommonEntityCodes(template, out bool isExtendedData, map);
1,068,536✔
264
                                        if (isExtendedData)
1,068,536✔
265
                                                continue;
16,010✔
266
                                }
1,052,526✔
267

268
                                if (this._reader.DxfCode != DxfCode.Start)
2,852,720✔
269
                                        this._reader.ReadNext();
2,852,162✔
270
                        }
2,852,720✔
271

272
                        return template;
228,564✔
273
                }
228,564✔
274

275
                protected void readCommonEntityCodes(CadEntityTemplate template, out bool isExtendedData, DxfMap map = null)
276
                {
1,148,126✔
277
                        isExtendedData = false;
1,148,126✔
278
                        switch (this._reader.Code)
1,148,126✔
279
                        {
280
                                case 6:
281
                                        template.LineTypeName = this._reader.ValueAsString;
30,446✔
282
                                        break;
30,446✔
283
                                case 8:
284
                                        template.LayerName = this._reader.ValueAsString;
248,002✔
285
                                        break;
248,002✔
286
                                //Absent or zero indicates entity is in model space. 1 indicates entity is in paper space (optional).
287
                                case 67:
288
                                        break;
1,452✔
289
                                //Number of bytes Proxy entity graphics data
290
                                case 92:
291
                                case 160:
292
                                //Proxy entity graphics data
293
                                case 310:
294
                                        break;
90,080✔
295
                                case 347:
296
                                        template.MaterialHandle = this._reader.ValueAsHandle;
160✔
297
                                        break;
160✔
298
                                case 430:
299
                                        template.BookColorName = this._reader.ValueAsString;
200✔
300
                                        break;
200✔
301
                                default:
302
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Entity]))
777,786✔
303
                                        {
618,758✔
304
                                                this.readCommonCodes(template, out isExtendedData, map);
618,758✔
305
                                        }
618,758✔
306
                                        break;
777,786✔
307
                        }
308
                }
1,148,126✔
309

310
                protected bool checkObjectEnd(CadTemplate template, DxfMap map, Func<CadTemplate, DxfMap, bool> func)
311
                {
760✔
312
                        if (this._reader.DxfCode == DxfCode.Start)
760✔
313
                        {
532✔
314
                                return true;
532✔
315
                        }
316
                        else
317
                        {
228✔
318
                                return func.Invoke(template, map);
228✔
319
                        }
320
                }
760✔
321

322
                protected bool checkEntityEnd(CadEntityTemplate template, DxfMap map, string subclass, Func<CadEntityTemplate, DxfMap, string, bool> func)
323
                {
480✔
324
                        if (this._reader.DxfCode == DxfCode.Start)
480!
325
                        {
480✔
326
                                return true;
480✔
327
                        }
328
                        else
329
                        {
×
330
                                return func.Invoke(template, map, subclass);
×
331
                        }
332
                }
480✔
333

334
                private bool readArc(CadEntityTemplate template, DxfMap map, string subclass = null)
335
                {
10,648✔
336
                        switch (this._reader.Code)
10,648✔
337
                        {
338
                                default:
339
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Arc]))
10,648✔
340
                                        {
9,024✔
341
                                                return this.readEntitySubclassMap(template, map, DxfSubclassMarker.Circle);
9,024✔
342
                                        }
343
                                        return true;
1,624✔
344
                        }
345
                }
10,648✔
346

347
                private bool readAttributeDefinition(CadEntityTemplate template, DxfMap map, string subclass = null)
348
                {
39,546✔
349
                        DxfClassMap emap = map.SubClasses[template.CadObject.SubclassMarker];
39,546✔
350
                        CadAttributeTemplate tmp = template as CadAttributeTemplate;
39,546✔
351

352
                        switch (this._reader.Code)
39,546!
353
                        {
354
                                case 44:
355
                                case 46:
356
                                        return true;
×
357
                                case 101:
358
                                        var att = tmp.CadObject as AttributeBase;
78✔
359
                                        att.MText = new MText();
78✔
360
                                        CadTextEntityTemplate mtextTemplate = new CadTextEntityTemplate(att.MText);
78✔
361
                                        tmp.MTextTemplate = mtextTemplate;
78✔
362
                                        this.readEntityCodes<MText>(mtextTemplate, this.readTextEntity);
78✔
363
                                        return true;
78✔
364
                                default:
365
                                        if (!this.tryAssignCurrentValue(template.CadObject, emap))
39,468✔
366
                                        {
29,858✔
367
                                                return this.readTextEntity(template, map, DxfSubclassMarker.Text);
29,858✔
368
                                        }
369
                                        return true;
9,610✔
370
                        }
371
                }
39,546✔
372

373
                private bool readTableEntity(CadEntityTemplate template, DxfMap map, string subclass = null)
374
                {
158,040✔
375
                        string mapName = string.IsNullOrEmpty(subclass) ? template.CadObject.SubclassMarker : subclass;
158,040!
376
                        CadTableEntityTemplate tmp = template as CadTableEntityTemplate;
158,040✔
377
                        TableEntity table = tmp.CadObject as TableEntity;
158,040✔
378

379
                        switch (this._reader.Code)
158,040✔
380
                        {
381
                                case 2:
382
                                        tmp.BlockName = this._reader.ValueAsString;
480✔
383
                                        return true;
480✔
384
                                case 342:
385
                                        tmp.StyleHandle = this._reader.ValueAsHandle;
480✔
386
                                        return true;
480✔
387
                                case 343:
388
                                        tmp.BlockOwnerHandle = this._reader.ValueAsHandle;
480✔
389
                                        return true;
480✔
390
                                case 141:
391
                                        var row = new TableEntity.Row();
2,640✔
392
                                        row.Height = this._reader.ValueAsDouble;
2,640✔
393
                                        table.Rows.Add(row);
2,640✔
394
                                        return true;
2,640✔
395
                                case 142:
396
                                        var col = new TableEntity.Column();
1,920✔
397
                                        col.Width = this._reader.ValueAsDouble;
1,920✔
398
                                        table.Columns.Add(col);
1,920✔
399
                                        return true;
1,920✔
400
                                case 144:
401
                                        tmp.CurrentCellTemplate.FormatTextHeight = this._reader.ValueAsDouble;
480✔
402
                                        return true;
480✔
403
                                case 145:
404
                                        tmp.CurrentCell.Rotation = this._reader.ValueAsDouble;
9,840✔
405
                                        return true;
9,840✔
406
                                case 170:
407
                                        //Has data flag
408
                                        return true;
720✔
409
                                case 171:
410
                                        tmp.CreateCell((TableEntity.CellType)this._reader.ValueAsInt);
9,840✔
411
                                        return true;
9,840✔
412
                                case 172:
413
                                        tmp.CurrentCell.FlagValue = this._reader.ValueAsInt;
9,840✔
414
                                        return true;
9,840✔
415
                                case 173:
416
                                        tmp.CurrentCell.MergedValue = this._reader.ValueAsInt;
9,840✔
417
                                        return true;
9,840✔
418
                                case 174:
419
                                        tmp.CurrentCell.Autofit = this._reader.ValueAsBool;
9,840✔
420
                                        return true;
9,840✔
421
                                case 175:
422
                                        tmp.CurrentCell.BorderWidth = this._reader.ValueAsInt;
9,840✔
423
                                        return true;
9,840✔
424
                                case 176:
425
                                        tmp.CurrentCell.BorderHeight = this._reader.ValueAsInt;
9,840✔
426
                                        return true;
9,840✔
427
                                case 178:
428
                                        tmp.CurrentCell.VirtualEdgeFlag = this._reader.ValueAsShort;
9,840✔
429
                                        return true;
9,840✔
430
                                case 179:
431
                                        //Unknown value
432
                                        return true;
480✔
433
                                case 301:
434
                                        var content = new TableEntity.CellContent();
6,560✔
435
                                        tmp.CurrentCell.Contents.Add(content);
6,560✔
436
                                        this.readCellValue(content);
6,560✔
437
                                        return true;
6,560✔
438
                                case 340:
439
                                        tmp.CurrentCellTemplate.BlockRecordHandle = this._reader.ValueAsHandle;
480✔
440
                                        return true;
480✔
441
                                default:
442
                                        if (!this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Insert]))
64,600✔
443
                                        {
62,920✔
444
                                                return this.readEntitySubclassMap(template, map, DxfSubclassMarker.TableEntity);
62,920✔
445
                                        }
446
                                        return true;
1,680✔
447
                        }
448
                }
158,040✔
449

450
                private void readCellValue(TableEntity.CellContent content)
451
                {
6,560✔
452
                        if (this._reader.ValueAsString.Equals("CELL_VALUE", StringComparison.OrdinalIgnoreCase))
6,560!
453
                        {
6,560✔
454
                                this._reader.ReadNext();
6,560✔
455
                        }
6,560✔
456
                        else
457
                        {
×
458
                                throw new Exceptions.DxfException($"Expected value not found CELL_VALUE", this._reader.Position);
×
459
                        }
460

461
                        while (this._reader.Code != 304
42,880✔
462
                                && !this._reader.ValueAsString.Equals("ACVALUE_END", StringComparison.OrdinalIgnoreCase))
42,880✔
463
                        {
36,320✔
464
                                switch (this._reader.Code)
36,320!
465
                                {
466
                                        case 1:
467
                                                content.Value.Text = this._reader.ValueAsString;
1,920✔
468
                                                break;
1,920✔
469
                                        case 2:
470
                                                content.Value.Text += this._reader.ValueAsString;
×
471
                                                break;
×
472
                                        case 11:
473
                                                content.Value.Value = new XYZ(this._reader.ValueAsDouble, 0, 0);
160✔
474
                                                break;
160✔
475
                                        case 21:
476
                                                content.Value.Value = new XYZ(0, this._reader.ValueAsDouble, 0);
160✔
477
                                                break;
160✔
478
                                        case 31:
479
                                                content.Value.Value = new XYZ(0, 0, this._reader.ValueAsDouble);
160✔
480
                                                break;
160✔
481
                                        case 302:
482
                                                //TODO: Fix this assignation to cell value
483
                                                content.Value.Value = this._reader.ValueAsString;
6,560✔
484
                                                break;
6,560✔
485
                                        case 90:
486
                                                content.Value.ValueType = (TableEntity.CellValueType)this._reader.ValueAsInt;
6,560✔
487
                                                break;
6,560✔
488
                                        case 91:
489
                                                content.Value.Value = this._reader.ValueAsInt;
160✔
490
                                                break;
160✔
491
                                        case 93:
492
                                                content.Value.Flags = this._reader.ValueAsInt;
6,560✔
493
                                                break;
6,560✔
494
                                        case 94:
495
                                                content.Value.Units = (TableEntity.ValueUnitType)this._reader.ValueAsInt;
6,560✔
496
                                                break;
6,560✔
497
                                        case 140:
498
                                                content.Value.Value = this._reader.ValueAsDouble;
640✔
499
                                                break;
640✔
500
                                        case 300:
501
                                                content.Value.Format = this._reader.ValueAsString;
6,560✔
502
                                                break;
6,560✔
503
                                        default:
504
                                                this._builder.Notify($"[CELL_VALUE] Unhandled dxf code {this._reader.Code} with value {this._reader.ValueAsString}", NotificationType.None);
320✔
505
                                                break;
320✔
506
                                }
507

508
                                this._reader.ReadNext();
36,320✔
509
                        }
36,320✔
510
                }
6,560✔
511

512
                private bool readTextEntity(CadEntityTemplate template, DxfMap map, string subclass = null)
513
                {
341,010✔
514
                        string mapName = string.IsNullOrEmpty(subclass) ? template.CadObject.SubclassMarker : subclass;
341,010✔
515
                        CadTextEntityTemplate tmp = template as CadTextEntityTemplate;
341,010✔
516

517
                        switch (this._reader.Code)
341,010✔
518
                        {
519
                                //TODO: Implement multiline text def codes
520
                                case 1 or 3 when tmp.CadObject is MText mtext:
30,306✔
521
                                        mtext.Value += this._reader.ValueAsString;
11,466✔
522
                                        return true;
11,466✔
523
                                case 50 when tmp.CadObject is MText mtext://Read only for MText
570!
524
                                        double angle = MathHelper.DegToRad(this._reader.ValueAsDouble);
×
525
                                        mtext.AlignmentPoint = new XYZ(System.Math.Cos(angle), System.Math.Sin(angle), 0.0);
×
526
                                        return true;
×
527
                                case 70:
528
                                case 74:
529
                                case 101:
530
                                        return true;
480✔
531
                                case 7:
532
                                        tmp.StyleName = this._reader.ValueAsString;
3,080✔
533
                                        return true;
3,080✔
534
                                default:
535
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[mapName]);
325,984✔
536
                        }
537
                }
341,010✔
538

539
                private bool readTolerance(CadEntityTemplate template, DxfMap map, string subclass = null)
540
                {
7,200✔
541
                        CadToleranceTemplate tmp = template as CadToleranceTemplate;
7,200✔
542

543
                        switch (this._reader.Code)
7,200✔
544
                        {
545
                                case 3:
546
                                        tmp.DimensionStyleName = this._reader.ValueAsString;
720✔
547
                                        return true;
720✔
548
                                default:
549
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
6,480✔
550
                        }
551
                }
7,200✔
552

553
                private bool readDimension(CadEntityTemplate template, DxfMap map, string subclass = null)
554
                {
80,560✔
555
                        CadDimensionTemplate tmp = template as CadDimensionTemplate;
80,560✔
556

557
                        switch (this._reader.Code)
80,560✔
558
                        {
559
                                case 2:
560
                                        tmp.BlockName = this._reader.ValueAsString;
3,080✔
561
                                        return true;
3,080✔
562
                                case 3:
563
                                        tmp.StyleName = this._reader.ValueAsString;
2,640✔
564
                                        return true;
2,640✔
565
                                case 50:
566
                                        var dim = new DimensionLinear();
280✔
567
                                        tmp.SetDimensionObject(dim);
280✔
568
                                        dim.Rotation = this._reader.ValueAsAngle;
280✔
569
                                        map.SubClasses.Add(DxfSubclassMarker.LinearDimension, DxfClassMap.Create<DimensionLinear>());
280✔
570
                                        return true;
280✔
571
                                case 70:
572
                                        //Flags do not have set
573
                                        tmp.SetDimensionFlags((DimensionType)this._reader.ValueAsShort);
3,080✔
574
                                        return true;
3,080✔
575
                                //Measurement - read only
576
                                case 42:
577
                                        return true;
2,640✔
578
                                //Undocumented codes
579
                                case 73:
580
                                case 74:
581
                                case 75:
582
                                case 90:
583
                                case 361:
584
                                        return true;
5,280✔
585
                                case 100:
586
                                        switch (this._reader.ValueAsString)
8,640✔
587
                                        {
588
                                                case DxfSubclassMarker.Dimension:
589
                                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Dimension]);
2,640✔
590
                                                case DxfSubclassMarker.AlignedDimension:
591
                                                        tmp.SetDimensionObject(new DimensionAligned());
1,200✔
592
                                                        map.SubClasses.Add(this._reader.ValueAsString, DxfClassMap.Create<DimensionAligned>());
1,200✔
593
                                                        return true;
1,200✔
594
                                                case DxfSubclassMarker.DiametricDimension:
595
                                                        tmp.SetDimensionObject(new DimensionDiameter());
240✔
596
                                                        map.SubClasses.Add(this._reader.ValueAsString, DxfClassMap.Create<DimensionDiameter>());
240✔
597
                                                        return true;
240✔
598
                                                case DxfSubclassMarker.Angular2LineDimension:
599
                                                        tmp.SetDimensionObject(new DimensionAngular2Line());
240✔
600
                                                        map.SubClasses.Add(this._reader.ValueAsString, DxfClassMap.Create<DimensionAngular2Line>());
240✔
601
                                                        return true;
240✔
602
                                                case DxfSubclassMarker.Angular3PointDimension:
603
                                                        tmp.SetDimensionObject(new DimensionAngular3Pt());
240✔
604
                                                        map.SubClasses.Add(this._reader.ValueAsString, DxfClassMap.Create<DimensionAngular3Pt>());
240✔
605
                                                        return true;
240✔
606
                                                case DxfSubclassMarker.RadialDimension:
607
                                                        tmp.SetDimensionObject(new DimensionRadius());
240✔
608
                                                        map.SubClasses.Add(this._reader.ValueAsString, DxfClassMap.Create<DimensionRadius>());
240✔
609
                                                        return true;
240✔
610
                                                case DxfSubclassMarker.OrdinateDimension:
611
                                                        tmp.SetDimensionObject(new DimensionOrdinate());
480✔
612
                                                        map.SubClasses.Add(this._reader.ValueAsString, DxfClassMap.Create<DimensionOrdinate>());
480✔
613
                                                        return true;
480✔
614
                                                case DxfSubclassMarker.LinearDimension:
615
                                                        return true;
720✔
616
                                                default:
617
                                                        return false;
2,640✔
618
                                        }
619
                                default:
620
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
54,920✔
621
                        }
622
                }
80,560✔
623

624
                protected bool readHatch(CadEntityTemplate template, DxfMap map, string subclass = null)
625
                {
48,000✔
626
                        CadHatchTemplate tmp = template as CadHatchTemplate;
48,000✔
627
                        Hatch hatch = tmp.CadObject;
48,000✔
628

629
                        bool isFirstSeed = true;
48,000✔
630
                        XY seedPoint = new XY();
48,000✔
631

632
                        switch (this._reader.Code)
48,000!
633
                        {
634
                                case 2:
635
                                        hatch.Pattern.Name = this._reader.ValueAsString;
1,920✔
636
                                        return true;
1,920✔
637
                                case 10:
638
                                        seedPoint.X = this._reader.ValueAsDouble;
3,120✔
639
                                        return true;
3,120✔
640
                                case 20:
641
                                        if (!isFirstSeed)
3,840!
642
                                        {
×
643
                                                seedPoint.Y = this._reader.ValueAsDouble;
×
644
                                                hatch.SeedPoints.Add(seedPoint);
×
645
                                        }
×
646
                                        return true;
3,840✔
647
                                case 30:
648
                                        hatch.Elevation = this._reader.ValueAsDouble;
1,920✔
649
                                        isFirstSeed = false;
1,920✔
650
                                        return true;
1,920✔
651
                                case 53:
652
                                        hatch.PatternAngle = this._reader.ValueAsAngle;
×
653
                                        return true;
×
654
                                //TODO: Check hatch undocumented codes
655
                                case 90:
656
                                        return true;
×
657
                                //Information about the hatch pattern
658
                                case 75:
659
                                        return true;
×
660
                                //Number of pattern definition lines
661
                                case 78:
662
                                        this.readPattern(hatch.Pattern, this._reader.ValueAsInt);
1,440✔
663
                                        return true;
1,440✔
664
                                //Number of boundary paths (loops)
665
                                case 91:
666
                                        this.readLoops(tmp, this._reader.ValueAsInt);
1,920✔
667
                                        return true;
1,920✔
668
                                //Number of seed points
669
                                case 98:
670
                                        return true;
480✔
671
                                case 450:
672
                                        hatch.GradientColor.Enabled = this._reader.ValueAsBool;
400✔
673
                                        return true;
400✔
674
                                case 451:
675
                                        hatch.GradientColor.Reserved = this._reader.ValueAsInt;
400✔
676
                                        return true;
400✔
677
                                case 452:
678
                                        hatch.GradientColor.IsSingleColorGradient = this._reader.ValueAsBool;
400✔
679
                                        return true;
400✔
680
                                case 453:
681
                                        //Number of colors
682
                                        return true;
400✔
683
                                case 460:
684
                                        hatch.GradientColor.Angle = this._reader.ValueAsDouble;
400✔
685
                                        return true;
400✔
686
                                case 461:
687
                                        hatch.GradientColor.Shift = this._reader.ValueAsDouble;
400✔
688
                                        return true;
400✔
689
                                case 462:
690
                                        hatch.GradientColor.ColorTint = this._reader.ValueAsDouble;
400✔
691
                                        return true;
400✔
692
                                case 463:
693
                                        GradientColor gradient = new GradientColor();
800✔
694
                                        gradient.Value = this._reader.ValueAsDouble;
800✔
695
                                        hatch.GradientColor.Colors.Add(gradient);
800✔
696
                                        return true;
800✔
697
                                case 63:
698
                                        GradientColor colorByIndex = hatch.GradientColor.Colors.LastOrDefault();
800✔
699
                                        if (colorByIndex != null)
800✔
700
                                        {
800✔
701
                                                colorByIndex.Color = new Color((short)this._reader.ValueAsUShort);
800✔
702
                                        }
800✔
703
                                        return true;
800✔
704
                                case 421:
705
                                        GradientColor colorByRgb = hatch.GradientColor.Colors.LastOrDefault();
800✔
706
                                        if (colorByRgb != null)
800✔
707
                                        {
800✔
708
                                                //TODO: Hatch assign color by true color
709
                                                //TODO: Is always duplicated by 63, is it needed??
710
                                                //colorByRgb.Color = new Color(this._reader.LastValueAsShort);
711
                                        }
800✔
712
                                        return true;
800✔
713
                                case 470:
714
                                        hatch.GradientColor.Name = this._reader.ValueAsString;
400✔
715
                                        return true;
400✔
716
                                default:
717
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[template.CadObject.SubclassMarker]);
27,760✔
718
                        }
719
                }
48,000✔
720

721
                private bool readInsert(CadEntityTemplate template, DxfMap map, string subclass = null)
722
                {
69,626✔
723
                        CadInsertTemplate tmp = template as CadInsertTemplate;
69,626✔
724

725
                        switch (this._reader.Code)
69,626✔
726
                        {
727
                                case 2:
728
                                        tmp.BlockName = this._reader.ValueAsString;
6,508✔
729
                                        return true;
6,508✔
730
                                case 100:
731
                                        //AcDbEntity
732
                                        //AcDbBlockReference
733
                                        //AcDbMInsertBlock
734
                                        return true;
6,528✔
735
                                case 66:
736
                                        return true;
560✔
737
                                default:
738
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Insert]);
56,030✔
739
                        }
740
                }
69,626✔
741

742
                private CadEntityTemplate readPolyline()
743
                {
12,348✔
744
                        CadPolyLineTemplate template = null;
12,348✔
745

746
                        if (this._builder.Version == ACadVersion.Unknown
12,348!
747
                                || this._builder.Version == ACadVersion.AC1009)
12,348✔
748
                        {
11,868✔
749
                                var polyline = new Polyline2D();
11,868✔
750
                                template = new CadPolyLineTemplate(polyline);
11,868✔
751
                                this.readEntityCodes<Polyline2D>(template, this.readPolyline);
11,868✔
752

753
                                while (this._reader.Code == 0 && this._reader.ValueAsString == DxfFileToken.EntityVertex)
54,108!
754
                                {
42,240✔
755
                                        Vertex2D v = new Vertex2D();
42,240✔
756
                                        CadVertexTemplate vertexTemplate = new CadVertexTemplate(v);
42,240✔
757
                                        this.readEntityCodes<Vertex2D>(vertexTemplate, this.readVertex);
42,240✔
758

759
                                        if (vertexTemplate.Vertex.Handle == 0)
42,240!
760
                                        {
×
761
                                                polyline.Vertices.Add(v);
×
762
                                        }
×
763
                                        else
764
                                        {
42,240✔
765
                                                template.VertexHandles.Add(vertexTemplate.Vertex.Handle);
42,240✔
766
                                                this._builder.AddTemplate(vertexTemplate);
42,240✔
767
                                        }
42,240✔
768
                                }
42,240✔
769

770
                                while (this._reader.Code == 0 && this._reader.ValueAsString == DxfFileToken.EndSequence)
23,736!
771
                                {
11,868✔
772
                                        var seqend = new Seqend();
11,868✔
773
                                        var seqendTemplate = new CadEntityTemplate<Seqend>(seqend);
11,868✔
774
                                        this.readEntityCodes<Seqend>(seqendTemplate, this.readEntitySubclassMap);
11,868✔
775

776
                                        polyline.Vertices.Seqend = seqend;
11,868✔
777
                                }
11,868✔
778
                        }
11,868✔
779
                        else
780
                        {
480✔
781
                                template = new CadPolyLineTemplate();
480✔
782
                                this.readEntityCodes<Entity>(template, this.readPolyline);
480✔
783
                        }
480✔
784

785
                        if (template.CadObject is CadPolyLineTemplate.PolyLinePlaceholder)
12,348!
UNCOV
786
                        {
×
UNCOV
787
                                this._builder.Notify($"[{DxfFileToken.EntityPolyline}] Subclass not found, entity discarded", NotificationType.Warning);
×
UNCOV
788
                                return null;
×
789
                        }
790

791
                        return template;
12,348✔
792
                }
12,348✔
793

794
                private bool readPolyline(CadEntityTemplate template, DxfMap map, string subclass = null)
795
                {
88,672✔
796
                        CadPolyLineTemplate tmp = template as CadPolyLineTemplate;
88,672✔
797

798
                        switch (this._reader.Code)
88,672✔
799
                        {
800
                                //DXF: always 0
801
                                //APP: a “dummy” point; the X and Y values are always 0, and the Z value is the polyline's elevation (in OCS when 2D, WCS when 3D)
802
                                case 10:
803
                                case 20:
804
                                //Obsolete; formerly an “entities follow flag” (optional; ignore if present)
805
                                case 66:
806
                                //Polygon mesh M vertex count (optional; default = 0)
807
                                case 71:
808
                                //Polygon mesh N vertex count(optional; default = 0)
809
                                case 72:
810
                                //Smooth surface M density(optional; default = 0)
811
                                case 73:
812
                                //Smooth surface N density (optional; default = 0)
813
                                case 74:
814
                                        return true;
37,604✔
815
                                case 100:
816
                                        switch (this._reader.ValueAsString)
960!
817
                                        {
818
                                                case DxfSubclassMarker.Polyline:
819
                                                        tmp.SetPolyLineObject(new Polyline2D());
×
820
                                                        map.SubClasses.Add(DxfSubclassMarker.Polyline, DxfClassMap.Create<Polyline2D>());
×
821
                                                        return true;
×
822
                                                case DxfSubclassMarker.Polyline3d:
823
                                                        tmp.SetPolyLineObject(new Polyline3D());
240✔
824
                                                        map.SubClasses.Add(DxfSubclassMarker.Polyline3d, DxfClassMap.Create<Polyline3D>());
240✔
825
                                                        return true;
240✔
826
                                                case DxfSubclassMarker.PolyfaceMesh:
827
                                                        tmp.SetPolyLineObject(new PolyfaceMesh());
240✔
828
                                                        map.SubClasses.Add(DxfSubclassMarker.PolyfaceMesh, DxfClassMap.Create<PolyfaceMesh>());
240✔
829
                                                        return true;
240✔
830
                                                default:
831
                                                        return false;
480✔
832
                                        }
833
                                default:
834
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
50,108✔
835
                        }
836
                }
88,672✔
837

838
                private bool readLeader(CadEntityTemplate template, DxfMap map, string subclass = null)
839
                {
6,000✔
840
                        CadLeaderTemplate tmp = template as CadLeaderTemplate;
6,000✔
841

842
                        switch (this._reader.Code)
6,000✔
843
                        {
844
                                case 3:
845
                                        tmp.DIMSTYLEName = this._reader.ValueAsString;
240✔
846
                                        return true;
240✔
847
                                case 10:
848
                                        tmp.CadObject.Vertices.Add(new XYZ(this._reader.ValueAsDouble, 0, 0));
960✔
849
                                        return true;
960✔
850
                                case 20:
851
                                        XYZ y = tmp.CadObject.Vertices[tmp.CadObject.Vertices.Count - 1];
960✔
852
                                        y.Y = this._reader.ValueAsDouble;
960✔
853
                                        tmp.CadObject.Vertices[tmp.CadObject.Vertices.Count - 1] = y;
960✔
854
                                        return true;
960✔
855
                                case 30:
856
                                        XYZ z = tmp.CadObject.Vertices[tmp.CadObject.Vertices.Count - 1];
960✔
857
                                        z.Z = this._reader.ValueAsDouble;
960✔
858
                                        tmp.CadObject.Vertices[tmp.CadObject.Vertices.Count - 1] = z;
960✔
859
                                        return true;
960✔
860
                                case 340:
861
                                        tmp.AnnotationHandle = this._reader.ValueAsHandle;
240✔
862
                                        return true;
240✔
863
                                //Hook line flag - read only
864
                                case 75:
865
                                //Vertices count
866
                                case 76:
867
                                        return true;
480✔
868
                                default:
869
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
2,160✔
870
                        }
871
                }
6,000✔
872

873
                private bool readLwPolyline(CadEntityTemplate template, DxfMap map, string subclass = null)
874
                {
98,616✔
875
                        CadEntityTemplate<LwPolyline> tmp = template as CadEntityTemplate<LwPolyline>;
98,616✔
876

877
                        LwPolyline.Vertex last = tmp.CadObject.Vertices.LastOrDefault();
98,616✔
878

879
                        switch (this._reader.Code)
98,616!
880
                        {
881
                                case 10:
882
                                        tmp.CadObject.Vertices.Add(new LwPolyline.Vertex(new XY(this._reader.ValueAsDouble, 0)));
23,412✔
883
                                        return true;
23,412✔
884
                                case 20:
885
                                        if (last is not null)
23,412✔
886
                                        {
23,412✔
887
                                                last.Location = new XY(last.Location.X, this._reader.ValueAsDouble);
23,412✔
888
                                        }
23,412✔
889
                                        return true;
23,412✔
890
                                case 40:
891
                                        if (last is not null)
2,400✔
892
                                        {
2,400✔
893
                                                last.StartWidth = this._reader.ValueAsDouble;
2,400✔
894
                                        }
2,400✔
895
                                        return true;
2,400✔
896
                                case 41:
897
                                        if (last is not null)
2,400✔
898
                                        {
2,400✔
899
                                                last.EndWidth = this._reader.ValueAsDouble;
2,400✔
900
                                        }
2,400✔
901
                                        return true;
2,400✔
902
                                case 42:
903
                                        if (last is not null)
3,288✔
904
                                        {
3,288✔
905
                                                last.Bulge = this._reader.ValueAsDouble;
3,288✔
906
                                        }
3,288✔
907
                                        return true;
3,288✔
908
                                case 50:
909
                                        if (last is not null)
×
910
                                        {
×
911
                                                last.CurveTangent = this._reader.ValueAsDouble;
×
912
                                        }
×
913
                                        return true;
×
914
                                //Obsolete; formerly an “entities follow flag” (optional; ignore if present)
915
                                case 66:
916
                                //Vertex count
917
                                case 90:
918
                                        return true;
5,256✔
919
                                case 91:
920
                                        if (last is not null)
×
921
                                        {
×
922
                                                last.Id = this._reader.ValueAsInt;
×
923
                                        }
×
924
                                        return true;
×
925
                                default:
926
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
38,448✔
927
                        }
928
                }
98,616✔
929

930
                private bool readMesh(CadEntityTemplate template, DxfMap map, string subclass = null)
931
                {
42,240✔
932
                        CadMeshTemplate tmp = template as CadMeshTemplate;
42,240✔
933

934
                        switch (this._reader.Code)
42,240✔
935
                        {
936
                                case 100:
937
                                        if (this._reader.ValueAsString.Equals(DxfSubclassMarker.Mesh, StringComparison.OrdinalIgnoreCase))
960✔
938
                                        {
480✔
939
                                                tmp.SubclassMarker = true;
480✔
940
                                        }
480✔
941
                                        return true;
960✔
942
                                //Count of sub-entity which property has been overridden
943
                                case 90:
944
                                        //TODO: process further entities
945
                                        return true;
480✔
946
                                case 92:
947
                                        if (!tmp.SubclassMarker)
720✔
948
                                        {
240✔
949
                                                return false;
240✔
950
                                        }
951

952
                                        int nvertices = this._reader.ValueAsInt;
480✔
953
                                        for (int i = 0; i < nvertices; i++)
61,440✔
954
                                        {
30,240✔
955
                                                this._reader.ReadNext();
30,240✔
956
                                                double x = this._reader.ValueAsDouble;
30,240✔
957
                                                this._reader.ReadNext();
30,240✔
958
                                                double y = this._reader.ValueAsDouble;
30,240✔
959
                                                this._reader.ReadNext();
30,240✔
960
                                                double z = this._reader.ValueAsDouble;
30,240✔
961
                                                tmp.CadObject.Vertices.Add(new XYZ(x, y, z));
30,240✔
962
                                        }
30,240✔
963
                                        return true;
480✔
964
                                case 93:
965
                                        int size = this._reader.ValueAsInt;
480✔
966
                                        this._reader.ReadNext();
480✔
967

968
                                        int indexes = 0;
480✔
969
                                        for (int i = 0; i < size; i += indexes + 1)
66,240✔
970
                                        {
32,640✔
971
                                                indexes = this._reader.ValueAsInt;
32,640✔
972
                                                this._reader.ReadNext();
32,640✔
973

974
                                                int[] face = new int[indexes];
32,640✔
975
                                                for (int j = 0; j < indexes; j++)
314,880✔
976
                                                {
124,800✔
977
                                                        face[j] = this._reader.ValueAsInt;
124,800✔
978

979
                                                        if ((i + j + 2) < size)
124,800✔
980
                                                        {
124,320✔
981
                                                                this._reader.ReadNext();
124,320✔
982
                                                        }
124,320✔
983
                                                }
124,800✔
984

985
                                                tmp.CadObject.Faces.Add(face);
32,640✔
986
                                        }
32,640✔
987

988
                                        Debug.Assert(this._reader.Code == 90);
480✔
989

990
                                        return true;
480✔
991
                                case 94:
992
                                        int numEdges = this._reader.ValueAsInt;
480✔
993
                                        this._reader.ReadNext();
480✔
994
                                        for (int i = 0; i < numEdges; i++)
125,760✔
995
                                        {
62,400✔
996
                                                Mesh.Edge edge = new Mesh.Edge();
62,400✔
997

998
                                                edge.Start = this._reader.ValueAsInt;
62,400✔
999
                                                this._reader.ReadNext();
62,400✔
1000
                                                edge.End = this._reader.ValueAsInt;
62,400✔
1001

1002
                                                if (i < numEdges - 1)
62,400✔
1003
                                                {
61,920✔
1004
                                                        this._reader.ReadNext();
61,920✔
1005
                                                }
61,920✔
1006

1007
                                                tmp.CadObject.Edges.Add(edge);
62,400✔
1008
                                        }
62,400✔
1009

1010
                                        Debug.Assert(this._reader.Code == 90);
480✔
1011

1012
                                        return true;
480✔
1013
                                case 95:
1014
                                        this._reader.ReadNext();
480✔
1015
                                        for (int i = 0; i < tmp.CadObject.Edges.Count; i++)
125,760✔
1016
                                        {
62,400✔
1017
                                                Mesh.Edge edge = tmp.CadObject.Edges[i];
62,400✔
1018
                                                edge.Crease = this._reader.ValueAsDouble;
62,400✔
1019

1020
                                                tmp.CadObject.Edges[i] = edge;
62,400✔
1021

1022
                                                if (i < tmp.CadObject.Edges.Count - 1)
62,400✔
1023
                                                {
61,920✔
1024
                                                        this._reader.ReadNext();
61,920✔
1025
                                                }
61,920✔
1026
                                        }
62,400✔
1027

1028
                                        Debug.Assert(this._reader.Code == 140);
480✔
1029

1030
                                        return true;
480✔
1031
                                default:
1032
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
38,640✔
1033
                        }
1034
                }
42,240✔
1035

1036
                private bool readMLine(CadEntityTemplate template, DxfMap map, string subclass = null)
1037
                {
62,400✔
1038
                        CadMLineTemplate tmp = template as CadMLineTemplate;
62,400✔
1039

1040
                        switch (this._reader.Code)
62,400✔
1041
                        {
1042
                                // String of up to 32 characters. The name of the style used for this mline. An entry for this style must exist in the MLINESTYLE dictionary.
1043
                                // Do not modify this field without also updating the associated entry in the MLINESTYLE dictionary
1044
                                case 2:
1045
                                        tmp.MLineStyleName = this._reader.ValueAsString;
720✔
1046
                                        return true;
720✔
1047
                                case 72:
1048
                                        tmp.NVertex = this._reader.ValueAsInt;
720✔
1049
                                        return true;
720✔
1050
                                case 73:
1051
                                        tmp.NElements = this._reader.ValueAsInt;
720✔
1052
                                        return true;
720✔
1053
                                case 340:
1054
                                        tmp.MLineStyleHandle = this._reader.ValueAsHandle;
720✔
1055
                                        return true;
720✔
1056
                                default:
1057
                                        if (!tmp.TryReadVertex(this._reader.Code, this._reader.Value))
59,520✔
1058
                                        {
10,080✔
1059
                                                return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
10,080✔
1060
                                        }
1061
                                        return true;
49,440✔
1062
                        }
1063
                }
62,400✔
1064

1065
                private bool readMLeader(CadEntityTemplate template, DxfMap map, string subclass = null)
1066
                {
169,440✔
1067
                        CadMLeaderTemplate tmp = template as CadMLeaderTemplate;
169,440✔
1068

1069
                        switch (this._reader.Code)
169,440✔
1070
                        {
1071
                                case 270:
1072
                                        //f270 Version
1073
                                        return true;
1,800✔
1074
                                case 300:
1075
                                        this.readMultiLeaderObjectContextData(tmp.CadMLeaderAnnotContextTemplate);
3,600✔
1076
                                        return true;
3,600✔
1077
                                case 340:
1078
                                        tmp.LeaderStyleHandle = this._reader.ValueAsHandle;
3,600✔
1079
                                        return true;
3,600✔
1080
                                case 341:
1081
                                        tmp.LineTypeHandle = this._reader.ValueAsHandle;
3,600✔
1082
                                        return true;
3,600✔
1083
                                case 343:
1084
                                        tmp.MTextStyleHandle = this._reader.ValueAsHandle;
3,600✔
1085
                                        return true;
3,600✔
1086
                                default:
1087
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
153,240✔
1088
                        }
1089
                }
169,440✔
1090

1091
                private void readMultiLeaderObjectContextData(CadMLeaderAnnotContextTemplate template)
1092
                {
3,600✔
1093
                        this._reader.ReadNext();
3,600✔
1094

1095
                        DxfMap map = DxfMap.Create<MultiLeaderObjectContextData>();
3,600✔
1096
                        var contextData = template.CadObject as MultiLeaderObjectContextData;
3,600✔
1097

1098
                        bool end = false;
3,600✔
1099
                        while (this._reader.DxfCode != DxfCode.Start)
201,600✔
1100
                        {
201,600✔
1101
                                switch (this._reader.Code)
201,600✔
1102
                                {
1103
                                        case 301 when this._reader.ValueAsString.Equals("}"):
3,600✔
1104
                                                end = true;
3,600✔
1105
                                                break;
3,600✔
1106
                                        case 302 when this._reader.ValueAsString.Equals("LEADER{"):
3,600✔
1107
                                                contextData.LeaderRoots.Add(this.readMultiLeaderLeader(template));
3,600✔
1108
                                                break;
3,600✔
1109
                                        case 340:
1110
                                                template.TextStyleHandle = this._reader.ValueAsHandle;
3,600✔
1111
                                                break;
3,600✔
1112
                                        default:
1113
                                                if (!this.tryAssignCurrentValue(contextData, map.SubClasses[contextData.SubclassMarker]))
190,800!
1114
                                                {
×
1115
                                                        this._builder.Notify($"[AcDbMLeaderObjectContextData] Unhandled dxf code {this._reader.Code} with value {this._reader.ValueAsString}", NotificationType.None);
×
1116
                                                }
×
1117
                                                break;
190,800✔
1118
                                }
1119

1120
                                if (end)
201,600✔
1121
                                {
3,600✔
1122
                                        break;
3,600✔
1123
                                }
1124

1125
                                this._reader.ReadNext();
198,000✔
1126
                        }
198,000✔
1127
                }
3,600✔
1128

1129
                private MultiLeaderObjectContextData.LeaderRoot readMultiLeaderLeader(CadMLeaderAnnotContextTemplate template)
1130
                {
3,600✔
1131
                        MultiLeaderObjectContextData.LeaderRoot root = new();
3,600✔
1132
                        var map = DxfClassMap.Create(root.GetType(), nameof(MultiLeaderObjectContextData.LeaderRoot));
3,600✔
1133

1134
                        this._reader.ReadNext();
3,600✔
1135

1136
                        bool end = false;
3,600✔
1137
                        while (this._reader.DxfCode != DxfCode.Start)
45,000✔
1138
                        {
45,000✔
1139
                                switch (this._reader.Code)
45,000✔
1140
                                {
1141
                                        case 303 when this._reader.ValueAsString.Equals("}"):
3,600✔
1142
                                                end = true;
3,600✔
1143
                                                break;
3,600✔
1144
                                        case 304 when this._reader.ValueAsString.Equals("LEADER_LINE{"):
3,600✔
1145
                                                var lineTemplate = new LeaderLineTemplate();
3,600✔
1146
                                                template.LeaderLineTemplates.Add(lineTemplate);
3,600✔
1147
                                                root.Lines.Add(this.readMultiLeaderLine(lineTemplate));
3,600✔
1148
                                                break;
3,600✔
1149
                                        default:
1150
                                                if (!this.tryAssignCurrentValue(root, map))
37,800!
1151
                                                {
×
1152
                                                        this._builder.Notify($"[LeaderRoot] Unhandled dxf code {this._reader.Code} with value {this._reader.ValueAsString}", NotificationType.None);
×
1153
                                                }
×
1154
                                                break;
37,800✔
1155
                                }
1156

1157
                                if (end)
45,000✔
1158
                                {
3,600✔
1159
                                        break;
3,600✔
1160
                                }
1161

1162
                                this._reader.ReadNext();
41,400✔
1163
                        }
41,400✔
1164

1165
                        return root;
3,600✔
1166
                }
3,600✔
1167

1168
                private MultiLeaderObjectContextData.LeaderLine readMultiLeaderLine(LeaderLineTemplate template)
1169
                {
3,600✔
1170
                        MultiLeaderObjectContextData.LeaderLine line = template.LeaderLine;
3,600✔
1171
                        var map = DxfClassMap.Create(line.GetType(), nameof(MultiLeaderObjectContextData.LeaderLine));
3,600✔
1172

1173
                        this._reader.ReadNext();
3,600✔
1174

1175
                        bool end = false;
3,600✔
1176
                        while (this._reader.DxfCode != DxfCode.Start)
18,000✔
1177
                        {
18,000✔
1178
                                switch (this._reader.Code)
18,000✔
1179
                                {
1180
                                        case 10:
1181
                                                XYZ pt = new XYZ(this._reader.ValueAsDouble, 0, 0);
3,600✔
1182
                                                line.Points.Add(pt);
3,600✔
1183
                                                break;
3,600✔
1184
                                        case 20:
1185
                                                pt = line.Points[line.Points.Count - 1];
3,600✔
1186
                                                pt.Y = this._reader.ValueAsDouble;
3,600✔
1187
                                                line.Points[line.Points.Count - 1] = pt;
3,600✔
1188
                                                break;
3,600✔
1189
                                        case 30:
1190
                                                pt = line.Points[line.Points.Count - 1];
3,600✔
1191
                                                pt.Z = this._reader.ValueAsDouble;
3,600✔
1192
                                                line.Points[line.Points.Count - 1] = pt;
3,600✔
1193
                                                break;
3,600✔
1194
                                        case 305 when this._reader.ValueAsString.Equals("}"):
3,600✔
1195
                                                end = true;
3,600✔
1196
                                                break;
3,600✔
1197
                                        default:
1198
                                                if (!this.tryAssignCurrentValue(line, map))
3,600!
1199
                                                {
×
1200
                                                        this._builder.Notify($"[LeaderLine] Unhandled dxf code {this._reader.Code} with value {this._reader.ValueAsString}", NotificationType.None);
×
1201
                                                }
×
1202
                                                break;
3,600✔
1203
                                }
1204

1205
                                if (end)
18,000✔
1206
                                {
3,600✔
1207
                                        break;
3,600✔
1208
                                }
1209

1210
                                this._reader.ReadNext();
14,400✔
1211
                        }
14,400✔
1212

1213
                        return line;
3,600✔
1214
                }
3,600✔
1215

1216
                private bool readShape(CadEntityTemplate template, DxfMap map, string subclass = null)
1217
                {
2,680✔
1218
                        CadShapeTemplate tmp = template as CadShapeTemplate;
2,680✔
1219

1220
                        switch (this._reader.Code)
2,680✔
1221
                        {
1222
                                case 2:
1223
                                        tmp.ShapeFileName = this._reader.ValueAsString;
280✔
1224
                                        return true;
280✔
1225
                                default:
1226
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
2,400✔
1227
                        }
1228
                }
2,680✔
1229

1230
                private bool readWipeoutBase(CadEntityTemplate template, DxfMap map, string subclass = null)
1231
                {
14,160✔
1232
                        CadWipeoutBaseTemplate tmp = template as CadWipeoutBaseTemplate;
14,160✔
1233
                        CadWipeoutBase wipeout = tmp.CadObject as CadWipeoutBase;
14,160✔
1234

1235
                        switch (this._reader.Code)
14,160✔
1236
                        {
1237
                                case 91:
1238
                                        var nvertices = this._reader.ValueAsInt;
480✔
1239
                                        for (int i = 0; i < nvertices; i++)
4,320✔
1240
                                        {
1,680✔
1241
                                                this._reader.ReadNext();
1,680✔
1242
                                                var x = this._reader.ValueAsDouble;
1,680✔
1243
                                                this._reader.ReadNext();
1,680✔
1244
                                                var y = this._reader.ValueAsDouble;
1,680✔
1245

1246
                                                wipeout.ClipBoundaryVertices.Add(new XY(x, y));
1,680✔
1247
                                        }
1,680✔
1248

1249
                                        this._reader.ReadNext();
480✔
1250

1251
                                        return this.checkEntityEnd(template, map, subclass, this.readWipeoutBase);
480✔
1252
                                case 340:
1253
                                        tmp.ImgDefHandle = this._reader.ValueAsHandle;
480✔
1254
                                        return true;
480✔
1255
                                case 360:
1256
                                        tmp.ImgReactorHandle = this._reader.ValueAsHandle;
480✔
1257
                                        return true;
480✔
1258
                                default:
1259
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
12,720✔
1260
                        }
1261
                }
14,160✔
1262

1263
                private bool readModelerGeometry(CadEntityTemplate template, DxfMap map, string subclass = null)
1264
                {
342,410✔
1265
                        string mapName = string.IsNullOrEmpty(subclass) ? template.CadObject.SubclassMarker : subclass;
342,410✔
1266
                        var geometry = template.CadObject as ModelerGeometry;
342,410✔
1267

1268
                        switch (this._reader.Code)
342,410✔
1269
                        {
1270
                                case 2:
1271
                                        geometry.Guid = new Guid(this._reader.ValueAsString);
240✔
1272
                                        return true;
240✔
1273
                                case 290:
1274
                                        return true;
240✔
1275
                                default:
1276
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[mapName]);
341,930✔
1277
                        }
1278
                }
342,410✔
1279

1280
                private bool readSolid3d(CadEntityTemplate template, DxfMap map, string subclass = null)
1281
                {
41,040✔
1282
                        CadSolid3DTemplate tmp = template as CadSolid3DTemplate;
41,040✔
1283

1284
                        switch (this._reader.Code)
41,040✔
1285
                        {
1286
                                case 350:
1287
                                        tmp.HistoryHandle = this._reader.ValueAsHandle;
320✔
1288
                                        return true;
320✔
1289
                                default:
1290
                                        return this.readModelerGeometry(template, map, DxfSubclassMarker.ModelerGeometry);
40,720✔
1291
                        }
1292
                }
41,040✔
1293

1294
                private bool readSpline(CadEntityTemplate template, DxfMap map, string subclass = null)
1295
                {
16,800✔
1296
                        CadSplineTemplate tmp = template as CadSplineTemplate;
16,800✔
1297

1298
                        XYZ controlPoint;
1299
                        XYZ fitPoint;
1300

1301
                        switch (this._reader.Code)
16,800!
1302
                        {
1303
                                case 10:
1304
                                        controlPoint = new CSMath.XYZ(this._reader.ValueAsDouble, 0, 0);
1,920✔
1305
                                        tmp.CadObject.ControlPoints.Add(controlPoint);
1,920✔
1306
                                        return true;
1,920✔
1307
                                case 20:
1308
                                        controlPoint = tmp.CadObject.ControlPoints.LastOrDefault();
1,920✔
1309
                                        controlPoint.Y = this._reader.ValueAsDouble;
1,920✔
1310
                                        tmp.CadObject.ControlPoints[tmp.CadObject.ControlPoints.Count - 1] = controlPoint;
1,920✔
1311
                                        return true;
1,920✔
1312
                                case 30:
1313
                                        controlPoint = tmp.CadObject.ControlPoints.LastOrDefault();
1,920✔
1314
                                        controlPoint.Z = this._reader.ValueAsDouble;
1,920✔
1315
                                        tmp.CadObject.ControlPoints[tmp.CadObject.ControlPoints.Count - 1] = controlPoint;
1,920✔
1316
                                        return true;
1,920✔
1317
                                case 11:
1318
                                        fitPoint = new CSMath.XYZ(this._reader.ValueAsDouble, 0, 0);
×
1319
                                        tmp.CadObject.FitPoints.Add(fitPoint);
×
1320
                                        return true;
×
1321
                                case 21:
1322
                                        fitPoint = tmp.CadObject.FitPoints.LastOrDefault();
×
1323
                                        fitPoint.Y = this._reader.ValueAsDouble;
×
1324
                                        tmp.CadObject.FitPoints[tmp.CadObject.FitPoints.Count - 1] = fitPoint;
×
1325
                                        return true;
×
1326
                                case 31:
1327
                                        fitPoint = tmp.CadObject.FitPoints.LastOrDefault();
×
1328
                                        fitPoint.Z = this._reader.ValueAsDouble;
×
1329
                                        tmp.CadObject.FitPoints[tmp.CadObject.FitPoints.Count - 1] = fitPoint;
×
1330
                                        return true;
×
1331
                                case 40:
1332
                                        tmp.CadObject.Knots.Add(this._reader.ValueAsDouble);
3,840✔
1333
                                        return true;
3,840✔
1334
                                case 41:
1335
                                        tmp.CadObject.Weights.Add(this._reader.ValueAsDouble);
×
1336
                                        return true;
×
1337
                                case 72:
1338
                                case 73:
1339
                                case 74:
1340
                                        return true;
1,440✔
1341
                                default:
1342
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
5,760✔
1343
                        }
1344
                }
16,800✔
1345

1346
                private bool readUnderlayEntity<T>(CadEntityTemplate template, DxfMap map, string subclass = null)
1347
                        where T : PdfUnderlayDefinition
1348
                {
3,800✔
1349
                        CadUnderlayTemplate<T> tmp = template as CadUnderlayTemplate<T>;
3,800✔
1350

1351
                        switch (this._reader.Code)
3,800✔
1352
                        {
1353
                                case 340:
1354
                                        tmp.DefinitionHandle = this._reader.ValueAsHandle;
240✔
1355
                                        return true;
240✔
1356
                                default:
1357
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
3,560✔
1358
                        }
1359
                }
3,800✔
1360

1361
                private bool readVertex(CadEntityTemplate template, DxfMap map, string subclass = null)
1362
                {
280,766✔
1363
                        CadVertexTemplate tmp = template as CadVertexTemplate;
280,766✔
1364

1365
                        switch (this._reader.Code)
280,766✔
1366
                        {
1367
                                //Polyface mesh vertex index
1368
                                case 71:
1369
                                case 72:
1370
                                case 73:
1371
                                case 74:
1372
                                        return true;
1,960✔
1373
                                case 100:
1374
                                        switch (this._reader.ValueAsString)
8,160!
1375
                                        {
1376
                                                case DxfSubclassMarker.Vertex:
1377
                                                        return true;
2,400✔
1378
                                                case DxfSubclassMarker.PolylineVertex:
1379
                                                        tmp.SetVertexObject(new Vertex2D());
×
1380
                                                        map.SubClasses.Add(DxfSubclassMarker.PolylineVertex, DxfClassMap.Create<Vertex2D>());
×
1381
                                                        return true;
×
1382
                                                case DxfSubclassMarker.Polyline3dVertex:
1383
                                                        tmp.SetVertexObject(new Vertex3D());
1,200✔
1384
                                                        map.SubClasses.Add(DxfSubclassMarker.Polyline3dVertex, DxfClassMap.Create<Vertex3D>());
1,200✔
1385
                                                        return true;
1,200✔
1386
                                                case DxfSubclassMarker.PolyfaceMeshVertex:
1387
                                                        tmp.SetVertexObject(new VertexFaceMesh());
1,200✔
1388
                                                        map.SubClasses.Add(DxfSubclassMarker.PolyfaceMeshVertex, DxfClassMap.Create<VertexFaceMesh>());
1,200✔
1389
                                                        return true;
1,200✔
1390
                                                case DxfSubclassMarker.PolyfaceMeshFace:
1391
                                                        tmp.SetVertexObject(new VertexFaceRecord());
480✔
1392
                                                        map.SubClasses.Add(DxfSubclassMarker.PolyfaceMeshFace, DxfClassMap.Create<VertexFaceRecord>());
480✔
1393
                                                        return true;
480✔
1394
                                                default:
1395
                                                        return false;
2,880✔
1396
                                        }
1397
                                default:
1398
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[tmp.CadObject.SubclassMarker]);
270,646✔
1399
                        }
1400
                }
280,766✔
1401

1402
                private bool readViewport(CadEntityTemplate template, DxfMap map, string subclass = null)
1403
                {
80,456✔
1404
                        CadViewportTemplate tmp = template as CadViewportTemplate;
80,456✔
1405

1406
                        switch (this._reader.Code)
80,456!
1407
                        {
1408
                                //Undocumented
1409
                                case 67:
1410
                                case 68:
1411
                                        return true;
2,944✔
1412
                                case 69:
1413
                                        tmp.ViewportId = this._reader.ValueAsShort;
1,472✔
1414
                                        return true;
1,472✔
1415
                                case 331:
1416
                                        tmp.FrozenLayerHandles.Add(this._reader.ValueAsHandle);
×
1417
                                        return true;
×
1418
                                case 348:
1419
                                        tmp.VisualStyleHandle = this._reader.ValueAsHandle;
928✔
1420
                                        return true;
928✔
1421
                                default:
1422
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.Viewport]);
75,112✔
1423
                        }
1424
                }
80,456✔
1425

1426
                private bool readEntitySubclassMap(CadEntityTemplate template, DxfMap map, string subclass = null)
1427
                {
1,007,142✔
1428
                        string mapName = string.IsNullOrEmpty(subclass) ? template.CadObject.SubclassMarker : subclass;
1,007,142✔
1429

1430
                        switch (this._reader.Code)
1,007,142✔
1431
                        {
1432
                                default:
1433
                                        return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[mapName]);
1,007,142✔
1434
                        }
1435
                }
1,007,142✔
1436

1437
                protected void readExtendedData(Dictionary<string, List<ExtendedDataRecord>> edata)
1438
                {
42,721✔
1439
                        List<ExtendedDataRecord> records = new();
42,721✔
1440
                        edata.Add(this._reader.ValueAsString, records);
42,721✔
1441

1442
                        this._reader.ReadNext();
42,721✔
1443

1444
                        while (this._reader.DxfCode >= DxfCode.ExtendedDataAsciiString)
328,498✔
1445
                        {
298,543✔
1446
                                if (this._reader.DxfCode == DxfCode.ExtendedDataRegAppName)
298,543✔
1447
                                {
12,766✔
1448
                                        this.readExtendedData(edata);
12,766✔
1449
                                        break;
12,766✔
1450
                                }
1451

1452
                                ExtendedDataRecord record = null;
285,777✔
1453
                                double x = 0;
285,777✔
1454
                                double y = 0;
285,777✔
1455
                                double z = 0;
285,777✔
1456

1457
                                switch (this._reader.DxfCode)
285,777✔
1458
                                {
1459
                                        case DxfCode.ExtendedDataAsciiString:
1460
                                        case DxfCode.ExtendedDataRegAppName:
1461
                                                record = new ExtendedDataString(this._reader.ValueAsString);
30,268✔
1462
                                                break;
30,268✔
1463
                                        case DxfCode.ExtendedDataControlString:
1464
                                                record = new ExtendedDataControlString(this._reader.ValueAsString == "}");
15,848✔
1465
                                                break;
15,848✔
1466
                                        case DxfCode.ExtendedDataLayerName:
1467
                                                if (this._builder.Layers.TryGetValue(this._reader.ValueAsString, out Layer layer))
280✔
1468
                                                {
266✔
1469
                                                        record = new ExtendedDataLayer(layer.Handle);
266✔
1470
                                                }
266✔
1471
                                                else
1472
                                                {
14✔
1473
                                                        this._builder.Notify($"[XData] Could not found the linked Layer {this._reader.ValueAsString}.", NotificationType.Warning);
14✔
1474
                                                }
14✔
1475
                                                break;
280✔
1476
                                        case DxfCode.ExtendedDataBinaryChunk:
1477
                                                record = new ExtendedDataBinaryChunk(this._reader.ValueAsBinaryChunk);
80✔
1478
                                                break;
80✔
1479
                                        case DxfCode.ExtendedDataHandle:
1480
                                                record = new ExtendedDataHandle(this._reader.ValueAsHandle);
2,958✔
1481
                                                break;
2,958✔
1482
                                        case DxfCode.ExtendedDataXCoordinate:
1483
                                                x = this._reader.ValueAsDouble;
2,984✔
1484
                                                this._reader.ReadNext();
2,984✔
1485
                                                y = this._reader.ValueAsDouble;
2,984✔
1486
                                                this._reader.ReadNext();
2,984✔
1487
                                                z = this._reader.ValueAsDouble;
2,984✔
1488

1489
                                                record = new ExtendedDataCoordinate(
2,984✔
1490
                                                        new XYZ(
2,984✔
1491
                                                                x,
2,984✔
1492
                                                                y,
2,984✔
1493
                                                                z)
2,984✔
1494
                                                        );
2,984✔
1495
                                                break;
2,984✔
1496
                                        case DxfCode.ExtendedDataWorldXCoordinate:
1497
                                                x = this._reader.ValueAsDouble;
1,440✔
1498
                                                this._reader.ReadNext();
1,440✔
1499
                                                y = this._reader.ValueAsDouble;
1,440✔
1500
                                                this._reader.ReadNext();
1,440✔
1501
                                                z = this._reader.ValueAsDouble;
1,440✔
1502

1503
                                                record = new ExtendedDataWorldCoordinate(
1,440✔
1504
                                                        new XYZ(
1,440✔
1505
                                                                x,
1,440✔
1506
                                                                y,
1,440✔
1507
                                                                z)
1,440✔
1508
                                                        );
1,440✔
1509
                                                break;
1,440✔
1510
                                        case DxfCode.ExtendedDataWorldXDisp:
1511
                                                x = this._reader.ValueAsDouble;
280✔
1512
                                                this._reader.ReadNext();
280✔
1513
                                                y = this._reader.ValueAsDouble;
280✔
1514
                                                this._reader.ReadNext();
280✔
1515
                                                z = this._reader.ValueAsDouble;
280✔
1516

1517
                                                record = new ExtendedDataDisplacement(
280✔
1518
                                                        new XYZ(
280✔
1519
                                                                x,
280✔
1520
                                                                y,
280✔
1521
                                                                z)
280✔
1522
                                                        );
280✔
1523
                                                break;
280✔
1524
                                        case DxfCode.ExtendedDataWorldXDir:
1525
                                                x = this._reader.ValueAsDouble;
280✔
1526
                                                this._reader.ReadNext();
280✔
1527
                                                y = this._reader.ValueAsDouble;
280✔
1528
                                                this._reader.ReadNext();
280✔
1529
                                                z = this._reader.ValueAsDouble;
280✔
1530

1531
                                                record = new ExtendedDataDirection(
280✔
1532
                                                        new XYZ(
280✔
1533
                                                                x,
280✔
1534
                                                                y,
280✔
1535
                                                                z)
280✔
1536
                                                        );
280✔
1537
                                                break;
280✔
1538
                                        case DxfCode.ExtendedDataReal:
1539
                                                record = new ExtendedDataReal(this._reader.ValueAsDouble);
140,536✔
1540
                                                break;
140,536✔
1541
                                        case DxfCode.ExtendedDataDist:
1542
                                                record = new ExtendedDataDistance(this._reader.ValueAsDouble);
280✔
1543
                                                break;
280✔
1544
                                        case DxfCode.ExtendedDataScale:
1545
                                                record = new ExtendedDataScale(this._reader.ValueAsDouble);
280✔
1546
                                                break;
280✔
1547
                                        case DxfCode.ExtendedDataInteger16:
1548
                                                record = new ExtendedDataInteger16(this._reader.ValueAsShort);
78,517✔
1549
                                                break;
78,517✔
1550
                                        case DxfCode.ExtendedDataInteger32:
1551
                                                record = new ExtendedDataInteger32((int)this._reader.ValueAsInt);
9,186✔
1552
                                                break;
9,186✔
1553
                                        default:
1554
                                                this._builder.Notify($"Unknown code for extended data: {this._reader.DxfCode}", NotificationType.Warning);
2,560✔
1555
                                                break;
2,560✔
1556
                                }
1557

1558
                                if (record != null)
285,777✔
1559
                                {
283,203✔
1560
                                        records.Add(record);
283,203✔
1561
                                }
283,203✔
1562

1563
                                this._reader.ReadNext();
285,777✔
1564
                        }
285,777✔
1565
                }
42,721✔
1566

1567
                private void readPattern(HatchPattern pattern, int nlines)
1568
                {
1,440✔
1569
                        //Jump 78 code
1570
                        this._reader.ReadNext();
1,440✔
1571

1572
                        for (int i = 0; i < nlines; i++)
218,400✔
1573
                        {
107,760✔
1574
                                HatchPattern.Line line = new HatchPattern.Line();
107,760✔
1575
                                XY basePoint = new XY();
107,760✔
1576
                                XY offset = new XY();
107,760✔
1577

1578
                                bool end = false;
107,760✔
1579
                                HashSet<int> codes = new();
107,760✔
1580

1581
                                while (!end)
755,760✔
1582
                                {
754,320✔
1583
                                        if (codes.Contains(this._reader.Code))
754,320✔
1584
                                        {
106,320✔
1585
                                                break;
106,320✔
1586
                                        }
1587
                                        else
1588
                                        {
648,000✔
1589
                                                codes.Add(this._reader.Code);
648,000✔
1590
                                        }
648,000✔
1591

1592
                                        switch (this._reader.Code)
648,000!
1593
                                        {
1594
                                                case 53:
1595
                                                        line.Angle = this._reader.ValueAsAngle;
107,760✔
1596
                                                        break;
107,760✔
1597
                                                case 43:
1598
                                                        basePoint.X = this._reader.ValueAsDouble;
107,760✔
1599
                                                        break;
107,760✔
1600
                                                case 44:
1601
                                                        basePoint.Y = this._reader.ValueAsDouble;
107,760✔
1602
                                                        line.BasePoint = basePoint;
107,760✔
1603
                                                        break;
107,760✔
1604
                                                case 45:
1605
                                                        offset.X = this._reader.ValueAsDouble;
107,760✔
1606
                                                        line.Offset = offset;
107,760✔
1607
                                                        break;
107,760✔
1608
                                                case 46:
1609
                                                        offset.Y = this._reader.ValueAsDouble;
107,760✔
1610
                                                        line.Offset = offset;
107,760✔
1611
                                                        break;
107,760✔
1612
                                                //Number of dash length items
1613
                                                case 79:
1614
                                                        int ndash = this._reader.ValueAsInt;
107,760✔
1615
                                                        for (int j = 0; j < ndash; j++)
645,600✔
1616
                                                        {
215,040✔
1617
                                                                this._reader.ReadNext();
215,040✔
1618
                                                                line.DashLengths.Add(this._reader.ValueAsDouble);
215,040✔
1619
                                                        }
215,040✔
1620
                                                        break;
107,760✔
1621
                                                case 49:
1622
                                                        line.DashLengths.Add(this._reader.ValueAsDouble);
×
1623
                                                        break;
×
1624
                                                default:
1625
                                                        end = true;
1,440✔
1626
                                                        break;
1,440✔
1627
                                        }
1628
                                        this._reader.ReadNext();
648,000✔
1629
                                }
648,000✔
1630

1631
                                pattern.Lines.Add(line);
107,760✔
1632
                        }
107,760✔
1633
                }
1,440✔
1634

1635
                private void readLoops(CadHatchTemplate template, int count)
1636
                {
1,920✔
1637
                        if (this._reader.Code == 91)
1,920✔
1638
                                this._reader.ReadNext();
1,920✔
1639

1640
                        for (int i = 0; i < count; i++)
7,680✔
1641
                        {
1,920✔
1642
                                if (this._reader.Code != 92)
1,920!
1643
                                {
×
1644
                                        this._builder.Notify($"Boundary path should start with code 92 but was {this._reader.Code}");
×
1645
                                        break;
×
1646
                                }
1647

1648
                                CadHatchTemplate.CadBoundaryPathTemplate path = this.readLoop();
1,920✔
1649
                                if (path != null)
1,920✔
1650
                                        template.PathTempaltes.Add(path);
1,920✔
1651
                        }
1,920✔
1652
                }
1,920✔
1653

1654
                private CadHatchTemplate.CadBoundaryPathTemplate readLoop()
1655
                {
1,920✔
1656
                        CadHatchTemplate.CadBoundaryPathTemplate template = new CadHatchTemplate.CadBoundaryPathTemplate();
1,920✔
1657
                        var flags = (BoundaryPathFlags)this._reader.ValueAsInt;
1,920✔
1658
                        template.Path.Flags = flags;
1,920✔
1659

1660
                        if (flags.HasFlag(BoundaryPathFlags.Polyline))
1,920✔
1661
                        {
720✔
1662
                                Hatch.BoundaryPath.Polyline pl = this.readPolylineBoundary();
720✔
1663
                                template.Path.Edges.Add(pl);
720✔
1664
                        }
720✔
1665
                        else
1666
                        {
1,200✔
1667
                                this._reader.ReadNext();
1,200✔
1668

1669
                                if (this._reader.Code != 93)
1,200!
1670
                                {
×
1671
                                        this._builder.Notify($"Edge Boundary path should start with code 93 but was {this._reader.Code}");
×
1672
                                        return null;
×
1673
                                }
1674

1675
                                int edges = this._reader.ValueAsInt;
1,200✔
1676
                                this._reader.ReadNext();
1,200✔
1677

1678
                                for (int i = 0; i < edges; i++)
12,000✔
1679
                                {
4,800✔
1680
                                        var edge = this.readEdge();
4,800✔
1681
                                        if (edge != null)
4,800✔
1682
                                                template.Path.Edges.Add(edge);
4,800✔
1683
                                }
4,800✔
1684
                        }
1,200✔
1685

1686
                        bool end = false;
1,920✔
1687
                        while (!end)
7,440✔
1688
                        {
5,520✔
1689
                                switch (this._reader.Code)
5,520✔
1690
                                {
1691
                                        //Number of source boundary objects
1692
                                        case 97:
1693
                                                break;
1,920✔
1694
                                        case 330:
1695
                                                template.Handles.Add(this._reader.ValueAsHandle);
1,680✔
1696
                                                break;
1,680✔
1697
                                        default:
1698
                                                end = true;
1,920✔
1699
                                                continue;
1,920✔
1700
                                }
1701

1702
                                this._reader.ReadNext();
3,600✔
1703
                        }
3,600✔
1704

1705
                        return template;
1,920✔
1706
                }
1,920✔
1707

1708
                private Hatch.BoundaryPath.Polyline readPolylineBoundary()
1709
                {
720✔
1710
                        Hatch.BoundaryPath.Polyline boundary = new Hatch.BoundaryPath.Polyline();
720✔
1711

1712
                        this._reader.ReadNext();
720✔
1713

1714
                        if (this._reader.Code != 72)
720!
1715
                        {
×
1716
                                this._builder.Notify($"Polyline Boundary path should start with code 72 but was {this._reader.Code}");
×
1717
                                return null;
×
1718
                        }
1719

1720
                        //72
1721
                        bool hasBulge = this._reader.ValueAsBool;
720✔
1722
                        this._reader.ReadNext();
720✔
1723

1724
                        //73
1725
                        bool isClosed = this._reader.ValueAsBool;
720✔
1726
                        this._reader.ReadNext();
720✔
1727

1728
                        //93
1729
                        int nvertices = this._reader.ValueAsInt;
720✔
1730
                        this._reader.ReadNext();
720✔
1731

1732
                        for (int i = 0; i < nvertices; i++)
7,200✔
1733
                        {
2,880✔
1734
                                double bulge = 0.0;
2,880✔
1735

1736
                                //10
1737
                                double x = this._reader.ValueAsDouble;
2,880✔
1738
                                this._reader.ReadNext();
2,880✔
1739
                                //20
1740
                                double y = this._reader.ValueAsDouble;
2,880✔
1741
                                this._reader.ReadNext();
2,880✔
1742

1743
                                if (hasBulge)
2,880!
1744
                                {
×
1745
                                        //42
1746
                                        bulge = this._reader.ValueAsDouble;
×
1747
                                        this._reader.ReadNext();
×
1748
                                }
×
1749

1750
                                boundary.Vertices.Add(new XYZ(x, y, bulge));
2,880✔
1751
                        }
2,880✔
1752

1753
                        return boundary;
720✔
1754
                }
720✔
1755

1756
                private Hatch.BoundaryPath.Edge readEdge()
1757
                {
4,800✔
1758
                        if (this._reader.Code != 72)
4,800!
1759
                        {
×
1760
                                this._builder.Notify($"Edge Boundary path should define the type with code 72 but was {this._reader.Code}");
×
1761
                                return null;
×
1762
                        }
1763

1764
                        Hatch.BoundaryPath.EdgeType type = (Hatch.BoundaryPath.EdgeType)this._reader.ValueAsInt;
4,800✔
1765
                        this._reader.ReadNext();
4,800✔
1766

1767
                        switch (type)
4,800!
1768
                        {
1769
                                case Hatch.BoundaryPath.EdgeType.Line:
1770
                                        Hatch.BoundaryPath.Line line = new Hatch.BoundaryPath.Line();
4,800✔
1771
                                        while (true)
24,000✔
1772
                                        {
24,000✔
1773
                                                switch (this._reader.Code)
24,000✔
1774
                                                {
1775
                                                        case 10:
1776
                                                                line.Start = new XY(this._reader.ValueAsDouble, line.Start.Y);
4,800✔
1777
                                                                break;
4,800✔
1778
                                                        case 20:
1779
                                                                line.Start = new XY(line.Start.X, this._reader.ValueAsDouble);
4,800✔
1780
                                                                break;
4,800✔
1781
                                                        case 11:
1782
                                                                line.End = new XY(this._reader.ValueAsDouble, line.End.Y);
4,800✔
1783
                                                                break;
4,800✔
1784
                                                        case 21:
1785
                                                                line.End = new XY(line.End.X, this._reader.ValueAsDouble);
4,800✔
1786
                                                                break;
4,800✔
1787
                                                        default:
1788
                                                                return line;
4,800✔
1789
                                                }
1790

1791
                                                this._reader.ReadNext();
19,200✔
1792
                                        }
19,200✔
1793
                                case Hatch.BoundaryPath.EdgeType.CircularArc:
1794
                                        Hatch.BoundaryPath.Arc arc = new Hatch.BoundaryPath.Arc();
×
1795
                                        while (true)
×
1796
                                        {
×
1797
                                                switch (this._reader.Code)
×
1798
                                                {
1799
                                                        case 10:
1800
                                                                arc.Center = new XY(this._reader.ValueAsDouble, arc.Center.Y);
×
1801
                                                                break;
×
1802
                                                        case 20:
1803
                                                                arc.Center = new XY(arc.Center.X, this._reader.ValueAsDouble);
×
1804
                                                                break;
×
1805
                                                        case 40:
1806
                                                                arc.Radius = this._reader.ValueAsDouble;
×
1807
                                                                break;
×
1808
                                                        case 50:
1809
                                                                arc.StartAngle = this._reader.ValueAsDouble;
×
1810
                                                                break;
×
1811
                                                        case 51:
1812
                                                                arc.EndAngle = this._reader.ValueAsDouble;
×
1813
                                                                break;
×
1814
                                                        case 73:
1815
                                                                arc.CounterClockWise = this._reader.ValueAsBool;
×
1816
                                                                break;
×
1817
                                                        default:
1818
                                                                return arc;
×
1819
                                                }
1820

1821
                                                this._reader.ReadNext();
×
1822
                                        }
×
1823
                                case Hatch.BoundaryPath.EdgeType.EllipticArc:
1824
                                        Hatch.BoundaryPath.Ellipse ellipse = new Hatch.BoundaryPath.Ellipse();
×
1825
                                        while (true)
×
1826
                                        {
×
1827
                                                switch (this._reader.Code)
×
1828
                                                {
1829
                                                        case 10:
1830
                                                                ellipse.Center = new XY(this._reader.ValueAsDouble, ellipse.Center.Y);
×
1831
                                                                break;
×
1832
                                                        case 20:
1833
                                                                ellipse.Center = new XY(ellipse.Center.X, this._reader.ValueAsDouble);
×
1834
                                                                break;
×
1835
                                                        case 11:
1836
                                                                ellipse.MajorAxisEndPoint = new XY(this._reader.ValueAsDouble, ellipse.Center.Y);
×
1837
                                                                break;
×
1838
                                                        case 21:
1839
                                                                ellipse.MajorAxisEndPoint = new XY(ellipse.Center.X, this._reader.ValueAsDouble);
×
1840
                                                                break;
×
1841
                                                        case 40:
1842
                                                                ellipse.MinorToMajorRatio = this._reader.ValueAsDouble;
×
1843
                                                                break;
×
1844
                                                        case 50:
1845
                                                                ellipse.StartAngle = this._reader.ValueAsDouble;
×
1846
                                                                break;
×
1847
                                                        case 51:
1848
                                                                ellipse.EndAngle = this._reader.ValueAsDouble;
×
1849
                                                                break;
×
1850
                                                        case 73:
1851
                                                                ellipse.CounterClockWise = this._reader.ValueAsBool;
×
1852
                                                                break;
×
1853
                                                        default:
1854
                                                                return ellipse;
×
1855
                                                }
1856

1857
                                                this._reader.ReadNext();
×
1858
                                        }
×
1859
                                case Hatch.BoundaryPath.EdgeType.Spline:
1860
                                        Hatch.BoundaryPath.Spline spline = new Hatch.BoundaryPath.Spline();
×
1861
                                        int nKnots = 0;
×
1862
                                        int nCtrlPoints = 0;
×
1863
                                        int nFitPoints = 0;
×
1864

1865
                                        XYZ controlPoint = new XYZ();
×
1866
                                        XY fitPoint = new XY();
×
1867

1868
                                        while (true)
×
1869
                                        {
×
1870
                                                switch (this._reader.Code)
×
1871
                                                {
1872
                                                        case 10:
1873
                                                                controlPoint = new XYZ(this._reader.ValueAsDouble, 0, 1);
×
1874
                                                                break;
×
1875
                                                        case 20:
1876
                                                                controlPoint = new XYZ(controlPoint.X, this._reader.ValueAsDouble, controlPoint.Z);
×
1877
                                                                spline.ControlPoints.Add(controlPoint);
×
1878
                                                                break;
×
1879
                                                        case 11:
1880
                                                                fitPoint = new XY(this._reader.ValueAsDouble, 0);
×
1881
                                                                break;
×
1882
                                                        case 21:
1883
                                                                fitPoint = new XY(fitPoint.X, this._reader.ValueAsDouble);
×
1884
                                                                spline.FitPoints.Add(fitPoint);
×
1885
                                                                break;
×
1886
                                                        case 42:
1887
                                                                var last = spline.ControlPoints[spline.ControlPoints.Count - 1];
×
1888
                                                                spline.ControlPoints[spline.ControlPoints.Count - 1] = new XYZ(last.X, last.Y, this._reader.ValueAsDouble);
×
1889
                                                                break;
×
1890
                                                        case 12:
1891
                                                                spline.StartTangent = new XY(this._reader.ValueAsDouble, spline.StartTangent.Y);
×
1892
                                                                break;
×
1893
                                                        case 22:
1894
                                                                spline.StartTangent = new XY(spline.StartTangent.X, this._reader.ValueAsDouble);
×
1895
                                                                break;
×
1896
                                                        case 13:
1897
                                                                spline.EndTangent = new XY(this._reader.ValueAsDouble, spline.EndTangent.Y);
×
1898
                                                                break;
×
1899
                                                        case 23:
1900
                                                                spline.EndTangent = new XY(spline.EndTangent.X, this._reader.ValueAsDouble);
×
1901
                                                                break;
×
1902
                                                        case 94:
1903
                                                                spline.Degree = this._reader.ValueAsInt;
×
1904
                                                                break;
×
1905
                                                        case 73:
1906
                                                                spline.Rational = this._reader.ValueAsBool;
×
1907
                                                                break;
×
1908
                                                        case 74:
1909
                                                                spline.Periodic = this._reader.ValueAsBool;
×
1910
                                                                break;
×
1911
                                                        case 95:
1912
                                                                nKnots = this._reader.ValueAsInt;
×
1913
                                                                break;
×
1914
                                                        case 96:
1915
                                                                nCtrlPoints = this._reader.ValueAsInt;
×
1916
                                                                break;
×
1917
                                                        case 97:
1918
                                                                nFitPoints = this._reader.ValueAsInt;
×
1919
                                                                break;
×
1920
                                                        case 40:
1921
                                                                spline.Knots.Add(this._reader.ValueAsDouble);
×
1922
                                                                break;
×
1923
                                                        default:
1924
                                                                return spline;
×
1925
                                                }
1926

1927
                                                this._reader.ReadNext();
×
1928
                                        }
×
1929
                        }
1930

1931
                        return null;
×
1932
                }
4,800✔
1933

1934
                private void readDefinedGroups(CadTemplate template)
1935
                {
67,854✔
1936
                        this.readDefinedGroups(out ulong? xdict, out HashSet<ulong> reactorsHandles);
67,854✔
1937

1938
                        template.XDictHandle = xdict;
67,854✔
1939
                        template.ReactorsHandles.UnionWith(reactorsHandles);
67,854✔
1940
                }
67,854✔
1941

1942
                private void readDefinedGroups(out ulong? xdictHandle, out HashSet<ulong> reactors)
1943
                {
68,096✔
1944
                        xdictHandle = null;
68,096✔
1945
                        reactors = new HashSet<ulong>();
68,096✔
1946

1947
                        switch (this._reader.ValueAsString)
68,096✔
1948
                        {
1949
                                case DxfFileToken.DictionaryToken:
1950
                                        this._reader.ReadNext();
12,845✔
1951
                                        xdictHandle = this._reader.ValueAsHandle;
12,845✔
1952
                                        this._reader.ReadNext();
12,845✔
1953
                                        Debug.Assert(this._reader.DxfCode == DxfCode.ControlString);
12,845✔
1954
                                        return;
12,845✔
1955
                                case DxfFileToken.ReactorsToken:
1956
                                        reactors = this.readReactors();
52,851✔
1957
                                        break;
52,851✔
1958
                                case DxfFileToken.BlkRefToken:
1959
                                default:
1960
                                        do
1961
                                        {
6,240✔
1962
                                                this._reader.ReadNext();
6,240✔
1963
                                        }
6,240✔
1964
                                        while (this._reader.DxfCode != DxfCode.ControlString);
6,240✔
1965
                                        return;
2,400✔
1966
                        }
1967
                }
68,096✔
1968

1969
                private HashSet<ulong> readReactors()
1970
                {
52,851✔
1971
                        HashSet<ulong> reactors = new();
52,851✔
1972

1973
                        this._reader.ReadNext();
52,851✔
1974

1975
                        while (this._reader.DxfCode != DxfCode.ControlString)
112,986✔
1976
                        {
60,135✔
1977
                                this._reader.ReadNext();
60,135✔
1978
                        }
60,135✔
1979

1980
                        return reactors;
52,851✔
1981
                }
52,851✔
1982

1983
                protected bool tryAssignCurrentValue(object cadObject, DxfClassMap map)
1984
                {
5,634,908✔
1985
                        try
1986
                        {
5,634,908✔
1987
                                //Use this method only if the value is not a link between objects
1988
                                if (map.DxfProperties.TryGetValue(this._reader.Code, out DxfProperty dxfProperty))
5,634,908✔
1989
                                {
2,516,759✔
1990
                                        if (dxfProperty.ReferenceType.HasFlag(DxfReferenceType.Count))
2,516,759✔
1991
                                        {
14,548✔
1992
                                                return true;
14,548✔
1993
                                        }
1994

1995
                                        if (dxfProperty.ReferenceType.HasFlag(DxfReferenceType.Handle)
2,502,211✔
1996
                                                || dxfProperty.ReferenceType.HasFlag(DxfReferenceType.Name))
2,502,211✔
1997
                                        {
17,370✔
1998
                                                return false;
17,370✔
1999
                                        }
2000

2001
                                        object value = this._reader.Value;
2,484,841✔
2002

2003
                                        if (dxfProperty.ReferenceType.HasFlag(DxfReferenceType.IsAngle))
2,484,841✔
2004
                                        {
17,428✔
2005
                                                value = MathHelper.DegToRad((double)value);
17,428✔
2006
                                        }
17,428✔
2007

2008
                                        dxfProperty.SetValue(this._reader.Code, cadObject, value);
2,484,841✔
2009

2010
                                        return true;
2,484,841✔
2011
                                }
2012
                        }
3,118,149✔
2013
                        catch (Exception ex)
×
2014
                        {
×
2015
                                if (!this._builder.Configuration.Failsafe)
×
2016
                                {
×
2017
                                        throw ex;
×
2018
                                }
2019
                                else
2020
                                {
×
2021
                                        this._builder.Notify("An error occurred while assigning a property using mapper", NotificationType.Error, ex);
×
2022
                                }
×
2023
                        }
×
2024

2025
                        return false;
3,118,149✔
2026
                }
5,634,908✔
2027
        }
2028
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc