Elin Decompiled Documentation EA 23.102 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 IsBelow(int _int)
42 {
43 return GetInt() < _int;
44 }
45
46 public static Version Get(string str)
47 {
48 if (str.IsEmpty())
49 {
50 return default(Version);
51 }
52 string[] array = str.Split('.');
53 if (array.Length < 3)
54 {
55 return default(Version);
56 }
57 Version result = default(Version);
58 result.major = array[0].ToInt();
59 result.minor = array[1].ToInt();
60 result.batch = array[2].ToInt();
61 return result;
62 }
63
64 public static Version Get(int i)
65 {
66 Version result = default(Version);
67 result.major = i / 1000000;
68 result.minor = i / 1000 % 1000;
69 result.batch = i % 1000;
70 return result;
71 }
72
74 {
75 if (IsBelow(v))
76 {
77 return false;
78 }
79 if (major == v.major)
80 {
81 return minor >= 21;
82 }
83 return false;
84 }
85
86 public override bool Equals(object obj)
87 {
88 Version version = (Version)obj;
89 if (version.major == major && version.minor == minor)
90 {
91 return version.batch == batch;
92 }
93 return false;
94 }
95
96 public override int GetHashCode()
97 {
98 return GetInt();
99 }
100}
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:86
static Version Get(int i)
Definition: Version.cs:64
static Version Get(string str)
Definition: Version.cs:46
override int GetHashCode()
Definition: Version.cs:96
bool IsBelow(int _int)
Definition: Version.cs:41
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
int minor
Definition: Version.cs:8
bool demo
Definition: Version.cs:14
bool IsSaveCompatible(Version v)
Definition: Version.cs:73