Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Commit

Permalink
Response improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
about518 committed Nov 21, 2013
1 parent 24fff1c commit 273759e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
Binary file modified KanColleDbPost/FiddlerCore4.dll
Binary file not shown.
47 changes: 41 additions & 6 deletions KanColleDbPost/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,27 @@ public Form1()

private void Form1_Load(object sender, EventArgs e)
{
FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest;
FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete;
}

public string[] kanColleServers =
{
"203.104.105.167",
"125.6.184.15",
"125.6.184.16",
"125.6.187.205",
"125.6.187.229",
"125.6.187.253",
"125.6.188.25",
"203.104.248.135",
"125.6.189.7",
"125.6.189.39",
"125.6.189.71",
"125.6.189.103",
"125.6.189.135",
};

public enum UrlType
{
SHIP2,
Expand Down Expand Up @@ -84,20 +102,37 @@ public enum UrlType
//{ UrlType.MASTER_STYPE, "api_get_master/stype" },
//{ UrlType.MASTER_USEITEM, "api_get_master/useitem" },
};
void FiddlerApplication_AfterSessionComplete(Fiddler.Session oSession)

void FiddlerApplication_BeforeRequest(Session oSession)
{
string url = oSession.fullUrl;
if (url.IndexOf("/kcsapi/") <= 0)
bool isKanColleServer = false;
foreach (string ip in kanColleServers)
{
if (checkBox1.Checked)
if (oSession.hostname == ip)
{
AppendText(url + "\n");
isKanColleServer = true;
break;
}
}
if (!isKanColleServer)
{
// 艦これサーバー以外のリクエストはすべてバイパス
oSession.bypassGateway = true;
oSession.bBufferResponse = false;
}
}

void FiddlerApplication_AfterSessionComplete(Session oSession)
{
if (oSession.bypassGateway)
{
// バイパスされたセッションではなにもしない
return;
}

Task.Factory.StartNew(() =>
{
string url = oSession.fullUrl;
foreach (KeyValuePair<UrlType, string> kvp in urls)
{
if (url.IndexOf(kvp.Value) > 0)
Expand Down
4 changes: 2 additions & 2 deletions KanColleDbPost/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]

0 comments on commit 273759e

Please sign in to comment.