├── .editorconfig ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md ├── dependabot.yml └── workflows │ ├── build.yml │ └── release.yml ├── .gitignore ├── .img ├── en │ └── top.jpg └── ja │ └── top.jpg ├── Directory.Build.props ├── LICENSE ├── LibX4.Tests ├── CatFileTests │ └── CatFileTest.cs ├── IAsyncEnumerableExtension.cs ├── LanguageResolverTests │ └── LanguageResolverTest.cs ├── LibX4.Tests.csproj ├── TestData │ └── CatFileTest │ │ ├── Config │ │ ├── config.xml │ │ └── content.xml │ │ ├── ModEnvironment │ │ ├── 01.cat │ │ ├── 01.dat │ │ ├── 02.cat │ │ ├── 02.dat │ │ ├── extensions │ │ │ ├── bar_mod │ │ │ │ ├── content.xml │ │ │ │ ├── ext_01.cat │ │ │ │ └── ext_01.dat │ │ │ └── foo_mod │ │ │ │ ├── content.xml │ │ │ │ ├── ext_01.cat │ │ │ │ └── ext_01.dat │ │ └── version.dat │ │ ├── ModEnvironmentOrig │ │ ├── 01 │ │ │ └── libraries │ │ │ │ ├── personal infomation │ │ │ │ ├── personal infomation.xml │ │ │ │ └── personal_infomation.xml │ │ │ │ ├── personal_infomation.xml │ │ │ │ └── personal_infomation │ │ │ │ ├── personal infomation.xml │ │ │ │ └── personal_infomation.xml │ │ ├── 02 │ │ │ └── libraries │ │ │ │ └── personal_infomation.xml │ │ ├── extensions │ │ │ ├── bar_mod │ │ │ │ ├── content.xml │ │ │ │ └── ext_01 │ │ │ │ │ └── libraries │ │ │ │ │ ├── bar_mod_personal infomation │ │ │ │ │ ├── personal infomation.xml │ │ │ │ │ └── personal_infomation.xml │ │ │ │ │ └── bar_mod_personal_infomation │ │ │ │ │ ├── personal infomation.xml │ │ │ │ │ └── personal_infomation.xml │ │ │ └── foo_mod │ │ │ │ ├── content.xml │ │ │ │ └── ext_01 │ │ │ │ └── libraries │ │ │ │ ├── foo_mod_personal infomation │ │ │ │ ├── personal infomation.xml │ │ │ │ └── personal_infomation.xml │ │ │ │ └── foo_mod_personal_infomation │ │ │ │ ├── personal infomation.xml │ │ │ │ └── personal_infomation.xml │ │ └── version.dat │ │ ├── ModIndexXml │ │ ├── 01.cat │ │ ├── 01.dat │ │ ├── extensions │ │ │ └── baz_mod │ │ │ │ ├── content.xml │ │ │ │ ├── ext_01.cat │ │ │ │ └── ext_01.dat │ │ └── version.dat │ │ ├── ModIndexXmlOrig │ │ ├── 01 │ │ │ ├── assets │ │ │ │ └── fx │ │ │ │ │ └── macros │ │ │ │ │ ├── bar_macro.xml │ │ │ │ │ └── foo_macro.xml │ │ │ └── index │ │ │ │ └── macros.xml │ │ ├── extensions │ │ │ └── baz_mod │ │ │ │ ├── content.xml │ │ │ │ └── ext_01 │ │ │ │ ├── assets │ │ │ │ └── fx │ │ │ │ │ └── macros │ │ │ │ │ └── baz_macro.xml │ │ │ │ └── index │ │ │ │ └── macros.xml │ │ └── version.dat │ │ ├── PlaneFileModEnvironment │ │ ├── 01.cat │ │ ├── 01.dat │ │ ├── 02.cat │ │ ├── 02.dat │ │ ├── extensions │ │ │ ├── bar_mod │ │ │ │ ├── content.xml │ │ │ │ └── libraries │ │ │ │ │ ├── bar_mod_personal infomation │ │ │ │ │ ├── personal infomation.xml │ │ │ │ │ └── personal_infomation.xml │ │ │ │ │ └── bar_mod_personal_infomation │ │ │ │ │ ├── personal infomation.xml │ │ │ │ │ └── personal_infomation.xml │ │ │ └── foo_mod │ │ │ │ ├── content.xml │ │ │ │ └── libraries │ │ │ │ ├── foo_mod_personal infomation │ │ │ │ ├── personal infomation.xml │ │ │ │ └── personal_infomation.xml │ │ │ │ └── foo_mod_personal_infomation │ │ │ │ ├── personal infomation.xml │ │ │ │ └── personal_infomation.xml │ │ └── version.dat │ │ ├── VanillaEnvironment │ │ ├── 01.cat │ │ ├── 01.dat │ │ ├── 02.cat │ │ ├── 02.dat │ │ └── version.dat │ │ ├── VanillaEnvironmentOrig │ │ ├── 01 │ │ │ └── libraries │ │ │ │ ├── personal infomation │ │ │ │ ├── personal infomation.xml │ │ │ │ └── personal_infomation.xml │ │ │ │ ├── personal_infomation.xml │ │ │ │ └── personal_infomation │ │ │ │ ├── personal infomation.xml │ │ │ │ └── personal_infomation.xml │ │ ├── 02 │ │ │ └── libraries │ │ │ │ └── personal_infomation.xml │ │ └── version.dat │ │ ├── VanillaIndexXml │ │ ├── 01.cat │ │ ├── 01.dat │ │ └── version.dat │ │ └── VanillaIndexXmlOrig │ │ ├── 01 │ │ ├── assets │ │ │ └── fx │ │ │ │ └── macros │ │ │ │ ├── bar_macro.xml │ │ │ │ └── foo_macro.xml │ │ └── index │ │ │ └── macros.xml │ │ └── version.dat ├── TestHelperExtension.cs ├── XAttributeExtensionTest.cs └── XDocumentExTest.cs ├── LibX4 ├── AssemblyInfo.cs ├── FileSystem │ ├── CatFile.cs │ ├── CatFileLoader.cs │ ├── CatLoadOption.cs │ ├── DependencyInfo.cs │ ├── DependencyResolutionException.cs │ ├── ICatFile.cs │ ├── IFileLoader.cs │ ├── IIndexResolver.cs │ ├── ModInfo.cs │ └── XMLPatcher.cs ├── Lang │ ├── ILanguageResolver.cs │ └── LanguageResolver.cs ├── LibX4.csproj ├── X4Path.cs └── Xml │ ├── XAttributeExtension.cs │ ├── XDocumentEx.cs │ └── XmlFormatException.cs ├── X4_ComplexCalculator.sln ├── X4_ComplexCalculator ├── App.xaml ├── App.xaml.cs ├── AssemblyInfo.cs ├── Common │ ├── Behavior │ │ ├── CloseWindowBehavior.cs │ │ ├── ControlItemDoubleClick.cs │ │ ├── DataGridCurrentCellEditModeBehavior.cs │ │ ├── DataGridFocusCellBehavior.cs │ │ ├── DataGridHeaderThumbBehavior.cs │ │ ├── DataGridMouseEnterEditModeBehavior.cs │ │ ├── HorizontalScrollSyncBehavior.cs │ │ └── VirtualizedDataGridSelectBehavior.cs │ ├── BindableBaseEx.cs │ ├── BindingProxy.cs │ ├── Collection │ │ ├── ObservablePropertyChangedCollection.cs │ │ ├── ObservableRangeCollection.cs │ │ ├── PooledDisposableDictionary.cs │ │ ├── RangeObservableCollection.cs │ │ └── WpfObservableRangeCollection.cs │ ├── Configuration.cs │ ├── Controls │ │ └── DataGridFilter │ │ │ ├── Interface │ │ │ └── IDataGridFilter.cs │ │ │ ├── List │ │ │ ├── ListBoxItem.cs │ │ │ ├── ListContentFilter.cs │ │ │ ├── ListFilter.xaml │ │ │ └── ListFilter.xaml.cs │ │ │ ├── MultiList │ │ │ ├── MultiListBoxItem.cs │ │ │ ├── MultiListContentFilter.cs │ │ │ ├── MultiListFilter.xaml │ │ │ └── MultiListFilter.xaml.cs │ │ │ ├── Numerical │ │ │ ├── NumericalBetweenContentFilter.cs │ │ │ ├── NumericalContentFilter.cs │ │ │ ├── NumericalFilter.xaml │ │ │ ├── NumericalFilter.xaml.cs │ │ │ └── NumericalFilterConditinos.cs │ │ │ └── Text │ │ │ ├── TextContentFilter.cs │ │ │ ├── TextFilter.xaml │ │ │ ├── TextFilter.xaml.cs │ │ │ └── TextFilterConditions.cs │ ├── Dialog │ │ ├── MessageBoxes │ │ │ ├── DialogResultConverter.cs │ │ │ ├── ILocalizedMessageBox.cs │ │ │ ├── LocalizedMessageBoxEx.cs │ │ │ └── LocalizedMessageBoxResult.cs │ │ └── SelectStringDialog │ │ │ ├── SelectStringDialog.xaml │ │ │ ├── SelectStringDialog.xaml.cs │ │ │ └── SelectStringModel.cs │ ├── DoEventsExecuter.cs │ ├── EditStatus │ │ ├── EditStatus.cs │ │ └── IEditable.cs │ ├── IReorderble.cs │ ├── ISelectable.cs │ ├── Localize │ │ ├── CSVEmbeddedLocalizationProvider.cs │ │ ├── CSVLocalizationProvider.cs │ │ └── CSVLocalizationProviderBase.cs │ ├── MouseHoverEditCellColumn.cs │ ├── ProgressEx.cs │ ├── PropertyChangedExtendedEventArgs.cs │ └── ValueConverter │ │ ├── ActiveDocumentConverter.cs │ │ ├── Array2StringConverter.cs │ │ ├── BoolNegativeConverter.cs │ │ ├── EnumToBooleanConverter.cs │ │ ├── FormatStringConverter.cs │ │ ├── IsLessThanConverter.cs │ │ ├── SliderValueConverter.cs │ │ ├── UpDownValueConverter.cs │ │ └── Visiblity2NullableBooleanConverter.cs ├── DB │ ├── DBConnection.cs │ ├── SettingDatabase.cs │ ├── X4DB │ │ ├── Builder │ │ │ ├── EngineBuilder.cs │ │ │ ├── EquipmentBuilder.cs │ │ │ ├── ModuleBuilder.cs │ │ │ ├── ShieldBuilder.cs │ │ │ ├── ShipBuilder.cs │ │ │ ├── ThrusterBuilder.cs │ │ │ └── WareBuilder.cs │ │ ├── Entity │ │ │ ├── Drag.cs │ │ │ ├── Engine.Properties.cs │ │ │ ├── Engine.cs │ │ │ ├── EngineThrust.cs │ │ │ ├── Equipment.Properties.cs │ │ │ ├── Equipment.cs │ │ │ ├── EquipmentType.cs │ │ │ ├── Faction.cs │ │ │ ├── Inertia.cs │ │ │ ├── Module.Properties.cs │ │ │ ├── Module.cs │ │ │ ├── ModuleProduct.cs │ │ │ ├── ModuleStorage.cs │ │ │ ├── ModuleType.cs │ │ │ ├── Race.cs │ │ │ ├── Shield.Properties.cs │ │ │ ├── Shield.cs │ │ │ ├── Ship.Properties.cs │ │ │ ├── Ship.cs │ │ │ ├── ShipHanger.cs │ │ │ ├── ShipLoadout.cs │ │ │ ├── ShipType.cs │ │ │ ├── Thruster.Properties.cs │ │ │ ├── Thruster.cs │ │ │ ├── TransportType.cs │ │ │ ├── Ware.Properties.cs │ │ │ ├── Ware.cs │ │ │ ├── WareEffect.cs │ │ │ ├── WareEffects.cs │ │ │ ├── WareEquipment.cs │ │ │ ├── WareGroup.cs │ │ │ ├── WareProduction.cs │ │ │ ├── WareResource.cs │ │ │ └── X4Size.cs │ │ ├── Interfaces │ │ │ ├── IEngine.cs │ │ │ ├── IEquipment.cs │ │ │ ├── IEquipmentType.cs │ │ │ ├── IEquippableWare.cs │ │ │ ├── IFaction.cs │ │ │ ├── IMacro.cs │ │ │ ├── IModuleProduct.cs │ │ │ ├── IModuleStorage.cs │ │ │ ├── IModuleType.cs │ │ │ ├── IRace.cs │ │ │ ├── IShield.cs │ │ │ ├── IShip.cs │ │ │ ├── IShipHanger.cs │ │ │ ├── IShipLoadout.cs │ │ │ ├── IShipType.cs │ │ │ ├── IThruster.cs │ │ │ ├── ITransportType.cs │ │ │ ├── IWare.cs │ │ │ ├── IWareEffect.cs │ │ │ ├── IWareEffects.cs │ │ │ ├── IWareEquipment.cs │ │ │ ├── IWareGroup.cs │ │ │ ├── IWareProduction.cs │ │ │ ├── IWareResource.cs │ │ │ ├── IX4Module.cs │ │ │ └── IX4Size.cs │ │ └── Manager │ │ │ ├── EquipmentTagsManager.cs │ │ │ ├── EquipmentTypeManager.cs │ │ │ ├── FactionManager.cs │ │ │ ├── ModuleProductManager.cs │ │ │ ├── ModuleStorageManager.cs │ │ │ ├── RaceManager.cs │ │ │ ├── ShipHangerManager.cs │ │ │ ├── ShipLoadoutManager.cs │ │ │ ├── TransportTypeManager.cs │ │ │ ├── WareEffectManager.cs │ │ │ ├── WareEquipmentManager.cs │ │ │ ├── WareGroupManager.cs │ │ │ ├── WareManager.cs │ │ │ ├── WareOwnerManager.cs │ │ │ ├── WareProductionManager.cs │ │ │ ├── WareResourceManager.cs │ │ │ ├── WareTagsManager.cs │ │ │ └── X4SizeManager.cs │ └── X4Database.cs ├── Entity │ └── EquippableWareEquipmentManager.cs ├── Infrastructure │ ├── ApplicationUpdater.cs │ └── ZipPackageExtractorEx.cs ├── Localization │ ├── Lang.csv │ ├── Lang.en-US.csv │ └── Lang.ja-JP.csv ├── Main │ ├── ImportExporter.cs │ ├── LanguagesManager.cs │ ├── LayoutsManager.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── MainWindowModel.cs │ ├── MainWindowViewModel.cs │ ├── Menu │ │ ├── File │ │ │ ├── Export │ │ │ │ ├── IExport.cs │ │ │ │ └── StationCalculatorExport.cs │ │ │ └── Import │ │ │ │ ├── IImport.cs │ │ │ │ ├── LoadoutImport │ │ │ │ ├── LoadoutImport.cs │ │ │ │ ├── LoadoutImportModel.cs │ │ │ │ ├── LoadoutImportViewModel.cs │ │ │ │ ├── LoadoutItem.cs │ │ │ │ ├── SelectLoadoutDialog.xaml │ │ │ │ └── SelectLoadoutDialog.xaml.cs │ │ │ │ ├── SaveDataImport │ │ │ │ ├── SaveDataImport.cs │ │ │ │ ├── SaveDataStationItem.cs │ │ │ │ ├── SelectStationDialog.xaml │ │ │ │ ├── SelectStationDialog.xaml.cs │ │ │ │ ├── SelectStationModel.cs │ │ │ │ └── SelectStationViewModel.cs │ │ │ │ ├── StationCalculatorImport.cs │ │ │ │ └── StationPlanImport │ │ │ │ ├── SelectPlanModel.cs │ │ │ │ ├── SelectPlanViewModel.cs │ │ │ │ ├── SelectPlanWindow.xaml │ │ │ │ ├── SelectPlanWindow.xaml.cs │ │ │ │ ├── StationPlanImport.cs │ │ │ │ └── StationPlanItem.cs │ │ ├── Lang │ │ │ └── LangMenuItem.cs │ │ ├── Layout │ │ │ └── LayoutMenuItem.cs │ │ └── View │ │ │ ├── DBViewer │ │ │ ├── DBViewerWindow.xaml │ │ │ ├── DBViewerWindow.xaml.cs │ │ │ ├── Modules │ │ │ │ ├── ModulesGrid.xaml │ │ │ │ ├── ModulesGrid.xaml.cs │ │ │ │ ├── ModulesGridItem.cs │ │ │ │ └── ModulesGridViewModel.cs │ │ │ ├── Races │ │ │ │ ├── RacesGrid.xaml │ │ │ │ ├── RacesGrid.xaml.cs │ │ │ │ ├── RacesGridItem.cs │ │ │ │ └── RacesViewModel.cs │ │ │ ├── Ships │ │ │ │ ├── EquipmentInfo.cs │ │ │ │ ├── ShipsGrid.xaml │ │ │ │ ├── ShipsGrid.xaml.cs │ │ │ │ ├── ShipsGridItem.cs │ │ │ │ └── ShipsViewModel.cs │ │ │ └── Wares │ │ │ │ ├── WaresGrid.xaml │ │ │ │ ├── WaresGrid.xaml.cs │ │ │ │ ├── WaresGridItem.cs │ │ │ │ └── WaresViewModel.cs │ │ │ └── EmpireOverview │ │ │ ├── EmpireOverViewProductsGridItem.cs │ │ │ ├── EmpireOverviewWindow.xaml │ │ │ ├── EmpireOverviewWindow.xaml.cs │ │ │ ├── EmpireOverviewWindowModel.cs │ │ │ ├── EmpireOverviewWindowViewModel.cs │ │ │ └── WorkAreaItem.cs │ ├── OwnerWindowSetter.cs │ ├── UpdateDownloadProgressDialog.xaml │ ├── UpdateDownloadProgressDialog.xaml.cs │ ├── UpdateDownloadProgressViewModel.cs │ ├── WorkArea │ │ ├── IWorkArea.cs │ │ ├── SaveDataReader │ │ │ ├── ISaveDataReader.cs │ │ │ ├── SaveDataReader0.cs │ │ │ ├── SaveDataReader1.cs │ │ │ ├── SaveDataReader2.cs │ │ │ └── SaveDataReaderFactory.cs │ │ ├── SaveDataWriter │ │ │ ├── ISaveDataWriter.cs │ │ │ └── SQLiteSaveDataWriter.cs │ │ ├── UI │ │ │ ├── BuildResourcesGrid │ │ │ │ ├── BuildResourceCalculator.cs │ │ │ │ ├── BuildResourcesGrid.xaml │ │ │ │ ├── BuildResourcesGrid.xaml.cs │ │ │ │ ├── BuildResourcesGridItem.cs │ │ │ │ ├── BuildResourcesGridModel.cs │ │ │ │ ├── BuildResourcesGridViewModel.cs │ │ │ │ └── CalcResult.cs │ │ │ ├── LayoutManagers │ │ │ │ └── LayoutManager.cs │ │ │ ├── Menu │ │ │ │ └── Tab │ │ │ │ │ └── VisiblityMenuItem.cs │ │ │ ├── ModulesGrid │ │ │ │ ├── ContextMenuOperation.cs │ │ │ │ ├── EditEquipment │ │ │ │ │ ├── EditEquipmentModel.cs │ │ │ │ │ ├── EditEquipmentViewModel.cs │ │ │ │ │ ├── EditEquipmentWindow.xaml │ │ │ │ │ ├── EditEquipmentWindow.xaml.cs │ │ │ │ │ ├── EquipmentList │ │ │ │ │ │ ├── EquipmentList.xaml │ │ │ │ │ │ ├── EquipmentList.xaml.cs │ │ │ │ │ │ ├── EquipmentListItem.cs │ │ │ │ │ │ ├── EquipmentListModel.cs │ │ │ │ │ │ └── EquipmentListViewModel.cs │ │ │ │ │ ├── FactionsListItem.cs │ │ │ │ │ └── PresetComboboxItem.cs │ │ │ │ ├── EquipmentsInfo.cs │ │ │ │ ├── ModulesGrid.xaml │ │ │ │ ├── ModulesGrid.xaml.cs │ │ │ │ ├── ModulesGridItem.cs │ │ │ │ ├── ModulesGridModel.cs │ │ │ │ ├── ModulesGridViewModel.cs │ │ │ │ ├── ModulesReorder.cs │ │ │ │ └── SelectModule │ │ │ │ │ ├── ModulesListItem.cs │ │ │ │ │ ├── SelectModuleModel.cs │ │ │ │ │ ├── SelectModuleViewModel.cs │ │ │ │ │ ├── SelectModuleWindow.xaml │ │ │ │ │ └── SelectModuleWindow.xaml.cs │ │ │ ├── ProductsGrid │ │ │ │ ├── CalcResult.cs │ │ │ │ ├── Efficiency2TextConverter.cs │ │ │ │ ├── IProductDetailsListItem.cs │ │ │ │ ├── ProductCalculator.cs │ │ │ │ ├── ProductDetailsListItem.cs │ │ │ │ ├── ProductDetailsListItemConsumption.cs │ │ │ │ ├── ProductsGrid.xaml │ │ │ │ ├── ProductsGrid.xaml.cs │ │ │ │ ├── ProductsGridItem.cs │ │ │ │ ├── ProductsGridModel.cs │ │ │ │ ├── ProductsGridViewModel.cs │ │ │ │ └── TradeOption.cs │ │ │ ├── StationSettings │ │ │ │ ├── StationSettings.xaml │ │ │ │ └── StationSettings.xaml.cs │ │ │ ├── StationSummary │ │ │ │ ├── BuildingCost │ │ │ │ │ └── BuildingCostModel.cs │ │ │ │ ├── Profit │ │ │ │ │ └── ProfitModel.cs │ │ │ │ ├── StationSummary.xaml │ │ │ │ ├── StationSummary.xaml.cs │ │ │ │ ├── StationSummaryViewModel.cs │ │ │ │ └── WorkForce │ │ │ │ │ ├── ModuleInfo │ │ │ │ │ ├── WorkForceModuleInfoDetailsItem.cs │ │ │ │ │ └── WorkForceModuleInfoModel.cs │ │ │ │ │ └── NeedWareInfo │ │ │ │ │ ├── NeedWareInfoDetailsItem.cs │ │ │ │ │ └── NeedWareInfoModel.cs │ │ │ ├── StorageAssign │ │ │ │ ├── StorageAssign.xaml │ │ │ │ ├── StorageAssign.xaml.cs │ │ │ │ ├── StorageAssignGridItem.cs │ │ │ │ ├── StorageAssignModel.cs │ │ │ │ ├── StorageAssignViewModel.cs │ │ │ │ └── StorageCapacityInfo.cs │ │ │ └── StoragesGrid │ │ │ │ ├── StorageDetailsListItem.cs │ │ │ │ ├── StoragesGrid.xaml │ │ │ │ ├── StoragesGrid.xaml.cs │ │ │ │ ├── StoragesGridItem.cs │ │ │ │ ├── StoragesGridModel.cs │ │ │ │ └── StoragesGridViewModel.cs │ │ ├── WorkArea.xaml │ │ ├── WorkArea.xaml.cs │ │ ├── WorkAreaData │ │ │ ├── BuildResources │ │ │ │ ├── BuildResourcesInfo.cs │ │ │ │ └── IBuildResourcesInfo.cs │ │ │ ├── IStationData.cs │ │ │ ├── Modules │ │ │ │ ├── IModulesInfo.cs │ │ │ │ └── ModulesInfo.cs │ │ │ ├── Products │ │ │ │ ├── IProductsInfo.cs │ │ │ │ └── ProductsInfo.cs │ │ │ ├── StationData.cs │ │ │ ├── StationSettings │ │ │ │ ├── IStationSettings.cs │ │ │ │ ├── StationSettings.cs │ │ │ │ └── WorkforceManager.cs │ │ │ ├── StorageAssign │ │ │ │ ├── IStorageAssignInfo.cs │ │ │ │ └── StorageAssignInfo.cs │ │ │ └── Storages │ │ │ │ ├── IStoragesInfo.cs │ │ │ │ └── StoragesInfo.cs │ │ ├── WorkAreaModel.cs │ │ └── WorkAreaViewModel.cs │ ├── WorkAreaFileIO.cs │ └── WorkAreaManager.cs ├── Themes │ ├── DataGridThemes.xaml │ ├── ListViewThemes.xaml │ ├── MenuItemThemes.xaml │ ├── OtherThemes.xaml │ └── WindowThemes.xaml └── X4_ComplexCalculator.csproj ├── X4_ComplexCalculator_CustomControlLibrary ├── AssemblyInfo.cs ├── ClearSortOrderDataGrid │ ├── ClearSortOrderDataGrid.cs │ └── Generic.xaml ├── ClearableWaterMarkTextBox │ ├── ClearableWaterMarkTextBox.cs │ └── Generic.xaml ├── CrossButton │ ├── CrossButton.cs │ └── Generic.xaml ├── DataGridExtensions │ ├── Behaviors │ │ ├── ApplyInitialSortingBehavior.cs │ │ ├── BeginEditOnCtrlEnterBehavior.cs │ │ ├── ClearTextBoxOnButtonClickBehavior.cs │ │ ├── DisableTargetWhileEditingBehavior.cs │ │ └── ExtendedStarSizeBehavior.cs │ ├── ColumnStyles.cs │ ├── DataGridEventsProvider.cs │ ├── DataGridFilter.cs │ ├── DataGridFilterColumn.cs │ ├── DataGridFilterColumnControl.cs │ ├── DataGridFilterHost.cs │ ├── DataGridFilteringEventArgs.cs │ ├── ExtensionMethods.cs │ ├── Framework │ │ └── DispatcherThrottle.cs │ ├── IContentFilter.cs │ ├── IContentFilterFactory.cs │ ├── IDataGridEventsProvider.cs │ ├── IResourceLocator.cs │ ├── InternalExtensionMethods.cs │ ├── License │ ├── RegexContentFilter.cs │ ├── SimpleContentFilter.cs │ ├── Themes │ │ └── Generic.xaml │ └── Tools.cs ├── DataGridFilter │ └── Generic.xaml ├── DataGridInline │ ├── InlineGridViewColumn.cs │ └── InlineListView.cs ├── FodyWeavers.xml ├── FodyWeavers.xsd ├── Themes │ └── Generic.xaml └── X4_ComplexCalculator_CustomControlLibrary.csproj ├── X4_DataExporterWPF.Tests ├── ExporterTest.cs ├── IAsyncEnumerableExtension.cs ├── TestHelperExtension.cs └── X4_DataExporterWPF.Tests.csproj ├── X4_DataExporterWPF ├── AssemblyInfo.cs ├── Entity │ ├── Common.cs │ ├── Effect.cs │ ├── Engine.cs │ ├── Equipment.cs │ ├── EquipmentTag.cs │ ├── EquipmentType.cs │ ├── Faction.cs │ ├── Map.cs │ ├── Module.cs │ ├── ModuleProduct.cs │ ├── ModuleShield.cs │ ├── ModuleStorage.cs │ ├── ModuleStorageType.cs │ ├── ModuleTurret.cs │ ├── ModuleType.cs │ ├── Purpose.cs │ ├── Race.cs │ ├── Shield.cs │ ├── Ship.cs │ ├── ShipHanger.cs │ ├── ShipLoadout.cs │ ├── ShipPurpose.cs │ ├── ShipResource.cs │ ├── ShipTransportType.cs │ ├── ShipType.cs │ ├── Size.cs │ ├── Thruster.cs │ ├── TransportType.cs │ ├── Ware.cs │ ├── WareEffect.cs │ ├── WareEquipment.cs │ ├── WareEquipmentTag.cs │ ├── WareGroup.cs │ ├── WareOwner.cs │ ├── WareProduction.cs │ ├── WareResource.cs │ ├── WareTag.cs │ ├── WorkUnitProduction.cs │ └── WorkUnitResource.cs ├── Export │ ├── CommonExporter.cs │ ├── DbBackupper.cs │ ├── Equipment │ │ ├── EngineExporter.cs │ │ ├── EquipmentExporter.cs │ │ ├── EquipmentTypeExporter.cs │ │ ├── ShieldExporter.cs │ │ └── ThrusterExporter.cs │ ├── IExporter.cs │ ├── Module │ │ ├── ModuleExporter.cs │ │ ├── ModuleProductExporter.cs │ │ ├── ModuleStorageExporter.cs │ │ └── ModuleTypeExporter.cs │ ├── Other │ │ ├── EffectExporter.cs │ │ ├── MapExporter.cs │ │ ├── PurposeExporter.cs │ │ ├── SizeExporter.cs │ │ └── TransportTypeExporter.cs │ ├── Race │ │ ├── FactionExporter.cs │ │ └── RaceExporter.cs │ ├── Ship │ │ ├── ShipExporter.cs │ │ ├── ShipHangerExporter.cs │ │ ├── ShipLoadoutExporter.cs │ │ ├── ShipPurposeExporter.cs │ │ ├── ShipTransportTypeExporter.cs │ │ └── ShipTypeExporter.cs │ ├── Util.cs │ └── Ware │ │ ├── WareEffectExporter.cs │ │ ├── WareEquipmentExporter.cs │ │ ├── WareExporter.cs │ │ ├── WareGroupExporter.cs │ │ ├── WareOwnerExporter.cs │ │ ├── WareProductionExporter.cs │ │ ├── WareResourceExporter.cs │ │ └── WareTagsExporter.cs ├── ExportWindow │ ├── DataExportModel.cs │ ├── DataExportViewModel.cs │ ├── DataExportWindow.xaml │ ├── DataExportWindow.xaml.cs │ ├── DependencyResolutionFailedWindows │ │ ├── DependencyResolutionFailedInfo.cs │ │ ├── DependencyResolutionFailedModel.cs │ │ ├── DependencyResolutionFailedWindow.xaml │ │ └── DependencyResolutionFailedWindow.xaml.cs │ ├── LangComboboxItem.cs │ └── ValueConverters │ │ └── EnumRadioButtonConverter.cs ├── Internal │ ├── IAsyncEnumerableExtension.cs │ ├── IDbConnectionExtension.cs │ └── ThumbnailManager.cs └── X4_DataExporterWPF.csproj ├── readme.ja.md └── readme.md /.editorconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ocelot1210/X4_ComplexCalculator/99d4d53101656c0853083eab6b12e59d7acdd272/.editorconfig -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "-" 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | # Describe the bug 11 | A clear and concise description of what the bug is. 12 | 13 | # To Reproduce 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | # Expected behavior 21 | A clear and concise description of what you expected to happen. 22 | 23 | # Screenshots 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | # Execution environment 27 | - OS: [e.g. Windows 10, Ver.XXXX, Build:YYYYY.ZZZZ] 28 | - Language [e.g. en-US (Preferably in accordance with RFC 4646.)] 29 | - App version [e.g. v1.2.3] 30 | - Version of X4. [e.g. 3.30 beta4] 31 | - Installed mods / DLCs. 32 | 1. Split Vendetta 33 | 1. ... 34 | 35 | # Additional context 36 | Add any other context about the problem here. [e.g. X4_ComplexCalculator_CrashReport.txt] 37 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: nuget 4 | directory: / 5 | schedule: 6 | interval: weekly 7 | 8 | - package-ecosystem: github-actions 9 | directory: / 10 | schedule: 11 | interval: monthly 12 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | runs-on: windows-latest 8 | if: > 9 | github.event_name == 'push' || 10 | github.event.pull_request.head.repo.full_name != github.repository 11 | 12 | strategy: 13 | matrix: 14 | Configuration: [Debug, Release] 15 | 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | with: 20 | fetch-depth: 0 21 | 22 | - name: Setup .Net 8 23 | uses: actions/setup-dotnet@v4 24 | with: 25 | dotnet-version: 8.x.x 26 | 27 | - name: Clean 28 | run: dotnet clean X4_ComplexCalculator.sln --configuration ${{ matrix.Configuration }} && dotnet nuget locals all --clear 29 | 30 | - name: Restore dependencies 31 | run: dotnet restore 32 | 33 | - name: Build 34 | run: dotnet build -c ${{ matrix.Configuration }} --no-restore 35 | 36 | - name: Test 37 | run: dotnet test 38 | 39 | - name: Upload build artifact 40 | uses: actions/upload-artifact@v4 41 | with: 42 | name: X4_ComplexCalculator-${{ matrix.Configuration }}-${{ github.sha }} 43 | path: X4_ComplexCalculator/bin/${{ matrix.Configuration }}/net8.0-windows7.0 44 | -------------------------------------------------------------------------------- /.img/en/top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ocelot1210/X4_ComplexCalculator/99d4d53101656c0853083eab6b12e59d7acdd272/.img/en/top.jpg -------------------------------------------------------------------------------- /.img/ja/top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ocelot1210/X4_ComplexCalculator/99d4d53101656c0853083eab6b12e59d7acdd272/.img/ja/top.jpg -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10.0 5 | enable 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LibX4.Tests/LibX4.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0-windows7.0 5 | false 6 | 7 | 8 | 9 | 10 | 11 | 12 | all 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | 15 | 16 | all 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/Config/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/Config/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironment/01.cat: -------------------------------------------------------------------------------- 1 | libraries/personal infomation/personal infomation.xml 13013 1617703127 6f136163eca16419f2f5ea7cf6ebdb1d 2 | libraries/personal infomation/personal_infomation.xml 13023 1617703127 565df9ab8756a4dae02ba29b0cda6c52 3 | libraries/personal_infomation.xml 10142 1617703127 ab5d8bb692d891c6af8a646951e70e54 4 | libraries/personal_infomation/personal infomation.xml 12994 1617703127 f92e60dc198ba460af6d6628329eac68 5 | libraries/personal_infomation/personal_infomation.xml 13011 1617703127 bd76c2df32a1bac5127ebbfc3bb74e90 6 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironment/02.cat: -------------------------------------------------------------------------------- 1 | libraries/personal_infomation.xml 10122 1617703127 a89a82a4ebf06a246a6e9476280c724e 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironment/extensions/bar_mod/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironment/extensions/bar_mod/ext_01.cat: -------------------------------------------------------------------------------- 1 | libraries/bar_mod_personal infomation/personal infomation.xml 13008 1617703127 dcddf9b4f49acd281b7cd9d4b2443fb7 2 | libraries/bar_mod_personal infomation/personal_infomation.xml 13010 1617703127 0fe72027aa6e797b37260808bee06c39 3 | libraries/bar_mod_personal_infomation/personal infomation.xml 13056 1617703127 329c8dbd7cf5c20ba0cb94bfa9c2ff04 4 | libraries/bar_mod_personal_infomation/personal_infomation.xml 13011 1617703127 f74f37ff2eed82716279286c3a51980c 5 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironment/extensions/foo_mod/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironment/extensions/foo_mod/ext_01.cat: -------------------------------------------------------------------------------- 1 | libraries/foo_mod_personal infomation/personal infomation.xml 13053 1617703127 6200ad19b31ac47636738f2cf9acb089 2 | libraries/foo_mod_personal infomation/personal_infomation.xml 13037 1617703127 a5b366e2075a75c40dbda47219165242 3 | libraries/foo_mod_personal_infomation/personal infomation.xml 13016 1617703127 05cfc075ac8a4ac3216debacec07c8de 4 | libraries/foo_mod_personal_infomation/personal_infomation.xml 13011 1617703127 9ce1570f29b24be632c85e5415e49262 5 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironment/version.dat: -------------------------------------------------------------------------------- 1 | 330 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironmentOrig/extensions/bar_mod/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironmentOrig/extensions/foo_mod/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModEnvironmentOrig/version.dat: -------------------------------------------------------------------------------- 1 | 330 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModIndexXml/01.cat: -------------------------------------------------------------------------------- 1 | assets/fx/macros/bar_macro.xml 12850 1617703127 7adea87f533f69cbf34c3446a89a97cc 2 | assets/fx/macros/foo_macro.xml 13036 1617703127 b98e8930982b7c6db4159b6ad33830f5 3 | index/macros.xml 185 1617703127 5c04510321ce124e7b3b72b1a7d2caae 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModIndexXml/extensions/baz_mod/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModIndexXml/extensions/baz_mod/ext_01.cat: -------------------------------------------------------------------------------- 1 | assets/fx/macros/baz_macro.xml 13063 1617703127 bb1a0a8beb1b8c4025bafc95f808192b 2 | index/macros.xml 152 1617703127 feb0d3fb9628dbbb30cbc18c4dd490b0 3 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModIndexXml/version.dat: -------------------------------------------------------------------------------- 1 | 330 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModIndexXmlOrig/01/index/macros.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModIndexXmlOrig/extensions/baz_mod/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModIndexXmlOrig/extensions/baz_mod/ext_01/index/macros.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/ModIndexXmlOrig/version.dat: -------------------------------------------------------------------------------- 1 | 330 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/PlaneFileModEnvironment/01.cat: -------------------------------------------------------------------------------- 1 | libraries/personal infomation/personal infomation.xml 12691 1613023474 7456b0ba0a7e9a12be58031c5281139c 2 | libraries/personal infomation/personal_infomation.xml 12701 1613023482 3f7e322bd6537e82aba0cbc6c64bfa54 3 | libraries/personal_infomation.xml 10141 1613093673 31b73d84f1795f198184f13018234f68 4 | libraries/personal_infomation/personal infomation.xml 12672 1613023520 3c1b9fa035a629847e6c1a6c5b866e0c 5 | libraries/personal_infomation/personal_infomation.xml 12689 1613023522 a85cd73ef26f5bbd0db6b59172c26d12 6 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/PlaneFileModEnvironment/02.cat: -------------------------------------------------------------------------------- 1 | libraries/personal_infomation.xml 10121 1613093694 65db3dfe5ef9a0992d6a2239d631b9f0 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/PlaneFileModEnvironment/extensions/bar_mod/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/PlaneFileModEnvironment/extensions/foo_mod/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/PlaneFileModEnvironment/version.dat: -------------------------------------------------------------------------------- 1 | 330 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/VanillaEnvironment/01.cat: -------------------------------------------------------------------------------- 1 | libraries/personal infomation/personal infomation.xml 13013 1617703127 6f136163eca16419f2f5ea7cf6ebdb1d 2 | libraries/personal infomation/personal_infomation.xml 13023 1617703127 565df9ab8756a4dae02ba29b0cda6c52 3 | libraries/personal_infomation.xml 10142 1617703127 ab5d8bb692d891c6af8a646951e70e54 4 | libraries/personal_infomation/personal infomation.xml 12994 1617703127 f92e60dc198ba460af6d6628329eac68 5 | libraries/personal_infomation/personal_infomation.xml 13011 1617703127 bd76c2df32a1bac5127ebbfc3bb74e90 6 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/VanillaEnvironment/02.cat: -------------------------------------------------------------------------------- 1 | libraries/personal_infomation.xml 10122 1617703127 a89a82a4ebf06a246a6e9476280c724e 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/VanillaEnvironment/version.dat: -------------------------------------------------------------------------------- 1 | 330 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/VanillaEnvironmentOrig/version.dat: -------------------------------------------------------------------------------- 1 | 330 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/VanillaIndexXml/01.cat: -------------------------------------------------------------------------------- 1 | assets/fx/macros/bar_macro.xml 13021 1617703127 209efb317335d63861b5192d1463bd0c 2 | assets/fx/macros/foo_macro.xml 13036 1617703127 b98e8930982b7c6db4159b6ad33830f5 3 | index/macros.xml 185 1617703127 5c04510321ce124e7b3b72b1a7d2caae 4 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/VanillaIndexXml/version.dat: -------------------------------------------------------------------------------- 1 | 330 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/VanillaIndexXmlOrig/01/index/macros.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LibX4.Tests/TestData/CatFileTest/VanillaIndexXmlOrig/version.dat: -------------------------------------------------------------------------------- 1 | 330 2 | -------------------------------------------------------------------------------- /LibX4.Tests/TestHelperExtension.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Xml.Linq; 3 | 4 | namespace LibX4.Tests; 5 | 6 | /// 7 | /// LibX4.Tests 用のユーティリティクラス 8 | /// 9 | internal static class TestHelperExtension 10 | { 11 | /// 12 | /// 文字列から文頭文末の改行及び各行のインデントを取り除く 13 | /// 14 | /// 対象の文字列 15 | /// 文頭文末の改行及び各行のインデントを取り除いた文字列 16 | public static string TrimIndent(this string source) 17 | { 18 | var lines = source.Split("\n").ToList(); 19 | if (string.IsNullOrWhiteSpace(lines.First())) lines.RemoveAt(0); 20 | if (string.IsNullOrWhiteSpace(lines.Last())) lines.RemoveAt(lines.Count - 1); 21 | var indent = lines 22 | .Where(l => !string.IsNullOrWhiteSpace(l)) 23 | .Min(l => l.TakeWhile(char.IsWhiteSpace).Count()); 24 | return string.Join("\n", lines.Select(l => l[indent..])); 25 | } 26 | 27 | 28 | /// 29 | /// 文字列を XML として読み込む 30 | /// 31 | /// XML として読み込む文字列 32 | /// 読み込んだ XML 33 | public static XDocument ToXDocument(this string source) 34 | => XDocument.Parse(source.TrimIndent()); 35 | } 36 | -------------------------------------------------------------------------------- /LibX4.Tests/XAttributeExtensionTest.cs: -------------------------------------------------------------------------------- 1 | using LibX4.Xml; 2 | using System.Globalization; 3 | using System.Threading; 4 | using System.Xml.Linq; 5 | using Xunit; 6 | 7 | namespace LibX4.Tests; 8 | 9 | /// 10 | /// のテストクラス 11 | /// 12 | public class XAttributeExtensionTest 13 | { 14 | /// 15 | /// 言語設定によっては double のパースに失敗する場合がある 16 | /// 参照: #5 17 | /// 18 | [Fact] 19 | public void ParseFailedInSomeCurrentCulture() 20 | { 21 | Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR"); 22 | 23 | var time = new XAttribute("time", "1.5"); 24 | Assert.Equal(1.5, time.GetDouble()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LibX4.Tests/XDocumentExTest.cs: -------------------------------------------------------------------------------- 1 | using LibX4.Xml; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Text; 5 | using Xunit; 6 | 7 | namespace LibX4.Tests; 8 | 9 | /// 10 | /// のテストクラス 11 | /// 12 | public class XDocumentExTest 13 | { 14 | /// 15 | /// UTF-8 の BOM 16 | /// 17 | private static readonly byte[] _Bom = Encoding.UTF8.GetPreamble(); 18 | 19 | 20 | /// 21 | /// テスト用の XML 文字列の配列 22 | /// 23 | public static object[][] TestXmls => new[] { 24 | new [] { "" }, 25 | new [] { @"" }, 26 | new [] { @"" }, 27 | new [] { @"" }, 28 | new [] { @"" }, 29 | }; 30 | 31 | 32 | /// 33 | /// UTF-8 エンコードされた XML ストリームから読み込める 34 | /// 35 | /// テスト用の文字列 36 | [Theory] 37 | [MemberData(nameof(TestXmls))] 38 | public void Utf8(string source) 39 | { 40 | var stream = new MemoryStream(Encoding.UTF8.GetBytes(source)); 41 | XDocumentEx.Load(stream); 42 | } 43 | 44 | 45 | /// 46 | /// UTF-8 with BOM エンコードされた XML ストリームから読み込める 47 | /// 48 | /// テスト用の文字列 49 | [Theory] 50 | [MemberData(nameof(TestXmls))] 51 | public void Utf8WithBom(string source) 52 | { 53 | var stream = new MemoryStream(_Bom.Concat(Encoding.UTF8.GetBytes(source)).ToArray()); 54 | XDocumentEx.Load(stream); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /LibX4/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("LibX4.Tests")] 4 | -------------------------------------------------------------------------------- /LibX4/FileSystem/CatLoadOption.cs: -------------------------------------------------------------------------------- 1 | namespace LibX4.FileSystem; 2 | 3 | 4 | /// 5 | /// .cat ファイルを読み込むオプション 6 | /// 7 | public enum CatLoadOption 8 | { 9 | None = 0b0000_0000, 10 | 11 | /// 12 | /// バニラのデータを読み込む 13 | /// 14 | Vanilla = 0b0000_0001, 15 | 16 | /// 17 | /// DLC のデータを読み込む 18 | /// 19 | Dlc = 0b0000_0010, 20 | 21 | /// 22 | /// Mod のデータを読み込む 23 | /// 24 | Mod = 0b0000_0100, 25 | 26 | /// 27 | /// 公式のデータを読み込む 28 | /// 29 | Official = Vanilla | Dlc, 30 | 31 | /// 32 | /// 全てのデータを読み込む 33 | /// 34 | All = Vanilla | Dlc | Mod, 35 | } 36 | -------------------------------------------------------------------------------- /LibX4/FileSystem/DependencyResolutionException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace LibX4.FileSystem; 5 | 6 | 7 | /// 8 | /// Mod の依存関係の解決に失敗した際にスローされる例外 9 | /// 10 | public class DependencyResolutionException : Exception 11 | { 12 | public readonly IReadOnlyList UnloadedMods = Array.Empty(); 13 | 14 | public DependencyResolutionException() { } 15 | 16 | public DependencyResolutionException(string message) : base(message) { } 17 | 18 | public DependencyResolutionException(string message, Exception? innerException) 19 | : base(message, innerException) { } 20 | 21 | public DependencyResolutionException(string message, IReadOnlyList unloadedMods) : base(message) 22 | { 23 | UnloadedMods = unloadedMods; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LibX4/FileSystem/IFileLoader.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace LibX4.FileSystem; 6 | 7 | interface IFileLoader 8 | { 9 | /// 10 | /// Mod等のルートディレクトリ 11 | /// 12 | public string RootDir { get; } 13 | 14 | 15 | /// 16 | /// 非同期にファイルを開く 17 | /// 18 | /// ファイルパス 19 | /// キャンセル トークン 20 | /// ファイルのStream、該当ファイルが無かった場合はnull 21 | public Task OpenFileAsync(string filePath, CancellationToken cancellationToken = default); 22 | } 23 | -------------------------------------------------------------------------------- /LibX4/FileSystem/IIndexResolver.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using System.Xml.Linq; 4 | 5 | namespace LibX4.FileSystem; 6 | 7 | /// 8 | /// マクロなどの外部 XML 参照を解決するインターフェース 9 | /// 10 | public interface IIndexResolver 11 | { 12 | /// 13 | /// Index ファイルに記載されているxmlを開く 14 | /// 15 | /// Index ファイルパス 16 | /// マクロ名等 17 | /// キャンセル トークン 18 | /// インデックスファイルに該当する名前が記載されていない場合 19 | /// 解決結果先のファイル 20 | public Task OpenIndexXmlAsync(string indexFilePath, string name, CancellationToken cancellationToken = default); 21 | } 22 | -------------------------------------------------------------------------------- /LibX4/Lang/ILanguageResolver.cs: -------------------------------------------------------------------------------- 1 | namespace LibX4.Lang; 2 | 3 | /// 4 | /// X4 の言語フィールド文字列 (例: {1001,2490}) を解決するインターフェース 5 | /// 6 | public interface ILanguageResolver 7 | { 8 | /// 9 | /// 言語フィールド文字列 (例: {1001,2490}) を解決する 10 | /// 11 | /// 言語フィールド文字列を含む文字列 12 | /// 言語フィールド文字列を解決し置き換えた文字列 13 | string Resolve(string target); 14 | } 15 | -------------------------------------------------------------------------------- /LibX4/LibX4.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0-windows7.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /LibX4/Xml/XmlFormatException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Linq; 3 | 4 | namespace LibX4.Xml; 5 | 6 | /// 7 | /// XML 文書の形式が無効である場合にスローされる例外 8 | /// 9 | public class XmlFormatException : FormatException 10 | { 11 | public XmlFormatException() { } 12 | 13 | public XmlFormatException(string message) : base(message) { } 14 | 15 | public XmlFormatException(string message, Exception? innerException) 16 | : base(message, innerException) { } 17 | 18 | 19 | /// 20 | /// 無効な値 21 | /// 22 | public string Input { get; private set; } = ""; 23 | 24 | 25 | /// 26 | /// 親要素 27 | /// 28 | public string Parent { get; private set; } = ""; 29 | 30 | 31 | /// 32 | /// 例外を説明するメッセージを取得 33 | /// 34 | public override string Message 35 | => string.Join(Environment.NewLine, base.Message, 36 | $"Input: {Input}", $"Parent: {Parent}"); 37 | 38 | 39 | /// 40 | /// XML 属性から XmlFormatException を初期化する 41 | /// 42 | /// エラーの発生した XML 属性 43 | /// 指定の XML 属性の情報で初期化した XmlFormatException 44 | public static XmlFormatException CreateFrom(XAttribute? attr, 45 | Exception? innerException = null) 46 | { 47 | var exception = new XmlFormatException("XML format is invalid.", innerException) 48 | { 49 | Input = attr?.Value ?? "", 50 | Parent = attr?.Parent?.ToString() ?? "" 51 | }; 52 | return exception; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace X4_ComplexCalculator; 4 | 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Behavior/DataGridHeaderThumbBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Controls.Primitives; 4 | 5 | namespace X4_ComplexCalculator.Common.Behavior; 6 | 7 | /// 8 | /// 参考:https://dotnetmemo.hatenadiary.org/entry/20120212/1329061121 9 | /// 10 | public class DataGridHeaderThumbBehavior 11 | { 12 | public static readonly DependencyProperty SyncColumnProperty = 13 | DependencyProperty.RegisterAttached("SyncColumn", typeof(DataGridColumn), typeof(DataGridHeaderThumbBehavior), new PropertyMetadata(PropertyCallback)); 14 | 15 | public static DataGridColumn GetSyncColumn(Thumb obj) 16 | => (DataGridColumn)obj.GetValue(SyncColumnProperty); 17 | 18 | public static void SetSyncColumn(Thumb obj, DataGridColumn value) 19 | => obj.SetValue(SyncColumnProperty, value); 20 | 21 | 22 | private static void PropertyCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args) 23 | { 24 | if (obj is not Thumb source) 25 | { 26 | return; 27 | } 28 | 29 | void eventHandler(object sender, DragDeltaEventArgs e) 30 | { 31 | var target = GetSyncColumn(source); 32 | target.Width = new DataGridLength(target.ActualWidth + e.HorizontalChange); 33 | } 34 | 35 | if (args.OldValue is not null) 36 | { 37 | source.DragDelta -= eventHandler; 38 | } 39 | 40 | if (args.NewValue is not null) 41 | { 42 | source.DragDelta += eventHandler; 43 | } 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Behavior/HorizontalScrollSyncBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace X4_ComplexCalculator.Common.Behavior; 5 | 6 | public class HorizontalScrollSyncBehavior 7 | { 8 | public static readonly DependencyProperty SyncElementProperty = 9 | DependencyProperty.RegisterAttached("SyncElement", typeof(ScrollViewer), typeof(HorizontalScrollSyncBehavior), new PropertyMetadata(PropertyCallback)); 10 | 11 | public static ScrollViewer GetSyncElement(ScrollViewer obj) 12 | => (ScrollViewer)obj.GetValue(SyncElementProperty); 13 | 14 | 15 | public static void SetSyncElement(ScrollViewer obj, ScrollViewer value) 16 | => obj.SetValue(SyncElementProperty, value); 17 | 18 | 19 | private static void PropertyCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args) 20 | { 21 | if (obj is not ScrollViewer source) 22 | { 23 | return; 24 | } 25 | 26 | void eventHandler(object sender, ScrollChangedEventArgs e) 27 | { 28 | var target = GetSyncElement(source); 29 | target?.ScrollToHorizontalOffset(source.HorizontalOffset); 30 | } 31 | 32 | if (args.OldValue is ScrollViewer oldScroll) 33 | { 34 | source.ScrollChanged -= eventHandler; 35 | } 36 | 37 | if (args.NewValue is ScrollViewer newScroll) 38 | { 39 | source.ScrollChanged += eventHandler; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/BindableBaseEx.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System.Collections.Generic; 3 | using System.Runtime.CompilerServices; 4 | 5 | namespace X4_ComplexCalculator.Common; 6 | 7 | public abstract class BindableBaseEx : BindableBase 8 | { 9 | 10 | /// 11 | /// 値が異なれば指定したプロパティに値を設定し、OnPropertyChangedを発火させる 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | protected bool SetPropertyEx(ref T storage, T value, [CallerMemberName] string propertyName = "") 19 | { 20 | if (EqualityComparer.Default.Equals(storage, value)) 21 | { 22 | return false; 23 | } 24 | 25 | T prevValue = storage; 26 | storage = value; 27 | RaisePropertyChangedEx(prevValue, value, propertyName); 28 | 29 | return true; 30 | } 31 | 32 | 33 | /// 34 | /// プロパティ変更通知 35 | /// 36 | /// 37 | /// 前回値 38 | /// 今回値 39 | /// プロパティ名 40 | protected void RaisePropertyChangedEx(T oldValue, T newValue, [CallerMemberName] string propertyName = "") 41 | { 42 | OnPropertyChanged(new PropertyChangedExtendedEventArgs(propertyName, oldValue, newValue)); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/BindingProxy.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace X4_ComplexCalculator.Common; 4 | 5 | /// 6 | /// データ中継用クラス 7 | /// 8 | public class BindingProxy : Freezable 9 | { 10 | protected override Freezable CreateInstanceCore() 11 | { 12 | return new BindingProxy(); 13 | } 14 | 15 | 16 | /// 17 | /// 中継するデータ 18 | /// 19 | public static readonly DependencyProperty DataProperty = 20 | DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null)); 21 | 22 | 23 | /// 24 | /// 中継するデータ 25 | /// 26 | public object Data 27 | { 28 | get => GetValue(DataProperty) ?? DefaultData; 29 | set => SetValue(DataProperty, value); 30 | } 31 | 32 | 33 | /// 34 | /// 中継するデータ(初期値) 35 | /// 36 | public static readonly DependencyProperty DefaultDataProperty = 37 | DependencyProperty.Register("DefaultData", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null)); 38 | 39 | 40 | /// 41 | /// 中継するデータ 42 | /// 43 | public object DefaultData 44 | { 45 | get => GetValue(DefaultDataProperty); 46 | set => SetValue(DefaultDataProperty, value); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Collection/PooledDisposableDictionary.cs: -------------------------------------------------------------------------------- 1 | using Collections.Pooled; 2 | using System; 3 | 4 | /// 5 | /// な場合、自動で Dispose してくれる 6 | /// 7 | /// 8 | /// 9 | internal class PooledDisposableDictionary : PooledDictionary , IDisposable 10 | where TKey : notnull 11 | where TValue : IDisposable 12 | { 13 | 14 | public new void Dispose() 15 | { 16 | foreach (var value in Values) 17 | { 18 | value.Dispose(); 19 | } 20 | base.Dispose(); 21 | } 22 | } -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Controls/DataGridFilter/Interface/IDataGridFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using X4_ComplexCalculator_CustomControlLibrary.DataGridExtensions; 3 | 4 | namespace X4_ComplexCalculator.Common.Controls.DataGridFilter.Interface; 5 | 6 | public interface IDataGridFilter : IContentFilter, IEquatable 7 | { 8 | /// 9 | /// フィルタが有効か 10 | /// 11 | public bool IsFilterEnabled { get; } 12 | } 13 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Controls/DataGridFilter/List/ListBoxItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | 3 | namespace X4_ComplexCalculator.Common.Controls.DataGridFilter.List; 4 | 5 | /// 6 | /// リスト用のアイテム 7 | /// 8 | class ListBoxItem : BindableBase 9 | { 10 | #region メンバ 11 | /// 12 | /// チェックされたか 13 | /// 14 | private bool _isChecked; 15 | #endregion 16 | 17 | 18 | #region プロパティ 19 | /// 20 | /// 表示文字列 21 | /// 22 | public string Text { get; } 23 | 24 | 25 | /// 26 | /// チェックされたか 27 | /// 28 | public bool IsChecked 29 | { 30 | get => _isChecked; 31 | set => SetProperty(ref _isChecked, value); 32 | } 33 | #endregion 34 | 35 | 36 | 37 | /// 38 | /// コンストラクタ 39 | /// 40 | /// 表示文字列 41 | /// チェックされたか 42 | public ListBoxItem(string text, bool isChecked = true) 43 | { 44 | Text = text; 45 | IsChecked = isChecked; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Controls/DataGridFilter/List/ListContentFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using X4_ComplexCalculator.Common.Controls.DataGridFilter.Interface; 5 | using X4_ComplexCalculator_CustomControlLibrary.DataGridExtensions; 6 | 7 | namespace X4_ComplexCalculator.Common.Controls.DataGridFilter.List; 8 | 9 | /// 10 | /// リストフィルタ用クラス 11 | /// 12 | public class ListContentFilter : IDataGridFilter 13 | { 14 | #region メンバ 15 | /// 16 | /// 除外された項目一覧 17 | /// 18 | private readonly IReadOnlyList _excludedItems; 19 | #endregion 20 | 21 | 22 | #region プロパティ 23 | /// 24 | public bool IsFilterEnabled => _excludedItems.Any(); 25 | #endregion 26 | 27 | 28 | /// 29 | /// コンストラクタ 30 | /// 31 | /// 除外された項目一覧 32 | public ListContentFilter(IEnumerable excludedItems) 33 | { 34 | _excludedItems = excludedItems.ToArray(); 35 | } 36 | 37 | 38 | /// 39 | public bool IsMatch(object? value) 40 | { 41 | return _excludedItems.Contains(value?.ToString() ?? string.Empty) != true; 42 | } 43 | 44 | 45 | /// 46 | public bool Equals(IContentFilter? other) 47 | { 48 | if (other is ListContentFilter filter) 49 | { 50 | return _excludedItems.Count == filter._excludedItems.Count && 51 | _excludedItems.OrderBy(x => x).SequenceEqual(filter._excludedItems.OrderBy(x => x)); 52 | } 53 | 54 | return false; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Controls/DataGridFilter/MultiList/MultiListBoxItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | 3 | namespace X4_ComplexCalculator.Common.Controls.DataGridFilter.MultiList; 4 | 5 | /// 6 | /// リスト用のアイテム 7 | /// 8 | class ListBoxItem : BindableBase 9 | { 10 | #region メンバ 11 | /// 12 | /// チェックされたか 13 | /// 14 | private bool _isChecked; 15 | #endregion 16 | 17 | 18 | #region プロパティ 19 | /// 20 | /// 表示文字列 21 | /// 22 | public string Text { get; } 23 | 24 | 25 | /// 26 | /// チェックされたか 27 | /// 28 | public bool IsChecked 29 | { 30 | get => _isChecked; 31 | set => SetProperty(ref _isChecked, value); 32 | } 33 | #endregion 34 | 35 | 36 | 37 | /// 38 | /// コンストラクタ 39 | /// 40 | /// 表示文字列 41 | /// チェックされたか 42 | public ListBoxItem(string text, bool isChecked = true) 43 | { 44 | Text = text; 45 | IsChecked = isChecked; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Controls/DataGridFilter/Numerical/NumericalFilterConditinos.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.Common.Controls.DataGridFilter.Numerical; 2 | 3 | /// 4 | /// 数値用フィルタの一致条件 5 | /// 6 | public enum NumericalFilterConditinos 7 | { 8 | Equals, // 指定の値に等しい 9 | NotEquals, // 指定の値に等しくない 10 | GreaterThan, // 指定の値を超える 11 | GreaterThanOrEqualTo, // 指定の値以上 12 | LessThan, // 指定の値未満 13 | LessThanOrEqualTo, // 指定の値以下 14 | Between, // 指定の範囲内 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Controls/DataGridFilter/Text/TextFilterConditions.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.Common.Controls.DataGridFilter.Text; 2 | 3 | /// 4 | /// 文字列用フィルタの一致条件 5 | /// 6 | public enum TextFilterConditions 7 | { 8 | Contains, // 文字列を含む 9 | NotContains, // 文字列を含まない 10 | Equals, // 文字列と一致する 11 | NotEquals, // 文字列と一致しない 12 | StartWith, // 文字列で始まる 13 | EndWith, // 文字列で終わる 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/Dialog/MessageBoxes/LocalizedMessageBoxResult.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.Common.Dialog.MessageBoxes; 2 | 3 | public enum LocalizedMessageBoxResult 4 | { 5 | None, 6 | OK, 7 | Cancel, 8 | Yes, 9 | No, 10 | } 11 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/EditStatus/EditStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace X4_ComplexCalculator.Common.EditStatus; 4 | 5 | /// 6 | /// 編集状態用列挙体 7 | /// 8 | [Flags] 9 | public enum EditStatus 10 | { 11 | Unedited = 0b_0000_0000, // 未編集 12 | Edited = 0b_0000_0001, // 編集された 13 | Saved = 0b_0000_0010, // 保存された 14 | EditAndSaved = Edited | Saved, // 編集して保存された 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/EditStatus/IEditable.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.Common.EditStatus; 2 | 3 | /// 4 | /// 編集状態保持用interface 5 | /// 6 | interface IEditable 7 | { 8 | /// 9 | /// 編集状態 10 | /// 11 | public EditStatus EditStatus { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/IReorderble.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.Common; 2 | 3 | /// 4 | /// 順番を入れ替え可能なコレクションの要素に対するインターフェイス 5 | /// 6 | interface IReorderble 7 | { 8 | /// 9 | /// 順番入れ替え対象か 10 | /// 11 | public bool IsReorderTarget { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ISelectable.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.Common; 2 | 3 | /// 4 | /// 選択可能アイテム用インターフェイス 5 | /// 6 | /// 7 | /// DataGrid等のItemsSourceに設定するアイテムが継承する事を想定 8 | /// 9 | public interface ISelectable 10 | { 11 | /// 12 | /// 選択されているか 13 | /// 14 | public bool IsSelected { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/MouseHoverEditCellColumn.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xaml.Behaviors; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using X4_ComplexCalculator.Common.Behavior; 5 | 6 | namespace X4_ComplexCalculator.Common; 7 | 8 | /// 9 | /// マウスホバー時に編集モードになるセル 10 | /// 11 | public class MouseHoverEditCellColumn : DataGridTemplateColumn 12 | { 13 | /// 14 | /// セル作成 15 | /// 16 | /// 17 | /// 18 | /// 19 | protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem) 20 | { 21 | Interaction.GetBehaviors(cell).Add(new DataGridMouseEnterEditModeBehavior()); 22 | 23 | return base.GenerateElement(cell, dataItem); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ProgressEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace X4_ComplexCalculator.Common; 5 | 6 | class ProgressEx : IProgress 7 | { 8 | /// 9 | /// 現在値 10 | /// 11 | private T _current; 12 | 13 | 14 | /// 15 | /// 進捗変更時に呼ばれるイベント 16 | /// 17 | public event EventHandler? ProgressChanged; 18 | 19 | 20 | 21 | /// 22 | /// コンストラクタ 23 | /// 24 | /// 初期値 25 | public ProgressEx(T firstValue) 26 | { 27 | _current = firstValue; 28 | } 29 | 30 | 31 | /// 32 | /// 進捗変更 33 | /// 34 | /// 変更後 35 | public void Report(T value) 36 | { 37 | // 同じ値なら何もしない 38 | if (EqualityComparer.Default.Equals(_current, value)) 39 | { 40 | return; 41 | } 42 | 43 | _current = value; 44 | ProgressChanged?.Invoke(this, _current); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/PropertyChangedExtendedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace X4_ComplexCalculator.Common; 4 | 5 | /// 6 | /// PropertyChangedEventArgsの拡張版(変更前後の値も保持) 7 | /// 8 | /// 9 | public class PropertyChangedExtendedEventArgs : PropertyChangedEventArgs 10 | { 11 | /// 12 | /// 変更前の値 13 | /// 14 | public virtual T OldValue { get; } 15 | 16 | /// 17 | /// 変更後の値 18 | /// 19 | public virtual T NewValue { get; } 20 | 21 | 22 | /// 23 | /// コンストラクタ 24 | /// 25 | /// プロパティ名 26 | /// 前回値 27 | /// 今回値 28 | public PropertyChangedExtendedEventArgs(string propertyName, T oldValue, T newValue) : base(propertyName) 29 | { 30 | OldValue = oldValue; 31 | NewValue = newValue; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ValueConverter/ActiveDocumentConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Data; 3 | using X4_ComplexCalculator.Main.WorkArea; 4 | 5 | namespace X4_ComplexCalculator.Common.ValueConverter; 6 | 7 | /// 8 | /// 9 | /// 10 | public class ActiveDocumentConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 13 | { 14 | if (value is WorkAreaViewModel) 15 | { 16 | return value; 17 | } 18 | 19 | return Binding.DoNothing; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 23 | { 24 | if (value is WorkAreaViewModel) 25 | { 26 | return value; 27 | } 28 | 29 | return Binding.DoNothing; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ValueConverter/Array2StringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Windows.Data; 6 | 7 | namespace X4_ComplexCalculator.Common.ValueConverter; 8 | 9 | /// 10 | /// 配列を指定した区切り文字で分割した文字列に変換するValueConverter 11 | /// 12 | public class Array2StringConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | if (value is IEnumerable arr) 17 | { 18 | return string.Join(parameter.ToString(), ConvertSub(arr)); 19 | } 20 | 21 | return value?.ToString() ?? ""; 22 | } 23 | 24 | private static IEnumerable ConvertSub(IEnumerable enumerable) 25 | { 26 | foreach (var item in enumerable) 27 | { 28 | yield return item?.ToString() ?? ""; 29 | } 30 | } 31 | 32 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 33 | { 34 | throw new NotImplementedException(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ValueConverter/BoolNegativeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace X4_ComplexCalculator.Common.ValueConverter; 6 | 7 | /// 8 | /// bool値を反転するValueConverter 9 | /// 10 | public class BoolNegativeConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | return !(value is bool boolean && boolean); 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | return !(value is bool boolean && boolean); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ValueConverter/EnumToBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace X4_ComplexCalculator.Common.ValueConverter; 7 | 8 | /// 9 | /// 列挙型とbool型を変換するValueConverter 10 | /// 11 | public class EnumToBooleanConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (parameter is not string paramStr) 16 | { 17 | return DependencyProperty.UnsetValue; 18 | } 19 | 20 | if (!Enum.IsDefined(value.GetType(), value)) 21 | { 22 | return DependencyProperty.UnsetValue; 23 | } 24 | 25 | var paramValue = Enum.Parse(value.GetType(), paramStr); 26 | 27 | return paramValue.Equals(value); 28 | } 29 | 30 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | if (parameter is not string paramStr) 33 | { 34 | return DependencyProperty.UnsetValue; 35 | } 36 | 37 | return true.Equals(value) ? Enum.Parse(targetType, paramStr) : DependencyProperty.UnsetValue; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ValueConverter/FormatStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | using System.Windows.Data; 5 | 6 | namespace X4_ComplexCalculator.Common.ValueConverter; 7 | 8 | public class FormatStringConverter : IMultiValueConverter 9 | { 10 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (values.Length < 1 || values[0] is not string key) 13 | { 14 | throw new ArgumentException("The first parameter must be language key.", nameof(values)); 15 | } 16 | 17 | return string.Format(key, values.Skip(1).ToArray()); 18 | } 19 | 20 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ValueConverter/IsLessThanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace X4_ComplexCalculator.Common.ValueConverter; 6 | 7 | /// 8 | /// 特定の値未満なら動作するValueConverter 9 | /// 10 | public class IsLessThanConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | if (parameter is not string param) 15 | { 16 | throw new ArgumentException($"paran ${parameter} must be string.", nameof(parameter)); 17 | } 18 | return System.Convert.ToInt64(value) < long.Parse(param); 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ValueConverter/SliderValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Data; 3 | 4 | namespace X4_ComplexCalculator.Common.ValueConverter; 5 | 6 | /// 7 | /// DataGridのヘッダ部分のスライダー用ValueConverter 8 | /// 9 | public class SliderValueConverter : IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 12 | { 13 | if (value is double) 14 | { 15 | return value; 16 | } 17 | 18 | return parameter ?? Binding.DoNothing; 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 22 | { 23 | if (value is double) 24 | { 25 | return value; 26 | } 27 | 28 | return parameter ?? Binding.DoNothing; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Common/ValueConverter/Visiblity2NullableBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | 7 | namespace X4_ComplexCalculator.Common.ValueConverter; 8 | 9 | /// 10 | /// Visiblityとboolの変換を行う 11 | /// 12 | class Visiblity2NullableBooleanConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type _, object parameter, CultureInfo culture) 15 | { 16 | var ret = (value is Visibility visibility) ? visibility == Visibility.Visible : Binding.DoNothing; 17 | return ret; 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | var ret = (value is bool?) ? (((bool?)value) == true) ? Visibility.Visible : Visibility.Collapsed : 23 | (value is bool) ? (((bool?)value) == true) ? Visibility.Visible : Visibility.Collapsed : Binding.DoNothing; 24 | 25 | return ret; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Builder/EngineBuilder.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using X4_ComplexCalculator.DB.X4DB.Entity; 6 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 7 | 8 | namespace X4_ComplexCalculator.DB.X4DB.Builder; 9 | 10 | /// 11 | /// クラスのインスタンスを作成するBuilderクラス 12 | /// 13 | class EngineBuilder 14 | { 15 | #region メンバ 16 | /// 17 | /// エンジン情報一覧 18 | /// 19 | private readonly IReadOnlyDictionary _engines; 20 | #endregion 21 | 22 | 23 | /// 24 | /// コンストラクタ 25 | /// 26 | /// DB接続情報 27 | public EngineBuilder(IDbConnection conn) 28 | { 29 | _engines = conn.Query("SELECT * FROM Engine") 30 | .ToDictionary(x => x.EquipmentID); 31 | } 32 | 33 | 34 | /// 35 | /// エンジン情報作成 36 | /// 37 | /// ベースとなる装備情報 38 | /// エンジン情報または装備情報 39 | public IEquipment Build(IEquipment equipment) 40 | { 41 | if (_engines.TryGetValue(equipment.ID, out var item)) 42 | { 43 | return new Engine( 44 | equipment, 45 | new EngineThrust(item.ForwardThrust, item.ReverseThrust, item.BoostThrust, item.TravelThrust), 46 | item.BoostDuration, 47 | item.BoostReleaseTime, 48 | item.TravelReleaseTime 49 | ); 50 | } 51 | 52 | return equipment; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Builder/ShieldBuilder.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using X4_ComplexCalculator.DB.X4DB.Entity; 6 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 7 | 8 | namespace X4_ComplexCalculator.DB.X4DB.Builder; 9 | 10 | /// 11 | /// クラスのインスタンスを作成するBuilderクラス 12 | /// 13 | class ShieldBuilder 14 | { 15 | #region メンバ 16 | /// 17 | /// シールド情報一覧 18 | /// 19 | private readonly IReadOnlyDictionary _shields; 20 | #endregion 21 | 22 | 23 | /// 24 | /// コンストラクタ 25 | /// 26 | /// DB接続情報 27 | public ShieldBuilder(IDbConnection conn) 28 | { 29 | _shields = conn.Query("SELECT * FROM Shield") 30 | .ToDictionary(x => x.EquipmentID); 31 | } 32 | 33 | 34 | /// 35 | /// シールド情報作成 36 | /// 37 | /// ベースとなる装備情報 38 | /// シールド情報または装備情報 39 | public IEquipment Build(IEquipment equipment) 40 | { 41 | if (_shields.TryGetValue(equipment.ID, out var item)) 42 | { 43 | return new Shield( 44 | equipment, 45 | item.Capacity, 46 | item.RechargeRate, 47 | item.RechargeDelay 48 | ); 49 | } 50 | 51 | return equipment; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Builder/ThrusterBuilder.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using X4_ComplexCalculator.DB.X4DB.Entity; 6 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 7 | 8 | namespace X4_ComplexCalculator.DB.X4DB.Builder; 9 | 10 | /// 11 | /// クラスのインスタンスを作成するBuilderクラス 12 | /// 13 | class ThrusterBuilder 14 | { 15 | #region メンバ 16 | /// 17 | /// スラスター情報一覧 18 | /// 19 | private readonly IReadOnlyDictionary _thrusters; 20 | #endregion 21 | 22 | 23 | /// 24 | /// コンストラクタ 25 | /// 26 | /// DB接続情報 27 | public ThrusterBuilder(IDbConnection conn) 28 | { 29 | _thrusters = conn.Query("SELECT * FROM Thruster") 30 | .ToDictionary(x => x.EquipmentID); 31 | } 32 | 33 | 34 | /// 35 | /// スラスター情報作成 36 | /// 37 | /// ベースとなる装備情報 38 | /// スラスター情報または装備情報 39 | public IEquipment Build(IEquipment equipment) 40 | { 41 | if (_thrusters.TryGetValue(equipment.ID, out var item)) 42 | { 43 | return new Thruster( 44 | equipment, 45 | item.ThrustStrafe, 46 | item.ThrustPitch, 47 | item.ThrustYaw, 48 | item.ThrustRoll, 49 | item.AngularRoll, 50 | item.AngularPitch 51 | ); 52 | } 53 | 54 | return equipment; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/Drag.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 2 | 3 | /// 4 | /// 艦船の抗力情報用クラス 5 | /// 6 | /// 前方抗力 7 | /// 後方抗力 8 | /// 水平抗力 9 | /// 垂直抗力 10 | /// ピッチ抗力 11 | /// ヨー抗力 12 | /// ロール抗力 13 | public sealed record Drag( 14 | double Forward, 15 | double Reverse, 16 | double Horizontal, 17 | double Vertical, 18 | double Pitch, 19 | double Yaw, 20 | double Roll 21 | ); 22 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/EngineThrust.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 2 | 3 | /// 4 | /// エンジンの推進力情報用クラス 5 | /// 6 | /// 前方推進力 7 | /// 後方推進力 8 | /// ブースト推進力 9 | /// トラベル推進力 10 | public sealed record EngineThrust( 11 | double Forward, 12 | double Reverse, 13 | double Boost, 14 | double Travel 15 | ); 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/EquipmentType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 5 | 6 | /// 7 | /// 装備種別情報用クラス 8 | /// 9 | public class EquipmentType : IEquipmentType 10 | { 11 | #region プロパティ 12 | /// 13 | public string EquipmentTypeID { get; } 14 | 15 | 16 | /// 17 | public string Name { get; } 18 | #endregion 19 | 20 | 21 | /// 22 | /// コンストラクタ 23 | /// 24 | /// 25 | /// 26 | public EquipmentType(string equipmentTypeID, string name) 27 | { 28 | EquipmentTypeID = equipmentTypeID; 29 | Name = name; 30 | } 31 | 32 | 33 | /// 34 | /// 比較 35 | /// 36 | /// 比較対象 37 | /// 38 | public override bool Equals(object? obj) => obj is IEquipmentType other && other.EquipmentTypeID == EquipmentTypeID; 39 | 40 | 41 | public bool Equals(IEquipmentType other) => other.EquipmentTypeID == EquipmentTypeID; 42 | 43 | 44 | /// 45 | /// ハッシュ値を取得 46 | /// 47 | /// ハッシュ値 48 | public override int GetHashCode() => HashCode.Combine(EquipmentTypeID); 49 | } 50 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/Faction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 4 | 5 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 6 | 7 | /// 8 | /// 派閥情報用クラス 9 | /// 10 | public class Faction : IFaction 11 | { 12 | #region IFaction 13 | /// 14 | public string FactionID { get; } 15 | 16 | 17 | /// 18 | public string Name { get; } 19 | 20 | 21 | /// 22 | public IRace Race { get; } 23 | 24 | 25 | /// 26 | public Color Color { get; } 27 | #endregion 28 | 29 | 30 | /// 31 | /// コンストラクタ 32 | /// 33 | /// 派閥ID 34 | /// 派閥名 35 | /// 種族 36 | public Faction(string factionID, string name, IRace race, int color) 37 | { 38 | FactionID = factionID; 39 | Name = name; 40 | Race = race; 41 | Color = Color.FromArgb(color); 42 | } 43 | 44 | 45 | /// 46 | /// 比較 47 | /// 48 | /// 比較対象 49 | /// 50 | public override bool Equals(object? obj) => obj is IFaction other && other.FactionID == FactionID; 51 | 52 | 53 | /// 54 | /// ハッシュ値を取得 55 | /// 56 | /// ハッシュ値 57 | public override int GetHashCode() => HashCode.Combine(FactionID); 58 | } 59 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/Inertia.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 2 | 3 | /// 4 | /// 艦船の慣性情報用クラス 5 | /// 6 | /// ピッチ 7 | /// ヨー 8 | /// ロール 9 | public sealed record Inertia(double Pitch, double Yaw, double Roll); 10 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/ModuleProduct.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 4 | 5 | /// 6 | /// モジュールの製品情報用クラス 7 | /// 8 | /// モジュールID 9 | /// 生産対象のウェアID 10 | /// 製造方式 11 | /// 生産量 12 | /// 生産情報 13 | public sealed record ModuleProduct( 14 | string ModuleID, 15 | string WareID, 16 | string Method, 17 | long Amount, 18 | IWareProduction WareProduction 19 | ) : IModuleProduct; 20 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/ModuleStorage.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 5 | 6 | /// 7 | /// モジュールの保管庫情報用クラス 8 | /// 9 | /// モジュールID 10 | /// 容量 11 | /// 保管庫種別一覧 12 | public sealed record ModuleStorage( 13 | string ID, 14 | long Amount, 15 | HashSet Types 16 | ) : IModuleStorage; 17 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/ModuleType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 5 | 6 | /// 7 | /// モジュール種別情報用クラス 8 | /// 9 | public class ModuleType : IModuleType 10 | { 11 | #region IModuleType 12 | /// 13 | public string ModuleTypeID { get; } 14 | 15 | 16 | /// 17 | public string Name { get; } 18 | #endregion 19 | 20 | 21 | /// 22 | /// コンストラクタ 23 | /// 24 | /// モジュール種別ID 25 | /// モジュール種別名 26 | public ModuleType(string moduleTypeID, string name) 27 | { 28 | ModuleTypeID = moduleTypeID; 29 | Name = name; 30 | } 31 | 32 | 33 | /// 34 | /// 比較 35 | /// 36 | /// 比較対象 37 | /// 38 | public override bool Equals(object? obj) => obj is IModuleType other && ModuleTypeID == other.ModuleTypeID; 39 | 40 | 41 | /// 42 | /// ハッシュ値を取得 43 | /// 44 | /// ハッシュ値 45 | public override int GetHashCode() => HashCode.Combine(ModuleTypeID); 46 | } 47 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/Race.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 5 | 6 | /// 7 | /// 種族情報用クラス 8 | /// 9 | public class Race : IRace 10 | { 11 | #region IRace 12 | /// 13 | public string RaceID { get; } 14 | 15 | 16 | /// 17 | public string Name { get; } 18 | 19 | 20 | /// 21 | public string ShortName { get; } 22 | 23 | 24 | /// 25 | public string Description { get; } 26 | #endregion 27 | 28 | 29 | /// 30 | /// コンストラクタ 31 | /// 32 | /// 種族ID 33 | /// 種族名 34 | /// 略称 35 | /// 説明文 36 | public Race(string raceID, string name, string shortName, string description) 37 | { 38 | RaceID = raceID; 39 | Name = name; 40 | ShortName = shortName; 41 | Description = description; 42 | } 43 | 44 | 45 | /// 46 | /// 比較 47 | /// 48 | /// 比較対象 49 | /// 50 | public override bool Equals(object? obj) => obj is IRace other && other.RaceID == RaceID; 51 | 52 | 53 | /// 54 | /// ハッシュ値を取得 55 | /// 56 | /// ハッシュ値 57 | public override int GetHashCode() => HashCode.Combine(RaceID); 58 | } 59 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/Shield.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 4 | 5 | /// 6 | /// シールド情報用クラス 7 | /// 8 | public partial class Shield : IShield 9 | { 10 | /// 11 | /// コンストラクタ 12 | /// 13 | /// 14 | /// 最大シールド容量 15 | /// 再充電率 16 | /// 再充電遅延 17 | public Shield(IEquipment equipment, long capacity, long rechargeRate, double rechargeDelay) 18 | { 19 | ID = equipment.ID; 20 | Name = equipment.Name; 21 | WareGroup = equipment.WareGroup; 22 | TransportType = equipment.TransportType; 23 | Description = equipment.Description; 24 | Volume = equipment.Volume; 25 | MinPrice = equipment.MinPrice; 26 | AvgPrice = equipment.AvgPrice; 27 | MaxPrice = equipment.MaxPrice; 28 | Owners = equipment.Owners; 29 | Productions = equipment.Productions; 30 | Resources = equipment.Resources; 31 | Tags = equipment.Tags; 32 | WareEffects = equipment.WareEffects; 33 | 34 | MacroName = equipment.MacroName; 35 | EquipmentType = equipment.EquipmentType; 36 | Hull = equipment.Hull; 37 | HullIntegrated = equipment.HullIntegrated; 38 | Mk = equipment.Mk; 39 | MakerRace = equipment.MakerRace; 40 | EquipmentTags = equipment.EquipmentTags; 41 | Size = equipment.Size; 42 | 43 | Capacity = capacity; 44 | RechargeRate = rechargeRate; 45 | RechargeDelay = rechargeDelay; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/ShipHanger.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 4 | 5 | /// 6 | /// 艦船のハンガー情報用クラス 7 | /// 8 | public class ShipHanger : IShipHanger 9 | { 10 | #region IShipHanger 11 | /// 12 | public string ShipID { get; } 13 | 14 | 15 | /// 16 | public IX4Size Size { get; } 17 | 18 | 19 | /// 20 | public long Count { get; } 21 | 22 | 23 | /// 24 | public long Capacity { get; } 25 | #endregion 26 | 27 | 28 | /// 29 | /// コンストラクタ 30 | /// 31 | /// 艦船ID 32 | /// 発着パッドのサイズID 33 | /// 発着パッド数 34 | /// 機体格納数 35 | public ShipHanger(string shipID, string sizeID, long count, long capacity) 36 | { 37 | ShipID = shipID; 38 | Size = X4Database.Instance.X4Size.Get(sizeID); 39 | Count = count; 40 | Capacity = capacity; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/ShipLoadout.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 4 | 5 | /// 6 | /// 艦船のロードアウト情報用クラス 7 | /// 8 | public class ShipLoadout : IShipLoadout 9 | { 10 | #region メンバ 11 | /// 12 | /// 装備品ID 13 | /// 14 | private readonly string _equipmentID; 15 | #endregion 16 | 17 | 18 | #region IShipLoadout 19 | /// 20 | public string ID { get; } 21 | 22 | 23 | /// 24 | public string LoadoutID { get; } 25 | 26 | 27 | /// 28 | public IEquipment Equipment => X4Database.Instance.Ware.Get(_equipmentID); 29 | 30 | 31 | /// 32 | public string GroupName { get; } 33 | 34 | 35 | /// 36 | public long Count { get; } 37 | #endregion 38 | 39 | 40 | 41 | /// 42 | /// コンストラクタ 43 | /// 44 | /// 艦船ID 45 | /// ロードアウトID 46 | /// グループ名 47 | /// 個数 48 | /// 装備ID 49 | public ShipLoadout(string shipID, string loadoutID, string groupName, long count, string equipmentID) 50 | { 51 | ID = shipID; 52 | LoadoutID = loadoutID; 53 | _equipmentID = equipmentID; 54 | GroupName = groupName; 55 | Count = count; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/ShipType.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB; 4 | 5 | /// 6 | /// 艦船種別情報用クラス 7 | /// 8 | /// 艦船種別ID 9 | /// 名称 10 | /// 説明文 11 | public sealed record ShipType(string ShipTypeID, string Name, string Description) : IShipType; 12 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/TransportType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 5 | 6 | /// 7 | /// カーゴタイプ(輸送種別)情報用クラス 8 | /// 9 | public class TransportType : ITransportType 10 | { 11 | #region ITransportType 12 | /// 13 | public string TransportTypeID { get; } 14 | 15 | 16 | /// 17 | public string Name { get; } 18 | #endregion 19 | 20 | 21 | /// 22 | /// コンストラクタ 23 | /// 24 | /// カーゴ種別ID 25 | /// カーゴ種別名 26 | public TransportType(string transportTypeID, string name) 27 | { 28 | TransportTypeID = transportTypeID; 29 | Name = name; 30 | } 31 | 32 | 33 | /// 34 | /// 比較 35 | /// 36 | /// 比較対象 37 | /// 38 | public override bool Equals(object? obj) => obj is ITransportType other && Equals(other); 39 | 40 | 41 | /// 42 | /// 比較 43 | /// 44 | /// 45 | /// 46 | public bool Equals(ITransportType other) => TransportTypeID == other.TransportTypeID; 47 | 48 | 49 | /// 50 | /// ハッシュ値を取得 51 | /// 52 | /// ハッシュ値 53 | public override int GetHashCode() => HashCode.Combine(TransportTypeID); 54 | } 55 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/Ware.Properties.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 5 | 6 | public partial class Ware 7 | { 8 | #region IWare 9 | /// 10 | public string ID { get; } 11 | 12 | 13 | /// 14 | public string Name { get; } 15 | 16 | 17 | /// 18 | public IWareGroup WareGroup { get; } 19 | 20 | 21 | /// 22 | public ITransportType TransportType { get; } 23 | 24 | 25 | /// 26 | public string Description { get; } 27 | 28 | 29 | /// 30 | public long Volume { get; } 31 | 32 | 33 | /// 34 | public long MinPrice { get; } 35 | 36 | 37 | /// 38 | public long AvgPrice { get; } 39 | 40 | 41 | /// 42 | public long MaxPrice { get; } 43 | 44 | 45 | /// 46 | public IReadOnlyList Owners { get; } 47 | 48 | 49 | /// 50 | public IReadOnlyDictionary Productions { get; } 51 | 52 | 53 | /// 54 | public IReadOnlyDictionary> Resources { get; } 55 | 56 | 57 | /// 58 | public HashSet Tags { get; } 59 | 60 | 61 | /// 62 | public IWareEffects WareEffects { get; } 63 | #endregion 64 | } 65 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/WareEffect.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 4 | 5 | /// 6 | /// ウェア生産時の追加効果情報用クラス 7 | /// 8 | /// ウェアID 9 | /// 生産方式 10 | /// 追加効果ID 11 | /// 追加効果の値 12 | public sealed record WareEffect( 13 | string WareID, 14 | string Method, 15 | string EffectID, 16 | double Product 17 | ) : IWareEffect; 18 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/WareGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 5 | 6 | /// 7 | /// ウェア種別(グループ)情報用クラス 8 | /// 9 | public class WareGroup : IWareGroup 10 | { 11 | #region プロパティ 12 | /// 13 | public string WareGroupID { get; } 14 | 15 | 16 | /// 17 | public string Name { get; } 18 | 19 | 20 | /// 21 | public long Tier { get; } 22 | #endregion 23 | 24 | 25 | /// 26 | /// コンストラクタ 27 | /// 28 | /// ウェアグループID 29 | /// ウェアグループ名 30 | /// 階級 31 | public WareGroup(string wareGroupID, string name, long tier) 32 | { 33 | WareGroupID = wareGroupID; 34 | Name = name; 35 | Tier = tier; 36 | } 37 | 38 | 39 | /// 40 | /// 比較 41 | /// 42 | /// 比較対象 43 | /// 44 | public override bool Equals(object? obj) => obj is IWareGroup other && other.WareGroupID == WareGroupID; 45 | 46 | 47 | /// 48 | /// ハッシュ値を取得 49 | /// 50 | /// ハッシュ値 51 | public override int GetHashCode() => HashCode.Combine(WareGroupID); 52 | } 53 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/WareProduction.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 4 | 5 | /// 6 | /// ウェアの生産量と生産時間情報用クラス 7 | /// 8 | /// ウェアID 9 | /// 生産方式 10 | /// 名称 11 | /// 生産量 12 | /// 生産時間 13 | public sealed record WareProduction( 14 | string WareID, 15 | string Method, 16 | string Name, 17 | long Amount, 18 | double Time 19 | ) : IWareProduction 20 | { 21 | /// 22 | public override string ToString() => Name; 23 | } 24 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/WareResource.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 4 | 5 | /// 6 | /// 1サイクルのウェア生産に必要なウェア情報用クラス 7 | /// 8 | /// ウェアID 9 | /// 生産方式 10 | /// 必要ウェアID 11 | /// 必要量 12 | public sealed record WareResource( 13 | string WareID, 14 | string Method, 15 | string NeedWareID, 16 | long Amount 17 | ) : IWareResource; 18 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Entity/X4Size.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.DB.X4DB.Entity; 5 | 6 | /// 7 | /// X4のサイズ情報用クラス 8 | /// 9 | /// サイズID 10 | /// サイズ名 11 | public sealed record X4Size(string SizeID, string Name) : IX4Size 12 | { 13 | #region プロパティ 14 | /// 15 | public int Size { get; } = SizeID switch 16 | { 17 | "extrasmall" => 0, 18 | "small" => 1, 19 | "medium" => 2, 20 | "large" => 3, 21 | "extralarge" => 4, 22 | _ => throw new NotSupportedException($"SizeID \"{SizeID}\" is not supported.") 23 | }; 24 | #endregion 25 | } 26 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IEngine.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB.X4DB.Entity; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 4 | 5 | /// 6 | /// エンジン情報用インターフェース 7 | /// 8 | public interface IEngine : IEquipment 9 | { 10 | #region プロパティ 11 | /// 12 | /// 推進力 13 | /// 14 | public EngineThrust Thrust { get; } 15 | 16 | 17 | /// 18 | /// ブースト持続時間 19 | /// 20 | public double BoostDuration { get; } 21 | 22 | 23 | /// 24 | /// ブースト解除時間 25 | /// 26 | public double BoostReleaseTime { get; } 27 | 28 | 29 | /// 30 | /// トラベル解除時間 31 | /// 32 | public double TravelReleaseTime { get; } 33 | #endregion 34 | } 35 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IEquipment.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 4 | 5 | /// 6 | /// 装備情報用インターフェース 7 | /// 8 | public interface IEquipment : IWare, IMacro 9 | { 10 | #region プロパティ 11 | /// 12 | /// 装備種別 13 | /// 14 | public IEquipmentType EquipmentType { get; } 15 | 16 | 17 | /// 18 | /// 船体値 19 | /// 20 | public long Hull { get; } 21 | 22 | 23 | /// 24 | /// 船体値が統合されているか 25 | /// 26 | public bool HullIntegrated { get; } 27 | 28 | 29 | /// 30 | /// Mk 31 | /// 32 | public long Mk { get; } 33 | 34 | 35 | /// 36 | /// 製造種族 37 | /// 38 | public IRace? MakerRace { get; } 39 | 40 | 41 | /// 42 | /// タグ情報 43 | /// 44 | public HashSet EquipmentTags { get; } 45 | 46 | 47 | /// 48 | /// サイズ 49 | /// 50 | public IX4Size? Size { get; } 51 | #endregion 52 | } 53 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IEquipmentType.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// 装備種別情報用インターフェイス 5 | /// 6 | public interface IEquipmentType 7 | { 8 | #region プロパティ 9 | /// 10 | /// 装備種別ID 11 | /// 12 | public string EquipmentTypeID { get; } 13 | 14 | 15 | /// 16 | /// 装備種別名 17 | /// 18 | public string Name { get; } 19 | #endregion 20 | } 21 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IEquippableWare.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 4 | 5 | /// 6 | /// 装備スロットを持つウェアの情報用インターフェイス 7 | /// 8 | public interface IEquippableWare : IWare 9 | { 10 | #region プロパティ 11 | /// 12 | /// 装備一覧 13 | /// 14 | public IReadOnlyDictionary Equipments { get; } 15 | #endregion 16 | 17 | 18 | #region メソッド 19 | /// 20 | /// 指定したコネクション名に装備可能な装備情報を取得する 21 | /// 22 | /// 指定したコネクション名に装備可能な装備情報 23 | public IEnumerable GetEquippableEquipment(string connectionName) where T : IEquipment; 24 | #endregion 25 | } 26 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IFaction.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 4 | 5 | /// 6 | /// 派閥情報用インターフェイス 7 | /// 8 | public interface IFaction 9 | { 10 | #region プロパティ 11 | /// 12 | /// 派閥ID 13 | /// 14 | public string FactionID { get; } 15 | 16 | 17 | /// 18 | /// 派閥名 19 | /// 20 | public string Name { get; } 21 | 22 | 23 | /// 24 | /// 派閥の種族 25 | /// 26 | public IRace Race { get; } 27 | 28 | 29 | /// 30 | /// 派閥の色 31 | /// 32 | public Color Color { get; } 33 | #endregion 34 | } 35 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IMacro.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// マクロ名を持つウェアを表すインターフェイス 5 | /// 6 | public interface IMacro : IWare 7 | { 8 | #region プロパティ 9 | /// 10 | /// マクロ名 11 | /// 12 | public string MacroName { get; } 13 | #endregion 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IModuleProduct.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// モジュールの製品情報用インターフェイス 5 | /// 6 | public interface IModuleProduct 7 | { 8 | #region プロパティ 9 | /// 10 | /// モジュールID 11 | /// 12 | public string ModuleID { get; } 13 | 14 | 15 | /// 16 | /// 生産対象のウェアID 17 | /// 18 | public string WareID { get; } 19 | 20 | 21 | /// 22 | /// 製造方式 23 | /// 24 | public string Method { get; } 25 | 26 | 27 | /// 28 | /// 生産量 29 | /// 30 | public long Amount { get; } 31 | 32 | 33 | /// 34 | /// 生産情報 35 | /// 36 | public IWareProduction WareProduction { get; } 37 | #endregion 38 | } 39 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IModuleStorage.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 4 | 5 | /// 6 | /// モジュールの保管庫情報用インターフェイス 7 | /// 8 | public interface IModuleStorage 9 | { 10 | #region プロパティ 11 | /// 12 | /// モジュールID 13 | /// 14 | public string ID { get; } 15 | 16 | 17 | /// 18 | /// 容量 19 | /// 20 | public long Amount { get; } 21 | 22 | 23 | /// 24 | /// 保管庫種別一覧 25 | /// 26 | public HashSet Types { get; } 27 | #endregion 28 | } 29 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IModuleType.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// モジュール種別情報用インターフェイス 5 | /// 6 | public interface IModuleType 7 | { 8 | #region プロパティ 9 | /// 10 | /// モジュール種別ID 11 | /// 12 | public string ModuleTypeID { get; } 13 | 14 | 15 | /// 16 | /// モジュール種別名 17 | /// 18 | public string Name { get; } 19 | #endregion 20 | } -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IRace.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// 種族情報用インターフェイス 5 | /// 6 | public interface IRace 7 | { 8 | #region プロパティ 9 | /// 10 | /// 種族ID 11 | /// 12 | public string RaceID { get; } 13 | 14 | 15 | /// 16 | /// 種族名 17 | /// 18 | public string Name { get; } 19 | 20 | 21 | /// 22 | /// 略称 23 | /// 24 | public string ShortName { get; } 25 | 26 | 27 | /// 28 | /// 説明文 29 | /// 30 | public string Description { get; } 31 | #endregion 32 | } 33 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IShield.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// シールド情報用インターフェース 5 | /// 6 | interface IShield : IEquipment 7 | { 8 | #region プロパティ 9 | /// 10 | /// 最大シールド容量 11 | /// 12 | public long Capacity { get; } 13 | 14 | 15 | /// 16 | /// 再充電率 17 | /// 18 | public long RechargeRate { get; } 19 | 20 | 21 | /// 22 | /// 再充電遅延 23 | /// 24 | public double RechargeDelay { get; } 25 | #endregion 26 | } 27 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IShipHanger.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// 艦船のハンガー情報管理用インターフェイス 5 | /// 6 | public interface IShipHanger 7 | { 8 | #region プロパティ 9 | /// 10 | /// 艦船ID 11 | /// 12 | public string ShipID { get; } 13 | 14 | 15 | /// 16 | /// 発着パッドのサイズ 17 | /// 18 | public IX4Size Size { get; } 19 | 20 | 21 | /// 22 | /// 発着パッド数 23 | /// 24 | public long Count { get; } 25 | 26 | 27 | /// 28 | /// 機体格納数 29 | /// 30 | public long Capacity { get; } 31 | #endregion 32 | } 33 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IShipLoadout.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// 艦船のロードアウト情報用インターフェイス 5 | /// 6 | public interface IShipLoadout 7 | { 8 | #region プロパティ 9 | /// 10 | /// 艦船ID 11 | /// 12 | public string ID { get; } 13 | 14 | 15 | /// 16 | /// ロードアウトID 17 | /// 18 | public string LoadoutID { get; } 19 | 20 | 21 | /// 22 | /// 装備品 23 | /// 24 | public IEquipment Equipment { get; } 25 | 26 | 27 | /// 28 | /// グループ名 29 | /// 30 | public string GroupName { get; } 31 | 32 | 33 | /// 34 | /// 個数 35 | /// 36 | public long Count { get; } 37 | #endregion 38 | } 39 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IShipType.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// 艦船種別情報用インターフェイス 5 | /// 6 | public interface IShipType 7 | { 8 | #region プロパティ 9 | /// 10 | /// 艦船種別ID 11 | /// 12 | public string ShipTypeID { get; } 13 | 14 | 15 | /// 16 | /// 名称 17 | /// 18 | public string Name { get; } 19 | 20 | 21 | /// 22 | /// 説明文 23 | /// 24 | public string Description { get; } 25 | #endregion 26 | } 27 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IThruster.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// スラスター情報用インターフェース 5 | /// 6 | public interface IThruster : IEquipment 7 | { 8 | #region プロパティ 9 | /// 10 | /// 推進(水平・垂直)? 11 | /// 12 | public double ThrustStrafe { get; } 13 | 14 | 15 | /// 16 | /// 推進力(ピッチ) 17 | /// 18 | public double ThrustPitch { get; } 19 | 20 | 21 | /// 22 | /// 推進力(ヨー) 23 | /// 24 | public double ThrustYaw { get; } 25 | 26 | 27 | /// 28 | /// 推進力(ロール) 29 | /// 30 | public double ThrustRoll { get; } 31 | 32 | 33 | /// 34 | /// 角度(ロール)? 35 | /// 36 | public double AngularRoll { get; } 37 | 38 | 39 | /// 40 | /// 角度(ピッチ)? 41 | /// 42 | public double AngularPitch { get; } 43 | #endregion 44 | } 45 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/ITransportType.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// カーゴタイプ(輸送種別)情報用インターフェイス 5 | /// 6 | public interface ITransportType 7 | { 8 | #region プロパティ 9 | /// 10 | /// カーゴ種別ID 11 | /// 12 | public string TransportTypeID { get; } 13 | 14 | 15 | /// 16 | /// カーゴ種別名 17 | /// 18 | public string Name { get; } 19 | #endregion 20 | } 21 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IWareEffect.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// ウェア単位のウェア生産時の追加効果情報用インターフェイス 5 | /// 6 | public interface IWareEffect 7 | { 8 | #region プロパティ 9 | /// 10 | /// ウェアID 11 | /// 12 | public string WareID { get; } 13 | 14 | 15 | /// 16 | /// 生産方式 17 | /// 18 | public string Method { get; } 19 | 20 | 21 | /// 22 | /// 追加効果ID 23 | /// 24 | public string EffectID { get; } 25 | 26 | 27 | /// 28 | /// 追加効果の値 29 | /// 30 | public double Product { get; } 31 | #endregion 32 | } 33 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IWareEffects.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 4 | 5 | /// 6 | /// ウェア単位のウェア生産時の追加効果情報用インターフェイス 7 | /// 8 | public interface IWareEffects 9 | { 10 | /// 11 | /// に対応する追加効果情報一覧を取得する 12 | /// 13 | /// ウェア生産方式 14 | /// に対応する追加効果情報一覧 又は null 15 | public IReadOnlyDictionary? TryGet(string method); 16 | 17 | 18 | 19 | /// 20 | /// に対応する追加効果情報を取得する 21 | /// 22 | /// ウェア生産方式 23 | /// 追加効果ID 24 | /// 25 | public IWareEffect? TryGet(string method, string effectID); 26 | } 27 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IWareEquipment.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 4 | 5 | /// 6 | /// ウェアの装備情報用インターフェイス 7 | /// 8 | public interface IWareEquipment 9 | { 10 | #region プロパティ 11 | /// 12 | /// ウェアID 13 | /// 14 | public string ID { get; } 15 | 16 | 17 | /// 18 | /// コネクション名 19 | /// 20 | public string ConnectionName { get; } 21 | 22 | 23 | /// 24 | /// 装備種別 25 | /// 26 | public IEquipmentType EquipmentType { get; } 27 | 28 | 29 | /// 30 | /// グループ名 31 | /// 32 | public string GroupName { get; } 33 | 34 | 35 | /// 36 | /// タグ情報 37 | /// 38 | public HashSet Tags { get; } 39 | #endregion 40 | 41 | 42 | /// 43 | /// 指定した装備がthisに装備可能か判定する 44 | /// 45 | /// 判定したい装備 46 | /// 指定した装備がthisに装備可能か 47 | public bool CanEquipped(IEquipment equipment); 48 | } 49 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IWareGroup.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// ウェア種別(グループ)情報用インターフェイス 5 | /// 6 | public interface IWareGroup 7 | { 8 | #region プロパティ 9 | /// 10 | /// ウェアグループID 11 | /// 12 | public string WareGroupID { get; } 13 | 14 | 15 | /// 16 | /// ウェアグループ名 17 | /// 18 | public string Name { get; } 19 | 20 | 21 | /// 22 | /// 階級 23 | /// 24 | public long Tier { get; } 25 | #endregion 26 | } 27 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IWareProduction.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | public interface IWareProduction 4 | { 5 | #region プロパティ 6 | /// 7 | /// ウェアID 8 | /// 9 | public string WareID { get; } 10 | 11 | 12 | /// 13 | /// 生産方式 14 | /// 15 | public string Method { get; } 16 | 17 | 18 | /// 19 | /// 名称 20 | /// 21 | public string Name { get; } 22 | 23 | 24 | /// 25 | /// 生産量 26 | /// 27 | public long Amount { get; } 28 | 29 | 30 | /// 31 | /// 生産時間 32 | /// 33 | public double Time { get; } 34 | #endregion 35 | } 36 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IWareResource.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 2 | 3 | /// 4 | /// 1サイクルのウェア生産に必要なウェア情報用インターフェイス 5 | /// 6 | public interface IWareResource 7 | { 8 | #region プロパティ 9 | /// 10 | /// ウェアID 11 | /// 12 | public string WareID { get; } 13 | 14 | 15 | /// 16 | /// 生産方式 17 | /// 18 | public string Method { get; } 19 | 20 | 21 | /// 22 | /// 必要ウェアID 23 | /// 24 | public string NeedWareID { get; } 25 | 26 | 27 | /// 28 | /// 必要量 29 | /// 30 | public long Amount { get; } 31 | #endregion 32 | } 33 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IX4Module.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 5 | 6 | /// 7 | /// ステーションモジュール情報用インターフェイス 8 | /// 9 | public interface IX4Module : IEquippableWare, IMacro, IComparable 10 | { 11 | #region プロパティ 12 | /// 13 | /// モジュール種別 14 | /// 15 | public IModuleType ModuleType { get; } 16 | 17 | 18 | /// 19 | /// 従業員数 20 | /// 21 | public long MaxWorkers { get; } 22 | 23 | 24 | /// 25 | /// 最大収容人数 26 | /// 27 | public long WorkersCapacity { get; } 28 | 29 | 30 | /// 31 | /// 設計図が無いか 32 | /// 33 | public bool NoBluePrint { get; } 34 | 35 | 36 | /// 37 | /// モジュールの製品 38 | /// 39 | public IReadOnlyList Products { get; } 40 | 41 | 42 | /// 43 | /// 保管庫情報 44 | /// 45 | public IModuleStorage Storage { get; } 46 | #endregion 47 | } 48 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Interfaces/IX4Size.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace X4_ComplexCalculator.DB.X4DB.Interfaces; 4 | 5 | /// 6 | /// サイズ情報用インターフェイス 7 | /// 8 | public interface IX4Size : IComparable 9 | { 10 | #region プロパティ 11 | /// 12 | /// サイズID 13 | /// 14 | public string SizeID { get; } 15 | 16 | 17 | /// 18 | /// サイズ名 19 | /// 20 | public string Name { get; } 21 | 22 | 23 | /// 24 | /// サイズ(比較用) 25 | /// 26 | public int Size { get; } 27 | #endregion 28 | 29 | 30 | 31 | /// 32 | /// 比較 33 | /// 34 | /// 比較対象 35 | /// 比較結果 36 | int IComparable.CompareTo(IX4Size? other) 37 | { 38 | if (other is null) 39 | { 40 | return 1; 41 | } 42 | 43 | return this.Size - other.Size; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Manager/EquipmentTypeManager.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using X4_ComplexCalculator.DB.X4DB.Entity; 6 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 7 | 8 | namespace X4_ComplexCalculator.DB.X4DB.Manager; 9 | 10 | /// 11 | /// に対応する を管理するクラス 12 | /// 13 | class EquipmentTypeManager 14 | { 15 | #region メンバ 16 | /// 17 | /// 装備種別一覧 18 | /// 19 | private readonly IReadOnlyDictionary _equipmentTypes; 20 | #endregion 21 | 22 | 23 | /// 24 | /// コンストラクタ 25 | /// 26 | /// DB接続情報 27 | public EquipmentTypeManager(IDbConnection conn) 28 | { 29 | const string SQL = "SELECT EquipmentTypeID, Name FROM EquipmentType"; 30 | _equipmentTypes = conn.Query(SQL) 31 | .ToDictionary(x => x.EquipmentTypeID, x => x as IEquipmentType); 32 | } 33 | 34 | 35 | /// 36 | /// に対応する を取得する 37 | /// 38 | /// 装備種別ID 39 | /// に対応する 40 | /// に対応する が無い場合 41 | public IEquipmentType Get(string id) => _equipmentTypes[id]; 42 | } 43 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Manager/FactionManager.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using X4_ComplexCalculator.DB.X4DB.Entity; 6 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 7 | 8 | namespace X4_ComplexCalculator.DB.X4DB.Manager; 9 | 10 | /// 11 | /// の一覧を管理するクラス 12 | /// 13 | class FactionManager 14 | { 15 | #region メンバ 16 | /// 17 | /// 派閥一覧 18 | /// 19 | private readonly IReadOnlyDictionary _factions; 20 | #endregion 21 | 22 | 23 | /// 24 | /// コンストラクタ 25 | /// 26 | /// DB接続情報 27 | /// 種族情報 28 | public FactionManager(IDbConnection conn, RaceManager raceManager) 29 | { 30 | _factions = conn.Query("SELECT * FROM Faction WHERE RaceID IN (SELECT RaceID FROM Race)") 31 | .Select(x => new Faction(x.FactionID, x.Name, raceManager.Get(x.RaceID), (int)x.Color) as IFaction) 32 | .ToDictionary(x => x.FactionID); 33 | } 34 | 35 | 36 | /// 37 | /// 派閥IDに対応する派閥の取得を試みる 38 | /// 39 | /// 種族ID 40 | /// 派閥IDに対応する派閥 派閥IDに対応する派閥が無ければnull 41 | public IFaction? TryGet(string id) => 42 | _factions.TryGetValue(id, out var race) ? race : null; 43 | } 44 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Manager/TransportTypeManager.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using X4_ComplexCalculator.DB.X4DB.Entity; 6 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 7 | 8 | namespace X4_ComplexCalculator.DB.X4DB.Manager; 9 | 10 | /// 11 | /// の一覧を管理するクラス 12 | /// 13 | public class TransportTypeManager 14 | { 15 | /// 16 | /// カーゴタイプ一覧 17 | /// 18 | private readonly IReadOnlyDictionary _transportTypes; 19 | 20 | 21 | /// 22 | /// コンストラクタ 23 | /// 24 | /// DB接続情報 25 | public TransportTypeManager(IDbConnection conn) 26 | { 27 | const string SQL = "SELECT TransportTypeID, Name FROM TransportType"; 28 | _transportTypes = conn.Query(SQL).ToDictionary(x => x.TransportTypeID, x => x as ITransportType); 29 | } 30 | 31 | 32 | /// 33 | /// に対応する を取得する 34 | /// 35 | /// カーゴ種別ID 36 | /// に対応する 37 | /// に対応する が無い場合 38 | public ITransportType Get(string id) => _transportTypes[id]; 39 | 40 | 41 | /// 42 | /// 全ての を列挙する 43 | /// 44 | /// 全ての の列挙 45 | public IEnumerable GetAll() => _transportTypes.Values; 46 | } 47 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Manager/WareEffectManager.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using X4_ComplexCalculator.DB.X4DB.Entity; 6 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 7 | 8 | namespace X4_ComplexCalculator.DB.X4DB.Manager; 9 | 10 | /// 11 | /// の一覧を管理するクラス 12 | /// 13 | class WareEffectManager 14 | { 15 | #region メンバ 16 | /// 17 | /// をキーにしたウェア生産時の追加効果情報一覧 18 | /// 19 | private readonly IReadOnlyDictionary _wareEffects; 20 | 21 | 22 | /// 23 | /// 空のウェア生産時の追加効果情報 24 | /// 25 | private readonly IWareEffects _emptyEffect = new WareEffects(Enumerable.Empty()); 26 | #endregion 27 | 28 | 29 | /// 30 | /// コンストラクタ 31 | /// 32 | /// DB接続情報 33 | public WareEffectManager(IDbConnection conn) 34 | { 35 | const string SQL = "SELECT WareID, Method, EffectID, Product FROM WareEffect"; 36 | 37 | _wareEffects = conn.Query(SQL) 38 | .GroupBy(x => x.WareID) 39 | .ToDictionary(x => x.Key, x => new WareEffects(x)); 40 | } 41 | 42 | 43 | /// 44 | /// に対応するウェア生産時の追加効果情報一覧を取得する 45 | /// 46 | /// 47 | /// に対応するウェア生産時の追加効果情報一覧 48 | public IWareEffects Get(string id) 49 | => _wareEffects.TryGetValue(id, out var effects) ? effects : _emptyEffect; 50 | } 51 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/DB/X4DB/Manager/WareGroupManager.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using X4_ComplexCalculator.DB.X4DB.Entity; 6 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 7 | 8 | namespace X4_ComplexCalculator.DB.X4DB.Manager; 9 | 10 | /// 11 | /// の一覧を管理するクラス 12 | /// 13 | class WareGroupManager 14 | { 15 | #region メンバ 16 | /// 17 | /// ウェア種別IDをキーにした の一覧 18 | /// 19 | private readonly IReadOnlyDictionary _wareGroups; 20 | 21 | 22 | /// 23 | /// ダミー用ウェア種別 24 | /// 25 | private readonly IWareGroup _dummyWareGroup = new WareGroup("", "", -1); 26 | #endregion 27 | 28 | 29 | /// 30 | /// コンストラクタ 31 | /// 32 | /// DB接続情報 33 | public WareGroupManager(IDbConnection conn) 34 | { 35 | const string SQL = "SELECT WareGroupID, Name, Tier FROM WareGroup"; 36 | _wareGroups = conn.Query(SQL) 37 | .ToDictionary(x => x.WareGroupID, x => x as IWareGroup); 38 | } 39 | 40 | 41 | /// 42 | /// に対応する の取得を試みる 43 | /// 44 | /// ウェア種別ID 45 | /// 46 | /// に対応する 47 | /// 無ければ空の 48 | /// 49 | public IWareGroup TryGet(string wareGroupID) => 50 | _wareGroups.TryGetValue(wareGroupID, out var ret) ? ret : _dummyWareGroup; 51 | } 52 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Localization/Lang.en-US.csv: -------------------------------------------------------------------------------- 1 | dummy -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Dialog.MessageBoxes; 2 | 3 | namespace X4_ComplexCalculator.Main; 4 | 5 | /// 6 | /// Interaction logic for MainWindow.xaml 7 | /// 8 | public partial class MainWindow 9 | { 10 | public MainWindow() 11 | { 12 | System.Windows.Forms.Application.EnableVisualStyles(); 13 | 14 | InitializeComponent(); 15 | DataContext = new MainWindowViewModel(new LocalizedMessageBoxEx(this)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/File/Export/IExport.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | using X4_ComplexCalculator.Main.WorkArea; 3 | 4 | namespace X4_ComplexCalculator.Main.Menu.File.Export; 5 | 6 | public interface IExport 7 | { 8 | /// 9 | /// メニュー表示用タイトル 10 | /// 11 | public string Title { get; } 12 | 13 | 14 | /// 15 | /// Viewより呼ばれるCommand 16 | /// 17 | public ICommand Command { get; } 18 | 19 | 20 | /// 21 | /// エクスポート実行 22 | /// 23 | /// 作業エリア 24 | /// エクスポートに成功したか 25 | public bool Export(IWorkArea WorkArea); 26 | } 27 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/File/Import/IImport.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | using X4_ComplexCalculator.Main.WorkArea; 3 | 4 | namespace X4_ComplexCalculator.Main.Menu.File.Import; 5 | 6 | public interface IImport 7 | { 8 | /// 9 | /// メニュー表示用タイトル 10 | /// 11 | public string Title { get; } 12 | 13 | 14 | /// 15 | /// Viewより呼ばれるCommand 16 | /// 17 | public ICommand Command { get; } 18 | 19 | 20 | /// 21 | /// インポート対象を選択 22 | /// 23 | /// インポート対象数 24 | public int Select(); 25 | 26 | 27 | /// 28 | /// インポート実行 29 | /// 30 | /// 作業エリア 31 | /// インポートに成功したか 32 | public bool Import(IWorkArea WorkArea); 33 | } 34 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/File/Import/LoadoutImport/LoadoutImport.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System.Windows.Input; 3 | using X4_ComplexCalculator.Main.WorkArea; 4 | 5 | namespace X4_ComplexCalculator.Main.Menu.File.Import.LoadoutImport; 6 | 7 | /// 8 | /// 装備をインポート 9 | /// 10 | class LoadoutImport : BindableBase, IImport 11 | { 12 | /// 13 | /// メニュー表示用タイトル 14 | /// 15 | public string Title => "Lang:MainWindow_Menu_File_MenuItem_Import_MenuItem_Loadout_Header"; 16 | 17 | 18 | /// 19 | /// Viewより呼ばれるCommand 20 | /// 21 | public ICommand Command { get; } 22 | 23 | 24 | /// 25 | /// コンストラクタ 26 | /// 27 | /// Viewより呼ばれるCommand 28 | public LoadoutImport(ICommand command) => Command = command; 29 | 30 | 31 | /// 32 | /// インポート処理 33 | /// 34 | /// 35 | /// 36 | public bool Import(IWorkArea _) => true; // 何もしない 37 | 38 | 39 | /// 40 | /// インポート対象を選択 41 | /// 42 | /// インポート対象数 43 | public int Select() 44 | { 45 | SelectLoadoutDialog.ShowImportDialog(); 46 | return 0; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/File/Import/LoadoutImport/SelectLoadoutDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Windows; 3 | using X4_ComplexCalculator.Common.Dialog.MessageBoxes; 4 | 5 | namespace X4_ComplexCalculator.Main.Menu.File.Import.LoadoutImport; 6 | 7 | /// 8 | /// SelectLoadoutDialog.xaml の相互作用ロジック 9 | /// 10 | public partial class SelectLoadoutDialog : Window 11 | { 12 | /// 13 | /// コンストラクタ 14 | /// 15 | private SelectLoadoutDialog() 16 | { 17 | InitializeComponent(); 18 | 19 | DataContext = new LoadoutImportViewModel(new LocalizedMessageBoxEx(this)); 20 | } 21 | 22 | 23 | /// 24 | /// ダイアログ表示 25 | /// 26 | public static bool ShowImportDialog() 27 | { 28 | var wnd = new SelectLoadoutDialog 29 | { 30 | Owner = Application.Current.Windows.OfType().FirstOrDefault(x => x.IsActive) ?? Application.Current.MainWindow 31 | }; 32 | 33 | return wnd.ShowDialog() == true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/File/Import/SaveDataImport/SaveDataStationItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System.Xml.Linq; 3 | 4 | namespace X4_ComplexCalculator.Main.Menu.File.Import.SaveDataImport; 5 | 6 | /// 7 | /// X4 セーブデータインポート時のステーション一覧1レコード分 8 | /// 9 | public class SaveDataStationItem : BindableBase 10 | { 11 | #region メンバ 12 | /// 13 | /// チェックされたか 14 | /// 15 | private bool _isChecked; 16 | #endregion 17 | 18 | 19 | #region プロパティ 20 | /// 21 | /// セクター名 22 | /// 23 | public string SectorName { get; } 24 | 25 | 26 | /// 27 | /// ステーション名 28 | /// 29 | public string StationName { get; } 30 | 31 | 32 | /// 33 | /// チェックされたか 34 | /// 35 | public bool IsChecked 36 | { 37 | get => _isChecked; 38 | set => SetProperty(ref _isChecked, value); 39 | } 40 | 41 | 42 | /// 43 | /// xml内容 44 | /// 45 | public XElement XElement { get; } 46 | #endregion 47 | 48 | 49 | /// 50 | /// コンストラクタ 51 | /// 52 | /// セクター名 53 | /// xml内容 54 | public SaveDataStationItem(string sectorName, XElement xElement) 55 | { 56 | SectorName = sectorName; 57 | StationName = xElement.Attribute("name")?.Value ?? ""; 58 | XElement = xElement; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/File/Import/SaveDataImport/SelectStationDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Windows; 4 | using X4_ComplexCalculator.Common.Dialog.MessageBoxes; 5 | 6 | namespace X4_ComplexCalculator.Main.Menu.File.Import.SaveDataImport; 7 | 8 | /// 9 | /// SelectStationDialog.xaml の相互作用ロジック 10 | /// 11 | public partial class SelectStationDialog : Window 12 | { 13 | /// 14 | /// コンストラクタ 15 | /// 16 | /// 選択計画一覧 17 | private SelectStationDialog(List planItems) 18 | { 19 | InitializeComponent(); 20 | DataContext = new SelectStationViewModel(planItems, new LocalizedMessageBoxEx(this)); 21 | } 22 | 23 | 24 | /// 25 | /// ダイアログ表示 26 | /// 27 | /// 選択計画一覧 28 | public static bool ShowDialog(List stationItems) 29 | { 30 | var wnd = new SelectStationDialog(stationItems) 31 | { 32 | Owner = Application.Current.Windows.OfType().FirstOrDefault(x => x.IsActive) ?? Application.Current.MainWindow 33 | }; 34 | 35 | return wnd.ShowDialog() == true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/File/Import/StationPlanImport/SelectPlanWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Windows; 4 | using X4_ComplexCalculator.Common.Dialog.MessageBoxes; 5 | 6 | namespace X4_ComplexCalculator.Main.Menu.File.Import.StationPlanImport; 7 | 8 | /// 9 | /// SelectPlanWindow.xaml の相互作用ロジック 10 | /// 11 | public partial class SelectPlanDialog : Window 12 | { 13 | /// 14 | /// コンストラクタ 15 | /// 16 | /// 選択計画一覧 17 | private SelectPlanDialog(List planItems) 18 | { 19 | InitializeComponent(); 20 | DataContext = new SelectPlanViewModel(planItems, new LocalizedMessageBoxEx(this)); 21 | } 22 | 23 | 24 | /// 25 | /// ダイアログ表示 26 | /// 27 | /// 選択計画一覧 28 | public static bool ShowDialog(List planItems) 29 | { 30 | var wnd = new SelectPlanDialog(planItems) 31 | { 32 | Owner = Application.Current.Windows.OfType().FirstOrDefault(x => x.IsActive) ?? Application.Current.MainWindow 33 | }; 34 | 35 | return wnd.ShowDialog() == true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/File/Import/StationPlanImport/StationPlanItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System.Xml.Linq; 3 | 4 | namespace X4_ComplexCalculator.Main.Menu.File.Import.StationPlanImport; 5 | 6 | /// 7 | /// ステーション計画1レコード分 8 | /// 9 | public class StationPlanItem : BindableBase 10 | { 11 | #region メンバ 12 | /// 13 | /// チェックされたか 14 | /// 15 | public bool _IsChecked; 16 | #endregion 17 | 18 | 19 | #region プロパティ 20 | /// 21 | /// 計画ID 22 | /// 23 | public string PlanID { get; } 24 | 25 | 26 | /// 27 | /// 計画名 28 | /// 29 | public string PlanName { get; } 30 | 31 | 32 | /// 33 | /// チェックされたか 34 | /// 35 | public bool IsChecked 36 | { 37 | get => _IsChecked; 38 | set => SetProperty(ref _IsChecked, value); 39 | } 40 | 41 | 42 | /// 43 | /// 計画 44 | /// 45 | public XElement Plan { get; } 46 | #endregion 47 | 48 | 49 | /// 50 | /// コンストラクタ 51 | /// 52 | /// 計画ID 53 | /// 計画名 54 | /// 計画を表す 55 | public StationPlanItem(string planID, string planName, XElement plan) 56 | { 57 | PlanID = planID; 58 | PlanName = planName; 59 | Plan = plan; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/Lang/LangMenuItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using Reactive.Bindings; 3 | using Reactive.Bindings.Extensions; 4 | using System.Globalization; 5 | 6 | namespace X4_ComplexCalculator.Main.Menu.Lang; 7 | 8 | /// 9 | /// 言語メニュー1レコード分 10 | /// 11 | public class LangMenuItem : BindableBase 12 | { 13 | #region プロパティ 14 | /// 15 | /// 言語 16 | /// 17 | public CultureInfo CultureInfo { get; } 18 | 19 | 20 | /// 21 | /// チェックされたか 22 | /// 23 | public ReactivePropertySlim IsChecked { get; } 24 | 25 | 26 | /// 27 | /// チェックを外すことはできない 28 | /// 29 | public ReadOnlyReactivePropertySlim IsCheckable { get; } 30 | #endregion 31 | 32 | 33 | /// 34 | /// コンストラクタ 35 | /// 36 | /// 言語情報 37 | public LangMenuItem(CultureInfo cultureInfo, bool isChecked) 38 | { 39 | CultureInfo = cultureInfo; 40 | IsChecked = new ReactivePropertySlim(isChecked); 41 | IsCheckable = IsChecked.Inverse().ToReadOnlyReactivePropertySlim(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/Layout/LayoutMenuItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using Reactive.Bindings; 3 | 4 | namespace X4_ComplexCalculator.Main.Menu.Layout; 5 | 6 | /// 7 | /// レイアウト一覧の1レコード分 8 | /// 9 | public class LayoutMenuItem : BindableBase 10 | { 11 | #region プロパティ 12 | /// 13 | /// レイアウトID 14 | /// 15 | public long LayoutID; 16 | 17 | 18 | /// 19 | /// レイアウト名 20 | /// 21 | public ReactivePropertySlim LayoutName { get; } 22 | 23 | 24 | /// 25 | /// 保存ボタンクリック時 26 | /// 27 | public ReactiveCommand SaveButtonClickedCommand { get; } = new ReactiveCommand(); 28 | 29 | 30 | /// 31 | /// 編集ボタンクリック時 32 | /// 33 | public ReactiveCommand EditButtonClickedCommand { get; } = new ReactiveCommand(); 34 | 35 | 36 | /// 37 | /// 削除ボタンクリック時 38 | /// 39 | public ReactiveCommand DeleteButtonClickedCommand { get; } = new ReactiveCommand(); 40 | 41 | 42 | /// 43 | /// チェック状態 44 | /// 45 | public ReactivePropertySlim IsChecked { get; } 46 | #endregion 47 | 48 | 49 | /// 50 | /// コンストラクタ 51 | /// 52 | /// レイアウトID 53 | /// レイアウト名 54 | /// チェックされているか 55 | public LayoutMenuItem(long layoutID, string layoutName, bool isChecked) 56 | { 57 | LayoutID = layoutID; 58 | LayoutName = new ReactivePropertySlim(layoutName); 59 | IsChecked = new ReactivePropertySlim(isChecked); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/DBViewerWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer; 4 | 5 | /// 6 | /// DBViewerWindow.xaml の相互作用ロジック 7 | /// 8 | public partial class DBViewerWindow : Window 9 | { 10 | public DBViewerWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/Modules/ModulesGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer.Modules; 4 | 5 | /// 6 | /// ModulesGrid.xaml の相互作用ロジック 7 | /// 8 | public partial class ModulesGrid : UserControl 9 | { 10 | public ModulesGrid() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/Modules/ModulesGridViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | using System.Windows.Data; 5 | using X4_ComplexCalculator.Common.Collection; 6 | using X4_ComplexCalculator.DB; 7 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 8 | 9 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer.Modules; 10 | 11 | /// 12 | /// モジュール情報閲覧用ViewModel 13 | /// 14 | class ModulesGridViewModel : BindableBase 15 | { 16 | #region メンバ 17 | /// 18 | /// モジュール一覧 19 | /// 20 | private readonly ObservableRangeCollection _modules; 21 | #endregion 22 | 23 | 24 | #region プロパティ 25 | /// 26 | /// 表示用データ 27 | /// 28 | public ListCollectionView ModulesView { get; } 29 | #endregion 30 | 31 | 32 | /// 33 | /// コンストラクタ 34 | /// 35 | public ModulesGridViewModel() 36 | { 37 | var items = X4Database.Instance.Ware.GetAll() 38 | .Where(x => !x.Tags.Contains("noplayerblueprint")) 39 | .Select(x => new ModulesGridItem(x)); 40 | 41 | _modules = new(items); 42 | 43 | ModulesView = (ListCollectionView)CollectionViewSource.GetDefaultView(_modules); 44 | ModulesView.SortDescriptions.Clear(); 45 | ModulesView.SortDescriptions.Add(new SortDescription(nameof(ModulesGridItem.ModuleName), ListSortDirection.Ascending)); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/Races/RacesGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer.Races; 4 | 5 | /// 6 | /// RacesGrid.xaml の相互作用ロジック 7 | /// 8 | public partial class RacesGrid : UserControl 9 | { 10 | public RacesGrid() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/Races/RacesGridItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer.Races; 5 | 6 | /// 7 | /// 種族表示用DataGridの1レコード分 8 | /// 9 | class RacesGridItem : BindableBase 10 | { 11 | #region メンバ 12 | /// 13 | /// 種族 14 | /// 15 | private readonly IRace _race; 16 | #endregion 17 | 18 | 19 | #region プロパティ 20 | /// 21 | /// 種族ID 22 | /// 23 | public string ID => _race.RaceID; 24 | 25 | 26 | /// 27 | /// 名称 28 | /// 29 | public string Name => _race.Name; 30 | 31 | 32 | /// 33 | /// 略称 34 | /// 35 | public string ShortName => _race.ShortName; 36 | #endregion 37 | 38 | 39 | /// 40 | /// コンストラクタ 41 | /// 42 | /// 種族 43 | public RacesGridItem(IRace race) 44 | { 45 | _race = race; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/Races/RacesViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | using System.Windows.Data; 5 | using X4_ComplexCalculator.Common.Collection; 6 | using X4_ComplexCalculator.DB; 7 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 8 | 9 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer.Races; 10 | 11 | /// 12 | /// 種族閲覧用ViewModel 13 | /// 14 | class RacesViewModel : BindableBase 15 | { 16 | #region メンバ 17 | /// 18 | /// 種族一覧 19 | /// 20 | private readonly ObservableRangeCollection _races = new(X4Database.Instance.Race.GetAll().Select(x => new RacesGridItem(x))); 21 | #endregion 22 | 23 | 24 | #region プロパティ 25 | /// 26 | /// 表示用データ 27 | /// 28 | public ListCollectionView RacesView { get; } 29 | #endregion 30 | 31 | 32 | /// 33 | /// コンストラクタ 34 | /// 35 | public RacesViewModel() 36 | { 37 | RacesView = (ListCollectionView)CollectionViewSource.GetDefaultView(_races); 38 | RacesView.SortDescriptions.Clear(); 39 | RacesView.SortDescriptions.Add(new SortDescription(nameof(IRace.Name), ListSortDirection.Ascending)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/Ships/ShipsGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer.Ships; 4 | 5 | /// 6 | /// ShipsGrid.xaml の相互作用ロジック 7 | /// 8 | public partial class ShipsGrid : UserControl 9 | { 10 | public ShipsGrid() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/Ships/ShipsViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | using System.Windows.Data; 5 | using X4_ComplexCalculator.Common.Collection; 6 | using X4_ComplexCalculator.DB; 7 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 8 | 9 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer.Ships; 10 | 11 | /// 12 | /// 艦船情報用ViewModel 13 | /// 14 | class ShipsViewModel : BindableBase 15 | { 16 | #region メンバ 17 | /// 18 | /// ウェア一覧 19 | /// 20 | private readonly ObservableRangeCollection _ships = new(); 21 | #endregion 22 | 23 | 24 | #region プロパティ 25 | /// 26 | /// 表示用データ 27 | /// 28 | public ListCollectionView ShipsView { get; } 29 | #endregion 30 | 31 | 32 | /// 33 | /// コンストラクタ 34 | /// 35 | public ShipsViewModel() 36 | { 37 | var items = X4Database.Instance.Ware.GetAll() 38 | .Select(x => ShipsGridItem.Create(x)) 39 | .Where(x => x is not null) 40 | .Select(x => x!); 41 | 42 | _ships = new(items); 43 | 44 | ShipsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_ships); 45 | ShipsView.SortDescriptions.Clear(); 46 | ShipsView.SortDescriptions.Add(new SortDescription(nameof(ShipsGridItem.ShipName), ListSortDirection.Ascending)); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/Wares/WaresGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer.Wares; 4 | 5 | /// 6 | /// WaresGrid.xaml の相互作用ロジック 7 | /// 8 | public partial class WaresGrid : UserControl 9 | { 10 | public WaresGrid() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/DBViewer/Wares/WaresViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | using System.Windows.Data; 5 | using X4_ComplexCalculator.Common.Collection; 6 | using X4_ComplexCalculator.DB; 7 | 8 | namespace X4_ComplexCalculator.Main.Menu.View.DBViewer.Wares; 9 | 10 | /// 11 | /// ウェア情報閲覧用ViewModel 12 | /// 13 | class WaresViewModel : BindableBase 14 | { 15 | #region メンバ 16 | /// 17 | /// ウェア一覧 18 | /// 19 | private readonly ObservableRangeCollection _wares; 20 | #endregion 21 | 22 | 23 | #region プロパティ 24 | /// 25 | /// 表示用データ 26 | /// 27 | public ListCollectionView WaresView { get; } 28 | #endregion 29 | 30 | 31 | /// 32 | /// コンストラクタ 33 | /// 34 | public WaresViewModel() 35 | { 36 | var items = X4Database.Instance.Ware.GetAll() 37 | .Where(x => x.Tags.Contains("economy")) 38 | .Select(x => new WaresGridItem(x)); 39 | 40 | _wares = new(items); 41 | 42 | WaresView = (ListCollectionView)CollectionViewSource.GetDefaultView(_wares); 43 | WaresView.SortDescriptions.Clear(); 44 | WaresView.SortDescriptions.Add(new SortDescription(nameof(WaresGridItem.WareName), ListSortDirection.Ascending)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/EmpireOverview/EmpireOverviewWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using System.Windows; 3 | using X4_ComplexCalculator.Main.WorkArea; 4 | 5 | namespace X4_ComplexCalculator.Main.Menu.View.EmpireOverview; 6 | 7 | /// 8 | /// EmpireOverviewWindow.xaml の相互作用ロジック 9 | /// 10 | public partial class EmpireOverviewWindow : Window 11 | { 12 | /// 13 | /// コンストラクタ 14 | /// 15 | /// 帝国の概要用Model 16 | public EmpireOverviewWindow(ObservableCollection workAreas) 17 | { 18 | InitializeComponent(); 19 | 20 | DataContext = new EmpireOverviewWindowViewModel(workAreas); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/Menu/View/EmpireOverview/WorkAreaItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using X4_ComplexCalculator.Main.WorkArea; 3 | 4 | namespace X4_ComplexCalculator.Main.Menu.View.EmpireOverview 5 | { 6 | public class WorkAreaItem : BindableBase 7 | { 8 | /// 9 | /// 集計対象か 10 | /// 11 | private bool _isChecked; 12 | 13 | 14 | /// 15 | /// 集計対象か 16 | /// 17 | public bool IsChecked 18 | { 19 | get => _isChecked; 20 | set => SetProperty(ref _isChecked, value); 21 | } 22 | 23 | /// 24 | /// 計画 25 | /// 26 | public WorkAreaViewModel WorkArea { get; } 27 | 28 | 29 | /// 30 | /// 計画名 31 | /// 32 | public string Title => WorkArea.Title; 33 | 34 | 35 | /// 36 | /// コンストラクタ 37 | /// 38 | /// 計画 39 | /// 集計対象か 40 | public WorkAreaItem(WorkAreaViewModel workArea, bool isChecked) 41 | { 42 | WorkArea = workArea; 43 | _isChecked = isChecked; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/UpdateDownloadProgressDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace X4_ComplexCalculator.Main; 4 | 5 | /// 6 | /// UpdateDownloadProglessDialog.xaml の相互作用ロジック 7 | /// 8 | public partial class UpdateDownloadProglessDialog : Window 9 | { 10 | public UpdateDownloadProglessDialog() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/UpdateDownloadProgressViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using Reactive.Bindings; 3 | using X4_ComplexCalculator.Infrastructure; 4 | 5 | namespace X4_ComplexCalculator.Main; 6 | 7 | /// 8 | /// アップデートのダウンロード進捗表示ビューモデル 9 | /// 10 | public class UpdateDownloadProgressViewModel : BindableBase 11 | { 12 | #region メンバ 13 | /// 14 | /// アップデート機能 15 | /// 16 | private readonly ApplicationUpdater _applicationUpdater; 17 | #endregion 18 | 19 | 20 | #region プロパティ 21 | /// 22 | /// ダウンロード状況 23 | /// 24 | public IReadOnlyReactiveProperty DownloadProgress 25 | => _applicationUpdater.DownloadProgress; 26 | 27 | 28 | /// 29 | /// キャンセルコマンド 30 | /// 31 | public ReactiveCommand CancelCommand { get; } 32 | #endregion 33 | 34 | 35 | /// 36 | /// アップデートのダウンロード進捗表示ビューモデルを初期化する 37 | /// 38 | /// アップデート機能 39 | public UpdateDownloadProgressViewModel(ApplicationUpdater applicationUpdater) 40 | { 41 | _applicationUpdater = applicationUpdater; 42 | CancelCommand = new ReactiveCommand().WithSubscribe(Cancel); 43 | 44 | // ダウンロードが終わり次第アプリケーションを終了し、更新を適用する 45 | #pragma warning disable CA2012 // ValueTask を正しく使用する必要があります 46 | _ = applicationUpdater.UpdateAfterDownloading(); 47 | #pragma warning restore CA2012 // ValueTask を正しく使用する必要があります 48 | } 49 | 50 | 51 | /// 52 | /// ダウンロードをキャンセルする 53 | /// 54 | private void Cancel() => _applicationUpdater.CancelDownload(); 55 | } 56 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/IWorkArea.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea; 4 | 5 | public interface IWorkArea 6 | { 7 | /// 8 | /// タイトル文字列 9 | /// 10 | public string Title { get; set; } 11 | 12 | 13 | /// 14 | /// 計算機で使用するステーション用データ 15 | /// 16 | public IStationData StationData { get; } 17 | } 18 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/SaveDataReader/ISaveDataReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.SaveDataReader; 4 | 5 | /// 6 | /// 保存ファイル読み込み処理用インターフェイス 7 | /// 8 | interface ISaveDataReader 9 | { 10 | /// 11 | /// 読み込み対象ファイルパス 12 | /// 13 | string Path { set; } 14 | 15 | 16 | /// 17 | /// 保存したファイル読み込み 18 | /// 19 | /// 成功したか 20 | bool Load(IProgress progress); 21 | } 22 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/SaveDataReader/SaveDataReaderFactory.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.DB; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.SaveDataReader; 4 | 5 | /// 6 | /// 保存ファイル読み込みクラスのインスタンス作成用クラス 7 | /// 8 | internal static class SaveDataReaderFactory 9 | { 10 | /// 11 | /// インスタンス作成 12 | /// 13 | /// 読み込み対象ファイルパス 14 | /// 作業エリア 15 | /// 保存ファイル読み込みクラスのインスタンス 16 | public static ISaveDataReader CreateSaveDataReader(string path, IWorkArea WorkArea) 17 | { 18 | var version = GetVersion(path); 19 | ISaveDataReader ret = version switch 20 | { 21 | 0 => new SaveDataReader0(WorkArea), 22 | 1 => new SaveDataReader1(WorkArea), 23 | _ => new SaveDataReader2(WorkArea), 24 | }; 25 | 26 | ret.Path = path; 27 | 28 | return ret; 29 | } 30 | 31 | 32 | /// 33 | /// 保存ファイルのバージョン取得 34 | /// 35 | /// ファイルパス 36 | /// バージョン 37 | private static int GetVersion(string path) 38 | { 39 | using var conn = new DBConnection(path); 40 | 41 | const string SQL_1 = "SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name = 'Common'"; 42 | var tableExists = conn.QuerySingle(SQL_1); 43 | if (!tableExists) return 0; 44 | 45 | const string SQL_2 = "SELECT Value FROM Common WHERE Item = 'FormatVersion'"; 46 | return conn.QuerySingle(SQL_2); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/SaveDataWriter/ISaveDataWriter.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.Main.WorkArea.SaveDataWriter; 2 | 3 | /// 4 | /// ファイル保存処理用インターフェイス 5 | /// 6 | interface ISaveDataWriter 7 | { 8 | /// 9 | /// 保存先ファイルパス 10 | /// 11 | string SaveFilePath { get; set; } 12 | 13 | 14 | /// 15 | /// 上書き保存 16 | /// 17 | /// 作業エリア 18 | /// 保存されたか 19 | bool Save(IWorkArea WorkArea); 20 | 21 | 22 | /// 23 | /// 名前を付けて保存 24 | /// 25 | /// 作業エリア 26 | /// 保存されたか 27 | bool SaveAs(IWorkArea WorkArea); 28 | } 29 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/BuildResourcesGrid/BuildResourcesGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.UI.BuildResourcesGrid; 4 | 5 | /// 6 | /// ResourcesGrid.xaml の相互作用ロジック 7 | /// 8 | public partial class BuildResourcesGrid : UserControl 9 | { 10 | public BuildResourcesGrid() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/BuildResourcesGrid/CalcResult.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.Main.WorkArea.UI.BuildResourcesGrid; 2 | 3 | /// 4 | /// 建造リソースの計算結果 5 | /// 6 | public class CalcResult 7 | { 8 | #region プロパティ 9 | /// 10 | /// 建造に必要なウェアID 11 | /// 12 | public string WareID { get; } 13 | 14 | 15 | /// 16 | /// 必要量 17 | /// 18 | public long Amount { get; } 19 | #endregion 20 | 21 | 22 | /// 23 | /// コンストラクタ 24 | /// 25 | /// 建造に必要なウェアID 26 | /// 必要量 27 | public CalcResult(string wareID, long amount) 28 | { 29 | WareID = wareID; 30 | Amount = amount; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ModulesGrid/EditEquipment/EditEquipmentWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using X4_ComplexCalculator.Common.Dialog.MessageBoxes; 3 | using X4_ComplexCalculator.Entity; 4 | 5 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid.EditEquipment; 6 | 7 | /// 8 | /// SelectModuleEquipmentWindow.xaml の相互作用ロジック 9 | /// 10 | public partial class EditEquipmentWindow : Window 11 | { 12 | /// 13 | /// コンストラクタ 14 | /// 15 | /// 編集対象の装備情報 16 | public EditEquipmentWindow(EquippableWareEquipmentManager equipmentManager) 17 | { 18 | InitializeComponent(); 19 | 20 | DataContext = new EditEquipmentViewModel(equipmentManager, new LocalizedMessageBoxEx(this)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ModulesGrid/EditEquipment/EquipmentList/EquipmentList.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid.EditEquipment.EquipmentList; 4 | 5 | /// 6 | /// EquipmentList.xaml の相互作用ロジック 7 | /// 8 | public partial class EquipmentList : UserControl 9 | { 10 | public EquipmentList() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ModulesGrid/EditEquipment/EquipmentList/EquipmentListItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid.EditEquipment.EquipmentList; 5 | 6 | /// 7 | /// 兵装編集画面の装備品一覧1レコード分 8 | /// 9 | class EquipmentListItem : BindableBase 10 | { 11 | #region メンバ 12 | /// 13 | /// 選択されているか 14 | /// 15 | private bool _isSelected; 16 | #endregion 17 | 18 | 19 | #region プロパティ 20 | /// 21 | /// 装備品 22 | /// 23 | public IEquipment Equipment { get; } 24 | 25 | 26 | /// 27 | /// 選択されているか 28 | /// 29 | public bool IsSelected 30 | { 31 | get => _isSelected; 32 | set => SetProperty(ref _isSelected, value); 33 | } 34 | #endregion 35 | 36 | 37 | /// 38 | /// コンストラクタ 39 | /// 40 | /// 装備品 41 | public EquipmentListItem(IEquipment equipment) 42 | { 43 | Equipment = equipment; 44 | _isSelected = false; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ModulesGrid/EditEquipment/FactionsListItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid.EditEquipment; 5 | 6 | /// 7 | /// 派閥リストの1レコード分 8 | /// 9 | class FactionsListItem : BindableBase 10 | { 11 | #region メンバ 12 | /// 13 | /// チェックされたか 14 | /// 15 | private bool _isChecked = true; 16 | #endregion 17 | 18 | #region プロパティ 19 | /// 20 | /// 派閥 21 | /// 22 | public IFaction Faction { get; } 23 | 24 | 25 | /// 26 | /// 種族ID 27 | /// 28 | public string RaceID => Faction.Race.RaceID; 29 | 30 | 31 | /// 32 | /// 種族名 33 | /// 34 | public string RaceName => Faction.Race.Name; 35 | 36 | 37 | /// 38 | /// 派閥名 39 | /// 40 | public string FactionName => Faction.Name; 41 | 42 | 43 | /// 44 | /// チェック状態 45 | /// 46 | public bool IsChecked 47 | { 48 | get => _isChecked; 49 | set => SetProperty(ref _isChecked, value); 50 | } 51 | #endregion 52 | 53 | 54 | /// 55 | /// コンストラクタ 56 | /// 57 | /// 派閥 58 | /// チェック状態 59 | public FactionsListItem(IFaction faction, bool isChecked) 60 | { 61 | Faction = faction; 62 | IsChecked = isChecked; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ModulesGrid/EditEquipment/PresetComboboxItem.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | using Prism.Mvvm; 5 | 6 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid.EditEquipment; 7 | 8 | /// 9 | /// プリセットコンボボックス用アイテム 10 | /// 11 | class PresetComboboxItem : BindableBase 12 | { 13 | #region メンバ 14 | /// 15 | /// プリセット名 16 | /// 17 | private string _name; 18 | #endregion 19 | 20 | 21 | #region プロパティ 22 | /// 23 | /// プリセットID 24 | /// 25 | public long ID { get; } 26 | 27 | 28 | /// 29 | /// プリセット名 30 | /// 31 | public string Name 32 | { 33 | get => _name; 34 | set => SetProperty(ref _name, value); 35 | } 36 | #endregion 37 | 38 | 39 | /// 40 | /// コンストラクタ 41 | /// 42 | /// プリセットID(内部用) 43 | /// プリセット名 44 | public PresetComboboxItem(long id, string name) 45 | { 46 | ID = id; 47 | _name = name; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ModulesGrid/ModulesGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid; 4 | 5 | /// 6 | /// ModuleListGridView.xaml の相互作用ロジック 7 | /// 8 | public partial class ModulesGrid : UserControl 9 | { 10 | /// 11 | /// コンストラクタ 12 | /// 13 | public ModulesGrid() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ModulesGrid/SelectModule/ModulesListItem.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using X4_ComplexCalculator.DB.X4DB.Interfaces; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid.SelectModule; 5 | 6 | public class ModulesListItem : BindableBase 7 | { 8 | #region メンバ 9 | /// 10 | /// チェックされたか 11 | /// 12 | private bool _isChecked; 13 | #endregion 14 | 15 | 16 | #region プロパティ 17 | /// 18 | /// モジュールID 19 | /// 20 | public string ID { get; } 21 | 22 | 23 | /// 24 | /// 表示名称 25 | /// 26 | public string Name { get; } 27 | 28 | 29 | /// 30 | /// チェック状態 31 | /// 32 | public bool IsChecked 33 | { 34 | get => _isChecked; 35 | set => SetProperty(ref _isChecked, value); 36 | } 37 | #endregion 38 | 39 | 40 | 41 | /// 42 | /// コンストラクタ 43 | /// 44 | /// ID 45 | /// 名称 46 | /// チェック状態 47 | public ModulesListItem(string id, string name, bool isChecked) 48 | { 49 | ID = id; 50 | Name = name; 51 | IsChecked = isChecked; 52 | } 53 | 54 | 55 | /// 56 | /// コンストラクタ 57 | /// 58 | /// 表示対象ウェア 59 | /// チェック状態 60 | public ModulesListItem(IWare ware, bool isChecked = false) 61 | { 62 | ID = ware.ID; 63 | Name = ware.Name; 64 | IsChecked = isChecked; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ModulesGrid/SelectModule/SelectModuleWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using X4_ComplexCalculator.Common.Collection; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid.SelectModule; 5 | 6 | /// 7 | /// AddModuleWindow.xaml の相互作用ロジック 8 | /// 9 | public partial class SelectModuleWindow : Window 10 | { 11 | /// 12 | /// コンストラクタ 13 | /// 14 | /// モジュール追加対象 15 | /// 変更前のモジュール 16 | public SelectModuleWindow(ObservableRangeCollection modules, string prevModuleName = "") 17 | { 18 | InitializeComponent(); 19 | 20 | DataContext = new SelectModuleViewModel(modules, prevModuleName); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ProductsGrid/Efficiency2TextConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ProductsGrid; 6 | 7 | /// 8 | /// 生産性を表示文字列に変換するValueConverter 9 | /// 10 | class Efficiency2TextConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | if (value is double val) 15 | { 16 | return (val < 0) ? "-" : $"{(int)(val * 100)}%"; 17 | } 18 | 19 | return value; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ProductsGrid/IProductDetailsListItem.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ProductsGrid; 4 | 5 | /// 6 | /// 製品詳細表示用インターフェイス 7 | /// 8 | public interface IProductDetailsListItem : INotifyPropertyChanged 9 | { 10 | /// 11 | /// 生産/消費ウェアID 12 | /// 13 | public string WareID { get; } 14 | 15 | 16 | /// 17 | /// モジュールID 18 | /// 19 | string ModuleID { get; } 20 | 21 | 22 | /// 23 | /// モジュール名 24 | /// 25 | string ModuleName { get; } 26 | 27 | 28 | /// 29 | /// モジュール数 30 | /// 31 | long ModuleCount { get; set; } 32 | 33 | 34 | /// 35 | /// 生産性 36 | /// 37 | double Efficiency { get; } 38 | 39 | 40 | /// 41 | /// 生産量 42 | /// 43 | long Amount { get; } 44 | 45 | 46 | /// 47 | /// 生産性を設定 48 | /// 49 | /// 効果ID 50 | /// 設定値 51 | void SetEfficiency(string effectID, double value); 52 | } 53 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ProductsGrid/ProductsGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ProductsGrid; 4 | 5 | /// 6 | /// ProductGrid.xaml の相互作用ロジック 7 | /// 8 | public partial class ProductsGrid : UserControl 9 | { 10 | public ProductsGrid() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/ProductsGrid/TradeOption.cs: -------------------------------------------------------------------------------- 1 | namespace X4_ComplexCalculator.Main.WorkArea.UI.ProductsGrid; 2 | 3 | /// 4 | /// 売買オプション 5 | /// 6 | public class TradeOption 7 | { 8 | #region メンバ 9 | /// 10 | /// 購入しない 11 | /// 12 | public bool NoBuy; 13 | 14 | 15 | /// 16 | /// 販売しない 17 | /// 18 | public bool NoSell; 19 | #endregion 20 | 21 | 22 | /// 23 | /// コンストラクタ 24 | /// 25 | /// 購入しない 26 | /// 販売しない 27 | public TradeOption(bool noBuy = false, bool noSell = false) 28 | { 29 | NoBuy = noBuy; 30 | NoSell = noSell; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/StationSettings/StationSettings.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.UI.StationSettings; 4 | 5 | /// 6 | /// StationSettings.xaml の相互作用ロジック 7 | /// 8 | public partial class StationSettings : UserControl 9 | { 10 | public StationSettings() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/StationSummary/StationSummary.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.UI.StationSummary; 4 | 5 | /// 6 | /// StationSummary.xaml の相互作用ロジック 7 | /// 8 | public partial class StationSummary : UserControl 9 | { 10 | public StationSummary() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/StorageAssign/StorageAssign.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.UI.StorageAssign; 4 | 5 | /// 6 | /// StorageSimulator.xaml の相互作用ロジック 7 | /// 8 | public partial class StorageAssign : UserControl 9 | { 10 | public StorageAssign() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/UI/StoragesGrid/StoragesGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.UI.StoragesGrid; 4 | 5 | /// 6 | /// StoragesGrid.xaml の相互作用ロジック 7 | /// 8 | public partial class StoragesGrid : UserControl 9 | { 10 | public StoragesGrid() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkArea.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea; 4 | 5 | /// 6 | /// WorkArea.xaml の相互作用ロジック 7 | /// 8 | public partial class WorkArea : UserControl 9 | { 10 | /// 11 | /// コンストラクタ 12 | /// 13 | public WorkArea() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/BuildResources/BuildResourcesInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.BuildResourcesGrid; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.BuildResources; 5 | 6 | /// 7 | /// 建造リソース情報用クラス 8 | /// 9 | public class BuildResourcesInfo : IBuildResourcesInfo 10 | { 11 | /// 12 | /// 建造リソース情報 13 | /// 14 | public ObservablePropertyChangedCollection BuildResources { get; } = new(); 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/BuildResources/IBuildResourcesInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.BuildResourcesGrid; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.BuildResources; 5 | 6 | /// 7 | /// 建造リソース情報用インターフェイス 8 | /// 9 | public interface IBuildResourcesInfo 10 | { 11 | /// 12 | /// 建造リソース情報 13 | /// 14 | public ObservablePropertyChangedCollection BuildResources { get; } 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/IStationData.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.BuildResources; 2 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Modules; 3 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Products; 4 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.StationSettings; 5 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.StorageAssign; 6 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Storages; 7 | 8 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData; 9 | 10 | /// 11 | /// 計算機で使用するステーション用データ 12 | /// 13 | public interface IStationData 14 | { 15 | /// 16 | /// モジュール一覧 17 | /// 18 | IBuildResourcesInfo BuildResourcesInfo { get; } 19 | 20 | 21 | /// 22 | /// 製品情報 23 | /// 24 | IModulesInfo ModulesInfo { get; } 25 | 26 | 27 | /// 28 | /// 建造リソース情報 29 | /// 30 | IProductsInfo ProductsInfo { get; } 31 | 32 | 33 | /// 34 | /// 保管庫情報 35 | /// 36 | IStationSettings Settings { get; } 37 | 38 | 39 | /// 40 | /// 保管庫割当情報 41 | /// 42 | IStorageAssignInfo StorageAssignInfo { get; } 43 | 44 | 45 | /// 46 | /// ステーション設定 47 | /// 48 | IStoragesInfo StoragesInfo { get; } 49 | } -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/Modules/IModulesInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Modules; 5 | 6 | /// 7 | /// モジュール一覧情報用インターフェイス 8 | /// 9 | public interface IModulesInfo 10 | { 11 | /// 12 | /// モジュール一覧情報 13 | /// 14 | public ObservablePropertyChangedCollection Modules { get; } 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/Modules/ModulesInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.ModulesGrid; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Modules; 5 | 6 | /// 7 | /// モジュール一覧情報用クラス 8 | /// 9 | public class ModulesInfo : IModulesInfo 10 | { 11 | /// 12 | /// モジュール一覧 13 | /// 14 | public ObservablePropertyChangedCollection Modules { get; } = new(); 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/Products/IProductsInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.ProductsGrid; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Products; 5 | 6 | /// 7 | /// 製品一覧情報用インターフェイス 8 | /// 9 | public interface IProductsInfo 10 | { 11 | /// 12 | /// 製品一覧情報 13 | /// 14 | public ObservablePropertyChangedCollection Products { get; } 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/Products/ProductsInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.ProductsGrid; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Products; 5 | 6 | /// 7 | /// 製品一覧情報用クラス 8 | /// 9 | public class ProductsInfo : IProductsInfo 10 | { 11 | /// 12 | /// 製品一覧情報 13 | /// 14 | public ObservablePropertyChangedCollection Products { get; } 15 | = new(); 16 | } 17 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/StationData.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.BuildResources; 2 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Modules; 3 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Products; 4 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.StationSettings; 5 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.StorageAssign; 6 | using X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Storages; 7 | 8 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData; 9 | 10 | /// 11 | /// 計算機で使用するステーション用データ用クラス 12 | /// 13 | public class StationData : IStationData 14 | { 15 | /// 16 | /// モジュール一覧 17 | /// 18 | public IModulesInfo ModulesInfo { get; } = new ModulesInfo(); 19 | 20 | 21 | /// 22 | /// 製品情報 23 | /// 24 | public IProductsInfo ProductsInfo { get; } = new ProductsInfo(); 25 | 26 | 27 | /// 28 | /// 建造リソース情報 29 | /// 30 | public IBuildResourcesInfo BuildResourcesInfo { get; } = new BuildResourcesInfo(); 31 | 32 | 33 | /// 34 | /// 保管庫情報 35 | /// 36 | public IStoragesInfo StoragesInfo { get; } = new StoragesInfo(); 37 | 38 | 39 | /// 40 | /// 保管庫割当情報 41 | /// 42 | public IStorageAssignInfo StorageAssignInfo { get; } = new StorageAssignInfo(); 43 | 44 | 45 | /// 46 | /// ステーション設定 47 | /// 48 | public IStationSettings Settings { get; } = new StationSettings.StationSettings(); 49 | } 50 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/StationSettings/IStationSettings.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.StationSettings; 4 | 5 | /// 6 | /// ステーション設定情報用インターフェイス 7 | /// 8 | public interface IStationSettings : INotifyPropertyChanged 9 | { 10 | /// 11 | /// 本部か 12 | /// 13 | public bool IsHeadquarters { get; set; } 14 | 15 | 16 | /// 17 | /// 本部の必要労働者数 18 | /// 19 | public int HQWorkers { get; } 20 | 21 | 22 | /// 23 | /// 労働者 24 | /// 25 | public WorkforceManager Workforce { get; } 26 | 27 | 28 | /// 29 | /// 日光[%] 30 | /// 31 | public double Sunlight { get; set; } 32 | } 33 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/StationSettings/StationSettings.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.StationSettings; 5 | 6 | /// 7 | /// ステーション設定用クラス 8 | /// 9 | public class StationSettings : BindableBase, IStationSettings 10 | { 11 | #region メンバ 12 | /// 13 | /// 本部か 14 | /// 15 | private bool _isHeadquarters; 16 | 17 | 18 | /// 19 | /// 日光[%] 20 | /// 21 | private double _sunlight = 100; 22 | #endregion 23 | 24 | 25 | #region プロパティ 26 | /// 27 | /// 本部か 28 | /// 29 | public bool IsHeadquarters 30 | { 31 | get => _isHeadquarters; 32 | set => SetProperty(ref _isHeadquarters, value); 33 | } 34 | 35 | 36 | /// 37 | /// 本部の必要労働者数 38 | /// 39 | public int HQWorkers { get; } = 200; 40 | 41 | 42 | /// 43 | /// 労働者 44 | /// 45 | public WorkforceManager Workforce { get; } = new(); 46 | 47 | 48 | /// 49 | /// 日光[%] 50 | /// 51 | public double Sunlight 52 | { 53 | get => _sunlight; 54 | set => SetProperty(ref _sunlight, value); 55 | } 56 | #endregion 57 | } 58 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/StorageAssign/IStorageAssignInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.StorageAssign; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.StorageAssign; 5 | 6 | /// 7 | /// 保管庫割当情報用インターフェイス 8 | /// 9 | public interface IStorageAssignInfo 10 | { 11 | /// 12 | /// 保管庫割当情報 13 | /// 14 | public ObservablePropertyChangedCollection StorageAssign { get; } 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/StorageAssign/StorageAssignInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.StorageAssign; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.StorageAssign; 5 | 6 | /// 7 | /// 保管庫割当情報用クラス 8 | /// 9 | public class StorageAssignInfo : IStorageAssignInfo 10 | { 11 | /// 12 | /// 保管庫割当情報 13 | /// 14 | public ObservablePropertyChangedCollection StorageAssign { get; } 15 | = new ObservablePropertyChangedCollection(); 16 | } 17 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/Storages/IStoragesInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.StoragesGrid; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Storages; 5 | 6 | /// 7 | /// 保管庫情報用インターフェイス 8 | /// 9 | public interface IStoragesInfo 10 | { 11 | /// 12 | /// 保管庫情報 13 | /// 14 | public ObservablePropertyChangedCollection Storages { get; } 15 | } 16 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Main/WorkArea/WorkAreaData/Storages/StoragesInfo.cs: -------------------------------------------------------------------------------- 1 | using X4_ComplexCalculator.Common.Collection; 2 | using X4_ComplexCalculator.Main.WorkArea.UI.StoragesGrid; 3 | 4 | namespace X4_ComplexCalculator.Main.WorkArea.WorkAreaData.Storages; 5 | 6 | /// 7 | /// 保管庫情報用インターフェイス 8 | /// 9 | public class StoragesInfo : IStoragesInfo 10 | { 11 | /// 12 | /// 保管庫情報 13 | /// 14 | public ObservablePropertyChangedCollection Storages { get; } 15 | = new ObservablePropertyChangedCollection(); 16 | } 17 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Themes/OtherThemes.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | {0:N0} 9 | 10 | 11 | 19 | 20 | True 21 | False 22 | 23 | -------------------------------------------------------------------------------- /X4_ComplexCalculator/Themes/WindowThemes.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /X4_ComplexCalculator_CustomControlLibrary/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /X4_ComplexCalculator_CustomControlLibrary/ClearSortOrderDataGrid/Generic.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 |