Has35SP1C() public static method

Determines if the User Agent String indicates .NET 3.5 SP1 Client
public static Has35SP1C ( String UserAgent ) : bool
UserAgent String A User Agent String
return bool
        public void CheckAllCLRInUserAgentDetectionStrings()
        {
            var userAgentCLRString = String.Join(" ", CLRVersionStrings().ToArray());

            Assert.IsTrue(Helpers.Has10(userAgentCLRString), ".NET Version 1.0");
            Assert.IsTrue(Helpers.Has11(userAgentCLRString), ".NET Version 1.1");
            Assert.IsTrue(Helpers.Has20(userAgentCLRString), ".NET Version 2.0");
            Assert.IsTrue(Helpers.Has35(userAgentCLRString), ".NET Version 3.5");
            Assert.IsTrue(Helpers.Has35SP1C(userAgentCLRString), ".NET Version 3.5 SP1 Client Profile");
            Assert.IsTrue(Helpers.Has35SP1E(userAgentCLRString), ".NET Version 3.5 SP1 Full");
            Assert.IsTrue(Helpers.Has40C(userAgentCLRString), ".NET Version 4.0 Client Profile");
            Assert.IsTrue(Helpers.Has40E(userAgentCLRString), ".NET Version 4.0 Full");
        }
示例#2
0
    public static UpdateInformationResponse GetUpdateInformation(string UserAgent, string realVersion, int releaseKey)
    {
        bool   net4          = false;
        string netInfoString = "";
        var    response      = new UpdateInformationResponse();

        // We should check this first since we don't need to check .NET versions if they can't have .NET versions
        // Check for windows phone first as it may contain 'Mac' in User Agent
        if (UserAgent.Contains("Windows Phone"))
        {
            response.Text = "It looks like you're running a Windows Phone, awesome! There's no .NET Framework download for the Windows phone, but you might check out <a href=\"https://dev.windows.com/\"/>the Windows Dev Center</a> or <a href=\"http://www.windowsphone.com/store/\"/>the Windows Phone Store</a>";
            return(response);
        }
        if (UserAgent.Contains("Mac"))
        {
            response.Text = "It looks like you're running a Mac or an iPhone. There's no .NET Framework download from Microsoft for the Mac, but you might check out <a href=\"http://www.go-mono.com/mono-downloads/download.html\">Mono</a>, which is an Open Source platform that can run .NET code on a Mac. For your mobile devices, check out <a href=\"http://xamarin.com/platform\">Xamarin</a> and write .NET apps for iOS and Android!";
            return(response);
        }
        if (UserAgent.Contains("nix"))
        {
            response.Text = "It looks like you're running a Unix machine. There's no .NET Framework download from Microsoft for Unix, but you might check out <a href=\"http://www.go-mono.com/mono-downloads/download.html\">Mono</a>, which is an Open Source platform that can run .NET code on Unix.";
            return(response);
        }

        response.CanRunCheckApp         = true;
        response.VersionCanBeDetermined = true;

        net4 = GetWindows8Or10Message(UserAgent, ref netInfoString) || Get40Message(UserAgent, ref netInfoString);
        if (!string.IsNullOrEmpty(realVersion) || releaseKey != 0)
        {
            netInfoString = GetRealVersionMessage(ref realVersion, releaseKey);
        }
        else if (Helpers.Has35(UserAgent) || Helpers.Has35SP1C(UserAgent) || Helpers.Has35SP1E(UserAgent))
        {
            netInfoString += DotNet3_5Message((Helpers.Has35SP1C(UserAgent) || Helpers.Has35SP1E(UserAgent)), net4);
        }
        else if (Helpers.Has30(UserAgent))
        {
            netInfoString += DotNet3Message(net4);
        }
        else if (Helpers.Has20(UserAgent))
        {
            netInfoString += DotNet2Message(net4);
        }
        else if (Helpers.Has11(UserAgent) || Helpers.Has10(UserAgent))
        {
            netInfoString += DotNet1Message(net4);
        }
        else if (!net4)
        {
            if (UserAgent.Contains("fox"))
            {
                netInfoString += MessageForBrowser("Firefox");
            }
            else if (UserAgent.Contains("Chrome"))
            {
                netInfoString += MessageForBrowser("Chrome");
            }
            else if (UserAgent.Contains("Safari")) // Chrome also uses safari in the user agent so this check must come after
            {
                netInfoString += MessageForBrowser("Safari");
            }
            else
            {
                netInfoString += UnknownBrowserMessage();
            }

            response.VersionCanBeDetermined = false;
        }

        if (response.VersionCanBeDetermined)
        {
            response.VersionIsLatest = Helpers.CheckVersionLatest(realVersion, ref netInfoString);
        }

        //need to see if windows 2000 has the latest version
        foreach (KeyValuePair <string, string> windowsVersion in Constants.OldWindows)
        {
            netInfoString += CheckDotNet3_5UnSupportedOs(UserAgent, windowsVersion.Key, windowsVersion.Value);
        }

        response.Text = netInfoString;
        return(response);
    }
示例#3
0
    public static string GetUpdateInformation(string UserAgent, Version version)
    {
        bool   net4          = false;
        string netInfoString = "";


        //We should check this first since we don't need to check .NET versions if they can't have .NET versions
        if (UserAgent.Contains("Mac"))
        {
            netInfoString = "It looks like you're running a Mac or an iPhone. There's no .NET Framework download from Microsoft for the Mac, but you might check out <a href=\"http://www.go-mono.com/mono-downloads/download.html\">Mono</a>, which is an Open Source platform that can run .NET code on a Mac. For your iPhone, check out <a href=\"http://xamarin.com/monotouch\">MonoTouch</a> and write .NET apps for iOS!";
            return(netInfoString);
        }
        if (UserAgent.Contains("nix"))
        {
            netInfoString = "It looks like you're running a Unix machine. There's no .NET Framework download from Microsoft for Unix, but you might check out <a href=\"http://www.go-mono.com/mono-downloads/download.html\">Mono</a>, which is an Open Source platform that can run .NET code on Unix.";
            return(netInfoString);
        }


        net4 = (GetWindows8Message(UserAgent, ref netInfoString) || Get40Message(UserAgent, ref netInfoString));
        if (Helpers.Has35(UserAgent) || Helpers.Has35SP1C(UserAgent) || Helpers.Has35SP1E(UserAgent))
        {
            netInfoString += DotNet3_5Message((Helpers.Has35SP1C(UserAgent) || Helpers.Has35SP1E(UserAgent)), net4);
        }
        else if (Helpers.Has30(UserAgent))
        {
            netInfoString += DotNet3Message(net4);
        }
        else if (Helpers.Has20(UserAgent))
        {
            netInfoString += DotNet2Message(net4);
        }
        else if (Helpers.Has11(UserAgent) || Helpers.Has10(UserAgent))
        {
            netInfoString += DotNet1Message(net4);
        }
        else if (!net4)
        {
            if (UserAgent.Contains("fox"))
            {
                netInfoString += MessageForBrowser("Firefox");
            }
            else if (UserAgent.Contains("Chrome"))
            {
                netInfoString += MessageForBrowser("Chrome");
            }
            else if (UserAgent.Contains("Safari")) // Chrome also uses safari in the user agent so this check must come after
            {
                netInfoString += MessageForBrowser("Safari");
            }
            else
            {
                netInfoString += UnknownBrowserMessage();
            }
        }

        //need to see if windows 2000 has the latest version
        foreach (KeyValuePair <string, string> windowsVersion in Constants.OldWindows)
        {
            netInfoString += CheckDotNet3_5UnSupportedOs(UserAgent, windowsVersion.Key, windowsVersion.Value);
        }

        return(netInfoString);
    }