forked from LavaGang/MelonLoader
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathApplicationHandler.cs
49 lines (41 loc) · 1.44 KB
/
ApplicationHandler.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
using System;
using System.Reflection;
using UnityEngine;
namespace MelonLoader.Support
{
internal static class ApplicationHandler
{
#if __ANDROID__
// internal static string _InternalGUID = new Guid().ToString();
internal static string GetVersion()
{
return "0.0.0";
}
internal static string GetBuildGUID()
{
return "0000";
}
#else
private static MethodInfo Application_get_version = null;
private static MethodInfo Application_get_buildGUID = null;
static ApplicationHandler()
{
Type applicationType = typeof(Application);
PropertyInfo versionProp = applicationType.GetProperty("version");
if (versionProp != null)
Application_get_version = versionProp.GetGetMethod();
PropertyInfo buildGUIDProp = applicationType.GetProperty("buildGUID");
if (buildGUIDProp != null)
Application_get_buildGUID = buildGUIDProp.GetGetMethod();
}
internal static string GetVersion()
=> (Application_get_version != null)
? (string)Application_get_version.Invoke(null, new object[0])
: null;
internal static string GetBuildGUID()
=> (Application_get_buildGUID != null)
? (string)Application_get_buildGUID.Invoke(null, new object[0])
: null;
#endif
}
}