From b07d2340a9a6da22ee0fd95f2c6ccca3939cb7ab Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 22 Mar 2022 23:00:18 -0400 Subject: encapsulate & cache asset operation groups (#766) This is needed for the upcoming Stardew Valley 1.6 to avoid duplicate checks between DoesAssetExist and Load calls, and to make sure the answer doesn't change between them. --- src/SMAPI/Framework/Content/AssetOperationGroup.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/SMAPI/Framework/Content/AssetOperationGroup.cs (limited to 'src/SMAPI/Framework/Content') diff --git a/src/SMAPI/Framework/Content/AssetOperationGroup.cs b/src/SMAPI/Framework/Content/AssetOperationGroup.cs new file mode 100644 index 00000000..a2fcb722 --- /dev/null +++ b/src/SMAPI/Framework/Content/AssetOperationGroup.cs @@ -0,0 +1,33 @@ +namespace StardewModdingAPI.Framework.Content +{ + /// A set of operations to apply to an asset for a given or implementation. + internal class AssetOperationGroup + { + /********* + ** Accessors + *********/ + /// The mod applying the changes. + public IModMetadata Mod { get; } + + /// The load operations to apply. + public AssetLoadOperation[] LoadOperations { get; } + + /// The edit operations to apply. + public AssetEditOperation[] EditOperations { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The mod applying the changes. + /// The load operations to apply. + /// The edit operations to apply. + public AssetOperationGroup(IModMetadata mod, AssetLoadOperation[] loadOperations, AssetEditOperation[] editOperations) + { + this.Mod = mod; + this.LoadOperations = loadOperations; + this.EditOperations = editOperations; + } + } +} -- cgit