forked from zekro-archive/meautosd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcUpdate.cs
42 lines (39 loc) · 1.04 KB
/
cUpdate.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using meautosd.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using static meautosd.cConst;
namespace meautosd
{
class cUpdate
{
public static string getOnelineFile(string URL)
{
WebClient client = new WebClient();
Stream stream = client.OpenRead(URL);
StreamReader reader = new StreamReader(stream);
return reader.ReadToEnd();
}
public static bool getUpdateStatus(string clientVersion, string latestVersion)
{
if (clientVersion == latestVersion)
return false;
else
return true;
}
public static void update()
{
if (getUpdateStatus(VERSION, getOnelineFile(versionFileURL)))
{
Form fUpdate = new fUpdate();
fUpdate.ShowDialog();
}
}
}
}