summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Content/AssetEditOperation.cs
blob: 14db231c904ad42607586e6f6feb610136f55deb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;

namespace StardewModdingAPI.Framework.Content
{
    /// <summary>An edit to apply to an asset when it's requested from the content pipeline.</summary>
    internal class AssetEditOperation
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The mod applying the edit.</summary>
        public IModMetadata Mod { get; }

        /// <summary>The content pack on whose behalf the edit is being applied, if any.</summary>
        public IModMetadata OnBehalfOf { get; }

        /// <summary>Apply the edit to an asset.</summary>
        public Action<IAssetData> ApplyEdit { get; }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="mod">The mod applying the edit.</param>
        /// <param name="onBehalfOf">The content pack on whose behalf the edit is being applied, if any.</param>
        /// <param name="applyEdit">Apply the edit to an asset.</param>
        public AssetEditOperation(IModMetadata mod, IModMetadata onBehalfOf, Action<IAssetData> applyEdit)
        {
            this.Mod = mod;
            this.OnBehalfOf = onBehalfOf;
            this.ApplyEdit = applyEdit;
        }
    }
}