diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-23 20:16:52 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-23 20:16:52 -0400 |
commit | 36a04a6e77eac74be660dc9848b6045834479f4f (patch) | |
tree | 1176a8920a7656f720e0b36ebc4fe45b26cc202a /src/StardewModdingAPI.Models/ModInfoModel.cs | |
parent | f0e2117f70455bd9883321ae5b0bf40562f2d5de (diff) | |
parent | 57111a6e8fa6a23bb56f515b50f8b7ea5924d49f (diff) | |
download | SMAPI-36a04a6e77eac74be660dc9848b6045834479f4f.tar.gz SMAPI-36a04a6e77eac74be660dc9848b6045834479f4f.tar.bz2 SMAPI-36a04a6e77eac74be660dc9848b6045834479f4f.zip |
Merge branch 'feature/update-check-api' into develop
Diffstat (limited to 'src/StardewModdingAPI.Models/ModInfoModel.cs')
-rw-r--r-- | src/StardewModdingAPI.Models/ModInfoModel.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/StardewModdingAPI.Models/ModInfoModel.cs b/src/StardewModdingAPI.Models/ModInfoModel.cs new file mode 100644 index 00000000..44071230 --- /dev/null +++ b/src/StardewModdingAPI.Models/ModInfoModel.cs @@ -0,0 +1,48 @@ +using Newtonsoft.Json; + +namespace StardewModdingAPI.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; + } + } +} |