forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplicationLauncher.cs
More file actions
159 lines (149 loc) · 5.6 KB
/
ApplicationLauncher.cs
File metadata and controls
159 lines (149 loc) · 5.6 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading;
using UnityEditor;
using UnityEditor.Modules;
internal class ApplicationLauncher
{
public static void BuildAndRun(BuildLaunchPlayerArgs args)
{
if (args.target != BuildTarget.WSAPlayer)
{
throw new ArgumentException("Invalid build target.", "target");
}
if (args.installPath.StartsWith(@"\\") || args.installPath.StartsWith("//"))
{
throw new ArgumentException("Can not Build & Run to network share!");
}
WSASDK wsaSDK = EditorUserBuildSettings.wsaSDK;
if (wsaSDK == WSASDK.UniversalSDK81)
{
switch (EditorUserBuildSettings.wsaBuildAndRunDeployTarget)
{
case WSABuildAndRunDeployTarget.LocalMachine:
wsaSDK = WSASDK.SDK81;
break;
case WSABuildAndRunDeployTarget.WindowsPhone:
wsaSDK = WSASDK.PhoneSDK81;
break;
}
}
if (((wsaSDK == WSASDK.UniversalSDK81) || (wsaSDK == WSASDK.UWP)) && (EditorUserBuildSettings.wsaBuildAndRunDeployTarget == WSABuildAndRunDeployTarget.LocalMachineAndWindowsPhone))
{
BuildAndRunOnBoth(args, wsaSDK);
}
else
{
BuildAndRunOnSingle(args, wsaSDK, EditorUserBuildSettings.wsaBuildAndRunDeployTarget);
}
}
private static void BuildAndRunOnBoth(BuildLaunchPlayerArgs args, WSASDK wsaSDK)
{
bool flag;
<BuildAndRunOnBoth>c__AnonStorey0 storey = new <BuildAndRunOnBoth>c__AnonStorey0 {
storeException = null,
phoneException = null
};
if (wsaSDK != WSASDK.UniversalSDK81)
{
if (wsaSDK != WSASDK.UWP)
{
throw new Exception("Unexpected WSASDK: " + wsaSDK.ToString());
}
}
else
{
storey.storeLauncher = CreateLauncherInstance(args, WSASDK.SDK81, WSABuildAndRunDeployTarget.LocalMachine);
storey.phoneLauncher = CreateLauncherInstance(args, WSASDK.PhoneSDK81, WSABuildAndRunDeployTarget.WindowsPhone);
flag = true;
goto Label_008B;
}
storey.storeLauncher = CreateLauncherInstance(args, WSASDK.UWP, WSABuildAndRunDeployTarget.LocalMachine);
storey.phoneLauncher = CreateLauncherInstance(args, WSASDK.UWP, WSABuildAndRunDeployTarget.WindowsPhone);
flag = false;
Label_008B:
storey.storeLauncher.Build();
storey.phoneLauncher.Build();
if (flag)
{
EditorUtility.DisplayProgressBar("Deploying Player", "Running on local machine and windows phone", 0.75f);
Thread thread = new Thread(new ThreadStart(storey.<>m__0));
Thread thread2 = new Thread(new ThreadStart(storey.<>m__1));
thread.Start();
thread2.Start();
thread.Join();
thread2.Join();
}
else
{
EditorUtility.DisplayProgressBar("Deploying Player", "Running on local machine", 0.75f);
try
{
storey.storeLauncher.Run();
}
catch (Exception exception)
{
storey.storeException = exception;
}
EditorUtility.DisplayProgressBar("Deploying Player", "Running on windows phone", 0.75f);
try
{
storey.phoneLauncher.Run();
}
catch (Exception exception2)
{
storey.phoneException = exception2;
}
}
if ((storey.storeException != null) || (storey.phoneException != null))
{
string str = "";
throw new Exception(str + ((storey.storeException == null) ? "" : storey.storeException.Message) + ((storey.phoneException == null) ? "" : storey.phoneException.Message));
}
}
private static void BuildAndRunOnSingle(BuildLaunchPlayerArgs args, WSASDK wsaSDK, WSABuildAndRunDeployTarget deployTarget)
{
ApplicationLauncherImpl impl = CreateLauncherInstance(args, wsaSDK, deployTarget);
impl.Build();
EditorUtility.DisplayProgressBar("Deploying Player", "Running", 0.75f);
impl.Run();
}
private static ApplicationLauncherImpl CreateLauncherInstance(BuildLaunchPlayerArgs args, WSASDK wsaSDK, WSABuildAndRunDeployTarget deployTarget)
{
string packageName = Utility.GetPackageName(true);
return new ApplicationLauncherImpl(args.playerPackage, Path.GetFullPath(FileUtil.NiceWinPath(args.installPath)), Utility.GetVsName(), GetConfiguration(), wsaSDK, EditorUserBuildSettings.wsaSDK, deployTarget);
}
private static string GetConfiguration() =>
(!EditorUserBuildSettings.development ? "Master" : "Release");
[CompilerGenerated]
private sealed class <BuildAndRunOnBoth>c__AnonStorey0
{
internal Exception phoneException;
internal ApplicationLauncherImpl phoneLauncher;
internal Exception storeException;
internal ApplicationLauncherImpl storeLauncher;
internal void <>m__0()
{
try
{
this.storeLauncher.Run();
}
catch (Exception exception)
{
this.storeException = exception;
}
}
internal void <>m__1()
{
try
{
this.phoneLauncher.Run();
}
catch (Exception exception)
{
this.phoneException = exception;
}
}
}
}