예제 #1
0
        /// <summary>
        /// SSTP送信
        /// </summary>
        protected bool SendSSTPScript(SSTPClient.Request req, out SSTPClient.Response res)
        {
            res = null;
            var sstpClient = new SSTPClient();

            try
            {
                res = sstpClient.SendRequest(req);

                // エラーレスポンス時
                if (!res.Success)
                {
                    if (res.StatusCode == 404)
                    {
                        MessageBox.Show(this,
                                        string.Format("通信先のゴースト ({0}) が見つかりませんでした。\r\nそのゴーストがいなくなっているか、ほかの原因によって操作がブロックされている可能性があります。", CallerSakuraName),
                                        "エラー",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning);

                        UpdateFMOInfoAndUpdateUI();
                        return(false);
                    }
                    else
                    {
                        MessageBox.Show(this,
                                        string.Format("SSPとの通信に失敗しました。\r\n({0} {1})", res.StatusCode, res.StatusExplanation),
                                        "エラー",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning);
                        return(false);
                    }
                }

                // 正常終了
                return(true);
            }
            catch (SocketException ex)
            {
                Debug.WriteLine(ex.ToString());

                // ソケット例外発生時
                MessageBox.Show(this,
                                "SSPとの通信を行えませんでした。\r\nSSPが終了しているか、ほかの原因によって操作がブロックされている可能性があります。",
                                "エラー",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return(false);
            }
        }
예제 #2
0
 /// <summary>
 /// SSTP送信
 /// </summary>
 protected bool SendSSTPScript(SSTPClient.Request req)
 {
     SSTPClient.Response res;
     return(SendSSTPScript(req, out res));
 }