public static void Run(Login login, Battle battle) { #if DEBUG var authUrl = "http://localhost:3000/get_token"; var postUrl = Settings.Default.DebugPostUrl; #else var authUrl = Settings.Default.AuthUrl; var postUrl = Settings.Default.PostUrl; #endif string msg = ""; CookieContainer cc = new CookieContainer(); var json = SendRequest(authUrl, login.ToPostParameter(), cc); if ("false" == json.success) { throw new MiserugeErrorException("ユーザ認証に失敗しました。"); } string parameters = String.Join( "&" , login.ToPostParameter() , battle.ToPostParameter() , "authenticity_token=" + json.authenticity_token , "_method=post" ); var json2 = SendRequest(postUrl, parameters, cc); foreach (dynamic it in json2.errors) { msg = String.Join(Environment.NewLine, msg, it); } if (!String.IsNullOrEmpty(msg)) { throw new MiserugeErrorException(msg, "投稿エラー", MessageBoxIcon.Error, MessageBoxButtons.OK); } }