示例#1
0
        public Sender(SyncOptions syncOptions, ILogger logger)
        {
            _logger                  = logger;
            _pathScanner             = new PathScanner(this);
            _sentReporter            = new SentReporter(_logger);
            _srcPath                 = Path.GetFullPath(syncOptions.SourcePath);
            _cancellationTokenSource = new CancellationTokenSource();

            if (!Directory.Exists(_srcPath))
            {
                throw new SyncException($"Invalid source path: {_srcPath}");
            }

            _excludeList = new FileMaskList();
            _excludeList.SetList(syncOptions.ExcludeList);

            _changes      = new Dictionary <string, FsSenderChange>();
            _needToScan   = true;
            _agentStarter = AgentStarter.Create(syncOptions, _logger);
            _logger.Log($"Sync {syncOptions}");
            _applyRequest = new ApplyRequest(_logger)
            {
                BasePath = _srcPath,
            };
            UpdateHasWork();
        }