summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Networking/MultiplayerPeerMod.cs
blob: 1e1505087437a930e5a881d3b034efdfc6ae0be5 (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.Diagnostics.CodeAnalysis;

namespace StardewModdingAPI.Framework.Networking
{
    internal class MultiplayerPeerMod : IMultiplayerPeerMod
    {
        /*********
        ** Accessors
        *********/
        /// <inheritdoc />
        public string Name { get; }

        /// <inheritdoc />
        public string ID { get; }

        /// <inheritdoc />
        public ISemanticVersion Version { get; }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="mod">The mod metadata.</param>
        [SuppressMessage("ReSharper", "ConstantConditionalAccessQualifier", Justification = "The ID shouldn't be null, but we should handle it to avoid an error just in case.")]
        public MultiplayerPeerMod(RemoteContextModModel mod)
        {
            this.Name = mod.Name;
            this.ID = mod.ID?.Trim() ?? string.Empty;
            this.Version = mod.Version;
        }
    }
}