• 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/CadReaderBase.cs
1
using ACadSharp.Header;
2
using CSUtilities.IO;
3
using CSUtilities.Text;
4
using System;
5
using System.IO;
6
using System.Text;
7

8
namespace ACadSharp.IO
9
{
10
        /// <summary>
11
        /// Base class for the DWG and DXF readers.
12
        /// </summary>
13
        /// <typeparam name="T">Configuration type for the reader.</typeparam>
14
        public abstract class CadReaderBase<T> : ICadReader
15
                where T : CadReaderConfiguration, new()
16
        {
17
                /// <inheritdoc/>
18
                public event NotificationEventHandler OnNotification;
19

20
                /// <summary>
21
                /// Reader configuration.
22
                /// </summary>
UNCOV
23
                public T Configuration { get; set; } = new();
×
24

UNCOV
25
                protected CadDocument _document = new CadDocument(false);
×
26

UNCOV
27
                protected Encoding _encoding = Encoding.Default;
×
28

29
                internal readonly StreamIO _fileStream;
30

UNCOV
31
                protected CadReaderBase(NotificationEventHandler notification)
×
UNCOV
32
                {
×
UNCOV
33
                        this.OnNotification += notification;
×
UNCOV
34
                }
×
35

UNCOV
36
                protected CadReaderBase(string filename, NotificationEventHandler notification = null) : this(File.OpenRead(filename), notification)
×
UNCOV
37
                {
×
UNCOV
38
                }
×
39

UNCOV
40
                protected CadReaderBase(Stream stream, NotificationEventHandler notification = null) : this(notification)
×
UNCOV
41
                {
×
UNCOV
42
                        this._fileStream = new StreamIO(stream);
×
UNCOV
43
                }
×
44

45
                /// <inheritdoc/>
46
                public abstract CadDocument Read();
47

48
                /// <inheritdoc/>
49
                public abstract CadHeader ReadHeader();
50

51
                /// <inheritdoc/>
52
                public virtual void Dispose()
UNCOV
53
                {
×
UNCOV
54
                        this._fileStream.Dispose();
×
UNCOV
55
                }
×
56

57
                protected Encoding getListedEncoding(int code)
UNCOV
58
                {
×
59
                        try
UNCOV
60
                        {
×
61
#if !NET48
UNCOV
62
                                Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
×
63
#endif
UNCOV
64
                                return Encoding.GetEncoding(code);
×
65
                        }
66
                        catch (Exception ex)
×
67
                        {
×
68
                                this.triggerNotification($"Encoding with codee {code} not found, using Windows-1252 as default", NotificationType.Warning, ex);
×
69
                        }
×
70

71
                        return TextEncoding.Windows1252();
×
UNCOV
72
                }
×
73

74
                protected void triggerNotification(string message, NotificationType notificationType, Exception ex = null)
UNCOV
75
                {
×
UNCOV
76
                        this.onNotificationEvent(null, new NotificationEventArgs(message, notificationType, ex));
×
UNCOV
77
                }
×
78

79
                protected void onNotificationEvent(object sender, NotificationEventArgs e)
UNCOV
80
                {
×
UNCOV
81
                        this.OnNotification?.Invoke(this, e);
×
UNCOV
82
                }
×
83
        }
84
}
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