//SWAT Office App/trunk/File Diagram.vsd |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
//SWAT Office App/trunk/File Diagram.vsd |
---|
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
//SWAT Office App/trunk/SWAT Office App/Form1.resx |
---|
File deleted |
\ No newline at end of file |
//SWAT Office App/trunk/SWAT Office App/AboutBox.cs |
---|
15,7 → 15,7 |
InitializeComponent(); |
this.Text = "Program Info"; |
this.labelProductName.Text = "SWAT Office App"; |
this.labelVersion.Text = "Version 2.5.1"; |
this.labelVersion.Text = "Version 2.6"; |
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 Office App/trunk/SWAT Office App/Add_User_Account_Form.cs |
---|
69,11 → 69,19 |
if (ManageUserAccounts.AddUser(txt_Username.Text, txt_Password.Text)) |
{ |
if (this.chk_Share.Checked == true) |
ManageUserAccounts.CreateShareFolder(txt_Username.Text); |
if (!ManageUserAccounts.CreateShareFolder(txt_Username.Text)) |
{ |
DebugText.appendText("Error occured while creating shared folder"); |
MessageBox.Show("Error occured when creating shared folder", "Error"); |
} |
this.Close(); |
} |
else |
{ |
DebugText.appendText("Error occured while creating new user account"); |
MessageBox.Show("Error occured when creating new user account","Error"); |
resetForm(); |
} |
} |
} |
} |
//SWAT Office App/trunk/SWAT Office App/DebugText.cs |
---|
0,0 → 1,45 |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Text; |
using System.IO; |
using System.Windows.Forms; |
namespace SWAT_Office_App |
{ |
class DebugText |
{ |
private static string debugLocation = "StatusLog.txt"; |
public static void appendText(string text) |
{ |
// Appends passed string into Debug.txt |
if (!File.Exists(debugLocation)) |
File.Create(debugLocation); |
using (StreamWriter sw = File.AppendText(debugLocation)) |
{ |
sw.Write("[" + DateTime.Now.ToLongDateString() + " | " + DateTime.Now.ToLongTimeString() + "] -- "); |
sw.Write(text + "\r\n"); |
sw.Flush(); |
} |
} |
public static void createNewDebugTxt() |
{ |
// Deletes old Debug.txt and creates a new one |
if (File.Exists(debugLocation)) |
{ |
File.Delete(debugLocation); |
File.Create(debugLocation); |
} |
} |
public static void startNewSession() |
{ |
if (!File.Exists(debugLocation)) |
File.Create(debugLocation); |
using (StreamWriter sw = File.AppendText(debugLocation)) |
{ |
sw.Write("-- New Session --\r\n"); |
sw.Flush(); |
} |
} |
} |
} |
//SWAT Office App/trunk/SWAT Office App/Delete_User_Verify_Form.cs |
---|
24,7 → 24,7 |
private void txt_Password_TextChanged(object sender, EventArgs e) |
{ |
TextBox tb = (TextBox)sender; |
if (tb.Text == "tr33b3@rd") |
if (tb.Text == Settings_Form.globalAdminPassword) |
{ |
bool error = false; |
// Checks if any of the selected items are system accounts |
40,7 → 40,11 |
} |
} |
if (error == false) |
ManageUserAccounts.DeleteUser(selectedUsers); |
if (!ManageUserAccounts.DeleteUser(selectedUsers)) |
{ |
DebugText.appendText("Error occured when trying to delete user"); |
MessageBox.Show("Error occured when trying to delete user", "Error"); |
} |
this.Close(); |
} |
} |
//SWAT Office App/trunk/SWAT Office App/Main_Menu_Form.cs |
---|
13,6 → 13,7 |
{ |
public Menu_Main() |
{ |
DebugText.startNewSession(); |
InitializeComponent(); |
Settings_Form.ImportSettings(); |
this.KeyPress += new KeyPressEventHandler(Menu_Main_KeyPress); |
23,13 → 24,15 |
// Monitors for keypresses |
switch (e.KeyChar) |
{ |
case '1': |
case '1': // Manage User Accounts and Shares |
ManageUserAccounts_Form user_Mgmt = new ManageUserAccounts_Form(); |
user_Mgmt.ShowDialog(); |
break; |
case '2': |
case '2': // DriveLogger |
// Check to make sure that an instance of DriveLogger isnt already running |
if (!DriveLogger_Form.instanceAlreadyRunning) |
{ |
DebugText.appendText("Starting instance of DriveLogger"); |
DriveLogger_Form driveForm = new DriveLogger_Form(); |
driveForm.Show(); |
} |
38,20 → 41,22 |
MessageBox.Show("An instance of DriveLogger is already running"); |
} |
break; |
case '3': |
case '3': // Reimage USB Drives |
// Check to make sure that another imaging thread isnt running |
if (!Reimage_USB_Drives.threadsRunning) |
{ |
DebugText.appendText("Starting reimaging of USB drives"); |
Reimage_USB_Drives.reimageUSBDrives(); |
} |
else |
{ |
MessageBox.Show("Another file copy operation is currently in progress.\n" + |
"Please wait for transfer to finish before starting another"); |
} |
break; |
case '4': |
case '4': // Program Settings |
SettingsVerify_Form settingsForm = new SettingsVerify_Form(); |
settingsForm.ShowDialog(); |
break; |
case '?': |
case '?': // About |
AboutBox aboutForm = new AboutBox(); |
aboutForm.ShowDialog(); |
break; |
59,35 → 64,39 |
} |
private void btn_Main_UserMgmt_Click(object sender, EventArgs e) |
{ |
// Manage User Accounts and Shares |
ManageUserAccounts_Form userMgmtForm = new ManageUserAccounts_Form(); |
userMgmtForm.ShowDialog(); |
} |
private void btn_DriveLogger_Click(object sender, EventArgs e) |
{ |
// DriveLogger |
if (!DriveLogger_Form.instanceAlreadyRunning) |
{ |
DebugText.appendText("Starting instance of DriveLogger"); |
DriveLogger_Form driveForm = new DriveLogger_Form(); |
driveForm.Show(); |
} |
else |
{ |
MessageBox.Show("An instance of DriveLogger is already running"); |
} |
} |
private void btn_Main_Settings_Click(object sender, EventArgs e) |
{ |
SettingsVerify_Form settingsForm = new SettingsVerify_Form(); |
settingsForm.ShowDialog(); |
} |
private void btn_Reimage_USB_Drives_Click(object sender, EventArgs e) |
{ |
if (!DriveLogger_Form.instanceAlreadyRunning) |
// Reimage USB Drives |
if (!Reimage_USB_Drives.threadsRunning) |
{ |
DebugText.appendText("Starting reimaging of USB drives"); |
Reimage_USB_Drives.reimageUSBDrives(); |
} |
else |
{ |
MessageBox.Show("Another file copy operation is currently in progress.\n" + |
"Please wait for transfer to finish before starting another"); |
} |
} |
private void btn_Main_Settings_Click(object sender, EventArgs e) |
{ |
// Program Settings |
SettingsVerify_Form settingsForm = new SettingsVerify_Form(); |
settingsForm.ShowDialog(); |
} |
} |
} |
//SWAT Office App/trunk/SWAT Office App/Manage_User_Accounts.cs |
---|
6,50 → 6,83 |
using System.IO; |
using System.Windows.Forms; |
using System.Security.AccessControl; |
using System.DirectoryServices.AccountManagement; |
namespace SWAT_Office_App |
{ |
class ManageUserAccounts |
{ |
public static List<string> UserAccountsList = new List<string>(); |
private static string studentGroupName = "StudentAccounts"; |
public static List<UserPrincipal> UserAccountsList = new List<UserPrincipal>(); |
public static bool AddUser(string username, string password) |
{ |
try |
{ |
// Returns true if user was added successfully |
foreach (string user in UserAccountsList) |
PrincipalContext localSystem = new PrincipalContext(ContextType.Machine); |
// Creates a new user after checking if it already exists or not |
UserPrincipal newUser = new UserPrincipal(localSystem); |
newUser.Name = username; |
PrincipalSearcher searcher = new PrincipalSearcher(newUser); |
Principal result = searcher.FindOne(); |
if (result == null) |
{ |
if (username.ToLower() == user.ToLower()) |
newUser = new UserPrincipal(localSystem); |
newUser.Name = username; |
newUser.SetPassword(password); |
newUser.PasswordNeverExpires = true; |
newUser.PasswordNotRequired = false; |
newUser.UserCannotChangePassword = true; |
newUser.Description = DateTime.Now.ToShortDateString(); |
newUser.Save(); |
// Creates a new group after checking if it already exists or not |
GroupPrincipal studentGroup = new GroupPrincipal(localSystem); |
studentGroup.Name = studentGroupName; |
searcher = new PrincipalSearcher(studentGroup); |
result = searcher.FindOne(); |
// Creates group if it doesnt already exist |
if (result == null) |
{ |
MessageBox.Show("Username already exists", "Error"); |
return false; |
studentGroup = new GroupPrincipal(localSystem, studentGroupName); |
studentGroup.Name = studentGroupName; |
studentGroup.IsSecurityGroup = true; |
studentGroup.Members.Add(newUser); |
studentGroup.Save(); |
} |
// Otherwise add to existing group |
else |
{ |
studentGroup = (GroupPrincipal)result; |
studentGroup.Members.Add(newUser); |
studentGroup.Save(); |
} |
DebugText.appendText("Account " + username + " has been created"); |
return true; |
} |
Process netProcess = new Process(); |
netProcess.StartInfo.WorkingDirectory = System.Environment.SystemDirectory; |
netProcess.StartInfo.FileName = "net.exe"; |
netProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
netProcess.StartInfo.CreateNoWindow = true; |
// Arguments for user account creation. Run NET HELP USER from the command prompt for more info. |
netProcess.StartInfo.Arguments = "USER \"" + username + "\" \"" + password + |
"\" /ADD /ACTIVE:YES /PASSWORDCHG:NO /PASSWORDREQ:YES /EXPIRES:NEVER /COMMENT:" + DateTime.Now.ToShortDateString(); |
netProcess.Start(); |
netProcess.WaitForExit(); |
netProcess.Close(); |
return true; |
else |
{ |
// local account already exists, return with error |
return false; |
} |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return false; |
} |
} |
public static void DeleteUser(List<string> usernames) |
public static bool DeleteUser(List<string> usernames) |
{ |
try |
{ |
bool Success = true; |
PrincipalContext localSystem = new PrincipalContext(ContextType.Machine); |
// Iterates through and deletes selected users |
foreach (string user in usernames) |
{ |
bool deleteShare = false; |
if (Directory.Exists(Settings_Form.sharedFolderLocation + @"\" + user)) |
{ |
// Prompts for deletion of folder as well as the user account |
57,116 → 90,59 |
"\nDelete the folder and all data within the folder?", |
"Warning!", MessageBoxButtons.YesNo); |
if (result == DialogResult.Yes) |
{ |
Process netProcess = new Process(); |
netProcess.StartInfo.WorkingDirectory = System.Environment.SystemDirectory; |
netProcess.StartInfo.FileName = "net.exe"; |
netProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
netProcess.StartInfo.CreateNoWindow = true; |
// Arguments for user account deletion. Run NET HELP USER from the command prompt for more info. |
netProcess.StartInfo.Arguments = "USER \"" + user + "\" /DELETE"; |
netProcess.Start(); |
netProcess.WaitForExit(); |
netProcess.Close(); |
DeleteShareFolder(user); |
} |
deleteShare = true; |
} |
// If no folders exist for the user, account is deleted without prompting |
else |
{ |
Process netProcess = new Process(); |
netProcess.StartInfo.WorkingDirectory = System.Environment.SystemDirectory; |
netProcess.StartInfo.FileName = "net.exe"; |
netProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
netProcess.StartInfo.CreateNoWindow = true; |
// Arguments for user account deletion. Run NET HELP USER from the command prompt for more info. |
netProcess.StartInfo.Arguments = "USER \"" + user + "\" /DELETE"; |
netProcess.Start(); |
netProcess.WaitForExit(); |
netProcess.Close(); |
} |
// Finds and deletes user and share |
UserPrincipal toDelete = new UserPrincipal(localSystem); |
toDelete.Name = user; |
PrincipalSearcher searcher = new PrincipalSearcher(toDelete); |
Principal found = searcher.FindOne(); |
toDelete = (UserPrincipal)found; |
toDelete.Delete(); |
DebugText.appendText("Account " + user + " has been deleted"); |
// Deletes share if selected |
if (deleteShare) |
if (!DeleteShareFolder(user)) |
Success = false; |
} |
return Success; |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return false; |
} |
} |
public static void QueryUserAccounts() |
public static bool QueryUserAccounts() |
{ |
// Function that reads the user accounts on the local computer to UserAccountsList |
UserAccountsList.Clear(); |
try |
{ |
Process netProcess = new Process(); |
netProcess.StartInfo.WorkingDirectory = System.Environment.SystemDirectory; |
netProcess.StartInfo.FileName = "net.exe"; |
netProcess.StartInfo.UseShellExecute = false; |
netProcess.StartInfo.RedirectStandardOutput = true; |
netProcess.StartInfo.CreateNoWindow = true; |
netProcess.StartInfo.Arguments = "USER"; |
netProcess.Start(); |
string netOutput = netProcess.StandardOutput.ReadToEnd(); |
// Splits the output into seperate strings for further processing |
string[] tempSplit = netOutput.Split(new string[] { " ", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries); |
// Roundabout way of trimming each string in the array |
string[] netOutputSplit = new string[tempSplit.Length]; |
for (int i = 0; i < tempSplit.Length; i++) |
netOutputSplit[i] = tempSplit[i].Trim(); |
// Imports the string array into the UserAccountsList List |
UserAccountsList.AddRange(netOutputSplit); |
// Removes the header and footer from the List |
UserAccountsList.RemoveRange(0, 2); |
UserAccountsList.RemoveRange(UserAccountsList.Count() - 1, 1); |
// Removes any additional empty entries |
UserAccountsList.RemoveAll(IsStringBlank); |
netProcess.WaitForExit(); |
netProcess.Close(); |
PrincipalContext localSystem = new PrincipalContext(ContextType.Machine); |
UserPrincipal user = new UserPrincipal(localSystem); |
user.Name = "*"; |
PrincipalSearcher searcher = new PrincipalSearcher(user); |
PrincipalSearchResult<Principal> result = searcher.FindAll(); |
foreach (Principal p in result) |
UserAccountsList.Add((UserPrincipal)p); |
return true; |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return false; |
} |
} |
public static string [] QueryUserAccountExtraInformation(string username) |
{ |
// Returns a string array with password requirement and date of account creation |
string[] stringArray = { "", "" }; |
try |
{ |
Process netProcess = new Process(); |
netProcess.StartInfo.WorkingDirectory = System.Environment.SystemDirectory; |
netProcess.StartInfo.FileName = "net.exe"; |
netProcess.StartInfo.UseShellExecute = false; |
netProcess.StartInfo.RedirectStandardOutput = true; |
netProcess.StartInfo.CreateNoWindow = true; |
netProcess.StartInfo.Arguments = "USER " + "\"" + username + "\""; |
netProcess.Start(); |
string netOutput = netProcess.StandardOutput.ReadToEnd(); |
// Splits the output into seperate strings for further processing |
string[] tempSplit = netOutput.Split(new string[] { " ", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries); |
// Roundabout way of trimming each string in the array |
string[] netOutputSplit = new string[tempSplit.Length]; |
for (int i = 0; i < tempSplit.Length; i++) |
netOutputSplit[i] = tempSplit[i].Trim(); |
stringArray[0] = netOutputSplit[20]; |
stringArray[1] = netOutputSplit[4]; |
netProcess.WaitForExit(); |
netProcess.Close(); |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
} |
return stringArray; |
} |
public static bool QueryUserSharedFolderExist(string username) |
{ |
return Directory.Exists(Settings_Form.sharedFolderLocation + @"\" + username); |
} |
public static void CreateShareFolder(string username) |
public static bool CreateShareFolder(string username) |
{ |
try |
173,41 → 149,52 |
{ |
// Creates the directory with only the specific NTFS and share permissions for the user. |
DirectorySecurity dSecurity = new DirectorySecurity(); |
// Adds NTFS permissions for system accounts |
foreach (string systemUser in Settings_Form.systemAccounts) |
{ |
dSecurity.AddAccessRule(new FileSystemAccessRule("\\" + systemUser, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow)); |
dSecurity.AddAccessRule(new FileSystemAccessRule("\\" + systemUser, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow)); |
} |
//dSecurity.AddAccessRule(new FileSystemAccessRule("\\Administrator", FileSystemRights.FullControl, AccessControlType.Allow)); |
//dSecurity.AddAccessRule(new FileSystemAccessRule("\\SWAT", FileSystemRights.FullControl, AccessControlType.Allow)); |
//dSecurity.AddAccessRule(new FileSystemAccessRule("\\Administrators", FileSystemRights.FullControl, AccessControlType.Allow)); |
// Adds NTFS permissions for the user |
dSecurity.AddAccessRule(new FileSystemAccessRule("\\" + username, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow)); |
dSecurity.AddAccessRule(new FileSystemAccessRule("\\" + username, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow)); |
Directory.CreateDirectory(Settings_Form.sharedFolderLocation + @"\" + username, dSecurity); |
SetSharePermissions(username); |
DebugText.appendText("Shared folder for " + username + " has been created"); |
return SetSharePermissions(username); |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return false; |
} |
} |
public static void DeleteShareFolder(string username) |
public static bool DeleteShareFolder(string username) |
{ |
try |
{ |
bool Success = true; |
// Removes the share BEFORE deleting the folder. Otherwise share will error on remove. |
RemoveSharePermissions(username); |
if (!RemoveSharePermissions(username)) |
Success = false; |
Directory.Delete(Settings_Form.sharedFolderLocation + @"\" + username, true); |
DebugText.appendText("Shared folder for " + username + " has been deleted"); |
return Success; |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return false; |
} |
} |
public static void ToggleShare(string username) |
public static bool ToggleShare(string username) |
{ |
try |
{ |
// Checks if a share already exists for the user |
if (Directory.Exists(Settings_Form.sharedFolderLocation + @"\" + username)) |
{ |
DialogResult result = MessageBox.Show("A shared folder exists for the user " + username + "!" + |
214,18 → 201,19 |
"\nDelete the folder and all data within the folder?", |
"Warning!", MessageBoxButtons.YesNo); |
if (result == DialogResult.Yes) |
{ |
DeleteShareFolder(username); |
} |
return DeleteShareFolder(username); |
} |
// Otherwise creates the share for the user |
else |
{ |
CreateShareFolder(username); |
} |
return CreateShareFolder(username); |
return true; |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return false; |
} |
} |
public static long GetShareSize(string username) |
234,29 → 222,62 |
long size = GetDirSize(dir); |
return size; |
} |
public static void ChangeUserPassword(string username, string password) |
private static long GetDirSize(DirectoryInfo input) |
{ |
try |
{ |
Process netProcess = new Process(); |
netProcess.StartInfo.WorkingDirectory = System.Environment.SystemDirectory; |
netProcess.StartInfo.FileName = "net.exe"; |
netProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
netProcess.StartInfo.CreateNoWindow = true; |
// Arguments for changing user password. Run NET HELP USER from the command prompt for more info. |
netProcess.StartInfo.Arguments = "USER \"" + username + "\" \"" + password + "\""; |
netProcess.Start(); |
netProcess.WaitForExit(); |
netProcess.Close(); |
if (input.Exists) |
{ |
long size = 0; |
FileInfo[] files = input.GetFiles(); |
foreach (FileInfo file in files) |
{ |
size += file.Length; |
} |
DirectoryInfo[] dirs = input.GetDirectories(); |
foreach (DirectoryInfo dir in dirs) |
{ |
size += GetDirSize(dir); |
} |
return size; |
} |
else |
return 0; |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return 0; |
} |
} |
public static bool ChangeUserPassword(string username, string password) |
{ |
try |
{ |
// Queries for the specified user password |
PrincipalContext localSystem = new PrincipalContext(ContextType.Machine); |
UserPrincipal user = new UserPrincipal(localSystem); |
user.Name = username; |
PrincipalSearcher searcher = new PrincipalSearcher(user); |
Principal result = searcher.FindOne(); |
user = (UserPrincipal)result; |
user.SetPassword(password); |
user.Save(); |
DebugText.appendText("Password for " + username + " has been changed"); |
return true; |
} |
catch (Exception e) |
{ |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return false; |
} |
} |
public static bool SessionsOpen() |
{ |
bool sessionsOpen = true; |
try |
{ |
Process netProcess = new Process(); |
274,43 → 295,19 |
netProcess.Close(); |
if (tempSplit[0] == "There are no entries in the list.") |
sessionsOpen = false; |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
} |
return sessionsOpen; |
} |
private static long GetDirSize(DirectoryInfo entry) |
{ |
try |
{ |
if (entry.Exists) |
{ |
long size = 0; |
FileInfo[] files = entry.GetFiles(); |
foreach (FileInfo file in files) |
{ |
size += file.Length; |
} |
DirectoryInfo[] dirs = entry.GetDirectories(); |
foreach (DirectoryInfo dir in dirs) |
{ |
size += GetDirSize(dir); |
} |
return size; |
} |
return false; |
else |
return 0; |
return true; |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
return 0; |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return true; |
} |
} |
private static void SetSharePermissions(string username) |
private static bool SetSharePermissions(string username) |
{ |
string combinationString = ""; |
foreach (string systemUser in Settings_Form.systemAccounts) |
329,13 → 326,18 |
netProcess.Start(); |
netProcess.WaitForExit(); |
netProcess.Close(); |
DebugText.appendText("Share permissions for " + username + " has been set"); |
return true; |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return false; |
} |
} |
private static void RemoveSharePermissions(string username) |
private static bool RemoveSharePermissions(string username) |
{ |
try |
{ |
348,18 → 350,16 |
netProcess.Start(); |
netProcess.WaitForExit(); |
netProcess.Close(); |
DebugText.appendText("Share permissions for " + username + " has been removed"); |
return true; |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString(), "Error"); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
return false; |
} |
} |
private static bool IsStringBlank(string s) |
{ |
if (s == "") |
return true; |
else |
return false; |
} |
} |
} |
//SWAT Office App/trunk/SWAT Office App/Manage_User_Accounts_Form.cs |
---|
6,6 → 6,7 |
using System.Linq; |
using System.Text; |
using System.Windows.Forms; |
using System.DirectoryServices.AccountManagement; |
namespace SWAT_Office_App |
{ |
17,28 → 18,23 |
// Designate columns to include in listview for the Manage User Accounts Form |
ColumnHeader Column_1 = new ColumnHeader(); |
Column_1.Text = "Username"; |
Column_1.Width = 101; |
Column_1.Width = 121; |
this.lst_UserAccounts.Columns.Add(Column_1); |
ColumnHeader Column_2 = new ColumnHeader(); |
Column_2.Text = "Pass?"; |
Column_2.Text = "Share"; |
Column_2.Width = 46; |
Column_2.TextAlign = HorizontalAlignment.Center; |
this.lst_UserAccounts.Columns.Add(Column_2); |
ColumnHeader Column_3 = new ColumnHeader(); |
Column_3.Text = "Share?"; |
Column_3.Width = 46; |
Column_3.Text = "Size"; |
Column_3.Width = 75; |
Column_3.TextAlign = HorizontalAlignment.Center; |
this.lst_UserAccounts.Columns.Add(Column_3); |
ColumnHeader Column_4 = new ColumnHeader(); |
Column_4.Text = "Size"; |
Column_4.Width = 50; |
Column_4.Text = "Date Created"; |
Column_4.Width = 80; |
Column_4.TextAlign = HorizontalAlignment.Center; |
this.lst_UserAccounts.Columns.Add(Column_4); |
ColumnHeader Column_5 = new ColumnHeader(); |
Column_5.Text = "Date Created"; |
Column_5.Width = 80; |
Column_5.TextAlign = HorizontalAlignment.Center; |
this.lst_UserAccounts.Columns.Add(Column_5); |
PaintUserListbox(); |
this.btn_Delete.Enabled = false; |
51,78 → 47,76 |
} |
private void PaintUserListbox() |
{ |
// Function for refreshing/painting the listbox |
this.lst_UserAccounts.BeginUpdate(); |
ManageUserAccounts.QueryUserAccounts(); |
try |
{ |
// Function for refreshing/painting the listbox |
this.lst_UserAccounts.BeginUpdate(); |
ManageUserAccounts.QueryUserAccounts(); |
// Temporary entries in listview |
//ListViewItem entry; |
//ListViewItem.ListViewSubItem s_entry; |
//entry = new ListViewItem(); |
//entry.Text = "TestUser"; |
//s_entry = new ListViewItem.ListViewSubItem(); |
//s_entry.Text = "Yes"; |
//entry.SubItems.Add(s_entry); |
//s_entry = new ListViewItem.ListViewSubItem(); |
//s_entry.Text = "Yes"; |
//entry.SubItems.Add(s_entry); |
//s_entry = new ListViewItem.ListViewSubItem(); |
//s_entry.Text = "01/05/2010"; |
//entry.SubItems.Add(s_entry); |
//this.lst_User_Accounts.Items.Add(entry); |
// Temporary entries in listview |
//ListViewItem entry; |
//ListViewItem.ListViewSubItem s_entry; |
//entry = new ListViewItem(); |
//entry.Text = "TestUser"; |
//s_entry = new ListViewItem.ListViewSubItem(); |
//s_entry.Text = "Yes"; |
//entry.SubItems.Add(s_entry); |
//s_entry = new ListViewItem.ListViewSubItem(); |
//s_entry.Text = "Yes"; |
//entry.SubItems.Add(s_entry); |
//s_entry = new ListViewItem.ListViewSubItem(); |
//s_entry.Text = "01/05/2010"; |
//entry.SubItems.Add(s_entry); |
//this.lst_User_Accounts.Items.Add(entry); |
this.lst_UserAccounts.Items.Clear(); |
// Prevents system accounts from showing, depending on settings |
foreach (string user in ManageUserAccounts.UserAccountsList) |
{ |
ListViewItem entry = new ListViewItem(); |
bool remove = false; |
foreach (string hiddenUser in Settings_Form.hiddenAccounts) |
this.lst_UserAccounts.Items.Clear(); |
// Prevents system accounts from showing, depending on settings |
foreach (UserPrincipal user in ManageUserAccounts.UserAccountsList) |
{ |
if (user.ToLower() == hiddenUser.ToLower()) |
ListViewItem entry = new ListViewItem(); |
bool remove = false; |
foreach (string hiddenUser in Settings_Form.hiddenAccounts) |
{ |
remove = true; |
break; |
if (user.Name.ToLower() == hiddenUser.ToLower()) |
{ |
remove = true; |
break; |
} |
} |
} |
// Adds the subitem columns for each entry |
if (remove == false) |
{ |
ListViewItem.ListViewSubItem s_password = new ListViewItem.ListViewSubItem(); |
string[] extraUserInformation = ManageUserAccounts.QueryUserAccountExtraInformation(user); |
s_password.Text = extraUserInformation[0]; |
entry.SubItems.Add(s_password); |
ListViewItem.ListViewSubItem s_share = new ListViewItem.ListViewSubItem(); |
if (ManageUserAccounts.QueryUserSharedFolderExist(user)) |
s_share.Text = "Yes"; |
else |
s_share.Text = "No"; |
entry.SubItems.Add(s_share); |
ListViewItem.ListViewSubItem s_size = new ListViewItem.ListViewSubItem(); |
if (Settings_Form.showFileSizes) |
// Populates the subitem columns for each entry |
if (remove == false) |
{ |
long size = ManageUserAccounts.GetShareSize(user); |
ListViewItem.ListViewSubItem s_share = new ListViewItem.ListViewSubItem(); |
if (ManageUserAccounts.QueryUserSharedFolderExist(user.Name)) |
s_share.Text = "Yes"; |
else |
s_share.Text = "No"; |
entry.SubItems.Add(s_share); |
ListViewItem.ListViewSubItem s_size = new ListViewItem.ListViewSubItem(); |
long size = ManageUserAccounts.GetShareSize(user.Name); |
if ((size / 1073741824) > 0) |
s_size.Text = (size / 1073741824).ToString() + " GB"; |
else |
s_size.Text = (size / 1048576).ToString() + " MB"; |
entry.SubItems.Add(s_size); |
ListViewItem.ListViewSubItem s_datecreated = new ListViewItem.ListViewSubItem(); |
s_datecreated.Text = user.Description; |
entry.SubItems.Add(s_datecreated); |
} |
else |
if (remove == false) |
{ |
s_size.Text = "NA"; |
entry.Text = user.Name; |
this.lst_UserAccounts.Items.Add(entry); |
} |
entry.SubItems.Add(s_size); |
ListViewItem.ListViewSubItem s_datecreated = new ListViewItem.ListViewSubItem(); |
s_datecreated.Text = extraUserInformation[1]; |
entry.SubItems.Add(s_datecreated); |
} |
if (remove == false) |
{ |
entry.Text = user; |
this.lst_UserAccounts.Items.Add(entry); |
} |
this.lst_UserAccounts.EndUpdate(); |
} |
this.lst_UserAccounts.EndUpdate(); |
catch (Exception e) |
{ |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
private void lst_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) |
{ |
130,7 → 124,7 |
} |
private void lst_ValidateAll() |
{ |
// Disables certain buttons depending on number of items selected |
// Enables/disables certain buttons depending on number of items selected |
ListView.SelectedListViewItemCollection collection = this.lst_UserAccounts.SelectedItems; |
if (collection.Count == 0) |
154,7 → 148,7 |
this.btn_Delete.Enabled = true; |
this.btn_Pass.Enabled = true; |
this.btn_Share.Enabled = true; |
ListViewItem.ListViewSubItem subItem = collection[0].SubItems[2]; |
ListViewItem.ListViewSubItem subItem = collection[0].SubItems[1]; |
if (subItem.Text == "Yes") |
this.btn_OpenShare.Enabled = true; |
else |
197,7 → 191,7 |
} |
private void btn_Delete_Click(object sender, EventArgs e) |
{ |
if (ManageUserAccounts.SessionsOpen() == false) |
if (!ManageUserAccounts.SessionsOpen()) |
{ |
ListView.SelectedListViewItemCollection selectedItems = this.lst_UserAccounts.SelectedItems; |
List<string> userList = new List<string>(); |
//SWAT Office App/trunk/SWAT Office App/Reimage_USB_Drive_Progress_Form.cs |
---|
54,7 → 54,9 |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString()); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
delegate void closeForm_(); |
71,7 → 73,9 |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString()); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
} |
//SWAT Office App/trunk/SWAT Office App/Reimage_USB_Drives.cs |
---|
80,7 → 80,7 |
} |
else |
{ |
MessageBox.Show("bootsect.exe is missing from the master image location"); |
MessageBox.Show("bootsect.exe is missing from the master image location","Error"); |
} |
} |
else |
90,7 → 90,9 |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString()); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
private static void bwThread_DoWork(object sender, DoWorkEventArgs e) |
213,7 → 215,9 |
} |
catch (Exception ex) |
{ |
MessageBox.Show(ex.ToString()); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(ex.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
static void fileCopyThread32_DoWork(object sender, DoWorkEventArgs e) |
328,7 → 332,9 |
} |
catch (Exception ex) |
{ |
MessageBox.Show(ex.ToString()); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(ex.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
} |
//SWAT Office App/trunk/SWAT Office App/Reset_User_Password_Form.cs |
---|
25,8 → 25,7 |
} |
private void txt_Box1_TextChanged(object sender, EventArgs e) |
{ |
// Office password is set here |
if (txt_Password1.Text == "tr33b3@rd") |
if (txt_Password1.Text == Settings_Form.globalAdminPassword) |
{ |
this.txt_Password1.Visible = false; |
this.txt_Password2.Visible = true; |
49,7 → 48,11 |
} |
private void btn_Ok_Click(object sender, EventArgs e) |
{ |
ManageUserAccounts.ChangeUserPassword(selectedUsername, txt_Password2.Text); |
if (!ManageUserAccounts.ChangeUserPassword(selectedUsername, txt_Password2.Text)) |
{ |
DebugText.appendText("Error occured while changing password"); |
MessageBox.Show("Error occured while changing password", "Error"); |
} |
this.Close(); |
} |
} |
//SWAT Office App/trunk/SWAT Office App/SWAT Office App.csproj |
---|
54,6 → 54,7 |
<ItemGroup> |
<Reference Include="System" /> |
<Reference Include="System.Core" /> |
<Reference Include="System.DirectoryServices.AccountManagement" /> |
<Reference Include="System.Xml.Linq" /> |
<Reference Include="System.Data.DataSetExtensions" /> |
<Reference Include="Microsoft.CSharp" /> |
88,6 → 89,7 |
<Compile Include="Add_User_Account_Form.Designer.cs"> |
<DependentUpon>Add_User_Account_Form.cs</DependentUpon> |
</Compile> |
<Compile Include="DebugText.cs" /> |
<Compile Include="Delete_User_Verify_Form.cs"> |
<SubType>Form</SubType> |
</Compile> |
//SWAT Office App/trunk/SWAT Office App/Settings_Form.Designer.cs |
---|
29,7 → 29,6 |
private void InitializeComponent() |
{ |
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Settings_Form)); |
this.chk_PassReq = new System.Windows.Forms.CheckBox(); |
this.btn_Ok = new System.Windows.Forms.Button(); |
this.btn_Cancel = new System.Windows.Forms.Button(); |
this.listBox_SystemAccounts = new System.Windows.Forms.ListBox(); |
55,20 → 54,9 |
this.groupBox_HiddenAccounts.SuspendLayout(); |
this.SuspendLayout(); |
// |
// chk_PassReq |
// |
this.chk_PassReq.AutoSize = true; |
this.chk_PassReq.Enabled = false; |
this.chk_PassReq.Location = new System.Drawing.Point(12, 12); |
this.chk_PassReq.Name = "chk_PassReq"; |
this.chk_PassReq.Size = new System.Drawing.Size(160, 17); |
this.chk_PassReq.TabIndex = 1; |
this.chk_PassReq.Text = "Require Complex Passwords"; |
this.chk_PassReq.UseVisualStyleBackColor = true; |
// |
// btn_Ok |
// |
this.btn_Ok.Location = new System.Drawing.Point(72, 328); |
this.btn_Ok.Location = new System.Drawing.Point(72, 305); |
this.btn_Ok.Name = "btn_Ok"; |
this.btn_Ok.Size = new System.Drawing.Size(52, 23); |
this.btn_Ok.TabIndex = 11; |
79,7 → 67,7 |
// btn_Cancel |
// |
this.btn_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
this.btn_Cancel.Location = new System.Drawing.Point(130, 328); |
this.btn_Cancel.Location = new System.Drawing.Point(130, 305); |
this.btn_Cancel.Name = "btn_Cancel"; |
this.btn_Cancel.Size = new System.Drawing.Size(52, 23); |
this.btn_Cancel.TabIndex = 12; |
120,7 → 108,7 |
this.groupBox_SystemAccounts.Controls.Add(this.listBox_SystemAccounts); |
this.groupBox_SystemAccounts.Controls.Add(this.btn_SystemRemove); |
this.groupBox_SystemAccounts.Controls.Add(this.btn_SystemAdd); |
this.groupBox_SystemAccounts.Location = new System.Drawing.Point(12, 35); |
this.groupBox_SystemAccounts.Location = new System.Drawing.Point(12, 12); |
this.groupBox_SystemAccounts.Name = "groupBox_SystemAccounts"; |
this.groupBox_SystemAccounts.Size = new System.Drawing.Size(170, 82); |
this.groupBox_SystemAccounts.TabIndex = 4; |
129,7 → 117,7 |
// |
// txt_ShareLocation |
// |
this.txt_ShareLocation.Location = new System.Drawing.Point(12, 224); |
this.txt_ShareLocation.Location = new System.Drawing.Point(12, 201); |
this.txt_ShareLocation.Name = "txt_ShareLocation"; |
this.txt_ShareLocation.Size = new System.Drawing.Size(112, 20); |
this.txt_ShareLocation.TabIndex = 5; |
137,7 → 125,7 |
// lbl_ShareLocation |
// |
this.lbl_ShareLocation.AutoSize = true; |
this.lbl_ShareLocation.Location = new System.Drawing.Point(12, 208); |
this.lbl_ShareLocation.Location = new System.Drawing.Point(12, 185); |
this.lbl_ShareLocation.Name = "lbl_ShareLocation"; |
this.lbl_ShareLocation.Size = new System.Drawing.Size(117, 13); |
this.lbl_ShareLocation.TabIndex = 10; |
145,7 → 133,7 |
// |
// btn_ShareLocationChange |
// |
this.btn_ShareLocationChange.Location = new System.Drawing.Point(130, 223); |
this.btn_ShareLocationChange.Location = new System.Drawing.Point(130, 200); |
this.btn_ShareLocationChange.Name = "btn_ShareLocationChange"; |
this.btn_ShareLocationChange.Size = new System.Drawing.Size(52, 22); |
this.btn_ShareLocationChange.TabIndex = 6; |
159,7 → 147,7 |
// |
// btn_USBLocationx32Change |
// |
this.btn_USBLocationx32Change.Location = new System.Drawing.Point(130, 262); |
this.btn_USBLocationx32Change.Location = new System.Drawing.Point(130, 239); |
this.btn_USBLocationx32Change.Name = "btn_USBLocationx32Change"; |
this.btn_USBLocationx32Change.Size = new System.Drawing.Size(52, 22); |
this.btn_USBLocationx32Change.TabIndex = 8; |
169,7 → 157,7 |
// |
// txt_USBMasterCopyLocation_x32 |
// |
this.txt_USBMasterCopyLocation_x32.Location = new System.Drawing.Point(12, 263); |
this.txt_USBMasterCopyLocation_x32.Location = new System.Drawing.Point(12, 240); |
this.txt_USBMasterCopyLocation_x32.Name = "txt_USBMasterCopyLocation_x32"; |
this.txt_USBMasterCopyLocation_x32.Size = new System.Drawing.Size(112, 20); |
this.txt_USBMasterCopyLocation_x32.TabIndex = 7; |
177,7 → 165,7 |
// lbl_USBCopyLocation_x32 |
// |
this.lbl_USBCopyLocation_x32.AutoSize = true; |
this.lbl_USBCopyLocation_x32.Location = new System.Drawing.Point(12, 247); |
this.lbl_USBCopyLocation_x32.Location = new System.Drawing.Point(12, 224); |
this.lbl_USBCopyLocation_x32.Name = "lbl_USBCopyLocation_x32"; |
this.lbl_USBCopyLocation_x32.Size = new System.Drawing.Size(155, 13); |
this.lbl_USBCopyLocation_x32.TabIndex = 15; |
185,7 → 173,7 |
// |
// btn_USBLocationx64Change |
// |
this.btn_USBLocationx64Change.Location = new System.Drawing.Point(130, 300); |
this.btn_USBLocationx64Change.Location = new System.Drawing.Point(130, 277); |
this.btn_USBLocationx64Change.Name = "btn_USBLocationx64Change"; |
this.btn_USBLocationx64Change.Size = new System.Drawing.Size(52, 22); |
this.btn_USBLocationx64Change.TabIndex = 10; |
195,7 → 183,7 |
// |
// txt_USBMasterCopyLocation_x64 |
// |
this.txt_USBMasterCopyLocation_x64.Location = new System.Drawing.Point(12, 302); |
this.txt_USBMasterCopyLocation_x64.Location = new System.Drawing.Point(12, 279); |
this.txt_USBMasterCopyLocation_x64.Name = "txt_USBMasterCopyLocation_x64"; |
this.txt_USBMasterCopyLocation_x64.Size = new System.Drawing.Size(112, 20); |
this.txt_USBMasterCopyLocation_x64.TabIndex = 9; |
203,7 → 191,7 |
// lbl_USBCopyLocation_x64 |
// |
this.lbl_USBCopyLocation_x64.AutoSize = true; |
this.lbl_USBCopyLocation_x64.Location = new System.Drawing.Point(12, 286); |
this.lbl_USBCopyLocation_x64.Location = new System.Drawing.Point(12, 263); |
this.lbl_USBCopyLocation_x64.Name = "lbl_USBCopyLocation_x64"; |
this.lbl_USBCopyLocation_x64.Size = new System.Drawing.Size(155, 13); |
this.lbl_USBCopyLocation_x64.TabIndex = 18; |
214,7 → 202,7 |
this.groupBox_HiddenAccounts.Controls.Add(this.listBox_HiddenAccounts); |
this.groupBox_HiddenAccounts.Controls.Add(this.btn_HiddenRemove); |
this.groupBox_HiddenAccounts.Controls.Add(this.btn_HiddenAdd); |
this.groupBox_HiddenAccounts.Location = new System.Drawing.Point(12, 123); |
this.groupBox_HiddenAccounts.Location = new System.Drawing.Point(12, 100); |
this.groupBox_HiddenAccounts.Name = "groupBox_HiddenAccounts"; |
this.groupBox_HiddenAccounts.Size = new System.Drawing.Size(170, 82); |
this.groupBox_HiddenAccounts.TabIndex = 19; |
252,7 → 240,7 |
// btn_Default |
// |
this.btn_Default.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); |
this.btn_Default.Location = new System.Drawing.Point(12, 331); |
this.btn_Default.Location = new System.Drawing.Point(12, 308); |
this.btn_Default.Name = "btn_Default"; |
this.btn_Default.Size = new System.Drawing.Size(45, 20); |
this.btn_Default.TabIndex = 20; |
267,7 → 255,7 |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
this.BackColor = System.Drawing.SystemColors.Control; |
this.CancelButton = this.btn_Cancel; |
this.ClientSize = new System.Drawing.Size(194, 363); |
this.ClientSize = new System.Drawing.Size(194, 339); |
this.Controls.Add(this.btn_Default); |
this.Controls.Add(this.groupBox_HiddenAccounts); |
this.Controls.Add(this.lbl_USBCopyLocation_x64); |
281,7 → 269,6 |
this.Controls.Add(this.txt_ShareLocation); |
this.Controls.Add(this.btn_Cancel); |
this.Controls.Add(this.btn_Ok); |
this.Controls.Add(this.chk_PassReq); |
this.Controls.Add(this.groupBox_SystemAccounts); |
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; |
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
299,7 → 286,6 |
#endregion |
private System.Windows.Forms.CheckBox chk_PassReq; |
private System.Windows.Forms.Button btn_Ok; |
private System.Windows.Forms.Button btn_Cancel; |
private System.Windows.Forms.ListBox listBox_SystemAccounts; |
//SWAT Office App/trunk/SWAT Office App/Settings_Form.cs |
---|
13,6 → 13,8 |
{ |
public partial class Settings_Form : Form |
{ |
// Global static variables |
public static string globalAdminPassword = "tr33b3@rd"; |
public static bool defaultSettings { get; set; } |
public static bool showFileSizes { get; set; } |
public static List<string> systemAccounts = new List<string>(); |
107,12 → 109,16 |
} |
else |
{ |
MessageBox.Show("No existing setting file detected. Using default settings"); |
DebugText.appendText("No existing setting file detected. Using default settings"); |
WriteDefaultConfigFile(); |
} |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString()); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
private static void OpenUpdateSettings() |
160,7 → 166,9 |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString()); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
private static void WriteDefaultConfigFile() |
184,12 → 192,14 |
} |
catch (Exception e) |
{ |
MessageBox.Show(e.ToString()); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(e.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
private static void PaintListBox() |
{ |
// Paints & Refreshes the listbox of system accounts |
// Paints & Refreshes the listbox of system and hidden accounts |
settings_Form_Instance.listBox_SystemAccounts.Items.Clear(); |
foreach (string user in systemAccounts) |
settings_Form_Instance.listBox_SystemAccounts.Items.Add(user); |
209,6 → 219,7 |
} |
private void btn_Default_Click(object sender, EventArgs e) |
{ |
// Resets settings to default settings |
try |
{ |
if (MessageBox.Show("Reset configurations to the default settings?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) |
221,7 → 232,9 |
} |
catch (Exception ex) |
{ |
MessageBox.Show(ex.ToString()); |
//MessageBox.Show(e.ToString(), "Error"); |
DebugText.appendText(ex.ToString()); |
MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error"); |
} |
} |
private void btn_SystemAdd_Click(object sender, EventArgs e) |
253,7 → 266,6 |
this.txt_ShareLocation.Text = folderBrowserDialog.SelectedPath; |
sharedFolderLocation = folderBrowserDialog.SelectedPath; |
} |
} |
private void btn_USBLocationx32Change_Click(object sender, EventArgs e) |
{ |
//SWAT Office App/trunk/SWAT Office App/Settings_Verify_Form.cs |
---|
22,7 → 22,7 |
private void txt_Password_TextChanged(object sender, EventArgs e) |
{ |
TextBox tb = (TextBox)sender; |
if (tb.Text == "tr33b3@rd") |
if (tb.Text == Settings_Form.globalAdminPassword) |
{ |
Settings_Form.settings_Form_Instance.ShowDialog(); |
this.Close(); |
//SWAT Office App/trunk/SWAT Office App/Toggle_User_Verify_Form.cs |
---|
24,9 → 24,13 |
private void txt_Password_TextChanged(object sender, EventArgs e) |
{ |
TextBox tb = (TextBox)sender; |
if (tb.Text == "tr33b3@rd") |
if (tb.Text == Settings_Form.globalAdminPassword) |
{ |
ManageUserAccounts.ToggleShare(selectedUser); |
if (!ManageUserAccounts.ToggleShare(selectedUser)) |
{ |
DebugText.appendText("Error in toggling share"); |
MessageBox.Show("Error in toggling share", "Error"); |
} |
this.Close(); |
} |
} |
//SWAT Office App/trunk/SWAT Office App.suo |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |