Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 10 → Rev 16

/SWAT USB App/trunk/SWAT USB App/SettingsParser.cs
33,25 → 33,37
 
// Reads the list of applications from the USBSettings.xml file into form_Software.softwareList
DebugText.appendText("Parsing list of applications into List softwareList");
IEnumerable<XElement> app =
from el in Settings.Elements("Applications").Elements("Application")
select el;
foreach (XElement el in app)
foreach (XElement elem in Settings.Elements("Applications").Elements("Application"))
{
DebugText.appendText("Adding application " + el.Element("Name").Value + " into softwareList");
form_Software.softwareList.Add(el.Element("Name").Value);
DebugText.appendText("Adding application " + elem.Element("Name").Value + " into softwareList");
form_Software.softwareList.Add(elem.Element("Name").Value);
}
// Alternate way of reading list of applications
//IEnumerable<XElement> app =
// from el in Settings.Elements("Applications").Elements("Application")
// select el;
//foreach (XElement el in app)
//{
// DebugText.appendText("Adding application " + el.Element("Name").Value + " into softwareList");
// form_Software.softwareList.Add(el.Element("Name").Value);
//}
 
// Reads the list of drivers from the USBSettings.xml file into form_Drivers.driverList
DebugText.appendText("Parsing list of drivers into List driverList");
IEnumerable<XElement> driv =
from el in Settings.Elements("Drivers").Elements("Driver")
select el;
foreach (XElement el in driv)
foreach (XElement elem in Settings.Elements("Drivers").Elements("Driver"))
{
DebugText.appendText("Adding driver " + el.Element("Name").Value + " into driverList");
form_Drivers.driverList.Add(el.Element("Name").Value);
DebugText.appendText("Adding driver " + elem.Element("Name").Value + " into driverList");
form_Drivers.driverList.Add(elem.Element("Name").Value);
}
// Alternate way of reading list of drivers
//IEnumerable<XElement> driv =
// from el in Settings.Elements("Drivers").Elements("Driver")
// select el;
//foreach (XElement el in driv)
//{
// DebugText.appendText("Adding driver " + el.Element("Name").Value + " into driverList");
// form_Drivers.driverList.Add(el.Element("Name").Value);
//}
}
catch (Exception e)
{
65,13 → 77,22
{
// Checks if passed application name is marked as default
bool isDefault = false;
 
IEnumerable<XElement> def =
from el in Settings.Elements("Applications").Elements("Application")
where (string)el.Element("Name") == applicationName
select el;
if ((string)def.First().Element("Default").Value.ToLower() == "yes")
isDefault = true;
foreach (XElement elem in Settings.Elements("Applications").Elements("Application"))
{
if (elem.Element("Name").Value == applicationName)
if (elem.Element("Default").Value.ToLower() == "yes")
{
isDefault = true;
break;
}
}
// Alternate method of finding if default is marked
//IEnumerable<XElement> def =
// from el in Settings.Elements("Applications").Elements("Application")
// where (string)el.Element("Name") == applicationName
// select el;
//if ((string)def.First().Element("Default").Value.ToLower() == "yes")
// isDefault = true;
return isDefault;
}
catch (Exception e)
91,6 → 112,7
from el in Settings.Elements("Applications").Elements("Application")
where (string)el.Element("Name") == fileName
select el;
// Checks drivers if fileName is not found in Applications
if (loc.Count() == 0)
{
loc =