コード例 #1
0
ファイル: ManagedChest.cs プロジェクト: liroudev/StardewMods
        /// <summary>Update the chest metadata.</summary>
        /// <param name="name">The chest's display name.</param>
        /// <param name="category">The category name (if any).</param>
        /// <param name="order">The sort value (if any).</param>
        /// <param name="ignored">Whether the chest should be ignored.</param>
        /// <param name="automateStoreItems">Whether Automate should take items from this container.</param>
        /// <param name="automateTakeItems">Whether Automate should put items in this container.</param>
        public void Update(string name, string category, int?order, bool ignored, AutomateContainerPreference automateStoreItems, AutomateContainerPreference automateTakeItems)
        {
            ContainerData data = this.Container.Data;

            data.Name = !string.IsNullOrWhiteSpace(name) && name != this.DefaultDisplayName
                ? name.Trim()
                : null;
            data.Category = !string.IsNullOrWhiteSpace(category) && category != this.DefaultCategory
                ? category.Trim()
                : null;
            data.Order              = order;
            data.IsIgnored          = ignored;
            data.AutomateStoreItems = automateStoreItems;
            data.AutomateTakeItems  = automateTakeItems;

            this.Container.SaveData();
        }
コード例 #2
0
 /// <summary>Get whether IO is preferred.</summary>
 /// <param name="preference">The IO preference.</param>
 public static bool IsPreferred(this AutomateContainerPreference preference)
 {
     return(preference == AutomateContainerPreference.Prefer);
 }
コード例 #3
0
 /*********
 ** Methods
 *********/
 /// <summary>Get whether IO is enabled.</summary>
 /// <param name="preference">The IO preference.</param>
 public static bool IsAllowed(this AutomateContainerPreference preference)
 {
     return(preference != AutomateContainerPreference.Disable);
 }