controller: download new version number check to memory instead of a file
This commit is contained in:
parent
f5eba8cb3f
commit
d7e21127d7
|
@ -1071,32 +1071,23 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void CheckForNewVersion ()
|
public void CheckForNewVersion ()
|
||||||
{
|
{
|
||||||
string new_version_file_path = System.IO.Path.Combine (SparklePaths.SparkleTmpPath,
|
|
||||||
"version");
|
|
||||||
|
|
||||||
if (File.Exists (new_version_file_path))
|
|
||||||
File.Delete (new_version_file_path);
|
|
||||||
|
|
||||||
WebClient web_client = new WebClient ();
|
WebClient web_client = new WebClient ();
|
||||||
Uri uri = new Uri ("http://www.sparkleshare.org/version");
|
Uri uri = new Uri ("http://www.sparkleshare.org/version");
|
||||||
|
|
||||||
web_client.DownloadFileCompleted += delegate {
|
web_client.DownloadStringCompleted += delegate (object o, DownloadStringCompletedEventArgs args) {
|
||||||
|
string new_version = args.Result.Trim ();
|
||||||
|
|
||||||
if (new FileInfo (new_version_file_path).Length > 0) {
|
if (Defines.VERSION.Equals (new_version)) {
|
||||||
StreamReader reader = new StreamReader (new_version_file_path);
|
if (VersionUpToDate != null)
|
||||||
string downloaded_version_number = reader.ReadToEnd ().Trim ();
|
VersionUpToDate ();
|
||||||
|
|
||||||
if (Defines.VERSION.Equals (downloaded_version_number)) {
|
} else {
|
||||||
if (VersionUpToDate != null)
|
if (NewVersionAvailable != null)
|
||||||
VersionUpToDate ();
|
NewVersionAvailable (new_version);
|
||||||
} else {
|
|
||||||
if (NewVersionAvailable != null)
|
|
||||||
NewVersionAvailable (downloaded_version_number);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
web_client.DownloadFileAsync (uri, new_version_file_path);
|
web_client.DownloadStringAsync (uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue