-
Notifications
You must be signed in to change notification settings - Fork 21
/
BaseExtension.txt
63 lines (57 loc) · 2.56 KB
/
BaseExtension.txt
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using ModBot;
using System;
using System.ComponentModel.Composition;
using System.Net;
namespace NAMESPACE
{
[Export(typeof(IExtension))]
public class EXTENSION : IExtension
{
private string LatestVersion;
public void Load()
{
}
public string Name { get { return "Extension Name"; } }
public string FileName { get { return "NAMESPACE.dll"; } }
public string Author { get { return "Author Name"; } }
public string UniqueID { get { return "NAMESPACE"; } }
public string ContactInfo { get { return "EMAIL"; } }
public string Version { get { return "0.0.1"; } }
public int ApiVersion { get { return 0; } }
public int LoadPriority { get { return 0; } }
public bool UpdateCheck()
{
using (WebClient w = new WebClient())
{
w.Proxy = null;
try
{
LatestVersion = w.DownloadString("https://dl.dropboxusercontent.com/u/60356733/ModBot/Extensions/Extensions.txt");
if (LatestVersion != "")
{
foreach (string Extension in LatestVersion.Split(Environment.NewLine.ToCharArray()))
{
string[] data = Extension.Split(';');
if (data.Length > 6)
{
if (data[3] == UniqueID)
{
LatestVersion = data[5];
string[] Latest = LatestVersion.Split('.'), Current = Version.Split('.');
int LatestMajor = int.Parse(Latest[0]), LatestMinor = int.Parse(Latest[1]), LatestBuild = int.Parse(Latest[2]);
int CurrentMajor = int.Parse(Current[0]), CurrentMinor = int.Parse(Current[1]), CurrentBuild = int.Parse(Current[2]);
return (LatestMajor > CurrentMajor || LatestMajor == CurrentMajor && LatestMinor > CurrentMinor || LatestMajor == CurrentMajor && LatestMinor == CurrentMinor && LatestBuild > CurrentBuild);
}
}
}
}
}
catch
{
}
}
return false;
}
public string UpdateURL { get { return "https://dl.dropboxusercontent.com/u/60356733/ModBot/Extensions/" + UniqueID + "/" + LatestVersion + "/" + FileName; } }
}
}