mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 21:25:52 +12:00
Remove " " space from the names
This commit is contained in:
parent
bef3032886
commit
8e451633dc
59 changed files with 391 additions and 391 deletions
121
Horse Isle Server/HorseIsleServer/Server/ConfigReader.cs
Normal file
121
Horse Isle Server/HorseIsleServer/Server/ConfigReader.cs
Normal file
|
@ -0,0 +1,121 @@
|
|||
using HISP.Properties;
|
||||
using System.IO;
|
||||
|
||||
namespace HISP.Server
|
||||
{
|
||||
|
||||
class ConfigReader
|
||||
{
|
||||
public static int Port;
|
||||
public static string BindIP;
|
||||
|
||||
public static string DatabaseIP;
|
||||
public static string DatabaseUsername;
|
||||
public static string DatabaseName;
|
||||
public static string DatabasePassword;
|
||||
public static int DatabasePort;
|
||||
public static int IntrestRate;
|
||||
public static string Motd;
|
||||
public static string MapFile;
|
||||
public static string GameDataFile;
|
||||
public static string CrossDomainPolicyFile;
|
||||
|
||||
public static bool Debug;
|
||||
public static bool AllUsersSubbed;
|
||||
public static bool BadWords;
|
||||
public static bool DoCorrections;
|
||||
|
||||
public const int MAX_STACK = 40;
|
||||
|
||||
private static string ConfigurationFileName = "server.properties";
|
||||
public static void OpenConfig()
|
||||
{
|
||||
if (!File.Exists(ConfigurationFileName))
|
||||
{
|
||||
Logger.WarnPrint(ConfigurationFileName+" not found! writing default.");
|
||||
File.WriteAllText(ConfigurationFileName,Resources.DefaultServerProperties);
|
||||
Logger.InfoPrint("! Its very likely database connection will fail...");
|
||||
}
|
||||
|
||||
string[] configFile = File.ReadAllLines(ConfigurationFileName);
|
||||
foreach (string setting in configFile)
|
||||
{
|
||||
/*
|
||||
* Avoid crashing.
|
||||
*/
|
||||
if (setting.Length < 1)
|
||||
continue;
|
||||
if (setting[0] == '#')
|
||||
continue;
|
||||
if (!setting.Contains("="))
|
||||
continue;
|
||||
|
||||
string[] dataPair = setting.Split('=');
|
||||
|
||||
string key = dataPair[0];
|
||||
string data = dataPair[1];
|
||||
/*
|
||||
* Parse configuration file
|
||||
*/
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case "port":
|
||||
Port = int.Parse(data);
|
||||
break;
|
||||
case "ip":
|
||||
BindIP = data;
|
||||
break;
|
||||
case "db_ip":
|
||||
DatabaseIP = data;
|
||||
break;
|
||||
case "db_username":
|
||||
DatabaseUsername = data;
|
||||
break;
|
||||
case "db_password":
|
||||
DatabasePassword = data;
|
||||
break;
|
||||
case "db_name":
|
||||
DatabaseName = data;
|
||||
break;
|
||||
case "db_port":
|
||||
DatabasePort = int.Parse(data);
|
||||
break;
|
||||
case "map":
|
||||
MapFile = data;
|
||||
break;
|
||||
case "motd":
|
||||
Motd = data;
|
||||
break;
|
||||
case "gamedata":
|
||||
GameDataFile = data;
|
||||
break;
|
||||
case "crossdomain":
|
||||
CrossDomainPolicyFile = data;
|
||||
break;
|
||||
case "all_users_subscribed":
|
||||
AllUsersSubbed = data == "true";
|
||||
break;
|
||||
case "enable_corrections":
|
||||
BadWords = data == "true";
|
||||
break;
|
||||
case "enable_word_filter":
|
||||
DoCorrections = data == "true";
|
||||
break;
|
||||
case "intrest_rate":
|
||||
IntrestRate = int.Parse(data);
|
||||
break;
|
||||
case "debug":
|
||||
Debug = data == "true";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue