-
Notifications
You must be signed in to change notification settings - Fork 2
/
AdoptiumReleaseVersion.cs
67 lines (55 loc) · 2.68 KB
/
AdoptiumReleaseVersion.cs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AJ_UpdateWatcher
{
public class AdoptiumReleaseVersion
{
public string Major { get; set; }
public string Minor { get; set; }
public string Security { get; set; }
public string Build { get; set; }
public string VersionString { get; set; } // like: "openjdk_version": "1.8.0_265-b01" :: version only
public string ReleaseName { get; set; } // like: "release_name": "jdk-11.0.8+10_openj9-0.21.0" :: extra info
public string MSIURL { get; set; }
public string ZIPURL { get; set; }
public string LocalPath { get; set; }
public string ImageType { get; set; }
public bool Found { get; set; }
public AdoptiumReleaseVersion()
{
Found = false;
}
public string ParsedVersionString
{
get
{
return $"{Major}.{Minor}.{Security}" + (String.IsNullOrEmpty(Build) || Build == "-1" ? "" : $"+{Build}");
}
}
public static bool operator > (AdoptiumReleaseVersion a, AdoptiumReleaseVersion b)
{
if (Convert.ToInt32(a.Major) > Convert.ToInt32(b.Major)) return true;
if (Convert.ToInt32(a.Major) < Convert.ToInt32(b.Major)) return false;
if (Convert.ToInt32(a.Minor) > Convert.ToInt32(b.Minor)) return true;
if (Convert.ToInt32(a.Minor) < Convert.ToInt32(b.Minor)) return false;
if (Convert.ToInt32(a.Security) > Convert.ToInt32(b.Security)) return true;
if (Convert.ToInt32(a.Security) < Convert.ToInt32(b.Security)) return false;
if (!String.IsNullOrEmpty(a.Build) && !String.IsNullOrEmpty(b.Build) && Convert.ToInt32(a.Build) > Convert.ToInt32(b.Build)) return true;
else return false;
}
public static bool operator < (AdoptiumReleaseVersion a, AdoptiumReleaseVersion b)
{
if (Convert.ToInt32(a.Major) < Convert.ToInt32(b.Major)) return true;
if (Convert.ToInt32(a.Major) > Convert.ToInt32(b.Major)) return false;
if (Convert.ToInt32(a.Minor) < Convert.ToInt32(b.Minor)) return true;
if (Convert.ToInt32(a.Minor) > Convert.ToInt32(b.Minor)) return false;
if (Convert.ToInt32(a.Security) < Convert.ToInt32(b.Security)) return true;
if (Convert.ToInt32(a.Security) > Convert.ToInt32(b.Security)) return false;
if (!String.IsNullOrEmpty(a.Build) && !String.IsNullOrEmpty(b.Build) && Convert.ToInt32(a.Build) < Convert.ToInt32(b.Build)) return true;
else return false;
}
}
}