From: Kazuhiro Fujieda Date: Sat, 27 Jan 2018 05:12:14 +0000 (+0900) Subject: kancolle-db.netへの送信機能を削除する X-Git-Tag: v10.0~4 X-Git-Url: http://git.osdn.net/view?p=kancollesniffer%2FKancolleSniffer.git;a=commitdiff_plain;h=9d2db977a3dbcc08c6976dc14f739a12286913b5 kancolle-db.netへの送信機能を削除する --- diff --git a/KancolleSniffer/Config.cs b/KancolleSniffer/Config.cs index 1262a78..7175ad0 100644 --- a/KancolleSniffer/Config.cs +++ b/KancolleSniffer/Config.cs @@ -70,12 +70,6 @@ namespace KancolleSniffer } } - public class KancolleDbConfig - { - public bool On { get; set; } - public string Token { get; set; } = ""; - } - public class PushbulletConfig { public bool On { get; set; } @@ -223,7 +217,6 @@ namespace KancolleSniffer public ProxyConfig Proxy { get; set; } = new ProxyConfig(); public ShipListConfig ShipList { get; set; } = new ShipListConfig(); public LogConfig Log { get; set; } = new LogConfig(); - public KancolleDbConfig KancolleDb { get; set; } = new KancolleDbConfig(); public PushbulletConfig Pushbullet { get; set; } = new PushbulletConfig(); public PushoverConfig Pushover { get; set; } = new PushoverConfig(); diff --git a/KancolleSniffer/ConfigDialog.Designer.cs b/KancolleSniffer/ConfigDialog.Designer.cs index d79131a..07e3f88 100644 --- a/KancolleSniffer/ConfigDialog.Designer.cs +++ b/KancolleSniffer/ConfigDialog.Designer.cs @@ -109,9 +109,7 @@ namespace KancolleSniffer this.textBoxOutput = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.buttonOutputDir = new System.Windows.Forms.Button(); - this.tabPageCollabo = new System.Windows.Forms.TabPage(); - this.tabControlCollabo = new System.Windows.Forms.TabControl(); - this.tabPagePushNotification = new System.Windows.Forms.TabPage(); + this.tabPagePush = new System.Windows.Forms.TabPage(); this.groupBoxPushover = new System.Windows.Forms.GroupBox(); this.buttonPushoverTest = new System.Windows.Forms.Button(); this.label16 = new System.Windows.Forms.Label(); @@ -124,11 +122,6 @@ namespace KancolleSniffer this.textBoxPushbulletToken = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.checkBoxPushbulletOn = new System.Windows.Forms.CheckBox(); - this.tabPageExternalService = new System.Windows.Forms.TabPage(); - this.groupBoxKancolleDb = new System.Windows.Forms.GroupBox(); - this.textBoxKancolleDbToken = new System.Windows.Forms.TextBox(); - this.label8 = new System.Windows.Forms.Label(); - this.checkBoxKancolleDbOn = new System.Windows.Forms.CheckBox(); this.tabPageDebug = new System.Windows.Forms.TabPage(); this.buttonPlayDebugLog = new System.Windows.Forms.Button(); this.buttonDebugLogOpenFile = new System.Windows.Forms.Button(); @@ -157,13 +150,9 @@ namespace KancolleSniffer this.groupBoxAutoConfig.SuspendLayout(); this.tabPageLog.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaterialLogInterval)).BeginInit(); - this.tabPageCollabo.SuspendLayout(); - this.tabControlCollabo.SuspendLayout(); - this.tabPagePushNotification.SuspendLayout(); + this.tabPagePush.SuspendLayout(); this.groupBoxPushover.SuspendLayout(); this.groupBoxPushbullet.SuspendLayout(); - this.tabPageExternalService.SuspendLayout(); - this.groupBoxKancolleDb.SuspendLayout(); this.tabPageDebug.SuspendLayout(); this.SuspendLayout(); // @@ -178,7 +167,7 @@ namespace KancolleSniffer this.tabControl.Controls.Add(this.tabPageVersion); this.tabControl.Controls.Add(this.tabPageProxy); this.tabControl.Controls.Add(this.tabPageLog); - this.tabControl.Controls.Add(this.tabPageCollabo); + this.tabControl.Controls.Add(this.tabPagePush); this.tabControl.Controls.Add(this.tabPageDebug); this.tabControl.Location = new System.Drawing.Point(7, 6); this.tabControl.Multiline = true; @@ -878,38 +867,16 @@ namespace KancolleSniffer this.buttonOutputDir.UseVisualStyleBackColor = true; this.buttonOutputDir.Click += new System.EventHandler(this.buttonOutputDir_Click); // - // tabPageCollabo - // - this.tabPageCollabo.Controls.Add(this.tabControlCollabo); - this.tabPageCollabo.Location = new System.Drawing.Point(4, 40); - this.tabPageCollabo.Name = "tabPageCollabo"; - this.tabPageCollabo.Size = new System.Drawing.Size(256, 158); - this.tabPageCollabo.TabIndex = 8; - this.tabPageCollabo.Text = "連携"; - this.tabPageCollabo.UseVisualStyleBackColor = true; - // - // tabControlCollabo - // - this.tabControlCollabo.Controls.Add(this.tabPagePushNotification); - this.tabControlCollabo.Controls.Add(this.tabPageExternalService); - this.tabControlCollabo.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlCollabo.Location = new System.Drawing.Point(0, 0); - this.tabControlCollabo.Name = "tabControlCollabo"; - this.tabControlCollabo.SelectedIndex = 0; - this.tabControlCollabo.Size = new System.Drawing.Size(256, 158); - this.tabControlCollabo.TabIndex = 3; - // - // tabPagePushNotification - // - this.tabPagePushNotification.Controls.Add(this.groupBoxPushover); - this.tabPagePushNotification.Controls.Add(this.groupBoxPushbullet); - this.tabPagePushNotification.Location = new System.Drawing.Point(4, 22); - this.tabPagePushNotification.Name = "tabPagePushNotification"; - this.tabPagePushNotification.Padding = new System.Windows.Forms.Padding(3); - this.tabPagePushNotification.Size = new System.Drawing.Size(248, 132); - this.tabPagePushNotification.TabIndex = 0; - this.tabPagePushNotification.Text = "プッシュ通知"; - this.tabPagePushNotification.UseVisualStyleBackColor = true; + // tabPagePush + // + this.tabPagePush.Controls.Add(this.groupBoxPushover); + this.tabPagePush.Controls.Add(this.groupBoxPushbullet); + this.tabPagePush.Location = new System.Drawing.Point(4, 40); + this.tabPagePush.Name = "tabPagePush"; + this.tabPagePush.Size = new System.Drawing.Size(256, 158); + this.tabPagePush.TabIndex = 8; + this.tabPagePush.Text = "プッシュ通知"; + this.tabPagePush.UseVisualStyleBackColor = true; // // groupBoxPushover // @@ -919,7 +886,7 @@ namespace KancolleSniffer this.groupBoxPushover.Controls.Add(this.textBoxPushoverUserKey); this.groupBoxPushover.Controls.Add(this.checkBoxPushoverOn); this.groupBoxPushover.Controls.Add(this.textBoxPushoverApiKey); - this.groupBoxPushover.Location = new System.Drawing.Point(6, 55); + this.groupBoxPushover.Location = new System.Drawing.Point(11, 60); this.groupBoxPushover.Name = "groupBoxPushover"; this.groupBoxPushover.Size = new System.Drawing.Size(236, 66); this.groupBoxPushover.TabIndex = 2; @@ -985,7 +952,7 @@ namespace KancolleSniffer this.groupBoxPushbullet.Controls.Add(this.textBoxPushbulletToken); this.groupBoxPushbullet.Controls.Add(this.label7); this.groupBoxPushbullet.Controls.Add(this.checkBoxPushbulletOn); - this.groupBoxPushbullet.Location = new System.Drawing.Point(6, 6); + this.groupBoxPushbullet.Location = new System.Drawing.Point(11, 11); this.groupBoxPushbullet.Name = "groupBoxPushbullet"; this.groupBoxPushbullet.Size = new System.Drawing.Size(236, 43); this.groupBoxPushbullet.TabIndex = 1; @@ -1029,55 +996,6 @@ namespace KancolleSniffer this.checkBoxPushbulletOn.Text = "有効"; this.checkBoxPushbulletOn.UseVisualStyleBackColor = true; // - // tabPageExternalService - // - this.tabPageExternalService.Controls.Add(this.groupBoxKancolleDb); - this.tabPageExternalService.Location = new System.Drawing.Point(4, 22); - this.tabPageExternalService.Name = "tabPageExternalService"; - this.tabPageExternalService.Padding = new System.Windows.Forms.Padding(3); - this.tabPageExternalService.Size = new System.Drawing.Size(248, 132); - this.tabPageExternalService.TabIndex = 1; - this.tabPageExternalService.Text = "外部サービス"; - this.tabPageExternalService.UseVisualStyleBackColor = true; - // - // groupBoxKancolleDb - // - this.groupBoxKancolleDb.Controls.Add(this.textBoxKancolleDbToken); - this.groupBoxKancolleDb.Controls.Add(this.label8); - this.groupBoxKancolleDb.Controls.Add(this.checkBoxKancolleDbOn); - this.groupBoxKancolleDb.Location = new System.Drawing.Point(6, 6); - this.groupBoxKancolleDb.Name = "groupBoxKancolleDb"; - this.groupBoxKancolleDb.Size = new System.Drawing.Size(234, 47); - this.groupBoxKancolleDb.TabIndex = 0; - this.groupBoxKancolleDb.TabStop = false; - this.groupBoxKancolleDb.Text = "艦これ統計データベース"; - // - // textBoxKancolleDbToken - // - this.textBoxKancolleDbToken.Location = new System.Drawing.Point(121, 20); - this.textBoxKancolleDbToken.Name = "textBoxKancolleDbToken"; - this.textBoxKancolleDbToken.Size = new System.Drawing.Size(107, 19); - this.textBoxKancolleDbToken.TabIndex = 2; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(57, 23); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(63, 12); - this.label8.TabIndex = 1; - this.label8.Text = "アクセスキー:"; - // - // checkBoxKancolleDbOn - // - this.checkBoxKancolleDbOn.AutoSize = true; - this.checkBoxKancolleDbOn.Location = new System.Drawing.Point(6, 22); - this.checkBoxKancolleDbOn.Name = "checkBoxKancolleDbOn"; - this.checkBoxKancolleDbOn.Size = new System.Drawing.Size(48, 16); - this.checkBoxKancolleDbOn.TabIndex = 0; - this.checkBoxKancolleDbOn.Text = "有効"; - this.checkBoxKancolleDbOn.UseVisualStyleBackColor = true; - // // tabPageDebug // this.tabPageDebug.Controls.Add(this.buttonPlayDebugLog); @@ -1227,16 +1145,11 @@ namespace KancolleSniffer this.tabPageLog.ResumeLayout(false); this.tabPageLog.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaterialLogInterval)).EndInit(); - this.tabPageCollabo.ResumeLayout(false); - this.tabControlCollabo.ResumeLayout(false); - this.tabPagePushNotification.ResumeLayout(false); + this.tabPagePush.ResumeLayout(false); this.groupBoxPushover.ResumeLayout(false); this.groupBoxPushover.PerformLayout(); this.groupBoxPushbullet.ResumeLayout(false); this.groupBoxPushbullet.PerformLayout(); - this.tabPageExternalService.ResumeLayout(false); - this.groupBoxKancolleDb.ResumeLayout(false); - this.groupBoxKancolleDb.PerformLayout(); this.tabPageDebug.ResumeLayout(false); this.tabPageDebug.PerformLayout(); this.ResumeLayout(false); @@ -1313,11 +1226,7 @@ namespace KancolleSniffer private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.CheckBox checkBoxPresetAkashi; - private System.Windows.Forms.TabPage tabPageCollabo; - private System.Windows.Forms.GroupBox groupBoxKancolleDb; - private System.Windows.Forms.TextBox textBoxKancolleDbToken; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.CheckBox checkBoxKancolleDbOn; + private System.Windows.Forms.TabPage tabPagePush; private System.Windows.Forms.ComboBox comboBoxZoom; private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label15; @@ -1331,14 +1240,11 @@ namespace KancolleSniffer private System.Windows.Forms.CheckBox checkBoxLocationPerMachine; private System.Windows.Forms.TextBox textBoxPushoverApiKey; private System.Windows.Forms.CheckBox checkBoxPushoverOn; - private System.Windows.Forms.TabControl tabControlCollabo; - private System.Windows.Forms.TabPage tabPagePushNotification; private System.Windows.Forms.GroupBox groupBoxPushover; private System.Windows.Forms.Button buttonPushoverTest; private System.Windows.Forms.Label label16; private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox textBoxPushoverUserKey; - private System.Windows.Forms.TabPage tabPageExternalService; private System.Windows.Forms.CheckBox checkBoxRepeat; private System.Windows.Forms.CheckBox checkBoxBattleResult; private System.Windows.Forms.CheckBox checkBoxAirBattleResult; diff --git a/KancolleSniffer/ConfigDialog.cs b/KancolleSniffer/ConfigDialog.cs index ae76c81..b19c302 100644 --- a/KancolleSniffer/ConfigDialog.cs +++ b/KancolleSniffer/ConfigDialog.cs @@ -100,8 +100,6 @@ namespace KancolleSniffer LoadLogSettings(); LoadDebugSettings(); - checkBoxKancolleDbOn.Checked = _config.KancolleDb.On; - textBoxKancolleDbToken.Text = _config.KancolleDb.Token; checkBoxPushbulletOn.Checked = _config.Pushbullet.On; textBoxPushbulletToken.Text = _config.Pushbullet.Token; checkBoxPushoverOn.Checked = _config.Pushover.On; @@ -145,8 +143,6 @@ namespace KancolleSniffer ApplyLogSettings(); ApplyDebugSettings(); - _config.KancolleDb.On = checkBoxKancolleDbOn.Checked; - _config.KancolleDb.Token = textBoxKancolleDbToken.Text; _config.Pushbullet.On = checkBoxPushbulletOn.Checked; _config.Pushbullet.Token = textBoxPushbulletToken.Text; _config.Pushover.On = checkBoxPushoverOn.Checked; diff --git a/KancolleSniffer/KancolleDb.cs b/KancolleSniffer/KancolleDb.cs deleted file mode 100644 index cada293..0000000 --- a/KancolleSniffer/KancolleDb.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (C) 2015 Kazuhiro Fujieda -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Net; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace KancolleSniffer -{ - public class KancolleDb - { - private readonly BlockingCollection> _queue = - new BlockingCollection>(10); - - private bool _started; - private string _token; - - public void Start(string token) - { - _token = token; - if (_started) - return; - _started = true; - Task.Run(() => - { - try - { - while (true) - { - var e = _queue.Take(); - try - { - using (var wc = new WebClient()) - { - var values = new NameValueCollection - { - {"token", _token}, - {"agent", "KdpR5STmwYTaFpNCbD4N"}, - {"url", e.Item1}, - {"requestbody", e.Item2}, - {"responsebody", e.Item3} - }; - wc.UploadValues("http://api.kancolle-db.net/2/", values); - } - } - catch (WebException) - { - } - } - } - catch (InvalidOperationException) - { - } - }); - } - - private readonly HashSet _urlSet = new HashSet() - { - "/kcsapi/api_port/port", - "/kcsapi/api_get_member/ship2", - "/kcsapi/api_get_member/ship3", - "/kcsapi/api_get_member/slot_item", - "/kcsapi/api_get_member/kdock", - "/kcsapi/api_get_member/mapinfo", - "/kcsapi/api_req_hensei/change", - "/kcsapi/api_req_kousyou/createship", - "/kcsapi/api_req_kousyou/getship", - "/kcsapi/api_req_kousyou/createitem", - "/kcsapi/api_req_map/start", - "/kcsapi/api_req_map/next", - "/kcsapi/api_req_map/select_eventmap_rank", - "/kcsapi/api_req_sortie/battle", - "/kcsapi/api_req_battle_midnight/battle", - "/kcsapi/api_req_battle_midnight/sp_midnight", - "/kcsapi/api_req_sortie/night_to_day", - "/kcsapi/api_req_sortie/battleresult", - "/kcsapi/api_req_combined_battle/battle", - "/kcsapi/api_req_combined_battle/airbattle", - "/kcsapi/api_req_combined_battle/midnight_battle", - "/kcsapi/api_req_combined_battle/battleresult", - "/kcsapi/api_req_sortie/airbattle", - "/kcsapi/api_req_combined_battle/battle_water", - "/kcsapi/api_req_combined_battle/sp_midnight" - }; - - public void Send(string url, string request, string response) - { - if (!_urlSet.Contains(url)) - return; - request = Regex.Replace(request, @"&api%5Ftoken=[^&]+|api%5Ftoken=[^&]+&?", ""); - response = response.Replace("svdata=", ""); - _queue.TryAdd(new Tuple(url, request, response)); - } - - public void Stop() - { - _queue.CompleteAdding(); - } - } -} \ No newline at end of file diff --git a/KancolleSniffer/KancolleSniffer.csproj b/KancolleSniffer/KancolleSniffer.csproj index c793ad9..8b04604 100644 --- a/KancolleSniffer/KancolleSniffer.csproj +++ b/KancolleSniffer/KancolleSniffer.csproj @@ -98,7 +98,6 @@ Component - diff --git a/KancolleSniffer/MainForm.cs b/KancolleSniffer/MainForm.cs index 6404149..ed6051e 100644 --- a/KancolleSniffer/MainForm.cs +++ b/KancolleSniffer/MainForm.cs @@ -50,7 +50,6 @@ namespace KancolleSniffer private DateTime _prev, _now; private readonly ErrorDialog _errorDialog = new ErrorDialog(); - private readonly KancolleDb _kancolleDb = new KancolleDb(); private readonly ErrorLog _errorLog; public MainForm() @@ -143,8 +142,6 @@ namespace KancolleSniffer WriteDebugLog(url, request, response); return; } - if (_config.KancolleDb.On) - _kancolleDb.Send(url, request, response); response = UnescapeString(response.Remove(0, "svdata=".Length)); WriteDebugLog(url, request, response); ProcessRequestMain(url, request, response); @@ -250,8 +247,6 @@ namespace KancolleSniffer ApplyDebugLogSetting(); ApplyLogSetting(); ApplyProxySetting(); - if (_config.KancolleDb.On) - _kancolleDb.Start(_config.KancolleDb.Token); CheckVersionUp((current, latest) => { if (double.Parse(latest) <= double.Parse(current)) @@ -305,7 +300,6 @@ namespace KancolleSniffer _config.ShipList.Visible = _listForm.Visible && _listForm.WindowState == FormWindowState.Normal; _config.Save(); _proxyManager.Shutdown(); - _kancolleDb.Stop(); } private void MainForm_Resize(object sender, EventArgs e) @@ -384,8 +378,6 @@ namespace KancolleSniffer _sniffer.Achievement.ResetHours = _config.ResetHours; labelAkashiRepair.Visible = labelAkashiRepairTimer.Visible = labelPresetAkashiTimer.Visible = _config.UsePresetAkashi; - if (_config.KancolleDb.On) - _kancolleDb.Start(_config.KancolleDb.Token); } public void ApplyDebugLogSetting()