add command-line options support
new command-line option "--bank <filename>" can be specified to be used instead of the game config option
This commit is contained in:
parent
44700b1ece
commit
e35b8520b4
@ -1,7 +1,22 @@
|
|||||||
namespace Game {
|
namespace Game {
|
||||||
public struct CommandLineOptions {
|
public struct CommandLineOptions {
|
||||||
|
public string? databaseFilename = null;
|
||||||
|
public CommandLineOptions() {
|
||||||
|
|
||||||
|
}
|
||||||
public static CommandLineOptions Parse(string[] args) {
|
public static CommandLineOptions Parse(string[] args) {
|
||||||
return new CommandLineOptions();
|
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 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,7 +29,7 @@ namespace Game {
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
string databaseFileName = gameConfig.databasePath;
|
string databaseFileName = opts.databaseFilename ?? gameConfig.databasePath;
|
||||||
|
|
||||||
display.ResetWindow();
|
display.ResetWindow();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user