63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
using PWAPPv2.Source.Config;
|
|
using System;
|
|
using System.Xml;
|
|
|
|
namespace PWAPPv2.Source
|
|
{
|
|
public class APIConfig
|
|
{
|
|
public string PWUserID;
|
|
public string PWPassword;
|
|
public string PWPracticeID;
|
|
public string PWApiID;
|
|
|
|
public string PWBaseURI;
|
|
public string PWUpdateURI;
|
|
public string PWAppVersion;
|
|
|
|
public APIConfig() { }
|
|
|
|
public APIConfig(Config.Configuration practiceConfig, Config.Configuration universalConfig)
|
|
{
|
|
PWUserID = practiceConfig.Get("pwuserid");
|
|
PWPassword = practiceConfig.Get("pwpassword");
|
|
PWPracticeID = practiceConfig.Get("pwpracticeid");
|
|
PWApiID = practiceConfig.Get("pwapiid");
|
|
|
|
PWBaseURI = universalConfig.Get("PWBaseURI");
|
|
PWUpdateURI = universalConfig.Get("PWUpdateURI");
|
|
PWAppVersion = universalConfig.Get("PWAppVersion");
|
|
|
|
}
|
|
|
|
public void LoadConfig(string path)
|
|
{
|
|
XmlDocument cfgDoc = new XmlDocument();
|
|
try
|
|
{
|
|
cfgDoc.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!");
|
|
return;
|
|
}
|
|
|
|
XmlNodeList XUserID = cfgDoc.GetElementsByTagName("pwuserid");
|
|
XmlNodeList XPassword = cfgDoc.GetElementsByTagName("pwpassword");
|
|
XmlNodeList XPracticeID = cfgDoc.GetElementsByTagName("pwpracticeid");
|
|
XmlNodeList XApiID = cfgDoc.GetElementsByTagName("pwapiid");
|
|
|
|
PWUserID = XUserID[0].InnerText;
|
|
PWPassword = XPassword[0].InnerText;
|
|
PWPracticeID = XPracticeID[0].InnerText;
|
|
PWApiID = XApiID[0].InnerText;
|
|
}
|
|
}
|
|
}
|