• 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/XData/ExtendedData.cs
1
using ACadSharp.Tables;
2
using System.Collections.Generic;
3
using System.Linq;
4

5
namespace ACadSharp.XData
6
{
7
        /// <summary>
8
        /// Extended data linked to an <see cref="AppId"/>.
9
        /// </summary>
10
        public class ExtendedData
11
        {
12
                /// <summary>
13
                /// Records contained in this Extended Data instance.
14
                /// </summary>
15
                public List<ExtendedDataRecord> Records { get; } = new();   //Should be private?
×
16

17
                /// <summary>
18
                /// Default constructor.
19
                /// </summary>
20
                public ExtendedData()
×
21
                {
×
22
                }
×
23

24
                /// <summary>
25
                /// Initialize an instance of <see cref="ExtendedData"/> with a collection of records.
26
                /// </summary>
27
                /// <param name="records">Records to add to the <see cref="ExtendedData"/>.</param>
28
                public ExtendedData(IEnumerable<ExtendedDataRecord> records) : this()
×
29
                {
×
30
                        this.Records.AddRange(records);
×
31
                }
×
32

33
                /// <summary>
34
                /// Make sure that the first and last record are <see cref="ExtendedDataControlString"/>.
35
                /// </summary>
36
                /// <remarks>
37
                /// The first control string must be the opening one and the last one closing.
38
                /// </remarks>
39
                public void AddControlStrings()
40
                {
×
41
                        if (!this.Records.Any())
×
42
                        {
×
43
                                this.Records.Add(ExtendedDataControlString.Open);
×
44
                                this.Records.Add(ExtendedDataControlString.Close);
×
45
                                return;
×
46
                        }
47

48
                        var first = this.Records.First();
×
49
                        if (first is not ExtendedDataControlString firstControl)
×
50
                        {
×
51
                                this.Records.Insert(0, ExtendedDataControlString.Open);
×
52
                        }
×
53
                        else if (firstControl.IsClosing)
×
54
                        {
×
55
                                this.Records.Insert(0, ExtendedDataControlString.Open);
×
56
                        }
×
57

58
                        var last = this.Records.Last();
×
59
                        if (last is not ExtendedDataControlString lastControl)
×
60
                        {
×
61
                                this.Records.Add(ExtendedDataControlString.Close);
×
62
                        }
×
63
                        else if (!lastControl.IsClosing)
×
64
                        {
×
65
                                this.Records.Add(ExtendedDataControlString.Close);
×
66
                        }
×
67
                }
×
68
        }
69
}
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