Пример #1
0
        public static bool NativeImageExists(string fileName, FrameworkVersion version, FrameworkArch arch)
        {
            string assymblyFolder = Path.Combine(Environment.ExpandEnvironmentVariables("%WInDir%"), "assembly");
            string nativeImageFileName = Path.GetFileNameWithoutExtension(fileName) + ".ni" + Path.GetExtension(fileName);
            string nativeImageFolderName = "NativeImages";

            if (FrameworkVersion.NetFX20 == version)
            {
                nativeImageFolderName += "_v2.0.50727";
            }
            else if (FrameworkVersion.NetFX40 == version)
            {
                // version number will keep changing up untill 4.0 RTM
                nativeImageFolderName += "_v4.0.*";
            }

            if (FrameworkArch.x86 == arch)
            {
                nativeImageFolderName += "_32";
            }
            else if (FrameworkArch.x64 == arch)
            {
                nativeImageFolderName += "_64";
            }

            // search for all directories matching the widcard to suppor 4.0
            DirectoryInfo directory = new DirectoryInfo(assymblyFolder);
            DirectoryInfo[] nativeImageDirectoryList = directory.GetDirectories(nativeImageFolderName);

            if (null == nativeImageDirectoryList || nativeImageDirectoryList.Length < 1)
            {
                return false;
            }

            FileInfo[] nativeImageFileList = nativeImageDirectoryList[0].GetFiles(nativeImageFileName, SearchOption.AllDirectories);
            if (null == nativeImageFileList || nativeImageFileList.Length < 1)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
Пример #2
0
        public static bool NativeImageExists(string fileName, FrameworkVersion version, FrameworkArch arch)
        {
            string assymblyFolder        = Path.Combine(Environment.ExpandEnvironmentVariables("%WInDir%"), "assembly");
            string nativeImageFileName   = Path.GetFileNameWithoutExtension(fileName) + ".ni" + Path.GetExtension(fileName);
            string nativeImageFolderName = "NativeImages";

            if (FrameworkVersion.NetFX20 == version)
            {
                nativeImageFolderName += "_v2.0.50727";
            }
            else if (FrameworkVersion.NetFX40 == version)
            {
                // version number will keep changing up untill 4.0 RTM
                nativeImageFolderName += "_v4.0.*";
            }

            if (FrameworkArch.x86 == arch)
            {
                nativeImageFolderName += "_32";
            }
            else if (FrameworkArch.x64 == arch)
            {
                nativeImageFolderName += "_64";
            }

            // search for all directories matching the widcard to suppor 4.0
            DirectoryInfo directory = new DirectoryInfo(assymblyFolder);

            DirectoryInfo[] nativeImageDirectoryList = directory.GetDirectories(nativeImageFolderName);

            if (null == nativeImageDirectoryList || nativeImageDirectoryList.Length < 1)
            {
                return(false);
            }

            FileInfo[] nativeImageFileList = nativeImageDirectoryList[0].GetFiles(nativeImageFileName, SearchOption.AllDirectories);
            if (null == nativeImageFileList || nativeImageFileList.Length < 1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }