Beispiel #1
0
 public static string GetFrameworkPath()
 {
     if (frameworkPath == null)
     {
         string[] strArray = new string[] { @"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft\VisualStudio\SxS\VC7", @"HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Microsoft\VisualStudio\SxS\VC7", @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft\VisualStudio\SxS\VC7", @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft\VisualStudio\SxS\VC7" };
         foreach (string str in strArray)
         {
             string str2 = RegistryUtil.GetRegistryStringValue32(str, "FrameworkDir32", null);
             if (!string.IsNullOrEmpty(str2))
             {
                 string str3 = RegistryUtil.GetRegistryStringValue32(str, "FrameworkVer32", null);
                 if (!string.IsNullOrEmpty(str3))
                 {
                     frameworkPath = Path.Combine(str2, str3);
                     break;
                 }
             }
         }
         if (frameworkPath == null)
         {
             frameworkPath = Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), @"Microsoft.NET\Framework\v4.0.30319");
         }
     }
     return(frameworkPath);
 }
Beispiel #2
0
        protected static string GetPlatformAssemblyPath(WSASDK wsaSDK)
        {
            string text;
            string path;

            switch (wsaSDK)
            {
            case WSASDK.SDK80:
                text = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0", "InstallationFolder");
                path = "Windows Kits\\8.0";
                break;

            case WSASDK.SDK81:
                text = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1", "InstallationFolder");
                path = "Windows Kits\\8.1";
                break;

            case WSASDK.PhoneSDK81:
                text = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhoneApp\\v8.1", "InstallationFolder");
                path = "Windows Phone Kits\\8.1";
                break;

            default:
                throw new Exception("Unknown Windows SDK: " + wsaSDK.ToString());
            }
            if (text == null)
            {
                string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
                text = Path.Combine(folderPath, path);
            }
            return(Path.Combine(text, "References\\CommonConfiguration\\Neutral\\Windows.winmd"));
        }
        private static void GetWindowsKit10(out string folder, out Version version)
        {
            string environmentVariable = Environment.GetEnvironmentVariable("ProgramFiles(x86)");

            folder  = Path.Combine(environmentVariable, "Windows Kits\\10\\");
            version = new Version(10, 0, 10240);
            try
            {
                folder = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0", "InstallationFolder", folder);
                string registryStringValue = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0", "ProductVersion", version.ToString());
                version = new Version(registryStringValue);
            }
            catch
            {
            }
        }
Beispiel #4
0
        internal static string GetWindowsKitDirectory(WSASDK wsaSDK)
        {
            string text;

            switch (wsaSDK)
            {
            case WSASDK.SDK80:
            {
                text = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0", "InstallationFolder", null);
                string path = "Windows Kits\\8.0";
                goto IL_AD;
            }

            case WSASDK.SDK81:
            {
                text = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1", "InstallationFolder", null);
                string path = "Windows Kits\\8.1";
                goto IL_AD;
            }

            case WSASDK.PhoneSDK81:
            {
                text = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhoneApp\\v8.1", "InstallationFolder", null);
                string path = "Windows Phone Kits\\8.1";
                goto IL_AD;
            }

            case WSASDK.UWP:
            {
                text = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0", "InstallationFolder", null);
                string path = "Windows Kits\\10.0";
                goto IL_AD;
            }
            }
            throw new Exception("Unknown Windows SDK: " + wsaSDK.ToString());
IL_AD:
            if (text == null)
            {
                string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
                string path;
                text = Path.Combine(folderPath, path);
            }
            return(text);
        }
        protected static string GetPlatformAssemblyPath(WSASDK wsaSDK)
        {
            string str;
            string str2;

            switch (wsaSDK)
            {
            case WSASDK.SDK80:
                str2 = RegistryUtil.GetRegistryStringValue32(@"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0", "InstallationFolder");
                str  = @"Windows Kits\8.0";
                break;

            case WSASDK.SDK81:
                str2 = RegistryUtil.GetRegistryStringValue32(@"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1", "InstallationFolder");
                str  = @"Windows Kits\8.1";
                break;

            case WSASDK.PhoneSDK81:
                str2 = RegistryUtil.GetRegistryStringValue32(@"SOFTWARE\Microsoft\Microsoft SDKs\WindowsPhoneApp\v8.1", "InstallationFolder");
                str  = @"Windows Phone Kits\8.1";
                break;

            case WSASDK.UWP:
                str2 = RegistryUtil.GetRegistryStringValue32(@"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0", "InstallationFolder");
                str  = @"Windows Kits\10.0";
                break;

            default:
                throw new Exception("Unknown Windows SDK: " + wsaSDK.ToString());
            }
            if (str2 == null)
            {
                str2 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), str);
            }
            if (wsaSDK == WSASDK.UWP)
            {
                return(Path.Combine(str2, @"UnionMetadata\Windows.winmd"));
            }
            return(Path.Combine(str2, @"References\CommonConfiguration\Neutral\Windows.winmd"));
        }
        internal static string GetWindowsKitDirectory(WSASDK wsaSDK)
        {
            string str;
            string path2;

            switch (wsaSDK)
            {
            case WSASDK.SDK80:
                str   = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0", "InstallationFolder", (string)null);
                path2 = "Windows Kits\\8.0";
                break;

            case WSASDK.SDK81:
                str   = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1", "InstallationFolder", (string)null);
                path2 = "Windows Kits\\8.1";
                break;

            case WSASDK.PhoneSDK81:
                str   = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhoneApp\\v8.1", "InstallationFolder", (string)null);
                path2 = "Windows Phone Kits\\8.1";
                break;

            case WSASDK.UWP:
                str   = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0", "InstallationFolder", (string)null);
                path2 = "Windows Kits\\10.0";
                break;

            default:
                throw new Exception("Unknown Windows SDK: " + wsaSDK.ToString());
            }
            if (str == null)
            {
                str = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), path2);
            }
            return(str);
        }
Beispiel #7
0
        private static string GetWindowsKit10()
        {
            string environmentVariable = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
            string text = Path.Combine(environmentVariable, "Windows Kits\\10\\");

            try
            {
                text = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0", "InstallationFolder", text);
            }
            catch
            {
            }
            string result;

            if (!Directory.Exists(text))
            {
                result = string.Empty;
            }
            else
            {
                result = text;
            }
            return(result);
        }