Exemple #1
0
        void guildname(Fiddler.Session oSession)
        {
            var a = oSession.GetResponseBodyAsString();

            Console.WriteLine(a);
            var test = DynamicJson.Parse(a);

            GlobalVar.guildname    = "," + test.guild_name;
            GlobalVar.lupi         = test.most_donated_lupi;
            GlobalVar.url          = "http://game.granbluefantasy.jp/#guild/detail/" + test.guild_id;
            GlobalVar.guildidcheck = test.guild_id;

            writeGuildname(test.guild_name);
            GlobalVar.mainpage = true;

            //初期化
            GlobalVar.totalrank = 0;
            GlobalVar.member    = 0;
            GlobalVar.page1     = false;
            GlobalVar.page2     = false;
            GlobalVar.page3     = false;
            GlobalVar.checker   = 0;

            if (hikoukaidan.check == false)
            {
                writeGuildnum("");
                writeARank("");
            }
        }
        private void FiddlerApplication_BeforeResponse(Fiddler.Session oSession)
        {
            //flash 品質設定
            if (oSession.bBufferResponse && oSession.fullUrl.Contains("/gadget/js/kcs_flash.js"))
            {
                string js   = oSession.GetResponseBodyAsString();
                bool   flag = false;

                var wmode = _wmodeRegex.Match(js);
                if (wmode.Success)
                {
                    js   = js.Replace(wmode.Value, string.Format(@"""wmode"":""{0}""", Utility.Configuration.Config.FormBrowser.FlashWMode));
                    flag = true;
                }

                var quality = _qualityRegex.Match(js);
                if (quality.Success)
                {
                    js   = js.Replace(quality.Value, string.Format(@"""quality"":""{0}""", Utility.Configuration.Config.FormBrowser.FlashQuality));
                    flag = true;
                }

                if (flag)
                {
                    oSession.utilSetResponseBody(js);

                    Utility.Logger.Add(1, "flashの品質設定を行いました。");
                }
            }
        }
Exemple #3
0
        private void sessionhandle(Fiddler.Session oSession)
        {
            if (oSession.PathAndQuery.EndsWith("/kcsapi/api_port/port"))
            {
                string JSON = oSession.GetResponseBodyAsString();
                JSON = JSON.Remove(0, "svdata=".Length);
                porthandle(JSON);
            }

            if (oSession.PathAndQuery.EndsWith("/kcsapi/api_get_member/mission"))
            {
                string JSON = oSession.GetResponseBodyAsString();
                JSON = JSON.Remove(0, "svdata=".Length);
                missionhandle(JSON);
            }

            if (oSession.PathAndQuery.EndsWith("/kcsapi/api_req_hokyu/charge"))
            {
                string JSON = oSession.GetResponseBodyAsString();
                JSON = JSON.Remove(0, "svdata=".Length);
                chargehandle(JSON);
            }

            if (oSession.PathAndQuery.EndsWith("/kcsapi/api_req_mission/result"))
            {
                string JSON = oSession.GetResponseBodyAsString();
                JSON = JSON.Remove(0, "svdata=".Length);
                resulthandle(JSON);
            }

            if (oSession.PathAndQuery.EndsWith("/kcsapi/api_req_mission/start"))
            {
                string JSON = oSession.GetResponseBodyAsString();
                JSON = JSON.Remove(0, "svdata=".Length);
                ExStarthandle(JSON);
            }
        }
Exemple #4
0
        //非公開だん専用
        void hikoukai(Fiddler.Session oSession)
        {
            var a = oSession.GetResponseBodyAsString();


            hikoukaidan.check = true;
            string pattern1 = @"(prt-status-value%22%3E)(?<members>.+?)(%E4%BA%BA%3C%2Fdiv)";
            string pattern2 = @"(Rank%3C%2Fdiv%3E%0A%09%09%09%09%3Cdiv%20class%3D%22prt-status-value%22%3E)(?<members>.+?)(%3C%2Fdiv%3E%0A%09%09%09%3C%2Fdiv)";

            hikoukaidan.num_member   = Regex.Match(a, pattern1).Groups["members"].Value;
            hikoukaidan.average_rank = Regex.Match(a, pattern2).Groups["members"].Value;
            Console.WriteLine(hikoukaidan.num_member + hikoukaidan.average_rank);

            writeGuildnum(hikoukaidan.num_member);
            writeARank(hikoukaidan.average_rank);
            hikoukaidan.check2 = false;
        }
        private void FiddlerApplication_AfterSessionComplete(Fiddler.Session oSession)
        {
            //保存
            {
                Utility.Configuration.ConfigurationData.ConfigConnection c = Utility.Configuration.Config.Connection;

                if (c.SaveReceivedData)
                {
                    try {
                        if (c.SaveResponse && oSession.fullUrl.Contains("/kcsapi/"))
                        {
                            // 非同期で書き出し処理するので取っておく
                            // stringはイミュータブルなのでOK
                            string url  = oSession.fullUrl;
                            string body = oSession.GetResponseBodyAsString();

                            Task.Run((Action)(() => {
                                SaveResponse(url, body);
                            }));
                        }
                        else if (oSession.fullUrl.Contains("/kcs/") &&
                                 ((c.SaveSWF && oSession.oResponse.MIMEType == "application/x-shockwave-flash") || c.SaveOtherFile))
                        {
                            string saveDataPath = c.SaveDataPath;                             // スレッド間の競合を避けるため取っておく
                            string tpath        = string.Format("{0}\\{1}", saveDataPath, oSession.fullUrl.Substring(oSession.fullUrl.IndexOf("/kcs/") + 5).Replace("/", "\\"));
                            {
                                int index = tpath.IndexOf("?");
                                if (index != -1)
                                {
                                    if (Utility.Configuration.Config.Connection.ApplyVersion)
                                    {
                                        string over   = tpath.Substring(index + 1);
                                        int    vindex = over.LastIndexOf("VERSION=", StringComparison.CurrentCultureIgnoreCase);
                                        if (vindex != -1)
                                        {
                                            string version = over.Substring(vindex + 8).Replace('.', '_');
                                            tpath  = tpath.Insert(tpath.LastIndexOf('.', index), "_v" + version);
                                            index += version.Length + 2;
                                        }
                                    }

                                    tpath = tpath.Remove(index);
                                }
                            }

                            // 非同期で書き出し処理するので取っておく
                            byte[] responseCopy = new byte[oSession.ResponseBody.Length];
                            Array.Copy(oSession.ResponseBody, responseCopy, oSession.ResponseBody.Length);

                            Task.Run((Action)(() => {
                                try {
                                    lock (this) {
                                        // 同時に書き込みが走るとアレなのでロックしておく

                                        Directory.CreateDirectory(Path.GetDirectoryName(tpath));

                                        //System.Diagnostics.Debug.WriteLine( oSession.fullUrl + " => " + tpath );
                                        using (var sw = new System.IO.BinaryWriter(System.IO.File.OpenWrite(tpath))) {
                                            sw.Write(responseCopy);
                                        }
                                    }

                                    Utility.Logger.Add(1, string.Format("通信からファイル {0} を保存しました。", tpath.Remove(0, saveDataPath.Length + 1)));
                                } catch (IOException ex) {                                      //ファイルがロックされている; 頻繁に出るのでエラーレポートを残さない
                                    Utility.Logger.Add(3, "通信内容の保存に失敗しました。 " + ex.Message);
                                }
                            }));
                        }
                    } catch (Exception ex) {
                        Utility.ErrorReporter.SendErrorReport(ex, "通信内容の保存に失敗しました。");
                    }
                }
            }


            if (oSession.fullUrl.Contains("/kcsapi/") && oSession.oResponse.MIMEType == "text/plain")
            {
                // 非同期でGUIスレッドに渡すので取っておく
                // stringはイミュータブルなのでOK
                string url  = oSession.fullUrl;
                string body = oSession.GetResponseBodyAsString();
                UIControl.BeginInvoke((Action)(() => { LoadResponse(url, body); }));
            }



            if (ServerAddress == null)
            {
                string url = oSession.fullUrl;

                int idxb = url.IndexOf("/kcsapi/");

                if (idxb != -1)
                {
                    int idxa = url.LastIndexOf("/", idxb - 1);

                    ServerAddress = url.Substring(idxa + 1, idxb - idxa - 1);
                }
            }
        }
Exemple #6
0
        //本体---------------------------------------------------------------------------------------------------------------------
        void FiddlerApplication_AfterSessionComplete(Fiddler.Session oSession)
        {
            var path = oSession.PathAndQuery;

            if (!path.StartsWith("/guild_other/member_list/")) // 団員一覧のAPI以外は無視する
            {
                if (path.StartsWith("//guild_other/guild_info"))
                {
                    guildname(oSession);
                    if (hikoukaidan.check2 == false)
                    {
                        Console.WriteLine("unchi");
                        show();
                    }
                }

                /*団プロフ通ってない時はスルー?
                 * if(path.Contains(GlobalVar.guildidcheck) == false)
                 * {
                 *  oSession.Ignore();
                 *  return;
                 * }
                 */

                //非公開の団を探す
                if (path.StartsWith("/guild_main/content/detail/"))
                {
                    hikoukai(oSession);
                }

                oSession.Ignore();
                return;
            }
            //コンソールに書く
            Console.WriteLine(oSession.fullUrl);
            //セッション情報をjson化して解析
            var a = oSession.GetResponseBodyAsString();

            Console.WriteLine(a);
            var test  = DynamicJson.Parse(a);
            int index = 0;

            //団プロフ→1ページ目に飛ぶことを想定
            if (test.current == "1" && GlobalVar.page1 == false && path.Contains(GlobalVar.guildidcheck) == true)
            {
                foreach (int x in test.list)
                {
                    if (int.Parse(test.list[index].level) >= 175)
                    {
                        GlobalVar.over175++;
                    }
                    GlobalVar.totalrank += int.Parse(test.list[index].level);
                    //var r1 = test.list[index].level;
                    //Console.WriteLine(r1);
                    index++;
                    GlobalVar.checker++;
                    GlobalVar.page1 = true;
                }
                //intをstringにキャスト
                string s = GlobalVar.checker.ToString();
                writeGuildnum(s + "/" + test.count);
            }

            //2ページ目初回のみカウント
            if (test.current == "2" && GlobalVar.page2 == false && path.Contains(GlobalVar.guildidcheck) == true)
            {
                foreach (int x in test.list)
                {
                    if (int.Parse(test.list[index].level) >= 175)
                    {
                        GlobalVar.over175++;
                    }
                    GlobalVar.totalrank += int.Parse(test.list[index].level);
                    index++;
                    GlobalVar.checker++;
                    GlobalVar.page2 = true;
                }
                //intをstringにキャスト
                string s = GlobalVar.checker.ToString();
                writeGuildnum(s + "/" + test.count);
            }

            //3ページ目初回時のみカウント
            if (test.current == "3" && GlobalVar.page3 == false && path.Contains(GlobalVar.guildidcheck) == true)
            {
                foreach (int x in test.list)
                {
                    if (int.Parse(test.list[index].level) >= 175)
                    {
                        GlobalVar.over175++;
                    }
                    GlobalVar.totalrank += int.Parse(test.list[index].level);
                    index++;
                    GlobalVar.checker++;
                    GlobalVar.page3 = true;
                }
                //intをstringにキャスト
                string s = GlobalVar.checker.ToString();
                writeGuildnum(s + "/" + test.count);
            }

            //GlobalVar.member += index;
            GlobalVar.member = (int)test.count;



            //どのページでも団員数さえ満たしているならおっけ
            //test.countは団員数
            if (GlobalVar.checker == test.count && GlobalVar.mainpage == true && path.Contains(GlobalVar.guildidcheck) == true)
            {
                Console.WriteLine("kuso");
                show();
            }



            //var arrayJson = DynamicJson.Parse(a);
            //var json = arrayJson.Deserialize<List>();
            //var r1 = json.id;
            // Console.WriteLine(r1);
        }