DeriveVisualStudioPath() private static method

private static DeriveVisualStudioPath ( string debuggerPath ) : string
debuggerPath string
return string
コード例 #1
0
ファイル: SyncVS.cs プロジェクト: lsx6244413/UnityDecomplie
        private static IDictionary <VisualStudioVersion, string> GetInstalledVisualStudios()
        {
            Dictionary <VisualStudioVersion, string> dictionary = new Dictionary <VisualStudioVersion, string>();

            if (SyncVS.SolutionSynchronizationSettings.IsWindows)
            {
                IEnumerator enumerator = Enum.GetValues(typeof(VisualStudioVersion)).GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        VisualStudioVersion visualStudioVersion = (VisualStudioVersion)enumerator.Current;
                        try
                        {
                            string text = Environment.GetEnvironmentVariable(string.Format("VS{0}0COMNTOOLS", (int)visualStudioVersion));
                            if (!string.IsNullOrEmpty(text))
                            {
                                string text2 = Paths.Combine(new string[]
                                {
                                    text,
                                    "..",
                                    "IDE",
                                    "devenv.exe"
                                });
                                if (File.Exists(text2))
                                {
                                    dictionary[visualStudioVersion] = text2;
                                    continue;
                                }
                            }
                            text = SyncVS.GetRegistryValue(string.Format("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\{0}.0", (int)visualStudioVersion), "InstallDir");
                            if (string.IsNullOrEmpty(text))
                            {
                                text = SyncVS.GetRegistryValue(string.Format("HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\VisualStudio\\{0}.0", (int)visualStudioVersion), "InstallDir");
                            }
                            if (!string.IsNullOrEmpty(text))
                            {
                                string text3 = Paths.Combine(new string[]
                                {
                                    text,
                                    "devenv.exe"
                                });
                                if (File.Exists(text3))
                                {
                                    dictionary[visualStudioVersion] = text3;
                                    continue;
                                }
                            }
                            text = SyncVS.GetRegistryValue(string.Format("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\{0}.0\\Debugger", (int)visualStudioVersion), "FEQARuntimeImplDll");
                            if (!string.IsNullOrEmpty(text))
                            {
                                string text4 = SyncVS.DeriveVisualStudioPath(text);
                                if (!string.IsNullOrEmpty(text4) && File.Exists(text4))
                                {
                                    dictionary[visualStudioVersion] = SyncVS.DeriveVisualStudioPath(text);
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
            }
            return(dictionary);
        }
コード例 #2
0
ファイル: SyncVS.cs プロジェクト: yaoya/UnityDecompiled
        private static IDictionary <VisualStudioVersion, VisualStudioPath[]> GetInstalledVisualStudios()
        {
            Dictionary <VisualStudioVersion, VisualStudioPath[]> dictionary = new Dictionary <VisualStudioVersion, VisualStudioPath[]>();

            if (SyncVS.SolutionSynchronizationSettings.IsWindows)
            {
                IEnumerator enumerator = Enum.GetValues(typeof(VisualStudioVersion)).GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        VisualStudioVersion visualStudioVersion = (VisualStudioVersion)enumerator.Current;
                        if (visualStudioVersion <= VisualStudioVersion.VisualStudio2015)
                        {
                            try
                            {
                                string text = Environment.GetEnvironmentVariable(string.Format("VS{0}0COMNTOOLS", (int)visualStudioVersion));
                                if (!string.IsNullOrEmpty(text))
                                {
                                    string path = Paths.Combine(new string[]
                                    {
                                        text,
                                        "..",
                                        "IDE",
                                        "devenv.exe"
                                    });
                                    if (File.Exists(path))
                                    {
                                        dictionary[visualStudioVersion] = new VisualStudioPath[]
                                        {
                                            new VisualStudioPath(path, "")
                                        };
                                        continue;
                                    }
                                }
                                text = SyncVS.GetRegistryValue(string.Format("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\{0}.0", (int)visualStudioVersion), "InstallDir");
                                if (string.IsNullOrEmpty(text))
                                {
                                    text = SyncVS.GetRegistryValue(string.Format("HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\VisualStudio\\{0}.0", (int)visualStudioVersion), "InstallDir");
                                }
                                if (!string.IsNullOrEmpty(text))
                                {
                                    string path2 = Paths.Combine(new string[]
                                    {
                                        text,
                                        "devenv.exe"
                                    });
                                    if (File.Exists(path2))
                                    {
                                        dictionary[visualStudioVersion] = new VisualStudioPath[]
                                        {
                                            new VisualStudioPath(path2, "")
                                        };
                                        continue;
                                    }
                                }
                                text = SyncVS.GetRegistryValue(string.Format("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\{0}.0\\Debugger", (int)visualStudioVersion), "FEQARuntimeImplDll");
                                if (!string.IsNullOrEmpty(text))
                                {
                                    string text2 = SyncVS.DeriveVisualStudioPath(text);
                                    if (!string.IsNullOrEmpty(text2) && File.Exists(text2))
                                    {
                                        dictionary[visualStudioVersion] = new VisualStudioPath[]
                                        {
                                            new VisualStudioPath(SyncVS.DeriveVisualStudioPath(text), "")
                                        };
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                string[] requiredWorkloads = new string[]
                {
                    "Microsoft.VisualStudio.Workload.ManagedGame"
                };
                string[]           rawDevEnvPaths = VisualStudioUtil.FindVisualStudioDevEnvPaths(15, requiredWorkloads);
                VisualStudioPath[] array          = (from vs in VisualStudioUtil.ParseRawDevEnvPaths(rawDevEnvPaths)
                                                     where !requiredWorkloads.Except(vs.Workloads).Any <string>()
                                                     select new VisualStudioPath(vs.DevEnvPath, vs.Edition)).ToArray <VisualStudioPath>();
                if (array.Length != 0)
                {
                    dictionary[VisualStudioVersion.VisualStudio2017] = array;
                }
            }
            return(dictionary);
        }