private string GenerateODBCConnectionString() { string connectionString; if (DSN != "") { connectionString = "DSN=" + DSN + ";"; if (Database != "") { connectionString += "database=" + Database + ";"; } } else if (Driver != "" & Server != "" & Uid != "" & Database != "") { connectionString = "driver=" + Driver + ";server=" + Server + ";uid=" + Uid + ";pwd=" + Pwd + ";database=" + Database + ";"; } else { LoggerZ.FatalError("All Connection Data was not set!"); return(""); } return(connectionString); }
private static void GetSettingsFromXML(string filepath) { try { XElement settingsXml = XElement.Parse(String.Join("\n", File.ReadAllLines(filepath))); IEnumerable <XElement> settingsX = settingsXml.Elements(); foreach (XElement setting in settingsX) { switch (setting.Name.ToString()) { #region Logger Settings case "Logger": foreach (XElement element in setting.Elements()) { if (element.Name == "LogFilePath") { } else { foreach (XElement level in element.Elements()) { loggerSettings.Add(element.Name.ToString() + "." + level.Name.ToString(), (level.Value == "true")); } } } break; #endregion #region SQL Settings case "SQL": foreach (XElement element in setting.Elements()) { if (element.Name == "BulkInsertCount") { //bulkInsertCount = Int32.Parse(element.Value.ToString()); } } break; #endregion #region ODBC Settings case "ODBC": OdbcZ.defaultConnection = new ODBCHandler(setting.Elements()); break; #endregion #region Discord Settings case "Discord": break; #endregion } if (setting.Name == "Connection") { } else if (setting.Name == "Logging") { } else if (setting.Name == "General") { foreach (XElement element in setting.Elements()) { } } else if (setting.Name == "Discord") { } } } catch (Exception e) { LoggerZ.FatalError(String.Format("Error: could not read lines in file \"{0}\"\n{1}", filepath, e.Message)); } }