/SWAT USB App/trunk/SWAT USB App/AboutBox.Designer.cs |
---|
29,6 → 29,7 |
{ |
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox)); |
this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); |
this.logoPictureBox = new System.Windows.Forms.PictureBox(); |
this.labelProductName = new System.Windows.Forms.Label(); |
this.labelVersion = new System.Windows.Forms.Label(); |
this.labelCopyright = new System.Windows.Forms.Label(); |
35,7 → 36,6 |
this.labelCompanyName = new System.Windows.Forms.Label(); |
this.textBoxDescription = new System.Windows.Forms.TextBox(); |
this.okButton = new System.Windows.Forms.Button(); |
this.logoPictureBox = new System.Windows.Forms.PictureBox(); |
this.tableLayoutPanel.SuspendLayout(); |
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); |
this.SuspendLayout(); |
65,6 → 65,18 |
this.tableLayoutPanel.Size = new System.Drawing.Size(417, 265); |
this.tableLayoutPanel.TabIndex = 0; |
// |
// logoPictureBox |
// |
this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; |
this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image"))); |
this.logoPictureBox.Location = new System.Drawing.Point(3, 3); |
this.logoPictureBox.Name = "logoPictureBox"; |
this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6); |
this.logoPictureBox.Size = new System.Drawing.Size(131, 259); |
this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; |
this.logoPictureBox.TabIndex = 12; |
this.logoPictureBox.TabStop = false; |
// |
// labelProductName |
// |
this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill; |
137,18 → 149,6 |
this.okButton.TabIndex = 24; |
this.okButton.Text = "&OK"; |
// |
// logoPictureBox |
// |
this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; |
this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image"))); |
this.logoPictureBox.Location = new System.Drawing.Point(3, 3); |
this.logoPictureBox.Name = "logoPictureBox"; |
this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6); |
this.logoPictureBox.Size = new System.Drawing.Size(131, 259); |
this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; |
this.logoPictureBox.TabIndex = 12; |
this.logoPictureBox.TabStop = false; |
// |
// AboutBox |
// |
this.AcceptButton = this.okButton; |
/SWAT USB App/trunk/SWAT USB App/AboutBox.cs |
---|
15,7 → 15,7 |
InitializeComponent(); |
this.Text = "Program Info"; |
this.labelProductName.Text = "SWAT USB App"; |
this.labelVersion.Text = "Version 2.1"; |
this.labelVersion.Text = "Version 2.2"; |
this.labelCopyright.Text = "Copyright to Kevin Lee @ Virginia Tech"; |
this.labelCompanyName.Text = "Author: Kevin Lee"; |
this.textBoxDescription.Text = "This program has been written by Kevin Lee for use " + |
/SWAT USB App/trunk/SWAT USB App/AboutBox.resx |
---|
133,8 → 133,8 |
n19RsKnwXbF2SVbpqrI3FfqVJVW7ahhrveqm1j9s1GuqaT7bKtdW2H60U7qrqPt0r2pfY//diTaTZk/+ |
OzV+2uEZGjP7Z32fkzD39HzzBUsXiSxuXfJtWebyeytDVp1e47J233rLDds2mWzestVk2/YdVjv373bd |
c3Zf2P4HB3MO/TzSfkz8+IqT1qfOnUk+++v8pIval45eSbz67/qcmza37t6pv6d8/8TDvMdiT/Y/y3wh |
8vLg6/y38u8ufGj6ZPr51dcF38N/Cvw69af1n+P//wANAA8013ReGAAAAAlwSFlzAAA45gAAOOYBk6jl |
TAAANQ1JREFUeF7t3VePNEfVB3B/Bb4DQkJwbQkhhC+MxAUW2GCTjbGNeRzAgI0DmJxNzjnnnHMwyeSc |
8vLg6/y38u8ufGj6ZPr51dcF38N/Cvw69af1n+P//wANAA8013ReGAAAAAlwSFlzAAA45QAAOOUBPhHE |
IQAANQ1JREFUeF7t3VePNEfVB3B/Bb4DQkJwbQkhhC+MxAUW2GCTjbGNeRzAgI0DmJxNzjnnnHMwyeSc |
c44m58y8/BqO33I9Hap7umerd7ek1e7OdFd31fnXyafqmGOOOWZz+HM4B//BwOEkHM5Bg4H/AuGwHcwZ |
SBbBIRAOJgT+O+pDIBxk6idjPwTCIRAOOcIhBv5/Bg48R/jnP/+5+c1vfrP51re+tfn4xz+++cAHPrD5 |
2Mc+tvnmN7+5+d3vfndgsHJggPCvf/1r89WvfnXzvve9b/OqV71q87KXvWzzrGc9a/PYxz5288xnPnPz |
/SWAT USB App/trunk/SWAT USB App/Initialization.cs |
---|
69,6 → 69,7 |
} |
public static void GetModelNumber() |
{ |
// Pulls the model nubmer of the computer using systeminfo.exe |
try |
{ |
Process proc = new Process(); |
/SWAT USB App/trunk/SWAT USB App/SettingsParser.cs |
---|
8,8 → 8,25 |
namespace SWAT_USB_App |
{ |
public struct Applications |
{ |
public string Name; |
public bool Default; |
public string Group; |
public string[] SetupFileLocation; |
} |
public struct Drivers |
{ |
public string Name; |
public string[] SetupFileLocation; |
} |
class SettingsParser |
{ |
public static List<Applications> ApplicationsList = new List<Applications>(); |
public static List<Drivers> DriversList = new List<Drivers>(); |
public static int softwareFormWidth; |
public static int driverFormWidth; |
public static bool driverCheckForMatchingModel; |
private static string settingsFileLocation = Initialization.pathToSWATDrive + "USBSettings.xml"; |
private static XElement Settings; |
26,44 → 43,71 |
{ |
DebugText.appendText("Parsing USBSettings.xml"); |
// Clears the lists for software and drivers |
form_Software.softwareList.Clear(); |
form_Drivers.driverList.Clear(); |
ApplicationsList.Clear(); |
DriversList.Clear(); |
Settings = XElement.Load(settingsFileLocation); |
// Reads program settings |
DebugText.appendText("Reading program settings"); |
softwareFormWidth = int.Parse(Settings.Element("Program").Element("SoftwareFormWidth").Value); |
driverFormWidth = int.Parse(Settings.Element("Program").Element("DriverFormWidth").Value); |
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 into List softwareList"); |
DebugText.appendText("Parsing list of applications"); |
foreach (XElement elem in Settings.Elements("Applications").Elements("Application")) |
{ |
DebugText.appendText("Adding application " + elem.Element("Name").Value + " into softwareList"); |
form_Software.softwareList.Add(elem.Element("Name").Value); |
DebugText.appendText("Adding application " + elem.Element("Name").Value); |
// Creates new Applications struct for holding app info |
Applications structElem = new Applications(); |
// Sets Name value |
structElem.Name = elem.Element("Name").Value; |
// Sets Default value |
if (elem.Element("Default") != null) |
if (elem.Element("Default").Value.ToLower() == "yes") |
structElem.Default = true; |
// Sets Group value |
if (elem.Element("Group") != null) |
structElem.Group = elem.Element("Group").Value; |
// Sets SetupFileLocation value |
string[] setupLocation = new string[elem.Element("Setup").Elements("Location").Count() * 2]; |
int counter = 0; |
foreach (XElement element in elem.Elements("Setup").Elements("Location")) |
{ |
DebugText.appendText("Reading setup locations for application " + structElem.Name); |
setupLocation[counter] = (string)element.Value; |
setupLocation[counter + 1] = (string)element.Attribute("Args"); |
counter += 2; |
} |
structElem.SetupFileLocation = setupLocation; |
// Adds created struct to struct list |
ApplicationsList.Add(structElem); |
} |
// 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"); |
DebugText.appendText("Parsing list of drivers"); |
foreach (XElement elem in Settings.Elements("Drivers").Elements("Driver")) |
{ |
DebugText.appendText("Adding driver " + elem.Element("Name").Value + " into driverList"); |
form_Drivers.driverList.Add(elem.Element("Name").Value); |
DebugText.appendText("Adding driver " + elem.Element("Name").Value); |
// Creates new Drivers struct for holding driver info |
Drivers structElem = new Drivers(); |
// Sets Name value |
structElem.Name = elem.Element("Name").Value; |
// Sets SetupFileLocation value |
string[] setupLocation = new string[elem.Element("Setup").Elements("Location").Count() * 2]; |
int counter = 0; |
foreach (XElement element in elem.Elements("Setup").Elements("Location")) |
{ |
DebugText.appendText("Reading setup locations for driver " + structElem.Name); |
setupLocation[counter] = (string)element.Value; |
setupLocation[counter + 1] = (string)element.Attribute("Args"); |
counter += 2; |
} |
structElem.SetupFileLocation = setupLocation; |
// Adds created struct into struct list |
DriversList.Add(structElem); |
} |
// 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) |
{ |
71,74 → 115,5 |
MessageBox.Show(e.ToString()); |
} |
} |
public static bool isDefaultCheck(string applicationName) |
{ |
try |
{ |
// Checks if passed application name is marked as default |
bool isDefault = false; |
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) |
{ |
DebugText.appendText("Exception Thrown: " + e.ToString()); |
MessageBox.Show(e.ToString()); |
return false; |
} |
} |
public static string[] getSetupLocation(string fileName) |
{ |
try |
{ |
// Pulls the location and arguments for the specified application/driver from USBSettings.xml |
DebugText.appendText("Getting setup locations for application " + fileName); |
IEnumerable<XElement> loc = |
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 = |
from el in Settings.Elements("Drivers").Elements("Driver") |
where (string)el.Element("Name") == fileName |
select el; |
} |
// Creates a string array holding alternating lines of setup locations and arguments for that setup file |
string[] appSetupFile = new string[loc.Elements("Setup").Elements("Location").Count() * 2]; |
int counter = 0; |
foreach (XElement elem in loc.Elements("Setup").Elements("Location")) |
{ |
DebugText.appendText("Setup location for " + fileName + " is at " + (string)elem.Value + " with arguments " + (string)elem.Attribute("Args")); |
appSetupFile[counter] = (string)elem.Value; |
appSetupFile[counter + 1] = (string)elem.Attribute("Args"); |
counter += 2; |
} |
return appSetupFile; |
} |
catch (Exception e) |
{ |
DebugText.appendText("Exception Thrown: " + e.ToString()); |
MessageBox.Show(e.ToString()); |
return null; |
} |
} |
} |
} |
/SWAT USB App/trunk/SWAT USB App/USBSettings.xml |
---|
0,0 → 1,149 |
<?xml version="1.0" encoding="utf-8"?> |
<!-- |
The settings XML file should be in the following format: |
<Settings> |
<Program> |
<SoftwareFormWidth></SoftwareFormWidth> // Width in px |
<DriverFormWidth></DriverFormWidth> // Width in px |
<CheckForMatchingModel></CheckForMatchingModel> // true|false |
</Program> |
<Applications> |
<Application> // Note: Can have multiple entries here |
<Name></Name> |
<Default></Default> // Optional, yes|no, defaults to no |
<Group></Group> // Optional, defaults to none |
<Setup> |
<Location Args=""></Location> |
</Setup> |
</Application> |
</Applications> |
<Drivers> |
<Driver> // Note: Can have multiple entries here |
<Name></Name> |
<Setup> |
<Location Args=""></Location> |
</Setup> |
</Driver> |
</Drivers> |
</Settings> |
--> |
<Settings> |
<Program> |
<SoftwareFormWidth>210</SoftwareFormWidth> |
<DriverFormWidth>180</DriverFormWidth> |
<CheckForMatchingModel>false</CheckForMatchingModel> |
</Program> |
<Applications> |
<Application> |
<Name>Adobe Reader</Name> |
<Default>Yes</Default> |
<Setup> |
<Location Args="">\Installer Files\Adobe\Setup.exe</Location> |
</Setup> |
</Application> |
<Application> |
<Name>Google Chrome</Name> |
<Default>No</Default> |
<Setup> |
<Location Args="">\Installer Files\Chrome\Setup.exe</Location> |
</Setup> |
</Application> |
<Application> |
<Name>Mozilla Firefox</Name> |
<Default>Yes</Default> |
<Setup> |
<Location Args="">\Installer Files\Firefox 3.6.8\Setup.exe</Location> |
</Setup> |
</Application> |
<Application> |
<Name>DyKnow x32</Name> |
<Default>Yes</Default> |
<Setup> |
<Location Args="">\Installer Files\DyKnow 32-bit Installation\DyKnowInstall53_x86.msi</Location> |
</Setup> |
</Application> |
<Application> |
<Name>LabView</Name> |
<Default>No</Default> |
<Setup> |
<Location Args="">\Installer Files\LabView R2009s\Setup.exe</Location> |
</Setup> |
</Application> |
<Application> |
<Name>MatLab x32</Name> |
<Default>No</Default> |
<Setup> |
<Location Args="">\Installer Files\Matlab\R2010a-32bit\setup.exe</Location> |
</Setup> |
</Application> |
<Application> |
<Name>Microsoft Office 2010</Name> |
<Default>Yes</Default> |
<Setup> |
<Location Args="">\Installer Files\Microsoft\Office 2010\Setup.exe</Location> |
</Setup> |
</Application> |
<Application> |
<Name>MalwareBytes</Name> |
<Default>Yes</Default> |
<Setup> |
<Location Args="">\Installer Files\MalwareBytes\mbam-setup-1.46.exe</Location> |
</Setup> |
</Application> |
<Application> |
<Name>Microsoft Security Essentials</Name> |
<Default>No</Default> |
<Group>Antivirus</Group> |
<Setup> |
<Location Args="">\Installer Files\Microsoft\Security Essentials\Setup x32.exe</Location> |
</Setup> |
</Application> |
<Application> |
<Name>Symantec Antivirus</Name> |
<Default>Yes</Default> |
<Group>Antivirus</Group> |
<Setup> |
<Location Args="">\Installer Files\Symantec Antivirus\vtsep1106000.exe</Location> |
</Setup> |
</Application> |
</Applications> |
<Drivers> |
<Driver> |
<Name>Fujitsu T4220</Name> |
<Setup> |
<Location Args="/s /sms">\Installer Files\Drivers\Fujitsu\T4220\System Extension\Setup.exe</Location> |
<Location Args="/s /sms">\Installer Files\Drivers\Fujitsu\T4220\Audio\Setup.exe</Location> |
<Location Args='/s /v\"/qb\"'>\Installer Files\Drivers\Fujitsu\T4220\Bluetooth\Setup.exe</Location> |
<Location Args="/s /se">\Installer Files\Drivers\Fujitsu\T4220\Button Driver\DPInst.exe</Location> |
<Location Args="-s">\Installer Files\Drivers\Fujitsu\T4220\Display\Setup.exe</Location> |
<Location Args='/s /v\"/qb\"'>\Installer Files\Drivers\Fujitsu\T4220\Fingerprint\Setup.exe</Location> |
<Location Args="/s /sms">\Installer Files\Drivers\Fujitsu\T4220\Hotkey Utility\Setup.exe</Location> |
<Location Args="/s /sms">\Installer Files\Drivers\Fujitsu\T4220\Media Slot O2Micro\Setup.exe</Location> |
<Location Args="/s /sms">\Installer Files\Drivers\Fujitsu\T4220\Pen\Setup.exe</Location> |
<Location Args="/s /sms">\Installer Files\Drivers\Fujitsu\T4220\SmartCard O2Micro\Setup.exe</Location> |
<Location Args="/s /sms">\Installer Files\Drivers\Fujitsu\T4220\Touchpad\Setup.exe</Location> |
<Location Args="/s /sms">\Installer Files\Drivers\Fujitsu\T4220\Wireless\Setup.exe</Location> |
<Location Args='/s /v\"/qb\"'>\Installer Files\Drivers\Fujitsu\T4220\Button Utilities\Setup.exe</Location> |
</Setup> |
</Driver> |
<Driver> |
<Name>Fujitsu T5010</Name> |
<Setup> |
<Location Args="">\Installer Files\Drivers\Fujitsu\T5010\Setup.exe</Location> |
</Setup> |
</Driver> |
<Driver> |
<Name>Toshiba M700</Name> |
<Setup> |
<Location Args="">\Installer Files\Drivers\Toshiba\tsi4win7.exe</Location> |
</Setup> |
</Driver> |
<Driver> |
<Name>Toshiba M750</Name> |
<Setup> |
<Location Args="">\Installer Files\Drivers\Toshiba\tsi4win7.exe</Location> |
</Setup> |
</Driver> |
</Drivers> |
</Settings> |
/SWAT USB App/trunk/SWAT USB App/bin/Debug/Debug.txt |
---|
File deleted |
/SWAT USB App/trunk/SWAT USB App/bin/Debug/SWAT USB App.vshost.exe.manifest |
---|
File deleted |
/SWAT USB App/trunk/SWAT USB App/bin/Debug/SWAT USB App.exe |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/bin/Debug/SWAT USB App.pdb |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/bin/Release/SWAT USB App.exe |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/bin/Release/SWAT USB App.pdb |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/form_Drivers.Designer.cs |
---|
36,13 → 36,12 |
// |
// btn_Cancel |
// |
this.btn_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) |
| System.Windows.Forms.AnchorStyles.Right))); |
this.btn_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
this.btn_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
this.btn_Cancel.FlatStyle = System.Windows.Forms.FlatStyle.System; |
this.btn_Cancel.Location = new System.Drawing.Point(100, 61); |
this.btn_Cancel.Location = new System.Drawing.Point(100, 37); |
this.btn_Cancel.Name = "btn_Cancel"; |
this.btn_Cancel.Size = new System.Drawing.Size(82, 24); |
this.btn_Cancel.Size = new System.Drawing.Size(62, 24); |
this.btn_Cancel.TabIndex = 3; |
this.btn_Cancel.Text = "Cancel"; |
this.btn_Cancel.UseVisualStyleBackColor = true; |
50,12 → 49,11 |
// |
// btn_Ok |
// |
this.btn_Ok.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) |
| System.Windows.Forms.AnchorStyles.Right))); |
this.btn_Ok.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
this.btn_Ok.FlatStyle = System.Windows.Forms.FlatStyle.System; |
this.btn_Ok.Location = new System.Drawing.Point(12, 61); |
this.btn_Ok.Location = new System.Drawing.Point(32, 37); |
this.btn_Ok.Name = "btn_Ok"; |
this.btn_Ok.Size = new System.Drawing.Size(82, 24); |
this.btn_Ok.Size = new System.Drawing.Size(62, 24); |
this.btn_Ok.TabIndex = 2; |
this.btn_Ok.Text = "Ok"; |
this.btn_Ok.UseVisualStyleBackColor = true; |
65,7 → 63,7 |
// |
this.groupBox_DriverList.Location = new System.Drawing.Point(12, 12); |
this.groupBox_DriverList.Name = "groupBox_DriverList"; |
this.groupBox_DriverList.Size = new System.Drawing.Size(170, 43); |
this.groupBox_DriverList.Size = new System.Drawing.Size(150, 19); |
this.groupBox_DriverList.TabIndex = 1; |
this.groupBox_DriverList.TabStop = false; |
this.groupBox_DriverList.Text = "Choose Your Tablet Model"; |
76,7 → 74,7 |
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
this.CancelButton = this.btn_Cancel; |
this.ClientSize = new System.Drawing.Size(194, 97); |
this.ClientSize = new System.Drawing.Size(174, 73); |
this.Controls.Add(this.btn_Ok); |
this.Controls.Add(this.groupBox_DriverList); |
this.Controls.Add(this.btn_Cancel); |
/SWAT USB App/trunk/SWAT USB App/form_Drivers.cs |
---|
13,7 → 13,6 |
{ |
public partial class form_Drivers : Form |
{ |
public static List<string> driverList = new List<string>(); |
private static List<Process> toInstall = new List<Process>(); |
private static List<RadioButton> formRadioButton = new List<RadioButton>(); |
private static form_Drivers _driver_Form = null; |
40,7 → 39,7 |
{ |
try |
{ |
if (driverList.Count == 0) |
if (SettingsParser.DriversList.Count() == 0) |
{ |
DebugText.appendText("No drivers were found in USBSettings.xml"); |
MessageBox.Show("No drivers were found in USBSettings.xml"); |
50,46 → 49,51 |
{ |
bool modelFound = false; |
DebugText.appendText("Driver form initializing"); |
Initialization.GetModelNumber(); |
if (SettingsParser.driverCheckForMatchingModel) |
Initialization.GetModelNumber(); |
// Draws the form with a radiobutton for each driver specified in the text file |
// Location placeholder |
int nextXLocation = 6, nextYLocation = 19; |
// Updates the groupbox size to hold all the radiobuttons |
this.groupBox_DriverList.Size = new Size(149, 40 + (driverList.Count - 1) * 23); |
this.groupBox_DriverList.Size = new Size(SettingsParser.driverFormWidth - 31, 19 + SettingsParser.DriversList.Count() * 23); |
// Updates the window size to hold all the radiobuttons + buttons |
this.Size = new Size(180, 121 + (driverList.Count - 1) * 23); |
this.Size = new Size(SettingsParser.driverFormWidth, 101 + SettingsParser.DriversList.Count() * 23); |
formRadioButton.Clear(); |
// Adds a radiobutton for each software item, adds rdoBtn to list formRadioButton |
foreach (string str in driverList) |
for (int i = 0; i < SettingsParser.DriversList.Count(); i++) |
{ |
RadioButton rdoBtn = new RadioButton(); |
rdoBtn.Name = "rdo_" + str; |
rdoBtn.Name = "rdo_" + SettingsParser.DriversList[i].Name; |
rdoBtn.AutoSize = true; |
// Removes the brackets from the name |
rdoBtn.Text = str; |
rdoBtn.Text = SettingsParser.DriversList[i].Name; |
rdoBtn.Location = new Point(nextXLocation, nextYLocation); |
// Increments the location placeholder for the next radiobutton |
nextYLocation += 23; |
this.groupBox_DriverList.Controls.Add(rdoBtn); |
formRadioButton.Add(rdoBtn); |
// If model is detected, check the correct entry |
if (str.ToLower() == Initialization.computerModel.ToLower() && modelFound == false) |
if (SettingsParser.driverCheckForMatchingModel) |
// If model is detected, check the correct entry |
if (SettingsParser.DriversList[i].Name.ToLower() == Initialization.computerModel.ToLower() && modelFound == false) |
{ |
modelFound = true; |
rdoBtn.Checked = true; |
} |
} |
if (SettingsParser.driverCheckForMatchingModel) |
{ |
if (modelFound == true) |
{ |
modelFound = true; |
rdoBtn.Checked = true; |
MessageBox.Show("Drivers were found for this computer.\n" + |
"Press OK to continue then OK to install drivers."); |
} |
else |
{ |
MessageBox.Show("Drivers were not found for this computer.\n" + |
"Please go to the manufacturer's site and manually\n" + |
"download the drivers for this computer."); |
} |
} |
if (modelFound == true) |
{ |
MessageBox.Show("Drivers were found for this computer.\n" + |
"Press OK to continue then OK to install drivers."); |
} |
else |
{ |
MessageBox.Show("Drivers were not found for this computer.\n" + |
"Please go to the manufacturer's site and manually\n" + |
"download the drivers for this computer."); |
} |
} |
} |
catch (Exception ex) |
105,12 → 109,18 |
DebugText.appendText("Updating list of processes to run from list of drivers checked"); |
toInstall.Clear(); |
// Updates list toInstall with processes for each software checked |
for (int i = 0; i < driverList.Count; i++) |
for (int i = 0; i < formRadioButton.Count(); i++) |
{ |
if (formRadioButton[i].Checked) |
{ |
string[] temp; |
temp = SettingsParser.getSetupLocation(formRadioButton[i].Text); |
string[] temp = null; |
// Pulls the setup locations |
for (int j = 0; j < SettingsParser.DriversList.Count(); j++) |
if (SettingsParser.DriversList[j].Name == formRadioButton[i].Text) |
{ |
temp = SettingsParser.DriversList[j].SetupFileLocation; |
break; |
} |
for (int j = 0; j < temp.Count(); j += 2) |
{ |
Process proc = new Process(); |
151,10 → 161,6 |
} |
} |
} |
//catch (Win32Exception e) |
//{ |
//} |
catch (Exception e) |
{ |
DebugText.appendText("Exception Thrown: " + e.ToString()); |
/SWAT USB App/trunk/SWAT USB App/form_Main_Menu.cs |
---|
18,8 → 18,6 |
DebugText.startNewSession(); |
DebugText.appendText("Main menu form initializing"); |
DebugText.appendText("SWAT Drive detected as drive " + Initialization.pathToSWATDrive); |
// Debug: Shows the drive letter of the USB drive detected at startup |
//DEBUG: MessageBox.Show(Initialization.pathToSWATDrive, "Drive Letter", MessageBoxButtons.OK); |
InitializeComponent(); |
this.KeyPreview = true; |
this.KeyPress += new KeyPressEventHandler(this.form_Main_Menu_KeyPress); |
/SWAT USB App/trunk/SWAT USB App/form_Software.Designer.cs |
---|
32,18 → 32,18 |
this.btn_Cancel = new System.Windows.Forms.Button(); |
this.btn_Ok = new System.Windows.Forms.Button(); |
this.groupBox_SoftwareList = new System.Windows.Forms.GroupBox(); |
this.button1 = new System.Windows.Forms.Button(); |
this.SuspendLayout(); |
// |
// btn_Cancel |
// |
this.btn_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) |
| System.Windows.Forms.AnchorStyles.Right))); |
this.btn_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
this.btn_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
this.btn_Cancel.FlatStyle = System.Windows.Forms.FlatStyle.System; |
this.btn_Cancel.Location = new System.Drawing.Point(100, 61); |
this.btn_Cancel.Location = new System.Drawing.Point(136, 37); |
this.btn_Cancel.Name = "btn_Cancel"; |
this.btn_Cancel.Size = new System.Drawing.Size(82, 24); |
this.btn_Cancel.TabIndex = 3; |
this.btn_Cancel.Size = new System.Drawing.Size(56, 24); |
this.btn_Cancel.TabIndex = 4; |
this.btn_Cancel.Text = "Cancel"; |
this.btn_Cancel.UseVisualStyleBackColor = true; |
this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click); |
50,13 → 50,12 |
// |
// btn_Ok |
// |
this.btn_Ok.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) |
| System.Windows.Forms.AnchorStyles.Right))); |
this.btn_Ok.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
this.btn_Ok.FlatStyle = System.Windows.Forms.FlatStyle.System; |
this.btn_Ok.Location = new System.Drawing.Point(12, 61); |
this.btn_Ok.Location = new System.Drawing.Point(74, 37); |
this.btn_Ok.Name = "btn_Ok"; |
this.btn_Ok.Size = new System.Drawing.Size(82, 24); |
this.btn_Ok.TabIndex = 2; |
this.btn_Ok.Size = new System.Drawing.Size(56, 24); |
this.btn_Ok.TabIndex = 3; |
this.btn_Ok.Text = "Ok"; |
this.btn_Ok.UseVisualStyleBackColor = true; |
this.btn_Ok.Click += new System.EventHandler(this.btn_Ok_Click); |
65,11 → 64,23 |
// |
this.groupBox_SoftwareList.Location = new System.Drawing.Point(12, 12); |
this.groupBox_SoftwareList.Name = "groupBox_SoftwareList"; |
this.groupBox_SoftwareList.Size = new System.Drawing.Size(170, 43); |
this.groupBox_SoftwareList.Size = new System.Drawing.Size(180, 19); |
this.groupBox_SoftwareList.TabIndex = 1; |
this.groupBox_SoftwareList.TabStop = false; |
this.groupBox_SoftwareList.Text = "Choose Software to Install"; |
// |
// button1 |
// |
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); |
this.button1.Location = new System.Drawing.Point(12, 37); |
this.button1.Name = "button1"; |
this.button1.Size = new System.Drawing.Size(56, 24); |
this.button1.TabIndex = 2; |
this.button1.Text = "Reset"; |
this.button1.UseVisualStyleBackColor = true; |
this.button1.Click += new System.EventHandler(this.button1_Click); |
// |
// form_Software |
// |
this.AcceptButton = this.btn_Ok; |
76,7 → 87,8 |
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
this.CancelButton = this.btn_Cancel; |
this.ClientSize = new System.Drawing.Size(194, 97); |
this.ClientSize = new System.Drawing.Size(204, 73); |
this.Controls.Add(this.button1); |
this.Controls.Add(this.btn_Ok); |
this.Controls.Add(this.groupBox_SoftwareList); |
this.Controls.Add(this.btn_Cancel); |
96,5 → 108,6 |
private System.Windows.Forms.Button btn_Cancel; |
private System.Windows.Forms.Button btn_Ok; |
private System.Windows.Forms.GroupBox groupBox_SoftwareList; |
private System.Windows.Forms.Button button1; |
} |
} |
/SWAT USB App/trunk/SWAT USB App/form_Software.cs |
---|
13,9 → 13,10 |
{ |
public partial class form_Software : Form |
{ |
public static List<string> softwareList = new List<string>(); |
private static List<string> subGroups = new List<string>(); |
private static List<Process> toInstall = new List<Process>(); |
private static List<CheckBox> formCheckBoxes = new List<CheckBox>(); |
private static List<RadioButton> formRadioButton = new List<RadioButton>(); |
private static form_Software _software_Form = null; |
public static form_Software software_Form_Instance |
{ |
37,30 → 38,90 |
DebugText.appendText("Software form initializing"); |
// Draws the form with a checkbox for each software specified in the text file |
InitializeComponent(); |
// Clears all lists |
subGroups.Clear(); |
toInstall.Clear(); |
formCheckBoxes.Clear(); |
formRadioButton.Clear(); |
// Location placeholder |
int nextXLocation = 6, nextYLocation = 19; |
// Updates the groupbox size to hold all the checkboxes |
this.groupBox_SoftwareList.Size = new Size(169, 40 + (softwareList.Count - 1) * 23); |
// Updates the window size to hold all the checkboxes + buttons |
this.Size = new Size(200, 121 + (softwareList.Count - 1) * 23); |
formCheckBoxes.Clear(); |
// Adds a checkbox for each software item, adds checkbox to list formCheckBoxes |
foreach (string str in softwareList) |
{DebugText.appendText("Checking if applications in softwareList is marked as default"); |
CheckBox chkBox = new CheckBox(); |
chkBox.Name = "chk_" + str; |
chkBox.AutoSize = true; |
// Removes the brackets from the name |
chkBox.Text = str; |
// Checks the checkbox if default is set to yes |
if (SettingsParser.isDefaultCheck(str)) |
chkBox.Checked = true; |
chkBox.Location = new Point(nextXLocation, nextYLocation); |
// Increments the location placeholder for the next checkbox |
nextYLocation += 23; |
this.groupBox_SoftwareList.Controls.Add(chkBox); |
formCheckBoxes.Add(chkBox); |
// Extracts all groups from ApplicationsList |
for (int i = 0; i < SettingsParser.ApplicationsList.Count(); i++) |
if (SettingsParser.ApplicationsList[i].Group != null) |
{ |
// Check if group exists already |
bool groupExist = false; |
for (int j = 0; j < subGroups.Count(); j++) |
if (SettingsParser.ApplicationsList[i].Group == subGroups[j]) |
{ |
groupExist = true; |
break; |
} |
if (!groupExist) |
subGroups.Add(SettingsParser.ApplicationsList[i].Group); |
} |
// Updates the groupbox size to hold all the checkboxes and subgroups |
this.groupBox_SoftwareList.Size = new Size(SettingsParser.softwareFormWidth - 30, 19 + SettingsParser.ApplicationsList.Count() * 23 + (subGroups.Count() * 25)); |
// Updates the window size to hold all elements |
this.Size = new Size(SettingsParser.softwareFormWidth, 101 + SettingsParser.ApplicationsList.Count() * 23 + (subGroups.Count() * 25)); |
// Adds a checkbox for each software item that is ungrouped, adds checkbox to list formCheckBoxes |
for (int i = 0; i < SettingsParser.ApplicationsList.Count(); i++) |
{ |
if (SettingsParser.ApplicationsList[i].Group == null) |
{ |
// Creates a new checkbox |
CheckBox chkBox = new CheckBox(); |
chkBox.Name = "chk_" + SettingsParser.ApplicationsList[i].Name; |
chkBox.AutoSize = true; |
chkBox.Text = SettingsParser.ApplicationsList[i].Name; |
if (SettingsParser.ApplicationsList[i].Default) |
chkBox.Checked = true; |
chkBox.Location = new Point(nextXLocation, nextYLocation); |
// Increments the location placeholder for the next element |
nextYLocation += 23; |
// Adds the checkbox to the parent groupbox |
this.groupBox_SoftwareList.Controls.Add(chkBox); |
// Adds the checkbox to formCheckBoxes list |
formCheckBoxes.Add(chkBox); |
} |
} |
// Adds a groupbox for each entry specified in subGroups as well as any applications under the group |
for (int i = 0; i < subGroups.Count(); i++) |
{ |
// Sets the internal location coordinates for the next element |
int subNextXLocation = 6; |
int subNextYLocation = 19; |
// Creates a new groupbox |
GroupBox grpBox = new GroupBox(); |
grpBox.Name = "grp_" + subGroups[i]; |
grpBox.Text = subGroups[i]; |
// Finds the number of applications under the group |
int numberOfSubentries = 0; |
for (int j = 0; j < SettingsParser.ApplicationsList.Count(); j++) |
if (SettingsParser.ApplicationsList[j].Group == subGroups[i]) |
{ |
// If the group matches, creates a new radiobutton |
numberOfSubentries++; |
RadioButton rdoBtn = new RadioButton(); |
rdoBtn.Name = "rdo_" + SettingsParser.ApplicationsList[j].Name; |
rdoBtn.AutoSize = true; |
rdoBtn.Text = SettingsParser.ApplicationsList[j].Name; |
if (SettingsParser.ApplicationsList[j].Default) |
rdoBtn.Checked = true; |
rdoBtn.Location = new Point(subNextXLocation, subNextYLocation); |
// Increments the location placeholder for the next element |
subNextYLocation += 23; |
// Adds the radiobutton to the parent groupbox |
grpBox.Controls.Add(rdoBtn); |
// Adds the radiobutton to formRadioButton list |
formRadioButton.Add(rdoBtn); |
} |
grpBox.Size = new Size(SettingsParser.softwareFormWidth - 42, 19 + numberOfSubentries * 23); |
grpBox.Location = new Point(nextXLocation, nextYLocation); |
nextYLocation += 25 + numberOfSubentries * 23; |
// Adds the created groupbox to the parent groupbox |
this.groupBox_SoftwareList.Controls.Add(grpBox); |
} |
} |
catch (Exception e) |
{ |
73,14 → 134,19 |
try |
{ |
DebugText.appendText("Updating list of processes to run from list of software checked"); |
toInstall.Clear(); |
// Updates list toInstall with processes for each software checked |
for (int i = 0; i < softwareList.Count; i++) |
// Updates list toInstall with processes for each software checked in formCheckBoxes |
for (int i = 0; i < formCheckBoxes.Count(); i++) |
{ |
if (formCheckBoxes[i].Checked) |
{ |
string[] temp; |
temp = SettingsParser.getSetupLocation(formCheckBoxes[i].Text); |
string[] temp = null; |
// Pulls the setup locations |
for (int j = 0; j < SettingsParser.ApplicationsList.Count(); j++) |
if (SettingsParser.ApplicationsList[j].Name == formCheckBoxes[i].Text) |
{ |
temp = SettingsParser.ApplicationsList[j].SetupFileLocation; |
break; |
} |
for (int j = 0; j < temp.Count(); j += 2) |
{ |
Process proc = new Process(); |
90,6 → 156,28 |
} |
} |
} |
// Updates list toInstall with processes for each software checked in formRadioButton |
for (int i = 0; i < formRadioButton.Count(); i++) |
{ |
if (formRadioButton[i].Checked) |
{ |
string[] temp = null; |
// Pulls the setup locations |
for (int j = 0; j < SettingsParser.ApplicationsList.Count(); j++) |
if (SettingsParser.ApplicationsList[j].Name == formRadioButton[i].Text) |
{ |
temp = SettingsParser.ApplicationsList[j].SetupFileLocation; |
break; |
} |
for (int j = 0; j < temp.Count(); j += 2) |
{ |
Process proc = new Process(); |
proc.StartInfo.FileName = Initialization.pathToSWATDrive + temp[j]; |
proc.StartInfo.Arguments = temp[j + 1]; |
toInstall.Add(proc); |
} |
} |
} |
} |
catch (Exception e) |
{ |
121,10 → 209,6 |
} |
} |
} |
//catch (Win32Exception e) |
//{ |
//} |
catch (Exception e) |
{ |
DebugText.appendText("Exception Thrown: " + e.ToString()); |
142,5 → 226,12 |
DebugText.appendText("Closing software form"); |
software_Form_Instance.Close(); |
} |
private void button1_Click(object sender, EventArgs e) |
{ |
for (int i = 0; i < formCheckBoxes.Count(); i++) |
formCheckBoxes[i].Checked = false; |
for (int i = 0; i < formRadioButton.Count(); i++) |
formRadioButton[i].Checked = false; |
} |
} |
} |
/SWAT USB App/trunk/SWAT USB App/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/obj/x86/Debug/SWAT USB App.exe |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/obj/x86/Debug/SWAT USB App.pdb |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/obj/x86/Debug/SWAT_USB_App.AboutBox.resources |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/obj/x86/Release/SWAT USB App.exe |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/obj/x86/Release/SWAT USB App.pdb |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/SWAT USB App/trunk/SWAT USB App/obj/x86/Release/SWAT_USB_App.AboutBox.resources |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |