Lots of updates

This commit is contained in:
Matthew Burke
2023-07-26 22:26:54 -04:00
parent 42794b6284
commit 1b65e9bb83
24 changed files with 1305 additions and 28 deletions

View File

@@ -0,0 +1,46 @@
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;
}
}
}