示例#1
0
        public FilesTabVM2(IRepository <SyncableFileRemote> filesRepo, AppFileGrouper fileGrouper, IFileSynchronizer fileSynchronizer, ID7Client d7Client, BinUploaderCfgFile cfgFile)
        {
            _grouper      = ForwardLogs(fileGrouper);
            _synchronizer = ForwardLogs(fileSynchronizer);
            _remotes      = ForwardLogs(filesRepo);
            //_cfgFile         = ForwardLogs(cfgFile);
            //_d7Client        = ForwardLogs(d7Client);
            MainList         = new VmList <RemoteVsLocalFile>();
            UploadChangesCmd = AsyncCommand.Create(token => UploadChanges(token));

            _remotes.SetClient(d7Client, cfgFile);
            _synchronizer.SetClient(d7Client);

            SetEventHandlers();
        }
		public SynchronizeFileService(
			IAsyncFileOperations asyncFileOperations,
			MusicMirrorConfiguration configuration,
			IFileSynchronizer fileSynchronizer,
			ISynchronizedFilesRepository synchronizedFilesRepository)
		{
			if (asyncFileOperations == null) throw new ArgumentNullException(nameof(asyncFileOperations));
			if (configuration == null) throw new ArgumentNullException(nameof(configuration));
			if (fileSynchronizer == null) throw new ArgumentNullException(nameof(fileSynchronizer));
			if (synchronizedFilesRepository == null) throw new ArgumentNullException(nameof(synchronizedFilesRepository));
			_asyncFileOperations = asyncFileOperations;
			_configuration = configuration;
			_fileSynchronizer = fileSynchronizer;
			_synchronizedFilesRepository = synchronizedFilesRepository;
		}
示例#3
0
        public FilesTabVM2(IRepository<SyncableFileRemote> filesRepo, AppFileGrouper fileGrouper, IFileSynchronizer fileSynchronizer, ID7Client d7Client, BinUploaderCfgFile cfgFile)
        {
            _grouper         = ForwardLogs(fileGrouper);
            _synchronizer    = ForwardLogs(fileSynchronizer);
            _remotes         = ForwardLogs(filesRepo);
            //_cfgFile         = ForwardLogs(cfgFile);
            //_d7Client        = ForwardLogs(d7Client);
            MainList         = new VmList<RemoteVsLocalFile>();
            UploadChangesCmd = AsyncCommand.Create(token => UploadChanges(token));

            _remotes.SetClient(d7Client, cfgFile);
            _synchronizer.SetClient(d7Client);

            SetEventHandlers();
        }
示例#4
0
        public BinUpdaterVM(IRepository<SyncableFileRemote> filesRepo, 
                            AppFileGrouper fileGrouper, 
                            IFileSynchronizer fileSynchronizer,
                            BinUpdaterCfgFile cfgFile,
                            UpdaterSessionVM usrSessionVm,
                            ID7Client d7Client,
                            LogScrollerVM logScroller)
        {
            DisplayName   = "Bin Updater";
            _d7Client     = ForwardLogs(d7Client);
            _grouper      = ForwardLogs(fileGrouper);
            _synchronizer = ForwardLogs(fileSynchronizer);
            _remotes      = ForwardLogs(filesRepo);
            _cfgFile      = ForwardLogs(cfgFile);
            UserSession   = ForwardLogs(usrSessionVm);
            UpdateNowCmd  = AsyncCommand.Create(tkn => UpdateNow(tkn));

            LogScroller = logScroller.ListenTo(this);
        }
示例#5
0
        public BinUpdaterVM(IRepository <SyncableFileRemote> filesRepo,
                            AppFileGrouper fileGrouper,
                            IFileSynchronizer fileSynchronizer,
                            BinUpdaterCfgFile cfgFile,
                            UpdaterSessionVM usrSessionVm,
                            ID7Client d7Client,
                            LogScrollerVM logScroller)
        {
            DisplayName   = "Bin Updater";
            _d7Client     = ForwardLogs(d7Client);
            _grouper      = ForwardLogs(fileGrouper);
            _synchronizer = ForwardLogs(fileSynchronizer);
            _remotes      = ForwardLogs(filesRepo);
            _cfgFile      = ForwardLogs(cfgFile);
            UserSession   = ForwardLogs(usrSessionVm);
            UpdateNowCmd  = AsyncCommand.Create(tkn => UpdateNow(tkn));

            LogScroller = logScroller.ListenTo(this);
        }
示例#6
0
        public virtual ICollection <JobFileContent> DownloadPartOfJobFileFromCluster(SubmittedTaskInfo taskInfo, SynchronizableFiles fileType, long offset)
        {
            string jobClusterDirectoryPath     = FileSystemUtils.GetJobClusterDirectoryPath(_fileSystem.Cluster.LocalBasepath, taskInfo.Specification.JobSpecification);
            string taskClusterDirectoryPath    = FileSystemUtils.GetTaskClusterDirectoryPath(jobClusterDirectoryPath, taskInfo.Specification);
            FullFileSpecification fileInfo     = CreateSynchronizableFileInfoForType(taskInfo.Specification, taskClusterDirectoryPath, fileType);
            IFileSynchronizer     synchronizer = CreateFileSynchronizer(fileInfo, taskInfo.Specification.JobSpecification.ClusterUser);

            synchronizer.Offset = offset;
            synchronizer.SyncFileInfo.DestinationDirectory = null;
            ICollection <JobFileContent> result = synchronizer.SynchronizeFiles();

            if (result != null)
            {
                foreach (JobFileContent content in result)
                {
                    content.FileType            = fileType;
                    content.SubmittedTaskInfoId = taskInfo.Id;
                }
            }
            return(result);
        }