-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
77 additions
and
13 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,3 +1,6 @@ | ||
v1.0.3 | ||
- Add check update | ||
|
||
v1.0.2 | ||
- Add deployment | ||
- Fix bugs | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,55 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Web.Script.Serialization; | ||
using System.Windows.Forms; | ||
|
||
namespace SyncClipboard | ||
{ | ||
class UpdateChecker | ||
{ | ||
public const string Version = "1.0.2"; | ||
public const string Version = "1.0.3"; | ||
public const string UpdateUrl = "https://api.github.com/repos/Jeric-X/SyncClipboard/releases/latest"; | ||
public const string ReleaseUrl = "https://github.com/Jeric-X/SyncClipboard/releases/latest"; | ||
|
||
public bool Check() | ||
{ | ||
HttpWebResponse httpWebResponse = null; | ||
try | ||
{ | ||
httpWebResponse = HttpWebResponseUtility.CreateGetHttpResponse(UpdateUrl, Config.TimeOut, null, null, null); | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show(ex.Message.ToString()); | ||
return false; | ||
} | ||
StreamReader objStrmReader = new StreamReader(httpWebResponse.GetResponseStream()); | ||
String strReply = objStrmReader.ReadToEnd(); | ||
JavaScriptSerializer serializer = new JavaScriptSerializer(); | ||
UpdateConvertJson p1 = null; | ||
try | ||
{ | ||
p1 = serializer.Deserialize<UpdateConvertJson>(strReply); | ||
if (String.Compare(p1.name, "v" + Version) > 0) | ||
if (MessageBox.Show("v" + Version + " -> " + p1.name + "\n\n是否更新", "检测到新版本", MessageBoxButtons.OKCancel) == DialogResult.OK) | ||
System.Diagnostics.Process.Start(UpdateChecker.ReleaseUrl); | ||
} | ||
catch (Exception e) | ||
{ | ||
MessageBox.Show(e.Message.ToString()); | ||
} | ||
return false; | ||
} | ||
} | ||
class UpdateConvertJson | ||
{ | ||
public String name { get; set; } | ||
|
||
public String rowser_download_url { get; set; } | ||
} | ||
} |