diff --git a/src/Tgstation.Server.Host/Components/ByondManager.cs b/src/Tgstation.Server.Host/Components/ByondManager.cs
index 1c00689b34..9613157065 100644
--- a/src/Tgstation.Server.Host/Components/ByondManager.cs
+++ b/src/Tgstation.Server.Host/Components/ByondManager.cs
@@ -8,6 +8,8 @@ using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Host.IO;
+using MemoryStream = System.IO.MemoryStream;
+
namespace Tgstation.Server.Host.Components
{
///
@@ -83,7 +85,7 @@ namespace Tgstation.Server.Host.Components
await ioManager.CreateDirectory(versionKey, cancellationToken).ConfigureAwait(false);
var resolvedPath = ioManager.ResolvePath(versionKey);
- using (var zipBytes = await downloadTask.ConfigureAwait(false))
+ using (var zipBytes = new MemoryStream(await downloadTask.ConfigureAwait(false)))
using (var archive = new ZipArchive(zipBytes))
await Task.Factory.StartNew(() => archive.ExtractToDirectory(resolvedPath), cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current).ConfigureAwait(false);
diff --git a/src/Tgstation.Server.Host/Components/IByondInstaller.cs b/src/Tgstation.Server.Host/Components/IByondInstaller.cs
index 2779e19969..4b3b6996d3 100644
--- a/src/Tgstation.Server.Host/Components/IByondInstaller.cs
+++ b/src/Tgstation.Server.Host/Components/IByondInstaller.cs
@@ -2,8 +2,6 @@
using System.Threading;
using System.Threading.Tasks;
-using Stream = System.IO.Stream;
-
namespace Tgstation.Server.Host.Components
{
///
@@ -26,8 +24,8 @@ namespace Tgstation.Server.Host.Components
///
/// The of BYOND to download
/// The for the operation
- /// A resulting in a of the zipfile
- Task DownloadVersion(Version version, CancellationToken cancellationToken);
+ /// A resulting in the s of the zipfile
+ Task DownloadVersion(Version version, CancellationToken cancellationToken);
///
/// Does actions necessary to get an extracted BYOND installation working
diff --git a/src/Tgstation.Server.Host/Components/WindowsByondInstaller.cs b/src/Tgstation.Server.Host/Components/WindowsByondInstaller.cs
new file mode 100644
index 0000000000..de1637fd34
--- /dev/null
+++ b/src/Tgstation.Server.Host/Components/WindowsByondInstaller.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Tgstation.Server.Host.IO;
+
+namespace Tgstation.Server.Host.Components
+{
+ ///
+ /// for windows systems
+ ///
+ sealed class WindowsByondInstaller : IByondInstaller
+ {
+ ///
+ /// The URL format string for getting BYOND windows version {0}.{1} zipfile
+ ///
+ const string ByondRevisionsURL = "https://secure.byond.com/download/build/{0}/{0}.{1}_byond.zip";
+
+ ///
+ public string DreamDaemonName => "dreamdaemon.exe";
+
+ ///
+ public string DreamMakerName => "dm.exe";
+
+ ///
+ /// The for the
+ ///
+ readonly IIOManager ioManager;
+
+ public Task CleanCache(CancellationToken cancellationToken) => ioManager.DeleteDirectory(ioManager.ConcatPath(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "byond/cache"), cancellationToken);
+
+ public Task DownloadVersion(Version version, CancellationToken cancellationToken)
+ {
+ var url = String.Format(CultureInfo.InvariantCulture, ByondRevisionsURL, version.Major, version.Major);
+
+ return ioManager.DownloadFile(new Uri(url), cancellationToken);
+ }
+
+ public Task InstallByond(string path, CancellationToken cancellationToken)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Tgstation.Server.Host/IO/DefaultIOManager.cs b/src/Tgstation.Server.Host/IO/DefaultIOManager.cs
index 5a4bb9654f..793b5881e2 100644
--- a/src/Tgstation.Server.Host/IO/DefaultIOManager.cs
+++ b/src/Tgstation.Server.Host/IO/DefaultIOManager.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -243,5 +244,13 @@ namespace Tgstation.Server.Host.IO
link = ResolvePath(link);
}, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current);
+
+ ///
+ public async Task DownloadFile(Uri url, CancellationToken cancellationToken)
+ {
+ using (var wc = new WebClient())
+ using (cancellationToken.Register(() => wc.CancelAsync()))
+ return await wc.DownloadDataTaskAsync(url).ConfigureAwait(false);
+ }
}
}
diff --git a/src/Tgstation.Server.Host/IO/IIOManager.cs b/src/Tgstation.Server.Host/IO/IIOManager.cs
index e5b6cdefde..ad320805d3 100644
--- a/src/Tgstation.Server.Host/IO/IIOManager.cs
+++ b/src/Tgstation.Server.Host/IO/IIOManager.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -153,5 +154,13 @@ namespace Tgstation.Server.Host.IO
/// A for the operation
/// A representing the running operation
Task MoveFile(string source, string destination, CancellationToken cancellationToken);
+
+ ///
+ /// Downloads a file from
+ ///
+ /// The URL to download
+ /// A for the operation
+ /// A resulting in the s of the downloaded file
+ Task DownloadFile(Uri url, CancellationToken cancellationToken);
}
}