Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion MinecraftBdsManager/Configuration/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ public static Settings CurrentSettings
return _instance;
}
}

///<summary>
/// The settings file that was loaded with this instance
///</summary>
public static String SettingsLocation { get; } = _settingsFilePath;

/// <summary>
/// Settings that govern if and how logs will be written to the file system.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions MinecraftBdsManager/Managers/BdsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ private set
public static DateTime? UserLastLoggedOffAt { get; private set; }

/// <summary>
/// Path to the world directory. This is null if the server has not been started.
/// Path to the world directory. This is an empty path if the server has never been started to avoid Path.combine errors on startup. (race condition)
/// </summary>
public static string? WorldDirectoryPath { get; private set; }
public static string? WorldDirectoryPath { get; private set; } = "";

/// <summary>
/// Determines if users have active on the server in the last time interval specified
Expand Down
2 changes: 1 addition & 1 deletion MinecraftBdsManager/Managers/ProcessManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static bool StartProcess(ProcessName processName, string executablePath,
return StartFireAndForgetProcess(executablePath, arguments);
}

Trace.TraceInformation($"Starting process {processName}.");
Trace.TraceInformation($"Starting process: {processName}, using {arguments}.");

// Check to see if we are already tracking this process...
if (TrackedProcesses.ContainsKey(processName) && processName != ProcessName.FireAndForget)
Expand Down
60 changes: 37 additions & 23 deletions MinecraftBdsManager/frmMain.Designer.cs

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

19 changes: 16 additions & 3 deletions MinecraftBdsManager/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ private async void btnIssueCommand_Click(object sender, EventArgs e)
{
return;
}

await BdsManager.SendCommandAsync(txtCustomCommand.Text, userSentCommand: true);
txtCustomCommand.Text = String.Empty;
if (BdsManager.ServerIsRunning)
{
await BdsManager.SendCommandAsync(txtCustomCommand.Text, userSentCommand: true);
txtCustomCommand.Text = String.Empty;
}
}

private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
Expand Down Expand Up @@ -142,5 +144,16 @@ private void toolBtnViewLog_Click(object sender, EventArgs e)

ProcessManager.StartProcess(ProcessName.FireAndForget, "explorer.exe", LogManager.CurrentLogFilePath);
}

private void toolBtnSettings_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(Settings.SettingsLocation))
{
LogManager.LogWarning($"An invalid Settings location has been specified {Settings.SettingsLocation}");
return;
}

ProcessManager.StartProcess(ProcessName.FireAndForget, "explorer.exe", Settings.SettingsLocation);
}
}
}