Subversion Repositories Code-Repo

Rev

Rev 10 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10 Rev 16
Line 31... Line 31...
31
 
31
 
32
                Settings = XElement.Load(settingsFileLocation);
32
                Settings = XElement.Load(settingsFileLocation);
33
 
33
 
34
                // Reads the list of applications from the USBSettings.xml file into form_Software.softwareList
34
                // Reads the list of applications from the USBSettings.xml file into form_Software.softwareList
35
                DebugText.appendText("Parsing list of applications into List softwareList");
35
                DebugText.appendText("Parsing list of applications into List softwareList");
36
                IEnumerable<XElement> app =
-
 
37
                    from el in Settings.Elements("Applications").Elements("Application")
36
                foreach (XElement elem in Settings.Elements("Applications").Elements("Application"))
38
                    select el;
-
 
39
                foreach (XElement el in app)
-
 
40
                {
37
                {
41
                    DebugText.appendText("Adding application " + el.Element("Name").Value + " into softwareList");
38
                    DebugText.appendText("Adding application " + elem.Element("Name").Value + " into softwareList");
42
                    form_Software.softwareList.Add(el.Element("Name").Value);
39
                    form_Software.softwareList.Add(elem.Element("Name").Value);
43
                }
40
                }
-
 
41
                // Alternate way of reading list of applications
-
 
42
                //IEnumerable<XElement> app =
-
 
43
                //    from el in Settings.Elements("Applications").Elements("Application")
-
 
44
                //    select el;
-
 
45
                //foreach (XElement el in app)
-
 
46
                //{
-
 
47
                //    DebugText.appendText("Adding application " + el.Element("Name").Value + " into softwareList");
-
 
48
                //    form_Software.softwareList.Add(el.Element("Name").Value);
-
 
49
                //}
44
 
50
 
45
                // Reads the list of drivers from the USBSettings.xml file into form_Drivers.driverList
51
                // Reads the list of drivers from the USBSettings.xml file into form_Drivers.driverList
46
                DebugText.appendText("Parsing list of drivers into List driverList");
52
                DebugText.appendText("Parsing list of drivers into List driverList");
47
                IEnumerable<XElement> driv =
-
 
48
                    from el in Settings.Elements("Drivers").Elements("Driver")
53
                foreach (XElement elem in Settings.Elements("Drivers").Elements("Driver"))
49
                    select el;
-
 
50
                foreach (XElement el in driv)
-
 
51
                {
54
                {
52
                    DebugText.appendText("Adding driver " + el.Element("Name").Value + " into driverList");
55
                    DebugText.appendText("Adding driver " + elem.Element("Name").Value + " into driverList");
53
                    form_Drivers.driverList.Add(el.Element("Name").Value);
56
                    form_Drivers.driverList.Add(elem.Element("Name").Value);
54
                }
57
                }
-
 
58
                // Alternate way of reading list of drivers
-
 
59
                //IEnumerable<XElement> driv =
-
 
60
                //    from el in Settings.Elements("Drivers").Elements("Driver")
-
 
61
                //    select el;
-
 
62
                //foreach (XElement el in driv)
-
 
63
                //{
-
 
64
                //    DebugText.appendText("Adding driver " + el.Element("Name").Value + " into driverList");
-
 
65
                //    form_Drivers.driverList.Add(el.Element("Name").Value);
-
 
66
                //}
55
            }
67
            }
56
            catch (Exception e)
68
            catch (Exception e)
57
            {
69
            {
58
                DebugText.appendText("Exception Thrown: " + e.ToString());
70
                DebugText.appendText("Exception Thrown: " + e.ToString());
59
                MessageBox.Show(e.ToString());
71
                MessageBox.Show(e.ToString());
Line 63... Line 75...
63
        {
75
        {
64
            try
76
            try
65
            {
77
            {
66
                // Checks if passed application name is marked as default
78
                // Checks if passed application name is marked as default
67
                bool isDefault = false;
79
                bool isDefault = false;
-
 
80
                foreach (XElement elem in Settings.Elements("Applications").Elements("Application"))
-
 
81
                {
-
 
82
                    if (elem.Element("Name").Value == applicationName)
-
 
83
                        if (elem.Element("Default").Value.ToLower() == "yes")
-
 
84
                        {
-
 
85
                            isDefault = true;
68
 
-
 
-
 
86
                            break;
-
 
87
                        }
-
 
88
                }
-
 
89
                // Alternate method of finding if default is marked
69
                IEnumerable<XElement> def =
90
                //IEnumerable<XElement> def =
70
                    from el in Settings.Elements("Applications").Elements("Application")
91
                //    from el in Settings.Elements("Applications").Elements("Application")
71
                    where (string)el.Element("Name") == applicationName
92
                //    where (string)el.Element("Name") == applicationName
72
                    select el;
93
                //    select el;
73
                if ((string)def.First().Element("Default").Value.ToLower() == "yes")
94
                //if ((string)def.First().Element("Default").Value.ToLower() == "yes")
74
                    isDefault = true;
95
                //    isDefault = true;
75
                return isDefault;
96
                return isDefault;
76
            }
97
            }
77
            catch (Exception e)
98
            catch (Exception e)
78
            {
99
            {
79
                DebugText.appendText("Exception Thrown: " + e.ToString());
100
                DebugText.appendText("Exception Thrown: " + e.ToString());
Line 89... Line 110...
89
                DebugText.appendText("Getting setup locations for application " + fileName);
110
                DebugText.appendText("Getting setup locations for application " + fileName);
90
                IEnumerable<XElement> loc =
111
                IEnumerable<XElement> loc =
91
                    from el in Settings.Elements("Applications").Elements("Application")
112
                    from el in Settings.Elements("Applications").Elements("Application")
92
                    where (string)el.Element("Name") == fileName
113
                    where (string)el.Element("Name") == fileName
93
                    select el;
114
                    select el;
-
 
115
                // Checks drivers if fileName is not found in Applications
94
                if (loc.Count() == 0)
116
                if (loc.Count() == 0)
95
                {
117
                {
96
                    loc =
118
                    loc =
97
                        from el in Settings.Elements("Drivers").Elements("Driver")
119
                        from el in Settings.Elements("Drivers").Elements("Driver")
98
                        where (string)el.Element("Name") == fileName
120
                        where (string)el.Element("Name") == fileName