new command-line option "--bank <filename>" can be specified to be used instead of the game config option
22 lines
797 B
C#
22 lines
797 B
C#
namespace Game {
|
|
public struct CommandLineOptions {
|
|
public string? databaseFilename = null;
|
|
public CommandLineOptions() {
|
|
|
|
}
|
|
public static CommandLineOptions Parse(string[] args) {
|
|
string? databaseFilename = null;
|
|
for (int i = 0; i < args.Length; ++i) {
|
|
string arg = args[i];
|
|
if (arg.StartsWith("--bank")) {
|
|
if (arg.Length > 6 && arg[6] == '=') {
|
|
databaseFilename = arg.Substring(7);
|
|
} else if (args.Length > i + 1) {
|
|
databaseFilename = args[i + 1];
|
|
}
|
|
}
|
|
}
|
|
return new CommandLineOptions() { databaseFilename = databaseFilename };
|
|
}
|
|
}
|
|
} |