Пример #1
0
            public static string DetectPath()
            {
                string path  = @"C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe";
                string clsid = "{2F410E77-24FD-4788-8412-3810115E7BCB}";

                if (RegistryKey64.Is64BitOperatingSystem())
                {
                    clsid = "{41E0355D-F488-487D-B7BA-D235D5834F1D}";
                }
                RegistryKey64 key = RegistryKey64.OpenKey(RegistryHive.ClassesRoot, @"CLSID\" + clsid + @"\InprocServer32", false, RegistryKey64.RegWow64Options.None);

                if (key != null)
                {
                    try
                    {
                        path = key.GetValue("") as string;
                        if (path != null)
                        {
                            path = path.Substring(0, path.LastIndexOf('\\') + 1) + "sgdm.exe";
                        }
                    }
                    finally
                    {
                        key.Close();
                    }
                }
                return(path);
            }