示例#1
0
 public PathObserverFactory(IIndexFactory indexFactory, IBackupManagerFactory backupFactory, ILogger logger, IFileHelper fileHelper, IPathSubjectFactory pathSubjectFactory)
 {
     this.indexFactory       = indexFactory;
     this.backupFactory      = backupFactory;
     this.logger             = logger;
     this.fileHelper         = fileHelper;
     this.pathSubjectFactory = pathSubjectFactory;
 }
示例#2
0
 public static void InitializeForTest(IBackupManagerFactory factoryForTest)
 {
     _backupCancellationSource?.Cancel();
     while (_backupManager != null)
     {
         Thread.Sleep(100);
     }
     _backupHistory.Clear();
     _backupManagerFactory = factoryForTest;
 }
示例#3
0
        public PathObserver(string indexPath, int delay, RepositoryType reposType, IIndexFactory indexFactory, IBackupManagerFactory backupFactory,
                            ILogger logger, IFileHelper fileHelper, IPathSubjectFactory pathSubjectFactory)
        {
            this.delay = delay;
            var index = indexFactory.GetIndex(indexPath);

            this.manager = backupFactory.GetBackupManager(index, reposType);
            this.logger  = logger;

            //Create path subjects
            foreach (var i in index.Values())
            {
                var parts = i.Value;
                if (!Directory.Exists(parts[0]) || !Directory.Exists(parts[1]))
                {
                    logger.Log(System.Diagnostics.EventLogEntryType.Warning, null, new ArgumentException("Could not create binding to path: " + parts[1]));
                    continue;
                }
                var sub = pathSubjectFactory.GetPathSubject(i.Key, parts[0]);
                Attach(sub);
            }
        }