Added Scm version of the contacts window
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Schema;
|
||||
@@ -262,6 +263,8 @@ namespace Step.Config
|
||||
|
||||
public static void ReadServerConfig()
|
||||
{
|
||||
CalculateHash(SERVER_CONFIG_PATH);
|
||||
|
||||
// Get server file handler
|
||||
XDocument xmlConfigFile = GetXmlHandlerWithValidator(SERVER_CONFIG_SCHEMA_PATH, SERVER_CONFIG_PATH);
|
||||
|
||||
@@ -379,15 +382,30 @@ namespace Step.Config
|
||||
|
||||
//Read Standard CMS Configuration
|
||||
XDocument xmlConfigFile = GetXmlHandlerWithValidator(MAINTENANCES_CONFIG_SCHEMA_PATH, MAINTENANCES_CONFIG_PATH, true);
|
||||
ReadAssistanceConfigFromXml(xmlConfigFile);
|
||||
ReadAssistanceConfigFromXml(
|
||||
xmlConfigFile.Root.Descendants("cmsContacts").FirstOrDefault(),
|
||||
out CmsContactConfig,
|
||||
out CmsAuxContact1,
|
||||
out CmsAuxContact2
|
||||
);
|
||||
|
||||
xmlConfigFile = GetXmlHandlerWithValidator(MAINTENANCES_CONFIG_SCHEMA_PATH, MAINTENANCES_CONFIG_PATH, true);
|
||||
ReadAssistanceConfigFromXml(
|
||||
xmlConfigFile.Root.Descendants("scmContacts").FirstOrDefault(),
|
||||
out ScmContactConfig,
|
||||
out ScmAuxContact1,
|
||||
out ScmAuxContact2
|
||||
);
|
||||
|
||||
//Setup STD var
|
||||
CmsWebsiteUrl = ContactConfig.WebSite;
|
||||
CmsCompanyName = ContactConfig.Company;
|
||||
}
|
||||
|
||||
public static bool ReadAssistanceCustomConfig()
|
||||
{
|
||||
|
||||
DealerContactConfig = null;
|
||||
DealerAuxContact1 = null;
|
||||
DealerAuxContact2 = null;
|
||||
|
||||
//Read Dealer Configuration
|
||||
if (File.Exists(CUSTOMER_CONTACTS))
|
||||
{
|
||||
@@ -420,14 +438,21 @@ namespace Step.Config
|
||||
ReadAssistanceConfig();
|
||||
return false;
|
||||
}
|
||||
ReadAssistanceConfigFromXml(XDocument.Parse(xmlContactFile.OuterXml));
|
||||
|
||||
ReadAssistanceConfigFromXml(
|
||||
XDocument.Parse(xmlContactFile.OuterXml).Root,
|
||||
out DealerContactConfig,
|
||||
out DealerAuxContact1,
|
||||
out DealerAuxContact2
|
||||
);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void ReadAssistanceConfigFromXml(XDocument xmlConfigFile)
|
||||
public static void ReadAssistanceConfigFromXml(XElement xmlRoot, out ContactModel MainContact, out ContactModel AuxContact1, out ContactModel AuxContact2)
|
||||
{
|
||||
ContactConfig = xmlConfigFile
|
||||
MainContact = xmlRoot
|
||||
.Descendants("MainOffice")
|
||||
.Select(x =>
|
||||
new ContactModel()
|
||||
@@ -439,7 +464,7 @@ namespace Step.Config
|
||||
})
|
||||
.FirstOrDefault();
|
||||
|
||||
AuxContact1 = xmlConfigFile
|
||||
AuxContact1 = xmlRoot
|
||||
.Descendants("AuxOffice1")
|
||||
.Select(x =>
|
||||
new ContactModel()
|
||||
@@ -451,7 +476,7 @@ namespace Step.Config
|
||||
})
|
||||
.FirstOrDefault();
|
||||
|
||||
AuxContact2 = xmlConfigFile
|
||||
AuxContact2 = xmlRoot
|
||||
.Descendants("AuxOffice2")
|
||||
.Select(x =>
|
||||
new ContactModel()
|
||||
@@ -699,6 +724,18 @@ namespace Step.Config
|
||||
}
|
||||
}
|
||||
|
||||
public static string CalculateHash(string filename)
|
||||
{
|
||||
using (var sha = SHA1.Create())
|
||||
{
|
||||
using (var stream = File.OpenRead(filename))
|
||||
{
|
||||
var hash = sha.ComputeHash(stream);
|
||||
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Read config from file from configuration
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user