VRC SDK
This project aims to completely document the VRChat Unity SDK
Loading...
Searching...
No Matches
VRCSDK3-Editor.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Collections.ObjectModel;
5using System.ComponentModel;
6using System.Diagnostics;
7using System.IO;
8using System.Linq;
9using System.Reflection;
10using System.Runtime.CompilerServices;
11using System.Runtime.Versioning;
12using System.Text;
13using System.Threading;
14using UnityEditor;
15using UnityEditor.AnimatedValues;
16using UnityEditor.AssetImporters;
17using UnityEditor.Build;
18using UnityEditor.Build.Reporting;
19using UnityEditor.SceneManagement;
20using UnityEditor.UI;
21using UnityEngine;
22using UnityEngine.Events;
23using UnityEngine.Networking;
24using UnityEngine.SceneManagement;
25using UnityEngine.UI;
26using UnityEngine.UIElements;
27using VRC.Core;
31using VRC.SDKBase;
36
37[assembly: CompilationRelaxations(8)]
38[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
39[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
40[assembly: VRCAssetExporter(/*Could not decode attribute arguments.*/)]
41[assembly: VRCSdkBuilder(/*Could not decode attribute arguments.*/)]
42[assembly: InternalsVisibleTo("VRC.SDK3.Editor")]
43[assembly: UnityAPICompatibilityVersion("2022.3.22f1", true)]
44[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
45[assembly: AssemblyCompany("VRCSDK3-Editor")]
46[assembly: AssemblyConfiguration("Release")]
47[assembly: AssemblyFileVersion("1.0.0.0")]
48[assembly: AssemblyInformationalVersion("1.0.0+77370df7b4055abf7cc0fb1da3c3d290108e9941")]
49[assembly: AssemblyProduct("VRCSDK3-Editor")]
50[assembly: AssemblyTitle("VRCSDK3-Editor")]
51[assembly: AssemblyVersion("1.0.0.0")]
53{
54 private static List<string> _playerObjectsToEnableInPost;
55
56 public int callbackOrder => -1024;
57
58 public bool OnPreprocessScene(Scene scene)
59 {
60 VRCSceneDescriptor vRCSceneDescriptor = null;
61 GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
62 for (int i = 0; i < rootGameObjects.Length; i++)
63 {
64 vRCSceneDescriptor = rootGameObjects[i].GetComponentInChildren<VRCSceneDescriptor>(true);
65 if ((Object)(object)vRCSceneDescriptor != (Object)null)
66 {
67 break;
68 }
69 }
70 if ((Object)(object)vRCSceneDescriptor == (Object)null)
71 {
72 return true;
73 }
74 List<VRCPlayerObject> val = new List<VRCPlayerObject>();
75 _playerObjectsToEnableInPost = new List<string>();
76 rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
77 for (int i = 0; i < rootGameObjects.Length; i++)
78 {
79 VRCPlayerObject[] componentsInChildren = rootGameObjects[i].GetComponentsInChildren<VRCPlayerObject>(true);
80 foreach (VRCPlayerObject vRCPlayerObject in componentsInChildren)
81 {
82 if (((Component)vRCPlayerObject).gameObject.activeInHierarchy)
83 {
84 _playerObjectsToEnableInPost.Add(((Object)vRCPlayerObject).name);
85 }
86 ((Component)vRCPlayerObject).gameObject.SetActive(false);
87 val.Add(vRCPlayerObject);
88 }
89 }
90 if (val.Count > 0)
91 {
92 vRCSceneDescriptor.PlayerPersistence = val.ToArray();
93 AssetDatabase.SaveAssets();
94 }
95 return true;
96 }
97
98 public void OnPostprocessScene(Scene scene)
99 {
100 //IL_0067: Unknown result type (might be due to invalid IL or missing references)
101 if (_playerObjectsToEnableInPost == null || _playerObjectsToEnableInPost.Count <= 0)
102 {
103 return;
104 }
105 GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
106 for (int i = 0; i < rootGameObjects.Length; i++)
107 {
108 VRCPlayerObject[] componentsInChildren = rootGameObjects[i].GetComponentsInChildren<VRCPlayerObject>(true);
109 foreach (VRCPlayerObject vRCPlayerObject in componentsInChildren)
110 {
111 if (_playerObjectsToEnableInPost.Contains(((Object)vRCPlayerObject).name))
112 {
113 ((Component)vRCPlayerObject).gameObject.SetActive(true);
114 }
115 }
116 }
117 EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
118 EditorSceneManager.SaveOpenScenes();
119 }
120}
122{
123 [CanEditMultipleObjects]
124 [CustomEditor(/*Could not decode attribute arguments.*/)]
125 public class InputFieldEditor : SelectableEditor
126 {
127 private SerializedProperty m_TextComponent;
128
129 private SerializedProperty m_Text;
130
131 private SerializedProperty m_ContentType;
132
133 private SerializedProperty m_LineType;
134
135 private SerializedProperty m_InputType;
136
137 private SerializedProperty m_CharacterValidation;
138
139 private SerializedProperty m_KeyboardType;
140
141 private SerializedProperty m_CharacterLimit;
142
143 private SerializedProperty m_CaretBlinkRate;
144
145 private SerializedProperty m_CaretWidth;
146
147 private SerializedProperty m_CaretColor;
148
149 private SerializedProperty m_CustomCaretColor;
150
151 private SerializedProperty m_SelectionColor;
152
153 private SerializedProperty m_HideMobileInput;
154
155 private SerializedProperty m_Placeholder;
156
157 private SerializedProperty m_OnValueChanged;
158
159 private SerializedProperty m_OnEndEdit;
160
161 private SerializedProperty m_ReadOnly;
162
163 private AnimBool m_CustomColor;
164
165 protected override void OnEnable()
166 {
167 //IL_019e: Unknown result type (might be due to invalid IL or missing references)
168 //IL_01a8: Expected O, but got Unknown
169 //IL_01bb: Unknown result type (might be due to invalid IL or missing references)
170 //IL_01c5: Expected O, but got Unknown
171 ((SelectableEditor)this).OnEnable();
172 m_TextComponent = ((Editor)this).serializedObject.FindProperty("m_TextComponent");
173 m_Text = ((Editor)this).serializedObject.FindProperty("m_Text");
174 m_ContentType = ((Editor)this).serializedObject.FindProperty("m_ContentType");
175 m_LineType = ((Editor)this).serializedObject.FindProperty("m_LineType");
176 m_InputType = ((Editor)this).serializedObject.FindProperty("m_InputType");
177 m_CharacterValidation = ((Editor)this).serializedObject.FindProperty("m_CharacterValidation");
178 m_KeyboardType = ((Editor)this).serializedObject.FindProperty("m_KeyboardType");
179 m_CharacterLimit = ((Editor)this).serializedObject.FindProperty("m_CharacterLimit");
180 m_CaretBlinkRate = ((Editor)this).serializedObject.FindProperty("m_CaretBlinkRate");
181 m_CaretWidth = ((Editor)this).serializedObject.FindProperty("m_CaretWidth");
182 m_CaretColor = ((Editor)this).serializedObject.FindProperty("m_CaretColor");
183 m_CustomCaretColor = ((Editor)this).serializedObject.FindProperty("m_CustomCaretColor");
184 m_SelectionColor = ((Editor)this).serializedObject.FindProperty("m_SelectionColor");
185 m_HideMobileInput = ((Editor)this).serializedObject.FindProperty("m_HideMobileInput");
186 m_Placeholder = ((Editor)this).serializedObject.FindProperty("m_Placeholder");
187 m_OnValueChanged = ((Editor)this).serializedObject.FindProperty("m_OnValueChanged");
188 m_OnEndEdit = ((Editor)this).serializedObject.FindProperty("m_OnEndEdit");
189 m_ReadOnly = ((Editor)this).serializedObject.FindProperty("m_ReadOnly");
190 m_CustomColor = new AnimBool(m_CustomCaretColor.boolValue);
191 ((BaseAnimValue<bool>)(object)m_CustomColor).valueChanged.AddListener(new UnityAction(((Editor)this).Repaint));
192 }
193
194 protected override void OnDisable()
195 {
196 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
197 //IL_0023: Expected O, but got Unknown
198 ((SelectableEditor)this).OnDisable();
199 ((BaseAnimValue<bool>)(object)m_CustomColor).valueChanged.RemoveListener(new UnityAction(((Editor)this).Repaint));
200 }
201
202 public override void OnInspectorGUI()
203 {
204 ((Editor)this).serializedObject.Update();
205 ((SelectableEditor)this).OnInspectorGUI();
206 EditorGUILayout.Space();
207 EditorGUILayout.PropertyField(m_TextComponent, Array.Empty<GUILayoutOption>());
208 if (m_TextComponent != null && m_TextComponent.objectReferenceValue != (Object)null && ((Text)/*isinst with value type is only supported in some contexts*/).supportRichText)
209 {
210 EditorGUILayout.HelpBox("Using Rich Text with input is unsupported.", (MessageType)2);
211 }
212 DisabledScope val = default(DisabledScope);
213 ((DisabledScope)(ref val))..ctor(m_TextComponent == null || m_TextComponent.objectReferenceValue == (Object)null);
214 try
215 {
216 EditorGUILayout.PropertyField(m_Text, Array.Empty<GUILayoutOption>());
217 EditorGUILayout.PropertyField(m_CharacterLimit, Array.Empty<GUILayoutOption>());
218 EditorGUILayout.Space();
219 EditorGUILayout.PropertyField(m_ContentType, Array.Empty<GUILayoutOption>());
220 if (!m_ContentType.hasMultipleDifferentValues)
221 {
222 EditorGUI.indentLevel += 1;
223 if (m_ContentType.enumValueIndex == 0 || m_ContentType.enumValueIndex == 1 || m_ContentType.enumValueIndex == 9)
224 {
225 EditorGUILayout.PropertyField(m_LineType, Array.Empty<GUILayoutOption>());
226 }
227 if (m_ContentType.enumValueIndex == 9)
228 {
229 EditorGUILayout.PropertyField(m_InputType, Array.Empty<GUILayoutOption>());
230 EditorGUILayout.PropertyField(m_KeyboardType, Array.Empty<GUILayoutOption>());
231 EditorGUILayout.PropertyField(m_CharacterValidation, Array.Empty<GUILayoutOption>());
232 }
233 EditorGUI.indentLevel -= 1;
234 }
235 EditorGUILayout.Space();
236 EditorGUILayout.PropertyField(m_Placeholder, Array.Empty<GUILayoutOption>());
237 EditorGUILayout.PropertyField(m_CaretBlinkRate, Array.Empty<GUILayoutOption>());
238 EditorGUILayout.PropertyField(m_CaretWidth, Array.Empty<GUILayoutOption>());
239 EditorGUILayout.PropertyField(m_CustomCaretColor, Array.Empty<GUILayoutOption>());
240 ((BaseAnimValue<bool>)(object)m_CustomColor).target = m_CustomCaretColor.boolValue;
241 if (EditorGUILayout.BeginFadeGroup(m_CustomColor.faded))
242 {
243 EditorGUILayout.PropertyField(m_CaretColor, Array.Empty<GUILayoutOption>());
244 }
245 EditorGUILayout.EndFadeGroup();
246 EditorGUILayout.PropertyField(m_SelectionColor, Array.Empty<GUILayoutOption>());
247 EditorGUILayout.PropertyField(m_HideMobileInput, Array.Empty<GUILayoutOption>());
248 EditorGUILayout.PropertyField(m_ReadOnly, Array.Empty<GUILayoutOption>());
249 EditorGUILayout.Space();
250 EditorGUILayout.PropertyField(m_OnValueChanged, Array.Empty<GUILayoutOption>());
251 EditorGUILayout.PropertyField(m_OnEndEdit, Array.Empty<GUILayoutOption>());
252 }
253 finally
254 {
255 ((IDisposable)(DisabledScope)(ref val)).Dispose();
256 }
257 ((Editor)this).serializedObject.ApplyModifiedProperties();
258 }
259 }
260}
262{
263 [ScriptedImporter(1, "mid")]
264 public class MidiFileImporter : ScriptedImporter
265 {
267
268 public override void OnImportAsset(AssetImportContext ctx)
269 {
270 MidiFile midiFile = MidiFile.Create(ctx.assetPath, ImportSettings);
271 ctx.AddObjectToAsset("main obj", (Object)(object)midiFile);
272 ctx.SetMainObject((Object)(object)midiFile);
273 }
274 }
275}
277{
278 [CustomPropertyDrawer(/*Could not decode attribute arguments.*/)]
279 public class EnumFlagsAttributeDrawer : PropertyDrawer
280 {
281 public override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label)
282 {
283 //IL_003d: Unknown result type (might be due to invalid IL or missing references)
284 //IL_009a: Unknown result type (might be due to invalid IL or missing references)
285 int num = 0;
286 int num2 = _property.enumNames.Length;
287 bool[] array = (bool[])(object)new Boolean[num2];
288 float num3 = (((Rect)(ref _position)).width - EditorGUIUtility.labelWidth) / (float)num2;
289 EditorGUI.LabelField(new Rect(((Rect)(ref _position)).x, ((Rect)(ref _position)).y, EditorGUIUtility.labelWidth, ((Rect)(ref _position)).height), _label);
290 EditorGUI.BeginChangeCheck();
291 Rect val = default(Rect);
292 for (int i = 0; i < num2; i++)
293 {
294 if ((_property.intValue & (1 << i)) == 1 << i)
295 {
296 array[i] = true;
297 }
298 ((Rect)(ref val))..ctor(((Rect)(ref _position)).x + EditorGUIUtility.labelWidth + num3 * (float)i, ((Rect)(ref _position)).y, num3, ((Rect)(ref _position)).height);
299 array[i] = GUI.Toggle(val, array[i], _property.enumNames[i], GUIStyle.op_Implicit("Button"));
300 if (array[i])
301 {
302 num += 1 << i;
303 }
304 }
305 if (EditorGUI.EndChangeCheck())
306 {
307 _property.intValue = num;
308 }
309 }
310 }
311 [CustomEditor(/*Could not decode attribute arguments.*/)]
312 public class VRCEnablePersistenceEditor : Editor
313 {
314 public override VisualElement CreateInspectorGUI()
315 {
316 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
317 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
318 //IL_003d: Expected O, but got Unknown
319 VisualElement val = new VisualElement();
320 HelpBoxVisualElement helpBoxVisualElement = new HelpBoxVisualElement("Persistence will be enabled for this object, and all of its children.", (HelpBoxMessageType)1);
321 if (!Object.op_Implicit((Object)(object)((Component)(((Editor)this).target as VRCEnablePersistence)).GetComponentInParent<VRCPlayerObject>(true)))
322 {
323 helpBoxVisualElement = new HelpBoxVisualElement("VRCEnablePersistence must be a child of a VRCPlayerObject to enable persistence.", (HelpBoxMessageType)3);
324 }
325 val.Add((VisualElement)(object)helpBoxVisualElement);
326 return val;
327 }
328 }
329}
331{
332 public class HelpBoxVisualElement : HelpBox
333 {
334 public HelpBoxVisualElement(string message, HelpBoxMessageType messageType)
335 : base(message, messageType)
336 {
337 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
338 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
339 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
340 Label obj = UQueryExtensions.Q<Label>((VisualElement)(object)this, (string)null, (string)null);
341 ((VisualElement)obj).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)0);
342 ((VisualElement)obj).style.fontSize = StyleLength.op_Implicit(12f);
343 }
344 }
345}
347{
348 [CustomEditor(/*Could not decode attribute arguments.*/)]
349 public class VRCPlayerPersistenceEditor : Editor
350 {
351 private void OnEnable()
352 {
353 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
354 //IL_0011: Expected O, but got Unknown
355 EditorApplication.hierarchyChanged += new Action(RemoveNestedPlayerObjectComponents);
357 }
358
359 private void OnDisable()
360 {
361 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
362 //IL_0011: Expected O, but got Unknown
363 EditorApplication.hierarchyChanged -= new Action(RemoveNestedPlayerObjectComponents);
364 }
365
367 {
368 VRCPlayerObject vRCPlayerObject = (VRCPlayerObject)(object)((Editor)this).target;
369 if (!((Object)(object)vRCPlayerObject == (Object)null))
370 {
371 string existingPlayerObjectChild;
372 if (HasParentWithComponent(((Component)vRCPlayerObject).transform, out var existingPlayerObjectParent))
373 {
374 Debug.LogError((object)String.Concat((string[])(object)new String[5]
375 {
376 "Can't add VRCPlayerObject to ",
377 ((Editor)this).target.name,
378 ". Parent ",
379 existingPlayerObjectParent,
380 " already has a VRCPlayerObject component. Nested VRCPlayerObject components are not supported."
381 }));
382 Object.DestroyImmediate((Object)(object)vRCPlayerObject);
383 }
384 else if (HasChildWithComponent(((Component)vRCPlayerObject).transform, out existingPlayerObjectChild))
385 {
386 Debug.LogError((object)String.Concat((string[])(object)new String[5]
387 {
388 "Can't add VRCPlayerObject to ",
389 ((Editor)this).target.name,
390 ". Child ",
391 existingPlayerObjectChild,
392 " already has a VRCPlayerObject component. Nested VRCPlayerObject components are not supported."
393 }));
394 Object.DestroyImmediate((Object)(object)vRCPlayerObject);
395 }
396 }
397 }
398
399 private static bool HasParentWithComponent(Transform target, out string existingPlayerObjectParent)
400 {
401 Transform parent = target.parent;
402 VRCPlayerObject vRCPlayerObject = default(VRCPlayerObject);
403 while ((Object)(object)parent != (Object)null)
404 {
405 if (((Component)parent).TryGetComponent<VRCPlayerObject>(ref vRCPlayerObject))
406 {
407 existingPlayerObjectParent = ((Object)parent).name;
408 return true;
409 }
410 parent = parent.parent;
411 }
412 existingPlayerObjectParent = String.Empty;
413 return false;
414 }
415
416 private static bool HasChildWithComponent(Transform target, out string existingPlayerObjectChild)
417 {
418 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
419 //IL_001a: Expected O, but got Unknown
420 IEnumerator enumerator = ((Component)target).transform.GetEnumerator();
421 try
422 {
423 VRCPlayerObject vRCPlayerObject = default(VRCPlayerObject);
424 while (enumerator.MoveNext())
425 {
426 Transform val = (Transform)enumerator.Current;
427 if (((Component)val).TryGetComponent<VRCPlayerObject>(ref vRCPlayerObject))
428 {
429 existingPlayerObjectChild = ((Object)val).name;
430 return true;
431 }
432 if (HasChildWithComponent(val, out existingPlayerObjectChild))
433 {
434 return true;
435 }
436 }
437 }
438 finally
439 {
440 IDisposable val2 = (IDisposable)(object)((enumerator is IDisposable) ? enumerator : null);
441 if (val2 != null)
442 {
443 val2.Dispose();
444 }
445 }
446 existingPlayerObjectChild = String.Empty;
447 return false;
448 }
449
450 public override VisualElement CreateInspectorGUI()
451 {
452 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
453 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
454 //IL_0019: Expected O, but got Unknown
455 VisualElement val = new VisualElement();
456 HelpBoxVisualElement helpBoxVisualElement = new HelpBoxVisualElement("Player Objects are automatically instantiated once for each player that joins, providing each player with their own copy of that GameObject, its UdonBehaviours, other components, and children. This object will be the template, and should not be modified or referenced after the world has loaded. Use Networking.GetPlayerObjects to get the player objects associated with a player instead.", (HelpBoxMessageType)1);
457 val.Add((VisualElement)(object)helpBoxVisualElement);
458 return val;
459 }
460 }
461}
463{
464 public class WorldAssetExportException : Exception
465 {
466 public WorldAssetExportException(string message)
467 : base(message)
468 {
469 }
470
471 public WorldAssetExportException(string message, Exception innerException)
472 : base(message, innerException)
473 {
474 }
475 }
476 public class AdbException : Exception
477 {
478 public int exitCode;
479
480 public string standardOutput;
481
482 public string standardError;
483
484 public AdbException(int exitCode, string stdOut, string stdError)
485 : base(String.Format("ADB failed with exit code {0}.\nStdOut:{1}\nStdError:{2}", (object)exitCode, (object)stdOut, (object)stdError))
486 {
487 this.exitCode = exitCode;
488 standardOutput = stdOut;
489 standardError = stdError;
490 }
491 }
492 public class AndroidTestBuildException : Exception
493 {
494 public AndroidTestBuildException(string message)
495 : base(message)
496 {
497 }
498
499 public AndroidTestBuildException(string message, Exception innerException)
500 : base(message, innerException)
501 {
502 }
503 }
504}
506{
507 public class VRCWorldAssetExporter : Object, IAssetExporter, IProcessSceneWithReport, IOrderedCallback
508 {
509 [CompilerGenerated]
510 private sealed class <>c__DisplayClass4_0 : Object
511 {
512 public List<GameObject> prefabs;
513
514 internal bool <FindDynamicContent>b__0(GameObject p)
515 {
516 return !prefabs.Contains(p);
517 }
518 }
519
520 public string Name => "VRCAvatarAssetExporter";
521
522 int IOrderedCallback.callbackOrder => 2147475455;
523
525 {
526 ExportCurrentSceneResource(buildAssetBundle: true, null, null);
527 }
528
529 public void ExportCurrentSceneResource(bool buildAssetBundle = true, Action<string> onProgress = null, Action<object> onContentProcessed = null)
530 {
531 //IL_03f7: Expected O, but got Unknown
532 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
533 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
534 //IL_00bd: Unknown result type (might be due to invalid IL or missing references)
535 //IL_00c2: Unknown result type (might be due to invalid IL or missing references)
536 //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
537 //IL_00ee: Unknown result type (might be due to invalid IL or missing references)
538 //IL_00fb: Unknown result type (might be due to invalid IL or missing references)
539 //IL_0102: Unknown result type (might be due to invalid IL or missing references)
540 //IL_00f2: Unknown result type (might be due to invalid IL or missing references)
541 //IL_010d: Unknown result type (might be due to invalid IL or missing references)
542 //IL_0184: Unknown result type (might be due to invalid IL or missing references)
543 //IL_0189: Unknown result type (might be due to invalid IL or missing references)
544 //IL_01a3: Unknown result type (might be due to invalid IL or missing references)
545 //IL_01a8: Unknown result type (might be due to invalid IL or missing references)
546 //IL_0235: Unknown result type (might be due to invalid IL or missing references)
547 //IL_023a: Unknown result type (might be due to invalid IL or missing references)
548 //IL_023c: Unknown result type (might be due to invalid IL or missing references)
549 //IL_025e: Unknown result type (might be due to invalid IL or missing references)
550 //IL_0263: Unknown result type (might be due to invalid IL or missing references)
551 //IL_0245: Unknown result type (might be due to invalid IL or missing references)
552 //IL_0251: Unknown result type (might be due to invalid IL or missing references)
553 //IL_0291: Unknown result type (might be due to invalid IL or missing references)
554 //IL_02b2: Unknown result type (might be due to invalid IL or missing references)
555 //IL_02b4: Unknown result type (might be due to invalid IL or missing references)
556 //IL_02b9: Unknown result type (might be due to invalid IL or missing references)
557 //IL_02be: Unknown result type (might be due to invalid IL or missing references)
558 //IL_02c0: Unknown result type (might be due to invalid IL or missing references)
559 //IL_02c5: Unknown result type (might be due to invalid IL or missing references)
560 //IL_02de: Unknown result type (might be due to invalid IL or missing references)
561 //IL_037e: Unknown result type (might be due to invalid IL or missing references)
562 //IL_0383: Unknown result type (might be due to invalid IL or missing references)
563 //IL_039d: Unknown result type (might be due to invalid IL or missing references)
564 //IL_039f: Unknown result type (might be due to invalid IL or missing references)
565 //IL_0416: Unknown result type (might be due to invalid IL or missing references)
566 Scene activeScene;
567 string text;
568 if (!EditorPrefs.HasKey("originalScenePath"))
569 {
570 activeScene = SceneManager.GetActiveScene();
571 text = ((Scene)(ref activeScene)).path;
572 }
573 else
574 {
575 text = EditorPrefs.GetString("originalScenePath");
576 }
577 string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
578 onProgress?.Invoke("Validating Scene");
579 VRCSceneDescriptor[] array = Tools.FindSceneObjectsOfTypeAll<VRCSceneDescriptor>();
580 if (array == null || array.Length != 1)
581 {
582 EditorUtility.DisplayDialog("Build Custom Scene", "Scene needs exactly one VRC_SceneDescriptor", "Ok");
583 return;
584 }
585 VRCSceneDescriptor vRCSceneDescriptor = array[0];
586 if ((Object)(object)vRCSceneDescriptor == (Object)null)
587 {
588 EditorUtility.DisplayDialog("Build Custom Scene", "You must place a VRC_SceneDescriptor on the root of you custom scene", "Ok");
589 return;
590 }
591 if (((VRC_SceneDescriptor)vRCSceneDescriptor).spawns.Length < 1)
592 {
593 EditorUtility.DisplayDialog("Build Custom Scene", "You must add at least one spawn to spawns in your VRC_SceneDescriptor.", "Ok");
594 return;
595 }
596 onProgress?.Invoke("Preparing Scene");
598 FindDynamicContent((VRC_SceneDescriptor)(object)vRCSceneDescriptor);
599 ((VRC_SceneDescriptor)vRCSceneDescriptor).gravity = Physics.gravity;
600 ((VRC_SceneDescriptor)vRCSceneDescriptor).layerCollisionArr = UpdateLayers.GetLayerCollisionArray();
601 ((VRC_SceneDescriptor)vRCSceneDescriptor).unityVersion = Application.unityVersion;
602 EditorUtility.SetDirty((Object)(object)vRCSceneDescriptor);
603 Scene scene = ((Component)vRCSceneDescriptor).gameObject.scene;
604 if (buildAssetBundle && !VRCBuildPipelineCallbacks.OnPreprocessScene(scene))
605 {
606 return;
607 }
608 EditorSceneManager.MarkSceneDirty(scene);
609 EditorSceneManager.SaveScene(scene);
610 onContentProcessed?.Invoke((object)scene);
611 if (!buildAssetBundle)
612 {
613 onProgress?.Invoke("Skipping AssetBundle, Build Complete");
614 return;
615 }
616 try
617 {
618 string text2 = ((Scene)(ref scene)).path;
619 onProgress?.Invoke("Exporting Scene");
620 bool flag = false;
621 if (fileNameWithoutExtension.Contains("."))
622 {
623 flag = true;
624 string text3 = "Assets/customTmpScene12345.unity";
625 AssetDatabase.CopyAsset(text2, text3);
626 text2 = text3;
627 AssetDatabase.Refresh();
628 }
629 AssetDatabase.RemoveUnusedAssetBundleNames();
630 String[] obj = new String[5]
631 {
632 "scene-",
633 default(String),
634 default(String),
635 default(String),
636 default(String)
637 };
638 BuildTarget activeBuildTarget = EditorUserBuildSettings.activeBuildTarget;
639 obj[1] = ((Object)(BuildTarget)(ref activeBuildTarget)).ToString();
640 obj[2] = "-";
641 activeScene = SceneManager.GetActiveScene();
642 obj[3] = ((Scene)(ref activeScene)).name;
643 obj[4] = ".vrcw";
644 string text4 = String.Concat((string[])(object)obj);
645 string text5 = String.Concat(Application.temporaryCachePath, "/", text4);
646 string localLowPath = VRC_SdkBuilder.GetLocalLowPath();
647 string text6;
648 if (!String.IsNullOrEmpty(localLowPath))
649 {
650 text6 = Path.Combine((string[])(object)new String[5] { localLowPath, "VRChat", "VRChat", "Worlds", text4 });
651 string directoryName = Path.GetDirectoryName(text6);
652 if (!String.IsNullOrEmpty(directoryName))
653 {
654 Directory.CreateDirectory(directoryName);
655 }
656 }
657 else
658 {
659 text6 = text5;
660 }
661 Keypair val = default(Keypair);
662 LibResult val2 = VRCFastCrypto.GenerateSigningKey(ref val);
663 if ((int)val2 != 0)
664 {
665 throw new Exception(String.Format("Failed to generate signing key: {0}", (object)val2));
666 }
667 SigningKey signingKey = ((Keypair)(ref val)).SigningKey;
668 EditorPrefs.SetString("currentBuildingAssetBundleCodeSigningKey", Convert.ToBase64String(((SigningKey)(ref signingKey)).Key));
669 onProgress?.Invoke("Creating an Asset Bundle");
670 AssetBundleBuild[] array2 = (AssetBundleBuild[])(object)new AssetBundleBuild[1]
671 {
672 new AssetBundleBuild
673 {
674 assetNames = (string[])(object)new String[1] { text2 },
675 assetBundleName = text4
676 }
677 };
678 BuildTarget activeBuildTarget2 = EditorUserBuildSettings.activeBuildTarget;
679 BuildTargetGroup selectedBuildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
680 onProgress?.Invoke("Building the Asset Bundle");
681 BuildPipeline.BuildAssetBundles(Application.temporaryCachePath, array2, (BuildAssetBundleOptions)32, EditorUserBuildSettings.activeBuildTarget);
682 if (!File.Exists(text5))
683 {
684 Logger.LogError("AssetBundle was not built", (DebugLevel)0, (Object)null);
685 return;
686 }
687 onProgress?.Invoke("Bundle Built, Processing Bundle");
688 uint num = default(uint);
689 if (!BuildPipeline.GetCRCForAssetBundle(text5, ref num))
690 {
691 Logger.LogError("Failed to get CRC for asset bundle!", (DebugLevel)0, (Object)null);
692 num = 0u;
693 }
694 List<byte> obj2 = new List<byte>();
695 obj2.Add((byte)0);
696 obj2.Add((byte)(num & 0xFFu));
697 obj2.Add((byte)((num >> 8) & 0xFFu));
698 obj2.Add((byte)((num >> 16) & 0xFFu));
699 obj2.Add((byte)((num >> 24) & 0xFFu));
700 VerifyKey verifyKey = ((Keypair)(ref val)).VerifyKey;
701 obj2.AddRange((IEnumerable<byte>)(object)((VerifyKey)(ref verifyKey)).Key);
702 string text7 = Convert.ToBase64String(obj2.ToArray());
703 EditorUserBuildSettings.SwitchActiveBuildTarget(selectedBuildTargetGroup, activeBuildTarget2);
704 if (text5 != text6)
705 {
706 File.Copy(text5, text6, true);
707 File.Delete(text5);
708 }
709 EditorPrefs.SetString("currentBuildingAssetBundlePath", text6);
710 EditorPrefs.SetString("currentBuildingAssetBundleWorldSignature", text7);
711 EditorPrefs.SetString("lastVRCPath", text6);
712 if (flag)
713 {
714 AssetDatabase.DeleteAsset(text2);
715 }
716 }
717 catch (Exception val3)
718 {
719 Exception val4 = val3;
720 Debug.LogError((object)String.Concat("Export Exception - ", (val4 != null) ? ((Object)val4).ToString() : null));
721 throw;
722 }
724 onProgress?.Invoke("Build Complete");
725 }
726
727 private static void FindDynamicContent(VRC_SceneDescriptor desc)
728 {
729 <>c__DisplayClass4_0 CS$<>8__locals0 = new <>c__DisplayClass4_0();
730 CS$<>8__locals0.prefabs = new List<GameObject>();
731 List<Material> val = new List<Material>();
732 AssetExporter.FindDynamicContent(ref CS$<>8__locals0.prefabs, ref val);
733 desc.DynamicMaterials = val;
734 if (desc.DynamicPrefabs != null && desc.DynamicPrefabs.Count > 0)
735 {
736 CS$<>8__locals0.prefabs.AddRange(Enumerable.Where<GameObject>((IEnumerable<GameObject>)(object)desc.DynamicPrefabs, (Func<GameObject, bool>)((GameObject p) => !CS$<>8__locals0.prefabs.Contains(p))));
737 }
738 desc.DynamicPrefabs = CS$<>8__locals0.prefabs;
739 String[] obj = new String[5]
740 {
741 "Found ",
742 default(String),
743 default(String),
744 default(String),
745 default(String)
746 };
747 int count = CS$<>8__locals0.prefabs.Count;
748 obj[1] = ((Int32)(ref count)).ToString();
749 obj[2] = " prefabs and ";
750 count = val.Count;
751 obj[3] = ((Int32)(ref count)).ToString();
752 obj[4] = " materials";
753 Logger.Log(String.Concat((string[])(object)obj), (DebugLevel)9, (Object)null);
754 }
755
757 {
758 //IL_0009: Expected O, but got Unknown
759 try
760 {
762 }
763 catch (Exception val)
764 {
765 Exception val2 = val;
766 Debug.LogError((object)String.Concat((val2 != null) ? ((Object)val2).ToString() : null, "\n", val2.StackTrace));
767 throw;
768 }
769 }
770
771 public static void RunScene(string bundleFilePath, string pluginFilePath)
772 {
773 if (Tools.Platform == "android")
774 {
775 try
776 {
777 RunWorldTestAndroid(bundleFilePath);
778 return;
779 }
780 catch (AdbException innerException)
781 {
782 throw new WorldAssetExportException("An ADB command failed to execute.\nCheck the console for more details.", (Exception)(object)innerException);
783 }
784 }
785 RunWorldTestDesktop(bundleFilePath, pluginFilePath);
786 }
787
788 private static void RunWorldTestDesktop(string bundleFilePath, string pluginFilePath)
789 {
790 //IL_00e4: Unknown result type (might be due to invalid IL or missing references)
791 //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
792 //IL_0100: Expected O, but got Unknown
793 string text = UnityWebRequest.EscapeURL(bundleFilePath).Replace("+", "%20");
794 string text2 = UnityWebRequest.EscapeURL(pluginFilePath).Replace("+", "%20");
795 string randomDigits = Tools.GetRandomDigits(10);
796 string text3 = SDKClientUtilities.GetSavedVRCInstallPath();
797 if (String.IsNullOrEmpty(text3) || !File.Exists(text3))
798 {
799 text3 = String.Concat("vrchat://create?roomId=", randomDigits, "&hidden=true&name=BuildAndRun&url=file:///", text);
800 if (!String.IsNullOrEmpty(text2))
801 {
802 text3 = String.Concat(text3, "&pluginUrl=file:///", text2);
803 }
804 }
805 string text4 = String.Concat("--url=create?roomId=", randomDigits, "&hidden=true&name=BuildAndRun&url=file:///", text);
806 if (!String.IsNullOrEmpty(text2))
807 {
808 text4 = String.Concat(text4, "&pluginUrl=file:///", text2);
809 }
810 string text5 = (VRCSettings.ForceNoVR ? " --no-vr" : "");
811 string text6 = (VRCSettings.WatchWorlds ? " --watch-worlds" : "");
812 string text7 = String.Concat("--enable-debug-gui --enable-sdk-log-levels --enable-udon-debug-logging ", text5, text6);
813 ProcessStartInfo val = new ProcessStartInfo(text3, String.Concat(text4, " ", text7))
814 {
815 WorkingDirectory = (Path.GetDirectoryName(text3) ?? "")
816 };
817 for (int i = 0; i < VRCSettings.NumClients; i++)
818 {
819 Process.Start(val);
820 Thread.Sleep(3000);
821 }
822 }
823
824 private static void RunWorldTestAndroid(string bundleFilePath)
825 {
826 //IL_0119: Unknown result type (might be due to invalid IL or missing references)
827 //IL_0120: Expected O, but got Unknown
828 //IL_00c5: Unknown result type (might be due to invalid IL or missing references)
829 //IL_00ca: Unknown result type (might be due to invalid IL or missing references)
830 List<string> androidDevices = GetAndroidDevices();
831 if (androidDevices.Count < 1)
832 {
833 throw new WorldAssetExportException("No android devices with ADB debugging enabled have been found.\nPlease plug in the device and enable USB debugging in the \"System\"->\"Developer Options\" settings section.\nNote that the \"System\"->\"Developer Options\" section only appears if you've enabled developer mode in Android, which you can enable by tapping \"About Phone\"->\"Build Number\" 7 times\n\nIf your device is still not appearing after trying the above, please try the following:\n1. Unplug the Android device\n2. Disable developer mode and USB debugging\n3. Plug in the Android device\n4. Enable developer mode by tapping \"About Phone\"->\"Build Number\" 7 times\n5. Enable USB debugging in the \"System\"->\"Developer Options\" section\n6. Attempt to Build and Test again.");
834 }
835 if (androidDevices.Count > 1)
836 {
837 throw new WorldAssetExportException(String.Concat("Multiple devices with ADB debugging enabled have been found. Unplug or disable USB debugging until the one device you would like to test on remains.\nCurrently available devices:\n", String.Join("\n", (IEnumerable<string>)(object)androidDevices)));
838 }
839 string text = Enumerable.First<string>((IEnumerable<string>)(object)androidDevices);
840 Debug.Log((object)String.Concat("Testing on ADB device ", text));
841 string text2 = null;
842 bool flag = false;
843 string text3;
844 if (text.ToLower().Contains("model:quest"))
845 {
846 text3 = ADB.GetQuestAppDataPath();
848 flag = true;
849 }
850 else
851 {
852 text3 = ADB.GetAndroidAppDataPath();
854 }
855 switch (ADB.GetDeviceLockState())
856 {
857 case DeviceLockState.LOCKED:
858 if (flag)
859 {
860 throw new WorldAssetExportException("Failed to test Android world: Device is locked.\nYour device must remain unlocked when starting a test build.\n\nEnsure that you are logged into the Meta Quest Developer Hub and your headset is properly connected before attempting to test an Android world.");
861 }
862 throw new WorldAssetExportException("Failed to test Android world: Device is locked.\nYour device must remain unlocked when starting a test build.\n\nYou may find it useful to enable the \"Stay Awake\" option in \"System\"->\"Developer Options\" to prevent the phone from locking while it's plugged in and charging.");
863 case DeviceLockState.UNKNOWN:
864 Debug.LogWarning((object)"Unable to determine if Android device is locked.\nNote that on some devices the device must remain unlocked for the VRChat app to be launched. Leave your device unlocked if the app is not launching.");
865 break;
866 }
867 string extension = Path.GetExtension(bundleFilePath);
868 DateTime utcNow = DateTime.UtcNow;
869 string text4 = String.Format("{0}_{1}", (object)((DateTime)(ref utcNow)).ToFileTimeUtc(), (object)extension).TrimStart('/');
870 text3 = text3.TrimEnd('/');
871 if (!ADB.AdbDirectoryExists(text3))
872 {
873 string[] array = Array.Empty<string>();
874 try
875 {
877 }
878 catch (Object)
879 {
880 Debug.LogWarning((object)"Unable to find potential VRChat app packages");
881 }
882 StringBuilder val2 = new StringBuilder();
883 val2.AppendLine("Unable to find a valid vrchat app directory on the device. Is the VRChat app installed?");
884 val2.AppendLine();
885 val2.AppendLine(String.Concat("Looking for '", text3, "'."));
886 if (array.Length != 0)
887 {
888 string text5 = String.Join("\n", Enumerable.Select<string, string>((IEnumerable<string>)(object)array, (Func<string, string>)((string x) => String.Concat("\t", x))));
889 val2.AppendLine("Potential app package names found on device:");
890 val2.AppendLine(text5);
891 }
892 string text6 = "Android App Package Name";
893 if (flag)
894 {
895 text6 = "Quest App Package Name";
896 }
897 val2.AppendLine(String.Concat("Use the project setting \"VRChat\"->\"SDK\"->\"", text6, "\" to change where the SDK looks for your app."));
898 if (array.Length == 1)
899 {
900 val2.AppendLine(String.Concat((string[])(object)new String[5]
901 {
902 "Try changing \"VRChat\"->\"SDK\"->\"",
903 text6,
904 "\" to \"",
905 Enumerable.First<string>((IEnumerable<string>)(object)array),
906 "\""
907 }));
908 }
909 val2.AppendLine();
910 val2.AppendLine("If you've just installed the app, launch it once before trying to build and test.");
911 val2.AppendLine();
912 val2.AppendLine("Note that the following Android device is being used:");
913 val2.AppendLine(text);
914 throw new WorldAssetExportException(((Object)val2).ToString());
915 }
917 string text7 = String.Concat(text3, "/files/TestWorlds/", text4);
918 ADB.MakeDirectory(String.Concat(text3, "/files/TestWorlds"));
919 ADB.PushFile(bundleFilePath, text7);
920 ADB.Command("shell", "content", "call", "--method", "scan_volume", "--uri", "content://media", "--arg", "external_primary");
921 ADB.Sync();
922 ADB.StartVRChat(text7, text2);
923 AnalyticsSDK.BuildAndTestLaunched(flag ? "Quest" : "AndroidGeneric", text);
924 }
925
926 private static List<string> GetAndroidDevices()
927 {
928 //IL_0009: Expected O, but got Unknown
929 try
930 {
931 return ADB.GetDevices();
932 }
933 catch (Win32Exception val)
934 {
935 Win32Exception val2 = val;
936 if (!((Exception)val2).Message.Contains("The system cannot find the file specified"))
937 {
938 throw val2;
939 }
940 throw new WorldAssetExportException("Unable to locate Android Debug Bridge (adb.exe). Please be sure to install the Android SDK as a Unity module, or add adb.exe to the PATH.", (Exception)(object)val2);
941 }
942 }
943
944 private static void AndroidCleanupOldTestWorlds(string appPath)
945 {
946 //IL_0057: Expected O, but got Unknown
947 string text = String.Concat(appPath, "/files/TestWorlds");
948 AdbResult adbResult;
949 try
950 {
951 adbResult = ADB.Command("shell", "find", text, "-mindepth", "1", "-mtime", "+1", "-delete");
952 }
953 catch (Exception val)
954 {
955 Exception val2 = val;
956 if (val2.Message.Contains("No such file or directory"))
957 {
958 return;
959 }
960 throw new WorldAssetExportException(String.Concat("Unable to cleanup test world folder at path '", text, "'"), val2);
961 }
962 IEnumerator<string> enumerator = Enumerable.Select<string, string>((IEnumerable<string>)(object)adbResult.standardOut.Split("\n", (StringSplitOptions)0), (Func<string, string>)((string x) => x.Trim())).GetEnumerator();
963 try
964 {
965 while (((IEnumerator)enumerator).MoveNext())
966 {
967 string current = enumerator.Current;
968 if (!String.IsNullOrWhiteSpace(current) && !String.IsNullOrEmpty(current))
969 {
970 Debug.Log((object)String.Concat("Deleted old test world file ", current, " on remote device"));
971 }
972 }
973 }
974 finally
975 {
976 if (enumerator != null)
977 {
978 ((IDisposable)enumerator).Dispose();
979 }
980 }
981 }
982
983 [Obsolete("Use methods from VRC.SDKBase.Editor.Api.VRCApi class for uploads instead")]
984 public static void LaunchSceneBlueprintUploader()
985 {
986 Debug.LogError((object)"Uploading via AssetExporter is no longer supported");
987 }
988
990 {
992 }
993
994 private static void RunExportedSceneResource()
995 {
996 string @string = EditorPrefs.GetString("currentBuildingAssetBundlePath");
997 if (!String.IsNullOrEmpty(@string))
998 {
999 string string2 = EditorPrefs.GetString("externalPluginPath");
1000 EditorPrefs.DeleteKey("externalPluginPath");
1001 RunScene(@string, string2);
1002 }
1003 }
1004
1005 void IProcessSceneWithReport.OnProcessScene(Scene scene, BuildReport report)
1006 {
1007 //IL_011d: Expected O, but got Unknown
1008 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
1009 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
1010 if (Application.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode)
1011 {
1012 return;
1013 }
1014 string @string = EditorPrefs.GetString("currentBuildingAssetBundleCodeSigningKey");
1015 if (String.IsNullOrEmpty(@string))
1016 {
1017 Debug.LogWarning((object)"No signing key found, skipping Udon code signing");
1018 return;
1019 }
1020 try
1021 {
1022 SigningKey signingKey = new SigningKey(Convert.FromBase64String(@string));
1023 IEnumerator<UdonSignatureHolderMarker> enumerator = TypeUtils.FindAssemblyAttributes<UdonSignatureHolderMarker>().GetEnumerator();
1024 try
1025 {
1026 while (((IEnumerator)enumerator).MoveNext())
1027 {
1028 Type type = enumerator.Current.type;
1029 if (!type.IsSubclassOf(typeof(ScriptableObject)))
1030 {
1031 continue;
1032 }
1033 Stopwatch val = Stopwatch.StartNew();
1034 Object[] array = Resources.FindObjectsOfTypeAll(type);
1035 Object[] array2 = array;
1036 foreach (Object val2 in array2)
1037 {
1038 if (!(val2 == (Object)null) && val2 is IUdonSignatureHolder udonSignatureHolder)
1039 {
1040 udonSignatureHolder.EnsureGZipFormat();
1041 udonSignatureHolder.Signature = Sign(udonSignatureHolder.SignedData);
1042 EditorUtility.SetDirty(val2);
1043 }
1044 }
1045 Debug.Log((object)String.Format("Computed code signatures for {0} scripts of type {1} in {2}ms", (object)array.Length, (object)((MemberInfo)type).Name, (object)val.ElapsedMilliseconds));
1046 }
1047 }
1048 finally
1049 {
1050 if (enumerator != null)
1051 {
1052 ((IDisposable)enumerator).Dispose();
1053 }
1054 }
1055 [CompilerGenerated]
1056 byte[] Sign(byte[] data)
1057 {
1058 //IL_001d: Unknown result type (might be due to invalid IL or missing references)
1059 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
1060 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
1061 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
1062 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
1063 if (data == null || data.Length == 0)
1064 {
1065 Debug.LogError((object)"Cannot sign empty data");
1066 return null;
1067 }
1068 byte[] result = default(byte[]);
1069 LibResult val5 = VRCFastCrypto.SignMessage(ref signingKey, ref data, ref result);
1070 if ((int)val5 != 0)
1071 {
1072 throw new Exception(String.Format("Failed to sign data: {0}", (object)val5));
1073 }
1074 return result;
1075 }
1076 }
1077 catch (Exception val3)
1078 {
1079 Exception val4 = val3;
1080 Debug.LogError((object)String.Concat("Failed to compute Udon signatures: ", (val4 != null) ? ((Object)val4).ToString() : null));
1081 throw;
1082 }
1083 finally
1084 {
1085 EditorPrefs.DeleteKey("currentBuildingAssetBundleCodeSigningKey");
1086 }
1087 }
1088 }
1089 public class VRCWorldBuilder : Object, ISDKBuilder
1090 {
1091 [CompilerGenerated]
1092 private EventHandler m_OnBuildStarted;
1093
1094 [CompilerGenerated]
1095 private EventHandler<string> m_OnBuildProgress;
1096
1097 [CompilerGenerated]
1098 private EventHandler<object> m_OnBuildContentProcessed;
1099
1100 [CompilerGenerated]
1101 private EventHandler<string> m_OnBuildSuccess;
1102
1103 [CompilerGenerated]
1104 private EventHandler<ValueTuple<string, string>> m_OnBuildSuccessWithSignature;
1105
1106 [CompilerGenerated]
1107 private EventHandler<string> m_OnBuildError;
1108
1109 [CompilerGenerated]
1110 private EventHandler<object> m_OnContentPreUpload;
1111
1112 public string Name => "VRCWorldBuilder";
1113
1114 public event EventHandler OnBuildStarted
1115 {
1116 [CompilerGenerated]
1117 add
1118 {
1119 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
1120 //IL_0016: Expected O, but got Unknown
1121 EventHandler val = this.m_OnBuildStarted;
1122 EventHandler val2;
1123 do
1124 {
1125 val2 = val;
1126 EventHandler val3 = (EventHandler)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1127 val = Interlocked.CompareExchange<EventHandler>(ref this.m_OnBuildStarted, val3, val2);
1128 }
1129 while (val != val2);
1130 }
1131 [CompilerGenerated]
1132 remove
1133 {
1134 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
1135 //IL_0016: Expected O, but got Unknown
1136 EventHandler val = this.m_OnBuildStarted;
1137 EventHandler val2;
1138 do
1139 {
1140 val2 = val;
1141 EventHandler val3 = (EventHandler)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1142 val = Interlocked.CompareExchange<EventHandler>(ref this.m_OnBuildStarted, val3, val2);
1143 }
1144 while (val != val2);
1145 }
1146 }
1147
1148 public event EventHandler<string> OnBuildProgress
1149 {
1150 [CompilerGenerated]
1151 add
1152 {
1153 EventHandler<string> val = this.m_OnBuildProgress;
1154 EventHandler<string> val2;
1155 do
1156 {
1157 val2 = val;
1158 EventHandler<string> val3 = (EventHandler<string>)(object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1159 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.m_OnBuildProgress, val3, val2);
1160 }
1161 while (val != val2);
1162 }
1163 [CompilerGenerated]
1164 remove
1165 {
1166 EventHandler<string> val = this.m_OnBuildProgress;
1167 EventHandler<string> val2;
1168 do
1169 {
1170 val2 = val;
1171 EventHandler<string> val3 = (EventHandler<string>)(object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1172 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.m_OnBuildProgress, val3, val2);
1173 }
1174 while (val != val2);
1175 }
1176 }
1177
1178 public event EventHandler<object> OnBuildContentProcessed
1179 {
1180 [CompilerGenerated]
1181 add
1182 {
1183 EventHandler<object> val = this.m_OnBuildContentProcessed;
1184 EventHandler<object> val2;
1185 do
1186 {
1187 val2 = val;
1188 EventHandler<object> val3 = (EventHandler<object>)(object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1189 val = Interlocked.CompareExchange<EventHandler<object>>(ref this.m_OnBuildContentProcessed, val3, val2);
1190 }
1191 while (val != val2);
1192 }
1193 [CompilerGenerated]
1194 remove
1195 {
1196 EventHandler<object> val = this.m_OnBuildContentProcessed;
1197 EventHandler<object> val2;
1198 do
1199 {
1200 val2 = val;
1201 EventHandler<object> val3 = (EventHandler<object>)(object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1202 val = Interlocked.CompareExchange<EventHandler<object>>(ref this.m_OnBuildContentProcessed, val3, val2);
1203 }
1204 while (val != val2);
1205 }
1206 }
1207
1208 public event EventHandler<string> OnBuildSuccess
1209 {
1210 [CompilerGenerated]
1211 add
1212 {
1213 EventHandler<string> val = this.m_OnBuildSuccess;
1214 EventHandler<string> val2;
1215 do
1216 {
1217 val2 = val;
1218 EventHandler<string> val3 = (EventHandler<string>)(object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1219 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.m_OnBuildSuccess, val3, val2);
1220 }
1221 while (val != val2);
1222 }
1223 [CompilerGenerated]
1224 remove
1225 {
1226 EventHandler<string> val = this.m_OnBuildSuccess;
1227 EventHandler<string> val2;
1228 do
1229 {
1230 val2 = val;
1231 EventHandler<string> val3 = (EventHandler<string>)(object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1232 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.m_OnBuildSuccess, val3, val2);
1233 }
1234 while (val != val2);
1235 }
1236 }
1237
1238 public event EventHandler<ValueTuple<string, string>> OnBuildSuccessWithSignature
1239 {
1240 [CompilerGenerated]
1241 add
1242 {
1243 EventHandler<ValueTuple<string, string>> val = this.m_OnBuildSuccessWithSignature;
1244 EventHandler<ValueTuple<string, string>> val2;
1245 do
1246 {
1247 val2 = val;
1248 EventHandler<ValueTuple<string, string>> val3 = (EventHandler<ValueTuple<string, string>>)(object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1249 val = Interlocked.CompareExchange<EventHandler<ValueTuple<string, string>>>(ref this.m_OnBuildSuccessWithSignature, val3, val2);
1250 }
1251 while (val != val2);
1252 }
1253 [CompilerGenerated]
1254 remove
1255 {
1256 EventHandler<ValueTuple<string, string>> val = this.m_OnBuildSuccessWithSignature;
1257 EventHandler<ValueTuple<string, string>> val2;
1258 do
1259 {
1260 val2 = val;
1261 EventHandler<ValueTuple<string, string>> val3 = (EventHandler<ValueTuple<string, string>>)(object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1262 val = Interlocked.CompareExchange<EventHandler<ValueTuple<string, string>>>(ref this.m_OnBuildSuccessWithSignature, val3, val2);
1263 }
1264 while (val != val2);
1265 }
1266 }
1267
1268 public event EventHandler<string> OnBuildError
1269 {
1270 [CompilerGenerated]
1271 add
1272 {
1273 EventHandler<string> val = this.m_OnBuildError;
1274 EventHandler<string> val2;
1275 do
1276 {
1277 val2 = val;
1278 EventHandler<string> val3 = (EventHandler<string>)(object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1279 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.m_OnBuildError, val3, val2);
1280 }
1281 while (val != val2);
1282 }
1283 [CompilerGenerated]
1284 remove
1285 {
1286 EventHandler<string> val = this.m_OnBuildError;
1287 EventHandler<string> val2;
1288 do
1289 {
1290 val2 = val;
1291 EventHandler<string> val3 = (EventHandler<string>)(object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1292 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.m_OnBuildError, val3, val2);
1293 }
1294 while (val != val2);
1295 }
1296 }
1297
1298 public event EventHandler<object> OnContentPreUpload
1299 {
1300 [CompilerGenerated]
1301 add
1302 {
1303 EventHandler<object> val = this.m_OnContentPreUpload;
1304 EventHandler<object> val2;
1305 do
1306 {
1307 val2 = val;
1308 EventHandler<object> val3 = (EventHandler<object>)(object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1309 val = Interlocked.CompareExchange<EventHandler<object>>(ref this.m_OnContentPreUpload, val3, val2);
1310 }
1311 while (val != val2);
1312 }
1313 [CompilerGenerated]
1314 remove
1315 {
1316 EventHandler<object> val = this.m_OnContentPreUpload;
1317 EventHandler<object> val2;
1318 do
1319 {
1320 val2 = val;
1321 EventHandler<object> val3 = (EventHandler<object>)(object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1322 val = Interlocked.CompareExchange<EventHandler<object>>(ref this.m_OnContentPreUpload, val3, val2);
1323 }
1324 while (val != val2);
1325 }
1326 }
1327
1329 {
1330 this.OnBuildStarted = null;
1331 this.OnBuildProgress = null;
1332 this.OnBuildSuccess = null;
1333 this.OnBuildSuccessWithSignature = null;
1334 this.OnBuildError = null;
1335 }
1336
1338 {
1339 this.OnContentPreUpload = null;
1340 }
1341
1342 public bool ExportAvatarBlueprint(GameObject externalReference = null)
1343 {
1344 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1345 throw new NotImplementedException();
1346 }
1347
1348 public bool ExportAndUploadAvatarBlueprint(GameObject externalReference = null)
1349 {
1350 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1351 throw new NotImplementedException();
1352 }
1353
1354 public bool ExportAndTestAvatarBlueprint(GameObject externalReference = null)
1355 {
1356 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1357 throw new NotImplementedException();
1358 }
1359
1360 [Obsolete("Use ExportSceneResource followed by VRC.SDKBase.Editor.Api.VRCApi methods instead")]
1362 {
1363 Debug.LogError((object)"Uploading via the SDK builder is no longer supported, use ExportSceneResource followed by VRC.SDKBase.Editor.Api.VRCApi methods instead");
1364 }
1365
1366 [Obsolete("Use ExportSceneResource followed by VRC.SDKBase.Editor.Api.VRCApi methods instead")]
1368 {
1369 Debug.LogError((object)"Uploading via the SDK builder is no longer supported, use ExportSceneResource followed by VRC.SDKBase.Editor.Api.VRCApi methods instead");
1370 }
1371
1373 {
1374 string @string = EditorPrefs.GetString("lastExternalPluginPath");
1375 string string2 = EditorPrefs.GetString("lastVRCPath");
1376 if (!String.IsNullOrEmpty(string2) && (String.IsNullOrEmpty(string2) || File.Exists(string2)))
1377 {
1378 VRCWorldAssetExporter.RunScene(string2, @string);
1379 }
1380 else
1381 {
1382 EditorUtility.DisplayDialog("Could not run VRChat scene", "Last built VRChat scene could not be found. Please Test/Compile Full Scene (slow).", "OK");
1383 }
1384 }
1385
1387 {
1388 try
1389 {
1390 if (ExportSceneResource())
1391 {
1392 EditorAssemblies.AddOnAssemblyReloadCallback("VRC.SDK3.Editor.AssetExporter", "RunExportedSceneResourceAndCleanupPlugin", true);
1393 }
1394 else
1395 {
1397 }
1398 }
1399 catch (Exception)
1400 {
1403 throw;
1404 }
1405 }
1406
1408 {
1410 }
1411
1412 private bool ExportSceneResourceInternal(bool buildAssetBundle = true)
1413 {
1414 //IL_0115: Expected O, but got Unknown
1415 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
1416 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
1417 //IL_0032: Invalid comparison between Unknown and I4
1418 //IL_0068: Unknown result type (might be due to invalid IL or missing references)
1419 //IL_0079: Unknown result type (might be due to invalid IL or missing references)
1420 //IL_00eb: Unknown result type (might be due to invalid IL or missing references)
1421 EventHandler onBuildStarted = this.OnBuildStarted;
1422 if (onBuildStarted != null)
1423 {
1424 onBuildStarted.Invoke((object)this, EventArgs.Empty);
1425 }
1426 PipelineManager[] array = Object.FindObjectsOfType<PipelineManager>();
1427 if (array.Length != 0)
1428 {
1429 PipelineManager val = array[0];
1430 val.contentType = (ContentType)1;
1431 if ((int)VRC_SdkBuilder.ActiveBuildType == 2 && String.IsNullOrEmpty(val.blueprintId))
1432 {
1433 val.AssignId();
1434 }
1435 if (buildAssetBundle)
1436 {
1437 EditorPrefs.SetString("lastBuiltAssetBundleBlueprintID", val.blueprintId);
1438 }
1439 EditorUtility.SetDirty((Object)(object)array[0]);
1440 EditorSceneManager.MarkSceneDirty(((Component)val).gameObject.scene);
1441 EditorSceneManager.SaveScene(((Component)val).gameObject.scene);
1442 }
1443 VRCWorldAssetExporter vRCWorldAssetExporter = new VRCWorldAssetExporter();
1444 try
1445 {
1446 vRCWorldAssetExporter.ExportCurrentSceneResource(buildAssetBundle, [CompilerGenerated] (string progress) =>
1447 {
1448 this.OnBuildProgress?.Invoke((object)this, progress);
1449 }, [CompilerGenerated] (object target) =>
1450 {
1451 this.OnBuildContentProcessed?.Invoke((object)this, target);
1452 });
1453 string @string = EditorPrefs.GetString("currentBuildingAssetBundlePath");
1454 string string2 = EditorPrefs.GetString("currentBuildingAssetBundleWorldSignature");
1455 if (File.Exists(@string))
1456 {
1457 this.OnBuildSuccess?.Invoke((object)this, @string);
1458 this.OnBuildSuccessWithSignature?.Invoke((object)this, new ValueTuple<string, string>(@string, string2));
1459 return false;
1460 }
1461 this.OnBuildError?.Invoke((object)this, "Failed to build the World. Check the logs for more details");
1462 }
1463 catch (Exception val2)
1464 {
1465 Exception val3 = val2;
1466 this.OnBuildError?.Invoke((object)this, val3.Message);
1467 }
1468 return false;
1469 }
1470
1471 public void ExportSceneToV3()
1472 {
1473 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1474 throw new NotImplementedException();
1475 }
1476
1477 public void ExportAvatarToV3(GameObject externalReference = null)
1478 {
1479 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1480 throw new NotImplementedException();
1481 }
1482 }
1483 public struct AdbResult : ValueType
1484 {
1485 public string standardOut;
1486
1487 public string standardError;
1488
1489 public int exitCode;
1490 }
1491 public enum DeviceLockState : Enum
1492 {
1493 UNKNOWN,
1494 LOCKED,
1495 UNLOCKED
1496 }
1497 public class ADB : Object
1498 {
1499 public static string GetAdbProcessFileName()
1500 {
1501 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
1502 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
1503 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
1504 //IL_001f: Invalid comparison between Unknown and I4
1505 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
1506 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
1507 string text = Path.Join(String.op_Implicit(EditorApplication.applicationContentsPath), String.op_Implicit("PlaybackEngines/AndroidPlayer/SDK/platform-tools"));
1508 string text2 = (((int)Application.platform == 7) ? "adb.exe" : "adb");
1509 string text3 = Path.Join(String.op_Implicit(text), String.op_Implicit(text2));
1510 string result = "adb";
1511 if (File.Exists(text3))
1512 {
1513 result = text3;
1514 }
1515 return result;
1516 }
1517
1518 public static ProcessStartInfo GetAdbProcessInfo(Collection<string> arguments, bool redirectStandardOutput = true, bool redirectStandardError = true, bool redirectStandardInput = false)
1519 {
1520 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1521 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
1522 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
1523 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
1524 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
1525 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
1526 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
1527 //IL_0034: Expected O, but got Unknown
1528 ProcessStartInfo val = new ProcessStartInfo
1529 {
1530 FileName = GetAdbProcessFileName(),
1531 UseShellExecute = false,
1532 CreateNoWindow = true,
1533 RedirectStandardOutput = redirectStandardOutput,
1534 RedirectStandardError = redirectStandardError,
1535 RedirectStandardInput = redirectStandardInput
1536 };
1537 IEnumerator<string> enumerator = arguments.GetEnumerator();
1538 try
1539 {
1540 while (((IEnumerator)enumerator).MoveNext())
1541 {
1542 string current = enumerator.Current;
1543 val.ArgumentList.Add(current);
1544 }
1545 return val;
1546 }
1547 finally
1548 {
1549 if (enumerator != null)
1550 {
1551 ((IDisposable)enumerator).Dispose();
1552 }
1553 }
1554 }
1555
1556 public static AdbResult Command(params string[] arguments)
1557 {
1558 Process val = Process.Start(GetAdbProcessInfo(new Collection<string>((IList<string>)(object)arguments)));
1559 val.WaitForExit();
1560 string text = ((TextReader)val.StandardOutput).ReadToEnd();
1561 string text2 = ((TextReader)val.StandardError).ReadToEnd();
1562 if (val.ExitCode != 0)
1563 {
1564 throw new AdbException(val.ExitCode, text, text2);
1565 }
1566 AdbResult result = default(AdbResult);
1567 result.standardOut = text;
1568 result.standardError = text2;
1569 result.exitCode = val.ExitCode;
1570 return result;
1571 }
1572
1573 public static void Sync()
1574 {
1575 Debug.Log((object)String.Concat("ADB sync\n", Command("shell", "sync").standardOut));
1576 }
1577
1578 public static List<string> GetDevices()
1579 {
1580 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
1581 //IL_0028: Expected O, but got Unknown
1582 AdbResult adbResult = Command("devices", "-l");
1583 StringReader val = new StringReader(adbResult.standardOut);
1584 if (((TextReader)val).ReadLine().Trim() != "List of devices attached")
1585 {
1586 throw new AndroidTestBuildException(String.Concat("Command `adb devices` returned unknown result: ", adbResult.standardOut));
1587 }
1588 List<string> val2 = new List<string>();
1589 string text;
1590 do
1591 {
1592 text = ((TextReader)val).ReadLine();
1593 if (!String.IsNullOrEmpty(text))
1594 {
1595 val2.Add(text);
1596 }
1597 }
1598 while (!String.IsNullOrEmpty(text));
1599 return val2;
1600 }
1601
1602 public static void PushFile(string localFilePath, string remoteFilePath)
1603 {
1604 Command("push", localFilePath, remoteFilePath);
1605 Debug.Log((object)String.Concat("Pushed ", localFilePath, " to ", remoteFilePath));
1606 }
1607
1608 public static void MakeDirectory(string dir)
1609 {
1610 Command("shell", "mkdir", "-p", dir);
1611 Debug.Log((object)String.Concat("Created directory ", dir));
1612 }
1613
1614 public static void StartVRChat(string remoteBundleFilePath, string appPackageName)
1615 {
1616 string text = ((!appPackageName.Contains("quest")) ? String.Concat(appPackageName, "/com.vrchat.app.MainActivity") : String.Concat(appPackageName, "/com.unity3d.player.UnityPlayerActivity"));
1617 Debug.Log((object)String.Concat((string[])(object)new String[6] { "Starting VRChat into world '", remoteBundleFilePath, "'\\tActivity: ", text, "\n\tlocalWorldPath: ", remoteBundleFilePath }));
1618 Debug.Log((object)Command("shell", "am", "start", "-n", text, "-a", "android.intent.action.MAIN", "-c", "android.intent.category.LAUNCHER", "-e", "localWorldPath", remoteBundleFilePath, "-e", "watchWorlds", "true").standardOut);
1619 }
1620
1621 public static bool AdbDirectoryExists(string appPath)
1622 {
1623 AdbResult adbResult = Command("shell", "ls", appPath, ">", "/dev/null", "2>&1", "&&", "echo", "\"true\"", "||", "echo", "\"false\"");
1624 if (adbResult.standardOut.Contains("true"))
1625 {
1626 return true;
1627 }
1628 if (adbResult.standardOut.Contains("false"))
1629 {
1630 return false;
1631 }
1632 throw new AndroidTestBuildException(String.Concat("Unknown adb result for directory exists check:\n", adbResult.standardOut, "\nStdErr:", adbResult.standardError));
1633 }
1634
1635 public static string[] GetPotentialVRChatAppPackages()
1636 {
1637 return Command("shell", "ls", "/storage/emulated/0/Android/data/", "|", "grep", "^com.vrchat").standardOut.Trim().Split("\n", (StringSplitOptions)0);
1638 }
1639
1640 public static bool IsAppOpen(string androidPackageName)
1641 {
1642 AdbResult adbResult = default(AdbResult);
1643 try
1644 {
1645 adbResult = Command("shell", "pidof", androidPackageName);
1646 }
1647 catch (AdbException ex)
1648 {
1649 if (ex.exitCode == 1)
1650 {
1651 return false;
1652 }
1653 }
1654 string text = adbResult.standardOut.Trim();
1655 if (String.IsNullOrEmpty(text))
1656 {
1657 return false;
1658 }
1659 string[] array = text.Split(" ", (StringSplitOptions)0);
1660 if (array.Length < 2)
1661 {
1662 return false;
1663 }
1664 int num = default(int);
1665 if (!Int32.TryParse(array[0], ref num))
1666 {
1667 return false;
1668 }
1669 if (!Int32.TryParse(array[1], ref num))
1670 {
1671 return false;
1672 }
1673 return true;
1674 }
1675
1676 public static string GetAndroidAppDataPath()
1677 {
1678 string androidPackageName = VRCSettings.AndroidPackageName;
1679 return String.Concat("/storage/emulated/0/Android/data/", androidPackageName);
1680 }
1681
1682 public static string GetQuestAppDataPath()
1683 {
1684 string questPackageName = VRCSettings.QuestPackageName;
1685 return String.Concat("/storage/emulated/0/Android/data/", questPackageName);
1686 }
1687
1689 {
1690 //IL_0073: Unknown result type (might be due to invalid IL or missing references)
1691 //IL_0078: Unknown result type (might be due to invalid IL or missing references)
1692 bool num = Environment.GetEnvironmentVariable("QA_SKIP_WINDOW_LOCK_CHECK", (EnvironmentVariableTarget)1) == "TRUE";
1693 bool flag = Environment.GetEnvironmentVariable("QA_SKIP_NFC_LOCK_CHECK", (EnvironmentVariableTarget)1) == "TRUE";
1694 List<Func<DeviceLockState>> val = new List<Func<DeviceLockState>>();
1695 if (!num)
1696 {
1697 val.Add((Func<DeviceLockState>)GetDeviceWindowLockState);
1698 }
1699 else
1700 {
1701 Debug.LogWarning((object)"QA: Skipping window based lock screen check");
1702 }
1703 if (!flag)
1704 {
1705 val.Add((Func<DeviceLockState>)GetDeviceNFCLockState);
1706 }
1707 else
1708 {
1709 Debug.LogWarning((object)"QA: Skipping NFC based lock screen check");
1710 }
1711 Enumerator<Func<DeviceLockState>> enumerator = val.GetEnumerator();
1712 try
1713 {
1714 while (enumerator.MoveNext())
1715 {
1716 Func<DeviceLockState> current = enumerator.Current;
1717 try
1718 {
1719 DeviceLockState deviceLockState = current.Invoke();
1720 if (deviceLockState != 0)
1721 {
1722 return deviceLockState;
1723 }
1724 }
1725 catch (AdbException)
1726 {
1727 }
1728 }
1729 }
1730 finally
1731 {
1732 ((IDisposable)enumerator).Dispose();
1733 }
1734 return DeviceLockState.UNKNOWN;
1735 [CompilerGenerated]
1736 static DeviceLockState GetDeviceNFCLockState()
1737 {
1738 IEnumerator<string> enumerator2 = Enumerable.Select<string, string>((IEnumerable<string>)(object)Command("shell", "dumpsys", "nfc", "|", "grep", "-e", "'mScreenState='", "-e", "'Screen State:'").standardOut.Trim().Split("\n", (StringSplitOptions)0), (Func<string, string>)((string x) => x.Trim())).GetEnumerator();
1739 try
1740 {
1741 while (((IEnumerator)enumerator2).MoveNext())
1742 {
1743 string current2 = enumerator2.Current;
1744 if (current2.EndsWith("UNLOCKED"))
1745 {
1746 return DeviceLockState.UNLOCKED;
1747 }
1748 if (current2.EndsWith("LOCKED"))
1749 {
1750 return DeviceLockState.LOCKED;
1751 }
1752 }
1753 }
1754 finally
1755 {
1756 if (enumerator2 != null)
1757 {
1758 ((IDisposable)enumerator2).Dispose();
1759 }
1760 }
1761 return DeviceLockState.UNKNOWN;
1762 }
1763 [CompilerGenerated]
1764 static DeviceLockState GetDeviceWindowLockState()
1765 {
1766 AdbResult adbResult = Command("shell", "dumpsys", "window", "|", "grep", "mDreamingLockscreen");
1767 if (adbResult.standardOut.Trim().EndsWith("mDreamingLockscreen=false"))
1768 {
1769 return DeviceLockState.UNLOCKED;
1770 }
1771 if (adbResult.standardOut.Trim().EndsWith("mDreamingLockscreen=true"))
1772 {
1773 return DeviceLockState.LOCKED;
1774 }
1775 return DeviceLockState.UNKNOWN;
1776 }
1777 }
1778 }
1779}
bool OnPreprocessScene(Scene scene)
void OnPostprocessScene(Scene scene)
static List< string > GetDevices()
static bool AdbDirectoryExists(string appPath)
static void StartVRChat(string remoteBundleFilePath, string appPackageName)
static void PushFile(string localFilePath, string remoteFilePath)
static string[] GetPotentialVRChatAppPackages()
static string GetAndroidAppDataPath()
static AdbResult Command(params string[] arguments)
static void MakeDirectory(string dir)
static ProcessStartInfo GetAdbProcessInfo(Collection< string > arguments, bool redirectStandardOutput=true, bool redirectStandardError=true, bool redirectStandardInput=false)
static DeviceLockState GetDeviceLockState()
static string GetQuestAppDataPath()
static string GetAdbProcessFileName()
static bool IsAppOpen(string androidPackageName)
static void FindDynamicContent(VRC_SceneDescriptor desc)
static void RunWorldTestAndroid(string bundleFilePath)
static void RunScene(string bundleFilePath, string pluginFilePath)
static void RunWorldTestDesktop(string bundleFilePath, string pluginFilePath)
static void AndroidCleanupOldTestWorlds(string appPath)
void ExportCurrentSceneResource(bool buildAssetBundle=true, Action< string > onProgress=null, Action< object > onContentProcessed=null)
bool ExportSceneResourceInternal(bool buildAssetBundle=true)
bool ExportAndTestAvatarBlueprint(GameObject externalReference=null)
EventHandler< object > m_OnBuildContentProcessed
EventHandler< ValueTuple< string, string > > m_OnBuildSuccessWithSignature
bool ExportAvatarBlueprint(GameObject externalReference=null)
EventHandler< object > m_OnContentPreUpload
void ExportAvatarToV3(GameObject externalReference=null)
bool ExportAndUploadAvatarBlueprint(GameObject externalReference=null)
EventHandler< object > OnBuildContentProcessed
EventHandler< ValueTuple< string, string > > OnBuildSuccessWithSignature
static void AddOnAssemblyReloadCallback(string className, string staticFunctionName, bool autoSerialize=true)
override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label)
AdbException(int exitCode, string stdOut, string stdError)
AndroidTestBuildException(string message, Exception innerException)
WorldAssetExportException(string message, Exception innerException)
static bool HasParentWithComponent(Transform target, out string existingPlayerObjectParent)
static bool HasChildWithComponent(Transform target, out string existingPlayerObjectChild)
override VisualElement CreateInspectorGUI()
HelpBoxVisualElement(string message, HelpBoxMessageType messageType)
override void OnImportAsset(AssetImportContext ctx)
MidiImportSettings ImportSettings
static MidiFile Create(string filePath, MidiImportSettings midiImportSettings)
Definition: VRCSDK3.cs:1271
static void FindDynamicContent(ref List< GameObject > prefabs, ref List< Material > materials)
List< GameObject > DynamicPrefabs
Definition: VRCSDKBase.cs:7135
ContentType
Definition: VRCSDKBase.cs:582