bonuska1/App/Program.cs
Slavasil e35b8520b4 add command-line options support
new command-line option "--bank <filename>" can be specified to be used instead of the game config option
2025-03-23 22:01:59 +03:00

39 lines
1.2 KiB
C#

using Game.Data;
using Game.UI;
namespace Game {
internal class Program {
static int Main(string[] args) {
CommandLineOptions opts = CommandLineOptions.Parse(args);
TextDisplay display = new TextDisplay();
if (!display.InitWindow()) {
return 1;
}
display.PrintSimpleWelcome();
Thread.Sleep(1200);
display.ShowSplash();
Thread.Sleep(2500);
GameConfig gameConfig;
try {
GameConfig? existingGameConfig = GameFiles.ReadGameConfig();
if (existingGameConfig == null) {
gameConfig = GameFiles.CreateDefaultGameConfig();
} else {
gameConfig = existingGameConfig;
}
} catch {
display.ShowFatalError("Произошла неизвестная ошибка при чтении/создании файла настроек");
Console.ReadKey();
return 2;
}
string databaseFileName = opts.databaseFilename ?? gameConfig.databasePath;
display.ResetWindow();
return 0;
}
}
}