Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 64 → Rev 65

/SWAT USB App/trunk/SWAT USB App/SettingsParser.cs
41,7 → 41,7
{
try
{
DebugText.appendText("Parsing USBSettings.xml");
Debug.appendText("Parsing USBSettings.xml");
// Clears the lists for software and drivers
ApplicationsList.Clear();
DriversList.Clear();
49,30 → 49,30
Settings = XElement.Load(settingsFileLocation);
 
// Reads program settings
DebugText.appendText("Reading program settings");
Debug.appendText("Reading program settings");
XElement temp = Settings.Element("Program").Element("SoftwareFormWidth");
if (temp == null)
DebugText.appendText("Setting SoftwareFormWidth not found. Using default value of 210");
Debug.appendText("Setting SoftwareFormWidth not found. Using default value of 210");
else
softwareFormWidth = int.Parse(Settings.Element("Program").Element("SoftwareFormWidth").Value);
 
temp = Settings.Element("Program").Element("DriverFormWidth");
if (temp == null)
DebugText.appendText("Setting DriverFormWidth not found. Using default value of 180");
Debug.appendText("Setting DriverFormWidth not found. Using default value of 180");
else
driverFormWidth = int.Parse(Settings.Element("Program").Element("DriverFormWidth").Value);
 
temp = Settings.Element("Program").Element("CheckForMatchingModel");
if (temp == null)
DebugText.appendText("Setting CheckForMatchingModel not found. Using default value of false");
Debug.appendText("Setting CheckForMatchingModel not found. Using default value of false");
else
driverCheckForMatchingModel = bool.Parse(Settings.Element("Program").Element("CheckForMatchingModel").Value);
 
// Reads the list of applications from the USBSettings.xml file into form_Software.softwareList
DebugText.appendText("Parsing list of applications");
Debug.appendText("Parsing list of applications");
foreach (XElement elem in Settings.Elements("Applications").Elements("Application"))
{
DebugText.appendText("Adding application " + elem.Element("Name").Value);
Debug.appendText("Adding application " + elem.Element("Name").Value);
// Creates new Applications struct for holding app info
Applications structElem = new Applications();
// Sets Name value
89,7 → 89,7
int counter = 0;
foreach (XElement element in elem.Elements("Setup").Elements("Location"))
{
DebugText.appendText("Reading setup locations for application " + structElem.Name);
Debug.appendText("Reading setup locations for application " + structElem.Name);
setupLocation[counter] = (string)element.Value;
setupLocation[counter + 1] = (string)element.Attribute("Args");
counter += 2;
100,10 → 100,10
}
 
// Reads the list of drivers from the USBSettings.xml file into form_Drivers.driverList
DebugText.appendText("Parsing list of drivers");
Debug.appendText("Parsing list of drivers");
foreach (XElement elem in Settings.Elements("Drivers").Elements("Driver"))
{
DebugText.appendText("Adding driver " + elem.Element("Name").Value);
Debug.appendText("Adding driver " + elem.Element("Name").Value);
// Creates new Drivers struct for holding driver info
Drivers structElem = new Drivers();
// Sets Name value
113,7 → 113,7
int counter = 0;
foreach (XElement element in elem.Elements("Setup").Elements("Location"))
{
DebugText.appendText("Reading setup locations for driver " + structElem.Name);
Debug.appendText("Reading setup locations for driver " + structElem.Name);
setupLocation[counter] = (string)element.Value;
setupLocation[counter + 1] = (string)element.Attribute("Args");
counter += 2;
125,7 → 125,7
}
catch (Exception e)
{
DebugText.appendText("Exception Thrown: " + e.ToString());
Debug.appendText("Exception Thrown: " + e.ToString());
MessageBox.Show(e.ToString());
}
}