2 using System
.Collections
;
3 using System
.Collections
.Generic
;
4 using System
.Collections
.Specialized
;
5 using System
.Configuration
;
8 using System
.Threading
;
10 static class AppSettings
12 static private string ircServer
;
13 static private string tfsUrl
;
14 static private string commandChannel
;
15 static private string notifyChannel
;
16 static private string username
;
17 static private string password
;
18 static private string domain
;
19 static private string nick
;
20 static private int latestChangesetId
= 0;
22 static public string IrcServer
24 get { return ircServer; }
27 static public string Nick
32 static public string TfsUrl
34 get { return tfsUrl; }
37 static public string CommandChannel
39 get { return commandChannel; }
42 static public string NotifyChannel
44 get { return notifyChannel; }
47 static public string Username
49 get { return username; }
52 static public string Password
54 get { return password; }
57 static public string Domain
59 get { return domain; }
62 static public int LatestChangesetId
64 get { return latestChangesetId; }
69 // Get the AppSettings collection.
70 NameValueCollection appSettings
= ConfigurationManager
.AppSettings
;
71 string[] keys
= appSettings
.AllKeys
;
73 // Loop to get key/value pairs.
74 for (int i
= 0; i
< appSettings
.Count
; i
++)
79 ircServer
= appSettings
[i
];
81 case "irc.channel.notify":
82 notifyChannel
= appSettings
[i
];
84 case "irc.channel.command":
85 commandChannel
= appSettings
[i
];
87 case "irc.channel": //obsolete setting
88 commandChannel
= appSettings
[i
];
89 notifyChannel
= appSettings
[i
];
92 nick
= appSettings
[i
];
95 tfsUrl
= appSettings
[i
];
98 domain
= appSettings
[i
];
101 username
= appSettings
[i
];
104 password
= appSettings
[i
];
106 case "tfs.changeset":
107 string cid
= appSettings
[i
];
108 if (!String
.IsNullOrEmpty(cid
))
109 latestChangesetId
= Convert
.ToInt32(cid
);