예제 #1
0
 public BackupService(
     ILog log,
     ISettingsProvider settingsProvider,
     IBackupHistoryService backupHistoryService,
     IBackupCompressor backupCompressor,
     IBackupStorageService backupStorageService,
     Scheduler scheduler)
 {
     _log = log;
       _settingsProvider = settingsProvider;
       _backupHistoryService = backupHistoryService;
       _backupCompressor = backupCompressor;
       _backupStorageService = backupStorageService;
       _scheduler = scheduler;
 }
예제 #2
0
        public BackupCompressor(
            ILog log,
            ISettingsProvider settingsProvider,
            IBackupHistoryService backupHistoryService)
        {
            _log = log;
              _settingsProvider = settingsProvider;
              _backupHistoryService = backupHistoryService;

              _tempDirectory = _settingsProvider.GetSetting<string>("TempDirectory");
              _storagePendingDirectory = _settingsProvider.GetSetting<string>("StoragePendingDirectory");

              var backupPaths = _settingsProvider.GetSetting<string>("BackupPaths");
              var excludedBackupPaths = _settingsProvider.GetSetting<string>("ExcludedBackupPaths");
              var excludedFileTypes = _settingsProvider.GetSetting<string>("ExcludedFileTypes");

              if (backupPaths.Length == 0)
            throw new Exception("No Backup Paths configured.");

              var splitChar = ",".ToCharArray();

              _pathsToBackup =
            backupPaths
            .Split(splitChar, StringSplitOptions.RemoveEmptyEntries)
            .Select(p => p.Trim().TrimEnd('\\', '/'))
            .ToArray();

              _pathsToExclude =
            excludedBackupPaths
              .Split(splitChar, StringSplitOptions.RemoveEmptyEntries)
              .Select(p => p.Trim().TrimEnd('\\', '/'))
              .ToArray();

              _fileTypesToExclude =
            excludedFileTypes
              .Split(splitChar, StringSplitOptions.RemoveEmptyEntries)
              .Select(p => p.Trim())
              .ToArray();
        }