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