├── .gitignore ├── .gitmodules ├── KcvPlugins ├── BattleLog │ ├── Converters │ │ └── SimpleShipConverter.cs │ ├── Data │ │ ├── ResourceService.cs │ │ └── Settings.cs │ ├── Entrance.cs │ ├── Enums │ │ ├── BattleSortTarget.cs │ │ └── BattleType.cs │ ├── Extensions │ │ └── ViewRangeEx.cs │ ├── Helper │ │ ├── AdmiralInfoHelper.cs │ │ ├── BattleLogsHelper.cs │ │ ├── LogsHelperBase.cs │ │ └── LogsHelperBase_Analysis.cs │ ├── Logger.csproj │ ├── Modes │ │ ├── AdmiralInfo.cs │ │ ├── AdmiralInfoChangeEventArgs.cs │ │ ├── AdmiralInfoList.cs │ │ ├── BattleEndEventArgs.cs │ │ ├── BattleResult.cs │ │ ├── BattleResultLists.cs │ │ ├── CombinedBattleEndEventArgs.cs │ │ ├── ILogsList.cs │ │ ├── IResult.cs │ │ ├── SimpleAdmiral.cs │ │ └── SimpleShip.cs │ ├── Modules │ │ ├── InitModules.cs │ │ └── LoggerModules.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── TextResource.Designer.cs │ ├── TextResource.resx │ ├── ViewModels │ │ ├── BattleLogViewModel.cs │ │ ├── Item │ │ │ ├── BattleResultViewModel.cs │ │ │ ├── MissionViewModel.cs │ │ │ └── SimpleShipViewModel.cs │ │ ├── LoggerViewModel.cs │ │ ├── SettingsViewModel.cs │ │ └── Sortable │ │ │ ├── BattleFilter.cs │ │ │ ├── BattleSortWorker.cs │ │ │ └── SortableColumnViewModel.cs │ ├── Views │ │ ├── BattleLogWindow.xaml │ │ ├── BattleLogWindow.xaml.cs │ │ ├── SettingsControl.xaml │ │ └── SettingsControl.xaml.cs │ ├── mome.txt │ └── packages.config ├── DebugExtensions │ ├── Data │ │ └── ResourceService.cs │ ├── DebugExtensions.csproj │ ├── Entrance.cs │ ├── Helper │ │ ├── ErrorLogHelper.cs │ │ ├── LogHelper.cs │ │ └── MessageLogHelper.cs │ ├── Modules │ │ ├── InitModules.cs │ │ └── LogsModules.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── TextResource.Designer.cs │ ├── TextResource.resx │ ├── ViewModels │ │ └── SettingsViewModel.cs │ ├── Views │ │ ├── SettingsControl.xaml │ │ └── SettingsControl.xaml.cs │ └── packages.config ├── KcvPlugins.sln ├── KcvPlugins │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── KcvPlugins.csproj │ ├── KcvSimulationWindow.xaml │ ├── KcvSimulationWindow.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── OpenToastWindow.xaml │ ├── OpenToastWindow.xaml.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ToastItemControl.xaml │ ├── ToastItemControl.xaml.cs │ ├── ToastWindow.xaml │ ├── ToastWindow.xaml.cs │ ├── Window1.xaml │ ├── Window1.xaml.cs │ ├── img │ │ └── 17.ico │ └── sounds │ │ └── notify.wav ├── Plugins.Core │ ├── Backup │ │ ├── propex.snippet │ │ └── propsetting.snippet │ ├── Collections │ │ └── Generic.cs │ ├── Enums │ │ ├── MessageType.cs │ │ ├── ModulesChangeEventArgsType.cs │ │ ├── ModulesType.cs │ │ └── ShipStatus.cs │ ├── Extensions │ │ ├── ArrayEx.cs │ │ ├── DistinctExtensions.cs │ │ ├── EnumEx.cs │ │ ├── IEnumerableEx.cs │ │ ├── LimitedValueEx.cs │ │ └── ReflectionEx.cs │ ├── GenericMessager.cs │ ├── Helper │ │ ├── JsonHelper.cs │ │ ├── KcvMainWindowControlHelper.cs │ │ ├── MessageBoxDialog.cs │ │ ├── PenetrateHelper.cs │ │ ├── TextFileHelper.cs │ │ ├── ThreadHelper.cs │ │ ├── ToolWindowHelper.cs │ │ └── UIHelper.cs │ ├── Models │ │ ├── MessageAction.cs │ │ ├── MessageItem.cs │ │ ├── ModulesChangeEventArgs.cs │ │ └── ModulesItem.cs │ ├── Modules │ │ ├── InitModules.cs │ │ ├── MessagerModules.cs │ │ ├── ModulesBase.cs │ │ └── PublicModules.cs │ ├── Plugins.Core.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── StaticData.cs │ ├── Styles │ │ ├── Controls.xaml │ │ ├── Generic.xaml │ │ └── Slider.Metro.xaml │ ├── TextResource.Designer.cs │ ├── TextResource.resx │ ├── ViewModels │ │ └── ViewModelEx.cs │ ├── Views │ │ ├── MessageBoxDialog.xaml │ │ └── MessageBoxDialog.xaml.cs │ ├── Win32 │ │ ├── ToolWindow.cs │ │ └── Window.cs │ ├── logs.txt │ └── packages.config ├── QuestsExtensions │ ├── Converters │ │ └── QuestConverter.cs │ ├── Data │ │ ├── LocalQuests.cs │ │ ├── LocalQuestsSettings.cs │ │ ├── ResourceService.cs │ │ └── Settings.cs │ ├── Entrance.cs │ ├── EntranceSettings.cs │ ├── Extensions │ │ └── QuestEx.cs │ ├── Helper │ │ └── QuestHelper.cs │ ├── Models │ │ ├── Quest.cs │ │ └── QuestsResource.cs │ ├── Modules │ │ ├── InitModules.cs │ │ ├── ModulesBase.cs │ │ └── QuestsModules.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── QuestsExtensions.csproj │ ├── TextResource.Designer.cs │ ├── TextResource.resx │ ├── ViewModels │ │ ├── QuestViewModelEx.cs │ │ ├── QuestsViewModelEx.cs │ │ └── SettingsViewModel.cs │ ├── Views │ │ ├── QuestControl.xaml │ │ ├── QuestControl.xaml.cs │ │ ├── SettingsControl.xaml │ │ └── SettingsControl.xaml.cs │ ├── XmlFile │ │ ├── QuestsResource.zh-cn.xml │ │ └── Settings.xml │ └── packages.config ├── SettingsExtensions │ ├── Controls │ │ ├── AppendProperty.cs │ │ ├── ConditionDataTemplateSelector.cs │ │ ├── FeetStyleTypeDataTemplateSelector.cs │ │ └── WindowViewTypeDataTemplateSelector.cs │ ├── Converters │ │ ├── ArcLimitedValueConverter.cs │ │ ├── FleetsColorConverter.cs │ │ ├── FleetsConverter.cs │ │ ├── FuelColorConverter.cs │ │ ├── KeySettingNameConverter.cs │ │ ├── KeySettingTypeConverter.cs │ │ └── WarningColorConverter.cs │ ├── Data │ │ ├── KeySetting.cs │ │ ├── ResourceService.cs │ │ └── Settings.cs │ ├── Entrance.cs │ ├── Entrance_Hotkey.cs │ ├── Enums │ │ ├── FeetStyleType.cs │ │ ├── KeyType.cs │ │ └── WindowViewType.cs │ ├── Extensions │ │ └── KanColleHostEx.cs │ ├── Helper │ │ ├── HotKeyHelper.cs │ │ ├── KeysHelper.cs │ │ ├── ThemeHelper.cs │ │ ├── WindowStateHelper.cs │ │ └── WindowViewHelper.cs │ ├── Models │ │ ├── KeyModulesItem.cs │ │ ├── KeySetting.cs │ │ ├── MessageAction.cs.bak │ │ ├── SetMessage.cs.bak │ │ └── ThemeItem.cs │ ├── Modules │ │ ├── ExitTipModules.cs │ │ ├── Generic │ │ │ ├── HotKeyHelper.cs │ │ │ └── MessagerHelper.cs.bak │ │ ├── InitModules.cs │ │ ├── KeysModules.cs │ │ ├── MainWindowModules.cs │ │ ├── NotifyIconModules.cs │ │ ├── PublicModulesKeys.cs │ │ ├── SimpleFleetModules.cs │ │ ├── ThemeModules.cs │ │ └── WindowViewModules.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SampleData │ │ ├── FleetViewModelSampleData.xaml │ │ └── FleetsViewModelSampleData.xaml │ ├── SettingsExtensions.csproj │ ├── TextResource.Designer.cs │ ├── TextResource.en.resx │ ├── TextResource.resx │ ├── ViewModels │ │ ├── Collections │ │ │ ├── ListViewModels.cs │ │ │ └── ThemeListViewModels.cs │ │ ├── Items │ │ │ ├── FeetStyleTypeViewModel.cs │ │ │ ├── KeyModulesItemViewModel.cs │ │ │ ├── SelectedItemViewModel.cs │ │ │ ├── ThemeItemViewModel.cs │ │ │ └── WindowViewTypeViewModel.cs │ │ ├── KeysSettingsViewModel.cs │ │ ├── SettingsViewModel.cs │ │ └── SimpleFleetViewModel.cs.bak │ ├── Views │ │ ├── ContainerWindow.xaml │ │ ├── ContainerWindow.xaml.cs │ │ ├── KeysSettingsControl.xaml │ │ ├── KeysSettingsControl.xaml.cs │ │ ├── MessageBoxDialog.xaml │ │ ├── MessageBoxDialog.xaml.cs │ │ ├── SettingsControl.xaml │ │ ├── SettingsControl.xaml.cs │ │ ├── Simple │ │ │ ├── ExpeditionsControl.xaml │ │ │ ├── ExpeditionsControl.xaml.cs │ │ │ ├── FleetControl.xaml │ │ │ ├── FleetControl.xaml.cs │ │ │ ├── QuestsControl.xaml │ │ │ ├── QuestsControl.xaml.cs │ │ │ ├── ShipyardControl.xaml │ │ │ └── ShipyardControl.xaml.cs │ │ ├── SimpleFleetWindow.xaml │ │ ├── SimpleFleetWindow.xaml.cs │ │ ├── SplitWindowButton.xaml │ │ ├── SplitWindowButton.xaml.cs │ │ ├── TabsWindowButton.xaml │ │ └── TabsWindowButton.xaml.cs │ ├── Win32 │ │ └── HotKey.cs │ ├── memo.txt │ ├── packages.config │ └── readme.SettingsExtensions.txt ├── SoundNotifier │ ├── Modules │ │ ├── InitModules.cs │ │ └── SoundsModules.cs │ ├── Notifier.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SoundNotifier.csproj │ ├── readme.SoundNotifier.txt │ └── sounds │ │ ├── notify.wav │ │ └── warning.wav ├── ViewRange │ ├── Converters │ │ └── ViewRangeConverter.cs │ ├── Data │ │ ├── ResourceService.cs │ │ └── Settings.cs │ ├── Entrance.cs │ ├── Enums │ │ └── MessageType.cs │ ├── Extensions │ │ └── ViewRangeEx.cs │ ├── Helper │ │ └── CalcFleetViewRange.cs │ ├── Modules │ │ ├── InitModules.cs │ │ └── ViewRangeModules.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── TextResource.Designer.cs │ ├── TextResource.resx │ ├── ViewModels │ │ └── SettingsViewModel.cs │ ├── ViewRange.csproj │ ├── Views │ │ ├── ResourceDictionary.xaml │ │ ├── SettingsControl.xaml │ │ └── SettingsControl.xaml.cs │ └── packages.config ├── Warning │ ├── Data │ │ ├── ResourceService.cs │ │ └── Settings.cs │ ├── Entrance.cs │ ├── Modules │ │ ├── InitModules.cs │ │ └── WarningModules.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Readme.Warning.txt │ ├── TextResource.Designer.cs │ ├── TextResource.resx │ ├── Themes │ │ ├── Accents │ │ │ └── Red.xaml │ │ ├── ThemeServiceEx.cs │ │ └── ThemeServiceEx.cs.bak │ ├── ViewModels │ │ ├── SettingsViewModel.cs │ │ └── ShipStatusViewModel.cs │ ├── Views │ │ ├── SettingsControl.xaml │ │ ├── SettingsControl.xaml.cs │ │ ├── StatusItemControl.xaml │ │ ├── StatusItemControl.xaml.cs │ │ ├── StatusWindow.xaml │ │ └── StatusWindow.xaml.cs │ ├── Warning.csproj │ ├── app.config │ ├── memo.txt │ └── packages.config └── WindowsNotifierForWin7 │ ├── Enums │ └── ToastType.cs │ ├── Modules │ ├── InitModules.cs │ └── NotifierModules.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Readme.WindowsNotifierEx.txt │ ├── ToastItemControl.xaml │ ├── ToastItemControl.xaml.cs │ ├── ToastMessage.cs │ ├── ToastWindow.xaml │ ├── ToastWindow.xaml.cs │ ├── WindowsNotifier.cs │ ├── WindowsNotifierEx.csproj │ └── memo.txt ├── LICENSE └── README.md /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "KanColleViewer"] 2 | path = KanColleViewer 3 | url = https://github.com/Grabacr07/KanColleViewer 4 | [submodule "WebSitePage"] 5 | path = WebSitePage 6 | url = https://github.com/AMMing/KcvPluginsPage.git 7 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Converters/SimpleShipConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | using System.Windows.Media; 9 | using Grabacr07.KanColleViewer.ViewModels.Contents.Fleets; 10 | using Grabacr07.KanColleWrapper.Models; 11 | using AMing.Plugins.Core.Extensions; 12 | using AMing.Logger.ViewModels.Item; 13 | 14 | namespace AMing.Logger.Converters 15 | { 16 | public class SimpleShipConverter : IValueConverter 17 | { 18 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | if (value is SimpleShipViewModel) 21 | { 22 | var ship = value as SimpleShipViewModel; 23 | if (ship != null) 24 | { 25 | return string.Format("[Id {0}] {1} [Lv.{2}{3}][HP {4}/{5}]", 26 | ship.Id, 27 | ship.Name, 28 | ship.Level, 29 | ship.LevelUpCount > 0 ? 30 | string.Format("→{0}", ship.Level + ship.LevelUpCount) : 31 | string.Empty, 32 | 33 | ship.HP_After != ship.HP_Before ? 34 | string.Format("{0}→{1}", ship.HP_Before, ship.HP_After) : 35 | string.Format("{0}", ship.HP_After), 36 | ship.HP_Max 37 | ); 38 | } 39 | } 40 | 41 | return value; 42 | } 43 | 44 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 45 | { 46 | throw new NotImplementedException(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Data/ResourceService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Livet; 7 | 8 | namespace AMing.Logger.Data 9 | { 10 | /// 11 | /// 多言語化されたリソースへのアクセスを提供します。 12 | /// 13 | public class ResourceService : NotificationObject 14 | { 15 | #region static members 16 | 17 | private static readonly ResourceService current = new ResourceService(); 18 | 19 | public static ResourceService Current 20 | { 21 | get { return current; } 22 | } 23 | 24 | #endregion 25 | 26 | /// 27 | /// サポートされているカルチャの名前。 28 | /// 29 | private readonly string[] supportedCultureNames = 30 | { 31 | //"ja", // Resources.resx 32 | "en", 33 | "zh-CN"//, 34 | //"ko-KR", 35 | }; 36 | 37 | private readonly TextResource _TextResource = new TextResource(); 38 | private readonly IReadOnlyCollection _SupportedCultures; 39 | 40 | /// 41 | /// 多言語化されたリソースを取得します。 42 | /// 43 | public TextResource TextResource 44 | { 45 | get { return this._TextResource; } 46 | } 47 | 48 | /// 49 | /// サポートされているカルチャを取得します。 50 | /// 51 | public IReadOnlyCollection SupportedCultures 52 | { 53 | get { return this._SupportedCultures; } 54 | } 55 | 56 | private ResourceService() 57 | { 58 | this._SupportedCultures = this.supportedCultureNames 59 | .Select(x => 60 | { 61 | try 62 | { 63 | return CultureInfo.GetCultureInfo(x); 64 | } 65 | catch (CultureNotFoundException) 66 | { 67 | return null; 68 | } 69 | }) 70 | .Where(x => x != null) 71 | .ToList(); 72 | } 73 | 74 | /// 75 | /// 指定されたカルチャ名を使用して、リソースのカルチャを変更します。 76 | /// 77 | /// カルチャの名前。 78 | public void ChangeCulture(string name) 79 | { 80 | TextResource.Culture = this.SupportedCultures.SingleOrDefault(x => x.Name == name); 81 | 82 | this.RaisePropertyChanged("Resources"); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Data/Settings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Xml.Serialization; 7 | using Grabacr07.KanColleViewer.Models.Data.Xml; 8 | using Grabacr07.KanColleWrapper; 9 | using Livet; 10 | using Grabacr07.KanColleViewer.Models; 11 | using System.Windows.Input; 12 | using MetroRadiance; 13 | 14 | namespace AMing.Logger.Data 15 | { 16 | [Serializable] 17 | public class Settings 18 | { 19 | #region static members 20 | 21 | #if DEBUG 22 | private static readonly string filePath = Path.Combine( 23 | Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), 24 | "y2443.com", 25 | "Logger.Debug", 26 | "Settings.xml"); 27 | #else 28 | private static readonly string filePath = Path.Combine( 29 | Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), 30 | "y2443.com", 31 | "Logger", 32 | "Settings.xml"); 33 | #endif 34 | 35 | public static Settings Current { get; set; } 36 | 37 | public static void Load() 38 | { 39 | try 40 | { 41 | Current = filePath.ReadXml(); 42 | } 43 | catch (Exception ex) 44 | { 45 | Current = GetInitialSettings(); 46 | System.Diagnostics.Debug.WriteLine(ex); 47 | } 48 | } 49 | 50 | public static Settings GetInitialSettings() 51 | { 52 | return new Settings 53 | { 54 | }; 55 | } 56 | 57 | #endregion 58 | 59 | #region member 60 | 61 | 62 | 63 | #endregion 64 | 65 | public void Save() 66 | { 67 | try 68 | { 69 | this.WriteXml(filePath); 70 | } 71 | catch (Exception ex) 72 | { 73 | System.Diagnostics.Debug.WriteLine(ex); 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Entrance.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleViewer.Composition; 2 | using Grabacr07.KanColleWrapper; 3 | using Grabacr07.KanColleWrapper.Models.Raw; 4 | using MetroRadiance; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.ComponentModel.Composition; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Controls; 12 | using kcv = Grabacr07.KanColleViewer; 13 | 14 | namespace AMing.Logger 15 | { 16 | [Export(typeof(IToolPlugin))] 17 | [ExportMetadata("Title", "Logger")] 18 | [ExportMetadata("Description", "Logger")] 19 | [ExportMetadata("Version", Entrance.IToolPluginVersion)] 20 | [ExportMetadata("Author", "@AMing")] 21 | public class Entrance : IToolPlugin 22 | { 23 | private readonly ViewModels.SettingsViewModel settingsViewModel = new ViewModels.SettingsViewModel(); 24 | 25 | 26 | public const string IToolPluginVersion = "1.0"; 27 | public string ToolName 28 | { 29 | get 30 | { 31 | return TextResource.Plugin_ToolName; 32 | } 33 | } 34 | 35 | public object GetToolView() 36 | { 37 | return new Views.SettingsControl { DataContext = this.settingsViewModel }; 38 | } 39 | 40 | public object GetSettingsView() 41 | { 42 | return null; 43 | } 44 | 45 | public Entrance() 46 | { 47 | Init(); 48 | } 49 | 50 | ~Entrance() 51 | { 52 | Exit(); 53 | } 54 | 55 | Modules.InitModules initModules; 56 | private void Init() 57 | { 58 | initModules = new Modules.InitModules(); 59 | initModules.Initialize(); 60 | Modules.LoggerModules.Current.SettingsViewModel = this.settingsViewModel; 61 | 62 | Data.Settings.Load(); 63 | } 64 | 65 | private void Exit() 66 | { 67 | Data.Settings.Current.Save(); 68 | } 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Enums/BattleSortTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AMing.Logger.Enums 8 | { 9 | public enum BattleSortTarget 10 | { 11 | None, 12 | Date, 13 | Mvp, 14 | Flagship, 15 | GetShip, 16 | WinRank, 17 | QuestName 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Enums/BattleType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AMing.Logger.Enums 8 | { 9 | public enum BattleType 10 | { 11 | /// 12 | /// 普通舰队 13 | /// 14 | Normal = 0, 15 | /// 16 | /// 联合舰队 17 | /// 18 | Combined = 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Extensions/ViewRangeEx.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleWrapper.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using AMing.Plugins.Core.Extensions; 9 | using Grabacr07.KanColleViewer.ViewModels.Contents.Fleets; 10 | 11 | namespace AMing.Logger.Extensions 12 | { 13 | public static class ViewRangeEx 14 | { 15 | public static Fleet GetFleet(this FleetViewModel data) 16 | { 17 | return data.GetField("source"); 18 | } 19 | public static T GetRawData(this RawDataWrapper data) 20 | { 21 | return data.GetField("RawData"); 22 | } 23 | public static int? Get(this int[] array, int index) 24 | { 25 | return array.Length > index ? (int?)array[index] : null; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Helper/AdmiralInfoHelper.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleWrapper; 2 | using Grabacr07.KanColleWrapper.Models.Raw; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AMing.Logger.Helper 11 | { 12 | public class AdmiralInfoHelper : LogsHelperBase 13 | { 14 | #region Current 15 | 16 | private static AdmiralInfoHelper _current = new AdmiralInfoHelper(); 17 | 18 | public static AdmiralInfoHelper Current 19 | { 20 | get { return _current; } 21 | set { _current = value; } 22 | } 23 | 24 | #endregion 25 | protected override int MaxSaveCount { get { return 1000; } } 26 | protected override string FolderName { get { return "AdmiralInfo"; } } 27 | 28 | protected readonly static TimeSpan Interval = TimeSpan.FromHours(1); 29 | 30 | public void Append(KanColleClient kanColleClient, Action isAppend) 31 | { 32 | base.Append(list => 33 | { 34 | var admiralInfo = new Modes.AdmiralInfo(KanColleClient.Current.Homeport.Admiral, KanColleClient.Current.Homeport.Materials); 35 | 36 | if (list.UpdateDate.Add(Interval) > DateTime.Now || ( 37 | admiralInfo.Fuel == 0 && 38 | admiralInfo.Ammunition == 0 && 39 | admiralInfo.Steel == 0 && 40 | admiralInfo.Bauxite == 0 41 | )) 42 | { 43 | isAppend(false); 44 | return false; 45 | } 46 | var newlist = list.List.ToList(); 47 | newlist.Add(admiralInfo); 48 | list.List = newlist.ToArray(); 49 | 50 | isAppend(true); 51 | return true; 52 | }); 53 | } 54 | 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Helper/LogsHelperBase_Analysis.cs: -------------------------------------------------------------------------------- 1 | using AMing.Logger.Modes; 2 | using AMing.Plugins.Core.Helper; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using AMing.Plugins.Core.Extensions; 10 | using System.Collections; 11 | 12 | namespace AMing.Logger.Helper 13 | { 14 | 15 | public partial class LogsHelperBase 16 | { 17 | /// 18 | /// 获取全部日志文件路径 19 | /// 20 | /// 21 | protected virtual IList GetAllFilePath() 22 | { 23 | var list = new List 24 | { 25 | this.LastFilePath 26 | }; 27 | var dirInfo = new DirectoryInfo(this.BackupFolderPath); 28 | if (dirInfo.Exists) 29 | { 30 | var backuplist = dirInfo.GetFiles(string.Format("*.{0}", this.logFormat)).Select(x => x.FullName); 31 | list.AddRange(backuplist); 32 | } 33 | return list; 34 | } 35 | /// 36 | /// 获取全部列表 37 | /// 38 | /// 39 | protected virtual IList GetAllList() 40 | { 41 | return GetAllFilePath().Select(x => GetList(x)).ToList(); 42 | } 43 | /// 44 | /// 获取所有的项(通过id移除重复项) 45 | /// 46 | /// 47 | protected virtual IList GetAllItem(IList allList) 48 | { 49 | var result = allList.SelectMany(x => x.List).Distinct(x => x.Id); 50 | 51 | return result.ToList(); 52 | } 53 | 54 | public virtual IList GetInfo(out IList list, out DateTime lastUpdateDate) 55 | { 56 | var allList = GetAllList(); 57 | 58 | list = GetAllItem(allList); 59 | lastUpdateDate = allList.Select(x => x.UpdateDate).OrderByDescending(x => x).FirstOrDefault(); 60 | 61 | return allList; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modes/AdmiralInfoChangeEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleWrapper; 2 | using Grabacr07.KanColleWrapper.Models.Raw; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AMing.Logger.Modes 10 | { 11 | public class AdmiralInfoChangeEventArgs : EventArgs 12 | { 13 | public KanColleClient KanColleClient { get; set; } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modes/AdmiralInfoList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AMing.Logger.Modes 8 | { 9 | public class AdmiralInfoList : ILogsList 10 | { 11 | public DateTime UpdateDate { get; set; } 12 | 13 | public AdmiralInfo[] List { get; set; } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modes/BattleEndEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleWrapper; 2 | using Grabacr07.KanColleWrapper.Models.Raw; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AMing.Logger.Modes 10 | { 11 | public class BattleEndEventArgs : EventArgs 12 | { 13 | public KanColleClient KanColleClient { get; set; } 14 | public kcsapi_battleresult BattleResult { get; set; } 15 | public bool IsFirstBattle { get; set; } 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modes/BattleResultLists.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AMing.Logger.Modes 8 | { 9 | public class BattleResultList : ILogsList 10 | { 11 | public DateTime UpdateDate { get; set; } 12 | 13 | public SimpleAdmiral[] AdmiralList { get; set; } 14 | 15 | public BattleResult[] List { get; set; } 16 | 17 | public BattleResultList() { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modes/CombinedBattleEndEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleWrapper; 2 | using Grabacr07.KanColleWrapper.Models.Raw; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AMing.Logger.Modes 10 | { 11 | public class CombinedBattleEndEventArgs : EventArgs 12 | { 13 | public KanColleClient KanColleClient { get; set; } 14 | public kcsapi_combined_battle_battleresult BattleResult { get; set; } 15 | public bool IsFirstBattle { get; set; } 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modes/ILogsList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AMing.Logger.Modes 8 | { 9 | public interface ILogsList 10 | { 11 | DateTime UpdateDate { get; set; } 12 | 13 | T[] List { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modes/IResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AMing.Logger.Modes 8 | { 9 | public interface IResult 10 | { 11 | string Id { get; set; } 12 | DateTime CreateDate { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modes/SimpleAdmiral.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleWrapper; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AMing.Logger.Modes 9 | { 10 | public class SimpleAdmiral 11 | { 12 | public string Id { get; set; } 13 | 14 | public string Nickname { get; set; } 15 | 16 | public int Level { get; set; } 17 | 18 | public SimpleAdmiral() { } 19 | public SimpleAdmiral(KanColleClient kanColleClient) 20 | { 21 | this.Id = kanColleClient.Homeport.Admiral.MemberId; 22 | this.Nickname = kanColleClient.Homeport.Admiral.Nickname; 23 | this.Level = kanColleClient.Homeport.Admiral.Level; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modes/SimpleShip.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleWrapper.Models; 2 | using Grabacr07.KanColleWrapper.Models.Raw; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AMing.Logger.Modes 10 | { 11 | public class SimpleShip 12 | { 13 | public int Id { get; set; } 14 | 15 | public string Name { get; set; } 16 | 17 | public int Level { get; set; } 18 | 19 | public int HP_Before { get; set; } 20 | public int HP_After { get; set; } 21 | public int HP_Max { get; set; } 22 | 23 | 24 | public SimpleShip() { } 25 | 26 | public SimpleShip(kcsapi_battleresult_getship ship) 27 | { 28 | this.Id = ship.api_ship_id; 29 | this.Name = ship.api_ship_name; 30 | this.Level = 1; 31 | } 32 | public SimpleShip(Api_Get_Ship ship) 33 | { 34 | this.Id = ship.api_ship_id; 35 | this.Name = ship.api_ship_name; 36 | this.Level = 1; 37 | } 38 | public SimpleShip(Ship ship) 39 | { 40 | this.Id = ship.Id; 41 | this.Name = ship.Info.Name; 42 | this.Level = ship.Level; 43 | this.HP_Before = ship.HP.Current; 44 | this.HP_Max = ship.HP.Maximum; 45 | } 46 | 47 | /// 48 | /// 是否是战斗之后的HP 49 | /// 50 | /// 51 | /// 52 | public bool IsAfterHP(Ship ship) 53 | { 54 | return ship.Id == this.Id && this.HP_After == 0 && ship.HP.Current <= this.HP_Before; 55 | } 56 | 57 | /// 58 | /// 设置战斗之后的HP 59 | /// 60 | /// 61 | /// 62 | public bool SetAfterHP(Ship ship) 63 | { 64 | if (IsAfterHP(ship)) 65 | { 66 | this.HP_After = ship.HP.Current; 67 | 68 | return true; 69 | } 70 | 71 | return false; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Modules/InitModules.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AMing.Logger.Modules 8 | { 9 | public class InitModules : AMing.Plugins.Core.Modules.InitModules 10 | { 11 | public override void SetModules() 12 | { 13 | base.SetModules(); 14 | 15 | ModulesList.Add(Modules.LoggerModules.Current); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Logger")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Logger")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("8dcbbe55-d909-4156-9205-42c55b293a4a")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyFileVersion("1.0.*")] 37 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/ViewModels/Item/MissionViewModel.cs: -------------------------------------------------------------------------------- 1 | using AMing.Logger.Modes; 2 | using Livet; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using AMing.Plugins.Core.Extensions; 9 | 10 | namespace AMing.Logger.ViewModels.Item 11 | { 12 | public class MissionViewModel : ViewModel 13 | { 14 | public int Index { get; set; } 15 | /// 16 | /// 地图名称 17 | /// 18 | public string MapName { get; set; } 19 | /// 20 | /// 结果 21 | /// 22 | public string Result { get; set; } 23 | /// 24 | /// 航行路线 25 | /// 26 | public string Route { get; set; } 27 | 28 | /// 29 | /// 捞到的舰娘 30 | /// 31 | public List GetShips { get; set; } 32 | /// 33 | /// 第一次战斗时间 34 | /// 35 | public DateTime FirstBattleDate { get; set; } 36 | /// 37 | /// 最后一次战斗时间 38 | /// 39 | public DateTime LastBattleDate { get; set; } 40 | 41 | /// 42 | /// 每个地址图的详情 43 | /// 44 | public List BattleResults { get; set; } 45 | 46 | public MissionViewModel(List list) 47 | { 48 | if(list==null ||list.Count==0)return ; 49 | 50 | this.BattleResults = list.Select(x => new BattleResultViewModel(x)).OrderBy(x => x.ResultData.CreateDate).ToList(); 51 | var first = this.BattleResults.FirstOrDefault(); 52 | 53 | this.FirstBattleDate = first.ResultData.CreateDate; 54 | this.LastBattleDate = this.BattleResults.LastOrDefault().ResultData.CreateDate; 55 | this.GetShips = this.BattleResults.Where(x => x.ResultData.GetShip != null).Select(x => x.ResultData.GetShip.Name).ToList(); 56 | 57 | this.MapName = first.ResultData.QuestName; 58 | this.Route = this.BattleResults.Select(x => x.ResultData.DeckName).ToString(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/ViewModels/Item/SimpleShipViewModel.cs: -------------------------------------------------------------------------------- 1 | using AMing.Logger.Modes; 2 | using Livet; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AMing.Logger.ViewModels.Item 10 | { 11 | public class SimpleShipViewModel : ViewModel 12 | { 13 | public int Id { get; set; } 14 | 15 | public string Name { get; set; } 16 | 17 | public int Level { get; set; } 18 | 19 | public int LevelUpCount { get; set; } 20 | public int HP_Before { get; set; } 21 | public int HP_After { get; set; } 22 | public int HP_Max { get; set; } 23 | 24 | public SimpleShipViewModel(SimpleShip ship, int lvup) 25 | { 26 | this.Id = ship.Id; 27 | this.Name = ship.Name; 28 | this.Level = ship.Level; 29 | this.HP_Before = ship.HP_Before; 30 | this.HP_After = ship.HP_After; 31 | this.HP_Max = ship.HP_Max; 32 | this.LevelUpCount = lvup; 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Views/BattleLogWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleViewer.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Windows; 6 | 7 | namespace AMing.Logger.Views 8 | { 9 | partial class BattleLogWindow 10 | { 11 | public BattleLogWindow() 12 | { 13 | this.InitializeComponent(); 14 | 15 | Application.Current.MainWindow.Closed += (sender, args) => this.Close(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/Views/SettingsControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AMing.Logger.Views 17 | { 18 | /// 19 | /// SettingsControl.xaml 的交互逻辑 20 | /// 21 | public partial class SettingsControl : UserControl 22 | { 23 | public SettingsControl() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/mome.txt: -------------------------------------------------------------------------------- 1 | 每次保存都重新读取数据写完立即保存,如果数量超过100(假定)就将数据存到下一个目录下,里面全部都是旧档以时间作为文件名,然后本地数据清空重新开始累积 -------------------------------------------------------------------------------- /KcvPlugins/BattleLog/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/Data/ResourceService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Livet; 7 | 8 | namespace AMing.DebugExtensions.Data 9 | { 10 | /// 11 | /// 多言語化されたリソースへのアクセスを提供します。 12 | /// 13 | public class ResourceService : NotificationObject 14 | { 15 | #region static members 16 | 17 | private static readonly ResourceService current = new ResourceService(); 18 | 19 | public static ResourceService Current 20 | { 21 | get { return current; } 22 | } 23 | 24 | #endregion 25 | 26 | /// 27 | /// サポートされているカルチャの名前。 28 | /// 29 | private readonly string[] supportedCultureNames = 30 | { 31 | //"ja", // Resources.resx 32 | "en", 33 | "zh-CN"//, 34 | //"ko-KR", 35 | }; 36 | 37 | private readonly TextResource _TextResource = new TextResource(); 38 | private readonly IReadOnlyCollection _SupportedCultures; 39 | 40 | /// 41 | /// 多言語化されたリソースを取得します。 42 | /// 43 | public TextResource TextResource 44 | { 45 | get { return this._TextResource; } 46 | } 47 | 48 | /// 49 | /// サポートされているカルチャを取得します。 50 | /// 51 | public IReadOnlyCollection SupportedCultures 52 | { 53 | get { return this._SupportedCultures; } 54 | } 55 | 56 | private ResourceService() 57 | { 58 | this._SupportedCultures = this.supportedCultureNames 59 | .Select(x => 60 | { 61 | try 62 | { 63 | return CultureInfo.GetCultureInfo(x); 64 | } 65 | catch (CultureNotFoundException) 66 | { 67 | return null; 68 | } 69 | }) 70 | .Where(x => x != null) 71 | .ToList(); 72 | } 73 | 74 | /// 75 | /// 指定されたカルチャ名を使用して、リソースのカルチャを変更します。 76 | /// 77 | /// カルチャの名前。 78 | public void ChangeCulture(string name) 79 | { 80 | TextResource.Culture = this.SupportedCultures.SingleOrDefault(x => x.Name == name); 81 | 82 | this.RaisePropertyChanged("Resources"); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/Helper/ErrorLogHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AMing.DebugExtensions.Helper 9 | { 10 | public class ErrorLogHelper : LogHelper 11 | { 12 | 13 | #region Current 14 | 15 | private static ErrorLogHelper _current = new ErrorLogHelper(); 16 | 17 | public static ErrorLogHelper Current 18 | { 19 | get { return _current; } 20 | set { _current = value; } 21 | } 22 | 23 | #endregion 24 | 25 | protected override string GetLogDirPath() 26 | { 27 | return Path.Combine( 28 | base.logsRootDir, 29 | "Error", 30 | DateTime.Now.ToString("yyyy_MM") 31 | ); 32 | } 33 | 34 | protected override string GetLogFileName() 35 | { 36 | return string.Format("logs_{0:yyyy_MM_dd}.txt", DateTime.Now); 37 | } 38 | 39 | protected override string ObjectToString(Exception ex) 40 | { 41 | StringBuilder sb = new StringBuilder(); 42 | sb.AppendFormat("Time:{0:yyyy-MM-dd HH:mm:ss.fff}\nMessage:{1}\nSource:{2}\nTrace:\n{3}\n", 43 | DateTime.Now, 44 | ex.Message, 45 | ex.Source, 46 | ex.StackTrace); 47 | sb.AppendLine("---------------------------------------"); 48 | 49 | return sb.ToString(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/Helper/LogHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AMing.DebugExtensions.Helper 9 | { 10 | public class LogHelper 11 | { 12 | /// 13 | /// 日志根目录位置 14 | /// 15 | protected readonly string logsRootDir = Path.Combine( 16 | Environment.CurrentDirectory, 17 | "Plugins", 18 | "Logs"); 19 | /// 20 | /// 获取日志保存目录 21 | /// 22 | /// 23 | protected virtual string GetLogDirPath() 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | /// 28 | /// 获取日志文件名 29 | /// 30 | /// 31 | protected virtual string GetLogFileName() 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | /// 36 | /// 将对象转换成字符串 37 | /// 38 | /// 39 | /// 40 | protected virtual string ObjectToString(T val) 41 | { 42 | throw new NotImplementedException(); 43 | } 44 | /// 45 | /// 追加内容 46 | /// 47 | /// 48 | public virtual void Append(T val) 49 | { 50 | try 51 | { 52 | string logDirPath = GetLogDirPath(); 53 | string logFileName = GetLogFileName(); 54 | string logFileNamePath = Path.Combine(logDirPath, logFileName); 55 | if (!Directory.Exists(logDirPath)) 56 | { 57 | Directory.CreateDirectory(logDirPath); 58 | } 59 | string content = ObjectToString(val); 60 | File.AppendAllText(logFileNamePath, content); 61 | } 62 | catch { } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/Helper/MessageLogHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AMing.DebugExtensions.Helper 9 | { 10 | public class MessageLogHelper : LogHelper 11 | { 12 | #region Current 13 | 14 | private static MessageLogHelper _current = new MessageLogHelper(); 15 | 16 | public static MessageLogHelper Current 17 | { 18 | get { return _current; } 19 | set { _current = value; } 20 | } 21 | 22 | #endregion 23 | 24 | protected override string GetLogDirPath() 25 | { 26 | return Path.Combine( 27 | base.logsRootDir, 28 | "Message", 29 | DateTime.Now.ToString("yyyy_MM_dd") 30 | ); 31 | } 32 | /// 33 | /// message有时候消息量比较大,所以一个小时记录一个文件 34 | /// 35 | /// 36 | protected override string GetLogFileName() 37 | { 38 | return string.Format("msg_{0:yyyy_MM_dd_HH}.txt", DateTime.Now); 39 | } 40 | 41 | protected override string ObjectToString(string val) 42 | { 43 | StringBuilder sb = new StringBuilder(); 44 | sb.AppendFormat("Time:{0:yyyy-MM-dd HH:mm:ss.fff}\nMessage:\n{1}\n", 45 | DateTime.Now, 46 | val); 47 | sb.AppendLine("---------------------------------------"); 48 | 49 | return sb.ToString(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/Modules/InitModules.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AMing.DebugExtensions.Modules 8 | { 9 | public class InitModules : AMing.Plugins.Core.Modules.InitModules 10 | { 11 | public override void SetModules() 12 | { 13 | base.SetModules(); 14 | 15 | ModulesList.Add(Modules.LogsModules.Current); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/Modules/LogsModules.cs: -------------------------------------------------------------------------------- 1 | using AMing.Plugins.Core.Modules; 2 | using Grabacr07.KanColleWrapper.Models; 3 | using Grabacr07.KanColleWrapper; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using AMing.Plugins.Core.Extensions; 7 | using System; 8 | using AMing.Plugins.Core.Models; 9 | 10 | namespace AMing.DebugExtensions.Modules 11 | { 12 | public class LogsModules : ModulesBase 13 | { 14 | #region Current 15 | 16 | private static LogsModules _current = new LogsModules(); 17 | 18 | public static LogsModules Current 19 | { 20 | get { return _current; } 21 | set { _current = value; } 22 | } 23 | 24 | #endregion 25 | 26 | #region member 27 | 28 | public ViewModels.SettingsViewModel SettingsViewModel { get; set; } 29 | 30 | #endregion 31 | 32 | #region method 33 | 34 | #endregion 35 | 36 | public override void Initialize() 37 | { 38 | base.Initialize(); 39 | InitPublicModules(); 40 | } 41 | 42 | #region PublicModules 43 | 44 | private void InitPublicModules() 45 | { 46 | AMing.Plugins.Core.GenericMessager.Current.RegisterForLogs(this, obj => AppendLogs(obj)); ; 47 | AMing.Plugins.Core.GenericMessager.Current.RegisterForException(this, ex => AppendLogsForException(ex)); 48 | } 49 | 50 | void AppendLogs(string val) 51 | { 52 | SettingsViewModel.LogsText = string.Format("{0}\nDateTime:{1:yyyy-MM-dd HH:mm:ss.fff}\n{2}\n", 53 | SettingsViewModel.LogsText, 54 | DateTime.Now, 55 | val); 56 | Helper.MessageLogHelper.Current.Append(val); 57 | } 58 | void AppendLogsForException(Exception ex) 59 | { 60 | Helper.ErrorLogHelper.Current.Append(ex); 61 | } 62 | 63 | 64 | #endregion 65 | 66 | 67 | public override void Dispose() 68 | { 69 | base.Dispose(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("DebugExtensions")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DebugExtensions")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("29cbb75c-312f-4fc6-8dab-cb5a09551e22")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.*")] 36 | [assembly: AssemblyFileVersion("1.2.*")] 37 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/ViewModels/SettingsViewModel.cs: -------------------------------------------------------------------------------- 1 | using Livet; 2 | using Livet.Commands; 3 | using MetroRadiance; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Input; 10 | 11 | namespace AMing.DebugExtensions.ViewModels 12 | { 13 | public class SettingsViewModel : ViewModel 14 | { 15 | 16 | #region PluginInfo 17 | 18 | private string _logsText; 19 | 20 | public string LogsText 21 | { 22 | get { return _logsText; } 23 | set 24 | { 25 | if (_logsText != value) 26 | { 27 | _logsText = value; 28 | this.RaisePropertyChanged(); 29 | } 30 | } 31 | } 32 | 33 | #endregion 34 | 35 | 36 | public void ClearLogs() 37 | { 38 | this.LogsText = string.Empty; 39 | } 40 | 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/Views/SettingsControl.xaml: -------------------------------------------------------------------------------- 1 |  15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/Views/SettingsControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace AMing.DebugExtensions.Views 17 | { 18 | /// 19 | /// SettingsControl.xaml 的交互逻辑 20 | /// 21 | public partial class SettingsControl : UserControl 22 | { 23 | public SettingsControl() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /KcvPlugins/DebugExtensions/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /KcvPlugins/KcvPlugins/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /KcvPlugins/KcvPlugins/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /KcvPlugins/KcvPlugins/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using Grabacr07.KanColleViewer.Composition; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace KcvPlugins 18 | { 19 | /// 20 | /// MainWindow.xaml 的交互逻辑 21 | /// 22 | public partial class MainWindow 23 | { 24 | public MainWindow() 25 | { 26 | InitializeComponent(); 27 | 28 | this.Loaded += MainWindow_Loaded; 29 | } 30 | 31 | void MainWindow_Loaded(object sender, RoutedEventArgs e) 32 | { 33 | App.PluginList.ForEach(pugin => AddPlugin(pugin)); 34 | 35 | MetroRadiance.ThemeService.Current.ChangeTheme(MetroRadiance.Theme.Light); 36 | } 37 | 38 | 39 | 40 | private void AddPlugin(IToolPlugin plugin) 41 | { 42 | var tabitem = new TabItem 43 | { 44 | Header = plugin.ToolName, 45 | Content = plugin.GetToolView() 46 | }; 47 | 48 | tabControl.Items.Add(tabitem); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /KcvPlugins/KcvPlugins/OpenToastWindow.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 |