summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs
blob: 614cdf49c4749dbdc6889c89c8e3b2dd94b08d11 (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
using System;
using System.Collections.Generic;
using System.Collections.Immutable;

namespace StardewModdingAPI.Events
{
    /// <summary>Event arguments for an <see cref="IContentEvents.AssetsInvalidated"/> event.</summary>
    public class AssetsInvalidatedEventArgs : EventArgs
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The asset names that were invalidated.</summary>
        public IReadOnlySet<IAssetName> Names { get; }

        /// <summary>The <see cref="Names"/> with any locale codes stripped.</summary>
        /// <remarks>For example, if <see cref="Names"/> contains a locale like <c>Data/Bundles.fr-FR</c>, this will have the name without locale like <c>Data/Bundles</c>. If the name has no locale, this field is equivalent.</remarks>
        public IReadOnlySet<IAssetName> NamesWithoutLocale { get; }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="names">The asset names that were invalidated.</param>
        /// <param name="namesWithoutLocale">The <paramref name="names"/> with any locale codes stripped.</param>
        internal AssetsInvalidatedEventArgs(IEnumerable<IAssetName> names, IEnumerable<IAssetName> namesWithoutLocale)
        {
            this.Names = names.ToImmutableHashSet();
            this.NamesWithoutLocale = namesWithoutLocale.ToImmutableHashSet();
        }
    }
}