상속: BaseEntityGuidId
예제 #1
0
 private async Task UpdateExisting(GroupContent mod, IAuthProvider provider, IAbsoluteDirectoryPath rsyncDir,
                                   IAbsoluteDirectoryPath folder, Action <SyncOptions> config = null)
 {
     SetupHosts(mod, provider);
     var repo = GetRepo(rsyncDir, folder, config);
     await repo.Update(config).ConfigureAwait(false);
 }
예제 #2
0
 Action <SyncOptions> GetOpts(IAbsoluteDirectoryPath packPath, StatusRepo status,
                              GroupContent mod) => opts => {
     opts.Hosts = GetHosts(mod).ToList();
     //{"required_version", mod.Version}, // TODO
     //{"required_guid", @group.Id}, // TODO
     opts.PackPath = packPath.GetChildDirectoryWithName(mod.PackageName);
     opts.Status   = status;
 };
예제 #3
0
 private void SetupHosts(GroupContent mod, IAuthProvider provider)
 {
     foreach (var h in GetHosts(mod))
     {
         provider.SetNonPersistentAuthInfo(h,
                                           new AuthInfo(Access.UserName, Access.Password));
     }
 }
예제 #4
0
 private async Task InstallNew(GroupContent mod, IAuthProvider provider, Action<SyncOptions> config,
     IAbsoluteDirectoryPath folder) {
     SetupHosts(mod, provider);
     var opts = new SyncOptions();
     config(opts);
     await
         Repository.Factory.Clone(opts.Hosts, folder.ToString(), config)
             .ConfigureAwait(false);
 }
예제 #5
0
        private async Task InstallNew(GroupContent mod, IAuthProvider provider, Action <SyncOptions> config,
                                      IAbsoluteDirectoryPath folder)
        {
            SetupHosts(mod, provider);
            var opts = new SyncOptions();

            config(opts);
            await
            Repository.Factory.Clone(opts.Hosts, folder.ToString(), config)
            .ConfigureAwait(false);
        }
예제 #6
0
        public async Task GetMod(GroupContent mod, IAbsoluteDirectoryPath destination, IAbsoluteDirectoryPath packPath,
            StatusRepo status, IAuthProvider provider, bool force = false) {
            var folder = destination.GetChildDirectoryWithName(mod.PackageName);

            if (!folder.Exists) {
                await InstallNew(mod, provider, GetOpts(packPath, status, mod), folder).ConfigureAwait(false);
                return;
            }

            var rsyncDir = folder.GetChildDirectoryWithName(Repository.RepoFolderName);
            if (!force && rsyncDir.Exists && IsRightVersion(rsyncDir, mod))
                return;
            await UpdateExisting(mod, provider, rsyncDir, folder, GetOpts(packPath, status, mod)).ConfigureAwait(false);
        }
예제 #7
0
        public async Task GetMod(GroupContent mod, IAbsoluteDirectoryPath destination, IAbsoluteDirectoryPath packPath,
                                 StatusRepo status, IAuthProvider provider, bool force = false)
        {
            var folder = destination.GetChildDirectoryWithName(mod.PackageName);

            if (!folder.Exists)
            {
                await InstallNew(mod, provider, GetOpts(packPath, status, mod), folder).ConfigureAwait(false);

                return;
            }

            var rsyncDir = folder.GetChildDirectoryWithName(Repository.RepoFolderName);

            if (!force && rsyncDir.Exists && IsRightVersion(rsyncDir, mod))
            {
                return;
            }
            await UpdateExisting(mod, provider, rsyncDir, folder, GetOpts(packPath, status, mod)).ConfigureAwait(false);
        }
예제 #8
0
 private void SetupHosts(GroupContent mod, IAuthProvider provider) {
     foreach (var h in GetHosts(mod)) {
         provider.SetNonPersistentAuthInfo(h,
             new AuthInfo(Access.UserName, Access.Password));
     }
 }
예제 #9
0
 private async Task UpdateExisting(GroupContent mod, IAuthProvider provider, IAbsoluteDirectoryPath rsyncDir,
     IAbsoluteDirectoryPath folder, Action<SyncOptions> config = null) {
     SetupHosts(mod, provider);
     var repo = GetRepo(rsyncDir, folder, config);
     await repo.Update(config).ConfigureAwait(false);
 }
예제 #10
0
 // TODO: Id vs PackageName?
 public IReadOnlyCollection<Uri> GetHosts(GroupContent content)
     => new[] {new Uri(baseHost, Id.ToShortId() + "/" + content.GameId.ToShortId() + "/" + content.PackageName)};
예제 #11
0
 // TODO
 private bool IsRightVersion(IAbsoluteDirectoryPath rsyncDir, GroupContent mod) => false;
예제 #12
0
 Action<SyncOptions> GetOpts(IAbsoluteDirectoryPath packPath, StatusRepo status,
     GroupContent mod) => opts => {
     opts.Hosts = GetHosts(mod).ToList();
     //{"required_version", mod.Version}, // TODO
     //{"required_guid", @group.Id}, // TODO
     opts.PackPath = packPath.GetChildDirectoryWithName(mod.PackageName);
     opts.Status = status;
 };
예제 #13
0
 // TODO: Id vs PackageName?
 public IReadOnlyCollection <Uri> GetHosts(GroupContent content)
 => new[] { new Uri(baseHost, Id.ToShortId() + "/" + content.GameId.ToShortId() + "/" + content.PackageName) };
예제 #14
0
 // TODO
 private bool IsRightVersion(IAbsoluteDirectoryPath rsyncDir, GroupContent mod) => false;