blob: cce68ad8b83864f2ad0fb3f9effff698fac98a84 (
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
46
47
48
49
50
51
52
|
using System;
using Newtonsoft.Json;
namespace StardewModdingAPI
{
/// <summary>A semantic mod version with an optional build tag.</summary>
public struct Version
{
/*********
** Accessors
*********/
/// <summary>The major version incremented for major API changes.</summary>
public int MajorVersion { get; set; }
/// <summary>The minor version incremented for backwards-compatible changes.</summary>
public int MinorVersion { get; set; }
/// <summary>The patch version for backwards-compatible bug fixes.</summary>
public int PatchVersion { get; set; }
/// <summary>An optional build tag.</summary>
public string Build { get; set; }
/// <summary>Obsolete.</summary>
[JsonIgnore]
[Obsolete("Use `Version.ToString()` instead.")]
public string VersionString => this.ToString();
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="major">The major version incremented for major API changes.</param>
/// <param name="minor">The minor version incremented for backwards-compatible changes.</param>
/// <param name="patch">The patch version for backwards-compatible bug fixes.</param>
/// <param name="build">An optional build tag.</param>
public Version(int major, int minor, int patch, string build)
{
this.MajorVersion = major;
this.MinorVersion = minor;
this.PatchVersion = patch;
this.Build = build;
}
/// <summary>Get a string representation of the version.</summary>
public override string ToString()
{
return $"{this.MajorVersion}.{this.MinorVersion}.{this.PatchVersion} {this.Build}".Trim();
}
}
}
|