-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return response object from GetUpdateInformation
Return an Response class with strongly typed properties for VersionCanBeDetermined and CanRunCheckApp. Enables removal of "This is the worst thing I've ever done..." comment
- Loading branch information
Showing
5 changed files
with
38 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,43 @@ | ||
using System; | ||
using System.Web; | ||
|
||
using SmallestDotNetLib; | ||
|
||
public partial class _Default : System.Web.UI.Page | ||
{ | ||
protected void Page_Load(object sender, EventArgs e) | ||
{ | ||
string userAgentText; | ||
bool runFromChecker = false; | ||
userAgent.Text = HttpUtility.HtmlEncode(Request.UserAgent); | ||
|
||
if (Request.QueryString["realversion"] != null) | ||
{ | ||
userResult.Text = Helpers.GetUpdateInformation(Request.QueryString["realversion"], Request.Browser.ClrVersion); | ||
userAgentText = this.Request.QueryString["realversion"]; | ||
runFromChecker = true; | ||
} | ||
else | ||
{ | ||
userResult.Text = Helpers.GetUpdateInformation(Request.UserAgent, Request.Browser.ClrVersion); | ||
userAgentText = this.Request.UserAgent; | ||
} | ||
|
||
UpdateInformationResponse response = Helpers.GetUpdateInformation(userAgentText, this.Request.Browser.ClrVersion); | ||
|
||
userResult.Text = response.Text; | ||
developerOnline.Text = String.Format(@"If your users have internet connectivity, the .NET Framework is only between {1} and {2} megs. Why such a wide range? Well, it depends on if they already have some version of .NET. | ||
If you point your users to the online setup for the {0}, that {3} MB download will automatically detect and download the smallest archive possible to get the job done.", Constants.DotNetOnline, Constants.DotNetOfflineMB - Constants.Version3OfflineMB, Constants.DotNetOfflineMB, Constants.DotNetOnlineMB); | ||
|
||
developerOfflineResult.Text = String.Format(@"If you are a developer and are distributing your code on CD or DVD, you might want to download the | ||
{0} on your media. The download is about {1} MB", Constants.DotNetOffline, Constants.DotNetOfflineMB); | ||
getdotnet.Visible = response.VersionCanBeDetermined; | ||
checkdotnet.Visible = response.CanRunCheckApp; | ||
|
||
if (userResult.Text.Contains("can't")) //This is the worst thing I've ever done. We will fix it soon. | ||
{ | ||
getdotnet.Visible = false; | ||
checkdotnet.Visible = true; | ||
} | ||
|
||
if (userResult.Text.Contains("Mac") || userResult.Text.Contains("Linux")) //No, THIS is the worst thing I've ever done. We will fix it soon. | ||
{ | ||
getdotnet.Visible = false; | ||
checkdotnet.Visible = false; | ||
} | ||
|
||
// Hide the 4.5 checker section if | ||
// (a) we can't determine the dotnet version or | ||
// (b) we're on an OS that doesn't support .Net or | ||
// (c) the user has already run the checker so we know exactly what version they're on. | ||
// Note that the checkdotnet section in the header will still be displayed as long as the OS supports it | ||
dotnet45.Visible = response.VersionCanBeDetermined && response.CanRunCheckApp && !runFromChecker; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters