Пример #1
0
        static void FiddlerApplication_BeforeResponse(Fiddler.Session oSession)
        {
            if (oSession.RequestMethod == "GET" &&
                oSession.fullUrl.Contains("home_timeline.json"))
            {
                try
                {
                    Console.WriteLine("Check!");
                    var json = JArray.Parse(oSession.GetResponseBodyAsString());
                    foreach (var t in json)
                    {
                        var id = (long)t["id"];
                        if (idSet.Contains(id))
                        {
                            continue;
                        }

                        Console.WriteLine(t["full_text"]);

                        // 임시방편으로 Set을 사용함
                        idSet.Add((long)t["id"]);
                    }
                }
                catch (Exception ex) {
                    var body = oSession.GetResponseBodyAsString();
                    Console.WriteLine(ex.Message);
                }
            }
        }
Пример #2
0
        static void FiddlerApplication_BeforeResponse(Session oSession)
        {
            string url = oSession.url;
            DateTime start = oSession.Timers.ClientBeginRequest;
            DateTime end = oSession.Timers.ClientDoneResponse;
            TimeSpan t = end - start;

            if (oSession.host != filter)
                return;

            if(oSession.Timers.DNSTime > 0)
                Console.WriteLine("DNS TIME: {0}", oSession.Timers.DNSTime);

            if (!sdata.Keys.Contains(url))
                sdata[url] = new List<RequestAggregate>();

            RequestAggregate rq = new RequestAggregate()
            {
                data_size = oSession.GetResponseBodyAsString().Length,
                host = oSession.host,
                time = t.TotalMilliseconds
            };

            Monitor.Enter(sdata[url]);
            sdata[url].Add(rq);
            Monitor.Exit(sdata[url]);

            ConsoleColor c = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.DarkRed;
            Console.WriteLine("{0}  ==> {1}", oSession.url, end-start);
            Console.ForegroundColor = defaultColor;
        }
        public void AutoTamperResponseBefore(Session oSession)
        {
            DelayedResponsesInformation delayData = null;

            //
            // when fiddler initialized
            // sometimes an exception is thrown
            //
            try
            {
                delayData = fiddlerHook.GetDelayFor(
                    oSession.url,
                    oSession.GetResponseBodyAsString()
                    );
            }
            catch (Exception) { }

            if (delayData != null)
            {
                try
                {
                    Thread.Sleep(delayData.DelaySec * 1000);
                }
                catch (Exception) { }
            }
        }
Пример #4
0
        public override void Handle(Session Session)
        {
            string ResponseJson = Session.GetResponseBodyAsString();
            EventListDungeons result = JsonConvert.DeserializeObject<EventListDungeons>(ResponseJson);

            lock (FFRKProxy.Instance.Cache.SyncRoot)
            {
                foreach (DataDungeon dungeon in result.Dungeons)
                {
                    DataCache.Dungeons.Key key = new DataCache.Dungeons.Key { DungeonId = dungeon.Id };
                    DataCache.Dungeons.Data data = null;
                    if (!FFRKProxy.Instance.Cache.Dungeons.TryGetValue(key, out data))
                    {
                        data = new DataCache.Dungeons.Data
                        {
                            Difficulty = dungeon.Difficulty,
                            Name = dungeon.Name,
                            Series = dungeon.SeriesId,
                            Type = dungeon.Type,
                            WorldId = dungeon.WorldId
                        };
                        FFRKProxy.Instance.Cache.Dungeons.Update(key, data);
                    }
                }
            }

            FFRKProxy.Instance.Database.BeginExecuteRequest(new DbOpRecordDungeonList(result));
            FFRKProxy.Instance.RaiseListDungeons(result);
        }
Пример #5
0
        public override void Handle(Session Session)
        {
            string ResponseJson = Session.GetResponseBodyAsString();

            EventBattleInitiated result = JsonConvert.DeserializeObject<EventBattleInitiated>(ResponseJson);
            FFRKProxy.Instance.GameState.ActiveBattle = result;
            FFRKProxy.Instance.RaiseBattleInitiated(result);
        }
Пример #6
0
 public override string GetResponseBody(Session Session)
 {
     string ResponseBody = Session.GetResponseBodyAsString();
     HtmlDocument doc = new HtmlDocument();
     doc.LoadHtml(ResponseBody);
     HtmlNode node = doc.DocumentNode.SelectSingleNode(".//script[@data-app-init-data]");
     if (node == null)
         return null;
     return node.InnerHtml;
 }
Пример #7
0
 private void naviEvent(Fiddler.Session oS, string type)
 {
     try {
         string svdata = oS.GetResponseBodyAsString();
         string json   = svdata.Substring(7);
         JToken temp   = JToken.Parse(json);
         OnMapNavigateEvent(new NavigateEventArgs(type, temp["api_data"]));
     } catch (Exception exception) {
         Debug.Print(exception.ToString());
     }
 }
Пример #8
0
        private void FiddlerApplication_BeforeResponse(Session oSession)
        {
            if (!set.CacheEnabled) return;

            if (oSession.PathAndQuery.StartsWith("/kcsapi/api_start2") && Settings.Current.HackEnabled)
            {
                jsonData = oSession.GetResponseBodyAsString();
                ModifyData.Items.ForEach(x => setModifiedData(x));
                oSession.utilSetResponseBody(jsonData);
            }
        }
Пример #9
0
 private static void smethod_2(Session session_0)
 {
     if (Class1.string_8 == "")
     {
         if (session_0.fullUrl.Contains("habbo") && session_0.fullUrl.EndsWith("/client") && !session_0.fullUrl.Contains("facebook") && session_0.GetResponseBodyAsString().Contains("sso.ticket"))
         {
             session_0.SaveRequest(Environment.CurrentDirectory + "\\http-headers.txt", true);
             Class6.smethod_1();
             Class6.smethod_0(session_0.GetResponseBodyAsString());
             Class0.main_0.method_22();
         }
     }
     else
     {
         if (session_0.fullUrl == Class1.string_8 && session_0.GetResponseBodyAsString().Contains("sso.ticket"))
         {
             session_0.SaveRequest(Environment.CurrentDirectory + "\\http-headers.txt", true);
             Class6.smethod_1();
             Class6.smethod_0(session_0.GetResponseBodyAsString());
             Class0.main_0.method_22();
         }
     }
 }
Пример #10
0
        public void FiddlerApplicationOnBeforeResponse(Session oSession)
        {
            if (oSession.RequestMethod != "GET")
                return;

            var oBody = oSession.GetResponseBodyAsString();
            var responseLower = oBody.ToLower();
            var clientScore = _clientDetectors.Count(clientDetector => responseLower.Contains(clientDetector));

            if (clientScore < (_clientDetectors.Length/2)) return;

            var clientParser = new ClientParser(_manager, oSession.GetResponseBodyAsString());
            if (clientParser.Parse())
            {
                oSession.utilDecodeResponse();

                SetStatus($"Found server details. {clientParser.IpAddress}:{clientParser.Port}", Color.Green);

                if(!_manager.ManualHotel)
                    _manager.StartServer(clientParser.IpAddress, clientParser.Port);
                else
                    _manager.StartServer(IPAddress.Parse(""), 30000);

                oBody = oBody.Replace(clientParser.OFlashVars["connection.info.host"], $"\"{(clientParser.Base64Host ? StringToBase64(_manager.ServerIpAddress.ToString()) : _manager.ServerIpAddress.ToString())}\"");
                oBody = oBody.Replace(clientParser.OFlashVars["connection.info.port"], $"\"{(clientParser.Base64Port ? StringToBase64(_manager.ServerPort.ToString()) : _manager.ServerPort.ToString())}\"");
                oBody = oBody.Replace(clientParser.OFlashVars["client.starting"], "\"RetroImpact has been injected, loading hotel..\"");

                oBody = Regex.Replace(oBody, "<audio id=\"player\" src=\"(.*?)\" autoplay=\"true\"></audio>", ""); // Get rid of a stupid radio #np

                oSession.utilSetResponseBody(oBody);

                _manager.StopIntercept();
            }
            else
                SetStatus(clientParser.ErrorMessage, Color.Red);
        }
Пример #11
0
 private void battleEvent(Fiddler.Session oS, string type)
 {
     try {
         string svdata = oS.GetResponseBodyAsString();
         string json   = svdata.Substring(7);
         JToken temp   = JToken.Parse(json);
         if (type == "end")
         {
             OnBattleFinishEvent(new BattleEventArgs(type, temp["api_data"]));
         }
         else
         {
             OnBattleStartEvent(new BattleEventArgs(type, temp["api_data"]));
         }
     } catch (Exception exception) {
         Debug.Print(exception.ToString());
     }
 }
Пример #12
0
 private static Hashtable getBodyInfo(Session oS, bool bUseV1dot2Format)
 {
     int num;
     int num2;
     Hashtable hashtable = new Hashtable();
     getDecompressedSize(oS, out num, out num2);
     hashtable.Add("size", num);
     hashtable.Add("compression", num2);
     hashtable.Add("mimeType", oS.oResponse["Content-Type"]);
     if (oS.responseBodyBytes != null)
     {
         string mIMEType = oS.oResponse.MIMEType;
         bool flag = IsMIMETypeTextEquivalent(mIMEType);
         if (((flag && ("text/plain" == mIMEType)) && (oS.responseBodyBytes.Length > 3)) && ((((oS.responseBodyBytes[0] == 0x43) && (oS.responseBodyBytes[1] == 0x57)) && (oS.responseBodyBytes[2] == 0x53)) || (((oS.responseBodyBytes[0] == 70) && (oS.responseBodyBytes[1] == 0x4c)) && (oS.responseBodyBytes[2] == 0x56))))
         {
             flag = false;
         }
         if (flag)
         {
             if (oS.responseBodyBytes.Length < _iMaxTextBodyLength)
             {
                 hashtable.Add("text", oS.GetResponseBodyAsString());
                 return hashtable;
             }
             hashtable.Add("comment", "Body length exceeded fiddler.importexport.HTTPArchiveJSON.MaxTextBodyLength, so body was omitted.");
             return hashtable;
         }
         if (bUseV1dot2Format)
         {
             if (oS.responseBodyBytes.Length < _iMaxBinaryBodyLength)
             {
                 hashtable.Add("encoding", "base64");
                 hashtable.Add("text", Convert.ToBase64String(oS.responseBodyBytes));
                 return hashtable;
             }
             hashtable.Add("comment", "Body length exceeded fiddler.importexport.HTTPArchiveJSON.MaxBinaryBodyLength, so body was omitted.");
         }
     }
     return hashtable;
 }
Пример #13
0
        public override void Handle(Session Session)
        {
            string ResponseJson = Session.GetResponseBodyAsString();

            EventListBattles result = JsonConvert.DeserializeObject<EventListBattles>(ResponseJson);
            FFRKProxy.Instance.GameState.ActiveDungeon = result;

            lock (FFRKProxy.Instance.Cache.SyncRoot)
            {
                result.Battles.Sort((x,y) => x.Id.CompareTo(y.Id));
                ushort stam_to_reach = 0;
                for (int i=0; i < result.Battles.Count; ++i)
                {
                    DataBattle battle = result.Battles[i];
                    DataCache.Battles.Key key = new DataCache.Battles.Key { BattleId = battle.Id };
                    DataCache.Battles.Data data = null;
                    if (!FFRKProxy.Instance.Cache.Battles.TryGetValue(key, out data))
                    {
                        data = new DataCache.Battles.Data
                        {
                            DungeonId = battle.DungeonId,
                            HistoSamples = 1,
                            Name = battle.Name,
                            Repeatable = (i < result.Battles.Count-1),
                            Samples = 1,
                            Stamina = battle.Stamina,
                            StaminaToReach = stam_to_reach
                        };

                        FFRKProxy.Instance.Cache.Battles.Update(key, data);
                    }

                    stam_to_reach += battle.Stamina;
                }
            }
            FFRKProxy.Instance.Database.BeginExecuteRequest(new DbOpRecordBattleList(result));
            FFRKProxy.Instance.RaiseListBattles(result);
        }
Пример #14
0
 private static async void ReportAsync(Session oSession)
 {
     if (!Config.Current.ReportToKancolleDB) return;
     foreach (var api in apinames)
         if (oSession.PathAndQuery.Contains(api))
         {
             try
             {
                 var request = HttpUtility.HtmlDecode(oSession.GetRequestBodyAsString());
                 request = regextoken.Replace(request, "");
                 var response = oSession.GetResponseBodyAsString().Replace("svdata=", "");
                 var wrq = WebRequest.CreateHttp("http://api.kancolle-db.net/2/");
                 wrq.Method = "POST";
                 wrq.ContentType = "application/x-www-form-urlencoded";
                 var data = "token=" + HttpUtility.UrlEncode(Config.Current.KancolleDBToken)
                     + "&agent=LZXNXVGPejgSnEXLH2ur"//伪装为KCV
                     + "&url=" + HttpUtility.UrlEncode(oSession.fullUrl)
                     + "&requestbody=" + HttpUtility.UrlEncode(request)
                     + "&responsebody=" + HttpUtility.UrlEncode(response);
                 wrq.ContentLength = Encoding.UTF8.GetByteCount(data);
                 using (var sw = new StreamWriter(await wrq.GetRequestStreamAsync()))
                 {
                     sw.Write(data);
                     sw.Flush();
                 }
                 using (var wrs = wrq.GetResponse() as HttpWebResponse)
                 {
                     System.Diagnostics.Debug.WriteLine(wrs.StatusCode);
                 }
             }
             catch (Exception ex)
             {
                 System.Diagnostics.Debug.WriteLine(ex);
             }
         }
 }
Пример #15
0
 /// <summary>
 /// Gets triggered before the response gets rendered
 /// </summary>
 /// <param name="objSession"></param>
 private void FiddlerApplication_BeforeResponse(Session objSession)
 {
     //Check whether its an inaccessible URL
     if (!_IsAllowedURL)
     {
         String strRequestBody = objSession.GetResponseBodyAsString();
         objSession.utilSetResponseBody("<html><body><h1 style='color:red;'>You are not allowed to view this site.</h1></body></html>");
     }
 }
Пример #16
0
        /// <summary>
        /// 유저 아이템 목록을 수집합니다.
        /// </summary>
        /// <param name="oS"></param>
        private void TreasureDetail(Session oS)
        {
            LoadingEnd = false;
            JArray jsonVal = JArray.Parse(oS.GetResponseBodyAsString()) as JArray;
            dynamic Details = jsonVal;

            CurrentTreasureList = new Dictionary<string, TreasureInfo>();

            //this.TreasureReadStart();
            foreach (dynamic detail in Details)
            {
                string name = detail.name;
                int count = detail.number;
                int image = detail.image;
                string imgUrl = "http://gbf.game-a.mbga.jp/assets/img/sp/assets/item/article/s/" + image + ".jpg";
                GrandcypherClient.Current.GreetHooker.FileDownloader(imgUrl, image + ".jpg", false);
                TreasureInfo temp = new TreasureInfo
                {
                    Name = name,
                    count = count,
                    ItemID = image
                };

                CurrentTreasureList.Add(name, temp);
            }
            this.TreasureReadEnd();
            LoadingEnd = true;
        }
Пример #17
0
 public void AutoTamperResponseBefore(Session oSession)
 {
     if (this.bLoaded && this.ui.bEnabled)
     {
         if (oSession.responseCode == 404)
             return;
         if (this.xGETurlList.Contains(oSession.url) || this.posturlList.Contains(oSession.url))
         {
             string strResponse = oSession.GetResponseBodyAsString().Replace('\\',  '/');
             this.regex = new Regex(@"PHP\s*\w*\:.*\/\w*.php");
             this.m = this.regex.Match(strResponse);
             if (this.m.Success)
             {
                 if (oSession.RequestMethod == "GET")
                     this.ui.AddResult("[" + oSession.RequestMethod + "]    " + oSession.url);
                 else if (oSession.RequestMethod == "POST")
                 {
                     this.ui.AddResult("[" + oSession.RequestMethod + "]    " + oSession.url);
                     this.ui.AddResult("[POST Data:]    " + oSession.GetRequestBodyEncoding().GetString(oSession.requestBodyBytes));
                 }
             }
             else return ;
         }
     }
 }
Пример #18
0
        private void QuestDetail(Session oS)
        {
            this.ScenarioStart();

            var path = oS.PathAndQuery.Split('?');
            PathName = path[0];
            PathName = PathName.Substring(1, path[0].Count() - 1);
            PathName = PathName.Replace("/", "_");

            this.ScenarioName = PathName;

            if (this.ScenarioList == null)
                this.ScenarioList = new List<Scenario>();
            else
            {
                this.ScenarioList.Clear();
                this.ScenarioList.TrimExcess();

            }

            JArray jsonVal = JArray.Parse(oS.GetResponseBodyAsString()) as JArray;
            dynamic Details = jsonVal;
            this.ProgressStatus = new LimitedValue();
            this.ProgressStatus.Max = Details.Count;
            this.ProgressStatus.Min = 0;
            this.ProgressStatus.Current = 0;

            this.ProgressBar();
            string TranslateDir = "Google";
            if (TranslateSite == TranslateKind.Naver) TranslateDir = "Naver";

            if (File.Exists(Path.Combine(MainFolder, "Translations", "Scenarios", TranslateDir, PathName + ".xml")))
            {
                foreach (var detail in Details)
                {
                    string dtl = detail.detail;
                    //string sel1 = detail.sel1_txt;
                    //string sel2 = detail.sel2_txt;

                    Scenario temp = new Scenario
                    {
                        context = RemoveWebTag(dtl),
                        index = detail.id,
                    };
                    if (detail.charcter1_name != "null") temp.Name = detail.charcter1_name;
                    else temp.Name = "";

                    temp.TrName = GrandcypherClient.Current.Translations.ReplaceTranslation(temp.Name);

                    temp.TrContext = GrandcypherClient.Current.Translations.GetTranslation(TranslationType.ScenarioDetail, temp.context, TranslateSite);
                    //if (sel1 != null)
                    //{
                    //	temp.sel1_txt = RemoveWebTag(sel1);
                    //	temp.Trsel1 = Translator(temp.sel1_txt, TranslateSite);
                    //}
                    //if (sel2 != null)
                    //{
                    //	temp.sel2_txt = RemoveWebTag(sel2);
                    //	temp.Trsel2 = Translator(temp.sel2_txt, TranslateSite);
                    //}

                    ScenarioList.Add(temp);

                    this.ProgressStatus.Current++;
                    this.ProgressBar();
                }
                this.TranslatieEnd();
            }
            else
            {
                foreach (dynamic detail in Details)
                {
                    string dtl = detail.detail;
                    string sel1 = detail.sel1_txt;
                    string sel2 = detail.sel2_txt;
                    Scenario temp = new Scenario
                    {
                        context = RemoveWebTag(dtl),
                        index = detail.id,
                    };
                    if (ScenarioList.Count == 0) temp.PathName = PathName;

                    if (detail.charcter1_name != "null") temp.Name = detail.charcter1_name;
                    else temp.Name = "";

                    if(!ScenarioTransDisabled)
                    {
                        temp.TrName = GrandcypherClient.Current.Translations.ReplaceTranslation(temp.Name);

                        temp.TrContext = GrandcypherClient.Current.Translations.ReplaceTranslation(temp.context);
                        temp.TrContext = Translator(temp.TrContext, TranslateSite);
                        if (temp.TrContext != null) temp.TrContext = temp.TrContext.Replace("정액", "");

                        if (sel1 != null)
                        {
                            temp.sel1_txt = RemoveWebTag(sel1);
                            temp.Trsel1 = Translator(temp.sel1_txt, TranslateSite);
                        }
                        if (sel2 != null)
                        {
                            temp.sel2_txt = RemoveWebTag(sel2);
                            temp.Trsel2 = Translator(temp.sel2_txt, TranslateSite);
                        }
                        #region Debug
            #if DEBUG
                Console.WriteLine("-----------------------------------------------------------");

                Console.WriteLine(temp.Name + " : " + RemoveWebTag(temp.context));
                Console.WriteLine(temp.TrName + " : " + temp.TrContext);
                if (temp.sel1_txt != null)
                {
                    Console.WriteLine(temp.sel1_txt);
                    Console.WriteLine(temp.Trsel1);

                }
                if (temp.sel2_txt != null)
                {
                    Console.WriteLine(temp.sel2_txt);
                    Console.WriteLine(temp.Trsel2);
                }
            #endif
                        #endregion
                    }

                    ScenarioList.Add(temp);

                    this.ProgressStatus.Current++;
                    this.ProgressBar();
                }
                this.TranslatieEnd();
                if(!ScenarioTransDisabled) GrandcypherClient.Current.Translations.WriteFile(ScenarioList, TranslateSite);
                else GrandcypherClient.Current.Translations.WriteFile(ScenarioList, TranslateKind.Raw);
            }
        }
        static void FiddlerApplication_BeforeResponse(Session rpSession)
        {
            var rSession = rpSession.Tag as NetworkSession;
            if (rSession != null)
            {
                if (rSession.State == NetworkSessionState.Requested)
                    rSession.State = NetworkSessionState.Responsed;

                var rApiSession = rSession as ApiSession;
                if (rApiSession != null)
                {
                    rApiSession.ResponseBodyString = rpSession.GetResponseBodyAsString();
                    ApiParserManager.Instance.Process(rApiSession);
                }

                var rResourceSession = rSession as ResourceSession;
                if (rResourceSession != null)
                    CacheService.Instance.ProcessResponse(rResourceSession, rpSession);

                if (rpSession.PathAndQuery == "/gadget/js/kcs_flash.js")
                {
                    var rScript = rpSession.GetResponseBodyAsString();
                    var rModified = false;

                    var rQuality = Preference.Current.Browser.Flash.Quality;
                    if (rQuality != FlashQuality.Default)
                    {
                        rScript = r_FlashQualityRegex.Replace(rScript, $"$1{rQuality}$2");
                        rModified = true;
                    }

                    var rRenderMode = Preference.Current.Browser.Flash.RenderMode;
                    if (rRenderMode != FlashRenderMode.Default)
                    {
                        rScript = r_FlashRenderModeRegex.Replace(rScript, $"$1{rRenderMode}$2");
                        rModified = true;
                    }

                    if (rModified)
                        rpSession.utilSetResponseBody(rScript);
                }

                if (rSession.FullUrl == GameConstants.GamePageUrl)
                {
                    ForceOverrideStylesheet(rpSession);

                    var rSource = rpSession.GetResponseBodyAsString();
                    rSource = r_SuppressReloadConfirmation.Replace(rSource, "false");

                    rpSession.utilSetResponseBody(rSource);
                }

                if (rpSession.oResponse.headers.Any(rHeader => rHeader.Name == "Content-Range"))
                    System.Diagnostics.Debugger.Break();
            }
        }
Пример #20
0
        private void EnhancementHook(Session oS, bool IsWeapon)
        {
            if (IsWeapon) this.WeaponReadStart();
            else this.CharReadStart();
            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;

            dynamic test = jsonFull;
            var list = test.param as JObject;
            expInfo = new ExpInfo
            {
                exp = (int)list["exp"],
                next_exp = (int)list["next_exp"],
                level = (int)list["level"],
                max_level = (int)list["max_level"],
                remain_next_exp = (int)list["remain_next_exp"],
            };
            if (IsWeapon) this.WeaponReadEnd();
            else this.CharReadEnd();
        }
Пример #21
0
 public override void Handle(Session Session)
 {
     string ResponseJson = Session.GetResponseBodyAsString();
     DataGachaSeriesList result = JsonConvert.DeserializeObject<DataGachaSeriesList>(ResponseJson);
     FFRKProxy.Instance.GameState.GachaSeries = result;
 }
        private void FiddlerApplication_AfterSessionComplete(Session sess)
        {
            // Ignore HTTPS connect requests
            if (sess.RequestMethod == "CONNECT")
                return;

            //if (CaptureConfiguration.ProcessId > 0)
            //{
            //    if (sess.LocalProcessID != 0 && sess.LocalProcessID != CaptureConfiguration.ProcessId)
            //        return;
            //}

            //if (!string.IsNullOrEmpty(CaptureConfiguration.CaptureDomain))
            //{
            //    if (sess.hostname.ToLower() != CaptureConfiguration.CaptureDomain.Trim().ToLower())
            //        return;
            //}

            //if (sess.hostname.ToLower() != "bet365" && sess.hostname.ToLower() != "www.bet365.com")
            //{
            //    return;
            //}

            //if (CaptureConfiguration.IgnoreResources)
            //{
            //    string url = sess.fullUrl.ToLower();

            //    var extensions = CaptureConfiguration.ExtensionFilterExclusions;
            //    foreach (var ext in extensions)
            //    {
            //        if (url.Contains(ext))
            //            return;
            //    }

            //    var filters = CaptureConfiguration.UrlFilterExclusions;
            //    foreach (var urlFilter in filters)
            //    {
            //        if (url.Contains(urlFilter))
            //            return;
            //    }
            //}

            if (sess == null || sess.oRequest == null || sess.oRequest.headers == null)
                return;

            string headers = sess.oRequest.headers.ToString();
            var reqBody    = sess.GetRequestBodyAsString();

            // if you wanted to capture the response
            string respHeaders = sess.oResponse.headers.ToString();
            var respBody       = sess.GetResponseBodyAsString();

            // replace the HTTP line to inject full URL
            //string firstLine = sess.RequestMethod + " " + sess.fullUrl + " " + sess.oRequest.headers.HTTPVersion;
            //int at = headers.IndexOf("\r\n");
            //if (at < 0)
            //    return;
            //headers = firstLine + "\r\n" + headers.Substring(at + 1);

            //string output = headers + "\r\n" +
            //                (!string.IsNullOrEmpty(reqBody) ? reqBody + "\r\n" : string.Empty) +
            //                Separator + "\r\n\r\n";

            var output = string.Format("Headers: {0}; /n Body: {1}; /n RHeaders: {2}; /n RBody: {3}",headers, reqBody, respHeaders, respBody);

            //BeginInvoke(new Action<string>((text) =>
            //{
            //    txtCapture.AppendText(text);
            //    UpdateButtonStatus();
            //}), output);

            Console.WriteLine(output);
        }
Пример #23
0
        /// <summary>
        /// 기본 무기 리스트. 강화/리스트/창고가 포함됨
        /// </summary>
        /// <param name="oS"></param>
        private void ListDetail(Session oS)
        {
            this.WeaponListLoad();
            this.ListIsEnd = false;
            this.DeckIsEnd = false;
            if (this.WeaponLists == null)
                this.WeaponLists = new List<WeaponInfo>();
            else
            {
                this.WeaponLists.Clear();
                this.WeaponLists.TrimExcess();
            }
            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;
            dynamic test = jsonFull;
            dynamic list = test.list;

            List<dynamic> weaponList = new List<dynamic>();

            for (int i = 0; i < list.Count; i++)
            {
                weaponList.Add(list[i]);
            }

            this.ProgressStatus = new LimitedValue();
            this.ProgressStatus.Max = weaponList.Count;
            this.ProgressStatus.Min = 0;
            this.ProgressStatus.Current = 0;

            this.ProgressBar();

            for (int i = 0; i < weaponList.Count; i++)
            {
                dynamic tempIndex = weaponList[i].master;
                dynamic tempparam = weaponList[i].param;
                WeaponInfo temp = new WeaponInfo();

                temp.MasterId = tempIndex.id;
                temp.ParamId = tempparam.id;//무기 스킬레벨등을 저장하고 구별하기 위한 부분

                temp.ItemName = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponList, "", TranslateKind.Google, temp.MasterId);
                if (temp.ItemName != string.Empty)
                {
                    temp.Element = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.Element, "", TranslateKind.Google, temp.MasterId);
                    temp.Kind = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponType, "", TranslateKind.Google, temp.MasterId);
                }
                else
                {
                    int msid = temp.MasterId;
                    temp = MasterInfoLoad(temp.MasterId, Convert.ToInt32(tempparam.id));

                    if (temp.SkillName1 != string.Empty) temp.SkillDetail1 = GrandcypherClient.Current.Translations.GetSkillInfo(temp.SkillName1, true);
                    else temp.SkillDetail1 = string.Empty;
                    if (temp.SkillName2 != string.Empty) temp.SkillDetail2 = GrandcypherClient.Current.Translations.GetSkillInfo(temp.SkillName2, true);
                    else temp.SkillDetail2 = string.Empty;
                }
                temp.is_used = weaponList[i].is_used;

                temp = this.InputSkillInfo(temp);

                temp.SkillLv1 = WeaponLvLoad(temp.ParamId, 1);
                temp.SkillLv2 = WeaponLvLoad(temp.ParamId, 2);

                if (temp.SkillName1 == string.Empty || temp.SkillName1 == null) temp.vSkillLv1 = Visibility.Collapsed;
                else temp.vSkillLv1 = Visibility.Visible;
                if (temp.SkillName2 == string.Empty || temp.SkillName2 == null) temp.vSkillLv2 = Visibility.Collapsed;
                else temp.vSkillLv2 = Visibility.Visible;

                WeaponLists.Add(temp);
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }
            this.ListIsEnd = true;
            this.LoadingEnd();
        }
Пример #24
0
        /// <summary>
        /// 덱 편성 화면. 공인계산기 포함
        /// </summary>
        /// <param name="oS"></param>
        private void DeckDetail(Session oS)
        {
            this.ListIsEnd = false;
            this.DeckIsEnd = false;

            this.WeaponListLoad();
            int MasterAttribute = 0;

            this.SkillCounter = new Skills();
            this.ConBahaList = new List<decimal>();
            this.VisBahaList = new List<decimal>();

            if (this.WeaponLists == null)
                this.WeaponLists = new List<WeaponInfo>();
            else
            {
                this.WeaponLists.Clear();
                this.WeaponLists.TrimExcess();
            }

            if (this.NPCList == null)
                this.NPCList = new List<NpcInfo>();
            else
            {
                this.NPCList.Clear();
                this.NPCList.TrimExcess();
            }

            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;
            dynamic test = jsonFull;
            dynamic list = test.deck.pc.weapons;
            dynamic npcList = test.deck.npc;

            if (test.deck.pc.skill.count > 0)
            {
                this.SkillList = new List<string>();
                dynamic skilllist = test.deck.pc.skill.description;
                foreach (var item in skilllist)
                {
                    JProperty SkillProperty = item;
                    var Firsts = SkillProperty.First;
                    string SkillComment = (string)Firsts["comment"];
                    int over = (int)Firsts["over"];

                    if (over > 1) SkillList.Add("◎ " + GrandcypherClient.Current.ScenarioHooker.Translator(SkillComment, GrandcypherClient.Current.ScenarioHooker.TranslateSite) + " + " + over.ToString());
                    else SkillList.Add("◎ " + GrandcypherClient.Current.ScenarioHooker.Translator(SkillComment, GrandcypherClient.Current.ScenarioHooker.TranslateSite));
                }
            }
            if (test.deck.pc.param.attribute != null)
            {
                MasterAttribute = Convert.ToInt32(test.deck.pc.param.attribute);
            }
            this.ProgressStatus = new LimitedValue();
            this.ProgressStatus.Max = 15;
            this.ProgressStatus.Min = 0;
            this.ProgressStatus.Current = 0;

            //캐릭터의 속성을 구별할 방법이 외부 DB를 추가로 만드는 방법밖에 없기때문에 일단 모두 같은 속성으로 간주.
            //즉 디 오더 그랑데나 속성 불일치 종족파티를 쓰는 유저는 이 계산기를 사용할수없음
            for (int i = 1; i < 6; i++)
            {
                NpcInfo npc = new NpcInfo();
                string temp = i.ToString();
                JObject jobject = (JObject)npcList[temp];
                JObject param;
                JObject master;
                try
                {
                    param = (JObject)jobject["param"];
                    master = (JObject)jobject["master"];
                }
                catch
                {
                    this.NPCList.Add(npc);
                    continue;
                }
                npc.name = (string)master["name"];
                npc.attack = (int)param["attack"];
                this.NPCList.Add(npc);
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }

            for (int i = 1; i < 11; i++)
            {
                WeaponInfo deck = new WeaponInfo();
                string temp = i.ToString();
                JObject jobject = (JObject)list[temp];
                JObject master;
                JObject param;
                try
                {
                    master = (JObject)jobject["master"];
                    param = (JObject)jobject["param"];
                }
                catch
                {
                    deck.vSkillLv1 = Visibility.Collapsed;
                    deck.vSkillLv2 = Visibility.Collapsed;
                    WeaponLists.Add(deck);
                    continue;
                }
                deck.MasterId = (int)master["id"];
                deck.ParamId = (int)param["id"];//무기 스킬레벨등을 저장하고 구별하기 위한 부분
                deck.ItemName = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponList, "", TranslateKind.Google, deck.MasterId);
                if (deck.ItemName == string.Empty)
                {
                    int msid = deck.MasterId;
                    deck = MasterInfoLoad(deck.MasterId, (int)param["id"]);
                    if (deck.SkillName1 != string.Empty) deck.SkillDetail1 = GrandcypherClient.Current.Translations.GetSkillInfo(deck.SkillName1, true);
                    else deck.SkillDetail1 = string.Empty;
                    if (deck.SkillName2 != string.Empty) deck.SkillDetail2 = GrandcypherClient.Current.Translations.GetSkillInfo(deck.SkillName2, true);
                    else deck.SkillDetail2 = string.Empty;
                }
                deck.vSkillLv1 = Visibility.Collapsed;
                deck.vSkillLv2 = Visibility.Collapsed;

                deck = this.InputSkillInfo(deck);
                deck.attribute = (int)master["attribute"];
                if (!deck.IsManual) deck.Kind = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponType, "", TranslateKind.Google, deck.MasterId);

                if (i == 1)
                {
                    MainWeapon = deck;
                }
                else WeaponLists.Add(deck);

                this.ProgressStatus.Current++;
                this.ProgressBar();
            }

            for (int i = 0; i < WeaponLists.Count; i++)
            {
                if (WeaponLists[i].SkillAttribute1 == MasterAttribute
                    || WeaponLists[i].SkillAttribute1 >= 7)
                    this.SumAtt(WeaponLists[i].GeneralType1, WeaponLists[i]);
                if (WeaponLists[i].SkillAttribute2 == MasterAttribute
                    || WeaponLists[i].SkillAttribute2 >= 7)
                    this.SumAtt(WeaponLists[i].GeneralType2, WeaponLists[i], true);
            }
            if (MainWeapon.SkillAttribute1 == MasterAttribute
                || MainWeapon.SkillAttribute1 >= 7)
                this.SumAtt(MainWeapon.GeneralType1, MainWeapon);
            if (MainWeapon.SkillAttribute2 == MasterAttribute
                || MainWeapon.SkillAttribute2 >= 7)
                this.SumAtt(MainWeapon.GeneralType2, MainWeapon, true);

            this.SkillCounter.Baha += this.TotalBaha(this.ConBahaList);
            this.SkillCounter.Baha += this.TotalBaha(this.VisBahaList);

            this.DeckIsEnd = true;
            if (test.deck.pc.param != null) SkillCounter.BasicAttack = test.deck.pc.param.attack;
            this.DeckLoadingEnd();
        }
Пример #25
0
        /// <summary>
        /// 무기 정보에 접근할때 자동적으로 무기의 레벨을 저장한다.
        /// </summary>
        /// <param name="oS"></param>
        private void WeaponDetail(Session oS, bool IsEnhance = true)
        {
            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;
            dynamic temp = jsonFull;
            if (!IsEnhance)
            {
                dynamic master = temp.master;
                dynamic param = temp.param;
                if (temp.id != null)
                {
                    int SkillLv = param.skill_level;
                    int MasterId = master.id;
                    if (SkillLv <= 1) return;
                    if (MasterId == 1039900000 || MasterId == 1029900000) return;
                    int id = temp.id;
                    dynamic skill1 = temp.skill1;
                    dynamic skill2 = temp.skill2;

                    if (skill1.comment != null) this.WeaponLvSave(id, 1, SkillLv);
                    if (skill2.comment != null) this.WeaponLvSave(id, 2, SkillLv);
                }
            }
            else
            {
                dynamic detail = temp.detail;
                JObject NewInfo = (JObject)temp["new"];
                if (detail.id != null)
                {
                    int ParamId = detail.id;
                    int MasterId = detail.master.id;
                    int NewSkillLv = (int)NewInfo["skill_level"];

                    if (NewSkillLv <= 1) return;
                    if (MasterId == 1039900000 || MasterId == 1029900000) return;

                    dynamic skill1 = detail.skill1;
                    dynamic skill2 = detail.skill2;

                    if (skill1.comment != null) this.WeaponLvSave(ParamId, 1, NewSkillLv);
                    if (skill2.comment != null) this.WeaponLvSave(ParamId, 2, NewSkillLv);
                }
            }
        }
Пример #26
0
        private void NoticeDetail(Session oS)
        {
            this.NoticeListLoad();

            if (this.NoticeLists == null)
                this.NoticeLists = new List<NoticeInfo>();
            else
            {
                this.NoticeLists.Clear();
                this.NoticeLists.TrimExcess();
            }
            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;
            dynamic test = jsonFull;
            dynamic list = test.list;

            List<dynamic> NoticeList = new List<dynamic>();

            for (int i = 0; i < list.Count; i++)
            {
                NoticeList.Add(list[i]);
            }

            this.ProgressStatus = new LimitedValue();
            this.ProgressStatus.Max = NoticeList.Count;
            this.ProgressStatus.Min = 0;
            this.ProgressStatus.Current = 0;

            this.ProgressBar();

            for (int i = 0; i < NoticeList.Count; i++)
            {
                NoticeInfo temp = new NoticeInfo
                {
                    contents = NoticeList[i].contents,
                    title = NoticeList[i].title,
                    date = NoticeList[i].date,
                    created_at = NoticeList[i].created_at,
                    updated_at = NoticeList[i].updated_at,
                };
                temp.contents = GrandcypherClient.Current.ScenarioHooker.RemoveWebTag(temp.contents, false);
                temp.contents = temp.contents.Replace("「", "[");
                temp.contents = temp.contents.Replace("」", "]");

                temp.title = temp.title.Replace("「", "[");
                temp.title = temp.title.Replace("」", "]");

                temp.TrContents = SplitContents(temp.contents);
                temp.TrTitle = GrandcypherClient.Current.ScenarioHooker.Translator(GrandcypherClient.Current.ScenarioHooker.RemoveWebTag(temp.title), GrandcypherClient.Current.ScenarioHooker.TranslateSite);

                NoticeLists.Add(temp);
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }
            this.LoadingEnd();
        }
Пример #27
0
        void FiddlerApplication_AfterSessionComplete(Fiddler.Session oSession)
        {
            if (true)             //oSession.fullUrl.Contains("125.6.189.247"))  //宿毛湾泊地サーバのIP
            {
                var responseResult = oSession.GetResponseBodyAsString();
                Debug.WriteLine(responseResult);
                if (oSession.fullUrl.Contains("/kcsapi/"))
                {
                    Console.WriteLine(string.Format("Session{0}({3}):HTTP {1} for {2}", oSession.id, oSession.responseCode, oSession.fullUrl, oSession.oResponse.MIMEType));
                    Debug.WriteLine(string.Format("Session{0}({3}):HTTP {1} for {2}", oSession.id, oSession.responseCode, oSession.fullUrl, oSession.oResponse.MIMEType));

                    try
                    {
                        var jsonData = DynamicJson.Parse(responseResult.Replace("svdata=", string.Empty));

                        //装備のデータリスト(jsonData.api_data.api_mst_slotitem)を取得しログに吐く
                        try
                        {
                            object[] slotitemsLog = jsonData.api_data.api_mst_slotitem;
                            using (var log = new StreamWriter(new FileStream("Start2_EquipLog.txt", FileMode.Create)))
                            {
                                foreach (var slotitem in slotitemsLog)
                                {
                                    log.WriteLine(slotitem);
                                }
                            }

                            //艦娘のデータリスト(jsonData.api_data.api_mst_ship)を取得しログに吐く

                            object[] shipsLog = jsonData.api_data.api_mst_ship;
                            using (var log = new StreamWriter(new FileStream("Start2_ShipLog.txt", FileMode.Create)))
                            {
                                foreach (var ship in shipsLog)
                                {
                                    log.WriteLine(ship);
                                }
                            }
                        }catch (Exception excep) {
                            //Console.WriteLine(excep);
                        }

                        if (oSession.fullUrl.Contains("api_start2"))
                        {
                            start2 = jsonData;
                            //using (var log = new StreamWriter(new FileStream("start2_log.txt", FileMode.Append)))
                            //{
                            //	log.WriteLine(start2);

                            //}
                            object[] slotitems = jsonData.api_data.api_mst_slotitem;
                            foreach (var slotitem in slotitems)
                            {
                                //Console.WriteLine(slotitem.ToString());
                                start2.SlotItemList.Add(slotitem);
                            }
                            object[] ships = jsonData.api_data.api_mst_ship;
                            foreach (var ship in ships)
                            {
                                //Console.WriteLine(ship.ToString());
                                start2.SlotItemList.Add(ship);
                            }
                        }

                        if (oSession.fullUrl.Contains("api_req_kousyou/createitem"))                        //開発時のapiリクエスト
                        {
                            fleetMaterial.NowMaterial.Fuel       = jsonData.api_data.api_material[0];
                            fleetMaterial.NowMaterial.Ammunition = jsonData.api_data.api_material[1];
                            fleetMaterial.NowMaterial.Steel      = jsonData.api_data.api_material[2];
                            fleetMaterial.NowMaterial.Bauxite    = jsonData.api_data.api_material[3];


                            //Console.WriteLine(fleetMaterial.BeforeMaterial);
                            //Console.WriteLine(fleetMaterial.NowMaterial);

                            Material recipeMaterial = new Material();
                            recipeMaterial.Fuel       = fleetMaterial.BeforeMaterial.Fuel - fleetMaterial.NowMaterial.Fuel;
                            recipeMaterial.Ammunition = fleetMaterial.BeforeMaterial.Ammunition - fleetMaterial.NowMaterial.Ammunition;
                            recipeMaterial.Steel      = fleetMaterial.BeforeMaterial.Steel - fleetMaterial.NowMaterial.Steel;
                            recipeMaterial.Bauxite    = fleetMaterial.BeforeMaterial.Bauxite - fleetMaterial.NowMaterial.Bauxite;


                            KaihatsuResult kaihatsuResult = new KaihatsuResult();
                            kaihatsuResult.Recipe       = recipeMaterial;
                            kaihatsuResult.FlagShipName = "";
                            kaihatsuResult.FlagShipLv   = 0;
                            kaihatsuResult.FleetLv      = 0;

                            if (jsonData.api_data.api_create_flag == 1)
                            {
                                //kaihatsuResult = "成功";
                                //equipName = jsonData.api_data.api_slot_item.api_slotitem_id;
                                kaihatsuResult.IsSuccess = true;
                                int itemId = int.Parse(jsonData.api_data.api_slot_item.api_slotitem_id.ToString());
                                kaihatsuResult.ItemName = start2.getItemName(itemId);
                            }
                            else
                            {
                                //kaihatsuResult = "失敗";
                                //equipName = jsonData.api_data.api_fdata;
                                kaihatsuResult.IsSuccess = false;
                                kaihatsuResult.ItemName  = jsonData.api_data.api_fdata;

                                int itemId = int.Parse(jsonData.api_data.api_fdata.Split(',')[1]);
                                //Console.WriteLine("itemId={0}",itemId);
                                kaihatsuResult.ItemName = start2.getItemName(itemId);
                            }


                            kaihatsuResultList.Add(kaihatsuResult);                             //開発結果の追加

                            using (var log = new StreamWriter(new FileStream("kaihatsuResult_log.txt", FileMode.Append)))
                            {
                                log.WriteLine(kaihatsuResult);                                 //ログを残す
                            }


                            //Console.WriteLine("レシピ:" +recipeFuel +"/" +recipeAmmunition +"/"+recipeSteel +"/" +recipeBauxite +"\t開発結果:" +kaihatsuResult +"\t装備id (?):" +equipName);
                            Console.WriteLine(kaihatsuResultList[(kaihatsuResultList.Count - 1)]);
                        }
                        else if (oSession.fullUrl.Contains("api_port/port"))                        //母港開いた時のリクエスト
                        {
                            fleetMaterial.NowMaterial.Fuel       = jsonData.api_data.api_material[0].api_value;
                            fleetMaterial.NowMaterial.Ammunition = jsonData.api_data.api_material[1].api_value;
                            fleetMaterial.NowMaterial.Steel      = jsonData.api_data.api_material[2].api_value;
                            fleetMaterial.NowMaterial.Bauxite    = jsonData.api_data.api_material[3].api_value;

                            Console.WriteLine(fleetMaterial.NowMaterial);
                        }
                        else
                        {
                            //material = "うんこ";
                        }

                        fleetMaterial.BeforeMaterial = (Material)fleetMaterial.NowMaterial.Clone();
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(e);
                    }
                }
            }
        }
Пример #28
0
        private static Content GetBodyInfo(Session oS)
        {
            var content = new Content();

            int num;
            int num2;

            GetDecompressedSize(oS, out num, out num2);
            content.size = num;
            content.compression = num2;
            content.mimeType = oS.oResponse["Content-Type"];

            string mImeType = oS.oResponse.MIMEType;
            bool isMimeTypeTextEquivalent = Utility.IsMimeTypeTextEquivalent(mImeType);
            if (((isMimeTypeTextEquivalent && ("text/plain" == mImeType)) && (oS.responseBodyBytes.Length > 3)) &&
                ((((oS.responseBodyBytes[0] == 0x43) && (oS.responseBodyBytes[1] == 0x57)) &&
                  (oS.responseBodyBytes[2] == 0x53)) ||
                 (((oS.responseBodyBytes[0] == 70) && (oS.responseBodyBytes[1] == 0x4c)) &&
                  (oS.responseBodyBytes[2] == 0x56))))
            {
                isMimeTypeTextEquivalent = false;
            }
            if (isMimeTypeTextEquivalent)
            {
                content.text = oS.GetResponseBodyAsString();
                return content;
            }
            if (oS.responseBodyBytes.Length < MaxBinaryBodyLength)
            {
                content.encoding = "base64";
                content.text = Convert.ToBase64String(oS.responseBodyBytes);
                return content;
            }

            content.comment =
                "Body length exceeded Mocument.Transcoders.HttpArchiveTranscoder.MaxBinaryBodyLength , so body was omitted.";
            return content;
        }
 static void FiddlerApplication_BeforeReturningError(Session rpSession)
 {
     var rSession = rpSession.Tag as NetworkSession;
     if (rSession != null)
     {
         rSession.State = NetworkSessionState.Error;
         rSession.ErrorMessage = rpSession.GetResponseBodyAsString();
     }
 }
Пример #30
0
 void FiddlerApplication_BeforeReturningError(FiddlerSession rpSession)
 {
     var rSession = rpSession.Tag as Session;
     if (rSession != null)
     {
         rSession.Message = rpSession.GetResponseBodyAsString();
         rSession.Status = SessionStatus.Error;
     }
 }
Пример #31
0
        private void PostToServer( Session oSession )
        {
            string oauth = OAuth;
            string url = oSession.fullUrl;
            string request = oSession.GetRequestBodyAsString();
            string response = oSession.GetResponseBodyAsString();

            request = RequestRegex.Replace( request, "" );

            try {

                //*
                using ( System.Net.WebClient wc = new System.Net.WebClient() ) {
                    wc.Headers["User-Agent"] = "ElectronicObserver/v" + SoftwareInformation.VersionEnglish;

                    if ( Proxy != null ) {
                        wc.Proxy = Proxy;
                    }

                    System.Collections.Specialized.NameValueCollection post = new System.Collections.Specialized.NameValueCollection();
                    post.Add( "token", oauth );
                    // agent key for 'ElectronicObserver'
                    // https://github.com/about518/kanColleDbPost/issues/3#issuecomment-105534030
                    post.Add( "agent", "L57Mi4hJeCYinbbBSH5K" );
                    post.Add( "url", url );
                    post.Add( "requestbody", request );
                    post.Add( "responsebody", response );

                    wc.UploadValuesCompleted += ( sender, e ) => {
                        if ( e.Error != null ) {

                            // 結構頻繁に出るのでレポートは残さない方針で 申し訳ないです
                            //Utility.ErrorReporter.SendErrorReport( e.Error, string.Format( "艦これ統計データベースへの {0} の送信に失敗しました。", url.Substring( url.IndexOf( "/api" ) + 1 ) ) );

                            Utility.Logger.Add( 1, string.Format( "艦これ統計データベースへの {0} の送信に失敗しました。{1}", url.Substring( url.IndexOf( "/api" ) + 1 ), e.Error.Message ) );

                        } else {
                            Utility.Logger.Add( 1, string.Format( "艦これ統計データベースへ {0} を送信しました。", url.Substring( url.IndexOf( "/api" ) + 1 ) ) );
                        }
                    };

                    wc.UploadValuesAsync( new Uri( "http://api.kancolle-db.net/2/" ), post );
                }
                //*/

            } catch ( Exception ex ) {

                Utility.ErrorReporter.SendErrorReport( ex, "艦これ統計データベースへの送信中にエラーが発生しました。" );
            }
        }
Пример #32
0
        void FiddlerApplication_BeforeResponse(FiddlerSession rpSession)
        {
            var rSession = rpSession.Tag as Session;
            if (rSession != null)
            {
                if (rSession.Status == SessionStatus.Request)
                    rSession.Status = SessionStatus.Responsed;

                var rApiSession = rSession as ApiSession;
                if (rApiSession != null)
                {
                    rApiSession.ResponseString = rpSession.GetResponseBodyAsString();
                    ApiParsers.Post(rApiSession);
                }

                var rResourceSession = rSession as ResourceSession;
                if (rResourceSession != null && ResourceCache.IsEnabled && rpSession.responseCode == 200 && !File.Exists(rResourceSession.CachePath) && rpSession.oResponse["Last-Modified"] != null)
                {
                    rResourceSession.Data = rpSession.ResponseBody;
                    rResourceSession.LastModifiedTime = Convert.ToDateTime(rpSession.oResponse["Last-Modified"]);
                    ResourceCache.SaveFile(rResourceSession);
                }

                if (rSession.Url.Contains("kcs/sound/titlecall/") || rSession.Url.Contains("api_start2"))
                    KanColleGame.Current.RaiseGameLaunchedEvent();
            }

            Debug.WriteLine("Response - " + rpSession.fullUrl);
        }
Пример #33
0
        public override void Handle(Session Session)
        {
            string ResponseJson = Session.GetResponseBodyAsString();
            string RequestPath = Session.oRequest.headers.RequestPath;

            JObject parsed_object = JsonConvert.DeserializeObject<JObject>(ResponseJson);
            int parameter_start_index = RequestPath.IndexOf('?');
            if (parameter_start_index == -1)
            {
                Utility.Log.LogFormat("Unrecognized gacha series details request path {0}.  Expected ?series_id=<n>", RequestPath);
                return;
            }
            string param_string = RequestPath.Substring(parameter_start_index+1);
            Match series_match = Regex.Match(param_string, "series_id=([0-9]+)");
            if (!series_match.Success)
            {
                Utility.Log.LogFormat("Unrecognized gacha series details request path {0}.  Expected ?series_id=<n>", RequestPath);
                return;
            }

            uint series_id;
            if (!uint.TryParse(series_match.Groups[1].Value, out series_id))
            {
                Utility.Log.LogFormat("Unrecognized gacha series details request path {0}.  series_id does not appear to be an integer.", RequestPath);
                return;
            }

            DataGachaSeriesItemsForEntryPoints gacha = new DataGachaSeriesItemsForEntryPoints();
            foreach (var child in parsed_object)
            {
                try
                {
                    uint entry_point_id = uint.Parse(child.Key);
                    if (child.Value.Type != JTokenType.Object)
                        continue;

                    string serialized = JsonConvert.SerializeObject(child.Value);

                    var entry = new DataGachaSeriesItemsForEntryPoints.ItemsForEntryPoint();
                    entry.ItemDetails = JsonConvert.DeserializeObject<DataGachaSeriesItemDetails>(serialized);
                    // Add the entry immediately.  We may not end up finding DataGachaSeriesEntryPoint for this
                    // entry point (for example if the user was already viewing the gacha banners when he loaded
                    // FFRK Inspector.  But we still save the entry point ID in the UI, and it's mostly just for
                    // show, so the UI can fallback in that case.
                    gacha.Gachas.Add(entry_point_id, entry);

                    // Find the entry point details for this entry point.
                    List<DataGachaSeriesInfo> SeriesList = FFRKProxy.Instance.GameState.GachaSeries.SeriesList;
                    if (SeriesList == null)
                        continue;

                    DataGachaSeriesInfo series = SeriesList.Find(x => x.SeriesId == series_id);
                    if (series == null)
                        continue;

                    entry.EntryPoint = FindEntryPointForSeries(series, entry_point_id);
                }
                catch
                {
                }
            }
            FFRKProxy.Instance.RaiseGachaStats(gacha);
        }
Пример #34
0
        /// <summary>
        /// Gets triggered before the response gets rendered
        /// </summary>
        /// <param name="objSession"></param>
        private void FiddlerApplication_BeforeResponse(Session objSession)
        {
            String strContentType;

            //Get the content type
            strContentType = objSession.oRequest.headers["Accept"];

            String strRequestBody = objSession.GetResponseBodyAsString();
            //objSession.utilSetResponseBody("<html><body><h1>Hii</h1></body></html>");

            //If the user has opted to display responses
            if(_enConfiguration == Config.ShowResponses)
                Console.WriteLine("{0}:HTTP {1} for {2}", objSession.id, objSession.responseCode, objSession.fullUrl);
        }