public bool Load()
{
var fi = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
fi = new FileInfo(Path.Combine(fi.DirectoryName, "installsettings.xml"));
if (!fi.Exists) return false;
var document = new XmlDocument();
document.Load(fi.FullName);
if (document.DocumentElement.Name == "a")
{
this.PrimaryServer = XmlHelper.GetNodeValue(document.DocumentElement, "server", string.Empty);
this.PrimaryUseIntegratedSecurity = XmlHelper.GetNodeValue(document.DocumentElement, "useintegratedsecurity", false);
this.PrimaryUserName = XmlHelper.GetNodeValue(document.DocumentElement, "username", string.Empty);
this.PrimaryPassword = XmlHelper.GetNodeValue(document.DocumentElement, "password", string.Empty);
var v = XmlHelper.GetNodeValue(document.DocumentElement, "username-encrypted", string.Empty).Decrypt();
if (!string.IsNullOrEmpty(v))
this.PrimaryUserName = v;
v = XmlHelper.GetNodeValue(document.DocumentElement, "password-encrypted", string.Empty).Decrypt();
if (!string.IsNullOrEmpty(v))
this.PrimaryPassword = v;
this.PrimaryDatabase = XmlHelper.GetNodeValue(document.DocumentElement, "database", string.Empty);
}
else
{
var node = document.DocumentElement.SelectSingleNode("primary");
this.PrimaryServer = XmlHelper.GetNodeValue(node, "server", string.Empty);
this.PrimaryUseIntegratedSecurity = XmlHelper.GetNodeValue(node, "useintegratedsecurity", false);
this.PrimaryUserName = XmlHelper.GetNodeValue(node, "username", string.Empty);
this.PrimaryPassword = XmlHelper.GetNodeValue(node, "password", string.Empty);
var v = XmlHelper.GetNodeValue(node, "username-encrypted", string.Empty).Decrypt();
if (!string.IsNullOrEmpty(v))
this.PrimaryUserName = v;
v = XmlHelper.GetNodeValue(node, "password-encrypted", string.Empty).Decrypt();
if (!string.IsNullOrEmpty(v))
this.PrimaryPassword = v;
this.PrimaryDatabase = XmlHelper.GetNodeValue(node, "database", string.Empty);
node = document.DocumentElement.SelectSingleNode("cloud");
this.CloudServer = XmlHelper.GetNodeValue(node, "server", string.Empty);
this.CloudUserName = XmlHelper.GetNodeValue(node, "username", string.Empty);
this.CloudPassword = XmlHelper.GetNodeValue(node, "password", string.Empty);
v = XmlHelper.GetNodeValue(node, "username-encrypted", string.Empty).Decrypt();
if (!string.IsNullOrEmpty(v))
this.CloudUserName = v;
v = XmlHelper.GetNodeValue(node, "password-encrypted", string.Empty).Decrypt();
if (!string.IsNullOrEmpty(v))
this.CloudPassword = v;
this.CloudDatabase = XmlHelper.GetNodeValue(node, "database", string.Empty);
}
this.IsLoaded = true;
return true;
}