Commit 13140a0e authored by mercury233's avatar mercury233

change run behavior

parent d20052fd
{ {
"welcome": [ "welcome": [
"Hi, I'm Windbot." "Hi, I'm WindBot."
], ],
"deckerror": [ "deckerror": [
"Sorry, it seems that I have too much {0} in my deck." "Sorry, it seems that I have too much {0} in my deck."
......
...@@ -21,6 +21,8 @@ namespace WindBot ...@@ -21,6 +21,8 @@ namespace WindBot
internal static void Main(string[] args) internal static void Main(string[] args)
{ {
Logger.WriteLine("WindBot starting...");
InitDatas("cards.cdb"); InitDatas("cards.cdb");
int argc = args.Length; int argc = args.Length;
...@@ -48,6 +50,7 @@ namespace WindBot ...@@ -48,6 +50,7 @@ namespace WindBot
else if (argc == 5) else if (argc == 5)
{ {
RunFromArgs(args); RunFromArgs(args);
Logger.WriteLine("WindBot ended.");
} }
// Use environment variables to run Windbot // Use environment variables to run Windbot
...@@ -73,13 +76,17 @@ namespace WindBot ...@@ -73,13 +76,17 @@ namespace WindBot
else if (Environment.GetEnvironmentVariable("YGOPRO_NAME") != null) else if (Environment.GetEnvironmentVariable("YGOPRO_NAME") != null)
{ {
RunFromEnv(); RunFromEnv();
Logger.WriteLine("WindBot ended.");
} }
// Else, run from the default settings // Else, tell the user to run it correctly
else else
{ {
WindBotInfo Info = new WindBotInfo(); Logger.WriteLine("");
Run(Info); Logger.WriteLine("See the readme for how to run WindBot!");
Logger.WriteLine("Press any key to quit...");
Logger.WriteLine("");
Console.ReadKey();
} }
} }
...@@ -88,6 +95,8 @@ namespace WindBot ...@@ -88,6 +95,8 @@ namespace WindBot
Rand = new Random(); Rand = new Random();
DecksManager.Init(); DecksManager.Init();
string absolutePath = Path.GetFullPath(databasePath); string absolutePath = Path.GetFullPath(databasePath);
if (!File.Exists(absolutePath))
absolutePath = Path.GetFullPath("../" + databasePath);
NamedCardsManager.Init(absolutePath); NamedCardsManager.Init(absolutePath);
} }
...@@ -128,8 +137,8 @@ namespace WindBot ...@@ -128,8 +137,8 @@ namespace WindBot
MainServer.AuthenticationSchemes = AuthenticationSchemes.Anonymous; MainServer.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
MainServer.Prefixes.Add("http://127.0.0.1:" + ServerPort + "/"); MainServer.Prefixes.Add("http://127.0.0.1:" + ServerPort + "/");
MainServer.Start(); MainServer.Start();
Logger.WriteLine("Windbot Server Start Successed."); Logger.WriteLine("WindBot server start successed.");
Logger.WriteLine("HTTP GET http://127.0.0.1:" + ServerPort + "/?name=Windbot&host=127.0.0.1&port=7911 to call the bot."); Logger.WriteLine("HTTP GET http://127.0.0.1:" + ServerPort + "/?name=WindBot&host=127.0.0.1&port=7911 to call the bot.");
while (true) while (true)
{ {
try try
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment