diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-07 23:57:47 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-07 23:57:47 -0400 |
commit | b7fb188513a844afed66b9b292ecfddb58528a42 (patch) | |
tree | b4eaf3f40db1490bc4547d595116328014ee04cb /src/SMAPI.Common/Models | |
parent | 99617211fa1d17aa11016b5dd5c5cb63d3b1ac16 (diff) | |
download | SMAPI-b7fb188513a844afed66b9b292ecfddb58528a42.tar.gz SMAPI-b7fb188513a844afed66b9b292ecfddb58528a42.tar.bz2 SMAPI-b7fb188513a844afed66b9b292ecfddb58528a42.zip |
rename shared project for broader use
Diffstat (limited to 'src/SMAPI.Common/Models')
-rw-r--r-- | src/SMAPI.Common/Models/ModInfoModel.cs | 48 | ||||
-rw-r--r-- | src/SMAPI.Common/Models/ModSeachModel.cs | 30 |
2 files changed, 78 insertions, 0 deletions
diff --git a/src/SMAPI.Common/Models/ModInfoModel.cs b/src/SMAPI.Common/Models/ModInfoModel.cs new file mode 100644 index 00000000..e071c0bb --- /dev/null +++ b/src/SMAPI.Common/Models/ModInfoModel.cs @@ -0,0 +1,48 @@ +using Newtonsoft.Json; + +namespace StardewModdingAPI.Common.Models +{ + /// <summary>Generic metadata about a mod.</summary> + internal class ModInfoModel + { + /********* + ** Accessors + *********/ + /// <summary>The mod name.</summary> + public string Name { get; } + + /// <summary>The mod's semantic version number.</summary> + public string Version { get; } + + /// <summary>The mod's web URL.</summary> + public string Url { get; } + + /// <summary>The error message indicating why the mod is invalid (if applicable).</summary> + public string Error { get; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct a valid instance.</summary> + /// <param name="name">The mod name.</param> + /// <param name="version">The mod's semantic version number.</param> + /// <param name="url">The mod's web URL.</param> + /// <param name="error">The error message indicating why the mod is invalid (if applicable).</param> + [JsonConstructor] + public ModInfoModel(string name, string version, string url, string error = null) + { + this.Name = name; + this.Version = version; + this.Url = url; + this.Error = error; // mainly initialised here for the JSON deserialiser + } + + /// <summary>Construct an valid instance.</summary> + /// <param name="error">The error message indicating why the mod is invalid.</param> + public ModInfoModel(string error) + { + this.Error = error; + } + } +} diff --git a/src/SMAPI.Common/Models/ModSeachModel.cs b/src/SMAPI.Common/Models/ModSeachModel.cs new file mode 100644 index 00000000..3f69f0ae --- /dev/null +++ b/src/SMAPI.Common/Models/ModSeachModel.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using System.Linq; + +namespace StardewModdingAPI.Common.Models +{ + /// <summary>Specifies mods whose update-check info to fetch.</summary> + internal class ModSearchModel + { + /********* + ** Accessors + *********/ + /// <summary>The namespaced mod keys to search.</summary> + public string[] ModKeys { get; set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an empty instance.</summary> + /// <remarks>This constructed is needed for JSON deserialisation.</remarks> + public ModSearchModel() { } + + /// <summary>Construct an valid instance.</summary> + /// <param name="modKeys">The namespaced mod keys to search.</param> + public ModSearchModel(IEnumerable<string> modKeys) + { + this.ModKeys = modKeys.ToArray(); + } + } +} |