using Serilog; // Make a version since it is so much easier to compare when the class handles it. namespace EdgeInstaller; sealed partial class Version : IEquatable { public int Major { get; private set; } public int Minor { get; private set; } public int Build { get; private set; } public int Patch { get; private set; } public int Subpatch { get; private set; } public Version(string versionString) { Log.Information("Creating version from string {versionString}", versionString); if (versionString == "") { throw new ArgumentException("The passed version string was empty", "versionString"); } var splitVersion = versionString.Split('.'); Log.Debug("SplitVersion = {@splitversion}", splitVersion); Major = int.Parse(splitVersion[0]); Minor = int.Parse(splitVersion[1]); Build = int.Parse(splitVersion[2]); var splitPatch = splitVersion[3].Split('-'); Log.Debug("SplitPatch = {@splitPatch}", splitPatch); Log.Debug("SplitPatch values : [0] = {0}, [1] = {1}", splitPatch[0], splitPatch[1]); Patch = int.Parse(splitPatch[0]); Subpatch = int.Parse(splitPatch[1]); Log.Debug("Version Created: {@version}", this); } public override string ToString() { return $"{Major}.{Minor}.{Build}.{Patch}-{Subpatch}"; } }