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

Commit

Permalink
Updated StartServerScript with updated arguments and warnings. Fixed …
Browse files Browse the repository at this point in the history
…some warnings/messages in IDE.
  • Loading branch information
n0tic committed Oct 16, 2022
1 parent a78bdab commit c13220a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
18 changes: 9 additions & 9 deletions SteamServerCreationTool/Data/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Settings
public string GetLogin()
{
if (!useUserData) return "anonymous";
else if (useUserData && !userData.IsEmpty()) return userData.username + " " + userData.GetPassword();
else if (useUserData && !userData.IsEmpty()) return userData.Username + " " + userData.GetPassword();
else return null;
}
}
Expand All @@ -52,30 +52,30 @@ public InstalledServer(string name, string installPath, App app)
[Serializable]
public class UserData
{
public string username { get; private set; }
public string password { get; private set; }
public string Username { get; private set; }
public string Password { get; private set; }

public UserData()
{
this.username = null;
this.password = null;
this.Username = null;
this.Password = null;
}

public bool IsEmpty()
{
if (string.IsNullOrWhiteSpace(this.username) || this.password == null || this.password.Length < 1) return true;
if (string.IsNullOrWhiteSpace(this.Username) || this.Password == null || this.Password.Length < 1) return true;
else return false;
}

public void SetUsername(string name) => this.username = name;
public void SetUsername(string name) => this.Username = name;

public void SetPassword(string pass) => this.password = Core.Base64Encode(pass);
public void SetPassword(string pass) => this.Password = Core.Base64Encode(pass);

public string GetPassword()
{
try
{
return Core.Base64Decode(this.password);
return Core.Base64Decode(this.Password);
}
catch { return null; }
}
Expand Down
4 changes: 2 additions & 2 deletions SteamServerCreationTool/Forms/CreateServerForm.Designer.cs

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

11 changes: 7 additions & 4 deletions SteamServerCreationTool/Forms/CreateServerForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using SteamServerCreationTool.Data;
#pragma warning disable IDE0044

using SteamServerCreationTool.Data;
using System;
using System.ComponentModel;
using System.Diagnostics;
Expand Down Expand Up @@ -31,7 +33,7 @@ private void CreateServerForm_Load(object sender, EventArgs e)
}
}

private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
private void LinkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (app != null)
{
Expand All @@ -41,7 +43,7 @@ private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
}
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => Process.Start("https://steamcommunity.com/dev/managegameservers?l=english");
private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => Process.Start("https://steamcommunity.com/dev/managegameservers?l=english");

private void InstallDirButton_Click(object sender, EventArgs e)
{
Expand Down Expand Up @@ -107,7 +109,7 @@ private void CancelButton_Click(object sender, EventArgs e)
Close();
}

private void StartSteamCMDServerDownload(Data.App app, bool skip = false)
private void StartSteamCMDServerDownload(Data.App app)
{
//Keep track of success
bool install = true;
Expand Down Expand Up @@ -169,6 +171,7 @@ private void StartSteamCMDServerDownload(Data.App app, bool skip = false)
startScript = startScript.Replace("{server_dir}", installDir);
startScript = startScript.Replace("{app_id}", appID);
startScript = startScript.Replace("{app_name}", app.Name);
startScript = startScript.Replace("{login_cred}", main.settings.GetLogin());

Core.SaveToFile(installDir + @"\StartServerScript.bat", startScript);

Expand Down
1 change: 1 addition & 0 deletions SteamServerCreationTool/Forms/ManageInstallsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ private void GenerateScriptButton_Click(object sender, EventArgs e)
startScript = startScript.Replace("{server_dir}", app.installPath);
startScript = startScript.Replace("{app_id}", app.app.Appid.ToString());
startScript = startScript.Replace("{app_name}", app.app.Name);
startScript = startScript.Replace("{login_cred}", main.settings.GetLogin());

Core.SaveToFile(app.installPath + @"\StartServerScript.bat", startScript);
}
Expand Down
2 changes: 1 addition & 1 deletion SteamServerCreationTool/Forms/SettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public SettingsForm(MainForm main)

private void CreateServerForm_Load(object sender, EventArgs e)
{
username_inputbox.Text = main.settings.userData.username;
username_inputbox.Text = main.settings.userData.Username;

string pass = main.settings.userData.GetPassword();
if (pass != null) password_inputbox.Text = pass;
Expand Down
7 changes: 4 additions & 3 deletions SteamServerCreationTool/Resources/StartServerScript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
::
:: You will need to edit the 3 lines below with valid information
:: Row: 19, 20, 21 (Bellow the lines beginning with "::")
::
:: !DO NOT ADD SPACES UNLESS THERE ARE SPACES IN THE ARGUMENT OR DIRECTORY PATH!
::
:: Examples:
:: SET serverExecutablePath=D:\Valheim Server
Expand Down Expand Up @@ -59,15 +61,14 @@ SET serverLaunchOptions=-Some -Launch Options
:: DO NOT EDIT BELOW THIS LINE; UNLESS YOU KNOW WHAT YOU ARE DOING
::================================================================


SET pathExist=%serverExecutablePath%\%serverExecutableFileName%

PUSHD {steamcmd_dir}
START /wait steamcmd +force_install_dir "{server_dir}" +login anonymous +app_update {app_id} validated +quit
START /wait steamcmd +force_install_dir "{server_dir}" +login "{login_cred}" +app_update {app_id} validated +quit
PUSHD {server_dir}
ECHO Protecting {app_name} from crashes...
ECHO To exit {app_name}, close this window first. It will restart otherwise.
TITLE {app_name}
TITLE "{app_name}"
IF EXIST "%pathExist%" GOTO server

CLS
Expand Down

0 comments on commit c13220a

Please sign in to comment.