Index: trunk/tools/wmib/Config.cs |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | /// <param name="b">Value</param> |
62 | 62 | private void AddConfig(string a, string b) |
63 | 63 | { |
64 | | - conf = conf + "\n" + a + "=" + b + ";"; |
| 64 | + conf += "\n" + a + "=" + b + ";"; |
65 | 65 | } |
66 | 66 | |
67 | 67 | /// <summary> |
Index: trunk/tools/wmib/Core.cs |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | using System.Collections.Generic; |
14 | 14 | using System.IO; |
15 | 15 | using System.Text.RegularExpressions; |
| 16 | +using System.Threading; |
16 | 17 | |
17 | 18 | namespace wmib |
18 | 19 | { |
— | — | @@ -37,8 +38,8 @@ |
38 | 39 | public class irc |
39 | 40 | { |
40 | 41 | private static System.Net.Sockets.NetworkStream data; |
41 | | - public static System.Threading.Thread dumphtmt; |
42 | | - public static System.Threading.Thread check_thread; |
| 42 | + public static Thread dumphtmt; |
| 43 | + public static Thread check_thread; |
43 | 44 | public static StreamReader rd; |
44 | 45 | private static StreamWriter wd; |
45 | 46 | private static List<user> User = new List<user>(); |
— | — | @@ -96,14 +97,14 @@ |
97 | 98 | |
98 | 99 | public int IsMatch() |
99 | 100 | { |
100 | | - System.Threading.Thread quick = new System.Threading.Thread(Run); |
| 101 | + Thread quick = new Thread(Run); |
101 | 102 | searching = true; |
102 | 103 | quick.Start(); |
103 | 104 | int check = 0; |
104 | 105 | while (searching) |
105 | 106 | { |
106 | 107 | check++; |
107 | | - System.Threading.Thread.Sleep(10); |
| 108 | + Thread.Sleep(10); |
108 | 109 | if (check <= 50) continue; |
109 | 110 | quick.Abort(); |
110 | 111 | return 2; |
— | — | @@ -707,13 +708,13 @@ |
708 | 709 | } |
709 | 710 | search_key = key.Substring(11); |
710 | 711 | running = true; |
711 | | - System.Threading.Thread th = new System.Threading.Thread(StartSearch); |
| 712 | + Thread th = new Thread(StartSearch); |
712 | 713 | th.Start(); |
713 | 714 | int check = 1; |
714 | 715 | while (running) |
715 | 716 | { |
716 | 717 | check++; |
717 | | - System.Threading.Thread.Sleep(10); |
| 718 | + Thread.Sleep(10); |
718 | 719 | if (check > 80) |
719 | 720 | { |
720 | 721 | th.Abort(); |
— | — | @@ -764,7 +765,7 @@ |
765 | 766 | { |
766 | 767 | while (locked) |
767 | 768 | { |
768 | | - System.Threading.Thread.Sleep(200); |
| 769 | + Thread.Sleep(200); |
769 | 770 | } |
770 | 771 | try |
771 | 772 | { |
— | — | @@ -811,7 +812,7 @@ |
812 | 813 | { |
813 | 814 | while (locked) |
814 | 815 | { |
815 | | - System.Threading.Thread.Sleep(200); |
| 816 | + Thread.Sleep(200); |
816 | 817 | } |
817 | 818 | foreach (item keys in text) |
818 | 819 | { |
— | — | @@ -834,7 +835,7 @@ |
835 | 836 | { |
836 | 837 | while (true) |
837 | 838 | { |
838 | | - System.Threading.Thread.Sleep(20000); |
| 839 | + Thread.Sleep(20000); |
839 | 840 | wd.WriteLine("PING :" + config.network); |
840 | 841 | wd.Flush(); |
841 | 842 | } |
— | — | @@ -860,7 +861,7 @@ |
861 | 862 | { |
862 | 863 | wd.WriteLine("PRIVMSG nickserv :identify " + config.login + " " + config.password); |
863 | 864 | wd.Flush(); |
864 | | - System.Threading.Thread.Sleep(4000); |
| 865 | + Thread.Sleep(4000); |
865 | 866 | } |
866 | 867 | return true; |
867 | 868 | } |
— | — | @@ -1024,15 +1025,15 @@ |
1025 | 1026 | string log; |
1026 | 1027 | if (!noac) |
1027 | 1028 | { |
1028 | | - log = "[" + timedateToString(System.DateTime.Now.Hour) + ":" + |
1029 | | - timedateToString(System.DateTime.Now.Minute) + ":" + |
1030 | | - timedateToString(System.DateTime.Now.Second) + "] * " + user + " " + message + "\n"; |
| 1029 | + log = "[" + timedateToString(DateTime.Now.Hour) + ":" + |
| 1030 | + timedateToString(DateTime.Now.Minute) + ":" + |
| 1031 | + timedateToString(DateTime.Now.Second) + "] * " + user + " " + message + "\n"; |
1031 | 1032 | } |
1032 | 1033 | else |
1033 | 1034 | { |
1034 | | - log = "[" + timedateToString(System.DateTime.Now.Hour) + ":" + |
1035 | | - timedateToString(System.DateTime.Now.Minute) + ":" + |
1036 | | - timedateToString(System.DateTime.Now.Second) + "] " + "<" + user + ">\t " + message + "\n"; |
| 1035 | + log = "[" + timedateToString(DateTime.Now.Hour) + ":" + |
| 1036 | + timedateToString(DateTime.Now.Minute) + ":" + |
| 1037 | + timedateToString(DateTime.Now.Second) + "] " + "<" + user + ">\t " + message + "\n"; |
1037 | 1038 | } |
1038 | 1039 | File.AppendAllText( |
1039 | 1040 | channel.log + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + ".txt", log); |
— | — | @@ -1060,6 +1061,11 @@ |
1061 | 1062 | return false; |
1062 | 1063 | } |
1063 | 1064 | |
| 1065 | + /// <summary> |
| 1066 | + /// |
| 1067 | + /// </summary> |
| 1068 | + /// <param name="name"></param> |
| 1069 | + /// <returns></returns> |
1064 | 1070 | public static bool validFile(string name) |
1065 | 1071 | { |
1066 | 1072 | return |
— | — | @@ -1109,7 +1115,7 @@ |
1110 | 1116 | config.Save(); |
1111 | 1117 | wd.WriteLine("JOIN " + channel); |
1112 | 1118 | wd.Flush(); |
1113 | | - System.Threading.Thread.Sleep(100); |
| 1119 | + Thread.Sleep(100); |
1114 | 1120 | config.channel Chan = getChannel(channel); |
1115 | 1121 | Chan.Users.addUser("admin", IRCTrust.normalize(user) + "!.*@" + host); |
1116 | 1122 | } |
— | — | @@ -1135,7 +1141,7 @@ |
1136 | 1142 | if (chan.Users.isApproved(user, host, "admin")) |
1137 | 1143 | { |
1138 | 1144 | wd.WriteLine("PART " + chan.name); |
1139 | | - System.Threading.Thread.Sleep(100); |
| 1145 | + Thread.Sleep(100); |
1140 | 1146 | wd.Flush(); |
1141 | 1147 | if (!Directory.Exists(chan.log)) |
1142 | 1148 | { |
— | — | @@ -1155,7 +1161,7 @@ |
1156 | 1162 | if (chan.Users.isApproved(user, host, "admin")) |
1157 | 1163 | { |
1158 | 1164 | wd.WriteLine("PART " + chan.name); |
1159 | | - System.Threading.Thread.Sleep(100); |
| 1165 | + Thread.Sleep(100); |
1160 | 1166 | wd.Flush(); |
1161 | 1167 | config.channels.Remove(chan); |
1162 | 1168 | config.Save(); |
— | — | @@ -1345,7 +1351,7 @@ |
1346 | 1352 | Authenticate(); |
1347 | 1353 | foreach (config.channel ch in config.channels) |
1348 | 1354 | { |
1349 | | - System.Threading.Thread.Sleep(2000); |
| 1355 | + Thread.Sleep(2000); |
1350 | 1356 | wd.WriteLine("JOIN " + ch.name); |
1351 | 1357 | } |
1352 | 1358 | wd.Flush(); |
— | — | @@ -1362,15 +1368,15 @@ |
1363 | 1369 | rd = new StreamReader(data, System.Text.Encoding.UTF8); |
1364 | 1370 | wd = new StreamWriter(data); |
1365 | 1371 | |
1366 | | - dumphtmt = new System.Threading.Thread(HtmlDump.Start); |
| 1372 | + dumphtmt = new Thread(HtmlDump.Start); |
1367 | 1373 | dumphtmt.Start(); |
1368 | | - check_thread = new System.Threading.Thread(Ping); |
| 1374 | + check_thread = new Thread(Ping); |
1369 | 1375 | check_thread.Start(); |
1370 | 1376 | |
1371 | 1377 | wd.WriteLine("USER " + config.name + " 8 * :" + config.name); |
1372 | 1378 | wd.WriteLine("NICK " + config.username); |
1373 | 1379 | |
1374 | | - System.Threading.Thread.Sleep(2000); |
| 1380 | + Thread.Sleep(2000); |
1375 | 1381 | |
1376 | 1382 | Authenticate(); |
1377 | 1383 | |
— | — | @@ -1379,14 +1385,14 @@ |
1380 | 1386 | if (ch.name != "") |
1381 | 1387 | { |
1382 | 1388 | wd.WriteLine("JOIN " + ch.name); |
1383 | | - System.Threading.Thread.Sleep(2000); |
| 1389 | + Thread.Sleep(2000); |
1384 | 1390 | } |
1385 | 1391 | } |
1386 | 1392 | wd.Flush(); |
1387 | 1393 | string nick = ""; |
1388 | 1394 | string host = ""; |
1389 | 1395 | string channel = ""; |
1390 | | - char delimiter = (char) 001; |
| 1396 | + const char delimiter = (char) 001; |
1391 | 1397 | |
1392 | 1398 | while (true) |
1393 | 1399 | { |
— | — | @@ -1403,7 +1409,6 @@ |
1404 | 1410 | if (text.Contains("PRIVMSG")) |
1405 | 1411 | { |
1406 | 1412 | string info = text.Substring(1, text.IndexOf(" :", 1) - 1); |
1407 | | - string info_host; |
1408 | 1413 | // we got a message here :) |
1409 | 1414 | if (text.Contains("!") && text.Contains("@")) |
1410 | 1415 | { |
— | — | @@ -1412,7 +1417,7 @@ |
1413 | 1418 | info.IndexOf(" ", info.IndexOf("@")) - 1 - |
1414 | 1419 | info.IndexOf("@")); |
1415 | 1420 | } |
1416 | | - info_host = info.Substring(info.IndexOf("PRIVMSG ")); |
| 1421 | + string info_host = info.Substring(info.IndexOf("PRIVMSG ")); |
1417 | 1422 | |
1418 | 1423 | string message; |
1419 | 1424 | if (info_host.Contains("#")) |
— | — | @@ -1469,7 +1474,7 @@ |
1470 | 1475 | } |
1471 | 1476 | } |
1472 | 1477 | } |
1473 | | - System.Threading.Thread.Sleep(50); |
| 1478 | + Thread.Sleep(50); |
1474 | 1479 | } |
1475 | 1480 | Program.Log("Reconnecting, end of data stream"); |
1476 | 1481 | Reconnect(); |