Пример #1
0
 async Task TryInstall(IInstallContentAction <IInstallableContent> action)
 {
     if (action.Cleaning.ShouldClean)
     {
         await Clean(action).ConfigureAwait(false);
     }
     await Synchronize(action).ConfigureAwait(false);
 }
Пример #2
0
 public async Task Install(IInstallContentAction<IInstallableContent> action) {
     await _gameLocker.ConfirmLock(action.Game.Id).ConfigureAwait(false);
     try {
         await TryInstall(action).ConfigureAwait(false);
     } finally {
         await _gameLocker.ReleaseLock(action.Game.Id).ConfigureAwait(false);
     }
 }
 public IInstallerSession Create(
     IInstallContentAction<IInstallableContent> action,
     Func<double, double, Task> progress) {
     switch (action.InstallerType) {
     case InstallerType.Synq:
         return new SynqInstallerSession(action, _toolsInstaller, _isPremium(), progress, _contentEngine);
     default:
         throw new NotSupportedException(action.InstallerType + " is not supported!");
     }
 }
Пример #4
0
 async Task Synchronize(IInstallContentAction <IInstallableContent> action)
 {
     try {
         await(await CreateSession(action).ConfigureAwait(false)).Synchronize().ConfigureAwait(false);
     } finally {
         if (!action.Status.IsEmpty())
         {
             await PostInstallStatusOverview(action.Status, action.CancelToken).ConfigureAwait(false);
         }
     }
 }
 public IInstallerSession Create(
     IInstallContentAction<IInstallableContent> action,
     Func<ProgressInfo, Task> progress) {
     switch (action.InstallerType) {
     case InstallerType.Synq:
         var i = _fact();
         i.Activate(action, progress);
         return i;
     default:
         throw new NotSupportedException(action.InstallerType + " is not supported!");
     }
 }
Пример #6
0
        public IInstallerSession Create(
            IInstallContentAction <IInstallableContent> action,
            Func <ProgressInfo, Task> progress)
        {
            switch (action.InstallerType)
            {
            case InstallerType.Synq:
                var i = _fact();
                i.Activate(action, progress);
                return(i);

            default:
                throw new NotSupportedException(action.InstallerType + " is not supported!");
            }
        }
 public SynqInstallerSession(IInstallContentAction<IInstallableContent> action, IToolsInstaller toolsInstaller,
     bool isPremium, Func<double, double, Task> statusChange, IContentEngine contentEngine) {
     if (action == null)
         throw new ArgumentNullException(nameof(action));
     if (toolsInstaller == null)
         throw new ArgumentNullException(nameof(toolsInstaller));
     if (statusChange == null)
         throw new ArgumentNullException(nameof(statusChange));
     _action = action;
     _toolsInstaller = toolsInstaller;
     _isPremium = isPremium;
     _statusChange = statusChange;
     _contentEngine = contentEngine;
     _status = new Status(_action.Content.Count);
 }
Пример #8
0
 Task Clean(IInstallContentAction<IInstallableContent> action) {
     // TODO: .Concat exclusions based on Package info from each Content, so that we don't reinstall the desired content?
     return _cleaner.CleanAsync(action.Paths.Path, action.Cleaning.Exclusions
         .Concat(
             new IRelativePath[]
             {@".\.synq".ToRelativeDirectoryPath(), @".\.sync-backup".ToRelativeDirectoryPath()})
         .ToArray(), action.Cleaning.FileTypes, action.Paths.Path.GetChildDirectoryWithName(SyncBackupDir));
 }
Пример #9
0
 async Task TryInstall(IInstallContentAction<IInstallableContent> action) {
     if (action.Cleaning.ShouldClean)
         await Clean(action).ConfigureAwait(false);
     await Synchronize(action).ConfigureAwait(false);
 }
Пример #10
0
 async Task Synchronize(IInstallContentAction<IInstallableContent> action) {
     await StatusChange(Status.Synchronizing).ConfigureAwait(false);
     try {
         await TrySynchronize(action).ConfigureAwait(false);
     } finally {
         await StatusChange(Status.Synchronized).ConfigureAwait(false);
     }
 }
 async Task Synchronize(IInstallContentAction<IInstallableContent> action) {
     try {
         await (await CreateSession(action).ConfigureAwait(false)).Synchronize().ConfigureAwait(false);
     } finally {
         if (!action.Status.IsEmpty())
             await PostInstallStatusOverview(action.Status, action.CancelToken).ConfigureAwait(false);
     }
 }
 // TODO: .Concat exclusions based on Package info from each Content, so that we don't reinstall the desired content?
 Task Clean(IInstallContentAction<IInstallableContent> action)
     => _cleaner.CleanAsync(action.Paths.Path, action.Cleaning.Exclusions
         .Concat(
             new IRelativePath[]
                 {@".\.synq".ToRelativeDirectoryPath(), @".\.sync-backup".ToRelativeDirectoryPath()})
         .ToArray(), action.Cleaning.FileTypes, action.Paths.Path.GetChildDirectoryWithName(SyncBackupDir));
 public async Task Install(IInstallContentAction<IInstallableContent> action) {
     await TryInstall(action).ConfigureAwait(false);
 }
 async Task<IInstallerSession> CreateSession(
         IInstallContentAction<IInstallableContent> action)
     => _sessionFactory.Create(action, info => StatusChange(Status.Synchronizing, info));
Пример #15
0
 async Task <IInstallerSession> CreateSession(
     IInstallContentAction <IInstallableContent> action)
 => _sessionFactory.Create(action, info => StatusChange(Status.Synchronizing, info));
Пример #16
0
 public async Task Install(IInstallContentAction <IInstallableContent> action)
 {
     await TryInstall(action).ConfigureAwait(false);
 }
Пример #17
0
 async Task TrySynchronize(IInstallContentAction<IInstallableContent> action) {
     await CreateSession(action).Synchronize().ConfigureAwait(false);
     if (!action.Status.IsEmpty())
         await PostInstallStatusOverview(action.Status).ConfigureAwait(false);
 }
Пример #18
0
 // TODO: .Concat exclusions based on Package info from each Content, so that we don't reinstall the desired content?
 Task Clean(IInstallContentAction <IInstallableContent> action)
 => _cleaner.CleanAsync(action.Paths.Path, action.Cleaning.Exclusions
                        .Concat(
                            new IRelativePath[]
                            { @".\.synq".ToRelativeDirectoryPath(), @".\.sync-backup".ToRelativeDirectoryPath() })
                        .ToArray(), action.Cleaning.FileTypes, action.Paths.Path.GetChildDirectoryWithName(SyncBackupDir));
Пример #19
0
 IInstallerSession CreateSession(
     IInstallContentAction<IInstallableContent> action) {
     var session = _sessionFactory.Create(action, (p, s) => StatusChange(Status.Synchronizing, p, s));
     if (action.CancelToken != default(CancellationToken))
         action.CancelToken.Register(session.Abort);
     _gameLocker.RegisterCancel(action.Game.Id, session.Abort);
     return session;
 }