Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GitHub to get latest version number. #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions Source/RatioMaster/VersionChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class VersionChecker
public const string LocalVersion = "0430";
public const string PublicVersion = "0.43";
public const string ReleaseDate = "08-01-2016";
private const string ProgramPageVersion = "http://ratiomaster.net/vc.php?v=";
private const string ProgramPageVersion = "https://github.com/NikolayIT/RatioMaster.NET/releases/latest";

private readonly string userAgent;

Expand Down Expand Up @@ -58,20 +58,16 @@ public bool CheckNewVersion()

public string GetServerVersionId()
{
var url = ProgramPageVersion + LocalVersion;
var url = ProgramPageVersion;
try
{
var request1 = (HttpWebRequest)WebRequest.Create(url);
request1.UserAgent = this.userAgent;
request1.Timeout = 2500;
using (var response1 = (HttpWebResponse)request1.GetResponse())
{
using (var reader1 = new StreamReader(response1.GetResponseStream()))
{
var data = reader1.ReadToEnd();
return data;
}
}
var response1 = request1.GetResponse();
var data = response1.ResponseUri.ToString();
data = data.Substring(data.Length - 4, 4);
return data;
}
catch (Exception exception1)
{
Expand Down