Example #1
0
        private npandaySettingsVendorsVendor[] GetVendorsForMicrosoft(RegistryKey microsoftRegistryKey)
        {
            if (microsoftRegistryKey == null)
            {
                throw new ExecutionException("NPANDAY-9011-006: Microsoft installation could not be found.");
            }

            string installRoot = (string)microsoftRegistryKey.GetValue("InstallRoot");

            DotnetSdkLocator sdkLocator = new DotnetSdkLocator();

            string sdkInstallRoot11 = sdkLocator.Find1_1();
            string sdkInstallRoot20 = sdkLocator.Find2_0();
            string sdkInstallRoot35 = sdkLocator.Find3_5();
            string sdkInstallRoot40 = sdkLocator.Find4_0();

            if (installRoot == null)
            {
                throw new ExecutionException("NPANDAY-9011-005");
            }

            List <npandaySettingsVendorsVendor> vendors = new List <npandaySettingsVendorsVendor>();
            DirectoryInfo dirInfo11 = new DirectoryInfo(Path.Combine(installRoot, "v1.1.4322"));
            DirectoryInfo dirInfo20 = new DirectoryInfo(Path.Combine(installRoot, "v2.0.50727"));
            DirectoryInfo dirInfo30 = new DirectoryInfo(Path.Combine(installRoot, "v3.0"));
            DirectoryInfo dirInfo35 = new DirectoryInfo(Path.Combine(installRoot, "v3.5"));
            DirectoryInfo dirInfo40 = new DirectoryInfo(Path.Combine(installRoot, "v4.0.30319"));

            if (dirInfo11.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName    = "MICROSOFT";
                vendor.vendorVersion = "1.1.4322";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks
                    = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework vf
                                    = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot      = dirInfo11.FullName;
                vf.frameworkVersion = "1.1.4322";

                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot   = sdkInstallRoot11;
                FindAndAssignExecutablePaths(vf);
                vendor.frameworks = vendorFrameworks;

                vendors.Add(vendor);
            }
            if (dirInfo20.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName    = "MICROSOFT";
                vendor.vendorVersion = "2.0.50727";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks
                    = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework vf = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot      = dirInfo20.FullName;
                vf.frameworkVersion = "2.0.50727";
                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot   = sdkInstallRoot20;
                FindAndAssignExecutablePaths(vf);

                vendor.frameworks = vendorFrameworks;
                vendors.Add(vendor);
            }
            if (dirInfo30.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName    = "MICROSOFT";
                vendor.vendorVersion = "3.0";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework   vf = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot      = dirInfo30.FullName;
                vf.frameworkVersion = "3.0";
                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot   = sdkInstallRoot20;

                // 3.0 does not have it's own compilers, so the bins from 2.0 will do the job here
                vf.executablePaths = new string[] { dirInfo20.FullName };

                FindAndAssignExecutablePaths(vf);
                vendor.frameworks = vendorFrameworks;
                vendors.Add(vendor);
            }
            if (dirInfo35.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName    = "MICROSOFT";
                vendor.vendorVersion = "3.5";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework   vf = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot      = dirInfo35.FullName;
                vf.frameworkVersion = "3.5";
                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot   = sdkInstallRoot35;
                FindAndAssignExecutablePaths(vf);
                vendor.frameworks = vendorFrameworks;
                vendors.Add(vendor);
            }
            if (dirInfo40.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName    = "MICROSOFT";
                vendor.vendorVersion = "4.0";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework   vf = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot      = dirInfo40.FullName;
                vf.frameworkVersion = "4.0";
                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot   = sdkInstallRoot40;
                FindAndAssignExecutablePaths(vf);
                vendor.frameworks = vendorFrameworks;
                vendors.Add(vendor);
            }

            foreach (string sdk in microsoftRegistryKey.GetSubKeyNames())
            {
                if (sdk == "v4.5.50709")
                {
                    npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                    vendor.vendorName    = "MICROSOFT";
                    vendor.vendorVersion = "4.5";
                    npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                    npandaySettingsVendorsVendorFrameworksFramework   vf = new npandaySettingsVendorsVendorFrameworksFramework();
                    vf.installRoot      = dirInfo40.FullName;
                    vf.frameworkVersion = "4.5";
                    vendorFrameworks[0] = vf;
                    vf.sdkInstallRoot   = sdkInstallRoot40;
                    FindAndAssignExecutablePaths(vf);
                    vendor.frameworks = vendorFrameworks;
                    vendors.Add(vendor);
                }
                else if (sdk == "v4.5.1")
                {
                    npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                    vendor.vendorName    = "MICROSOFT";
                    vendor.vendorVersion = "4.5.1";
                    npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                    npandaySettingsVendorsVendorFrameworksFramework   vf = new npandaySettingsVendorsVendorFrameworksFramework();
                    vf.installRoot      = dirInfo40.FullName;
                    vf.frameworkVersion = "4.5.1";
                    vendorFrameworks[0] = vf;
                    vf.sdkInstallRoot   = sdkInstallRoot40;
                    FindAndAssignExecutablePaths(vf);
                    vendor.frameworks = vendorFrameworks;
                    vendors.Add(vendor);
                }
            }
            return(vendors.ToArray());
        }
        private npandaySettingsVendorsVendor[] GetVendorsForMicrosoft(RegistryKey microsoftRegistryKey)
        {
            if (microsoftRegistryKey == null)
                throw new ExecutionException("NPANDAY-9011-006: Microsoft installation could not be found.");

            string installRoot = (string)microsoftRegistryKey.GetValue("InstallRoot");

            DotnetSdkLocator sdkLocator = new DotnetSdkLocator();

            string sdkInstallRoot11 = sdkLocator.Find1_1();
            string sdkInstallRoot20 = sdkLocator.Find2_0();
            string sdkInstallRoot35 = sdkLocator.Find3_5();
            string sdkInstallRoot40 = sdkLocator.Find4_0();

            if (installRoot == null) throw new ExecutionException("NPANDAY-9011-005");

            List<npandaySettingsVendorsVendor> vendors = new List<npandaySettingsVendorsVendor>();
            DirectoryInfo dirInfo11 = new DirectoryInfo(Path.Combine(installRoot, "v1.1.4322"));
            DirectoryInfo dirInfo20 = new DirectoryInfo(Path.Combine(installRoot, "v2.0.50727"));
            DirectoryInfo dirInfo30 = new DirectoryInfo(Path.Combine(installRoot, "v3.0"));
            DirectoryInfo dirInfo35 = new DirectoryInfo(Path.Combine(installRoot, "v3.5"));
            DirectoryInfo dirInfo40 = new DirectoryInfo(Path.Combine(installRoot, "v4.0.30319"));

            if (dirInfo11.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName = "MICROSOFT";
                vendor.vendorVersion = "1.1.4322";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks
                    = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework vf
                    = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot = dirInfo11.FullName;
                vf.frameworkVersion = "1.1.4322";

                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot = sdkInstallRoot11;
                FindAndAssignExecutablePaths(vf);
                vendor.frameworks = vendorFrameworks;

                vendors.Add(vendor);
            }
            if (dirInfo20.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName = "MICROSOFT";
                vendor.vendorVersion = "2.0.50727";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks
                    = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework vf = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot = dirInfo20.FullName;
                vf.frameworkVersion = "2.0.50727";
                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot = sdkInstallRoot20;
                FindAndAssignExecutablePaths(vf);

                vendor.frameworks = vendorFrameworks;
                vendors.Add(vendor);
            }
            if (dirInfo30.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName = "MICROSOFT";
                vendor.vendorVersion = "3.0";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework vf = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot = dirInfo30.FullName;
                vf.frameworkVersion = "3.0";
                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot = sdkInstallRoot20;

                // 3.0 does not have it's own compilers, so the bins from 2.0 will do the job here
                vf.executablePaths = new string[] { dirInfo20.FullName };

                FindAndAssignExecutablePaths(vf);
                vendor.frameworks = vendorFrameworks;
                vendors.Add(vendor);
            }
            if (dirInfo35.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName = "MICROSOFT";
                vendor.vendorVersion = "3.5";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework vf = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot = dirInfo35.FullName;
                vf.frameworkVersion = "3.5";
                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot = sdkInstallRoot35;
                FindAndAssignExecutablePaths(vf);
                vendor.frameworks = vendorFrameworks;
                vendors.Add(vendor);
            }
            if (dirInfo40.Exists)
            {
                npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                vendor.vendorName = "MICROSOFT";
                vendor.vendorVersion = "4.0";
                npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                npandaySettingsVendorsVendorFrameworksFramework vf = new npandaySettingsVendorsVendorFrameworksFramework();
                vf.installRoot = dirInfo40.FullName;
                vf.frameworkVersion = "4.0";
                vendorFrameworks[0] = vf;
                vf.sdkInstallRoot = sdkInstallRoot40;
                FindAndAssignExecutablePaths(vf);
                vendor.frameworks = vendorFrameworks;
                vendors.Add(vendor);
            }

            foreach (string sdk in microsoftRegistryKey.GetSubKeyNames())
            {
                if (sdk == "v4.5.50709")
                {
                    npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                    vendor.vendorName = "MICROSOFT";
                    vendor.vendorVersion = "4.5";
                    npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                    npandaySettingsVendorsVendorFrameworksFramework vf = new npandaySettingsVendorsVendorFrameworksFramework();
                    vf.installRoot = dirInfo40.FullName;
                    vf.frameworkVersion = "4.5";
                    vendorFrameworks[0] = vf;
                    vf.sdkInstallRoot = sdkInstallRoot40;
                    FindAndAssignExecutablePaths(vf);
                    vendor.frameworks = vendorFrameworks;
                    vendors.Add(vendor);
                }
                else if (sdk == "v4.5.1")
                {
                    npandaySettingsVendorsVendor vendor = new npandaySettingsVendorsVendor();
                    vendor.vendorName = "MICROSOFT";
                    vendor.vendorVersion = "4.5.1";
                    npandaySettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new npandaySettingsVendorsVendorFrameworksFramework[1];
                    npandaySettingsVendorsVendorFrameworksFramework vf = new npandaySettingsVendorsVendorFrameworksFramework();
                    vf.installRoot = dirInfo40.FullName;
                    vf.frameworkVersion = "4.5.1";
                    vendorFrameworks[0] = vf;
                    vf.sdkInstallRoot = sdkInstallRoot40;
                    FindAndAssignExecutablePaths(vf);
                    vendor.frameworks = vendorFrameworks;
                    vendors.Add(vendor);
                }
            }
            return vendors.ToArray();
        }