diff --git a/H1emu/MainWindow.xaml b/H1emu/MainWindow.xaml index 7c40c36..c4b958b 100644 --- a/H1emu/MainWindow.xaml +++ b/H1emu/MainWindow.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:H1Z1_server" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - Title="H1emu v1.2.3" + Title="H1emu v1.3.0" Width="800" Height="550" Icon="img/EmuIco_By_ZamZam.ico" @@ -70,19 +70,15 @@ + FontSize="18" Content="Install Servers (stable)"/> + FontSize="18" Content="Install Servers (latest)"/> diff --git a/H1emu/MainWindow.xaml.cs b/H1emu/MainWindow.xaml.cs index b6880f0..6173530 100644 --- a/H1emu/MainWindow.xaml.cs +++ b/H1emu/MainWindow.xaml.cs @@ -10,23 +10,31 @@ namespace H1Z1_server /// public partial class MainWindow { + ProcessStartInfo cmdShell; + ProcessStartInfo powershellShell; public MainWindow() { InitializeComponent(); + this.cmdShell = new ProcessStartInfo(); + cmdShell.FileName = "cmd.exe"; + cmdShell.RedirectStandardInput = true; + cmdShell.UseShellExecute = false; + + this.powershellShell = new ProcessStartInfo(); + powershellShell.FileName = "powershell.exe"; + powershellShell.RedirectStandardInput = true; + powershellShell.UseShellExecute = false; } + private string ServerFilesPath = "./H1emuServersFiles/h1z1-server-QuickStart-master"; private string ServerFilesRepo = "https://github.com/H1emu/h1z1-server-QuickStart/archive/master.zip"; private void LaunchServer_OnClick(object sender, RoutedEventArgs e) { Process p = new Process(); - ProcessStartInfo info = new ProcessStartInfo(); - info.FileName = "cmd.exe"; - info.RedirectStandardInput = true; - info.UseShellExecute = false; - p.StartInfo = info; + p.StartInfo = cmdShell; p.Start(); using (StreamWriter sw = p.StandardInput) @@ -42,12 +50,8 @@ private void LaunchServer_OnClick(object sender, RoutedEventArgs e) private void InstallNodejs_OnClick(object sender, RoutedEventArgs e) { Process p = new Process(); - ProcessStartInfo info = new ProcessStartInfo(); - info.FileName = "cmd.exe"; - info.RedirectStandardInput = true; - info.UseShellExecute = false; - p.StartInfo = info; + p.StartInfo = cmdShell; p.Start(); using (StreamWriter sw = p.StandardInput) @@ -64,12 +68,8 @@ private void InstallNodejs_OnClick(object sender, RoutedEventArgs e) private void ApplyPatch_OnClick(object sender, RoutedEventArgs e) { Process p = new Process(); - ProcessStartInfo info = new ProcessStartInfo(); - info.FileName = "cmd.exe"; - info.RedirectStandardInput = true; - info.UseShellExecute = false; - p.StartInfo = info; + p.StartInfo = cmdShell; p.Start(); using (StreamWriter sw = p.StandardInput) @@ -89,12 +89,8 @@ private void ApplyPatch_OnClick(object sender, RoutedEventArgs e) private void LaunchH1Z1_OnClick(object sender, RoutedEventArgs e) { Process p = new Process(); - ProcessStartInfo info = new ProcessStartInfo(); - info.FileName = "cmd.exe"; - info.RedirectStandardInput = true; - info.UseShellExecute = false; - p.StartInfo = info; + p.StartInfo = cmdShell; p.Start(); using (StreamWriter sw = p.StandardInput) @@ -106,15 +102,13 @@ private void LaunchH1Z1_OnClick(object sender, RoutedEventArgs e) } } - private void UpdtServer_OnClick(object sender, RoutedEventArgs e) + private void InstallLatest_OnClick(object sender, RoutedEventArgs e) { + InstallServer(); + Process p = new Process(); - ProcessStartInfo info = new ProcessStartInfo(); - info.FileName = "cmd.exe"; - info.RedirectStandardInput = true; - info.UseShellExecute = false; - p.StartInfo = info; + p.StartInfo = cmdShell; p.Start(); using (StreamWriter sw = p.StandardInput) @@ -122,25 +116,14 @@ private void UpdtServer_OnClick(object sender, RoutedEventArgs e) if (sw.BaseStream.CanWrite) { sw.WriteLine("cd " + ServerFilesPath); - sw.WriteLine("npm update"); + sw.WriteLine("npm i h1z1-server@latest"); } } } - private void InstallServer_OnClick(object sender, RoutedEventArgs e) + private void InstallServer() { Process p1 = new Process(); - Process p2 = new Process(); - - ProcessStartInfo cmdShell = new ProcessStartInfo(); - cmdShell.FileName = "cmd.exe"; - cmdShell.RedirectStandardInput = true; - cmdShell.UseShellExecute = false; - - ProcessStartInfo powershellShell = new ProcessStartInfo(); - powershellShell.FileName = "powershell.exe"; - powershellShell.RedirectStandardInput = true; - powershellShell.UseShellExecute = false; p1.StartInfo = cmdShell; p1.Start(); @@ -157,6 +140,9 @@ private void InstallServer_OnClick(object sender, RoutedEventArgs e) } } p1.WaitForExit(); + + Process p2 = new Process(); + p2.StartInfo = powershellShell; p2.Start(); @@ -168,7 +154,15 @@ private void InstallServer_OnClick(object sender, RoutedEventArgs e) } } p2.WaitForExit(); + } + private void InstallStable_OnClick(object sender, RoutedEventArgs e) + { + + InstallServer(); + Process p1 = new Process(); + + p1.StartInfo = cmdShell; p1.Start(); using (StreamWriter sw = p1.StandardInput) diff --git a/H1emu/Properties/AssemblyInfo.cs b/H1emu/Properties/AssemblyInfo.cs index 479c0df..a58a9c9 100644 --- a/H1emu/Properties/AssemblyInfo.cs +++ b/H1emu/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.3.0")] -[assembly: AssemblyFileVersion("1.2.3.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.3.0.0")] +[assembly: AssemblyFileVersion("1.3.0.0")] \ No newline at end of file