Skip to content
This repository has been archived by the owner on Jul 12, 2021. It is now read-only.

Commit

Permalink
1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGruber committed Feb 11, 2021
1 parent a3f1a19 commit 6843573
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 50 deletions.
14 changes: 5 additions & 9 deletions H1emu/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -70,19 +70,15 @@
<Button
Margin="0,20,0,0"
Padding="5,10,5,10"
Click="InstallServer_OnClick"
Click="InstallStable_OnClick"
FontFamily="Unispace"
FontSize="18">
Install Servers files
</Button>
FontSize="18" Content="Install Servers (stable)"/>
<Button
Margin="0,20,0,0"
Padding="5,10,5,10"
Click="UpdtServer_OnClick"
Click="InstallLatest_OnClick"
FontFamily="Unispace"
FontSize="18">
Update Servers files
</Button>
FontSize="18" Content="Install Servers (latest)"/>
</StackPanel>


Expand Down
72 changes: 33 additions & 39 deletions H1emu/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,31 @@ namespace H1Z1_server
/// </summary>
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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -106,41 +102,28 @@ 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)
{
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();
Expand All @@ -157,6 +140,9 @@ private void InstallServer_OnClick(object sender, RoutedEventArgs e)
}
}
p1.WaitForExit();

Process p2 = new Process();

p2.StartInfo = powershellShell;
p2.Start();

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions H1emu/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]

0 comments on commit 6843573

Please sign in to comment.