Skip to content

Commit

Permalink
fix bug when file size wasn't noticed when downloading from http
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargaj committed Jun 30, 2018
1 parent ee13706 commit df8cb93
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
8 changes: 4 additions & 4 deletions Source/Dialogs/DownloadDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ private async Task<string> DownloadFile(string url, string targetPath)
if (response.Headers["Location"] != null)
{
finalURL = response.Headers["Location"];
if (response.ContentLength > 0)
{
downloadProgress.Maximum = (int)response.ContentLength;
}
}
if (response.ContentLength > 0)
{
downloadProgress.Maximum = (int)response.ContentLength;
}
}
} while (response.Headers["Location"] != null);
Expand Down
50 changes: 25 additions & 25 deletions Source/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,31 +143,31 @@ private async static Task CheckForUpdates()
/// </summary>
[STAThread]
static void Main(string[] args)
{
System.Net.ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
{
if (sslPolicyErrors == System.Net.Security.SslPolicyErrors.None)
{
return true;
}
else
{
if (System.Windows.Forms.MessageBox.Show($"The following server certificate is not valid:\n\n{certificate.ToString()}\n\nAccept?",
"Certificate Validation",
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
return true;
else
return false;
};
};

System.Net.ServicePointManager.Expect100Continue = true;
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Ssl3;

Registry.Initialize();
Settings.LoadSettings();
{
System.Net.ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
{
if (sslPolicyErrors == System.Net.Security.SslPolicyErrors.None)
{
return true;
}
else
{
if (System.Windows.Forms.MessageBox.Show($"The following server certificate is not valid:\n\n{certificate.ToString()}\n\nAccept?",
"Certificate Validation",
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
return true;
else
return false;
};
};

System.Net.ServicePointManager.Expect100Continue = true;
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Ssl3;

Registry.Initialize();
Settings.LoadSettings();

bool registerOnly = false;
string openURL = null;
Expand Down
4 changes: 2 additions & 2 deletions Source/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyVersion("1.4.1.0")]
[assembly: AssemblyFileVersion("1.4.1.0")]

0 comments on commit df8cb93

Please sign in to comment.