-
Notifications
You must be signed in to change notification settings - Fork 0
/
ANS.cs
executable file
·482 lines (465 loc) · 21.9 KB
/
ANS.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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace IQ180大挑戰2
{
public partial class ANS : Form
{
public ANS()
{
InitializeComponent();
}
int select;
private void xButton1_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
select = listBox1.SelectedIndex;
groupBox1.Enabled = false;
groupBox2.Enabled = true;
button3.Enabled = false;
xButton1.Enabled = false;
switch (select)
{
case 0:
groupBox4.Enabled = false;
break;
case 1:
groupBox4.Enabled = false;
break;
case 2:
groupBox4.Enabled = false;
break;
case 3:
groupBox3.Enabled = false;
break;
case 4:
groupBox3.Enabled = false;
break;
case 5:
groupBox4.Enabled = false;
break;
case 6:
groupBox4.Enabled = false;
break;
case 7:
groupBox3.Enabled = false;
break;
case 8:
groupBox3.Enabled = false;
break;
case 9:
groupBox4.Enabled = false;
break;
case 10:
groupBox4.Enabled = false;
break;
case 11:
groupBox4.Enabled = false;
break;
case 12:
groupBox4.Enabled = false;
break;
case 13:
groupBox4.Enabled = false;
break;
case 14:
groupBox4.Enabled = false;
break;
case 15:
groupBox4.Enabled = false;
break;
}
}
private void button2_Click(object sender, EventArgs e)
{
if (button3.Enabled == true)
{
DialogResult a = MessageBox.Show("答案未儲存喔!要放棄儲存嗎?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (a == DialogResult.Yes)
{
richTextBox1.Text = "";
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
groupBox3.Enabled = true;
groupBox4.Enabled = true;
groupBox2.Enabled = false;
groupBox1.Enabled = true;
xButton1.Enabled = true;
}
}
else
{
richTextBox1.Text = "";
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
groupBox3.Enabled = true;
groupBox4.Enabled = true;
groupBox2.Enabled = false;
groupBox1.Enabled = true;
xButton1.Enabled = true;
}
}
private void button3_Click(object sender, EventArgs e)
{
string sel="";
if (groupBox4.Enabled == true)
{
if (radioButton1.Checked == true)
{
sel = "A";
}
if (radioButton2.Checked == true)
{
sel = "B";
}
if (radioButton3.Checked == true)
{
sel = "C";
}
if (radioButton4.Checked == true)
{
sel = "D";
}
}
#region save the ANS()
try
{
switch (select)
{
case 0:
StreamWriter sw1 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc1.dll");
sw1.Write(richTextBox1.Text);
sw1.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 1:
StreamWriter sw2 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc2.dll");
sw2.Write(richTextBox1.Text);
sw2.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 2:
StreamWriter sw3 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc3.dll");
sw3.Write(richTextBox1.Text);
sw3.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 3:
StreamWriter sw4 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc4.dll");
sw4.Write(sel);
sw4.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 4:
StreamWriter sw5 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc5.dll");
sw5.Write(sel);
sw5.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 5:
StreamWriter sw6 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc6.dll");
sw6.Write(richTextBox1.Text);
sw6.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 6:
StreamWriter sw7 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc7.dll");
sw7.Write(richTextBox1.Text);
sw7.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 7:
StreamWriter sw8 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc8.dll");
sw8.Write(sel);
sw8.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 8:
StreamWriter sw9 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc9.dll");
sw9.Write(sel);
sw9.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 9:
StreamWriter sw10 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc10.dll");
sw10.Write(richTextBox1.Text);
sw10.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 10:
StreamWriter sw11 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc11.dll");
sw11.Write(richTextBox1.Text);
sw11.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 11:
StreamWriter sw12 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc12.dll");
sw12.Write(richTextBox1.Text);
sw12.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 12:
StreamWriter sw13 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc13.dll");
sw13.Write(richTextBox1.Text);
sw13.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 13:
StreamWriter sw14 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc14.dll");
sw14.Write(richTextBox1.Text);
sw14.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 14:
StreamWriter sw15 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc15.dll");
sw15.Write(richTextBox1.Text);
sw15.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case 15:
StreamWriter sw16 = new StreamWriter(@"C:\Program Files\iq180_2settings\ansc16.dll");
sw16.Write(richTextBox1.Text);
sw16.Close();
MessageBox.Show("答案存好了!", "搞定", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
}
}
catch
{
MessageBox.Show("發生作答系統錯誤,請執行作答系統修復精靈!", "糟糕",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
#endregion
button3.Enabled = false;
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
button3.Enabled = true;
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
button3.Enabled = true;
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
button3.Enabled = true;
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
button3.Enabled = true;
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
button3.Enabled = true;
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
button1.Enabled = true;
}
private void ANS_Load(object sender, EventArgs e)
{
DateTime d = new DateTime(2015, 9, 9);
DateTime ddd = DateTime.Now;
DirectoryInfo dd = new DirectoryInfo(@"c:\Program Files\iq180_2settings\iq180_2_excctenaled\");
if (dd.Exists == true) { panel1.Visible = true; }
else if (ddd > d) { panel2.Visible = true; }
else { button1.Enabled = false; }
}
private void xButton2_Click(object sender, EventArgs e)
{
#region streamreader file...
StreamReader sr1 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc1.dll");
StreamReader sr2 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc2.dll");
StreamReader sr3 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc3.dll");
StreamReader sr4 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc4.dll");
StreamReader sr5 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc5.dll");
StreamReader sr6 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc6.dll");
StreamReader sr7 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc7.dll");
StreamReader sr8 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc8.dll");
StreamReader sr9 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc9.dll");
StreamReader sr10 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc10.dll");
StreamReader sr11 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc11.dll");
StreamReader sr12 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc12.dll");
StreamReader sr13 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc13.dll");
StreamReader sr14 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc14.dll");
StreamReader sr15 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc15.dll");
StreamReader sr16 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc16.dll");
string[] ans= new string[16];
ans[0] = sr1.ReadToEnd();
ans[1] = sr2.ReadToEnd();
ans[2] = sr3.ReadToEnd();
ans[3] = sr4.ReadToEnd();
ans[4] = sr5.ReadToEnd();
ans[5] = sr6.ReadToEnd();
ans[6] = sr7.ReadToEnd();
ans[7] = sr8.ReadToEnd();
ans[8] = sr9.ReadToEnd();
ans[9] = sr10.ReadToEnd();
ans[10] = sr11.ReadToEnd();
ans[11] = sr12.ReadToEnd();
ans[12] = sr13.ReadToEnd();
ans[13] = sr14.ReadToEnd();
ans[14] = sr15.ReadToEnd();
ans[15] = sr16.ReadToEnd();
sr1.Close();
sr2.Close();
sr3.Close();
sr4.Close();
sr5.Close();
sr6.Close();
sr7.Close();
sr8.Close();
sr9.Close();
sr10.Close();
sr11.Close();
sr12.Close();
sr13.Close();
sr14.Close();
sr15.Close();
sr16.Close();
#endregion
bool bl=true;
for (int i = 0; i < 16; i++)
{
if ((ans[i].Trim()) == "")
{
bl = false;
}
}
if (bl == false) { MessageBox.Show("您還不能交卷!!","注意",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); }
if (bl == true)
{
MessageBox.Show("您已經可以交卷!!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
xButton3.Enabled = true;
xButton2.Enabled = false;
}
}
private void xButton3_Click(object sender, EventArgs e)
{
DialogResult a = MessageBox.Show("聽好!交卷不是想教就交!因為交了之後就無法更改答案了!你只能交一次!就像考試一樣!考卷交了,就再也拿不回來!所以我勸你期限快到時再交!(自己決定)好!要不要交?", "注意", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (a == DialogResult.Yes)
{
DialogResult b = MessageBox.Show("你確定嗎??", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (b == DialogResult.Yes)
{
StreamReader sr1 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc1.dll");
StreamReader sr2 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc2.dll");
StreamReader sr3 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc3.dll");
StreamReader sr4 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc4.dll");
StreamReader sr5 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc5.dll");
StreamReader sr6 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc6.dll");
StreamReader sr7 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc7.dll");
StreamReader sr8 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc8.dll");
StreamReader sr9 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc9.dll");
StreamReader sr10 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc10.dll");
StreamReader sr11 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc11.dll");
StreamReader sr12 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc12.dll");
StreamReader sr13 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc13.dll");
StreamReader sr14 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc14.dll");
StreamReader sr15 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc15.dll");
StreamReader sr16 = new StreamReader(@"C:\Program Files\iq180_2settings\ansc16.dll");
string[] ans = new string[16];
ans[0] = sr1.ReadToEnd();
ans[1] = sr2.ReadToEnd();
ans[2] = sr3.ReadToEnd();
ans[3] = sr4.ReadToEnd();
ans[4] = sr5.ReadToEnd();
ans[5] = sr6.ReadToEnd();
ans[6] = sr7.ReadToEnd();
ans[7] = sr8.ReadToEnd();
ans[8] = sr9.ReadToEnd();
ans[9] = sr10.ReadToEnd();
ans[10] = sr11.ReadToEnd();
ans[11] = sr12.ReadToEnd();
ans[12] = sr13.ReadToEnd();
ans[13] = sr14.ReadToEnd();
ans[14] = sr15.ReadToEnd();
ans[15] = sr16.ReadToEnd();
DirectoryInfo dd = new DirectoryInfo(@"c:\IQ1802ANS\");
dd.Create();
DirectoryInfo ddd = new DirectoryInfo(@"c:\Program Files\iq180_2settings\iq180_2_excctenaled\");
ddd.Create();
StreamWriter sw = new StreamWriter(@"c:\IQ1802ANS\IQ180_2活動答案卷.dll");
StreamWriter cantexx = new StreamWriter(@"c:\Program Files\iq180_2settings\iq180_2_excctenaled\excctenaled.dll");
for (int i = 0; i < 16; i++)
{
sw.Write("System{$rehorgoegrmhgwiugph98uhp,drfug,iudregjeuidrjguiepg?/reogijo/reg jei,jg 9g9ejurghu??}/:::");
sw.Write(i + 1);
cantexx.Write("System{$rehorgoegrmhgwiugph98uhp,drfug,iudregjeuidrjguiepg?/reogijo/reg jei,jg 9g9ejurghu??}/:::");
cantexx.Write(i + 1);
sw.Write(".");
cantexx.Write(".");
sw.WriteLine(ans[i]);
cantexx.WriteLine(ans[i]);
}
sw.Close();
cantexx.Close();
sr1.Close();
sr2.Close();
sr3.Close();
sr4.Close();
sr5.Close();
sr6.Close();
sr7.Close();
sr8.Close();
sr9.Close();
sr10.Close();
sr11.Close();
sr12.Close();
sr13.Close();
sr14.Close();
sr15.Close();
sr16.Close();
MessageBox.Show(@"交卷成功!位置:(C:\IQ1802ANS\IQ180_2活動答案卷.dll)", "交卷已完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
panel1.Visible = true;
}
}
}
private void xButton4_Click(object sender, EventArgs e)
{
this.Close();
}
#region 問題與解決方案
private void xButton5_Click(object sender, EventArgs e)
{
MessageBox.Show(@"它的位置:(C:\IQ1802ANS\IQ180_2活動答案卷.dll)如果真的遺失了,請嘗試[答案卷備份補發]。", "問題與解決方案", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void xButton6_Click(object sender, EventArgs e)
{
MessageBox.Show("交卷後就不能再更改答案,這是遊戲規則啊!你交卷時我也有提醒過你!這樣瞭嗎!別再問我這鬼問題!", "問題與解決方案", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void xButton7_Click(object sender, EventArgs e)
{
DialogResult a = MessageBox.Show("需要補發備份的答案卷嗎??", "問題與解決方案", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (a == DialogResult.Yes)
{
StreamReader sr = new StreamReader(@"c:\Program Files\iq180_2settings\iq180_2_excctenaled\excctenaled.dll");
string spp = sr.ReadToEnd();
DirectoryInfo dd = new DirectoryInfo(@"c:\IQ1802ANS\");
dd.Create();
StreamWriter sw = new StreamWriter(@"c:\IQ1802ANS\IQ180_2活動答案卷.dll");
sw.Write(spp);
sr.Close();
sw.Close();
MessageBox.Show(@"補發完成。它的位置:(C:\IQ1802ANS\IQ180_2活動答案卷.dll)別再搞丟了!", "問題與解決方案", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
#endregion
private void xButton11_Click(object sender, EventArgs e)
{
this.Close();
}
}
}