public static void iniReadHandle() { try { if (File.Exists(Globals.s_iniLocation)) { Globals.b_usingINI = true; INIHandle ini = new INIHandle(Globals.s_iniLocation); Globals.b_overRideChecks = Convert.ToBoolean(ini.IniReadValue("Server", "Override XEX Checks")); Globals.b_getFileByWild = Convert.ToBoolean(ini.IniReadValue("XEX", "Get File By Wildcard (*.xex)")); Globals.s_xexName = Convert.ToString(ini.IniReadValue("XEX", "Specify XEX Name(Useless when wildcard is enabled.)")); Globals.i_svrPort = Convert.ToInt32(ini.IniReadValue("Network", "Port")); Globals.b_parseLogs = Convert.ToBoolean(ini.IniReadValue("Logging", "Parse Logs")); Globals.b_logConnections = Convert.ToBoolean(ini.IniReadValue("Logging", "Log Connection")); Globals.b_printCrash = Convert.ToBoolean(ini.IniReadValue("Logging", "Log Client Crash")); Globals.s_svrAddr = Convert.ToString(ini.IniReadValue("MySQL", "Server Address")); Globals.s_dbName = Convert.ToString(ini.IniReadValue("MySQL", "Database Name")); Globals.s_dbUser = Convert.ToString(ini.IniReadValue("MySQL", "Database Username")); Globals.s_dbPass = Convert.ToString(ini.IniReadValue("MySQL", "Database Password")); } else { Globals.b_usingINI = false; createINI(); } } catch { } }
public static void createINI() { INIHandle ini = new INIHandle(Globals.s_iniLocation); if (File.Exists(Globals.s_iniLocation)) { File.Delete(Globals.s_iniLocation); } ini.IniWriteValue("Server", "Override XEX Checks", Globals.b_overRideChecks.ToString()); ini.IniWriteValue("Network", "Port", Globals.i_svrPort.ToString()); ini.IniWriteValue("XEX", "Get File By Wildcard (*.xex)", Globals.b_getFileByWild.ToString()); ini.IniWriteValue("XEX", "Specify XEX Name(Useless when wildcard is enabled.)", Globals.s_xexName); ini.IniWriteValue("Logging", "Parse Logs", Globals.b_parseLogs.ToString()); ini.IniWriteValue("Logging", "Log Connection", Globals.b_logConnections.ToString()); ini.IniWriteValue("Logging", "Log Client Crash", Globals.b_printCrash.ToString()); ini.IniWriteValue("MySQL", "Server Address", Globals.s_svrAddr); ini.IniWriteValue("MySQL", "Database Name", Globals.s_dbName); ini.IniWriteValue("MySQL", "Database Username", Globals.s_dbUser); ini.IniWriteValue("MySQL", "Database Password", Globals.s_dbPass); }