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

DomCR / ACadSharp / 29143042407

11 Jul 2026 06:34AM UTC coverage: 2.912% (-73.0%) from 75.918%
29143042407

push

github

web-flow
Merge pull request #1146 from ilCosmico/acds-read-payload-anchor

Read the AcDs payload area offset from the data segment header

264 of 12999 branches covered (2.03%)

Branch coverage included in aggregate %.

0 of 30 new or added lines in 1 file covered. (0.0%)

31243 existing lines in 465 files now uncovered.

1337 of 41984 relevant lines covered (3.18%)

5.38 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

UNCOV
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);
×
59

UNCOV
60
                        if (this.DxfCode == DxfCode.Comment)
×
61
                        {
×
62
                                this.ReadNext();
×
63
                        }
×
UNCOV
64
                }
×
65

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

70
                        do
UNCOV
71
                        {
×
UNCOV
72
                                this.ReadNext();
×
UNCOV
73
                        }
×
UNCOV
74
                        while (this.ValueAsString != dxfEntry && (this.ValueAsString != DxfFileToken.EndOfFile));
×
75

UNCOV
76
                        return this.ValueAsString == dxfEntry;
×
UNCOV
77
                }
×
78

79
                public void ExpectedCode(int code)
UNCOV
80
                {
×
UNCOV
81
                        this.ReadNext();
×
82

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

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

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

UNCOV
99
                        this.baseStream.Position = 0;
×
100

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