From 09d71c395706cf5e49bbec11f90cf76cff30cd30 Mon Sep 17 00:00:00 2001 From: Yi Lu Date: Sat, 5 Mar 2022 14:59:30 +0800 Subject: [PATCH 1/3] fix shipname in unicode character fix #22 add a workaround to fix it. ref:https://stackoverflow.com/questions/47549512/how-can-i-deserialize-json-with-u-unicode-markup-in-java --- .../Serialization/Esi/EsiAPIShip.cs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/EVEMon.Common/Serialization/Esi/EsiAPIShip.cs b/src/EVEMon.Common/Serialization/Esi/EsiAPIShip.cs index 2a2728771..88acde894 100644 --- a/src/EVEMon.Common/Serialization/Esi/EsiAPIShip.cs +++ b/src/EVEMon.Common/Serialization/Esi/EsiAPIShip.cs @@ -1,4 +1,5 @@ using System.Runtime.Serialization; +using System.Text.RegularExpressions; namespace EVEMon.Common.Serialization.Esi { @@ -15,7 +16,26 @@ public sealed class EsiAPIShip [DataMember(Name = "ship_item_id")] public long ShipItemID { get; set; } + private string _ShipName; [DataMember(Name = "ship_name")] - public string ShipName { get; set; } + public string ShipName + { + get { return _ShipName; } + set + { + Regex pattern = new Regex(@"^u'(.*)'$"); + Match match = pattern.Match(value); + if(match.Success) + { + _ShipName = Regex.Unescape(match.Groups[1].Value); + } + else + { + _ShipName = value; + } + } + } + + } } From 44c7ff539ed536bcba6870b4e63d171c1ce1e2db Mon Sep 17 00:00:00 2001 From: luyi1888 Date: Sat, 5 Mar 2022 15:13:44 +0800 Subject: [PATCH 2/3] fix indent --- src/EVEMon.Common/Serialization/Esi/EsiAPIShip.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EVEMon.Common/Serialization/Esi/EsiAPIShip.cs b/src/EVEMon.Common/Serialization/Esi/EsiAPIShip.cs index 88acde894..1b93f6755 100644 --- a/src/EVEMon.Common/Serialization/Esi/EsiAPIShip.cs +++ b/src/EVEMon.Common/Serialization/Esi/EsiAPIShip.cs @@ -25,7 +25,7 @@ public string ShipName { Regex pattern = new Regex(@"^u'(.*)'$"); Match match = pattern.Match(value); - if(match.Success) + if (match.Success) { _ShipName = Regex.Unescape(match.Groups[1].Value); } From edec5f1be99e04b53f7c8503f77189832157622e Mon Sep 17 00:00:00 2001 From: Yi Lu Date: Sat, 5 Mar 2022 16:16:27 +0800 Subject: [PATCH 3/3] Append the number of skills in the skill queue to remaining time description fix #25 It will append the number of skills in the skill queue to remaining time description in the Overview tab and the bottom of Character tab. --- src/EVEMon.Common/Models/SkillQueue.cs | 12 ++++++++++++ .../CharacterMonitoring/CharacterMonitorFooter.cs | 3 ++- src/EVEMon/Controls/OverviewItem.cs | 5 +++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/EVEMon.Common/Models/SkillQueue.cs b/src/EVEMon.Common/Models/SkillQueue.cs index bb878cb5d..646b8f5f5 100644 --- a/src/EVEMon.Common/Models/SkillQueue.cs +++ b/src/EVEMon.Common/Models/SkillQueue.cs @@ -260,6 +260,18 @@ public double GetOneDaySkillQueueWidth(int width) return Math.Floor(WarningThresholdTimeSpan.TotalSeconds / totalSeconds * width); } + public string GetCountInSkillQueueDescription() + { + if (this.Count > 1) + { + return string.Format("{0} skills", this.Count); + } + else + { + return string.Format("{0} skill", this.Count); + } + } + #endregion } } diff --git a/src/EVEMon/CharacterMonitoring/CharacterMonitorFooter.cs b/src/EVEMon/CharacterMonitoring/CharacterMonitorFooter.cs index 02609af08..79f59258a 100644 --- a/src/EVEMon/CharacterMonitoring/CharacterMonitorFooter.cs +++ b/src/EVEMon/CharacterMonitoring/CharacterMonitorFooter.cs @@ -202,7 +202,8 @@ private void UpdateSkillQueueInfo() // Update the remaining queue time label DateTime queueEndTime = ccpCharacter.SkillQueue.EndTime; - lblQueueRemaining.Text = queueEndTime.ToRemainingTimeDescription(DateTimeKind.Utc); + lblQueueRemaining.Text = string.Format("{0} ({1})", queueEndTime.ToRemainingTimeDescription(DateTimeKind.Utc), + ccpCharacter.SkillQueue.GetCountInSkillQueueDescription()); } /// diff --git a/src/EVEMon/Controls/OverviewItem.cs b/src/EVEMon/Controls/OverviewItem.cs index 59d2a0466..2b1a2b89f 100644 --- a/src/EVEMon/Controls/OverviewItem.cs +++ b/src/EVEMon/Controls/OverviewItem.cs @@ -533,8 +533,9 @@ private void UpdateSkillQueueTrainingTime() // More than one entry in queue ? Display total queue remaining time if (ccpCharacter.SkillQueue.Count > 1) { - text = "Queue ends in " + ccpCharacter.SkillQueue.EndTime. - ToRemainingTimeShortDescription(DateTimeKind.Utc); + text = string.Format("Queue ends in {0} ({1})", ccpCharacter.SkillQueue.EndTime. + ToRemainingTimeShortDescription(DateTimeKind.Utc), + ccpCharacter.SkillQueue.GetCountInSkillQueueDescription()); } } // Skill queue is empty ?