return;\r
if (response == null || !response.StartsWith("svdata="))\r
{\r
- WriteDebugLog(url, request, response ?? "(null)");\r
- ShowServerError();\r
+ WriteDebugLog(url, request, response);\r
+ ShowServerError(url, request, response);\r
return;\r
}\r
response = response.Remove(0, "svdata=".Length);\r
{\r
var json = DynamicJson.Parse(response);\r
WriteDebugLog(url, request, json.ToString());\r
- UpdateInfo(_sniffer.Sniff(url, request, json));\r
+ var update = _sniffer.Sniff(url, request, json);\r
+ if (update == Sniffer.Update.Error)\r
+ {\r
+ ShowServerError(url, request, json);\r
+ return;\r
+ }\r
+ UpdateInfo(update);\r
}\r
catch (XmlException)\r
{\r
WriteDebugLog(url, request, response);\r
- ShowServerError();\r
+ ShowServerError(url, request, response);\r
}\r
- catch (RuntimeBinderException)\r
+ catch (RuntimeBinderException e)\r
{\r
- labelLogin.Text = "現在の艦これに対応していません。\n新しいバージョンを利用してください。";\r
- labelLogin.Visible = true;\r
+ if (_errorDialog.ShowDialog(this,\r
+ "このバージョンは現在の艦これに対応していません。\n新しいバージョンを利用してください。", e.ToString()) == DialogResult.Abort)\r
+ Application.Exit();\r
}\r
catch (LogIOException e)\r
{\r
{\r
if (_debugLogFile != null)\r
{\r
- File.AppendAllText(_debugLogFile, $"url: {url}\nrequest: {request}\nresponse: {response}\n");\r
+ File.AppendAllText(_debugLogFile, SessionString(url, request, response));\r
}\r
}\r
\r
- private void UpdateInfo(Sniffer.Update update)\r
+ private void ShowServerError(string url, string request, string response)\r
{\r
- if (update == Sniffer.Update.Error)\r
- {\r
- ShowServerError();\r
+ if (_errorDialog.Visible)\r
return;\r
- }\r
+ if (_errorDialog.ShowDialog(this, "サーバーからの応答が異常です。",\r
+ SessionString(url, request, response)) == DialogResult.Abort)\r
+ Application.Exit();\r
+ }\r
+\r
+ private string SessionString(string url, string request, string response)\r
+ => $"url: {url}\nrequest: {request}\nresponse: {(response ?? "(null)")}\n";\r
+\r
+ private void UpdateInfo(Sniffer.Update update)\r
+ {\r
if (update == Sniffer.Update.Start)\r
{\r
labelLogin.Visible = false;\r
UpdateBattleInfo();\r
}\r
\r
- private void ShowServerError()\r
- {\r
- labelLogin.Text = "サーバーからの応答が異常です。";\r
- labelLogin.Visible = true;\r
- }\r
-\r
private void MainForm_Load(object sender, EventArgs e)\r
{\r
_config.Load();\r