Helpers.Has30 C# (CSharp) Method

Has30() public static method

Determines if the User Agent String indicates .NET 3.0
public static Has30 ( String UserAgent ) : bool
UserAgent String A User Agent String
return bool
    public static bool Has30(String UserAgent)
    {
        return UserAgent.Contains(Constants.Version30Full);
    }

Usage Example

示例#1
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);
    }
All Usage Examples Of Helpers::Has30