ReSharper: remove redundant code

This commit is contained in:
bao-qian
2016-01-06 21:34:42 +00:00
parent ae42c4df16
commit 0daa3a8f57
65 changed files with 279 additions and 250 deletions

View File

@@ -9,7 +9,7 @@ namespace Wox.Core.Updater
public int MINOR { get; set; }
public int PATCH { get; set; }
public SemanticVersion(System.Version version)
public SemanticVersion(Version version)
{
MAJOR = version.Major;
MINOR = version.Minor;

View File

@@ -92,7 +92,7 @@ namespace Wox.Core.Updater
StartUpdate();
}
}
catch (System.Exception e)
catch (Exception e)
{
Log.Error(e);
}
@@ -112,7 +112,7 @@ namespace Wox.Core.Updater
{
((UpdateProcessAsyncResult)asyncResult).EndInvoke();
}
catch (System.Exception e)
catch (Exception e)
{
Log.Error(e);
updManager.CleanUp();
@@ -148,7 +148,7 @@ namespace Wox.Core.Updater
{
UpdateManager.Instance.ApplyUpdates(true, UserSettingStorage.Instance.EnableUpdateLog, false);
}
catch (System.Exception e)
catch (Exception e)
{
string updateError = InternationalizationManager.Instance.GetTranslation("update_wox_update_error");
Log.Error(e);

View File

@@ -15,30 +15,30 @@ namespace Wox.Core.Updater
public WoxUpdateSource(string feedUrl,IWebProxy proxy)
{
this.FeedUrl = feedUrl;
this.Proxy = proxy;
FeedUrl = feedUrl;
Proxy = proxy;
}
private void TryResolvingHost()
{
Uri uri = new Uri(this.FeedUrl);
Uri uri = new Uri(FeedUrl);
try
{
Dns.GetHostEntry(uri.Host);
}
catch (System.Exception ex)
catch (Exception ex)
{
throw new WebException(string.Format("Failed to resolve {0}. Check your connectivity.", (object)uri.Host), WebExceptionStatus.ConnectFailure);
throw new WebException(string.Format("Failed to resolve {0}. Check your connectivity.", uri.Host), WebExceptionStatus.ConnectFailure);
}
}
public string GetUpdatesFeed()
{
this.TryResolvingHost();
TryResolvingHost();
string str = string.Empty;
WebRequest webRequest = WebRequest.Create(this.FeedUrl);
WebRequest webRequest = WebRequest.Create(FeedUrl);
webRequest.Method = "GET";
webRequest.Proxy = this.Proxy;
webRequest.Proxy = Proxy;
using (WebResponse response = webRequest.GetResponse())
{
Stream responseStream = response.GetResponseStream();
@@ -56,7 +56,7 @@ namespace Wox.Core.Updater
if (!string.IsNullOrEmpty(baseUrl) && !baseUrl.EndsWith("/"))
baseUrl += "/";
FileDownloader fileDownloader = !Uri.IsWellFormedUriString(url, UriKind.Absolute) ? (!Uri.IsWellFormedUriString(baseUrl, UriKind.Absolute) ? (string.IsNullOrEmpty(baseUrl) ? new FileDownloader(url) : new FileDownloader(new Uri(new Uri(baseUrl), url))) : new FileDownloader(new Uri(new Uri(baseUrl, UriKind.Absolute), url))) : new FileDownloader(url);
fileDownloader.Proxy = this.Proxy;
fileDownloader.Proxy = Proxy;
if (string.IsNullOrEmpty(tempLocation) || !Directory.Exists(Path.GetDirectoryName(tempLocation)))
tempLocation = Path.GetTempFileName();
return fileDownloader.DownloadToFile(tempLocation, onProgress);