Ejemplo n.º 1
0
        public void ConfirmDependencyConstraintsOverride() {
            var mod1 = new ModNetworkContent("@test-mod-1", GameGuids.Arma3);
            var mod2 = new ModNetworkContent("@test-mod-2", GameGuids.Arma3);
            mod1.Dependencies.Add(new NetworkContentSpec(mod2, "1.0.0"));

            var collection = new LocalCollection(GameGuids.Arma3, "Test collection", new[] {
                new ContentSpec(mod1),
                new ContentSpec(mod2, "2.0.0")
            });

            collection.GetRelatedContent().First().Constraint.ShouldEqual("2.0.0");
        }
Ejemplo n.º 2
0
        LocalCollection FindOrCreateLocalCollection(IContentAction <IContent> action)
        {
            var contents = action.Content.Select(x => new ContentSpec((Content)x.Content, x.Constraint)).ToList();
            var existing =
                Collections.OfType <LocalCollection>().FirstOrDefault(x => x.Contents.SequenceEqual(contents));

            if (existing != null)
            {
                return(existing);
            }
            var isNotUpdateAll = (action.Name != "Update all") && (action.Name != "Available updates");
            var name           = isNotUpdateAll
                ? $"{action.Name ?? "Playlist"} {DateTime.UtcNow.ToString(Tools.GenericTools.DefaultDateFormat)}"
                : action.Name;
            var localCollection = new LocalCollection(Id, name, contents);

            if (isNotUpdateAll)
            {
                Contents.Add(localCollection);
            }
            return(localCollection);
        }