Inheritance: IToolchainVersion
        public XilinxToolchain(ToolchainManager manager, XilinxVersion version)
        {
            if (version == null)
            {
                throw new ArgumentNullException("version");
            }
            Version = version;
            Manager = manager;

            Logger.Instance.WriteDebug("Created Xilinx Toolchain Instance with version '{0}'", Version.ToString());

            PopulatePathData();
            PopulateToolFactories();
        }
        /// <summary>
        /// Scan the system for Xilinx installs using default install information.
        /// </summary>
        private static void ScanForXilinxInstalls()
        {
            if (XilinxInstalls == null)
            {
                XilinxInstalls = new List<XilinxVersion>();

                // Check the environment variable for a forced XILINX path
                string environmentISE = Environment.GetEnvironmentVariable("XILINX");
                if (Directory.Exists(environmentISE))
                {
                    XilinxEnviromentVersion = XilinxVersion.GetVersionFromFileset(environmentISE);
                    if (XilinxEnviromentVersion != null)
                    {
                        Logger.Instance.WriteDebug("Install version {0} @ '{1}' id = '{2}'",
                            XilinxEnviromentVersion.Version, XilinxEnviromentVersion.RootPath, XilinxEnviromentVersion.UniqueId);
                        XilinxInstalls.Add(XilinxEnviromentVersion);
                    }
                }

                // Scan for extra installs
                string[] installs = Directory.GetDirectories(GetXilinxDefaultRoot());
                foreach (string install in installs)
                {
                    XilinxVersion installVersion = XilinxVersion.GetVersionFromFileset(install);
                    if (installVersion == null)
                    {
                        // May use a ISE_DS sub directory
                        installVersion = XilinxVersion.GetVersionFromFileset(PathHelper.Combine(install, "ISE_DS"));
                    }

                    if (installVersion != null)
                    {
                        Logger.Instance.WriteDebug("Install version {0} @ '{1}' id = '{2}'",
                            installVersion.Version, installVersion.RootPath, installVersion.UniqueId);
                        // TODO: avoid duplicates
                        XilinxInstalls.Add(installVersion);
                    }
                }
            }
        }
        private static XilinxVersion GetCurrentXilinxVersion()
        {
            if (CurrentVersion != null)
            {
                return CurrentVersion;
            }
            else
            {
                ScanForXilinxInstalls();

                if (XilinxEnviromentVersion == null)
                {
                    foreach (XilinxVersion version in XilinxInstalls)
                    {
                        if (CurrentVersion == null || version.Version > CurrentVersion.Version)
                        {
                            CurrentVersion = version;
                        }
                    }
                }
                else
                {
                    CurrentVersion = XilinxEnviromentVersion;
                }
            }

            if (CurrentVersion == null)
            {
                throw new Exception("Unable to locate a Xilinx Installation directory, please set the XILINX variable.");
            }
            Logger.Instance.WriteVerbose("Located Xilinx {0} root at '{1}'", CurrentVersion.Version, CurrentVersion.RootPath);

            return CurrentVersion;
        }