Skip to content

Commit

Permalink
added try/catch on OTA update
Browse files Browse the repository at this point in the history
  • Loading branch information
sensboston committed Jul 9, 2015
1 parent a27a555 commit 7c2e6bb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions WPTweaker/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,20 @@ private async void CheckTweakListUpdate()
{
var req = HttpWebRequest.Create(_tweakListUri);
req.Method = "HEAD";
WebResponse resp = await req.GetResponseAsync();
// 196 bytes difference it's a headers size. Let's add a few more bytes for CR/LF, tabs etc. (non-significant changes)
if (resp.ContentLength > 0 && Math.Abs(resp.ContentLength - _settings.XmlTweaks.Length) > 210)
try
{
if (MessageBox.Show("Would you like to download new list?", "Tweak list update found", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
WebResponse resp = await req.GetResponseAsync();
// 196 bytes difference it's a headers size. Let's add a few more bytes for CR/LF, tabs etc. (non-significant changes)
if (resp.ContentLength > 0 && Math.Abs(resp.ContentLength - _settings.XmlTweaks.Length) > 210)
{
SyncButton_Click(this, null);
if (MessageBox.Show("Would you like to download new list?", "Tweak list update found", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
SyncButton_Click(this, null);
}
}
}
// Lets be silent in case of exception...
catch { }
}

/// <summary>
Expand Down

0 comments on commit 7c2e6bb

Please sign in to comment.