using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; namespace PWAPPv2.Source.Database { class DatabaseConfig { public string host; public string user; public string password; public string database; public DatabaseConfig(string path) { XmlDocument cfg = new XmlDocument(); try { cfg.Load(path); } catch(XmlException) { Console.WriteLine("An error has occured parsing the config file."); return; } catch(System.IO.FileNotFoundException) { Console.WriteLine("Config file could not be found!"); } XmlNodeList XHost = cfg.GetElementsByTagName("ODhost"); XmlNodeList XUser = cfg.GetElementsByTagName("ODuser"); XmlNodeList XPassword = cfg.GetElementsByTagName("ODpassword"); XmlNodeList XDatabase = cfg.GetElementsByTagName("ODdatabase"); host = XHost[0].InnerText; user = XUser[0].InnerText; password = XPassword[0].InnerText; database = XDatabase[0].InnerText; } } }