-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathCollection.cs
More file actions
105 lines (89 loc) · 2.53 KB
/
Collection.cs
File metadata and controls
105 lines (89 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using ScriptEngine.Machine.Contexts;
using ScriptEngine.Machine;
using System.Collections.Generic;
namespace osf
{
public class Collection : Dictionary<string, object>
{
public ClCollection dll_obj;
public Dictionary<string, object> M_Collection;
public Collection()
{
M_Collection = new Dictionary<string, object>();
OneScriptForms.AddToHashtable(M_Collection, this);
}
public Collection(Dictionary<string, object> p1)
{
M_Collection = p1;
}
public Collection(osf.Collection p1)
{
M_Collection = p1.M_Collection;
}
public new int Count
{
get
{
int count = 0;
foreach (KeyValuePair<string, object> DictionaryEntry in M_Collection)
{
count = count + 1;
}
return count;
}
}
public new object this[string index]
{
get { return M_Collection[index]; }
}
public new System.Collections.IEnumerator GetEnumerator()
{
return M_Collection.GetEnumerator();
}
public new void Add(string key, object item)
{
M_Collection.Add(key, item);
}
public new void Remove(string index)
{
M_Collection.Remove(index);
}
}
[ContextClass("КлКоллекция", "ClCollection")]
public class ClCollection : AutoContext<ClCollection>
{
public ClCollection()
{
Collection Collection1 = new Collection();
Collection1.dll_obj = this;
Base_obj = Collection1;
}
public ClCollection(Collection p1)
{
Collection Collection1 = p1;
Collection1.dll_obj = this;
Base_obj = Collection1;
}
public Collection Base_obj;
[ContextProperty("Количество", "Count")]
public int Count
{
get { return Base_obj.Count; }
}
[ContextMethod("Добавить", "Add")]
public void Add(IValue p2, string p1)
{
Base_obj.Add(p1, p2);
}
[ContextMethod("Удалить", "Remove")]
public void Remove(string p1)
{
Base_obj.Remove(p1);
}
[ContextMethod("Элемент", "Item")]
public IValue Item(string p1)
{
return (IValue)Base_obj[p1];
}
}
}