-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeneralSection.cs
57 lines (48 loc) · 1.71 KB
/
GeneralSection.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
using System;
using System.Collections.Generic;
namespace oftc_ircd_cs
{
public class GeneralSection : IConfigSection
{
public bool Daemon { get; set; }
public string SSLCertificate { get; set; }
public string SSLPrivateKey { get; set; }
public string MessagesFile { get; set; }
public string ServerName { get; set; }
public string ServerInfo { get; set; }
public string MotdFile { get; set; }
public int Nicklen { get; set; }
#region ConfigSection Members
public void SetDefaults()
{
Daemon = true;
ServerName = "IRC Server";
Nicklen = 30;
}
public void Process(object o)
{
var section = o as Dictionary<string, object>;
if (section == null)
throw new Exception("config element is not an object as expected");
object tmp;
if (section.TryGetValue("daemon", out tmp))
Daemon = (bool) tmp;
if (section.TryGetValue("ssl_certificate", out tmp))
SSLCertificate = (string) tmp;
if (section.TryGetValue("ssl_privatekey", out tmp))
SSLPrivateKey = (string) tmp;
if (section.TryGetValue("messages_file", out tmp))
MessagesFile = (string) tmp;
if (section.TryGetValue("server_name", out tmp))
ServerName = (string) tmp;
if (section.TryGetValue("server_info", out tmp))
ServerInfo = (string) tmp;
if (section.TryGetValue("nicklen", out tmp))
Nicklen = (int) tmp;
}
public void Verify()
{
}
#endregion
}
}