示例#1
0
        /// <summary>
        /// Checks if this modpack contains a specified modpack.
        /// </summary>
        public bool Contains(Modpack modpack, out ModpackReference reference, bool recursive = false)
        {
            foreach (var @ref in Mods)
            {
                var modpackReference = @ref as ModpackReference;
                if (modpackReference != null)
                {
                    if (modpackReference.Modpack == modpack)
                    {
                        reference = modpackReference;
                        return(true);
                    }

                    ModpackReference recursiveReference;
                    if (recursive && modpackReference.Modpack.Contains(modpack, out recursiveReference, true))
                    {
                        reference = recursiveReference;
                        return(true);
                    }
                }
            }

            reference = null;
            return(false);
        }
        public ModpackReference(Modpack modpack, Modpack parent)
        {
            Modpack = modpack;
            Image   = new BitmapImage(new Uri("../Images/Package.png", UriKind.Relative));

            modpack.PropertyChanged += PropertyChangedHandler;
            RemoveFromParentCommand  = new RelayCommand(() => parent.Mods.Remove(this));
        }
示例#3
0
        public ModReference(Mod mod, Modpack parent)
        {
            Mod   = mod;
            Image = new BitmapImage(new Uri("../Images/Document.png", UriKind.Relative));

            mod.PropertyChanged    += PropertyChangedHandler;
            RemoveFromParentCommand = new RelayCommand(() =>
            {
                parent.Mods.Remove(this);

                ModpackTemplateList.Instance.Update(MainViewModel.Instance.Modpacks);
                ModpackTemplateList.Instance.Save();
            });
        }
示例#4
0
        public ModpackTemplate(Modpack modpack, List <ModpackTemplate> parentCollection)
        {
            Modpack = modpack;
            this.parentCollection = parentCollection;

            ModTemplates               = modpack.Mods.Where(reference => reference is ModReference).Select(reference => new ModTemplate(((ModReference)reference).Mod)).ToList();
            ModTemplateView            = (ListCollectionView)(new CollectionViewSource()
            {
                Source = ModTemplates
            }).View;
            ModTemplateView.CustomSort = new ModSorter();

            ModpackTemplates               = modpack.Mods.Where(reference => reference is ModpackReference).Select(reference => new InnerModpackTemplate(((ModpackReference)reference).Modpack, parentCollection)).ToList();
            ModpackTemplateView            = (ListCollectionView)(new CollectionViewSource()
            {
                Source = ModpackTemplates
            }).View;
            ModpackTemplateView.CustomSort = new ModpackSorter();
        }
示例#5
0
        /// <summary>
        /// Checks if this modpack contains a specified modpack.
        /// </summary>
        public bool Contains(Modpack modpack, bool recursive = false)
        {
            ModpackReference reference;

            return(Contains(modpack, out reference, recursive));
        }
示例#6
0
 public InnerModpackTemplate(Modpack modpack, List <ModpackTemplate> parentCollection)
 {
     Modpack = modpack;
     this.parentCollection = parentCollection;
 }