Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Commit

Permalink
Resolve #2 - Update compatibility (#3)
Browse files Browse the repository at this point in the history
* Compatibility with current GameServer
* Added Browse button.
* Added Abort functionality
  • Loading branch information
bp-remit authored and danil179 committed May 22, 2019
1 parent 21e8efe commit da80da7
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 12 deletions.
32 changes: 29 additions & 3 deletions League Sandbox Auto Setup/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 53 additions & 9 deletions League Sandbox Auto Setup/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace League_Sandbox_Auto_Setup
public partial class leagueSandboxAutoSetupForm : Form
{
static string Client_Folder_Name = "League_Sandbox_Client";
private bool _abortInitiated;
private bool _setupStarted;
public leagueSandboxAutoSetupForm()
{
InitializeComponent();
Expand All @@ -27,13 +29,32 @@ public leagueSandboxAutoSetupForm()
Environment.Exit(0);
};
}
private void OnAbortSuccessfully()
{
_setupStarted = false;
_abortInitiated = false;
startButton.Enabled = true;
abortText.Visible = false;
}

private void startButton_Click(object sender, EventArgs e)
{
installDirectoryText.Enabled = false;
startButton.Enabled = false;
Directory.CreateDirectory(installDirectoryText.Text);
startCloningRepositories();
if (!_setupStarted)
{
installDirectoryText.Enabled = false;
browseButton.Enabled = false;
startButton.Text = "Abort";
Directory.CreateDirectory(installDirectoryText.Text);
startCloningRepositories();
_setupStarted = true;
}
else
{
_abortInitiated = true;
abortText.Visible = true;
startButton.Text = "Start";
startButton.Enabled = false;
}
}

private void startCloningRepositories()
Expand Down Expand Up @@ -113,6 +134,12 @@ private void startCloningRepositories()

private void startDownloadingClient()
{
if (_abortInitiated)
{
OnAbortSuccessfully();
return;
}

downloadingProgressLabel.Text = "--";

ProtocolProviderFactory.RegisterProtocolHandler("http", typeof(HttpProtocolProvider));
Expand Down Expand Up @@ -199,6 +226,12 @@ private void startUnzippingClient()
}
private void startSettingUpTestbox()
{
if (_abortInitiated)
{
OnAbortSuccessfully();
return;
}

String testboxLink = "http://gamemakersgarage.com/LeagueUI.7z";
String testboxLocation = Path.GetFullPath(Path.Combine(installDirectoryText.Text, "LeagueUI.7z"));
if (File.Exists(testboxLocation))
Expand Down Expand Up @@ -262,11 +295,11 @@ private void startVisualStudioFirstRun()

//Set up GameServer configs
var gameServerFolder = Path.Combine(installDirectoryText.Text, "GameServer");
var templatePath = Path.Combine(gameServerFolder, "GameServerApp\\Settings\\GameServerSettings.json.template");
var newPath = Path.Combine(gameServerFolder, "GameServerApp\\Settings\\GameServerSettings.json");
var templatePath = Path.Combine(gameServerFolder, "GameServerConsole\\Settings\\GameServerSettings.json.template");
var newPath = Path.Combine(gameServerFolder, "GameServerConsole\\Settings\\GameServerSettings.json");
var templateString = File.ReadAllText(templatePath);
var configTemplatePath = Path.Combine(gameServerFolder, "GameServerApp\\Settings\\GameInfo.json.template");
var configNewPath = Path.Combine(gameServerFolder, "GameServerApp\\Settings\\GameInfo.json");
var configTemplatePath = Path.Combine(gameServerFolder, "GameServerConsole\\Settings\\GameInfo.json.template");
var configNewPath = Path.Combine(gameServerFolder, "GameServerConsole\\Settings\\GameInfo.json");
if (File.Exists(newPath))
{
File.Delete(newPath);
Expand Down Expand Up @@ -340,5 +373,16 @@ private void startVisualStudioFirstRun()
}
});
}

private void BrowseButton_Click(object sender, EventArgs e)
{
using (var selectPath = new FolderBrowserDialog())
{
var result = selectPath.ShowDialog();

if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(selectPath.SelectedPath))
installDirectoryText.Text = selectPath.SelectedPath;
}
}
}
}
}

0 comments on commit da80da7

Please sign in to comment.