diff options
| author | Adrian Ulbrich <adrian.ulbrich.2003@gmail.com> | 2019-11-10 04:38:54 +0100 |
|---|---|---|
| committer | Adrian Ulbrich <adrian.ulbrich.2003@gmail.com> | 2019-11-10 04:38:54 +0100 |
| commit | 52a942a38066557250f9a0bedbd820f1e004bcea (patch) | |
| tree | b1e6477eb100ca3cd156db099dccab5229305cf1 /Unicity.DevLauncher/Program.cs | |
| parent | cc845ca858be069ea6349e2da0c28ff891abd1a7 (diff) | |
| download | Unicity-52a942a38066557250f9a0bedbd820f1e004bcea.tar.gz Unicity-52a942a38066557250f9a0bedbd820f1e004bcea.tar.bz2 Unicity-52a942a38066557250f9a0bedbd820f1e004bcea.zip | |
Added launcher
Diffstat (limited to 'Unicity.DevLauncher/Program.cs')
| -rw-r--r-- | Unicity.DevLauncher/Program.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Unicity.DevLauncher/Program.cs b/Unicity.DevLauncher/Program.cs new file mode 100644 index 0000000..41f6924 --- /dev/null +++ b/Unicity.DevLauncher/Program.cs @@ -0,0 +1,37 @@ +using System; +using System.IO; +using System.IO.Compression; +using System.Net; +using System.Reflection; + +namespace Unicity.DevLauncher +{ + class Program + { + const string devUrl = "https://dl.dropboxusercontent.com/s/2rfo1tycz73rr5s/dev.zip"; + static string tempDir = Path.GetTempPath() + "unicity"; + + static void Main(string[] args) + { + if (Directory.Exists(tempDir)) + { + Directory.Delete(tempDir, true); + } + Directory.CreateDirectory(tempDir); + + using (WebClient client = new WebClient()) + { + System.Console.WriteLine("Downloading latest build..."); + client.DownloadFile(devUrl, tempDir + "/game.zip"); + Console.WriteLine("Extracting files..."); + ZipFile.ExtractToDirectory(tempDir + "/game.zip", tempDir + "/game"); + + Console.WriteLine("Launching game..."); + Assembly assembly = Assembly.LoadFrom(Path.GetFullPath(tempDir + "/game/dotnet-framework-all/Unicity.Game.exe")); + Type program = assembly.GetType("Unicity.Game.Program"); + MethodInfo main = program.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static); + main.Invoke(null, new object[] { args }); + } + } + } +} |
