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

DomCR / ACadSharp / 17737836230

15 Sep 2025 03:12PM UTC coverage: 2.092% (-76.2%) from 78.245%
17737836230

push

github

web-flow
Merge pull request #790 from DomCR/addflag-refactor

addflag refactor

141 of 9225 branches covered (1.53%)

Branch coverage included in aggregate %.

0 of 93 new or added lines in 10 files covered. (0.0%)

24910 existing lines in 372 files now uncovered.

724 of 32119 relevant lines covered (2.25%)

5.76 hits per line

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

0.0
/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
        {
UNCOV
10
                public DxfCode DxfCode { get; protected set; }
×
11

UNCOV
12
                public GroupCodeValueType GroupCodeValue { get; protected set; }
×
13

UNCOV
14
                public int Code { get { return (int)this.DxfCode; } }
×
15

UNCOV
16
                public object Value { get; protected set; }
×
17

UNCOV
18
                public virtual int Position { get; protected set; }
×
19

UNCOV
20
                public string ValueRaw { get; protected set; }
×
21

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

UNCOV
34
                public bool ValueAsBool { get { return Convert.ToBoolean(this.Value); } }
×
35

UNCOV
36
                public short ValueAsShort { get { return Convert.ToInt16(this.Value); } }
×
37

UNCOV
38
                public ushort ValueAsUShort { get { return Convert.ToUInt16(this.Value); } }
×
39

UNCOV
40
                public int ValueAsInt { get { return Convert.ToInt32(this.Value); } }
×
41

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

UNCOV
44
                public double ValueAsDouble { get { return Convert.ToDouble(this.Value); } }
×
45

UNCOV
46
                public double ValueAsAngle { get { return (double)(MathHelper.DegToRad(Convert.ToDouble(this.Value))); } }
×
47

UNCOV
48
                public ulong ValueAsHandle { get { return (ulong)this.Value; } }
×
49

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

52
                protected abstract Stream baseStream { get; }
53

54
                public virtual void ReadNext()
UNCOV
55
                {
×
UNCOV
56
                        this.DxfCode = this.readCode();
×
UNCOV
57
                        this.GroupCodeValue = ACadSharp.GroupCodeValue.TransformValue(this.Code);
×
UNCOV
58
                        this.Value = this.transformValue(this.GroupCodeValue);
×
UNCOV
59
                }
×
60

61
                public bool Find(string dxfEntry)
UNCOV
62
                {
×
UNCOV
63
                        this.Start();
×
64

65
                        do
UNCOV
66
                        {
×
UNCOV
67
                                this.ReadNext();
×
UNCOV
68
                        }
×
UNCOV
69
                        while (this.ValueAsString != dxfEntry && (this.ValueAsString != DxfFileToken.EndOfFile));
×
70

UNCOV
71
                        return this.ValueAsString == dxfEntry;
×
UNCOV
72
                }
×
73

74
                public void ExpectedCode(int code)
UNCOV
75
                {
×
UNCOV
76
                        this.ReadNext();
×
77

UNCOV
78
                        if (this.Code != code)
×
79
                        {
×
80
                                throw new DxfException(code, this.Position);
×
81
                        }
UNCOV
82
                }
×
83

84
                public override string ToString()
85
                {
×
86
                        return $"{Code} | {Value}";
×
87
                }
×
88

89
                public virtual void Start()
UNCOV
90
                {
×
UNCOV
91
                        this.DxfCode = DxfCode.Invalid;
×
UNCOV
92
                        this.Value = string.Empty;
×
93

UNCOV
94
                        this.baseStream.Position = 0;
×
95

UNCOV
96
                        this.Position = 0;
×
UNCOV
97
                }
×
98

99
                protected abstract DxfCode readCode();
100

101
                protected abstract string readStringLine();
102

103
                protected abstract double lineAsDouble();
104

105
                protected abstract short lineAsShort();
106

107
                protected abstract int lineAsInt();
108

109
                protected abstract long lineAsLong();
110

111
                protected abstract ulong lineAsHandle();
112

113
                protected abstract byte[] lineAsBinaryChunk();
114

115
                protected abstract bool lineAsBool();
116

117
                private object transformValue(GroupCodeValueType code)
UNCOV
118
                {
×
UNCOV
119
                        switch (code)
×
120
                        {
121
                                case GroupCodeValueType.String:
122
                                case GroupCodeValueType.Comment:
123
                                case GroupCodeValueType.ExtendedDataString:
UNCOV
124
                                        return this.readStringLine();
×
125
                                case GroupCodeValueType.Point3D:
126
                                case GroupCodeValueType.Double:
127
                                case GroupCodeValueType.ExtendedDataDouble:
UNCOV
128
                                        return this.lineAsDouble();
×
129
                                case GroupCodeValueType.Byte:
130
                                case GroupCodeValueType.Int16:
131
                                case GroupCodeValueType.ExtendedDataInt16:
UNCOV
132
                                        return this.lineAsShort();
×
133
                                case GroupCodeValueType.Int32:
134
                                case GroupCodeValueType.ExtendedDataInt32:
UNCOV
135
                                        return this.lineAsInt();
×
136
                                case GroupCodeValueType.Int64:
UNCOV
137
                                        return this.lineAsLong();
×
138
                                case GroupCodeValueType.Handle:
139
                                case GroupCodeValueType.ObjectId:
140
                                case GroupCodeValueType.ExtendedDataHandle:
UNCOV
141
                                        return this.lineAsHandle();
×
142
                                case GroupCodeValueType.Bool:
UNCOV
143
                                        return this.lineAsBool();
×
144
                                case GroupCodeValueType.Chunk:
145
                                case GroupCodeValueType.ExtendedDataChunk:
UNCOV
146
                                        return this.lineAsBinaryChunk();
×
147
                                case GroupCodeValueType.None:
148
                                default:
149
                                        throw new DxfException((int)code, this.Position);
×
150
                        }
UNCOV
151
                }
×
152
        }
153
}
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