Skip to content
Permalink
Browse files

using Self.mainserver instead of hardcoded URLs

  • Loading branch information...
metonator committed Feb 15, 2019
1 parent b1c5e65 commit fdd41ad55dd5742afbbf6cf0a9eab90b4ca9e507
Showing with 17 additions and 24 deletions.
  1. +8 −11 GameLauncher/App/MainScreen.cs
  2. +8 −12 GameLauncher/Program.cs
  3. +1 −1 GameLauncher/Properties/AssemblyInfo.cs
@@ -463,18 +463,15 @@ private void moveWindow_MouseMove(object sender, MouseEventArgs e)
Log.Debug("Entering mainScreen_Load");

//INFO: this is here because this dll is necessary for downloading game files and I want to make it async.
if (!File.Exists("LZMA.dll"))
{
if (!File.Exists("LZMA.dll")) {
Log.Debug("Starting LZMA downloader");
playProgressText.Text = "Downloading LZMA.dll...";
using (WebClient wc = new WebClient())
{
wc.DownloadFileAsync(
// Param1 = Link of file
new Uri("http://launcher.worldunited.gg/files/LZMA.dll"),
// Param2 = Path to save
"LZMA.dll"
);
try {
playProgressText.Text = "Downloading LZMA.dll...";
using (WebClient wc = new WebClient()) {
wc.DownloadFileAsync(new Uri(Self.mainserver + "/files/LZMA.dll"), "LZMA.dll");
}
} catch (Exception ex) {
Log.Debug("Failed to download LZMA. " + ex.Message);
}
}

@@ -39,18 +39,14 @@ internal static class Program {
}

if(!File.Exists("GameLauncherUpdater.exe")) {
try {
//Better update async
WebClientWithTimeout UpdaterExecutable = new WebClientWithTimeout();
UpdaterExecutable.DownloadDataAsync(new Uri(Self.mainserver + "/files/GameLauncherUpdater.exe"));
UpdaterExecutable.DownloadDataCompleted += (sender, e) => {
try {
if (!e.Cancelled && e.Error == null) {
File.WriteAllBytes("GameLauncherUpdater.exe", e.Result);
}
} catch { /* ignored */ }
};
} catch { /* ignored */ }
Log.Debug("Starting GameLauncherUpdater downloader");
try {
using (WebClientWithTimeout wc = new WebClientWithTimeout()) {
wc.DownloadFileAsync(new Uri(Self.mainserver + "/files/GameLauncherUpdater.exe"), "GameLauncherUpdater.exe");
}
} catch(Exception ex) {
Log.Debug("Failed to download updater. " + ex.Message);
}
}

if (!File.Exists("servers.json")) {
@@ -8,7 +8,7 @@
[assembly: AssemblyTitle("GameLauncher")]
[assembly: AssemblyDescription("GameLauncher for Need For Speed(TM): World")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MTNTR")]
[assembly: AssemblyCompany("WorldUnited.gg")]
[assembly: AssemblyProduct("GameLauncher")]
[assembly: AssemblyCopyright("WorldUnited")]
[assembly: AssemblyTrademark("")]

0 comments on commit fdd41ad

Please sign in to comment.
You can’t perform that action at this time.