2017-06-07 21:02:29 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2017-07-22 19:27:41 +00:00
|
|
|
|
using Glove.INI;
|
2017-06-07 21:02:29 +00:00
|
|
|
|
|
2017-07-22 19:27:41 +00:00
|
|
|
|
namespace SockScape {
|
2017-06-07 21:02:29 +00:00
|
|
|
|
public static class Configuration {
|
|
|
|
|
private static SettingsFile Settings;
|
|
|
|
|
|
|
|
|
|
static Configuration() {
|
|
|
|
|
Settings = new SettingsFile(
|
|
|
|
|
"config.ini",
|
|
|
|
|
new List<SectionRules> {
|
|
|
|
|
new SectionRules {
|
|
|
|
|
Name = "General",
|
|
|
|
|
Required = true,
|
|
|
|
|
RequiredFields = new string[] {
|
|
|
|
|
"Run Master",
|
|
|
|
|
"Master Port",
|
|
|
|
|
"Master Addr",
|
|
|
|
|
"Max Users"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2017-08-18 21:01:11 +00:00
|
|
|
|
new SectionRules {
|
|
|
|
|
Name = "Database",
|
|
|
|
|
Required = true,
|
|
|
|
|
RequiredFields = new string[] {
|
|
|
|
|
"Server",
|
|
|
|
|
"Username",
|
|
|
|
|
"Password",
|
|
|
|
|
"Database"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2017-06-07 21:02:29 +00:00
|
|
|
|
new SectionRules {
|
|
|
|
|
Name = "Server",
|
|
|
|
|
AllowMultiple = true,
|
|
|
|
|
Required = true,
|
|
|
|
|
RequiredFields = new string[] {
|
|
|
|
|
"Id",
|
|
|
|
|
"Port"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Section Get(string section) {
|
|
|
|
|
return Settings[section];
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-16 21:00:01 +00:00
|
|
|
|
public static Instance General {
|
2017-06-07 21:02:29 +00:00
|
|
|
|
get {
|
2017-06-16 21:00:01 +00:00
|
|
|
|
return Settings["General"][0];
|
2017-06-07 21:02:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-18 21:01:11 +00:00
|
|
|
|
public static Instance Database {
|
|
|
|
|
get {
|
|
|
|
|
return Settings["Database"][0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-07 21:02:29 +00:00
|
|
|
|
public static Section Servers {
|
|
|
|
|
get {
|
|
|
|
|
return Settings["Server"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|