-
Notifications
You must be signed in to change notification settings - Fork 8
/
PerfChart.cs
371 lines (346 loc) · 10.3 KB
/
PerfChart.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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
public class PerfChart : UserControl
{
private const int int_0 = 0x200;
private const int int_1 = 8;
private int int_2;
private int int_3 = 4;
private decimal decimal_0;
private decimal decimal_1;
private int int_4;
private decimal decimal_2;
private Border3DStyle border3DStyle_0 = Border3DStyle.Flat;
private GEnum0 genum0_0;
private GEnum1 genum1_0;
private List<decimal> list_0 = new List<decimal>(0x200);
private Queue<decimal> queue_0 = new Queue<decimal>();
private GClass3 gclass3_0;
private IContainer icontainer_0;
private Timer timer_0;
public PerfChart()
{
this.InitializeComponent();
this.gclass3_0 = new GClass3();
base.SetStyle(ControlStyles.UserPaint, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
base.SetStyle(ControlStyles.ResizeRedraw, true);
this.Font = SystemInformation.MenuFont;
}
private void InitializeComponent()
{
this.icontainer_0 = new Container();
this.timer_0 = new Timer(this.icontainer_0);
base.SuspendLayout();
this.timer_0.Tick += new EventHandler(this.timer_0_Tick);
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.Name = "PerfChart";
base.Size = new Size(0xeb, 0x57);
base.ResumeLayout(false);
}
public void method_0()
{
this.list_0.Clear();
base.Invalidate();
}
public void method_1(decimal decimal_3)
{
if ((this.genum0_0 == GEnum0.Absolute) && (decimal_3 > 100M))
{
throw new Exception($"Values greater then 100 not allowed in ScaleMode: Absolute ({decimal_3})");
}
GEnum1 enum2 = this.genum1_0;
if (enum2 == GEnum1.Disabled)
{
this.method_3(decimal_3);
base.Invalidate();
}
else
{
if ((enum2 - 1) > GEnum1.SynchronizedAverage)
{
throw new Exception($"Unsupported TimerMode: {this.genum1_0}");
}
this.method_2(decimal_3);
}
}
private void method_10(Graphics graphics_0)
{
Rectangle rect = new Rectangle(0, 0, base.Width, base.Height);
using (Brush brush = new LinearGradientBrush(rect, this.gclass3_0.Color_0, this.gclass3_0.Color_1, LinearGradientMode.Vertical))
{
graphics_0.FillRectangle(brush, rect);
}
if (this.gclass3_0.Boolean_0)
{
for (int i = base.Width - this.int_4; i >= 0; i -= 8)
{
graphics_0.DrawLine(this.gclass3_0.GClass4_0.Pen_0, i, 0, i, base.Height);
}
}
if (this.gclass3_0.Boolean_1)
{
for (int i = 0; i < base.Height; i += 8)
{
graphics_0.DrawLine(this.gclass3_0.GClass4_1.Pen_0, 0, i, base.Width, i);
}
}
}
private void method_11(object sender, EventArgs e)
{
base.Invalidate();
}
private void method_2(decimal decimal_3)
{
this.queue_0.Enqueue(decimal_3);
}
private void method_3(decimal decimal_3)
{
this.list_0.Insert(0, Math.Max(decimal_3, 0M));
if (this.list_0.Count > 0x200)
{
this.list_0.RemoveAt(0x200);
}
this.int_4 += this.int_3;
if (this.int_4 > 8)
{
this.int_4 = this.int_4 % 8;
}
}
private void method_4()
{
if (this.queue_0.Count <= 0)
{
this.method_3(0M);
}
else if (this.genum1_0 == GEnum1.Simple)
{
while (this.queue_0.Count > 0)
{
this.method_3(this.queue_0.Dequeue());
}
}
else if ((this.genum1_0 == GEnum1.SynchronizedAverage) || (this.genum1_0 == GEnum1.SynchronizedSum))
{
decimal num = 0M;
int count = this.queue_0.Count;
while (true)
{
if (this.queue_0.Count <= 0)
{
if (this.genum1_0 == GEnum1.SynchronizedAverage)
{
num = (decimal) (num / count);
}
if (num > 88M)
{
num = (decimal) (num - 10M);
}
if (num < 10M)
{
num = (decimal) (num + 10M);
}
this.method_3(num);
break;
}
num = (decimal) (num + this.queue_0.Dequeue());
}
}
base.Invalidate();
}
private int method_5(decimal decimal_3)
{
decimal num = 0M;
if (this.genum0_0 == GEnum0.Absolute)
{
num = (decimal) ((decimal_3 * base.Height) / 100M);
}
else if (this.genum0_0 == GEnum0.Relative)
{
num = (this.decimal_0 > 0M) ? ((decimal) ((decimal_3 * base.Height) / this.decimal_0)) : 0M;
}
return Convert.ToInt32(Math.Round((decimal) ((base.Height - num) + 6M)));
}
private decimal method_6()
{
decimal num = 0M;
for (int i = 0; i < this.int_2; i++)
{
if (this.list_0[i] > num)
{
num = this.list_0[i];
}
}
return num;
}
private decimal method_7()
{
try
{
return this.list_0[0];
}
catch
{
}
try
{
return this.list_0[1];
}
catch
{
return 0M;
}
}
private void method_8(Graphics graphics_0)
{
this.int_2 = Math.Min(base.Width / this.int_3, this.list_0.Count);
if (this.genum0_0 == GEnum0.Relative)
{
this.decimal_0 = this.method_6();
}
this.decimal_1 = this.method_7();
Point point = new Point(base.Width + this.int_3, base.Height);
Point point2 = new Point();
if ((this.int_2 > 0) && this.gclass3_0.Boolean_2)
{
this.decimal_2 = 0M;
this.method_9(graphics_0);
}
for (int i = 0; i < this.int_2; i++)
{
point2.X = point.X - this.int_3;
point2.Y = this.method_5(this.list_0[i]);
graphics_0.DrawLine(this.gclass3_0.GClass4_3.Pen_0, point, point2);
point = point2;
}
if (this.genum0_0 == GEnum0.Relative)
{
SolidBrush brush = new SolidBrush(this.gclass3_0.GClass4_3.Color_0);
string[] textArray1 = new string[] { "Max: ", this.decimal_0.ToString(), Environment.NewLine, "Current: ", this.decimal_1.ToString() };
graphics_0.DrawString(string.Concat(textArray1), this.Font, brush, (float) 4f, (float) 2f);
}
ControlPaint.DrawBorder3D(graphics_0, 0, 0, base.Width, base.Height, this.border3DStyle_0);
}
private void method_9(Graphics graphics_0)
{
for (int i = 0; i < this.int_2; i++)
{
this.decimal_2 = (decimal) (this.decimal_2 + this.list_0[i]);
}
this.decimal_2 = (decimal) (this.decimal_2 / this.int_2);
int num = this.method_5(this.decimal_2);
graphics_0.DrawLine(this.gclass3_0.GClass4_2.Pen_0, 0, num, base.Width, num);
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.icontainer_0 != null))
{
this.icontainer_0.Dispose();
}
base.Dispose(disposing);
}
protected virtual void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (this.gclass3_0.Boolean_3)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
}
this.method_10(e.Graphics);
this.method_8(e.Graphics);
}
protected virtual void OnResize(EventArgs e)
{
base.OnResize(e);
base.Invalidate();
}
private void timer_0_Tick(object sender, EventArgs e)
{
if (!base.DesignMode)
{
this.method_4();
}
}
[Description("Appearance and Style"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Category("Appearance")]
public GClass3 GClass3_0
{
get
{
return this.gclass3_0;
}
set
{
this.gclass3_0 = value;
}
}
[Description("BorderStyle"), DefaultValue(typeof(Border3DStyle), "Sunken"), Category("Appearance")]
public Border3DStyle Border3DStyle_0
{
get
{
return this.border3DStyle_0;
}
set
{
this.border3DStyle_0 = value;
base.Invalidate();
}
}
public GEnum0 GEnum0_0
{
get
{
return this.genum0_0;
}
set
{
this.genum0_0 = value;
}
}
public GEnum1 GEnum1_0
{
get
{
return this.genum1_0;
}
set
{
if (value == GEnum1.Disabled)
{
if (this.genum1_0 != GEnum1.Disabled)
{
this.genum1_0 = value;
this.timer_0.Stop();
this.method_4();
return;
}
}
else
{
this.genum1_0 = value;
this.timer_0.Start();
}
}
}
public int Int32_0
{
get
{
return this.timer_0.Interval;
}
set
{
if (value < 15)
{
throw new ArgumentOutOfRangeException("TimerInterval", value, "The Timer interval must be greater then 15");
}
this.timer_0.Interval = value;
}
}
}