FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
UnityLauncherPro/UnityLauncherPro/Data/UnityVersion.cs at 143 · unitycoder/UnityLauncherPro · GitHub
unitycoder
UnityLauncherPro
Repository navigation
Code
Issues
23
(23)
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
UnityLauncherPro
/
UnityLauncherPro
/
Data
/
UnityVersion.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (49 loc) · 2.03 KB
Breadcrumbs
UnityLauncherPro
/
UnityLauncherPro
/
Data
/
UnityVersion.cs
Copy path
File metadata and controls
57 lines (49 loc) · 2.03 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
using
System
;
using
System
.
Collections
.
Generic
;
namespace
UnityLauncherPro
{
public
class
UnityVersion
{
public
string
Version
{
get
;
set
;
}
public
UnityVersionStream
Stream
{
get
;
set
;
}
public
DateTime
ReleaseDate
{
get
;
set
;
}
public
string
directURL
{
get
;
set
;
}
=
null
;
// if found from unofficial releases list
public
static
UnityVersion
FromJson
(
string
json
)
{
var
values
=
ParseJsonToDictionary
(
json
)
;
return
new
UnityVersion
{
Version
=
values
.
ContainsKey
(
"version"
)
?
values
[
"version"
]
:
null
,
Stream
=
ParseStream
(
values
.
ContainsKey
(
"stream"
)
?
values
[
"stream"
]
:
null
)
,
ReleaseDate
=
DateTime
.
TryParse
(
values
.
ContainsKey
(
"releaseDate"
)
?
values
[
"releaseDate"
]
:
null
,
out
var
date
)
?
date
:
default
}
;
}
public
string
ToJson
(
)
{
return
$
"{{
\"
version
\"
:
\"
{
Version
}
\"
,
\"
stream
\"
:
\"
{
Stream
}
\"
,
\"
releaseDate
\"
:
\"
{
ReleaseDate
:
yyyy-MM-ddTHH:mm:ss
}
\"
}}"
;
}
private
static
Dictionary
<
string
,
string
>
ParseJsonToDictionary
(
string
json
)
{
var
result
=
new
Dictionary
<
string
,
string
>
(
)
;
json
=
json
.
Trim
(
new
char
[
]
{
'{'
,
'}'
,
' '
}
)
;
var
keyValuePairs
=
json
.
Split
(
new
[
]
{
','
}
,
StringSplitOptions
.
RemoveEmptyEntries
)
;
foreach
(
var
pair
in
keyValuePairs
)
{
var
keyValue
=
pair
.
Split
(
new
[
]
{
':'
}
,
2
)
;
if
(
keyValue
.
Length
==
2
)
{
var
key
=
keyValue
[
0
]
.
Trim
(
new
char
[
]
{
' '
,
'"'
}
)
;
var
value
=
keyValue
[
1
]
.
Trim
(
new
char
[
]
{
' '
,
'"'
}
)
;
result
[
key
]
=
value
;
}
}
return
result
;
}
private
static
UnityVersionStream
ParseStream
(
string
stream
)
{
return
Enum
.
TryParse
(
stream
,
true
,
out
UnityVersionStream
result
)
?
result
:
UnityVersionStream
.
Tech
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL