Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="contentPack"></param>
        /// <param name="monitor"></param>
        public void Populate(IContentPack contentPack, IMonitor monitor)
        {
            CustomGreenHouse GreenHouseData = new CustomGreenHouse();

            if (ProcessContentPack(contentPack, out GreenHouseData))
            {
                monitor.Log($"\t + Contains a custom greenhouse.", LogLevel.Trace);
                //Version control?
                //Validate?
                GreenHouseData.ContentPack = contentPack;
                GreenHouseList.Add(GreenHouseData);
            }
        }
Exemple #2
0
        /// <summary>
        /// Populates the List<CustomFarm> FarmList variable with all the Content Packs
        /// registered to MTN.
        /// </summary>
        /// <param name="Helper">SMAPI's IModHelper, to load in the Content Packs</param>
        /// <param name="Monitor">SMAPI's IMonitor, to print useful information</param>
        public void Populate(IModHelper Helper, IMonitor Monitor)
        {
            CustomFarm       FarmData;
            CustomGreenHouse GreenHouseData;
            bool             ContainsFarm       = false;
            bool             ContainsGreenHouse = false;

            FarmList = new List <CustomFarm>();

            foreach (IContentPack ContentPack in Helper.ContentPacks.GetOwned())
            {
                FarmData       = new CustomFarm();
                GreenHouseData = new CustomGreenHouse();
                Monitor.Log($"Reading content pack: {ContentPack.Manifest.Name} {ContentPack.Manifest.Version}.");

                ContainsFarm       = ProcessFarmType(ContentPack, out FarmData);
                ContainsGreenHouse = ProcessGreenHouseType(ContentPack, out GreenHouseData);

                if (FarmData.Version < 2.1)
                {
                    FarmData = PopulateOld(ContentPack, Monitor, FarmData.Version);
                }

                if (ContainsFarm)
                {
                    Monitor.Log($"\t + Contains a custom farm.", LogLevel.Trace);
                    LoadIcon(Helper, ContentPack, FarmData);
                    Validate(FarmData);
                }

                if (FarmData != null)
                {
                    FarmData.ContentPack = ContentPack;
                    FarmList.Add(FarmData);
                }
                if (GreenHouseData != null)
                {
                    GreenHouseData.ContentPack = ContentPack;
                    GreenHouseList.Add(GreenHouseData);
                }
            }

            return;
        }