From ff69d41e2478bcec081c47d1165c440e668df5f7 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 11 Jan 2015 14:53:00 +0000 Subject: [PATCH] edited initial backup code, and added the call to it --- Saviour Backup System/setup.cs | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/Saviour Backup System/setup.cs b/Saviour Backup System/setup.cs index 73ef5aa..064a245 100644 --- a/Saviour Backup System/setup.cs +++ b/Saviour Backup System/setup.cs @@ -28,8 +28,7 @@ namespace Saviour_Backup_System SS = new splashScreen(); //displays the splash screen SS.description.Text = "From Setup..."; databaseTools.init(); - //startupBackups(); **this needs to be edited so that it uses newer code! - //run any initialising code here! + startupBackups(); SS.Close(); icon = new notificationIcon(); @@ -42,29 +41,20 @@ namespace Saviour_Backup_System DriveInfo[] drives = USBTools.getConnectedDrives(); List driveIDs = new List(); List drivesToBackup = new List(); - foreach (DriveInfo drive in drives) - { - driveIDs.Add(USBTools.calculateDriveID(drive)); - } - foreach (string id in IDs) - { - if (driveIDs.Contains(id)) - { - drivesToBackup.Add(id); - } - } - foreach (string id in drivesToBackup) - { + + foreach (DriveInfo drive in drives) { driveIDs.Add(USBTools.calculateDriveID(drive)); } + + foreach (string id in IDs) { if (driveIDs.Contains(id)) { drivesToBackup.Add(id); } } + + foreach (string id in drivesToBackup) { string directory = databaseTools.getBackupDirectory(id); string name = databaseTools.getDriveName(id); - foreach (DriveInfo drive in USBTools.getConnectedDrives()) - { - if (drive.VolumeLabel == name) - { - CT.startCopy(drive, directory, true); + + foreach (DriveInfo drive in USBTools.getConnectedDrives()) { + if (drive.VolumeLabel == name) { + CT.startCopy(drive, directory, false); break; - } - else { continue; } + } else { continue; } } } }