Skip to content

Commit 372138c

Browse files
committed
build crypt as stdcall
update updater paths
1 parent 700d8ea commit 372138c

File tree

6 files changed

+38
-9
lines changed

6 files changed

+38
-9
lines changed

Crypt/Crypt.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ LIBRARY Crypt
22

33
EXPORTS
44
InstallLibrary
5-
Shutdown=?Shutdown@@YAX_N@Z
5+
Shutdown=?Shutdown@@YGX_N@Z
6+
;Shutdown=?Shutdown@@YAX_N@Z
67
FindUOWindow
78
GetSharedAddress
89
GetPacketLength

Crypt/Crypt.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ $(ProjectDir)GenerateRazorChecksumH.exe</Command>
109109
<WarningLevel>Level3</WarningLevel>
110110
<DebugInformationFormat>
111111
</DebugInformationFormat>
112+
<CallingConvention>StdCall</CallingConvention>
112113
</ClCompile>
113114
<Link>
114115
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>

Razor

Submodule Razor updated from 468d245 to e2637b3

Updater/Downloader.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ private void DownloadFile()
7373
try
7474
{
7575
wr = ( HttpWebRequest )WebRequest.Create( _MsgUrl );
76+
wr.UserAgent = "Razor Updater";
7677
wr.Timeout = 5000;
7778

7879
ws = ( HttpWebResponse )wr.GetResponse();
@@ -104,7 +105,8 @@ private void DownloadFile()
104105
try
105106
{
106107
wr = ( HttpWebRequest )WebRequest.Create( _Url );
107-
wr.Timeout = 10000;
108+
wr.UserAgent = "Razor Updater";
109+
wr.Timeout = 10000;
108110
ws = ( HttpWebResponse )wr.GetResponse();
109111
if( ws.StatusCode == HttpStatusCode.OK )
110112
{

Updater/Main.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ public class UpdaterMain
1919
private static UpdaterStatus _Status = UpdaterStatus.Incomplete;
2020
public static UpdaterStatus Status { get { return _Status; } set { _Status = value; } }
2121

22+
public static Version UpdateVersion { get; set; }
23+
2224
/// <summary>
2325
/// The main entry point for the application.
2426
/// </summary>
2527
[STAThread]
26-
static void Main()
28+
static void Main(string[] args)
2729
{
2830
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler( CurrentDomain_UnhandledException );
2931

@@ -42,7 +44,12 @@ static void Main()
4244
Thread.Sleep( 50 );
4345
}
4446

45-
Directory.SetCurrentDirectory( UpdaterMain.BaseDirectory );
47+
for (int i = 0; i < args.Length; i++) {
48+
if (!String.IsNullOrEmpty(args[i]))
49+
UpdateVersion = new Version(args[i]);
50+
}
51+
52+
Directory.SetCurrentDirectory(UpdaterMain.BaseDirectory);
4653

4754
Application.EnableVisualStyles();
4855
Application.Run( new Updater() );

Updater/Updater.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Windows.Forms;
66
using System.Data;
77
using System.IO;
8+
using System.Net;
89

910
namespace Updater
1011
{
@@ -118,8 +119,8 @@ private void InitializeComponent()
118119
}
119120
#endregion
120121

121-
private const string UpdateRAR = "https://zenvera.com/razor/Razor_Latest.rar";
122-
private const string ChangelogRAR = "https://zenvera.com/razor/changelog.txt";
122+
//private const string UpdateRAR = "https://zenvera.com/razor/Razor_Latest.rar";
123+
private const string ChangelogRAR = "http://razor.uo.cx/changelog.txt";
123124
private Downloader _Downloader;
124125

125126
private void Updater_Load(object sender, System.EventArgs e)
@@ -130,8 +131,25 @@ private void Updater_Load(object sender, System.EventArgs e)
130131
}
131132

132133
closeTimer.Stop();
133-
134-
_Downloader = new Downloader( UpdateRAR, "Update.rar",
134+
135+
if (UpdaterMain.UpdateVersion == null)
136+
{
137+
UpdateStatus("Checking latest version...");
138+
139+
try
140+
{
141+
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://razor.uo.cx/version.txt");
142+
req.UserAgent = "Razor Updater";
143+
144+
using (StreamReader reader = new StreamReader(req.GetResponse().GetResponseStream()))
145+
{
146+
UpdaterMain.UpdateVersion = new Version(reader.ReadToEnd().Trim());
147+
}
148+
}
149+
catch { UpdateFailed(); return; }
150+
}
151+
152+
_Downloader = new Downloader( String.Format("https://github.com/msturgill/razor/releases/download/v{0}/Update.rar", UpdaterMain.UpdateVersion.ToString()), "Update.rar",
135153
ChangelogRAR,
136154
new ProgressChange( OnProgressChange ), new ConnectionFailed( OnConnectionFailed ), new OperationComplete( OnDownloadComplete ),
137155
new MessageDownloaded( OnChangelogDownloaded ) );

0 commit comments

Comments
 (0)