summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Networking/RemoteContextModel.cs
blob: 7d53e732234514618268dd0538e7f770cbdb8135 (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
36
37
38
39
40
41
42
43
44
45
using System;

namespace StardewModdingAPI.Framework.Networking
{
    /// <summary>Metadata about the game, SMAPI, and installed mods exchanged with connected computers.</summary>
    internal class RemoteContextModel
    {
        /*********
        ** Accessors
        *********/
        /// <summary>Whether this player is the host player.</summary>
        public bool IsHost { get; }

        /// <summary>The game's platform.</summary>
        public GamePlatform Platform { get; }

        /// <summary>The installed version of Stardew Valley.</summary>
        public ISemanticVersion? GameVersion { get; }

        /// <summary>The installed version of SMAPI.</summary>
        public ISemanticVersion? ApiVersion { get; }

        /// <summary>The installed mods.</summary>
        public RemoteContextModModel[] Mods { get; }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="isHost">Whether this player is the host player.</param>
        /// <param name="platform">The game's platform.</param>
        /// <param name="gameVersion">The installed version of Stardew Valley.</param>
        /// <param name="apiVersion">The installed version of SMAPI.</param>
        /// <param name="mods">The installed mods.</param>
        public RemoteContextModel(bool isHost, GamePlatform platform, ISemanticVersion gameVersion, ISemanticVersion apiVersion, RemoteContextModModel[]? mods)
        {
            this.IsHost = isHost;
            this.Platform = platform;
            this.GameVersion = gameVersion;
            this.ApiVersion = apiVersion;
            this.Mods = mods ?? Array.Empty<RemoteContextModModel>();
        }
    }
}