• 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/Objects/Collections/ObjectDictionaryCollection.cs
1
using System;
2
using System.Collections;
3
using System.Collections.Generic;
4
using System.Linq;
5

6
namespace ACadSharp.Objects.Collections
7
{
8
        /// <summary>
9
        /// Object collection linked to a dictionary.
10
        /// </summary>
11
        /// <typeparam name="T"></typeparam>
12
        public abstract class ObjectDictionaryCollection<T> : ICadCollection<T>, IObservableCadCollection<T>, IHandledCadObject, IEnumerable<T>
13
                where T : NonGraphicalObject
14
        {
15
                public event EventHandler<CollectionChangedEventArgs> OnAdd
16
                { add { this._dictionary.OnAdd += value; } remove { this._dictionary.OnAdd -= value; } }
×
17

18
                public event EventHandler<CollectionChangedEventArgs> OnRemove
UNCOV
19
                { add { this._dictionary.OnRemove += value; } remove { this._dictionary.OnRemove -= value; } }
×
20

21
                /// <inheritdoc/>
UNCOV
22
                public ulong Handle { get { return this._dictionary.Handle; } }
×
23

24
                protected CadDictionary _dictionary;
25

26
                /// <summary>
27
                /// Initializes a new instance of the ObjectDictionaryCollection class with the specified CAD dictionary.
28
                /// </summary>
29
                /// <param name="dictionary">The CAD dictionary that provides the underlying storage for the collection. Cannot be null.</param>
UNCOV
30
                protected ObjectDictionaryCollection(CadDictionary dictionary)
×
UNCOV
31
                {
×
UNCOV
32
                        if (dictionary == null)
×
33
                        {
×
34
                                throw new ArgumentNullException(nameof(dictionary));
×
35
                        }
36

UNCOV
37
                        this._dictionary = dictionary;
×
UNCOV
38
                }
×
39

40
                /// <summary>
41
                /// Add an entry to the collection
42
                /// </summary>
43
                /// <param name="entry"></param>
44
                public virtual void Add(T entry)
UNCOV
45
                {
×
UNCOV
46
                        this._dictionary.Add(entry);
×
UNCOV
47
                }
×
48

49
                /// <summary>
50
                /// Removes all keys and values from the <see cref="ObjectDictionaryCollection{T}"/>.
51
                /// </summary>
52
                public void Clear()
53
                {
×
54
                        this._dictionary.Clear();
×
55
                }
×
56

57
                /// <summary>
58
                /// Determines whether the <see cref="ObjectDictionaryCollection{T}"/> contains the specified key.
59
                /// </summary>
60
                /// <param name="key">The key to locate in the <see cref="ObjectDictionaryCollection{T}"/></param>
61
                /// <returns></returns>
62
                public bool ContainsKey(string key)
UNCOV
63
                {
×
UNCOV
64
                        return this._dictionary.ContainsKey(key);
×
UNCOV
65
                }
×
66

67
                /// <inheritdoc/>
68
                public IEnumerator<T> GetEnumerator()
UNCOV
69
                {
×
UNCOV
70
                        return this._dictionary.OfType<T>().GetEnumerator();
×
UNCOV
71
                }
×
72

73
                /// <inheritdoc/>
74
                IEnumerator IEnumerable.GetEnumerator()
UNCOV
75
                {
×
UNCOV
76
                        return this._dictionary.OfType<T>().GetEnumerator();
×
UNCOV
77
                }
×
78

79
                /// <summary>
80
                /// Remove an entry from the collection.
81
                /// </summary>
82
                /// <param name="name"></param>
83
                /// <returns></returns>
84
                public bool Remove(string name)
UNCOV
85
                {
×
UNCOV
86
                        return this.Remove(name, out _);
×
UNCOV
87
                }
×
88

89
                /// <summary>
90
                /// Remove an entry from the collection.
91
                /// </summary>
92
                /// <param name="name"></param>
93
                /// <param name="entry"></param>
94
                /// <returns></returns>
95
                public virtual bool Remove(string name, out T entry)
UNCOV
96
                {
×
UNCOV
97
                        bool result = this._dictionary.Remove(name, out NonGraphicalObject n);
×
UNCOV
98
                        entry = (T)n;
×
UNCOV
99
                        return result;
×
UNCOV
100
                }
×
101

102
                /// <inheritdoc/>
103
                public T TryAdd(T item)
UNCOV
104
                {
×
UNCOV
105
                        if (this.TryGet(item.Name, out T existing))
×
UNCOV
106
                        {
×
UNCOV
107
                                return existing;
×
108
                        }
109
                        else
UNCOV
110
                        {
×
UNCOV
111
                                this.Add(item);
×
UNCOV
112
                                return item;
×
113
                        }
UNCOV
114
                }
×
115

116
                /// <summary>
117
                /// Attempts to retrieve the entry associated with the specified name.
118
                /// </summary>
119
                /// <param name="name">The name of the entry to locate. Cannot be null.</param>
120
                /// <param name="entry">When this method returns, contains the entry associated with the specified name, if the name is found; otherwise,
121
                /// the default value for the type of the entry parameter. This parameter is passed uninitialized.</param>
122
                /// <returns>true if an entry with the specified name is found; otherwise, false.</returns>
123
                public bool TryGet(string name, out T entry)
UNCOV
124
                {
×
UNCOV
125
                        return this._dictionary.TryGetEntry(name, out entry);
×
UNCOV
126
                }
×
127

UNCOV
128
                public T this[string key] { get { return (T)this._dictionary[key]; } }
×
129
        }
130
}
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