Пример #1
0
 public static void Initialize(string editorPath)
 {
     if (Application.platform == RuntimePlatform.WindowsEditor)
     {
         string text = editorPath ?? EditorPrefs.GetString("kScriptsDefaultApp");
         if (text.EndsWith("UnityVS.OpenFile.exe"))
         {
             text = SyncVS.FindBestVisualStudio();
             if (text != null)
             {
                 EditorPrefs.SetString("kScriptsDefaultApp", text);
             }
         }
         VisualStudioVersion version;
         if (UnityVSSupport.IsVisualStudio(text, out version))
         {
             UnityVSSupport.m_ShouldUnityVSBeActive = true;
             string vstuBridgeAssembly = UnityVSSupport.GetVstuBridgeAssembly(version);
             if (vstuBridgeAssembly == null)
             {
                 Console.WriteLine("Unable to find bridge dll in registry for Microsoft Visual Studio Tools for Unity for " + text);
             }
             else if (!File.Exists(vstuBridgeAssembly))
             {
                 Console.WriteLine("Unable to find bridge dll on disk for Microsoft Visual Studio Tools for Unity for " + vstuBridgeAssembly);
             }
             else
             {
                 UnityVSSupport.s_UnityVSBridgeToLoad = vstuBridgeAssembly;
                 InternalEditorUtility.SetupCustomDll(Path.GetFileNameWithoutExtension(vstuBridgeAssembly), vstuBridgeAssembly);
             }
         }
     }
 }
Пример #2
0
        private static void InitializeVisualStudio(string externalEditor)
        {
            if (externalEditor.EndsWith("UnityVS.OpenFile.exe"))
            {
                externalEditor = SyncVS.FindBestVisualStudio();
                if (externalEditor != null)
                {
                    ScriptEditorUtility.SetExternalScriptEditor(externalEditor);
                }
            }
            VisualStudioVersion version;

            if (UnityVSSupport.IsVisualStudio(externalEditor, out version))
            {
                UnityVSSupport.m_ShouldUnityVSBeActive = true;
                string vstuBridgeAssembly = UnityVSSupport.GetVstuBridgeAssembly(version);
                if (vstuBridgeAssembly == null)
                {
                    Console.WriteLine("Unable to find bridge dll in registry for Microsoft Visual Studio Tools for Unity for " + externalEditor);
                }
                else if (!File.Exists(vstuBridgeAssembly))
                {
                    Console.WriteLine("Unable to find bridge dll on disk for Microsoft Visual Studio Tools for Unity for " + vstuBridgeAssembly);
                }
                else
                {
                    UnityVSSupport.s_UnityVSBridgeToLoad = vstuBridgeAssembly;
                    InternalEditorUtility.RegisterPrecompiledAssembly(Path.GetFileNameWithoutExtension(vstuBridgeAssembly), vstuBridgeAssembly);
                }
            }
        }
Пример #3
0
        public static void Initialize(string editorPath)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            UnityVSSupport.\u003CInitialize\u003Ec__AnonStoreyC4 initializeCAnonStoreyC4 = new UnityVSSupport.\u003CInitialize\u003Ec__AnonStoreyC4();
            if (Application.platform != RuntimePlatform.WindowsEditor)
            {
                return;
            }
            // ISSUE: reference to a compiler-generated field
            initializeCAnonStoreyC4.externalEditor = editorPath ?? EditorPrefs.GetString("kScriptsDefaultApp");
            // ISSUE: reference to a compiler-generated field
            if (initializeCAnonStoreyC4.externalEditor.EndsWith("UnityVS.OpenFile.exe"))
            {
                // ISSUE: reference to a compiler-generated field
                initializeCAnonStoreyC4.externalEditor = SyncVS.FindBestVisualStudio();
                // ISSUE: reference to a compiler-generated field
                if (initializeCAnonStoreyC4.externalEditor != null)
                {
                    // ISSUE: reference to a compiler-generated field
                    EditorPrefs.SetString("kScriptsDefaultApp", initializeCAnonStoreyC4.externalEditor);
                }
            }
            // ISSUE: reference to a compiler-generated method
            KeyValuePair <VisualStudioVersion, string>[] array = SyncVS.InstalledVisualStudios.Where <KeyValuePair <VisualStudioVersion, string> >(new Func <KeyValuePair <VisualStudioVersion, string>, bool>(initializeCAnonStoreyC4.\u003C\u003Em__237)).ToArray <KeyValuePair <VisualStudioVersion, string> >();
            bool flag = array.Length > 0;

            UnityVSSupport.m_ShouldUnityVSBeActive = flag;
            if (!flag)
            {
                return;
            }
            string vstuBridgeAssembly = UnityVSSupport.GetVstuBridgeAssembly(array[0].Key);

            if (vstuBridgeAssembly == null)
            {
                // ISSUE: reference to a compiler-generated field
                Console.WriteLine("Unable to find bridge dll in registry for Microsoft Visual Studio Tools for Unity for " + initializeCAnonStoreyC4.externalEditor);
            }
            else if (!File.Exists(vstuBridgeAssembly))
            {
                Console.WriteLine("Unable to find bridge dll on disk for Microsoft Visual Studio Tools for Unity for " + vstuBridgeAssembly);
            }
            else
            {
                UnityVSSupport.s_LoadedUnityVS = vstuBridgeAssembly;
                InternalEditorUtility.SetupCustomDll(Path.GetFileNameWithoutExtension(vstuBridgeAssembly), vstuBridgeAssembly);
            }
        }
Пример #4
0
        public static void Initialize(string editorPath)
        {
            if (Application.platform != RuntimePlatform.WindowsEditor)
            {
                return;
            }
            string externalEditor = editorPath ?? EditorPrefs.GetString("kScriptsDefaultApp");

            if (externalEditor.EndsWith("UnityVS.OpenFile.exe"))
            {
                externalEditor = SyncVS.FindBestVisualStudio();
                if (externalEditor != null)
                {
                    EditorPrefs.SetString("kScriptsDefaultApp", externalEditor);
                }
            }
            KeyValuePair <VisualStudioVersion, string>[] array = (from kvp in SyncVS.InstalledVisualStudios
                                                                  where Paths.AreEqual(kvp.Value, externalEditor, true)
                                                                  select kvp).ToArray <KeyValuePair <VisualStudioVersion, string> >();
            bool flag = array.Length > 0;

            UnityVSSupport.m_ShouldUnityVSBeActive = flag;
            if (!flag)
            {
                return;
            }
            string vstuBridgeAssembly = UnityVSSupport.GetVstuBridgeAssembly(array[0].Key);

            if (vstuBridgeAssembly == null)
            {
                Console.WriteLine("Unable to find bridge dll in registry for Microsoft Visual Studio Tools for Unity for " + externalEditor);
                return;
            }
            if (!File.Exists(vstuBridgeAssembly))
            {
                Console.WriteLine("Unable to find bridge dll on disk for Microsoft Visual Studio Tools for Unity for " + vstuBridgeAssembly);
                return;
            }
            UnityVSSupport.s_LoadedUnityVS = vstuBridgeAssembly;
            InternalEditorUtility.SetupCustomDll(Path.GetFileNameWithoutExtension(vstuBridgeAssembly), vstuBridgeAssembly);
        }