Elin Decompiled Documentation EA 23.130 Nightly
Loading...
Searching...
No Matches
Version.cs
Go to the documentation of this file.
1using System;
2
3[Serializable]
4public struct Version
5{
6 public int major;
7
8 public int minor;
9
10 public int batch;
11
12 public int fix;
13
14 public bool demo;
15
16 public string GetText()
17 {
18 return ((minor >= 23) ? "EA" : "Beta") + " " + minor + "." + batch + ((fix == 0) ? "" : (" Patch " + fix)) + (demo ? "demo".lang() : "");
19 }
20
21 public int GetInt()
22 {
23 return major * 1000000 + minor * 1000 + batch;
24 }
25
26 public int GetInt(int _major, int _minor, int _batch)
27 {
28 return _major * 1000000 + _minor * 1000 + _batch;
29 }
30
31 public bool IsBelow(int _major, int _minor, int _batch)
32 {
33 return GetInt() < GetInt(_major, _minor, _batch);
34 }
35
36 public bool IsBelow(Version v)
37 {
38 return IsBelow(v.GetInt());
39 }
40
41 public bool IsSameOrBelow(Version v)
42 {
43 if (v.GetInt() != GetInt())
44 {
45 return IsBelow(v.GetInt());
46 }
47 return true;
48 }
49
50 public bool IsBelow(int _int)
51 {
52 return GetInt() < _int;
53 }
54
55 public static Version Get(string str)
56 {
57 if (str.IsEmpty())
58 {
59 return default(Version);
60 }
61 string[] array = str.Split('.');
62 if (array.Length < 3)
63 {
64 return default(Version);
65 }
66 Version result = default(Version);
67 result.major = array[0].ToInt();
68 result.minor = array[1].ToInt();
69 result.batch = array[2].ToInt();
70 return result;
71 }
72
73 public static Version Get(int i)
74 {
75 Version result = default(Version);
76 result.major = i / 1000000;
77 result.minor = i / 1000 % 1000;
78 result.batch = i % 1000;
79 return result;
80 }
81
83 {
84 if (IsBelow(v))
85 {
86 return false;
87 }
88 if (major == v.major)
89 {
90 return minor >= 21;
91 }
92 return false;
93 }
94
95 public override bool Equals(object obj)
96 {
97 Version version = (Version)obj;
98 if (version.major == major && version.minor == minor)
99 {
100 return version.batch == batch;
101 }
102 return false;
103 }
104
105 public override int GetHashCode()
106 {
107 return GetInt();
108 }
109}
int GetInt(int _major, int _minor, int _batch)
Definition: Version.cs:26
bool IsBelow(Version v)
Definition: Version.cs:36
int batch
Definition: Version.cs:10
override bool Equals(object obj)
Definition: Version.cs:95
static Version Get(int i)
Definition: Version.cs:73
static Version Get(string str)
Definition: Version.cs:55
override int GetHashCode()
Definition: Version.cs:105
bool IsBelow(int _int)
Definition: Version.cs:50
string GetText()
Definition: Version.cs:16
bool IsBelow(int _major, int _minor, int _batch)
Definition: Version.cs:31
int major
Definition: Version.cs:6
int GetInt()
Definition: Version.cs:21
int fix
Definition: Version.cs:12
bool IsSameOrBelow(Version v)
Definition: Version.cs:41
int minor
Definition: Version.cs:8
bool demo
Definition: Version.cs:14
bool IsSaveCompatible(Version v)
Definition: Version.cs:82