Ejemplo n.º 1
0
        protected override async Task SynchronizeMods(IContentManager contentList,
                                                      CollectionVersionModel collectionVersion)
        {
            await HandleCustomRepositories(contentList, false).ConfigureAwait(false);

            await base.SynchronizeMods(contentList, collectionVersion).ConfigureAwait(false);
        }
Ejemplo n.º 2
0
 protected void UpdateServersInfo(CollectionVersionModel collectionVersion) {
     if (collectionVersion.Servers != null) {
         Servers =
             collectionVersion.Servers.Select(
                 x => new CollectionServer {Address = new ServerAddress(x.Address), Password = x.Password})
                 .ToList();
     } else
         Servers.Clear();
 }
Ejemplo n.º 3
0
 public void SetPublishedInformation(CollectionModel collection, CollectionVersionModel collectionVersion)
 {
     if (PublishedId.HasValue && PublishedId.Value != collection.Id)
     {
         throw new Exception(
                   "This modSet already has publishing information set and it's id does not match the provided collections id.");
     }
     PublishedId     = collection.Id;
     PublishingScope = collection.Scope;
     UpdatePublishInfo(collectionVersion.Version);
     _publishedAccountId = collection.AuthorId;
 }
Ejemplo n.º 4
0
        public virtual async Task UpdateInfoFromOnline(CollectionModel collection,
                                                       CollectionVersionModel collectionVersion,
                                                       Account author, IContentManager contentList)
        {
            var imageUrl = collection.AvatarUrl == null ? null : "http:" + collection.AvatarUrl;

            Image       = imageUrl;
            ImageLarge  = imageUrl;
            Name        = collection.Name;
            Description = collectionVersion.Description;
            Version     = collectionVersion.Version.ToString();
            UpdatedAt   = collectionVersion.ReleasedOn;
        }
        public override async Task UpdateInfoFromOnline(CollectionModel collection,
            CollectionVersionModel collectionVersion,
            Account author, IContentManager contentList) {
            await base.UpdateInfoFromOnline(collection, collectionVersion, author, contentList).ConfigureAwait(false);

            Subscribers = collection.Subscribers;
            AuthorAvatarUrl = author.Avatar;
            Author = author.DisplayName;

            collectionVersion.Repositories.SyncCollectionLocked(Repositories);
            UpdateServersInfo(collectionVersion);

            await SynchronizeMods(contentList, collectionVersion).ConfigureAwait(false);
        }
Ejemplo n.º 6
0
        public override async Task UpdateInfoFromOnline(CollectionModel collection,
                                                        CollectionVersionModel collectionVersion,
                                                        Account author, IContentManager contentList)
        {
            await base.UpdateInfoFromOnline(collection, collectionVersion, author, contentList).ConfigureAwait(false);

            Subscribers     = collection.Subscribers;
            AuthorAvatarUrl = author.Avatar;
            Author          = author.DisplayName;

            collectionVersion.Repositories.SyncCollectionLocked(Repositories);
            UpdateServersInfo(collectionVersion);

            await SynchronizeMods(contentList, collectionVersion).ConfigureAwait(false);
        }
Ejemplo n.º 7
0
 protected void UpdateServersInfo(CollectionVersionModel collectionVersion)
 {
     if (collectionVersion.Servers != null)
     {
         Servers =
             collectionVersion.Servers.Select(
                 x => new CollectionServer {
             Address = new ServerAddress(x.Address), Password = x.Password
         })
             .ToList();
     }
     else
     {
         Servers.Clear();
     }
 }
Ejemplo n.º 8
0
        public override async Task UpdateInfoFromOnline(CollectionModel collection,
                                                        CollectionVersionModel collectionVersion,
                                                        Account author, IContentManager contentList)
        {
            await base.UpdateInfoFromOnline(collection, collectionVersion, author, contentList).ConfigureAwait(false);

            Subscribers = collection.Scope == CollectionScope.Private ? (int?)null : collection.Subscribers;
            if (PublishedVersion == null || PublishedVersion < collectionVersion.Version)
            {
                collectionVersion.Repositories.SyncCollection(Repositories);
                UpdateServersInfo(collectionVersion);
                await SynchronizeMods(contentList, collectionVersion).ConfigureAwait(false);
            }

            // Has to come afterwards because otherwise we don't sync mods on changes...
            SetPublishedInformation(collection, collectionVersion);
        }
Ejemplo n.º 9
0
        protected virtual async Task SynchronizeMods(IContentManager contentList,
                                                     CollectionVersionModel collectionVersion)
        {
            foreach (var d in collectionVersion.Dependencies)
            {
                SetVersion(d.Dependency, d.Constraint);
            }
            var theMods = ConvertToMods(collectionVersion, contentList).ToArray();

            RefreshOrders(theMods);
            theMods.Select(x => x.GetSerializationString()).SyncCollection(AdditionalMods);
            RequiredMods =
                theMods.Select(x => x.Name)
                .Where(
                    x =>
                    collectionVersion.Dependencies.Any(
                        d => d.Dependency.Equals(x, StringComparison.InvariantCultureIgnoreCase) && d.IsRequired))
                .ToList();
            HandleModsetMods(contentList);
            UpdateState();
        }
Ejemplo n.º 10
0
 protected virtual IEnumerable <IMod> ConvertToMods(CollectionVersionModel collectionVersion,
                                                    IContentManager contentList) => contentList.FindOrCreateLocalMods(Game,
                                                                                                                      collectionVersion.Dependencies.Select(x => x.Dependency));
Ejemplo n.º 11
0
 protected override async Task SynchronizeMods(IContentManager contentList,
     CollectionVersionModel collectionVersion) {
     await HandleCustomRepositories(contentList, false).ConfigureAwait(false);
     await base.SynchronizeMods(contentList, collectionVersion).ConfigureAwait(false);
 }
Ejemplo n.º 12
0
 protected override IEnumerable<IMod> ConvertToMods(CollectionVersionModel collectionVersion,
     IContentManager contentList) {
     return contentList.FindOrCreateLocalMods(Game,
         collectionVersion.Dependencies.Select(x => x.Dependency), CustomRepoMods);
 }