Example #1
0
        public BackupBase(BackupProfileData profile, GenericStatusBarView progressBar) : base(profile)
        {
            m_TimeStamp = DateTime.Now;
            m_Profile   = profile;
            m_IStorage  = profile.GetStorageInterface();
            m_Logger    = profile.Logger;

            m_SourceBackupPathList = profile.BackupFolderList.ToList();//.Where(i => i.IsAvailable).ToList();
            m_TargetBackupPath     = profile.GetTargetBackupFolder();

            m_ProgressBar = progressBar;
        }
Example #2
0
 public IncrementalFullBackup(BackupProfileData profile, GenericStatusBarView progressBar = null) : base(profile, progressBar)
 {
 }
 public FileSystemWatcherBackup(BackupProfileData profile, GenericStatusBarView progressBar = null) : base(profile, progressBar)
 {
 }
Example #4
0
 public SnapshotBackup(BackupProfileData profile, GenericStatusBarView progressBar = null) : base(profile, progressBar)
 {
 }
Example #5
0
        public BackupProcessWorkerTask(BackupProfileData profile, bool bFullBackupScan)
        {
            m_Profile         = profile;
            m_Logger          = profile.Logger;
            m_bFullBackupScan = bFullBackupScan;

            WorkerReportsProgress      = true;
            WorkerSupportsCancellation = true;

            DoWork += (sender, e) =>
            {
                m_MaxActiveCPU = Properties.General.Default.MaxCPUOnBusy;
                m_MaxIdleCPU   = Properties.General.Default.MaxCPUOnAway;

                m_ProgressBar = GenericStatusBarView.NewInstance;
                profile.IsBackupWorkerBusy = true;
                //                RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackupTaskRunWorkerCompletedEvent);
                ProgressChanged    += BackupTaskRunWorkerProgressChangedEvent;
                RunWorkerCompleted += BackupTaskRunWorkerCompletedEvent;

                //profile.IsBackupWorkerBusy = true;
                m_ProgressBar.UpdateProgressBar("Backup starting...", 0);
                var startTime = DateTime.Now;

                m_Logger.Writeln($"-------------------------------------------------");
                try
                {
                    switch (profile.BackupType)
                    {
                    case BackupTypeEnum.Differential:
                        if (bFullBackupScan)
                        {
                            m_Logger.Writeln($"Starting a Full Deep Differential backup");
                            m_BackupManager = new DifferentialBackup(profile, m_ProgressBar);
                        }
                        else
                        {
                            m_Logger.Writeln($"Starting a Differential watcher backup");
                            m_BackupManager = new DifferentialWatcherBackup(profile, m_ProgressBar);
                        }
                        break;

                    case BackupTypeEnum.Incremental:
                        if (bFullBackupScan)
                        {
                            m_Logger.Writeln($"Starting a Full Deep Incremental backup");
                            m_BackupManager = new IncrementalFullBackup(profile, m_ProgressBar);
                        }
                        else
                        {
                            m_Logger.Writeln($"Starting Incremental watcher backup");
                            m_BackupManager = new IncrementalFullWatcherBackup(profile, m_ProgressBar);
                        }
                        break;

                    case BackupTypeEnum.Snapshot:
                        m_Logger.Writeln($"Starting a Snapshot backup");
                        m_BackupManager = new SnapshotBackup(profile, m_ProgressBar);
                        break;

                    default:
                        throw new ArgumentNullException("Unknown backup type in BackupWorker");
                    }

                    m_BackupManager.Init();
                    m_BackupManager.ProcessBackup();
                    m_BackupManager.Done();

                    m_Profile.RefreshProfileProperties();
                }
                catch (TaskCanceledException ex)
                {
                    m_Logger.Writeln($"Backup exception: {ex.Message}");
                    m_ProgressBar.UpdateProgressBar("Completed with Errors");
                    Trace.WriteLine($"Full Backup exception: {ex.Message}");
                    e.Result = $"Full Backup exception: {ex.Message}";
                    throw (ex);
                }
                finally
                {
                    if (CancellationPending)
                    {
                        e.Cancel = true;
                    }

                    m_Logger.Writeln($"Backup completed, execution time: {DateTime.Now - startTime}");
                    m_ProgressBar.Release();
                    m_ProgressBar   = null;
                    m_BackupManager = null;
                }
            };
        }
Example #6
0
 public DifferentialWatcherBackup(BackupProfileData profile, GenericStatusBarView progressBar = null) : base(profile, progressBar)
 {
 }