Skip to content

Commit 17bc726

Browse files
committed
Разделил RCW-объекты
1 parent 58fbddf commit 17bc726

File tree

4 files changed

+46
-33
lines changed

4 files changed

+46
-33
lines changed

src/ScriptEngine/Machine/Rcw/RcwMemberMetadata.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,6 @@ This Source Code Form is subject to the terms of the
77

88
namespace ScriptEngine.Machine.Rcw
99
{
10-
public class RcwMethodMetadata : RcwMemberMetadata
11-
{
12-
public bool? IsFunction { get; }
13-
14-
public RcwMethodMetadata(string name, int dispId, bool? isFunc) : base(name, dispId)
15-
{
16-
IsFunction = isFunc;
17-
}
18-
}
19-
20-
public class RcwPropertyMetadata : RcwMemberMetadata
21-
{
22-
public bool IsReadable { get; internal set; }
23-
24-
public bool IsWritable { get; internal set; }
25-
26-
public RcwPropertyMetadata(string name, int dispId) : base(name, dispId)
27-
{
28-
IsReadable = true;
29-
IsWritable = true;
30-
}
31-
}
32-
3310
public abstract class RcwMemberMetadata
3411
{
3512
public int DispatchId { get; }

src/ScriptEngine/Machine/Rcw/RcwMembersMetadataCollection.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,16 @@ namespace ScriptEngine.Machine.Rcw
1313
{
1414
public class RcwMembersMetadataCollection<T> where T : RcwMemberMetadata
1515
{
16-
private readonly List<T> _collection;
17-
private readonly Dictionary<int, T> _dispIds;
18-
private readonly Dictionary<string, T> _names;
16+
private readonly List<T> _collection = new List<T>();
17+
private readonly Dictionary<int, T> _dispIds = new Dictionary<int, T>();
18+
private readonly Dictionary<string, T> _names = new Dictionary<string, T>(StringComparer.InvariantCultureIgnoreCase);
1919

2020
public IReadOnlyDictionary<int, T> DispatchIds => new ReadOnlyDictionary<int, T>(_dispIds);
2121

2222
public IReadOnlyDictionary<string, T> Names => new ReadOnlyDictionary<string, T>(_names);
2323

2424
public T this[int index] => _collection[index];
2525

26-
public RcwMembersMetadataCollection()
27-
{
28-
_collection = new List<T>();
29-
_dispIds = new Dictionary<int, T>();
30-
_names = new Dictionary<string, T>(StringComparer.InvariantCultureIgnoreCase);
31-
}
32-
3326
public int IndexOf(T item) => _collection.IndexOf(item);
3427

3528
public void Add(T item)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*----------------------------------------------------------
2+
This Source Code Form is subject to the terms of the
3+
Mozilla Public License, v.2.0. If a copy of the MPL
4+
was not distributed with this file, You can obtain one
5+
at http://mozilla.org/MPL/2.0/.
6+
----------------------------------------------------------*/
7+
8+
using System.Reflection;
9+
10+
namespace ScriptEngine.Machine.Rcw
11+
{
12+
public class RcwMethodMetadata : RcwMemberMetadata
13+
{
14+
public bool? IsFunction { get; }
15+
16+
public RcwMethodMetadata(string name, int dispId, bool? isFunc) : base(name, dispId)
17+
{
18+
IsFunction = isFunc;
19+
}
20+
}
21+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*----------------------------------------------------------
2+
This Source Code Form is subject to the terms of the
3+
Mozilla Public License, v.2.0. If a copy of the MPL
4+
was not distributed with this file, You can obtain one
5+
at http://mozilla.org/MPL/2.0/.
6+
----------------------------------------------------------*/
7+
8+
namespace ScriptEngine.Machine.Rcw
9+
{
10+
public class RcwPropertyMetadata : RcwMemberMetadata
11+
{
12+
public bool IsReadable { get; internal set; }
13+
14+
public bool IsWritable { get; internal set; }
15+
16+
public RcwPropertyMetadata(string name, int dispId) : base(name, dispId)
17+
{
18+
IsReadable = true;
19+
IsWritable = true;
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)