OSDN Git Service

kancolle-db.netへの送信機能を削除する
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Sat, 27 Jan 2018 05:12:14 +0000 (14:12 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Sat, 27 Jan 2018 11:47:41 +0000 (20:47 +0900)
KancolleSniffer/Config.cs
KancolleSniffer/ConfigDialog.Designer.cs
KancolleSniffer/ConfigDialog.cs
KancolleSniffer/KancolleDb.cs [deleted file]
KancolleSniffer/KancolleSniffer.csproj
KancolleSniffer/MainForm.cs

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