Beispiel #1
0
 private static bool AllDependenciesContained(ModpackTemplate template, List <ModpackTemplate> list)
 {
     foreach (var dependency in template.ModpackTemplates.Select(inner => inner.OuterTemplate))
     {
         if (!list.Contains(dependency))
         {
             return(false);
         }
     }
     return(true);
 }
        public void Update(ICollection <Modpack> modpackList)
        {
            Modpacks = new ModpackTemplate[modpackList.Count];

            int index = 0;

            foreach (var modpack in modpackList)
            {
                Modpacks[index] = new ModpackTemplate()
                {
                    Name = modpack.Name,
                    Mods = modpack.Mods.Where(item => item is ModReference).Select(item => ((ModReference)item).Mod)
                           .Select(mod => new ModpackTemplateMod(mod.Name, mod.FactorioVersion))
                           .ToArray(),
                    Modpacks = modpack.Mods.Where(item => item is ModpackReference).Select(item => item.DisplayName).ToArray(),
                };

                index++;
            }
        }
Beispiel #3
0
        public void PopulateModpackList(ModCollection modList, ModpackCollection modpackList, IEditableCollectionView modpackView)
        {
            foreach (var template in Modpacks)
            {
                var modpack = new Modpack(template.Name, template.IsLocked, modpackList);
                if (modpackView != null)
                {
                    modpack.ParentView = modpackView;
                }

                foreach (ModpackTemplateMod modTemplate in template.Mods)
                {
                    Mod mod = GetMod(modList, modTemplate);
                    if (mod != null)
                    {
                        modpack.Mods.Add(new ModReference(mod, modpack));
                    }
                }

                modpackList.Add(modpack);
            }

            foreach (var modpack in modpackList)
            {
                ModpackTemplate template = GetTemplate(modpack.Name);

                foreach (string modpackName in template.Modpacks)
                {
                    Modpack subModpack = GetModpack(modpackList, modpackName);
                    var     reference  = new ModpackReference(subModpack, modpack);
                    reference.ParentView = modpack.ModsView;
                    if (subModpack != null)
                    {
                        modpack.Mods.Add(reference);
                    }
                }
            }
        }
Beispiel #4
0
 public int Compare(ModpackTemplate x, ModpackTemplate y)
 {
     return(string.Compare(x?.Name, y?.Name, StringComparison.InvariantCultureIgnoreCase));
 }