Index: trunk/tools/wmib/DumpHtm.cs |
— | — | @@ -22,6 +22,7 @@ |
23 | 23 | { |
24 | 24 | public config.channel Channel; |
25 | 25 | public string dumpname; |
| 26 | + // This function is called on start of bot |
26 | 27 | public static void Start() |
27 | 28 | { |
28 | 29 | while (true) |
— | — | @@ -63,19 +64,27 @@ |
64 | 65 | } |
65 | 66 | public void Make() |
66 | 67 | { |
67 | | - string text; |
68 | | - text = CreateHeader(); |
69 | | - text = text + "<table border=1 width=100%>\n<tr><td width=10%>Key</td><td>Value</td></tr>\n"; |
70 | | - if (Channel.Keys.text.Count > 0) |
| 68 | + try |
71 | 69 | { |
72 | | - foreach (irc.dictionary.item Key in Channel.Keys.text) |
| 70 | + string text; |
| 71 | + text = CreateHeader(); |
| 72 | + text = text + "<table border=1 width=100%>\n<tr><td width=10%>Key</td><td>Value</td></tr>\n"; |
| 73 | + Channel.Keys.locked = true; |
| 74 | + if (Channel.Keys.text.Count > 0) |
73 | 75 | { |
74 | | - text = text + AddLine(Key.key, Key.text); |
| 76 | + foreach (irc.dictionary.item Key in Channel.Keys.text) |
| 77 | + { |
| 78 | + text = text + AddLine(Key.key, Key.text); |
| 79 | + } |
75 | 80 | } |
| 81 | + Channel.Keys.locked = false; |
| 82 | + text = text + "<table>\n"; |
| 83 | + text = text + CreateFooter(); |
| 84 | + System.IO.File.WriteAllText(dumpname, text); |
| 85 | + } catch (Exception b) |
| 86 | + { |
| 87 | + Channel.Keys.locked = false; |
| 88 | + Console.WriteLine(b.Message); |
76 | 89 | } |
77 | | - text = text + "<table>\n"; |
78 | | - text = text + CreateFooter(); |
79 | | - System.IO.File.WriteAllText(dumpname, text); |
80 | | - } |
81 | 90 | } |
82 | 91 | } |
Index: trunk/tools/wmib/Core.cs |
— | — | @@ -224,6 +224,7 @@ |
225 | 225 | public string datafile = ""; |
226 | 226 | // if we need to update dump |
227 | 227 | public bool update = true; |
| 228 | + public bool locked = false; |
228 | 229 | public class item |
229 | 230 | { |
230 | 231 | public item(string Key, string Text, string User, string Lock = "false") |
— | — | @@ -511,6 +512,10 @@ |
512 | 513 | |
513 | 514 | public void setKey(string Text, string key, string user) |
514 | 515 | { |
| 516 | + while (locked) |
| 517 | + { |
| 518 | + i |
| 519 | + } |
515 | 520 | try |
516 | 521 | { |
517 | 522 | foreach (item data in text) |
— | — | @@ -546,6 +551,10 @@ |
547 | 552 | } |
548 | 553 | public void rmKey(string key, string user) |
549 | 554 | { |
| 555 | + while (locked) |
| 556 | + { |
| 557 | + System.Threading.Thread.Sleep(200); |
| 558 | + } |
550 | 559 | foreach (item keys in text) |
551 | 560 | { |
552 | 561 | if (keys.key == key) |