UnityEditor.SyncVS.CheckVisualStudioVersion C# (CSharp) Method

CheckVisualStudioVersion() static private method

static private CheckVisualStudioVersion ( int major, int minor, int build ) : bool
major int
minor int
build int
return bool
        internal static bool CheckVisualStudioVersion(int major, int minor, int build)
        {
            int num = -1;
            int num2 = -1;
            if (major != 11)
            {
                return false;
            }
            RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\DevDiv\vc\Servicing");
            if (key == null)
            {
                return false;
            }
            foreach (string str in key.GetSubKeyNames())
            {
                if (str.StartsWith("11.") && (str.Length > 3))
                {
                    try
                    {
                        int num4 = Convert.ToInt32(str.Substring(3));
                        if (num4 > num)
                        {
                            num = num4;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            if (num < 0)
            {
                return false;
            }
            RegistryKey key2 = key.OpenSubKey(string.Format(@"11.{0}\RuntimeDebug", num));
            if (key2 == null)
            {
                return false;
            }
            string str2 = key2.GetValue("Version", null) as string;
            if (str2 == null)
            {
                return false;
            }
            char[] separator = new char[] { '.' };
            string[] strArray2 = str2.Split(separator);
            if ((strArray2 == null) || (strArray2.Length < 3))
            {
                return false;
            }
            try
            {
                num2 = Convert.ToInt32(strArray2[2]);
            }
            catch (Exception)
            {
                return false;
            }
            return ((num > minor) || ((num == minor) && (num2 >= build)));
        }