diff --git a/assemblies/mshtml.dll b/assemblies/mshtml.dll deleted file mode 100644 index ef85196b6..000000000 Binary files a/assemblies/mshtml.dll and /dev/null differ diff --git a/source/Grabacr07.KanColleViewer/Composition/LoadFailedPluginData.cs b/source/Grabacr07.KanColleViewer/Composition/LoadFailedPluginData.cs index 0075b4179..f78dd5deb 100644 --- a/source/Grabacr07.KanColleViewer/Composition/LoadFailedPluginData.cs +++ b/source/Grabacr07.KanColleViewer/Composition/LoadFailedPluginData.cs @@ -9,7 +9,7 @@ public class LoadFailedPluginData { public string FilePath { get; set; } - public string Exception { get; set; } + public string Message { get; set; } public PluginMetadata Metadata { get; set; } } diff --git a/source/Grabacr07.KanColleViewer/Composition/PluginHost.cs b/source/Grabacr07.KanColleViewer/Composition/PluginHost.cs index 3e6fc9030..087c9cd2d 100644 --- a/source/Grabacr07.KanColleViewer/Composition/PluginHost.cs +++ b/source/Grabacr07.KanColleViewer/Composition/PluginHost.cs @@ -121,7 +121,7 @@ public void Initialize() this.failedPlugins.Add(new LoadFailedPluginData { FilePath = filepath, - Exception = ex.LoaderExceptions.Select(x => x.Message).ToString(Environment.NewLine), + Message = ex.LoaderExceptions.Select(x => x.Message).ToString(Environment.NewLine), }); } catch (BadImageFormatException ex) @@ -129,7 +129,7 @@ public void Initialize() this.failedPlugins.Add(new LoadFailedPluginData { FilePath = filepath, - Exception = ex.ToString(), + Message = ex.ToString(), }); } catch (FileLoadException ex) @@ -137,7 +137,7 @@ public void Initialize() this.failedPlugins.Add(new LoadFailedPluginData { FilePath = filepath, - Exception = ex.ToString(), + Message = ex.ToString(), }); } } @@ -177,6 +177,8 @@ public TContract[] Get() private IEnumerable Load(IEnumerable> imported) { + var ids = new HashSet(); + foreach (var lazy in imported) { Guid guid; @@ -199,7 +201,7 @@ private IEnumerable Load(IEnumerable> imp { FilePath = x?.Assembly.Location, Metadata = plugin.Metadata, - Exception = ex.ToString(), + Message = ex.ToString(), }); this.failedPlugins.AddRange(failds); } @@ -208,8 +210,18 @@ private IEnumerable Load(IEnumerable> imp this.failedPlugins.Add(new LoadFailedPluginData { Metadata = plugin.Metadata, - Exception = ex.ToString(), + Message = ex.ToString(), + }); + } + + if (!ids.Add(plugin.Id)) + { + this.failedPlugins.Add(new LoadFailedPluginData + { + Metadata = plugin.Metadata, + Message = "プラグインの ID が重複しています。" + Environment.NewLine + "プラグインには一意の GUID が必要です。プラグインの開発者に連絡してください。", }); + success = false; } if (success) @@ -241,7 +253,7 @@ private void Load(IEnumerable> imported) this.failedPlugins.Add(new LoadFailedPluginData { Metadata = plugin.Metadata, - Exception = ex.ToString(), + Message = ex.ToString(), }); } } diff --git a/source/Grabacr07.KanColleViewer/KanColleViewer.csproj b/source/Grabacr07.KanColleViewer/KanColleViewer.csproj index 382364bbf..b84579b25 100644 --- a/source/Grabacr07.KanColleViewer/KanColleViewer.csproj +++ b/source/Grabacr07.KanColleViewer/KanColleViewer.csproj @@ -81,10 +81,6 @@ ..\packages\LivetCask.1.3.1.0\lib\net45\Microsoft.Expression.Interactions.dll True - - ..\..\assemblies\mshtml.dll - True - ..\packages\Nekoxy.1.5.2.20\lib\net45\Nekoxy.dll True @@ -632,6 +628,15 @@ + + {3050F1C5-98B5-11CF-BB82-00AA00BDCE0B} + 4 + 0 + 0 + tlbimp + False + True + {EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B} 1 diff --git a/source/Grabacr07.KanColleViewer/Properties/Resources.Designer.cs b/source/Grabacr07.KanColleViewer/Properties/Resources.Designer.cs index 3ba16908e..7e9d01ab8 100644 --- a/source/Grabacr07.KanColleViewer/Properties/Resources.Designer.cs +++ b/source/Grabacr07.KanColleViewer/Properties/Resources.Designer.cs @@ -3004,6 +3004,33 @@ public static string ShipCatalog_Filter_Misc_All { } } + /// + /// Looks up a localized string similar to condition. + /// + public static string ShipCatalog_Filter_Misc_Condition { + get { + return ResourceManager.GetString("ShipCatalog_Filter_Misc_Condition", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 50 以上. + /// + public static string ShipCatalog_Filter_Misc_ConditionAbove50 { + get { + return ResourceManager.GetString("ShipCatalog_Filter_Misc_ConditionAbove50", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 50 未満. + /// + public static string ShipCatalog_Filter_Misc_ConditionBelow50 { + get { + return ResourceManager.GetString("ShipCatalog_Filter_Misc_ConditionBelow50", resourceCulture); + } + } + /// /// Looks up a localized string similar to 損傷. /// diff --git a/source/Grabacr07.KanColleViewer/Properties/Resources.en.resx b/source/Grabacr07.KanColleViewer/Properties/Resources.en.resx index 649a8f717..1a61e889f 100644 --- a/source/Grabacr07.KanColleViewer/Properties/Resources.en.resx +++ b/source/Grabacr07.KanColleViewer/Properties/Resources.en.resx @@ -1450,4 +1450,13 @@ Small Radar LoS × (1.00) + Large Radar LoS × (0.99) + Fleet composition OK + + Morale + + + Above 50 + + + Below 50 + \ No newline at end of file diff --git a/source/Grabacr07.KanColleViewer/Properties/Resources.resx b/source/Grabacr07.KanColleViewer/Properties/Resources.resx index 521f13eae..46c915678 100644 --- a/source/Grabacr07.KanColleViewer/Properties/Resources.resx +++ b/source/Grabacr07.KanColleViewer/Properties/Resources.resx @@ -1454,4 +1454,13 @@ HTTP プロトコルの通信は自動構成も含め「インターネット 艦隊編成は正常です + + condition + + + 50 以上 + + + 50 未満 + \ No newline at end of file diff --git a/source/Grabacr07.KanColleViewer/ViewModels/Composition/LoadFailedPluginViewModel.cs b/source/Grabacr07.KanColleViewer/ViewModels/Composition/LoadFailedPluginViewModel.cs index f36811226..a8225ae52 100644 --- a/source/Grabacr07.KanColleViewer/ViewModels/Composition/LoadFailedPluginViewModel.cs +++ b/source/Grabacr07.KanColleViewer/ViewModels/Composition/LoadFailedPluginViewModel.cs @@ -71,7 +71,7 @@ public LoadFailedPluginViewModel(LoadFailedPluginData data) { this.Metadata = data.Metadata ?? new BlacklistedAssembly { Name = Path.GetFileName(data.FilePath) } as object; - using (var reader = new StringReader(data.Exception)) + using (var reader = new StringReader(data.Message)) { this.Message = reader.ReadLine(); this.Exception = reader.ReadToEnd(); diff --git a/source/Grabacr07.KanColleViewer/Views/Behaviors/ScreenshotAction.cs b/source/Grabacr07.KanColleViewer/Views/Behaviors/ScreenshotAction.cs index d520e201d..4b981e017 100644 --- a/source/Grabacr07.KanColleViewer/Views/Behaviors/ScreenshotAction.cs +++ b/source/Grabacr07.KanColleViewer/Views/Behaviors/ScreenshotAction.cs @@ -9,7 +9,7 @@ using Grabacr07.KanColleViewer.Win32; using Livet.Behaviors.Messaging; using Livet.Messaging; -using mshtml; +using MSHTML; using SHDocVw; using IServiceProvider = Grabacr07.KanColleViewer.Win32.IServiceProvider; using WebBrowser = System.Windows.Controls.WebBrowser; diff --git a/source/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml b/source/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml index 840b95383..7f05f807b 100644 --- a/source/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml +++ b/source/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml @@ -437,15 +437,15 @@ - + - - - diff --git a/source/Grabacr07.KanColleViewer/Views/Controls/KanColleHost.cs b/source/Grabacr07.KanColleViewer/Views/Controls/KanColleHost.cs index 966bb25a7..a026481bb 100644 --- a/source/Grabacr07.KanColleViewer/Views/Controls/KanColleHost.cs +++ b/source/Grabacr07.KanColleViewer/Views/Controls/KanColleHost.cs @@ -9,9 +9,9 @@ using System.Windows.Navigation; using Grabacr07.KanColleViewer.Models; using Grabacr07.KanColleViewer.ViewModels; -using mshtml; using MetroRadiance.Interop; using MetroTrilithon.UI.Controls; +using MSHTML; using SHDocVw; using IServiceProvider = Grabacr07.KanColleViewer.Win32.IServiceProvider; using WebBrowser = System.Windows.Controls.WebBrowser; @@ -35,6 +35,7 @@ static KanColleHost() private ScrollViewer scrollViewer; private bool styleSheetApplied; private Dpi? systemDpi; + private bool firstLoaded; #region WebBrowser 依存関係プロパティ @@ -151,7 +152,7 @@ public void Update() var zoomFactor = dpi.ScaleX + (this.ZoomFactor - 1.0); var percentage = (int)(zoomFactor * 100); - ApplyZoomFactor(this.WebBrowser, percentage); + ApplyZoomFactor(this, percentage); var size = this.styleSheetApplied ? KanColleSize : InitialSize; size = new Size( @@ -163,8 +164,10 @@ public void Update() this.OwnerSizeChangeRequested?.Invoke(this, size); } - private static void ApplyZoomFactor(WebBrowser target, int zoomFactor) + private static void ApplyZoomFactor(KanColleHost target, int zoomFactor) { + if (!target.firstLoaded) return; + if (zoomFactor < 10 || zoomFactor > 1000) { StatusService.Current.Notify(string.Format(Properties.Resources.ZoomAction_OutOfRange, zoomFactor)); @@ -173,7 +176,7 @@ private static void ApplyZoomFactor(WebBrowser target, int zoomFactor) try { - var provider = target.Document as IServiceProvider; + var provider = target.WebBrowser.Document as IServiceProvider; if (provider == null) return; object ppvObject; @@ -200,6 +203,7 @@ private void HandleLoadCompleted(object sender, NavigationEventArgs e) this.ApplyStyleSheet(); WebBrowserHelper.SetScriptErrorsSuppressed(this.WebBrowser, true); + this.firstLoaded = true; this.Update(); } @@ -214,6 +218,8 @@ private void HandleWebBrowserNewWindow(string url, int flags, string targetFrame private void ApplyStyleSheet() { + if (!this.firstLoaded) return; + try { var document = this.WebBrowser.Document as HTMLDocument; diff --git a/source/Grabacr07.KanColleViewer/bin/Debug/Plugins/EventMapHpViewer.dll b/source/Grabacr07.KanColleViewer/bin/Debug/Plugins/EventMapHpViewer.dll index a37677d3a..838c21504 100644 Binary files a/source/Grabacr07.KanColleViewer/bin/Debug/Plugins/EventMapHpViewer.dll and b/source/Grabacr07.KanColleViewer/bin/Debug/Plugins/EventMapHpViewer.dll differ diff --git a/source/Grabacr07.KanColleViewer/bin/Release (beta)/Plugins/EventMapHpViewer.dll b/source/Grabacr07.KanColleViewer/bin/Release (beta)/Plugins/EventMapHpViewer.dll index a3cc61855..1d6e8639c 100644 Binary files a/source/Grabacr07.KanColleViewer/bin/Release (beta)/Plugins/EventMapHpViewer.dll and b/source/Grabacr07.KanColleViewer/bin/Release (beta)/Plugins/EventMapHpViewer.dll differ diff --git a/source/Grabacr07.KanColleViewer/bin/Release/Plugins/EventMapHpViewer.dll b/source/Grabacr07.KanColleViewer/bin/Release/Plugins/EventMapHpViewer.dll index a3cc61855..1d6e8639c 100644 Binary files a/source/Grabacr07.KanColleViewer/bin/Release/Plugins/EventMapHpViewer.dll and b/source/Grabacr07.KanColleViewer/bin/Release/Plugins/EventMapHpViewer.dll differ diff --git a/source/Grabacr07.KanColleWrapper/KanColleClient.cs b/source/Grabacr07.KanColleWrapper/KanColleClient.cs index c93bd0c6c..7b45cfc58 100644 --- a/source/Grabacr07.KanColleWrapper/KanColleClient.cs +++ b/source/Grabacr07.KanColleWrapper/KanColleClient.cs @@ -6,10 +6,8 @@ using System.Reactive.Threading.Tasks; using System.Threading; using System.Threading.Tasks; -using Grabacr07.KanColleWrapper.Internal; using Grabacr07.KanColleWrapper.Models; using Grabacr07.KanColleWrapper.Models.Raw; -using MetroTrilithon.Threading.Tasks; namespace Grabacr07.KanColleWrapper { @@ -123,20 +121,15 @@ private KanColleClient() public void Initialieze() { var proxy = this.Proxy ?? (this.Proxy = new KanColleProxy()); - var requireInfo = proxy.api_get_member_require_info.TryParse().FirstAsync().ToTask(); - //var basic = proxy.api_get_member_basic.TryParse().FirstAsync().ToTask(); - //var kdock = proxy.api_get_member_kdock.TryParse().FirstAsync().ToTask(); - //var sitem = proxy.api_get_member_slot_item.TryParse().FirstAsync().ToTask(); + var requireInfoSource = proxy.api_get_member_require_info + .TryParse() + .FirstAsync() + .ToTask(); proxy.api_start2.FirstAsync().Subscribe(async session => { var timeout = Task.Delay(TimeSpan.FromSeconds(20)); - var canInitialize = await Task.WhenAny(new Task[] { requireInfo }.WhenAll(), timeout) != timeout; - - // タイムアウト仕掛けてるのは、今後のアップデートで basic, kdock, slot_item のいずれかが来なくなったときに - // 起動できなくなる (IsStarted を true にできなくなる) のを防ぐため - // ----- - // ま、そんな規模の変更があったらそもそもまともに動作せんだろうがな ☝(◞‸◟)☝ 野良ツールはつらいよ + var canInitialize = await Task.WhenAny(requireInfoSource, timeout) != timeout; SvData svd; if (!SvData.TryParse(session, out svd)) return; @@ -146,10 +139,10 @@ public void Initialieze() if (canInitialize) { - var data = await requireInfo; - this.Homeport.UpdateAdmiral(data.Data.api_basic); - this.Homeport.Itemyard.Update(data.Data.api_slot_item); - this.Homeport.Dockyard.Update(data.Data.api_kdock); + var requireInfo = await requireInfoSource; + this.Homeport.UpdateAdmiral(requireInfo.Data.api_basic); + this.Homeport.Itemyard.Update(requireInfo.Data.api_slot_item); + this.Homeport.Dockyard.Update(requireInfo.Data.api_kdock); } this.IsStarted = true; diff --git a/source/Grabacr07.KanColleWrapper/Models/Raw/kcsapi_require_info.cs b/source/Grabacr07.KanColleWrapper/Models/Raw/kcsapi_require_info.cs index 34a57097a..e3a7eb608 100644 --- a/source/Grabacr07.KanColleWrapper/Models/Raw/kcsapi_require_info.cs +++ b/source/Grabacr07.KanColleWrapper/Models/Raw/kcsapi_require_info.cs @@ -1,18 +1,18 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; +// ReSharper disable InconsistentNaming namespace Grabacr07.KanColleWrapper.Models.Raw { - public class kcsapi_require_info - { - public kcsapi_basic api_basic { get; set; } - public kcsapi_slotitem[] api_slot_item { get; set; } - //public Api_Unsetslot api_unsetslot { get; set; } - public kcsapi_kdock[] api_kdock { get; set; } - public kcsapi_useitem[] api_useitem { get; set; } - //public Api_Furniture[] api_furniture { get; set; } - } + public class kcsapi_require_info + { + public kcsapi_basic api_basic { get; set; } + public kcsapi_slotitem[] api_slot_item { get; set; } + //public Api_Unsetslot api_unsetslot { get; set; } + public kcsapi_kdock[] api_kdock { get; set; } + public kcsapi_useitem[] api_useitem { get; set; } + //public Api_Furniture[] api_furniture { get; set; } + } }