Created
March 1, 2014 15:01
-
-
Save rcornell/9291035 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task<BackupResultHelper> StartBackup(List<Item> items, BackupType backupType, bool backupEnabled, | |
int interval = 0, DirectoryInfo targetDi = null, FileInfo targetFile = null) { | |
List<Item> itemsToBackup = ModifyItemPaths(items); | |
//Check for problems with parameters | |
if (!items.Any() && backupType == BackupType.Autobackup && backupEnabled) | |
return HandleBackupResult(true, false, "Autobackup Disabled", backupType, | |
DateTime.Now.ToString(Culture)); | |
if (!items.Any()) | |
return HandleBackupResult(false, false, "No items selected.", backupType, | |
DateTime.Now.ToString(Culture)); | |
switch (backupType) { | |
case BackupType.ToZip: | |
return await BackupToZip.BackupAndZip(itemsToBackup, targetFile); | |
case BackupType.ToFolder: | |
return BackupToFolder.BackupSaves(itemsToBackup, targetDi); | |
case BackupType.Autobackup: | |
return BackupAuto.ToggleAutoBackup(itemsToBackup, backupEnabled, interval, targetDi); | |
} | |
return ErrorResultHelper; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment