From 0d7a57378a31dc6ee370192339e2da86fad899a7 Mon Sep 17 00:00:00 2001 From: MyAngelKamikaze <40002167+myangelkamikaze@users.noreply.github.com> Date: Thu, 27 Dec 2018 14:28:31 +0900 Subject: [PATCH] Export for https://kancolle-fleetanalysis.firebaseapp.com added --- .../Window/FormFleet.Designer.cs | 22 +++++++++---- ElectronicObserver/Window/FormFleet.cs | 31 ++++++++++++++++++- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/ElectronicObserver/Window/FormFleet.Designer.cs b/ElectronicObserver/Window/FormFleet.Designer.cs index 2cf1d7c10..214bb0562 100644 --- a/ElectronicObserver/Window/FormFleet.Designer.cs +++ b/ElectronicObserver/Window/FormFleet.Designer.cs @@ -23,7 +23,8 @@ private void InitializeComponent() this.ContextMenuFleet_CopyFleet = new System.Windows.Forms.ToolStripMenuItem(); this.ContextMenuFleet_CopyFleetDeckBuilder = new System.Windows.Forms.ToolStripMenuItem(); this.ContextMenuFleet_CopyKanmusuList = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.ContextMenuFleet_CopyFleetAnalysis = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.ContextMenuFleet_AntiAirDetails = new System.Windows.Forms.ToolStripMenuItem(); this.ContextMenuFleet_Capture = new System.Windows.Forms.ToolStripMenuItem(); this.ContextMenuFleet_OutputFleetImage = new System.Windows.Forms.ToolStripMenuItem(); @@ -75,6 +76,7 @@ private void InitializeComponent() this.ContextMenuFleet_CopyFleet, this.ContextMenuFleet_CopyFleetDeckBuilder, this.ContextMenuFleet_CopyKanmusuList, + this.ContextMenuFleet_CopyFleetAnalysis, this.toolStripSeparator1, this.ContextMenuFleet_AntiAirDetails, this.ContextMenuFleet_Capture, @@ -103,10 +105,17 @@ private void InitializeComponent() this.ContextMenuFleet_CopyKanmusuList.Size = new System.Drawing.Size(227, 22); this.ContextMenuFleet_CopyKanmusuList.Text = "Copy Ship &List (kancolle-calc)"; this.ContextMenuFleet_CopyKanmusuList.Click += new System.EventHandler(this.ContextMenuFleet_CopyKanmusuList_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; + // + // ContextMenuFleet_CopyFleetAnalysis + // + this.ContextMenuFleet_CopyFleetAnalysis.Name = "ContextMenuFleet_CopyFleetAnalysis"; + this.ContextMenuFleet_CopyFleetAnalysis.Size = new System.Drawing.Size(227, 22); + this.ContextMenuFleet_CopyFleetAnalysis.Text = "Copy Ship List (&fleetanalysis)"; + this.ContextMenuFleet_CopyFleetAnalysis.Click += new System.EventHandler(this.ContextMenuFleet_CopyFleetAnalysis_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(224, 6); // // ContextMenuFleet_AntiAirDetails @@ -171,7 +180,8 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_CopyFleetDeckBuilder; private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_CopyKanmusuList; - private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_AntiAirDetails; + private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_CopyFleetAnalysis; + private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_AntiAirDetails; private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_OutputFleetImage; } } diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index 356f741c9..df5f76f94 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -1222,7 +1222,36 @@ private void ContextMenuFleet_CopyKanmusuList_Click(object sender, EventArgs e) } - private void ContextMenuFleet_AntiAirDetails_Click(object sender, EventArgs e) + /// + /// + /// + /// + private void ContextMenuFleet_CopyFleetAnalysis_Click(object sender, EventArgs e) + { + + StringBuilder sb = new StringBuilder(); + KCDatabase db = KCDatabase.Instance; + + // 手書き json の悲しみ + // pain and suffering + + sb.Append("["); + + foreach (var ship in db.Ships.Values.Where(s => s.IsLocked)) + { + if (ship == null) break; + + sb.Append($"{{\"api_ship_id\":{ship.ShipID},\"api_lv\":{ship.Level},\"api_kyouka\":[{ship.FirepowerModernized},{ship.TorpedoModernized},{ship.AAModernized},{ship.ArmorModernized},{ship.LuckModernized},{ship.HPMaxModernized},{ship.ASWModernized}]}},"); + } + + sb.Remove(sb.Length - 1, 1); // remove "," + sb.Append("]"); + + Clipboard.SetData(DataFormats.StringFormat, sb.ToString()); + } + + + private void ContextMenuFleet_AntiAirDetails_Click(object sender, EventArgs e) { var dialog = new DialogAntiAirDefense();