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

DomCR / ACadSharp / 20999928775

14 Jan 2026 03:35PM UTC coverage: 76.937% (+0.003%) from 76.934%
20999928775

Pull #951

github

web-flow
Merge 00fbb9968 into 024480147
Pull Request #951: issue-950 jump comments

7935 of 11173 branches covered (71.02%)

Branch coverage included in aggregate %.

1 of 4 new or added lines in 1 file covered. (25.0%)

1 existing line in 1 file now uncovered.

28893 of 36695 relevant lines covered (78.74%)

149714.04 hits per line

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

85.11
/src/ACadSharp/IO/DXF/DxfStreamReader/DxfStreamReaderBase.cs
1
using ACadSharp.Exceptions;
2
using CSMath;
3
using System;
4
using System.IO;
5

6
namespace ACadSharp.IO.DXF
7
{
8
        internal abstract class DxfStreamReaderBase : IDxfStreamReader
9
        {
10
                public DxfCode DxfCode { get; protected set; }
60,763,669✔
11

12
                public GroupCodeValueType GroupCodeValue { get; protected set; }
22,447,144✔
13

14
                public int Code { get { return (int)this.DxfCode; } }
83,996,589✔
15

16
                public object Value { get; protected set; }
20,071,698✔
17

18
                public virtual int Position { get; protected set; }
11,265,708✔
19

20
                public string ValueRaw { get; protected set; }
25,269,746✔
21

22
                public string ValueAsString
23
                {
24
                        get
25
                        {
2,859,669✔
26
                                return this.Value.ToString()
2,859,669✔
27
                                        .Replace("^J", "\n")
2,859,669✔
28
                                        .Replace("^M", "\r")
2,859,669✔
29
                                        .Replace("^I", "\t")
2,859,669✔
30
                                        .Replace("^ ", "^");
2,859,669✔
31
                        }
2,859,669✔
32
                }
33

34
                public bool ValueAsBool { get { return Convert.ToBoolean(this.Value); } }
194,661✔
35

36
                public short ValueAsShort { get { return Convert.ToInt16(this.Value); } }
403,707✔
37

38
                public ushort ValueAsUShort { get { return Convert.ToUInt16(this.Value); } }
41,112✔
39

40
                public int ValueAsInt { get { return Convert.ToInt32(this.Value); } }
1,395,402✔
41

42
                public long ValueAsLong { get { return Convert.ToInt64(this.Value); } }
×
43

44
                public double ValueAsDouble { get { return Convert.ToDouble(this.Value); } }
3,099,216✔
45

46
                public double ValueAsAngle { get { return (double)(MathHelper.DegToRad(Convert.ToDouble(this.Value))); } }
279,213✔
47

48
                public ulong ValueAsHandle { get { return (ulong)this.Value; } }
2,046,393✔
49

50
                public byte[] ValueAsBinaryChunk { get { return this.Value as byte[]; } }
204✔
51

52
                protected abstract Stream baseStream { get; }
53

54
                public virtual void ReadNext()
55
                {
10,033,697✔
56
                        this.DxfCode = this.readCode();
10,033,697✔
57
                        this.GroupCodeValue = ACadSharp.GroupCodeValue.TransformValue(this.Code);
10,033,697✔
58
                        this.Value = this.transformValue(this.GroupCodeValue);
10,033,697✔
59

60
                        if (this.DxfCode == DxfCode.Comment)
10,033,697!
NEW
61
                        {
×
NEW
62
                                this.ReadNext();
×
NEW
63
                        }
×
64
                }
10,033,697✔
65

66
                public bool Find(string dxfEntry)
67
                {
322✔
68
                        this.Start();
322✔
69

70
                        do
71
                        {
148,335✔
72
                                this.ReadNext();
148,335✔
73
                        }
148,335✔
74
                        while (this.ValueAsString != dxfEntry && (this.ValueAsString != DxfFileToken.EndOfFile));
148,335✔
75

76
                        return this.ValueAsString == dxfEntry;
322✔
77
                }
322✔
78

79
                public void ExpectedCode(int code)
80
                {
35,200✔
81
                        this.ReadNext();
35,200✔
82

83
                        if (this.Code != code)
35,200!
84
                        {
×
85
                                throw new DxfException(code, this.Position);
×
86
                        }
87
                }
35,200✔
88

89
                public override string ToString()
90
                {
×
91
                        return $"{Code} | {Value}";
×
92
                }
×
93

94
                public virtual void Start()
95
                {
882✔
96
                        this.DxfCode = DxfCode.Invalid;
882✔
97
                        this.Value = string.Empty;
882✔
98

99
                        this.baseStream.Position = 0;
882✔
100

101
                        this.Position = 0;
882✔
102
                }
882✔
103

104
                protected abstract DxfCode readCode();
105

106
                protected abstract string readStringLine();
107

108
                protected abstract double lineAsDouble();
109

110
                protected abstract short lineAsShort();
111

112
                protected abstract int lineAsInt();
113

114
                protected abstract long lineAsLong();
115

116
                protected abstract ulong lineAsHandle();
117

118
                protected abstract byte[] lineAsBinaryChunk();
119

120
                protected abstract bool lineAsBool();
121

122
                private object transformValue(GroupCodeValueType code)
123
                {
10,033,697✔
124
                        switch (code)
10,033,697!
125
                        {
126
                                case GroupCodeValueType.String:
127
                                case GroupCodeValueType.Comment:
128
                                case GroupCodeValueType.ExtendedDataString:
129
                                        return this.readStringLine();
2,366,764✔
130
                                case GroupCodeValueType.Point3D:
131
                                case GroupCodeValueType.Double:
132
                                case GroupCodeValueType.ExtendedDataDouble:
133
                                        return this.lineAsDouble();
2,813,764✔
134
                                case GroupCodeValueType.Byte:
135
                                case GroupCodeValueType.Int16:
136
                                case GroupCodeValueType.ExtendedDataInt16:
137
                                        return this.lineAsShort();
1,432,230✔
138
                                case GroupCodeValueType.Int32:
139
                                case GroupCodeValueType.ExtendedDataInt32:
140
                                        return this.lineAsInt();
980,344✔
141
                                case GroupCodeValueType.Int64:
142
                                        return this.lineAsLong();
2,321✔
143
                                case GroupCodeValueType.Handle:
144
                                case GroupCodeValueType.ObjectId:
145
                                case GroupCodeValueType.ExtendedDataHandle:
146
                                        return this.lineAsHandle();
774,247✔
147
                                case GroupCodeValueType.Bool:
148
                                        return this.lineAsBool();
101,231✔
149
                                case GroupCodeValueType.Chunk:
150
                                case GroupCodeValueType.ExtendedDataChunk:
151
                                        return this.lineAsBinaryChunk();
1,562,796✔
152
                                case GroupCodeValueType.None:
153
                                default:
154
                                        throw new DxfException((int)code, this.Position);
×
155
                        }
156
                }
10,033,697✔
157
        }
158
}
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