/
HiddenLayersConfig.cs
286 lines (273 loc) · 8.92 KB
/
HiddenLayersConfig.cs
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
namespace Nsim
{
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Xml.Linq;
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
public class HiddenLayersConfig : UserControl, IConfigurable, System.Windows.Markup.IComponentConnector, IHiddenLayers
{
private bool _x7dc3d9d322900926;
public static readonly DependencyProperty CountProperty = DependencyProperty.Register("Count", typeof(int), typeof(HiddenLayersConfig), new UIPropertyMetadata(0, new PropertyChangedCallback(HiddenLayersConfig.xcecac585893337d9)));
internal ActivationConfig edtActivation;
internal ListBox layersList;
public HiddenLayersConfig()
{
this.InitializeComponent();
}
[DebuggerNonUserCode]
internal Delegate _x11287467a5422d1c(Type x127370c996b87499, string xa1b13fd4a6c07a01)
{
return Delegate.CreateDelegate(x127370c996b87499, this, xa1b13fd4a6c07a01);
}
private void EdtActivationFunctionChanged(object sender, ActivationChangedEventArgs e)
{
using (IEnumerator<LayerConfig> enumerator = this.layersList.Items.OfType<LayerConfig>().GetEnumerator())
{
LayerConfig config;
goto Label_003D;
Label_001A:
config = enumerator.Current;
config.ActivationFunction.Xml = e.ActivationFunction.Xml;
if (0 != 0)
{
goto Label_001A;
}
Label_003D:
if (enumerator.MoveNext())
{
goto Label_001A;
}
}
}
[DebuggerNonUserCode]
public void InitializeComponent()
{
bool flag = !this._x7dc3d9d322900926;
while (flag)
{
this._x7dc3d9d322900926 = true;
Uri resourceLocator = new Uri("/Nsim4;component/components/structure/layer/hiddenlayersconfig.xaml", UriKind.Relative);
Application.LoadComponent(this, resourceLocator);
if (0 == 0)
{
break;
}
}
}
[EditorBrowsable(EditorBrowsableState.Never), DebuggerNonUserCode]
private void x628e6c716ec340be(int xf3efd21c486a5cce, object x11d58b056c032b03)
{
int num = xf3efd21c486a5cce;
if (((uint) num) >= 0)
{
switch (num)
{
case 1:
goto Label_0015;
case 2:
goto Label_0023;
}
if ((((uint) xf3efd21c486a5cce) + ((uint) xf3efd21c486a5cce)) >= 0)
{
this._x7dc3d9d322900926 = true;
return;
}
goto Label_0023;
}
Label_0015:
this.edtActivation = (ActivationConfig) x11d58b056c032b03;
return;
Label_0023:
this.layersList = (ListBox) x11d58b056c032b03;
}
private static void xcecac585893337d9(DependencyObject x73f821c71fe1e676, DependencyPropertyChangedEventArgs xfbf34718e704c6bc)
{
int num;
bool flag;
HiddenLayersConfig config = x73f821c71fe1e676 as HiddenLayersConfig;
if ((((uint) num) & 0) == 0)
{
goto Label_0170;
}
goto Label_00E8;
Label_002D:
App.Services.FairEvent<xa443afcc736e1f3e>(new xa443afcc736e1f3e());
if (-1 != 0)
{
return;
}
goto Label_0170;
Label_009F:
flag = num >= config.layersList.Items.Count;
if (((((uint) num) - ((uint) flag)) <= uint.MaxValue) && flag)
{
goto Label_002D;
}
int count = config.layersList.Items.Count;
Label_0067:
flag = count > num;
if (((uint) num) > uint.MaxValue)
{
goto Label_011E;
}
if (flag)
{
config.layersList.Items.RemoveAt(config.layersList.Items.Count - 1);
count--;
goto Label_0067;
}
goto Label_002D;
Label_00E8:
if (!flag)
{
goto Label_0134;
}
if (((uint) num) < 0)
{
goto Label_002D;
}
goto Label_009F;
Label_011E:
if (count < num)
{
LayerConfig newItem = new LayerConfig {
ActivationFunction = { Xml = config.ActivationFunction.Xml }
};
config.layersList.Items.Add(newItem);
count++;
if ((((uint) num) | 0x7fffffff) != 0)
{
goto Label_011E;
}
goto Label_0170;
}
goto Label_009F;
Label_0134:
count = config.layersList.Items.Count;
goto Label_011E;
Label_0170:
num = (int) xfbf34718e704c6bc.NewValue;
flag = num <= config.layersList.Items.Count;
if (0 != 0)
{
goto Label_0134;
}
goto Label_00E8;
}
public IActivationStruct ActivationFunction
{
get
{
return this.edtActivation;
}
}
public int Count
{
get
{
return (int) base.GetValue(CountProperty);
}
set
{
base.SetValue(CountProperty, value);
}
}
public IEnumerable<ILayerStruct> Layers
{
get
{
return this.layersList.Items.OfType<ILayerStruct>();
}
}
public XElement Xml
{
get
{
XElement element = new XElement("HiddenLayers");
element.Add(this.ActivationFunction.Xml);
IEnumerator enumerator = ((IEnumerable) this.layersList.Items).GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ILayerStruct current = (ILayerStruct) enumerator.Current;
do
{
element.Add(current.Xml);
}
while (15 == 0);
}
}
finally
{
bool flag;
IDisposable disposable = enumerator as IDisposable;
goto Label_007A;
Label_0071:
if (15 != 0)
{
}
goto Label_0093;
Label_007A:
flag = disposable == null;
while (!flag)
{
disposable.Dispose();
goto Label_0093;
}
goto Label_0071;
Label_0093:;
}
return element;
}
set
{
bool flag = !(value.Name.LocalName != "HiddenLayers");
do
{
if (!flag)
{
throw new ArgumentException();
}
break;
}
while (-2 == 0);
this.ActivationFunction.Xml = value.Element("ActivationFunction");
this.layersList.Items.Clear();
IEnumerator<XElement> enumerator = value.Elements("Layer").GetEnumerator();
try
{
while (enumerator.MoveNext())
{
XElement current = enumerator.Current;
LayerConfig newItem = new LayerConfig {
Xml = current
};
this.layersList.Items.Add(newItem);
if (2 != 0)
{
}
}
}
finally
{
flag = enumerator == null;
while (!flag)
{
enumerator.Dispose();
break;
}
}
this.Count = this.layersList.Items.Count;
}
}
}
}