Exemple #1
0
        private static List <EDrawingInstall> GetEDrawingsInstallations()
        {
            List <EDrawingInstall> installations = new List <EDrawingInstall>();

            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"))
            {
                foreach (string subkey_name in key.GetSubKeyNames())
                {
                    using (RegistryKey subkey = key.OpenSubKey(subkey_name))
                    {
                        if (subkey.GetValue("DisplayName") != null)
                        {
                            if (subkey.GetValue("DisplayName").ToString().Contains("eDrawing"))
                            {
                                installations.Add(new EDrawingInstall {
                                    Name    = subkey.GetValue("DisplayName").ToString(),
                                    Install = subkey.GetValue("InstallLocation").ToString(),
                                    Year    = EDrawingInstall.GetYear(subkey.GetValue("DisplayName").ToString())
                                });
                            }
                        }
                    }
                }
            }

            return(installations);
        }
Exemple #2
0
        public static string GetMostRecentEDrawingInstall()
        {
            List <EDrawingInstall> installations = GetEDrawingsInstallations();
            EDrawingInstall        newest        = new EDrawingInstall();

            foreach (EDrawingInstall install in installations)
            {
                if (install.Year > (int)newest.Year)
                {
                    newest = install;
                }
            }

            return(newest.FullPath);
        }