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

DomCR / ACadSharp / 12905761471

22 Jan 2025 10:03AM UTC coverage: 2.0% (-74.0%) from 75.963%
12905761471

push

github

DomCR
version 1.0.6

104 of 7676 branches covered (1.35%)

Branch coverage included in aggregate %.

590 of 27024 relevant lines covered (2.18%)

5.13 hits per line

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

0.0
/src/ACadSharp/IO/DXF/DxfStreamReader/DxfBinaryReader.cs
1
using System.Collections.Generic;
2
using System.Globalization;
3
using System.IO;
4
using System.Text;
5

6
namespace ACadSharp.IO.DXF
7
{
8
        internal class DxfBinaryReader : DxfStreamReaderBase
9
        {
10
                public const string Sentinel = "AutoCAD Binary DXF\r\n\u001a\0";
11

12
                public override int Position { get { return (int)this.baseStream.Position; } }
×
13

14
                protected override Stream baseStream { get { return this._stream.BaseStream; } }
×
15

16
                protected BinaryReader _stream;
17

18
                private Encoding _encoding;
19

20
                public DxfBinaryReader(Stream stream) : this(stream, Encoding.ASCII) { }
×
21

22
                public DxfBinaryReader(Stream stream, Encoding encoding)
×
23
                {
×
24
                        this._encoding = encoding;
×
25
                        this._stream = new BinaryReader(stream, this._encoding);
×
26

27
                        this.Start();
×
28
                }
×
29

30
                public override void Start()
31
                {
×
32
                        base.Start();
×
33

34
                        byte[] sentinel = this._stream.ReadBytes(22);
×
35
                        //AutoCAD Binary DXF\r\n\u001a\0
36
                        string s = Encoding.ASCII.GetString(sentinel);
×
37
                }
×
38

39
                protected override string readStringLine()
40
                {
×
41
                        byte b = this._stream.ReadByte();
×
42
                        List<byte> bytes = new List<byte>();
×
43

44
                        while (b != 0)
×
45
                        {
×
46
                                bytes.Add(b);
×
47
                                b = this._stream.ReadByte();
×
48
                        }
×
49

50
                        this.ValueRaw = this._encoding.GetString(bytes.ToArray(), 0, bytes.Count);
×
51
                        return this.ValueRaw;
×
52
                }
×
53

54
                protected override DxfCode readCode()
55
                {
×
56
                        return (DxfCode)this._stream.ReadInt16();
×
57
                }
×
58

59
                protected override bool lineAsBool()
60
                {
×
61
                        return this._stream.ReadByte() > 0;
×
62
                }
×
63

64
                protected override double lineAsDouble()
65
                {
×
66
                        return this._stream.ReadDouble();
×
67
                }
×
68

69
                protected override short lineAsShort()
70
                {
×
71
                        return this._stream.ReadInt16();
×
72
                }
×
73

74
                protected override int lineAsInt()
75
                {
×
76
                        return this._stream.ReadInt32();
×
77
                }
×
78

79
                protected override long lineAsLong()
80
                {
×
81
                        return this._stream.ReadInt64();
×
82
                }
×
83

84
                protected override ulong lineAsHandle()
85
                {
×
86
                        var str = this.readStringLine();
×
87

88
                        if (ulong.TryParse(str, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out ulong result))
×
89
                        {
×
90
                                return result;
×
91
                        }
92

93
                        return 0;
×
94
                }
×
95

96
                protected override byte[] lineAsBinaryChunk()
97
                {
×
98
                        byte length = this._stream.ReadByte();
×
99
                        return this._stream.ReadBytes(length);
×
100
                }
×
101
        }
102
}
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