From 721ee8e494814c67234c2370a597968b63db5673 Mon Sep 17 00:00:00 2001 From: Macocian Alexandru Victor Date: Wed, 14 May 2025 11:21:24 +0200 Subject: [PATCH] Huge application refactoring to better support plugins (#960) * Move shared code to Shared project * Move from Realm to Squealify * Rename Daybreak.Shared namespaces * Setup API project to expose a test API --- .github/workflows/cd.yaml | 5 + Daybreak.API/Controllers/TestController.cs | 13 ++ Daybreak.API/Daybreak.API.csproj | 41 ++++ Daybreak.API/EntryPoint.cs | 85 ++++++++ Daybreak.API/Extensions/ConsoleExtensions.cs | 19 ++ Daybreak.API/NativeMethods.cs | 28 +++ Daybreak.API/Properties/launchSettings.json | 12 ++ .../Serialization/ApiJsonSerializerContext.cs | 8 + .../Options/ITradeChatOptions.cs | 2 +- .../Converters/AttributeJsonConverter.cs | 2 +- .../Converters/BooleanToEffectConverter.cs | 2 +- .../BooleanToGridLengthConverter.cs | 2 +- .../BooleanToVisibilityConverter.cs | 6 +- .../Converters/CampaignJsonConverter.cs | 4 +- .../Converters/ContinentJsonConverter.cs | 4 +- .../Converters/DateTimeConverter.cs | 2 +- .../Converters/DoubleMultiplierConverter.cs | 2 +- .../EqualityToVisibilityConverter.cs | 2 +- .../EventCalendarDayToBrushConverter.cs | 9 +- .../Converters/EventToBrushConverter.cs | 9 +- .../Converters/HiddenWhenNull.cs | 2 +- .../Converters/IntToStringConverter.cs | 2 +- .../Converters/InverseBooleanConverter.cs | 2 +- .../Converters/ItemBaseJsonConverter.cs | 4 +- .../Converters/ItemBaseToIntConverter.cs | 4 +- .../Converters/ItemBaseToStringConverter.cs | 4 +- .../Converters/MapJsonConverter.cs | 4 +- .../MenuButtonHighlightConverter.cs | 2 +- .../Converters/NpcJsonConverter.cs | 4 +- .../Converters/PriceToStringConverter.cs | 18 +- .../Converters/ProfessionJsonConverter.cs | 4 +- .../Converters/QuestJsonConverter.cs | 4 +- .../Converters/RegionJsonConverter.cs | 4 +- .../Converters/SkillJsonConverter.cs | 4 +- .../TileButtonHighlightConverter.cs | 2 +- .../Converters/TimeSinceDateTimeConverter.cs | 2 +- .../Converters/TimespanToETAConverter.cs | 4 +- .../Converters/TitleJsonConverter.cs | 4 +- .../Converters/TradeAlertConverter.cs | 4 +- .../TraderQuoteTypeToStringConverter.cs | 4 +- Daybreak.Shared/Daybreak.Shared.csproj | 60 ++++++ .../CredentialsNotFoundException.cs | 2 +- .../Exceptions/ExecutableNotFoundException.cs | 2 +- .../Exceptions/FatalException.cs | 2 +- Daybreak.Shared/Global.cs | 12 ++ .../Models/ApplicationLauncherContext.cs | 2 +- .../Models/BackgroundResponse.cs | 2 +- .../Models/BatchedObservableCollection.cs | 2 +- .../Models/Browser/BrowserHistory.cs | 2 +- .../Models/Browser/BrowserPayload.cs | 2 +- .../Models/Browser/DownloadPayload.cs | 2 +- .../Models/Browser/OnContextMenuPayload.cs | 2 +- .../Models/BuildWithTemplateCode.cs | 4 +- .../Models/Builds/AttributeEntry.cs | 4 +- .../Models/Builds/IBuildEntry.cs | 2 +- .../Models/Builds/SingleBuildEntry.cs | 6 +- .../Models/Builds/TeamBuildEntry.cs | 4 +- .../Models/ColorPalette.cs | 2 +- .../Models/ColorScheme.cs | 2 +- .../Models/ColoredTextElement.cs | 2 +- .../Models/DownloadedBuild.cs | 4 +- .../Models/ElevationRequest.cs | 2 +- .../Models/EventViewModel.cs | 2 +- .../Models/ExecutablePath.cs | 2 +- .../Models/ExecutionPolicies.cs | 2 +- .../FocusView/PlayerContextMenuContext.cs | 6 +- .../Models/FocusView/QuestEntry.cs | 4 +- .../Models/FocusView/QuestLocationEntry.cs | 4 +- .../Models/FocusView/QuestLogEntry.cs | 2 +- .../Models/FocusView/QuestLogSeparator.cs | 2 +- .../Models/Github/GithubRefTag.cs | 2 +- .../Models/GuildWarsUpdateRequest.cs | 4 +- .../Models/GuildWarsUpdateResponse.cs | 2 +- .../Models/Guildwars/Attribute.cs | 4 +- .../Models/Guildwars/Build.cs | 4 +- .../Models/Guildwars/BuildEntryBase.cs | 4 +- .../Models/Guildwars/BuildMetadata.cs | 2 +- .../Models/Guildwars/Campaign.cs | 4 +- .../Models/Guildwars/Continent.cs | 4 +- .../Models/Guildwars/Event.cs | 2 +- .../Models/Guildwars/Hero.cs | 2 +- .../Models/Guildwars/IIconUrlEntity.cs | 2 +- .../Models/Guildwars/IItemModHash.cs | 2 +- .../Models/Guildwars/IWikiEntity.cs | 2 +- .../Models/Guildwars/Inscription.cs | 2 +- .../Models/Guildwars/InstanceType.cs | 2 +- .../Models/Guildwars/ItemBase.cs | 5 +- .../Models/Guildwars/ItemModifier.cs | 2 +- .../Models/Guildwars/LoginData.cs | 2 +- .../Models/Guildwars/MainPlayerData.cs | 2 +- .../Models/Guildwars/MainPlayerInformation.cs | 2 +- .../Models/Guildwars/Map.cs | 4 +- .../Models/Guildwars/Material.cs | 2 +- .../Models/Guildwars/Npc.cs | 4 +- .../PartyCompositionMetadataEntry.cs | 2 +- .../Models/Guildwars/PlayerInformation.cs | 2 +- .../Models/Guildwars/Position.cs | 2 +- .../Models/Guildwars/Profession.cs | 4 +- .../Models/Guildwars/Quest.cs | 4 +- .../Models/Guildwars/QuestMetadata.cs | 2 +- .../Models/Guildwars/Region.cs | 4 +- .../Models/Guildwars/RegionType.cs | 2 +- .../Models/Guildwars/Rune.cs | 6 +- .../Models/Guildwars/SessionData.cs | 2 +- .../Models/Guildwars/SessionInformation.cs | 2 +- .../Models/Guildwars/Skill.cs | 4 +- .../Models/Guildwars/SkillMetadata.cs | 2 +- .../Models/Guildwars/TeamBuildData.cs | 2 +- .../Models/Guildwars/TeamBuildPlayerData.cs | 2 +- .../Models/Guildwars/Title.cs | 4 +- .../Models/Guildwars/TitleInformation.cs | 2 +- .../Models/Guildwars/UserData.cs | 2 +- .../Models/Guildwars/UserInformation.cs | 2 +- Daybreak.Shared/Models/Guildwars/VialOfDye.cs | 39 ++++ .../Models/Guildwars/WorldData.cs | 2 +- .../Guildwars/WorldPlayerInformation.cs | 2 +- .../Models/IconPayload.cs | 2 +- .../Models/IconRequest.cs | 4 +- .../Models/InternetConnectionState.cs | 2 +- .../Models/Interop/AreaContext.cs | 2 +- .../Models/Interop/AreaInfoContext.cs | 2 +- .../Models/Interop/AttributeContext.cs | 2 +- .../Models/Interop/BagInfo.cs | 2 +- .../Models/Interop/EntityAllegiance.cs | 2 +- .../Models/Interop/EntityContext.cs | 2 +- .../Models/Interop/EntityState.cs | 2 +- .../Models/Interop/EntityType.cs | 2 +- .../Models/Interop/GameContext.cs | 2 +- .../Models/Interop/GamePosition.cs | 2 +- .../Models/Interop/GenericGuildwarsArray.cs | 2 +- .../Models/Interop/GlobalContext.cs | 2 +- .../Models/Interop/GuildwarsArray.cs | 4 +- .../Models/Interop/GuildwarsPointer.cs | 2 +- .../Models/Interop/GuildwarsPointerArray.cs | 2 +- .../Models/Interop/HenchmanPartyMember.cs | 2 +- .../Models/Interop/HeroPartyMember.cs | 2 +- .../Models/Interop/IPAddressContext.cs | 2 +- .../Models/Interop/InstanceContext.cs | 2 +- .../Models/Interop/InstanceInfoContext.cs | 2 +- .../Models/Interop/InstanceType.cs | 2 +- .../Models/Interop/InventoryContext.cs | 2 +- .../Models/Interop/ItemContext.cs | 2 +- .../Models/Interop/ItemInfo.cs | 2 +- .../Models/Interop/ItemModifier.cs | 2 +- .../Models/Interop/LoginCharacterContext.cs | 2 +- .../Models/Interop/MapContext.cs | 2 +- .../Models/Interop/MapEntityContext.cs | 2 +- .../Models/Interop/MapIconContext.cs | 2 +- .../Models/Interop/NpcContext.cs | 2 +- .../Models/Interop/PartyAttributesContext.cs | 2 +- .../Models/Interop/PartyContext.cs | 2 +- .../Models/Interop/PartyInfoContext.cs | 2 +- .../Models/Interop/PathingMap.cs | 2 +- .../Models/Interop/PathingMapContext.cs | 2 +- .../Models/Interop/PathingTrapezoid.cs | 2 +- .../Models/Interop/PlayerContext.cs | 2 +- .../Interop/PlayerControlledCharContext.cs | 2 +- .../Models/Interop/PlayerPartyMember.cs | 2 +- .../Models/Interop/PreGameContext.cs | 2 +- .../Models/Interop/ProfessionsContext.cs | 4 +- .../Models/Interop/PvpTeam.cs | 2 +- .../Models/Interop/QuestContext.cs | 2 +- .../Models/Interop/RegionType.cs | 2 +- .../Models/Interop/SkillContext.cs | 2 +- .../Models/Interop/SkillbarContext.cs | 2 +- .../Models/Interop/TeamColor.cs | 2 +- .../Models/Interop/TitleContext.cs | 2 +- .../Models/Interop/TitleIds.cs | 2 +- .../Models/Interop/TitleInfo.cs | 2 +- .../Models/Interop/TitleTierContext.cs | 2 +- .../Models/Interop/UserContext.cs | 2 +- .../Models/KeyMacro.cs | 2 +- .../Models/KeyboardHookEventArgs.cs | 2 +- .../Models/KeyboardInput.cs | 4 +- .../Models/KeyboardState.cs | 2 +- .../GuildWarsApplicationLaunchContext.cs | 4 +- .../LaunchConfiguration.cs | 2 +- .../LaunchConfigurationWithCredentials.cs | 5 +- .../Models/LauncherViewContext.cs | 4 +- {Daybreak => Daybreak.Shared}/Models/Log.cs | 2 +- .../Models/LoginCredentials.cs | 2 +- .../Models/MainPlayerResourceContext.cs | 4 +- .../Models/Menu/MenuButton.cs | 2 +- .../Models/Menu/MenuCategory.cs | 2 +- .../Models/Metrics/AggregationTypes.cs | 2 +- .../Models/Metrics/Metric.cs | 2 +- .../Models/Metrics/MetricSet.cs | 2 +- .../Models/Metrics/MetricSetViewModel.cs | 2 +- .../Models/Metrics/RecordedMetric.cs | 2 +- .../Models/Mods/GuildWarsCreatedContext.cs | 2 +- .../Models/Mods/GuildWarsStartedContext.cs | 2 +- .../Models/Mods/GuildWarsStartingContext.cs | 4 +- .../Mods/GuildWarsStartingDisabledContext.cs | 4 +- .../Handling/INotificationHandler.cs | 2 +- .../Notifications/ICancellableNotification.cs | 2 +- .../Models/Notifications/INotification.cs | 2 +- .../Models/Notifications/Notification.cs | 4 +- .../NotificationCancellationToken.cs | 2 +- .../Notifications/NotificationWrapper.cs | 2 +- .../Onboarding/LauncherOnboardingStage.cs | 2 +- .../Models/Options/OptionEntry.cs | 2 +- .../Models/Options/OptionHeading.cs | 2 +- .../Models/Options/OptionProperty.cs | 4 +- .../Models/Options/OptionSection.cs | 2 +- .../Models/Options/OptionSetter.cs | 2 +- .../Models/Plugins/AvailablePlugin.cs | 2 +- .../Models/Plugins/PluginConfigurationBase.cs | 35 ++-- .../Models}/PostUpdateActionBase.cs | 2 +- .../Models/Progress/ActionStatus.cs | 2 +- .../Models/Progress/CopyStatus.cs | 2 +- .../Progress/DSOALInstallationStatus.cs | 2 +- .../Progress/DirectSongInstallationStatus.cs | 3 +- .../Models/Progress/DownloadStatus.cs | 2 +- .../Progress/GuildwarsInstallationStatus.cs | 2 +- .../Models/Progress/IconDownloadStatus.cs | 2 +- .../Models/Progress/LoadStatus.cs | 2 +- .../Progress/ReShadeInstallationStatus.cs | 2 +- .../Models/Progress/StartupStatus.cs | 2 +- .../Progress/ToolboxInstallationStatus.cs | 2 +- .../Models/Progress/UModInstallationStatus.cs | 2 +- .../Models/Progress/UpdateStatus.cs | 2 +- .../Models/ProtectedLoginCredentials.cs | 2 +- .../Models/ReShade/ShaderPackage.cs | 2 +- .../Models/ScopeMetadata.cs | 2 +- .../Models/Screen.cs | 2 +- .../Models/SecureString.cs | 4 +- .../Models/SortedObservableCollection.cs | 2 +- .../Models}/StartupActionBase.cs | 2 +- .../Models/SynchronizationBuild.cs | 2 +- .../Models/Trade/ITradeAlert.cs | 4 +- .../Models/Trade/QuoteAlert.cs | 5 +- .../Models/Trade/TradeAlert.cs | 2 +- .../Models/Trade/TraderMessage.cs | 2 +- .../Models/Trade/TraderMessageViewWrapper.cs | 2 +- .../Models/Trade/TraderQuote.cs | 4 +- .../Models/Trade}/TraderQuoteType.cs | 2 +- .../Models/UMod/UModEntry.cs | 2 +- .../Models/Versioning/Version.cs | 2 +- .../Models/Versioning/VersionNumberToken.cs | 2 +- .../Models/Versioning/VersionStringToken.cs | 2 +- .../Models/Versioning/VersionToken.cs | 2 +- .../Models/Win32Window.cs | 4 +- .../Services/Api/IDaybreakApiService.cs | 6 + .../ArgumentHandling/IArgumentHandler.cs | 2 +- .../IApplicationArgumentService.cs | 2 +- .../IArgumentHandlerProducer.cs | 9 + .../IApplicationLauncher.cs | 4 +- .../Services/Browser/IBrowserExtension.cs | 2 +- .../Browser/IBrowserExtensionsManager.cs | 2 +- .../Browser/IBrowserExtensionsProducer.cs | 2 +- .../IAttributePointCalculator.cs | 6 +- .../BuildTemplates/IBuildTemplateManager.cs | 6 +- .../Credentials/ICredentialManager.cs | 4 +- .../Services/DSOAL/IDSOALService.cs | 6 +- .../Services/DirectSong/IDirectSongService.cs | 6 +- .../Services/Downloads/IDownloadService.cs | 4 +- .../Services/Events/IEventService.cs | 4 +- .../IGuildWarsExecutableManager.cs | 2 +- .../Experience/IExperienceCalculator.cs | 2 +- .../Guildwars/IGuildWarsVersionChecker.cs | 4 +- .../Guildwars/IGuildwarsCopyService.cs | 4 +- .../Services/Guildwars/IGuildwarsInstaller.cs | 6 +- .../Services/IconRetrieve/IIconCache.cs | 4 +- .../Services/Images/IImageCache.cs | 2 +- .../Services/Injection/IProcessInjector.cs | 2 +- .../Services/Injection/IStubInjector.cs | 7 + .../InternetChecker/IConnectivityStatus.cs | 2 +- .../IInternetCheckingService.cs | 6 +- .../ILaunchConfigurationService.cs | 4 +- .../Services/Logging/IDebugLogsWriter.cs | 2 +- .../Logging/IEventViewerLogsWriter.cs | 2 +- .../Services/Logging/ILogsManager.cs | 15 ++ .../Services/Menu/IMenuService.cs | 2 +- .../Menu/IMenuServiceButtonHandler.cs | 4 +- .../Services/Menu/IMenuServiceInitializer.cs | 2 +- .../Services/Menu/IMenuServiceProducer.cs | 4 +- .../Services/Metrics/IMetricsService.cs | 4 +- .../Services/Mods/IModService.cs | 4 +- .../Services/Mods/IModsManager.cs | 2 +- .../Services/Mutex/IMutexHandler.cs | 2 +- .../Services/Navigation/IViewManager.cs | 2 +- .../Services/Navigation/IViewProducer.cs | 2 +- .../INotificationHandlerProducer.cs | 4 +- .../Notifications/INotificationProducer.cs | 16 ++ .../Notifications/INotificationService.cs | 6 +- .../Services/Onboarding/IOnboardingService.cs | 4 +- .../Services/Options/IOptionsProducer.cs | 2 +- .../Services/Options/IOptionsProvider.cs | 2 +- .../Options/IOptionsSynchronizationService.cs | 2 +- .../Services/Options/IOptionsUpdateHook.cs | 2 +- .../Services/Plugins/IPluginsService.cs | 22 +- .../Services/Privilege/IPrivilegeManager.cs | 2 +- .../Services/ReShade/IReShadeService.cs | 8 +- .../Services/Registry/IRegistryService.cs | 2 +- .../Services/Scanner/IGuildwarsMemoryCache.cs | 6 +- .../Scanner/IGuildwarsMemoryReader.cs | 4 +- .../Services/Scanner/IMemoryScanner.cs | 4 +- .../Screens/IGuildwarsScreenPlacer.cs | 7 + .../Services/Screens/IScreenManager.cs | 4 +- .../Services/Screens/ISplashScreenService.cs | 2 +- .../Screenshots/IBackgroundProvider.cs | 4 +- .../Screenshots/IOnlinePictureClient.cs | 2 +- .../Screenshots/IScreenshotProvider.cs | 2 +- .../Services/SevenZip/ISevenZipExtractor.cs | 2 +- .../Services/Shortcuts/IShortcutManager.cs | 2 +- .../Services/Sounds/ISoundService.cs | 2 +- .../Startup/IStartupActionProducer.cs | 4 +- .../Services/Themes/IThemeManager.cs | 2 +- .../Services/Toolbox/IToolboxService.cs | 8 +- .../Services/TradeChat/IItemHashService.cs | 8 + .../TradeChat/IPriceHistoryService.cs | 6 +- .../TradeChat/ITradeAlertingService.cs | 4 +- .../Services/TradeChat/ITradeChatService.cs | 6 +- .../Services/TradeChat/ITraderQuoteService.cs | 4 +- .../TradeChat/IWordHighlightingService.cs | 4 +- .../Services/UMod/IUModService.cs | 10 +- .../Services/Updater/IApplicationUpdater.cs | 6 +- .../PostUpdate/IPostUpdateActionManager.cs | 2 +- .../PostUpdate/IPostUpdateActionProducer.cs | 4 +- .../PostUpdate/IPostUpdateActionProvider.cs | 9 + .../Services/Window/IWindowEventsHook.cs | 2 +- .../Utils/ColorExtensions.cs | 10 +- .../Utils/DateTimeExtensions.cs | 2 +- .../Utils/DependencyObjectExtensions.cs | 2 +- .../Utils/EncryptionHelper.cs | 30 ++- .../Utils/MathUtils.cs | 2 +- .../Utils/MetricsHttpMessageHandler.cs | 4 +- .../Utils/NativeMethods.cs | 197 ++++++++++-------- .../Utils/PathUtils.cs | 2 +- .../Utils/SerializationExtensions.cs | 2 +- .../Utils/StringUtils.cs | 2 +- .../Validators/AllGoesValidator.cs | 2 +- .../Validators/BooleanValidator.cs | 2 +- .../Validators/ClampedValidator.cs | 2 +- .../Validators/EnumValidator.cs | 4 +- .../Validators/IValidator.cs | 2 +- Daybreak.Tests/Models/InscriptionTests.cs | 2 +- Daybreak.Tests/Models/ItemBaseTests.cs | 4 +- Daybreak.Tests/Models/ItemTestsBase.cs | 2 +- Daybreak.Tests/Models/MaterialTests.cs | 2 +- Daybreak.Tests/Models/NpcTests.cs | 2 +- Daybreak.Tests/Models/QuestTests.cs | 4 +- Daybreak.Tests/Models/RuneTests.cs | 2 +- Daybreak.Tests/Models/VersionTests.cs | 4 +- Daybreak.Tests/Models/VialOfDyeTests.cs | 11 + .../Services/BuildTemplateManagerTests.cs | 7 +- .../Services/Models/TestArgumentHandler.cs | 2 +- .../Services/Models/TestArgumentHandler2.cs | 2 +- Daybreak.sln | 28 +++ .../OptionCustomValidatorAttribute.cs | 2 +- Daybreak/Attributes/OptionSetterView.cs | 4 +- .../Options/AscalonTradeChatOptions.cs | 1 + .../Options/CredentialManagerOptions.cs | 2 +- .../Configuration/Options/FocusViewOptions.cs | 2 +- .../Options/KamadanTradeChatOptions.cs | 1 + .../LaunchConfigurationServiceOptions.cs | 2 +- .../Configuration/Options/LauncherOptions.cs | 4 - .../Configuration/Options/ThemeOptions.cs | 2 +- .../Options/TradeAlertingOptions.cs | 2 +- Daybreak/Configuration/Options/UModOptions.cs | 2 +- .../Configuration/ProjectConfiguration.cs | 78 +++++-- Daybreak/Controls/AsyncImage.xaml | 2 +- Daybreak/Controls/AsyncImage.xaml.cs | 5 +- Daybreak/Controls/Buttons/BrowserButton.xaml | 2 +- Daybreak/Controls/Buttons/CopyButton.xaml | 2 +- .../Controls/Buttons/HighlightButton.xaml | 2 +- Daybreak/Controls/Buttons/MenuButton.xaml | 2 +- Daybreak/Controls/ChromiumBrowserWrapper.xaml | 2 +- .../Controls/ChromiumBrowserWrapper.xaml.cs | 23 +- Daybreak/Controls/DropDownButton.xaml | 2 +- .../CurrentMapComponent.xaml.cs | 2 +- .../CurrentQuestComponent.xaml.cs | 2 +- .../MainPlayerInformationComponent.xaml.cs | 15 +- .../PlayerResourcesComponent.xaml | 2 +- .../PlayerResourcesComponent.xaml.cs | 11 +- .../QuestLogComponent.xaml.cs | 2 +- .../TitleInformationComponent.xaml.cs | 2 +- Daybreak/Controls/Glyphs/StarGlyph.xaml | 2 +- Daybreak/Controls/MenuList.xaml.cs | 17 +- .../NotificationStackpanel.xaml.cs | 11 +- .../Notifications/NotificationTemplate.xaml | 2 +- .../NotificationTemplate.xaml.cs | 2 +- .../NotificationTemplateSelector.cs | 2 +- .../Notifications/NotificationView.xaml.cs | 2 +- .../Options/BooleanOptionTemplate.xaml.cs | 2 +- .../Options/EnumOptionTemplate.xaml.cs | 2 +- Daybreak/Controls/Options/OptionsSection.xaml | 2 +- .../Controls/Options/OptionsSection.xaml.cs | 11 +- .../PrimitiveRangeOptionTemplate.xaml.cs | 2 +- .../Options/StringOptionTemplate.xaml.cs | 2 +- Daybreak/Controls/SnowfallOverlay.xaml | 2 +- .../Controls/Templates/AccountTemplate.xaml | 2 +- .../Templates/AccountTemplate.xaml.cs | 2 +- .../Templates/AttributeTemplate.xaml.cs | 7 +- .../Templates/BuildEntryTemplate.xaml | 2 +- .../Templates/BuildEntryTemplate.xaml.cs | 2 +- .../Controls/Templates/BuildTemplate.xaml.cs | 19 +- .../Templates/GuildwarsPathTemplate.xaml | 2 +- .../Templates/GuildwarsPathTemplate.xaml.cs | 9 +- .../Templates/LaunchButtonTemplate.xaml | 6 +- .../Templates/LaunchButtonTemplate.xaml.cs | 4 +- .../Controls/Templates/QuestLogTemplate.xaml | 2 +- .../Templates/QuestLogTemplate.xaml.cs | 4 +- .../Controls/Templates/ScreenTemplate.xaml.cs | 2 +- .../Templates/SkillListEntryTemplate.xaml | 1 + .../Templates/SkillListEntryTemplate.xaml.cs | 9 +- .../Controls/Templates/SkillTemplate.xaml.cs | 7 +- .../Templates/TradeChatMessageTemplate.xaml | 2 +- .../TradeChatMessageTemplate.xaml.cs | 2 +- .../Controls/Templates/TradeChatTemplate.xaml | 4 +- .../Templates/TradeChatTemplate.xaml.cs | 7 +- .../Templates/TradeMessageTemplate.xaml | 4 +- .../Templates/TradeMessageTemplate.xaml.cs | 2 +- .../Templates/TradeQuoteTemplate.xaml | 2 +- .../Templates/TradeQuoteTemplate.xaml.cs | 9 +- .../Controls/Templates/TraderQuoteModel.cs | 2 +- Daybreak/Controls/WorldPlayerContextMenu.xaml | 2 +- Daybreak/Daybreak.csproj | 46 +--- Daybreak/FodyWeavers.xml | 3 - Daybreak/Launch/ExceptionDialog.xaml | 2 +- Daybreak/Launch/Launcher.cs | 35 ++-- Daybreak/Launch/MainWindow.xaml | 4 +- Daybreak/Launch/MainWindow.xaml.cs | 14 +- Daybreak/Launch/SplashWindow.xaml | 1 + Daybreak/Launch/SplashWindow.xaml.cs | 2 +- .../Notifications/Handling/NoActionHandler.cs | 8 - Daybreak/Services/Api/DaybreakApiService.cs | 83 ++++++++ .../ApplicationArgumentService.cs | 3 +- .../AutoLaunchArgumentHandler.cs | 5 +- .../IArgumentHandlerProducer.cs | 9 - .../ApplicationLauncher.cs | 27 +-- .../Browser/BrowserExtensionsManager.cs | 3 +- .../Services/Browser/BrowserHistoryManager.cs | 2 +- .../Browser/IBrowserHistoryManager.cs | 2 +- .../AttributePointCalculator.cs | 5 +- .../BuildTemplates/BuildTemplateManager.cs | 9 +- .../Services/Charts/LiveChartInitializer.cs | 4 +- .../Services/Credentials/CredentialManager.cs | 3 +- .../FixSymbolicLinkNotificationHandler.cs | 6 +- .../Actions/FixSymbolicLinkStartupAction.cs | 9 +- Daybreak/Services/DSOAL/DSOALService.cs | 15 +- .../Services/Database/IDatabaseCollection.cs | 25 --- .../Database/RealmDatabaseCollection.cs | 85 -------- .../Services/DirectSong/DirectSongService.cs | 15 +- .../Services/Downloads/DownloadService.cs | 7 +- .../Services/Events/EventNotifierService.cs | 9 +- Daybreak/Services/Events/EventService.cs | 3 +- .../ExceptionHandling/ExceptionHandler.cs | 10 +- .../GuildWarsExecutableManager.cs | 1 + .../Experience/ExperienceCalculator.cs | 3 +- Daybreak/Services/Graph/GraphClient.cs | 6 +- ...GuildWarsBatchUpdateNotificationHandler.cs | 16 +- .../GuildWarsUpdateNotificationHandler.cs | 13 +- .../Guildwars/GuildWarsVersionChecker.cs | 9 +- .../Guildwars/GuildwarsCopyService.cs | 5 +- .../Guildwars/IntegratedGuildwarsInstaller.cs | 13 +- .../Models/GuildWarsDownloadContext.cs | 2 +- Daybreak/Services/IconRetrieve/IconCache.cs | 5 +- Daybreak/Services/Images/ImageCache.cs | 5 +- .../Services/Injection/ProcessInjector.cs | 3 +- Daybreak/Services/Injection/StubInjector.cs | 191 +++++++++++++++++ .../InternetChecker/ConnectivityStatus.cs | 7 +- .../InternetCheckingService.cs | 8 +- .../LaunchConfigurationService.cs | 7 +- Daybreak/Services/Logging/DebugLogsWriter.cs | 3 +- .../Services/Logging/EventViewerLogsWriter.cs | 3 +- Daybreak/Services/Logging/ILogsManager.cs | 15 -- Daybreak/Services/Logging/JsonLogsManager.cs | 90 ++------ Daybreak/Services/Logging/Models/LogDTO.cs | 15 -- Daybreak/Services/Menu/MenuService.cs | 3 +- Daybreak/Services/Metrics/MetricsService.cs | 3 +- Daybreak/Services/Mods/ModsManager.cs | 3 +- .../Services/Monitoring/DiskUsageMonitor.cs | 9 +- .../Services/Monitoring/MemoryUsageMonitor.cs | 7 +- .../Monitoring/ProcessorUsageMonitor.cs | 5 +- Daybreak/Services/Mutex/MutexHandler.cs | 3 +- Daybreak/Services/Navigation/ViewManager.cs | 3 +- .../Handlers}/MessageBoxHandler.cs | 4 +- .../NavigateToCalendarViewHandler.cs | 8 +- .../Notifications/Handlers/NoActionHandler.cs | 11 + .../Notifications/INotificationProducer.cs | 15 -- .../Notifications/INotificationStorage.cs | 14 +- .../Notifications/Models/NotificationDTO.cs | 12 +- .../Notifications/NotificationService.cs | 45 ++-- .../Notifications/NotificationStorage.cs | 44 ++-- .../Notifications/NotificationsDbContext.cs | 7 + .../Services/Onboarding/OnboardingService.cs | 9 +- Daybreak/Services/Options/OptionsManager.cs | 3 +- .../Options/OptionsSynchronizationService.cs | 1 + Daybreak/Services/Plugins/PluginsService.cs | 24 ++- .../Validators/DaybreakPluginValidator.cs | 3 +- .../Services/Privilege/PrivilegeManager.cs | 4 +- .../ReShadeConfigChangedHandler.cs | 5 +- Daybreak/Services/ReShade/ReShadeService.cs | 24 ++- Daybreak/Services/Registry/RegistryService.cs | 3 +- .../Services/Scanner/GuildwarsMemoryCache.cs | 5 +- .../Services/Scanner/GuildwarsMemoryReader.cs | 22 +- Daybreak/Services/Scanner/MemoryScanner.cs | 5 +- .../Services/Screens/GuildwarsScreenPlacer.cs | 5 +- .../Screens/IGuildwarsScreenPlacer.cs | 7 - Daybreak/Services/Screens/ScreenManager.cs | 5 +- .../Services/Screens/SplashScreenService.cs | 5 +- .../Screenshots/BackgroundProvider.cs | 3 +- Daybreak/Services/Screenshots/Models/Entry.cs | 2 +- Daybreak/Services/Screenshots/Models/Event.cs | 2 +- .../Services/Screenshots/Models/Location.cs | 2 +- .../Screenshots/OnlinePictureClient.cs | 9 +- .../Screenshots/ScreenshotProvider.cs | 3 +- .../Services/SevenZip/SevenZipExtractor.cs | 3 +- .../Services/Shortcuts/ShortcutManager.cs | 3 +- Daybreak/Services/Sounds/SoundService.cs | 1 + .../Actions/BrowserHistorySizeEnforcer.cs | 1 + .../Startup/Actions/CleanupDatabases.cs | 57 +++-- .../Actions/CredentialsOptionsMigrator.cs | 3 +- .../Startup/Actions/DeleteOldDatabase.cs | 3 +- .../Actions/EnsureDatabaseTablesExist.cs | 24 +++ .../Startup/Actions/RenameInstallerAction.cs | 3 +- .../Startup/Actions/UpdateToolboxAction.cs | 3 +- .../Startup/Actions/UpdateUModAction.cs | 3 +- .../Services/Startup/StartupActionManager.cs | 3 +- Daybreak/Services/Themes/ThemeManager.cs | 7 +- .../Notifications/ToolboxUpdateHandler.cs | 6 +- Daybreak/Services/Toolbox/ToolboxService.cs | 19 +- .../Toolbox/Utilities/IToolboxClient.cs | 6 +- .../Toolbox/Utilities/ToolboxClient.cs | 10 +- .../Services/TradeChat/IItemHashService.cs | 8 - .../TradeChat/IPriceHistoryDatabase.cs | 17 +- .../TradeChat/ITradeHistoryDatabase.cs | 6 +- .../Services/TradeChat/ItemHashService.cs | 3 +- .../TradeChat/Models/TraderMessageDTO.cs | 10 +- .../TradeChat/Models/TraderQuoteDTO.cs | 10 +- .../TradeMessageNotificationHandler.cs | 8 +- .../TradeChat/PriceHistoryDatabase.cs | 67 ++++-- .../Services/TradeChat/PriceHistoryService.cs | 12 +- .../TradeChat/TradeAlertingService.cs | 18 +- .../Services/TradeChat/TradeChatService.cs | 7 +- .../TradeChat/TradeHistoryDatabase.cs | 22 +- .../TradeChat/TradeMessagesDbContext.cs | 7 + .../Services/TradeChat/TradeQuoteDbContext.cs | 10 + .../Services/TradeChat/TraderQuoteService.cs | 21 +- .../TradeChat/WordHighlightingService.cs | 3 +- .../UBlockOrigin/UBlockOriginService.cs | 18 +- Daybreak/Services/UMod/UModService.cs | 27 +-- .../Services/Updater/ApplicationUpdater.cs | 21 +- .../PostUpdate/IPostUpdateActionProvider.cs | 8 - .../PostUpdate/PostUpdateActionManager.cs | 4 +- .../Updater/UpdateNotificationHandler.cs | 8 +- Daybreak/Services/Window/WindowEventsHook.cs | 1 + Daybreak/Views/BuildsListView.xaml | 1 + Daybreak/Views/BuildsListView.xaml.cs | 13 +- Daybreak/Views/BuildsSynchronizationView.xaml | 4 +- .../Views/BuildsSynchronizationView.xaml.cs | 6 +- .../Copy/GuildwarsCopySelectionView.xaml | 2 +- .../Copy/GuildwarsCopySelectionView.xaml.cs | 6 +- Daybreak/Views/Copy/GuildwarsCopyView.xaml.cs | 6 +- Daybreak/Views/EventCalendarView.xaml | 2 +- Daybreak/Views/EventCalendarView.xaml.cs | 4 +- Daybreak/Views/FocusView.xaml | 2 +- Daybreak/Views/FocusView.xaml.cs | 24 +-- Daybreak/Views/GraphAuthorizationView.xaml | 1 + Daybreak/Views/GraphAuthorizationView.xaml.cs | 2 +- Daybreak/Views/GuildWarsPartySearchView.xaml | 1 + .../Views/GuildWarsPartySearchView.xaml.cs | 2 +- .../GuildWarsDownloadSelectionView.xaml.cs | 8 +- .../Installation/GuildWarsDownloadView.xaml | 2 +- .../GuildwarsDownloadView.xaml.cs | 10 +- Daybreak/Views/Launch/AccountsView.xaml | 1 + Daybreak/Views/Launch/AccountsView.xaml.cs | 6 +- Daybreak/Views/Launch/ExecutablesView.xaml | 1 + Daybreak/Views/Launch/ExecutablesView.xaml.cs | 6 +- .../Launch/LaunchConfigurationView.xaml.cs | 14 +- .../Launch/LaunchConfigurationsView.xaml.cs | 6 +- Daybreak/Views/LauncherView.xaml | 2 +- Daybreak/Views/LauncherView.xaml.cs | 22 +- Daybreak/Views/LogsView.xaml | 2 +- Daybreak/Views/LogsView.xaml.cs | 12 +- Daybreak/Views/MetricsView.xaml.cs | 4 +- Daybreak/Views/NotificationsView.xaml | 2 +- Daybreak/Views/NotificationsView.xaml.cs | 20 +- .../Onboarding/DSOAL/DSOALBrowserView.xaml | 1 + .../Onboarding/DSOAL/DSOALHomepageView.xaml | 1 + .../Onboarding/DSOAL/DSOALInstallingView.xaml | 2 +- .../DSOAL/DSOALInstallingView.xaml.cs | 6 +- .../DSOAL/DSOALOnboardingEntryView.xaml.cs | 4 +- .../Onboarding/DSOAL/DSOALSwitchView.xaml | 3 +- .../Onboarding/DSOAL/DSOALSwitchView.xaml.cs | 4 +- .../DirectSongInstallationChoiceView.xaml | 2 +- .../DirectSongInstallationChoiceView.xaml.cs | 4 +- .../DirectSongInstallationView.xaml | 2 +- .../DirectSongInstallationView.xaml.cs | 6 +- .../DirectSongOnboardingEntryView.xaml.cs | 4 +- .../DirectSong/DirectSongSwitchView.xaml | 3 +- .../DirectSong/DirectSongSwitchView.xaml.cs | 4 +- .../Onboarding/LauncherOnboardingView.xaml | 4 +- .../Onboarding/LauncherOnboardingView.xaml.cs | 8 +- .../ReShade/ReShadeBrowserView.xaml | 1 + .../ReShade/ReShadeBrowserView.xaml.cs | 7 +- .../ReShade/ReShadeConfigView.xaml.cs | 4 +- .../ReShadeInstallationChoiceView.xaml | 2 +- .../ReShadeInstallationChoiceView.xaml.cs | 4 +- .../ReShade/ReShadeInstallingView.xaml | 2 +- .../ReShade/ReShadeInstallingView.xaml.cs | 6 +- .../Onboarding/ReShade/ReShadeMainView.xaml | 2 +- .../ReShade/ReShadeMainView.xaml.cs | 6 +- .../ReShadeOnboardingEntryView.xaml.cs | 4 +- .../ReShade/ReShadePresetView.xaml.cs | 4 +- .../ReShadeStockEffectsSelectorView.xaml | 1 + .../ReShadeStockEffectsSelectorView.xaml.cs | 4 +- .../Toolbox/ToolboxHomepageView.xaml | 1 + .../ToolboxInstallationChoiceView.xaml | 2 +- .../ToolboxInstallationChoiceView.xaml.cs | 4 +- .../Toolbox/ToolboxInstallationView.xaml | 2 +- .../Toolbox/ToolboxInstallationView.xaml.cs | 6 +- .../ToolboxOnboardingEntryView.xaml.cs | 4 +- .../Onboarding/Toolbox/ToolboxSwitchView.xaml | 3 +- .../Toolbox/ToolboxSwitchView.xaml.cs | 4 +- .../Onboarding/UMod/UModBrowserView.xaml | 1 + .../Onboarding/UMod/UModBrowserView.xaml.cs | 7 +- .../UMod/UModInstallationChoiceView.xaml | 2 +- .../UMod/UModInstallationChoiceView.xaml.cs | 2 +- .../Onboarding/UMod/UModInstallingView.xaml | 2 +- .../UMod/UModInstallingView.xaml.cs | 6 +- .../Views/Onboarding/UMod/UModMainView.xaml | 3 +- .../Onboarding/UMod/UModMainView.xaml.cs | 6 +- .../UMod/UModOnboardingEntryView.xaml.cs | 4 +- Daybreak/Views/OptionSectionView.xaml.cs | 8 +- .../Views/PluginsConfirmationView.xaml.cs | 4 +- Daybreak/Views/PluginsView.xaml.cs | 6 +- Daybreak/Views/RequestDelevationView.xaml.cs | 6 +- Daybreak/Views/RequestElevationView.xaml | 2 +- Daybreak/Views/RequestElevationView.xaml.cs | 6 +- Daybreak/Views/ScreenChoiceView.xaml | 2 +- Daybreak/Views/ScreenChoiceView.xaml.cs | 8 +- .../Views/SettingsSynchronizationView.xaml | 2 +- .../Views/SettingsSynchronizationView.xaml.cs | 8 +- Daybreak/Views/SingleBuildTemplateView.xaml | 4 +- .../Views/SingleBuildTemplateView.xaml.cs | 8 +- Daybreak/Views/TeamBuildTemplateView.xaml | 3 +- Daybreak/Views/TeamBuildTemplateView.xaml.cs | 12 +- .../Views/Trade/AscalonTradeChatView.xaml.cs | 6 +- .../Views/Trade/KamadanTradeChatView.xaml.cs | 6 +- Daybreak/Views/Trade/PriceHistoryView.xaml | 1 + Daybreak/Views/Trade/PriceHistoryView.xaml.cs | 8 +- Daybreak/Views/Trade/PriceQuotesView.xaml | 3 +- Daybreak/Views/Trade/PriceQuotesView.xaml.cs | 74 ++++--- Daybreak/Views/Trade/QuoteAlertSetupView.xaml | 2 +- .../Views/Trade/QuoteAlertSetupView.xaml.cs | 8 +- .../Views/Trade/TradeAlertSetupView.xaml.cs | 6 +- .../Views/Trade/TradeAlertsChoiceView.xaml.cs | 10 +- Daybreak/Views/Trade/TradeAlertsView.xaml.cs | 6 +- .../Views/Trade/TradeNotificationView.xaml.cs | 11 +- Daybreak/Views/UpdateConfirmationView.xaml.cs | 6 +- Daybreak/Views/UpdateView.xaml | 3 +- Daybreak/Views/UpdateView.xaml.cs | 8 +- Daybreak/Views/VersionManagementView.xaml | 1 + Daybreak/Views/VersionManagementView.xaml.cs | 6 +- 656 files changed, 2514 insertions(+), 1794 deletions(-) create mode 100644 Daybreak.API/Controllers/TestController.cs create mode 100644 Daybreak.API/Daybreak.API.csproj create mode 100644 Daybreak.API/EntryPoint.cs create mode 100644 Daybreak.API/Extensions/ConsoleExtensions.cs create mode 100644 Daybreak.API/NativeMethods.cs create mode 100644 Daybreak.API/Properties/launchSettings.json create mode 100644 Daybreak.API/Serialization/ApiJsonSerializerContext.cs rename {Daybreak => Daybreak.Shared}/Configuration/Options/ITradeChatOptions.cs (67%) rename {Daybreak => Daybreak.Shared}/Converters/AttributeJsonConverter.cs (97%) rename {Daybreak => Daybreak.Shared}/Converters/BooleanToEffectConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/BooleanToGridLengthConverter.cs (96%) rename {Daybreak => Daybreak.Shared}/Converters/BooleanToVisibilityConverter.cs (83%) rename {Daybreak => Daybreak.Shared}/Converters/CampaignJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/ContinentJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/DateTimeConverter.cs (96%) rename {Daybreak => Daybreak.Shared}/Converters/DoubleMultiplierConverter.cs (93%) rename {Daybreak => Daybreak.Shared}/Converters/EqualityToVisibilityConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/EventCalendarDayToBrushConverter.cs (89%) rename {Daybreak => Daybreak.Shared}/Converters/EventToBrushConverter.cs (89%) rename {Daybreak => Daybreak.Shared}/Converters/HiddenWhenNull.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/IntToStringConverter.cs (96%) rename {Daybreak => Daybreak.Shared}/Converters/InverseBooleanConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/ItemBaseJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/ItemBaseToIntConverter.cs (92%) rename {Daybreak => Daybreak.Shared}/Converters/ItemBaseToStringConverter.cs (92%) rename {Daybreak => Daybreak.Shared}/Converters/MapJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/MenuButtonHighlightConverter.cs (95%) rename {Daybreak => Daybreak.Shared}/Converters/NpcJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/PriceToStringConverter.cs (69%) rename {Daybreak => Daybreak.Shared}/Converters/ProfessionJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/QuestJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/RegionJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/SkillJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/TileButtonHighlightConverter.cs (95%) rename {Daybreak => Daybreak.Shared}/Converters/TimeSinceDateTimeConverter.cs (98%) rename {Daybreak => Daybreak.Shared}/Converters/TimespanToETAConverter.cs (85%) rename {Daybreak => Daybreak.Shared}/Converters/TitleJsonConverter.cs (94%) rename {Daybreak => Daybreak.Shared}/Converters/TradeAlertConverter.cs (97%) rename {Daybreak => Daybreak.Shared}/Converters/TraderQuoteTypeToStringConverter.cs (92%) create mode 100644 Daybreak.Shared/Daybreak.Shared.csproj rename {Daybreak => Daybreak.Shared}/Exceptions/CredentialsNotFoundException.cs (90%) rename {Daybreak => Daybreak.Shared}/Exceptions/ExecutableNotFoundException.cs (90%) rename {Daybreak => Daybreak.Shared}/Exceptions/FatalException.cs (88%) create mode 100644 Daybreak.Shared/Global.cs rename {Daybreak => Daybreak.Shared}/Models/ApplicationLauncherContext.cs (86%) rename {Daybreak/Services/Screenshots => Daybreak.Shared}/Models/BackgroundResponse.cs (77%) rename {Daybreak => Daybreak.Shared}/Models/BatchedObservableCollection.cs (96%) rename {Daybreak => Daybreak.Shared}/Models/Browser/BrowserHistory.cs (81%) rename {Daybreak => Daybreak.Shared}/Models/Browser/BrowserPayload.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Browser/DownloadPayload.cs (75%) rename {Daybreak => Daybreak.Shared}/Models/Browser/OnContextMenuPayload.cs (89%) rename {Daybreak => Daybreak.Shared}/Models/BuildWithTemplateCode.cs (65%) rename {Daybreak => Daybreak.Shared}/Models/Builds/AttributeEntry.cs (88%) rename {Daybreak => Daybreak.Shared}/Models/Builds/IBuildEntry.cs (88%) rename {Daybreak => Daybreak.Shared}/Models/Builds/SingleBuildEntry.cs (98%) rename {Daybreak => Daybreak.Shared}/Models/Builds/TeamBuildEntry.cs (93%) rename {Daybreak => Daybreak.Shared}/Models/ColorPalette.cs (98%) rename {Daybreak => Daybreak.Shared}/Models/ColorScheme.cs (88%) rename {Daybreak => Daybreak.Shared}/Models/ColoredTextElement.cs (84%) rename {Daybreak => Daybreak.Shared}/Models/DownloadedBuild.cs (64%) rename {Daybreak => Daybreak.Shared}/Models/ElevationRequest.cs (84%) rename {Daybreak => Daybreak.Shared}/Models/EventViewModel.cs (90%) rename {Daybreak => Daybreak.Shared}/Models/ExecutablePath.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/ExecutionPolicies.cs (79%) rename {Daybreak => Daybreak.Shared}/Models/FocusView/PlayerContextMenuContext.cs (63%) rename {Daybreak => Daybreak.Shared}/Models/FocusView/QuestEntry.cs (64%) rename {Daybreak => Daybreak.Shared}/Models/FocusView/QuestLocationEntry.cs (64%) rename {Daybreak => Daybreak.Shared}/Models/FocusView/QuestLogEntry.cs (65%) rename {Daybreak => Daybreak.Shared}/Models/FocusView/QuestLogSeparator.cs (72%) rename {Daybreak => Daybreak.Shared}/Models/Github/GithubRefTag.cs (84%) rename {Daybreak/Services/Guildwars => Daybreak.Shared}/Models/GuildWarsUpdateRequest.cs (75%) rename {Daybreak/Services/Guildwars => Daybreak.Shared}/Models/GuildWarsUpdateResponse.cs (73%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Attribute.cs (98%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Build.cs (85%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/BuildEntryBase.cs (97%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/BuildMetadata.cs (94%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Campaign.cs (97%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Continent.cs (97%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Event.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Hero.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/IIconUrlEntity.cs (60%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/IItemModHash.cs (60%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/IWikiEntity.cs (59%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Inscription.cs (96%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/InstanceType.cs (64%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/ItemBase.cs (97%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/ItemModifier.cs (90%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/LoginData.cs (76%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/MainPlayerData.cs (69%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/MainPlayerInformation.cs (96%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Map.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Material.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Npc.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/PartyCompositionMetadataEntry.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/PlayerInformation.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Position.cs (94%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Profession.cs (98%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Quest.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/QuestMetadata.cs (83%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Region.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/RegionType.cs (89%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Rune.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/SessionData.cs (65%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/SessionInformation.cs (85%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Skill.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/SkillMetadata.cs (85%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/TeamBuildData.cs (77%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/TeamBuildPlayerData.cs (89%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/Title.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/TitleInformation.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/UserData.cs (63%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/UserInformation.cs (94%) create mode 100644 Daybreak.Shared/Models/Guildwars/VialOfDye.cs rename {Daybreak => Daybreak.Shared}/Models/Guildwars/WorldData.cs (81%) rename {Daybreak => Daybreak.Shared}/Models/Guildwars/WorldPlayerInformation.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/IconPayload.cs (76%) rename {Daybreak => Daybreak.Shared}/Models/IconRequest.cs (67%) rename {Daybreak => Daybreak.Shared}/Models/InternetConnectionState.cs (77%) rename {Daybreak => Daybreak.Shared}/Models/Interop/AreaContext.cs (96%) rename {Daybreak => Daybreak.Shared}/Models/Interop/AreaInfoContext.cs (97%) rename {Daybreak => Daybreak.Shared}/Models/Interop/AttributeContext.cs (83%) rename {Daybreak => Daybreak.Shared}/Models/Interop/BagInfo.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/Interop/EntityAllegiance.cs (79%) rename {Daybreak => Daybreak.Shared}/Models/Interop/EntityContext.cs (97%) rename {Daybreak => Daybreak.Shared}/Models/Interop/EntityState.cs (75%) rename {Daybreak => Daybreak.Shared}/Models/Interop/EntityType.cs (65%) rename {Daybreak => Daybreak.Shared}/Models/Interop/GameContext.cs (98%) rename {Daybreak => Daybreak.Shared}/Models/Interop/GamePosition.cs (67%) rename {Daybreak => Daybreak.Shared}/Models/Interop/GenericGuildwarsArray.cs (80%) rename {Daybreak => Daybreak.Shared}/Models/Interop/GlobalContext.cs (94%) rename {Daybreak => Daybreak.Shared}/Models/Interop/GuildwarsArray.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Interop/GuildwarsPointer.cs (84%) rename {Daybreak => Daybreak.Shared}/Models/Interop/GuildwarsPointerArray.cs (87%) rename {Daybreak => Daybreak.Shared}/Models/Interop/HenchmanPartyMember.cs (87%) rename {Daybreak => Daybreak.Shared}/Models/Interop/HeroPartyMember.cs (84%) rename {Daybreak => Daybreak.Shared}/Models/Interop/IPAddressContext.cs (85%) rename {Daybreak => Daybreak.Shared}/Models/Interop/InstanceContext.cs (82%) rename {Daybreak => Daybreak.Shared}/Models/Interop/InstanceInfoContext.cs (87%) rename {Daybreak => Daybreak.Shared}/Models/Interop/InstanceType.cs (61%) rename {Daybreak => Daybreak.Shared}/Models/Interop/InventoryContext.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/Interop/ItemContext.cs (90%) rename {Daybreak => Daybreak.Shared}/Models/Interop/ItemInfo.cs (96%) rename {Daybreak => Daybreak.Shared}/Models/Interop/ItemModifier.cs (85%) rename {Daybreak => Daybreak.Shared}/Models/Interop/LoginCharacterContext.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Interop/MapContext.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Interop/MapEntityContext.cs (96%) rename {Daybreak => Daybreak.Shared}/Models/Interop/MapIconContext.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/Interop/NpcContext.cs (93%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PartyAttributesContext.cs (85%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PartyContext.cs (90%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PartyInfoContext.cs (93%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PathingMap.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PathingMapContext.cs (83%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PathingTrapezoid.cs (93%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PlayerContext.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PlayerControlledCharContext.cs (74%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PlayerPartyMember.cs (85%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PreGameContext.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/Interop/ProfessionsContext.cs (81%) rename {Daybreak => Daybreak.Shared}/Models/Interop/PvpTeam.cs (66%) rename {Daybreak => Daybreak.Shared}/Models/Interop/QuestContext.cs (93%) rename {Daybreak => Daybreak.Shared}/Models/Interop/RegionType.cs (90%) rename {Daybreak => Daybreak.Shared}/Models/Interop/SkillContext.cs (87%) rename {Daybreak => Daybreak.Shared}/Models/Interop/SkillbarContext.cs (93%) rename {Daybreak => Daybreak.Shared}/Models/Interop/TeamColor.cs (72%) rename {Daybreak => Daybreak.Shared}/Models/Interop/TitleContext.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/Interop/TitleIds.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/Interop/TitleInfo.cs (70%) rename {Daybreak => Daybreak.Shared}/Models/Interop/TitleTierContext.cs (82%) rename {Daybreak => Daybreak.Shared}/Models/Interop/UserContext.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/KeyMacro.cs (84%) rename {Daybreak => Daybreak.Shared}/Models/KeyboardHookEventArgs.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/KeyboardInput.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/KeyboardState.cs (76%) rename {Daybreak => Daybreak.Shared}/Models/LaunchConfigurations/GuildWarsApplicationLaunchContext.cs (87%) rename {Daybreak => Daybreak.Shared}/Models/LaunchConfigurations/LaunchConfiguration.cs (88%) rename {Daybreak => Daybreak.Shared}/Models/LaunchConfigurations/LaunchConfigurationWithCredentials.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/LauncherViewContext.cs (93%) rename {Daybreak => Daybreak.Shared}/Models/Log.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/LoginCredentials.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/MainPlayerResourceContext.cs (70%) rename {Daybreak => Daybreak.Shared}/Models/Menu/MenuButton.cs (86%) rename {Daybreak => Daybreak.Shared}/Models/Menu/MenuCategory.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/Metrics/AggregationTypes.cs (63%) rename {Daybreak => Daybreak.Shared}/Models/Metrics/Metric.cs (84%) rename {Daybreak => Daybreak.Shared}/Models/Metrics/MetricSet.cs (86%) rename {Daybreak => Daybreak.Shared}/Models/Metrics/MetricSetViewModel.cs (87%) rename {Daybreak => Daybreak.Shared}/Models/Metrics/RecordedMetric.cs (79%) rename {Daybreak => Daybreak.Shared}/Models/Mods/GuildWarsCreatedContext.cs (80%) rename {Daybreak => Daybreak.Shared}/Models/Mods/GuildWarsStartedContext.cs (75%) rename {Daybreak => Daybreak.Shared}/Models/Mods/GuildWarsStartingContext.cs (70%) rename {Daybreak => Daybreak.Shared}/Models/Mods/GuildWarsStartingDisabledContext.cs (65%) rename {Daybreak => Daybreak.Shared}/Models/Notifications/Handling/INotificationHandler.cs (61%) rename {Daybreak => Daybreak.Shared}/Models/Notifications/ICancellableNotification.cs (73%) rename {Daybreak => Daybreak.Shared}/Models/Notifications/INotification.cs (87%) rename {Daybreak => Daybreak.Shared}/Models/Notifications/Notification.cs (89%) rename {Daybreak => Daybreak.Shared}/Models/Notifications/NotificationCancellationToken.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Notifications/NotificationWrapper.cs (87%) rename {Daybreak => Daybreak.Shared}/Models/Onboarding/LauncherOnboardingStage.cs (73%) rename {Daybreak => Daybreak.Shared}/Models/Options/OptionEntry.cs (85%) rename {Daybreak => Daybreak.Shared}/Models/Options/OptionHeading.cs (81%) rename {Daybreak => Daybreak.Shared}/Models/Options/OptionProperty.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Options/OptionSection.cs (80%) rename {Daybreak => Daybreak.Shared}/Models/Options/OptionSetter.cs (84%) rename {Daybreak => Daybreak.Shared}/Models/Plugins/AvailablePlugin.cs (80%) rename {Daybreak => Daybreak.Shared}/Models/Plugins/PluginConfigurationBase.cs (75%) rename {Daybreak/Services/Updater/PostUpdate => Daybreak.Shared/Models}/PostUpdateActionBase.cs (83%) rename {Daybreak => Daybreak.Shared}/Models/Progress/ActionStatus.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Progress/CopyStatus.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/Progress/DSOALInstallationStatus.cs (94%) rename {Daybreak => Daybreak.Shared}/Models/Progress/DirectSongInstallationStatus.cs (96%) rename {Daybreak => Daybreak.Shared}/Models/Progress/DownloadStatus.cs (96%) rename {Daybreak => Daybreak.Shared}/Models/Progress/GuildwarsInstallationStatus.cs (97%) rename {Daybreak => Daybreak.Shared}/Models/Progress/IconDownloadStatus.cs (98%) rename {Daybreak => Daybreak.Shared}/Models/Progress/LoadStatus.cs (82%) rename {Daybreak => Daybreak.Shared}/Models/Progress/ReShadeInstallationStatus.cs (94%) rename {Daybreak => Daybreak.Shared}/Models/Progress/StartupStatus.cs (95%) rename {Daybreak => Daybreak.Shared}/Models/Progress/ToolboxInstallationStatus.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Progress/UModInstallationStatus.cs (94%) rename {Daybreak => Daybreak.Shared}/Models/Progress/UpdateStatus.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/ProtectedLoginCredentials.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/ReShade/ShaderPackage.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/ScopeMetadata.cs (88%) rename {Daybreak => Daybreak.Shared}/Models/Screen.cs (78%) rename {Daybreak => Daybreak.Shared}/Models/SecureString.cs (98%) rename {Daybreak => Daybreak.Shared}/Models/SortedObservableCollection.cs (97%) rename {Daybreak/Services/Startup/Actions => Daybreak.Shared/Models}/StartupActionBase.cs (86%) rename {Daybreak => Daybreak.Shared}/Models/SynchronizationBuild.cs (81%) rename {Daybreak => Daybreak.Shared}/Models/Trade/ITradeAlert.cs (73%) rename {Daybreak => Daybreak.Shared}/Models/Trade/QuoteAlert.cs (84%) rename {Daybreak => Daybreak.Shared}/Models/Trade/TradeAlert.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Trade/TraderMessage.cs (94%) rename {Daybreak => Daybreak.Shared}/Models/Trade/TraderMessageViewWrapper.cs (97%) rename {Daybreak => Daybreak.Shared}/Models/Trade/TraderQuote.cs (67%) rename {Daybreak/Services/TradeChat/Models => Daybreak.Shared/Models/Trade}/TraderQuoteType.cs (50%) rename {Daybreak => Daybreak.Shared}/Models/UMod/UModEntry.cs (82%) rename {Daybreak => Daybreak.Shared}/Models/Versioning/Version.cs (99%) rename {Daybreak => Daybreak.Shared}/Models/Versioning/VersionNumberToken.cs (91%) rename {Daybreak => Daybreak.Shared}/Models/Versioning/VersionStringToken.cs (92%) rename {Daybreak => Daybreak.Shared}/Models/Versioning/VersionToken.cs (93%) rename {Daybreak => Daybreak.Shared}/Models/Win32Window.cs (78%) create mode 100644 Daybreak.Shared/Services/Api/IDaybreakApiService.cs rename {Daybreak => Daybreak.Shared}/Services/ApplicationArguments/ArgumentHandling/IArgumentHandler.cs (66%) rename {Daybreak => Daybreak.Shared}/Services/ApplicationArguments/IApplicationArgumentService.cs (66%) create mode 100644 Daybreak.Shared/Services/ApplicationArguments/IArgumentHandlerProducer.cs rename {Daybreak => Daybreak.Shared}/Services/ApplicationLauncher/IApplicationLauncher.cs (87%) rename {Daybreak => Daybreak.Shared}/Services/Browser/IBrowserExtension.cs (81%) rename {Daybreak => Daybreak.Shared}/Services/Browser/IBrowserExtensionsManager.cs (83%) rename {Daybreak => Daybreak.Shared}/Services/Browser/IBrowserExtensionsProducer.cs (72%) rename {Daybreak => Daybreak.Shared}/Services/BuildTemplates/IAttributePointCalculator.cs (72%) rename {Daybreak => Daybreak.Shared}/Services/BuildTemplates/IBuildTemplateManager.cs (89%) rename {Daybreak => Daybreak.Shared}/Services/Credentials/ICredentialManager.cs (80%) rename {Daybreak => Daybreak.Shared}/Services/DSOAL/IDSOALService.cs (62%) rename {Daybreak => Daybreak.Shared}/Services/DirectSong/IDirectSongService.cs (73%) rename {Daybreak => Daybreak.Shared}/Services/Downloads/IDownloadService.cs (73%) rename {Daybreak => Daybreak.Shared}/Services/Events/IEventService.cs (78%) rename {Daybreak => Daybreak.Shared}/Services/ExecutableManagement/IGuildWarsExecutableManager.cs (83%) rename {Daybreak => Daybreak.Shared}/Services/Experience/IExperienceCalculator.cs (86%) rename {Daybreak => Daybreak.Shared}/Services/Guildwars/IGuildWarsVersionChecker.cs (60%) rename {Daybreak => Daybreak.Shared}/Services/Guildwars/IGuildwarsCopyService.cs (70%) rename {Daybreak => Daybreak.Shared}/Services/Guildwars/IGuildwarsInstaller.cs (85%) rename {Daybreak => Daybreak.Shared}/Services/IconRetrieve/IIconCache.cs (66%) rename {Daybreak => Daybreak.Shared}/Services/Images/IImageCache.cs (76%) rename {Daybreak => Daybreak.Shared}/Services/Injection/IProcessInjector.cs (82%) create mode 100644 Daybreak.Shared/Services/Injection/IStubInjector.cs rename {Daybreak => Daybreak.Shared}/Services/InternetChecker/IConnectivityStatus.cs (59%) rename {Daybreak => Daybreak.Shared}/Services/InternetChecker/IInternetCheckingService.cs (55%) rename {Daybreak => Daybreak.Shared}/Services/LaunchConfigurations/ILaunchConfigurationService.cs (86%) rename {Daybreak => Daybreak.Shared}/Services/Logging/IDebugLogsWriter.cs (64%) rename {Daybreak => Daybreak.Shared}/Services/Logging/IEventViewerLogsWriter.cs (65%) create mode 100644 Daybreak.Shared/Services/Logging/ILogsManager.cs rename {Daybreak => Daybreak.Shared}/Services/Menu/IMenuService.cs (69%) rename {Daybreak => Daybreak.Shared}/Services/Menu/IMenuServiceButtonHandler.cs (53%) rename {Daybreak => Daybreak.Shared}/Services/Menu/IMenuServiceInitializer.cs (80%) rename {Daybreak => Daybreak.Shared}/Services/Menu/IMenuServiceProducer.cs (69%) rename {Daybreak => Daybreak.Shared}/Services/Metrics/IMetricsService.cs (91%) rename {Daybreak => Daybreak.Shared}/Services/Mods/IModService.cs (94%) rename {Daybreak => Daybreak.Shared}/Services/Mods/IModsManager.cs (87%) rename {Daybreak => Daybreak.Shared}/Services/Mutex/IMutexHandler.cs (74%) rename {Daybreak => Daybreak.Shared}/Services/Navigation/IViewManager.cs (88%) rename {Daybreak => Daybreak.Shared}/Services/Navigation/IViewProducer.cs (80%) rename {Daybreak => Daybreak.Shared}/Services/Notifications/INotificationHandlerProducer.cs (57%) create mode 100644 Daybreak.Shared/Services/Notifications/INotificationProducer.cs rename {Daybreak => Daybreak.Shared}/Services/Notifications/INotificationService.cs (86%) rename {Daybreak => Daybreak.Shared}/Services/Onboarding/IOnboardingService.cs (50%) rename {Daybreak => Daybreak.Shared}/Services/Options/IOptionsProducer.cs (66%) rename {Daybreak => Daybreak.Shared}/Services/Options/IOptionsProvider.cs (89%) rename {Daybreak => Daybreak.Shared}/Services/Options/IOptionsSynchronizationService.cs (93%) rename {Daybreak => Daybreak.Shared}/Services/Options/IOptionsUpdateHook.cs (84%) rename {Daybreak => Daybreak.Shared}/Services/Plugins/IPluginsService.cs (65%) rename {Daybreak => Daybreak.Shared}/Services/Privilege/IPrivilegeManager.cs (89%) rename {Daybreak => Daybreak.Shared}/Services/ReShade/IReShadeService.cs (86%) rename {Daybreak => Daybreak.Shared}/Services/Registry/IRegistryService.cs (77%) rename {Daybreak => Daybreak.Shared}/Services/Scanner/IGuildwarsMemoryCache.cs (82%) rename {Daybreak => Daybreak.Shared}/Services/Scanner/IGuildwarsMemoryReader.cs (89%) rename {Daybreak => Daybreak.Shared}/Services/Scanner/IMemoryScanner.cs (91%) create mode 100644 Daybreak.Shared/Services/Screens/IGuildwarsScreenPlacer.cs rename {Daybreak => Daybreak.Shared}/Services/Screens/IScreenManager.cs (75%) rename {Daybreak => Daybreak.Shared}/Services/Screens/ISplashScreenService.cs (68%) rename {Daybreak => Daybreak.Shared}/Services/Screenshots/IBackgroundProvider.cs (57%) rename {Daybreak => Daybreak.Shared}/Services/Screenshots/IOnlinePictureClient.cs (78%) rename {Daybreak => Daybreak.Shared}/Services/Screenshots/IScreenshotProvider.cs (75%) rename {Daybreak => Daybreak.Shared}/Services/SevenZip/ISevenZipExtractor.cs (85%) rename {Daybreak => Daybreak.Shared}/Services/Shortcuts/IShortcutManager.cs (77%) rename {Daybreak => Daybreak.Shared}/Services/Sounds/ISoundService.cs (73%) rename {Daybreak => Daybreak.Shared}/Services/Startup/IStartupActionProducer.cs (58%) rename {Daybreak => Daybreak.Shared}/Services/Themes/IThemeManager.cs (78%) rename {Daybreak => Daybreak.Shared}/Services/Toolbox/IToolboxService.cs (82%) create mode 100644 Daybreak.Shared/Services/TradeChat/IItemHashService.cs rename {Daybreak => Daybreak.Shared}/Services/TradeChat/IPriceHistoryService.cs (70%) rename {Daybreak => Daybreak.Shared}/Services/TradeChat/ITradeAlertingService.cs (77%) rename {Daybreak => Daybreak.Shared}/Services/TradeChat/ITradeChatService.cs (86%) rename {Daybreak => Daybreak.Shared}/Services/TradeChat/ITraderQuoteService.cs (78%) rename {Daybreak => Daybreak.Shared}/Services/TradeChat/IWordHighlightingService.cs (76%) rename {Daybreak => Daybreak.Shared}/Services/UMod/IUModService.cs (69%) rename {Daybreak => Daybreak.Shared}/Services/Updater/IApplicationUpdater.cs (79%) rename {Daybreak => Daybreak.Shared}/Services/Updater/PostUpdate/IPostUpdateActionManager.cs (63%) rename {Daybreak => Daybreak.Shared}/Services/Updater/PostUpdate/IPostUpdateActionProducer.cs (57%) create mode 100644 Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionProvider.cs rename {Daybreak => Daybreak.Shared}/Services/Window/IWindowEventsHook.cs (88%) rename {Daybreak => Daybreak.Shared}/Utils/ColorExtensions.cs (72%) rename {Daybreak => Daybreak.Shared}/Utils/DateTimeExtensions.cs (97%) rename {Daybreak => Daybreak.Shared}/Utils/DependencyObjectExtensions.cs (96%) rename {Daybreak => Daybreak.Shared}/Utils/EncryptionHelper.cs (84%) rename {Daybreak => Daybreak.Shared}/Utils/MathUtils.cs (87%) rename {Daybreak => Daybreak.Shared}/Utils/MetricsHttpMessageHandler.cs (94%) rename {Daybreak => Daybreak.Shared}/Utils/NativeMethods.cs (68%) rename {Daybreak => Daybreak.Shared}/Utils/PathUtils.cs (94%) rename {Daybreak => Daybreak.Shared}/Utils/SerializationExtensions.cs (89%) rename {Daybreak => Daybreak.Shared}/Utils/StringUtils.cs (98%) rename {Daybreak => Daybreak.Shared}/Validators/AllGoesValidator.cs (75%) rename {Daybreak => Daybreak.Shared}/Validators/BooleanValidator.cs (90%) rename {Daybreak => Daybreak.Shared}/Validators/ClampedValidator.cs (96%) rename {Daybreak => Daybreak.Shared}/Validators/EnumValidator.cs (80%) rename {Daybreak => Daybreak.Shared}/Validators/IValidator.cs (60%) create mode 100644 Daybreak.Tests/Models/VialOfDyeTests.cs delete mode 100644 Daybreak/FodyWeavers.xml delete mode 100644 Daybreak/Models/Notifications/Handling/NoActionHandler.cs create mode 100644 Daybreak/Services/Api/DaybreakApiService.cs delete mode 100644 Daybreak/Services/ApplicationArguments/IArgumentHandlerProducer.cs delete mode 100644 Daybreak/Services/Database/IDatabaseCollection.cs delete mode 100644 Daybreak/Services/Database/RealmDatabaseCollection.cs create mode 100644 Daybreak/Services/Injection/StubInjector.cs delete mode 100644 Daybreak/Services/Logging/ILogsManager.cs delete mode 100644 Daybreak/Services/Logging/Models/LogDTO.cs rename Daybreak/{Models/Notifications/Handling => Services/Notifications/Handlers}/MessageBoxHandler.cs (62%) rename Daybreak/{Models/Notifications/Handling => Services/Notifications/Handlers}/NavigateToCalendarViewHandler.cs (73%) create mode 100644 Daybreak/Services/Notifications/Handlers/NoActionHandler.cs delete mode 100644 Daybreak/Services/Notifications/INotificationProducer.cs create mode 100644 Daybreak/Services/Notifications/NotificationsDbContext.cs delete mode 100644 Daybreak/Services/Screens/IGuildwarsScreenPlacer.cs create mode 100644 Daybreak/Services/Startup/Actions/EnsureDatabaseTablesExist.cs delete mode 100644 Daybreak/Services/TradeChat/IItemHashService.cs create mode 100644 Daybreak/Services/TradeChat/TradeMessagesDbContext.cs create mode 100644 Daybreak/Services/TradeChat/TradeQuoteDbContext.cs delete mode 100644 Daybreak/Services/Updater/PostUpdate/IPostUpdateActionProvider.cs diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 182a9856..82a8962b 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -92,6 +92,11 @@ jobs: env: RuntimeIdentifier: win-${{ matrix.targetplatform }} + - name: Create publish API files + run: dotnet publish .\Daybreak.API\Daybreak.API.csproj -c $env:Configuration -r $env:RuntimeIdentifier --property:SolutionDir=$env:GITHUB_WORKSPACE -p:PublishSingleFile=false --self-contained true -o .\Publish + env: + RuntimeIdentifier: win-${{ matrix.targetplatform }} + - name: Pack publish files run: | Write-Host $env diff --git a/Daybreak.API/Controllers/TestController.cs b/Daybreak.API/Controllers/TestController.cs new file mode 100644 index 00000000..6fcd835b --- /dev/null +++ b/Daybreak.API/Controllers/TestController.cs @@ -0,0 +1,13 @@ +using Net.Sdk.Web; + +namespace Daybreak.API.Controllers; + +[GenerateController("api/test")] +public sealed class TestController +{ + [GenerateGet("testing")] + public IResult GetTest(CancellationToken token) + { + return Results.Text("Hello from injected ASP-NET Core!", "text/plain"); + } +} diff --git a/Daybreak.API/Daybreak.API.csproj b/Daybreak.API/Daybreak.API.csproj new file mode 100644 index 00000000..76f899ad --- /dev/null +++ b/Daybreak.API/Daybreak.API.csproj @@ -0,0 +1,41 @@ + + + + net9.0-windows + enable + enable + Library + win-x86 + true + true + true + + true + true + + + OutOfProcess + false + false + true + + + + + + + + + + + + $(MSBuildProjectDirectory)\..\Daybreak\bin\x86\$(Configuration)\$(TargetFramework)\ + true + + + + + + + + \ No newline at end of file diff --git a/Daybreak.API/EntryPoint.cs b/Daybreak.API/EntryPoint.cs new file mode 100644 index 00000000..daa25d31 --- /dev/null +++ b/Daybreak.API/EntryPoint.cs @@ -0,0 +1,85 @@ +using System.Net.NetworkInformation; +using System.Runtime.InteropServices; +using Daybreak.API.Extensions; +using Daybreak.API.Serialization; +using Net.Sdk.Web; + +namespace Daybreak.API; + +public static class EntryPoint +{ + private const int StartPort = 5080; + + [UnmanagedCallersOnly(EntryPoint = "ThreadInit"), STAThread] + public static int ThreadInit(IntPtr _, int __) + { + ConsoleExtensions.AllocateAnsiConsole(); + var port = FindAvailablePort(StartPort); + if (port <= 0) + { + Console.WriteLine($"No available port found starting from {StartPort}"); + return -1; + } + + Console.WriteLine($"Starting Daybreak API on port {port}"); + Task.Run(() => StartServer(port)); + return port; + } + + private static async Task StartServer(int port) + { + try + { + var builder = WebApplication.CreateBuilder(); + builder.WebHost.UseUrls($"http://127.0.0.1:{port}"); + builder.Services.ConfigureHttpJsonOptions(options => + { + options.SerializerOptions.TypeInfoResolverChain.Insert(0, new ApiJsonSerializerContext()); + }); + builder.Logging.AddConsole(); + builder.WithRoutes(); + + var app = builder.Build(); + app.UseRoutes(); + + await app.RunAsync(); + } + catch (Exception ex) + { + Console.Error.WriteLine(ex); + } + } + + private static int FindAvailablePort(int startPort) + { + var port = startPort; + while (!IsPortAvailable(port)) + { + port++; + if (port > 65535 || port < 0) + { + return -1; + } + } + + return port; + } + + private static bool IsPortAvailable(int port) + { + var ipProperties = IPGlobalProperties.GetIPGlobalProperties(); + var tcpListeners = ipProperties.GetActiveTcpListeners(); + if (tcpListeners.Any(endpoint => endpoint.Port == port)) + { + return false; + } + + var tcpConnections = ipProperties.GetActiveTcpConnections(); + if (tcpConnections.Any(conn => conn.LocalEndPoint.Port == port)) + { + return false; + } + + return true; + } +} diff --git a/Daybreak.API/Extensions/ConsoleExtensions.cs b/Daybreak.API/Extensions/ConsoleExtensions.cs new file mode 100644 index 00000000..13b07442 --- /dev/null +++ b/Daybreak.API/Extensions/ConsoleExtensions.cs @@ -0,0 +1,19 @@ +namespace Daybreak.API.Extensions; + +public static class ConsoleExtensions +{ + public static void AllocateAnsiConsole() + { + NativeMethods.AllocConsole(); + var handle = NativeMethods.GetStdHandle(NativeMethods.STD_OUTPUT_HANDLE); + if (!NativeMethods.GetConsoleMode(handle, out var mode)) + { + Console.WriteLine("Failed to get console mode"); + } + + if (!NativeMethods.SetConsoleMode(handle, mode | NativeMethods.ENABLE_VIRTUAL_TERMINAL_PROCESSING | NativeMethods.ENABLE_PROCESSED_OUTPUT)) + { + Console.WriteLine("Failed to enable virtual terminal processing"); + } + } +} diff --git a/Daybreak.API/NativeMethods.cs b/Daybreak.API/NativeMethods.cs new file mode 100644 index 00000000..b0e43a35 --- /dev/null +++ b/Daybreak.API/NativeMethods.cs @@ -0,0 +1,28 @@ +using System.Runtime.InteropServices; + +namespace Daybreak.API; + +internal static partial class NativeMethods +{ + public const int STD_OUTPUT_HANDLE = -11; + public const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004; + public const uint ENABLE_PROCESSED_OUTPUT = 0x0001; + + [LibraryImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool AllocConsole(); + + [LibraryImport("kernel32.dll", SetLastError = true)] + public static partial nint GetConsoleWindow(); + + [LibraryImport("kernel32.dll", SetLastError = true)] + public static partial nint GetStdHandle(int nStdHandle); + + [LibraryImport("kernel32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool GetConsoleMode(nint hConsoleHandle, out uint lpMode); + + [LibraryImport("kernel32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool SetConsoleMode(nint hConsoleHandle, uint dwMode); +} diff --git a/Daybreak.API/Properties/launchSettings.json b/Daybreak.API/Properties/launchSettings.json new file mode 100644 index 00000000..49a0fa9f --- /dev/null +++ b/Daybreak.API/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "Daybreak.API": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:51249;http://localhost:51250" + } + } +} \ No newline at end of file diff --git a/Daybreak.API/Serialization/ApiJsonSerializerContext.cs b/Daybreak.API/Serialization/ApiJsonSerializerContext.cs new file mode 100644 index 00000000..42809679 --- /dev/null +++ b/Daybreak.API/Serialization/ApiJsonSerializerContext.cs @@ -0,0 +1,8 @@ +using System.Text.Json.Serialization; + +namespace Daybreak.API.Serialization; + +[JsonSerializable(typeof(string))] +public partial class ApiJsonSerializerContext : JsonSerializerContext +{ +} diff --git a/Daybreak/Configuration/Options/ITradeChatOptions.cs b/Daybreak.Shared/Configuration/Options/ITradeChatOptions.cs similarity index 67% rename from Daybreak/Configuration/Options/ITradeChatOptions.cs rename to Daybreak.Shared/Configuration/Options/ITradeChatOptions.cs index 56003838..95c1a1b2 100644 --- a/Daybreak/Configuration/Options/ITradeChatOptions.cs +++ b/Daybreak.Shared/Configuration/Options/ITradeChatOptions.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Configuration.Options; +namespace Daybreak.Shared.Configuration.Options; public interface ITradeChatOptions { diff --git a/Daybreak/Converters/AttributeJsonConverter.cs b/Daybreak.Shared/Converters/AttributeJsonConverter.cs similarity index 97% rename from Daybreak/Converters/AttributeJsonConverter.cs rename to Daybreak.Shared/Converters/AttributeJsonConverter.cs index 21111c09..9c359360 100644 --- a/Daybreak/Converters/AttributeJsonConverter.cs +++ b/Daybreak.Shared/Converters/AttributeJsonConverter.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class AttributeJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/BooleanToEffectConverter.cs b/Daybreak.Shared/Converters/BooleanToEffectConverter.cs similarity index 94% rename from Daybreak/Converters/BooleanToEffectConverter.cs rename to Daybreak.Shared/Converters/BooleanToEffectConverter.cs index 5a519b36..62b75192 100644 --- a/Daybreak/Converters/BooleanToEffectConverter.cs +++ b/Daybreak.Shared/Converters/BooleanToEffectConverter.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Windows.Data; using System.Windows.Media.Effects; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class BooleanToEffectConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Daybreak/Converters/BooleanToGridLengthConverter.cs b/Daybreak.Shared/Converters/BooleanToGridLengthConverter.cs similarity index 96% rename from Daybreak/Converters/BooleanToGridLengthConverter.cs rename to Daybreak.Shared/Converters/BooleanToGridLengthConverter.cs index cc55d28c..004aa2ca 100644 --- a/Daybreak/Converters/BooleanToGridLengthConverter.cs +++ b/Daybreak.Shared/Converters/BooleanToGridLengthConverter.cs @@ -4,7 +4,7 @@ using System.Globalization; using System.Windows; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class BooleanToGridLengthConverter : IValueConverter { diff --git a/Daybreak/Converters/BooleanToVisibilityConverter.cs b/Daybreak.Shared/Converters/BooleanToVisibilityConverter.cs similarity index 83% rename from Daybreak/Converters/BooleanToVisibilityConverter.cs rename to Daybreak.Shared/Converters/BooleanToVisibilityConverter.cs index 66536aa4..8a3e4458 100644 --- a/Daybreak/Converters/BooleanToVisibilityConverter.cs +++ b/Daybreak.Shared/Converters/BooleanToVisibilityConverter.cs @@ -4,7 +4,7 @@ using System.Globalization; using System.Windows; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public class BooleanToVisibilityConverter : IValueConverter { @@ -38,12 +38,12 @@ public class BooleanToVisibilityConverter : IValueConverter } var objValue = value.Cast(); - if ((objValue && this.TriggerValue && this.IsHidden) || (!objValue && !this.TriggerValue && this.IsHidden)) + if (objValue && this.TriggerValue && this.IsHidden || !objValue && !this.TriggerValue && this.IsHidden) { return Visibility.Hidden; } - if ((objValue && this.TriggerValue && !this.IsHidden) || (!objValue && !this.TriggerValue && !this.IsHidden)) + if (objValue && this.TriggerValue && !this.IsHidden || !objValue && !this.TriggerValue && !this.IsHidden) { return Visibility.Collapsed; } diff --git a/Daybreak/Converters/CampaignJsonConverter.cs b/Daybreak.Shared/Converters/CampaignJsonConverter.cs similarity index 94% rename from Daybreak/Converters/CampaignJsonConverter.cs rename to Daybreak.Shared/Converters/CampaignJsonConverter.cs index c14da15d..b776912a 100644 --- a/Daybreak/Converters/CampaignJsonConverter.cs +++ b/Daybreak.Shared/Converters/CampaignJsonConverter.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class CampaignJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/ContinentJsonConverter.cs b/Daybreak.Shared/Converters/ContinentJsonConverter.cs similarity index 94% rename from Daybreak/Converters/ContinentJsonConverter.cs rename to Daybreak.Shared/Converters/ContinentJsonConverter.cs index 46773445..5c9d78e3 100644 --- a/Daybreak/Converters/ContinentJsonConverter.cs +++ b/Daybreak.Shared/Converters/ContinentJsonConverter.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class ContinentJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/DateTimeConverter.cs b/Daybreak.Shared/Converters/DateTimeConverter.cs similarity index 96% rename from Daybreak/Converters/DateTimeConverter.cs rename to Daybreak.Shared/Converters/DateTimeConverter.cs index 3a55f5b0..03337f41 100644 --- a/Daybreak/Converters/DateTimeConverter.cs +++ b/Daybreak.Shared/Converters/DateTimeConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class DateTimeConverter : IValueConverter { public string? Format { get; set; } diff --git a/Daybreak/Converters/DoubleMultiplierConverter.cs b/Daybreak.Shared/Converters/DoubleMultiplierConverter.cs similarity index 93% rename from Daybreak/Converters/DoubleMultiplierConverter.cs rename to Daybreak.Shared/Converters/DoubleMultiplierConverter.cs index 13fd8df8..0cc365ec 100644 --- a/Daybreak/Converters/DoubleMultiplierConverter.cs +++ b/Daybreak.Shared/Converters/DoubleMultiplierConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class DoubleMultiplierConverter : IValueConverter { public double Multiplier { get; set; } diff --git a/Daybreak/Converters/EqualityToVisibilityConverter.cs b/Daybreak.Shared/Converters/EqualityToVisibilityConverter.cs similarity index 94% rename from Daybreak/Converters/EqualityToVisibilityConverter.cs rename to Daybreak.Shared/Converters/EqualityToVisibilityConverter.cs index 1f8377dc..35f98695 100644 --- a/Daybreak/Converters/EqualityToVisibilityConverter.cs +++ b/Daybreak.Shared/Converters/EqualityToVisibilityConverter.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Windows; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class EqualityToVisibilityConverter : IMultiValueConverter { diff --git a/Daybreak/Converters/EventCalendarDayToBrushConverter.cs b/Daybreak.Shared/Converters/EventCalendarDayToBrushConverter.cs similarity index 89% rename from Daybreak/Converters/EventCalendarDayToBrushConverter.cs rename to Daybreak.Shared/Converters/EventCalendarDayToBrushConverter.cs index 54319c76..0b3abe99 100644 --- a/Daybreak/Converters/EventCalendarDayToBrushConverter.cs +++ b/Daybreak.Shared/Converters/EventCalendarDayToBrushConverter.cs @@ -1,5 +1,6 @@ -using Daybreak.Models.Guildwars; -using Daybreak.Services.Events; +using Daybreak.Shared; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.Events; using ExCSS; using Microsoft.Extensions.DependencyInjection; using System; @@ -11,11 +12,11 @@ using System.Windows.Data; using System.Windows.Media; using System.Windows.Shapes; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class EventCalendarDayToBrushConverter : IValueConverter { private readonly EventToBrushConverter eventToBrushConverter = new(); - private readonly IEventService eventService = Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService(); + private readonly IEventService eventService = Global.GlobalServiceProvider.GetRequiredService(); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/Daybreak/Converters/EventToBrushConverter.cs b/Daybreak.Shared/Converters/EventToBrushConverter.cs similarity index 89% rename from Daybreak/Converters/EventToBrushConverter.cs rename to Daybreak.Shared/Converters/EventToBrushConverter.cs index 24ca1a20..74dc9dba 100644 --- a/Daybreak/Converters/EventToBrushConverter.cs +++ b/Daybreak.Shared/Converters/EventToBrushConverter.cs @@ -1,13 +1,14 @@ -using Daybreak.Models; -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Guildwars; using System; using System.Collections.Generic; using System.Globalization; using System.Windows.Data; using System.Windows.Media; +using Brush = System.Windows.Media.Brush; -namespace Daybreak.Converters; -internal sealed class EventToBrushConverter : IValueConverter +namespace Daybreak.Shared.Converters; +public sealed class EventToBrushConverter : IValueConverter { private static readonly Dictionary EventMapping = new() { diff --git a/Daybreak/Converters/HiddenWhenNull.cs b/Daybreak.Shared/Converters/HiddenWhenNull.cs similarity index 94% rename from Daybreak/Converters/HiddenWhenNull.cs rename to Daybreak.Shared/Converters/HiddenWhenNull.cs index cf66ff6f..14fdc760 100644 --- a/Daybreak/Converters/HiddenWhenNull.cs +++ b/Daybreak.Shared/Converters/HiddenWhenNull.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Windows; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public class HiddenWhenNull : IValueConverter { diff --git a/Daybreak/Converters/IntToStringConverter.cs b/Daybreak.Shared/Converters/IntToStringConverter.cs similarity index 96% rename from Daybreak/Converters/IntToStringConverter.cs rename to Daybreak.Shared/Converters/IntToStringConverter.cs index b9db69ef..a54cbc9f 100644 --- a/Daybreak/Converters/IntToStringConverter.cs +++ b/Daybreak.Shared/Converters/IntToStringConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class IntToStringConverter : IValueConverter { diff --git a/Daybreak/Converters/InverseBooleanConverter.cs b/Daybreak.Shared/Converters/InverseBooleanConverter.cs similarity index 94% rename from Daybreak/Converters/InverseBooleanConverter.cs rename to Daybreak.Shared/Converters/InverseBooleanConverter.cs index fa27939b..a437ced5 100644 --- a/Daybreak/Converters/InverseBooleanConverter.cs +++ b/Daybreak.Shared/Converters/InverseBooleanConverter.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public class InverseBooleanConverter : IValueConverter { diff --git a/Daybreak/Converters/ItemBaseJsonConverter.cs b/Daybreak.Shared/Converters/ItemBaseJsonConverter.cs similarity index 94% rename from Daybreak/Converters/ItemBaseJsonConverter.cs rename to Daybreak.Shared/Converters/ItemBaseJsonConverter.cs index 42cc68ee..62a533fe 100644 --- a/Daybreak/Converters/ItemBaseJsonConverter.cs +++ b/Daybreak.Shared/Converters/ItemBaseJsonConverter.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class ItemBaseJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/ItemBaseToIntConverter.cs b/Daybreak.Shared/Converters/ItemBaseToIntConverter.cs similarity index 92% rename from Daybreak/Converters/ItemBaseToIntConverter.cs rename to Daybreak.Shared/Converters/ItemBaseToIntConverter.cs index 8f31ee65..f73d9103 100644 --- a/Daybreak/Converters/ItemBaseToIntConverter.cs +++ b/Daybreak.Shared/Converters/ItemBaseToIntConverter.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class ItemBaseToIntConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Daybreak/Converters/ItemBaseToStringConverter.cs b/Daybreak.Shared/Converters/ItemBaseToStringConverter.cs similarity index 92% rename from Daybreak/Converters/ItemBaseToStringConverter.cs rename to Daybreak.Shared/Converters/ItemBaseToStringConverter.cs index 4ab6e285..593b1064 100644 --- a/Daybreak/Converters/ItemBaseToStringConverter.cs +++ b/Daybreak.Shared/Converters/ItemBaseToStringConverter.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class ItemBaseToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Daybreak/Converters/MapJsonConverter.cs b/Daybreak.Shared/Converters/MapJsonConverter.cs similarity index 94% rename from Daybreak/Converters/MapJsonConverter.cs rename to Daybreak.Shared/Converters/MapJsonConverter.cs index c524b328..f90bd3dd 100644 --- a/Daybreak/Converters/MapJsonConverter.cs +++ b/Daybreak.Shared/Converters/MapJsonConverter.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class MapJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/MenuButtonHighlightConverter.cs b/Daybreak.Shared/Converters/MenuButtonHighlightConverter.cs similarity index 95% rename from Daybreak/Converters/MenuButtonHighlightConverter.cs rename to Daybreak.Shared/Converters/MenuButtonHighlightConverter.cs index 3c6f0e7a..e090ffc5 100644 --- a/Daybreak/Converters/MenuButtonHighlightConverter.cs +++ b/Daybreak.Shared/Converters/MenuButtonHighlightConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public class MenuButtonHighlightConverter : IValueConverter { diff --git a/Daybreak/Converters/NpcJsonConverter.cs b/Daybreak.Shared/Converters/NpcJsonConverter.cs similarity index 94% rename from Daybreak/Converters/NpcJsonConverter.cs rename to Daybreak.Shared/Converters/NpcJsonConverter.cs index 48bdbdb5..651ea351 100644 --- a/Daybreak/Converters/NpcJsonConverter.cs +++ b/Daybreak.Shared/Converters/NpcJsonConverter.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; using System.Linq; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class NpcJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/PriceToStringConverter.cs b/Daybreak.Shared/Converters/PriceToStringConverter.cs similarity index 69% rename from Daybreak/Converters/PriceToStringConverter.cs rename to Daybreak.Shared/Converters/PriceToStringConverter.cs index 8d8870f1..1b33dd6f 100644 --- a/Daybreak/Converters/PriceToStringConverter.cs +++ b/Daybreak.Shared/Converters/PriceToStringConverter.cs @@ -2,8 +2,8 @@ using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; -internal sealed class PriceToStringConverter : IValueConverter +namespace Daybreak.Shared.Converters; +public sealed class PriceToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { @@ -14,13 +14,13 @@ internal sealed class PriceToStringConverter : IValueConverter var price = value switch { - byte byteVal => (double)byteVal, - short shortVal => (double)shortVal, - ushort ushortVal => (double)ushortVal, - int intVal => (double)intVal, - uint uintVal => (double)uintVal, - long longVal => (double)longVal, - ulong ulongVal => (double)ulongVal, + byte byteVal => byteVal, + short shortVal => shortVal, + ushort ushortVal => ushortVal, + int intVal => intVal, + uint uintVal => uintVal, + long longVal => longVal, + ulong ulongVal => ulongVal, decimal decimalVal => (double)decimalVal, float floatVal => (double)floatVal, double doubleVal => (double)doubleVal, diff --git a/Daybreak/Converters/ProfessionJsonConverter.cs b/Daybreak.Shared/Converters/ProfessionJsonConverter.cs similarity index 94% rename from Daybreak/Converters/ProfessionJsonConverter.cs rename to Daybreak.Shared/Converters/ProfessionJsonConverter.cs index 568745cf..6f6a5418 100644 --- a/Daybreak/Converters/ProfessionJsonConverter.cs +++ b/Daybreak.Shared/Converters/ProfessionJsonConverter.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class ProfessionJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/QuestJsonConverter.cs b/Daybreak.Shared/Converters/QuestJsonConverter.cs similarity index 94% rename from Daybreak/Converters/QuestJsonConverter.cs rename to Daybreak.Shared/Converters/QuestJsonConverter.cs index 2399ac55..e046ef77 100644 --- a/Daybreak/Converters/QuestJsonConverter.cs +++ b/Daybreak.Shared/Converters/QuestJsonConverter.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class QuestJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/RegionJsonConverter.cs b/Daybreak.Shared/Converters/RegionJsonConverter.cs similarity index 94% rename from Daybreak/Converters/RegionJsonConverter.cs rename to Daybreak.Shared/Converters/RegionJsonConverter.cs index 385825bf..a5d171fd 100644 --- a/Daybreak/Converters/RegionJsonConverter.cs +++ b/Daybreak.Shared/Converters/RegionJsonConverter.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class RegionJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/SkillJsonConverter.cs b/Daybreak.Shared/Converters/SkillJsonConverter.cs similarity index 94% rename from Daybreak/Converters/SkillJsonConverter.cs rename to Daybreak.Shared/Converters/SkillJsonConverter.cs index 3e96e364..c6c79049 100644 --- a/Daybreak/Converters/SkillJsonConverter.cs +++ b/Daybreak.Shared/Converters/SkillJsonConverter.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class SkillJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/TileButtonHighlightConverter.cs b/Daybreak.Shared/Converters/TileButtonHighlightConverter.cs similarity index 95% rename from Daybreak/Converters/TileButtonHighlightConverter.cs rename to Daybreak.Shared/Converters/TileButtonHighlightConverter.cs index 8b54f508..98fa3fb7 100644 --- a/Daybreak/Converters/TileButtonHighlightConverter.cs +++ b/Daybreak.Shared/Converters/TileButtonHighlightConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public class TileButtonHighlightConverter : IValueConverter { diff --git a/Daybreak/Converters/TimeSinceDateTimeConverter.cs b/Daybreak.Shared/Converters/TimeSinceDateTimeConverter.cs similarity index 98% rename from Daybreak/Converters/TimeSinceDateTimeConverter.cs rename to Daybreak.Shared/Converters/TimeSinceDateTimeConverter.cs index bc124258..a887b134 100644 --- a/Daybreak/Converters/TimeSinceDateTimeConverter.cs +++ b/Daybreak.Shared/Converters/TimeSinceDateTimeConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class TimeSinceDateTimeConverter : IValueConverter { diff --git a/Daybreak/Converters/TimespanToETAConverter.cs b/Daybreak.Shared/Converters/TimespanToETAConverter.cs similarity index 85% rename from Daybreak/Converters/TimespanToETAConverter.cs rename to Daybreak.Shared/Converters/TimespanToETAConverter.cs index 4a29d258..f6df93bb 100644 --- a/Daybreak/Converters/TimespanToETAConverter.cs +++ b/Daybreak.Shared/Converters/TimespanToETAConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class TimespanToETAConverter : IValueConverter { @@ -30,6 +30,6 @@ public sealed class TimespanToETAConverter : IValueConverter return $"{(int)timeSpan.TotalDays} day{((int)timeSpan.TotalDays > 1 ? PluralAppend : string.Empty)} remaining"; } - return $"{(int)timeSpan.Hours:D2}:{(int)timeSpan.Minutes:D2}:{(int)timeSpan.Seconds:D2} remaining"; + return $"{timeSpan.Hours:D2}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2} remaining"; } } diff --git a/Daybreak/Converters/TitleJsonConverter.cs b/Daybreak.Shared/Converters/TitleJsonConverter.cs similarity index 94% rename from Daybreak/Converters/TitleJsonConverter.cs rename to Daybreak.Shared/Converters/TitleJsonConverter.cs index 28e56ea1..67c9ee7f 100644 --- a/Daybreak/Converters/TitleJsonConverter.cs +++ b/Daybreak.Shared/Converters/TitleJsonConverter.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Newtonsoft.Json; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class TitleJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; diff --git a/Daybreak/Converters/TradeAlertConverter.cs b/Daybreak.Shared/Converters/TradeAlertConverter.cs similarity index 97% rename from Daybreak/Converters/TradeAlertConverter.cs rename to Daybreak.Shared/Converters/TradeAlertConverter.cs index c8bbdce3..c7b4fdc1 100644 --- a/Daybreak/Converters/TradeAlertConverter.cs +++ b/Daybreak.Shared/Converters/TradeAlertConverter.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Trade; +using Daybreak.Shared.Models.Trade; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class TradeAlertConverter : JsonConverter { public override ITradeAlert? ReadJson(JsonReader reader, Type objectType, ITradeAlert? existingValue, bool hasExistingValue, JsonSerializer serializer) diff --git a/Daybreak/Converters/TraderQuoteTypeToStringConverter.cs b/Daybreak.Shared/Converters/TraderQuoteTypeToStringConverter.cs similarity index 92% rename from Daybreak/Converters/TraderQuoteTypeToStringConverter.cs rename to Daybreak.Shared/Converters/TraderQuoteTypeToStringConverter.cs index 9c4fff89..77da712e 100644 --- a/Daybreak/Converters/TraderQuoteTypeToStringConverter.cs +++ b/Daybreak.Shared/Converters/TraderQuoteTypeToStringConverter.cs @@ -1,9 +1,9 @@ -using Daybreak.Services.TradeChat.Models; +using Daybreak.Shared.Models.Trade; using System; using System.Globalization; using System.Windows.Data; -namespace Daybreak.Converters; +namespace Daybreak.Shared.Converters; public sealed class TraderQuoteTypeToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Daybreak.Shared/Daybreak.Shared.csproj b/Daybreak.Shared/Daybreak.Shared.csproj new file mode 100644 index 00000000..e0d60388 --- /dev/null +++ b/Daybreak.Shared/Daybreak.Shared.csproj @@ -0,0 +1,60 @@ + + + + net9.0-windows + enable + true + preview + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Daybreak/Exceptions/CredentialsNotFoundException.cs b/Daybreak.Shared/Exceptions/CredentialsNotFoundException.cs similarity index 90% rename from Daybreak/Exceptions/CredentialsNotFoundException.cs rename to Daybreak.Shared/Exceptions/CredentialsNotFoundException.cs index f3e084c7..c3f186f7 100644 --- a/Daybreak/Exceptions/CredentialsNotFoundException.cs +++ b/Daybreak.Shared/Exceptions/CredentialsNotFoundException.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Exceptions; +namespace Daybreak.Shared.Exceptions; public sealed class CredentialsNotFoundException : Exception { diff --git a/Daybreak/Exceptions/ExecutableNotFoundException.cs b/Daybreak.Shared/Exceptions/ExecutableNotFoundException.cs similarity index 90% rename from Daybreak/Exceptions/ExecutableNotFoundException.cs rename to Daybreak.Shared/Exceptions/ExecutableNotFoundException.cs index b29acd46..b71758e3 100644 --- a/Daybreak/Exceptions/ExecutableNotFoundException.cs +++ b/Daybreak.Shared/Exceptions/ExecutableNotFoundException.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Exceptions; +namespace Daybreak.Shared.Exceptions; public sealed class ExecutableNotFoundException : Exception { diff --git a/Daybreak/Exceptions/FatalException.cs b/Daybreak.Shared/Exceptions/FatalException.cs similarity index 88% rename from Daybreak/Exceptions/FatalException.cs rename to Daybreak.Shared/Exceptions/FatalException.cs index 5ae2bc1a..959be632 100644 --- a/Daybreak/Exceptions/FatalException.cs +++ b/Daybreak.Shared/Exceptions/FatalException.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Exceptions; +namespace Daybreak.Shared.Exceptions; public sealed class FatalException : Exception { diff --git a/Daybreak.Shared/Global.cs b/Daybreak.Shared/Global.cs new file mode 100644 index 00000000..9785dd20 --- /dev/null +++ b/Daybreak.Shared/Global.cs @@ -0,0 +1,12 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Daybreak")] + +namespace Daybreak.Shared; + +public static class Global +{ + //Will get set by Daybreak on application startup + public static IServiceProvider GlobalServiceProvider { get; internal set; } = default!; +} diff --git a/Daybreak/Models/ApplicationLauncherContext.cs b/Daybreak.Shared/Models/ApplicationLauncherContext.cs similarity index 86% rename from Daybreak/Models/ApplicationLauncherContext.cs rename to Daybreak.Shared/Models/ApplicationLauncherContext.cs index 2515189e..6d12c9ef 100644 --- a/Daybreak/Models/ApplicationLauncherContext.cs +++ b/Daybreak.Shared/Models/ApplicationLauncherContext.cs @@ -1,6 +1,6 @@ using System.Diagnostics; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public readonly struct ApplicationLauncherContext { public string ExecutablePath { get; init; } diff --git a/Daybreak/Services/Screenshots/Models/BackgroundResponse.cs b/Daybreak.Shared/Models/BackgroundResponse.cs similarity index 77% rename from Daybreak/Services/Screenshots/Models/BackgroundResponse.cs rename to Daybreak.Shared/Models/BackgroundResponse.cs index 84da5cd0..351cf17c 100644 --- a/Daybreak/Services/Screenshots/Models/BackgroundResponse.cs +++ b/Daybreak.Shared/Models/BackgroundResponse.cs @@ -1,6 +1,6 @@ using System.Windows.Media; -namespace Daybreak.Services.Screenshots.Models; +namespace Daybreak.Shared.Models; public sealed class BackgroundResponse { public ImageSource? ImageSource { get; set; } diff --git a/Daybreak/Models/BatchedObservableCollection.cs b/Daybreak.Shared/Models/BatchedObservableCollection.cs similarity index 96% rename from Daybreak/Models/BatchedObservableCollection.cs rename to Daybreak.Shared/Models/BatchedObservableCollection.cs index b6e4d03a..d4007261 100644 --- a/Daybreak/Models/BatchedObservableCollection.cs +++ b/Daybreak.Shared/Models/BatchedObservableCollection.cs @@ -2,7 +2,7 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public class BatchedObservableCollection : ObservableCollection { diff --git a/Daybreak/Models/Browser/BrowserHistory.cs b/Daybreak.Shared/Models/Browser/BrowserHistory.cs similarity index 81% rename from Daybreak/Models/Browser/BrowserHistory.cs rename to Daybreak.Shared/Models/Browser/BrowserHistory.cs index 21bc8e3e..4a9b2eb9 100644 --- a/Daybreak/Models/Browser/BrowserHistory.cs +++ b/Daybreak.Shared/Models/Browser/BrowserHistory.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.Browser; +namespace Daybreak.Shared.Models.Browser; public sealed class BrowserHistory { public List History { get; set; } = []; diff --git a/Daybreak/Models/Browser/BrowserPayload.cs b/Daybreak.Shared/Models/Browser/BrowserPayload.cs similarity index 91% rename from Daybreak/Models/Browser/BrowserPayload.cs rename to Daybreak.Shared/Models/Browser/BrowserPayload.cs index 2058318d..1a515cf0 100644 --- a/Daybreak/Models/Browser/BrowserPayload.cs +++ b/Daybreak.Shared/Models/Browser/BrowserPayload.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace Daybreak.Models.Browser; +namespace Daybreak.Shared.Models.Browser; public class BrowserPayload { diff --git a/Daybreak/Models/Browser/DownloadPayload.cs b/Daybreak.Shared/Models/Browser/DownloadPayload.cs similarity index 75% rename from Daybreak/Models/Browser/DownloadPayload.cs rename to Daybreak.Shared/Models/Browser/DownloadPayload.cs index 676a081e..4739d059 100644 --- a/Daybreak/Models/Browser/DownloadPayload.cs +++ b/Daybreak.Shared/Models/Browser/DownloadPayload.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Browser; +namespace Daybreak.Shared.Models.Browser; public sealed class DownloadPayload { diff --git a/Daybreak/Models/Browser/OnContextMenuPayload.cs b/Daybreak.Shared/Models/Browser/OnContextMenuPayload.cs similarity index 89% rename from Daybreak/Models/Browser/OnContextMenuPayload.cs rename to Daybreak.Shared/Models/Browser/OnContextMenuPayload.cs index d1635ffa..23c4379d 100644 --- a/Daybreak/Models/Browser/OnContextMenuPayload.cs +++ b/Daybreak.Shared/Models/Browser/OnContextMenuPayload.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace Daybreak.Models.Browser; +namespace Daybreak.Shared.Models.Browser; public sealed class OnContextMenuPayload { diff --git a/Daybreak/Models/BuildWithTemplateCode.cs b/Daybreak.Shared/Models/BuildWithTemplateCode.cs similarity index 65% rename from Daybreak/Models/BuildWithTemplateCode.cs rename to Daybreak.Shared/Models/BuildWithTemplateCode.cs index 8d1f3f83..db450243 100644 --- a/Daybreak/Models/BuildWithTemplateCode.cs +++ b/Daybreak.Shared/Models/BuildWithTemplateCode.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Builds; +using Daybreak.Shared.Models.Builds; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class BuildWithTemplateCode { diff --git a/Daybreak/Models/Builds/AttributeEntry.cs b/Daybreak.Shared/Models/Builds/AttributeEntry.cs similarity index 88% rename from Daybreak/Models/Builds/AttributeEntry.cs rename to Daybreak.Shared/Models/Builds/AttributeEntry.cs index 7854ee9f..c2b5ffb6 100644 --- a/Daybreak/Models/Builds/AttributeEntry.cs +++ b/Daybreak.Shared/Models/Builds/AttributeEntry.cs @@ -1,7 +1,7 @@ using System.ComponentModel; -using Daybreak.Models.Guildwars; +using Attribute = Daybreak.Shared.Models.Guildwars.Attribute; -namespace Daybreak.Models.Builds; +namespace Daybreak.Shared.Models.Builds; public sealed class AttributeEntry : INotifyPropertyChanged { diff --git a/Daybreak/Models/Builds/IBuildEntry.cs b/Daybreak.Shared/Models/Builds/IBuildEntry.cs similarity index 88% rename from Daybreak/Models/Builds/IBuildEntry.cs rename to Daybreak.Shared/Models/Builds/IBuildEntry.cs index 03d838a0..325cf946 100644 --- a/Daybreak/Models/Builds/IBuildEntry.cs +++ b/Daybreak.Shared/Models/Builds/IBuildEntry.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Daybreak.Models.Builds; +namespace Daybreak.Shared.Models.Builds; public interface IBuildEntry { public DateTimeOffset CreationTime { get; set; } diff --git a/Daybreak/Models/Builds/SingleBuildEntry.cs b/Daybreak.Shared/Models/Builds/SingleBuildEntry.cs similarity index 98% rename from Daybreak/Models/Builds/SingleBuildEntry.cs rename to Daybreak.Shared/Models/Builds/SingleBuildEntry.cs index 272012ed..4a904f9b 100644 --- a/Daybreak/Models/Builds/SingleBuildEntry.cs +++ b/Daybreak.Shared/Models/Builds/SingleBuildEntry.cs @@ -1,11 +1,11 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using Attribute = Daybreak.Models.Guildwars.Attribute; +using Attribute = Daybreak.Shared.Models.Guildwars.Attribute; -namespace Daybreak.Models.Builds; +namespace Daybreak.Shared.Models.Builds; public sealed class SingleBuildEntry : BuildEntryBase, IBuildEntry, INotifyPropertyChanged, IEquatable { public Profession Primary diff --git a/Daybreak/Models/Builds/TeamBuildEntry.cs b/Daybreak.Shared/Models/Builds/TeamBuildEntry.cs similarity index 93% rename from Daybreak/Models/Builds/TeamBuildEntry.cs rename to Daybreak.Shared/Models/Builds/TeamBuildEntry.cs index ae6c9166..7b5fe520 100644 --- a/Daybreak/Models/Builds/TeamBuildEntry.cs +++ b/Daybreak.Shared/Models/Builds/TeamBuildEntry.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Builds; +namespace Daybreak.Shared.Models.Builds; public sealed class TeamBuildEntry : BuildEntryBase, IEquatable { public List Builds diff --git a/Daybreak/Models/ColorPalette.cs b/Daybreak.Shared/Models/ColorPalette.cs similarity index 98% rename from Daybreak/Models/ColorPalette.cs rename to Daybreak.Shared/Models/ColorPalette.cs index 4de2c63c..dd8b3601 100644 --- a/Daybreak/Models/ColorPalette.cs +++ b/Daybreak.Shared/Models/ColorPalette.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Windows.Media; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public static class ColorPalette { public readonly static Color Red = Color.FromArgb(255, 213, 0, 0); diff --git a/Daybreak/Models/ColorScheme.cs b/Daybreak.Shared/Models/ColorScheme.cs similarity index 88% rename from Daybreak/Models/ColorScheme.cs rename to Daybreak.Shared/Models/ColorScheme.cs index 027c81ba..0450d6aa 100644 --- a/Daybreak/Models/ColorScheme.cs +++ b/Daybreak.Shared/Models/ColorScheme.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public enum ColorScheme { diff --git a/Daybreak/Models/ColoredTextElement.cs b/Daybreak.Shared/Models/ColoredTextElement.cs similarity index 84% rename from Daybreak/Models/ColoredTextElement.cs rename to Daybreak.Shared/Models/ColoredTextElement.cs index 6ece5f1f..32753f82 100644 --- a/Daybreak/Models/ColoredTextElement.cs +++ b/Daybreak.Shared/Models/ColoredTextElement.cs @@ -1,6 +1,6 @@ using System.Windows.Media; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class ColoredTextElement { diff --git a/Daybreak/Models/DownloadedBuild.cs b/Daybreak.Shared/Models/DownloadedBuild.cs similarity index 64% rename from Daybreak/Models/DownloadedBuild.cs rename to Daybreak.Shared/Models/DownloadedBuild.cs index 31f1b6d7..0240c4a1 100644 --- a/Daybreak/Models/DownloadedBuild.cs +++ b/Daybreak.Shared/Models/DownloadedBuild.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Builds; +using Daybreak.Shared.Models.Builds; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class DownloadedBuild { public string? PreferredName { get; set; } diff --git a/Daybreak/Models/ElevationRequest.cs b/Daybreak.Shared/Models/ElevationRequest.cs similarity index 84% rename from Daybreak/Models/ElevationRequest.cs rename to Daybreak.Shared/Models/ElevationRequest.cs index db2f2d15..7ce903a4 100644 --- a/Daybreak/Models/ElevationRequest.cs +++ b/Daybreak.Shared/Models/ElevationRequest.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class ElevationRequest { diff --git a/Daybreak/Models/EventViewModel.cs b/Daybreak.Shared/Models/EventViewModel.cs similarity index 90% rename from Daybreak/Models/EventViewModel.cs rename to Daybreak.Shared/Models/EventViewModel.cs index b86c02c3..bc1c1121 100644 --- a/Daybreak/Models/EventViewModel.cs +++ b/Daybreak.Shared/Models/EventViewModel.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System.ComponentModel; using System.Windows.Extensions; diff --git a/Daybreak/Models/ExecutablePath.cs b/Daybreak.Shared/Models/ExecutablePath.cs similarity index 92% rename from Daybreak/Models/ExecutablePath.cs rename to Daybreak.Shared/Models/ExecutablePath.cs index 33277f16..aebc3339 100644 --- a/Daybreak/Models/ExecutablePath.cs +++ b/Daybreak.Shared/Models/ExecutablePath.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class ExecutablePath : INotifyPropertyChanged { diff --git a/Daybreak/Models/ExecutionPolicies.cs b/Daybreak.Shared/Models/ExecutionPolicies.cs similarity index 79% rename from Daybreak/Models/ExecutionPolicies.cs rename to Daybreak.Shared/Models/ExecutionPolicies.cs index e9ca26e6..ab203e38 100644 --- a/Daybreak/Models/ExecutionPolicies.cs +++ b/Daybreak.Shared/Models/ExecutionPolicies.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public enum ExecutionPolicies { diff --git a/Daybreak/Models/FocusView/PlayerContextMenuContext.cs b/Daybreak.Shared/Models/FocusView/PlayerContextMenuContext.cs similarity index 63% rename from Daybreak/Models/FocusView/PlayerContextMenuContext.cs rename to Daybreak.Shared/Models/FocusView/PlayerContextMenuContext.cs index 6c5d0bc7..eea06d74 100644 --- a/Daybreak/Models/FocusView/PlayerContextMenuContext.cs +++ b/Daybreak.Shared/Models/FocusView/PlayerContextMenuContext.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Guildwars; -using Daybreak.Models.LaunchConfigurations; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.LaunchConfigurations; -namespace Daybreak.Models.FocusView; +namespace Daybreak.Shared.Models.FocusView; /// /// XD Name /// diff --git a/Daybreak/Models/FocusView/QuestEntry.cs b/Daybreak.Shared/Models/FocusView/QuestEntry.cs similarity index 64% rename from Daybreak/Models/FocusView/QuestEntry.cs rename to Daybreak.Shared/Models/FocusView/QuestEntry.cs index 210a6c0c..aaa0d197 100644 --- a/Daybreak/Models/FocusView/QuestEntry.cs +++ b/Daybreak.Shared/Models/FocusView/QuestEntry.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; -namespace Daybreak.Models.FocusView; +namespace Daybreak.Shared.Models.FocusView; public sealed class QuestEntry : QuestLogEntry { diff --git a/Daybreak/Models/FocusView/QuestLocationEntry.cs b/Daybreak.Shared/Models/FocusView/QuestLocationEntry.cs similarity index 64% rename from Daybreak/Models/FocusView/QuestLocationEntry.cs rename to Daybreak.Shared/Models/FocusView/QuestLocationEntry.cs index 5e84b197..a3ae7fd2 100644 --- a/Daybreak/Models/FocusView/QuestLocationEntry.cs +++ b/Daybreak.Shared/Models/FocusView/QuestLocationEntry.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; -namespace Daybreak.Models.FocusView; +namespace Daybreak.Shared.Models.FocusView; public sealed class QuestLocationEntry : QuestLogEntry { public override string Title { get; init; } = string.Empty; diff --git a/Daybreak/Models/FocusView/QuestLogEntry.cs b/Daybreak.Shared/Models/FocusView/QuestLogEntry.cs similarity index 65% rename from Daybreak/Models/FocusView/QuestLogEntry.cs rename to Daybreak.Shared/Models/FocusView/QuestLogEntry.cs index 3e1a40f0..cc035e8d 100644 --- a/Daybreak/Models/FocusView/QuestLogEntry.cs +++ b/Daybreak.Shared/Models/FocusView/QuestLogEntry.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.FocusView; +namespace Daybreak.Shared.Models.FocusView; public abstract class QuestLogEntry { diff --git a/Daybreak/Models/FocusView/QuestLogSeparator.cs b/Daybreak.Shared/Models/FocusView/QuestLogSeparator.cs similarity index 72% rename from Daybreak/Models/FocusView/QuestLogSeparator.cs rename to Daybreak.Shared/Models/FocusView/QuestLogSeparator.cs index bc7ac9cd..06393888 100644 --- a/Daybreak/Models/FocusView/QuestLogSeparator.cs +++ b/Daybreak.Shared/Models/FocusView/QuestLogSeparator.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.FocusView; +namespace Daybreak.Shared.Models.FocusView; public sealed class QuestLogSeparator : QuestLogEntry { public override string Title { get; init; } = string.Empty; diff --git a/Daybreak/Models/Github/GithubRefTag.cs b/Daybreak.Shared/Models/Github/GithubRefTag.cs similarity index 84% rename from Daybreak/Models/Github/GithubRefTag.cs rename to Daybreak.Shared/Models/Github/GithubRefTag.cs index d7e633d5..d1bd3c32 100644 --- a/Daybreak/Models/Github/GithubRefTag.cs +++ b/Daybreak.Shared/Models/Github/GithubRefTag.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace Daybreak.Models.Github; +namespace Daybreak.Shared.Models.Github; public sealed class GithubRefTag { diff --git a/Daybreak/Services/Guildwars/Models/GuildWarsUpdateRequest.cs b/Daybreak.Shared/Models/GuildWarsUpdateRequest.cs similarity index 75% rename from Daybreak/Services/Guildwars/Models/GuildWarsUpdateRequest.cs rename to Daybreak.Shared/Models/GuildWarsUpdateRequest.cs index e9fa4976..3f723d57 100644 --- a/Daybreak/Services/Guildwars/Models/GuildWarsUpdateRequest.cs +++ b/Daybreak.Shared/Models/GuildWarsUpdateRequest.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Progress; +using Daybreak.Shared.Models.Progress; using System.Threading; -namespace Daybreak.Services.Guildwars.Models; +namespace Daybreak.Shared.Models; public sealed class GuildWarsUpdateRequest { public string? ExecutablePath { get; init; } diff --git a/Daybreak/Services/Guildwars/Models/GuildWarsUpdateResponse.cs b/Daybreak.Shared/Models/GuildWarsUpdateResponse.cs similarity index 73% rename from Daybreak/Services/Guildwars/Models/GuildWarsUpdateResponse.cs rename to Daybreak.Shared/Models/GuildWarsUpdateResponse.cs index 14907e9e..5e14e4d5 100644 --- a/Daybreak/Services/Guildwars/Models/GuildWarsUpdateResponse.cs +++ b/Daybreak.Shared/Models/GuildWarsUpdateResponse.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.Guildwars.Models; +namespace Daybreak.Shared.Models; public sealed class GuildWarsUpdateResponse { public bool Result { get; init; } diff --git a/Daybreak/Models/Guildwars/Attribute.cs b/Daybreak.Shared/Models/Guildwars/Attribute.cs similarity index 98% rename from Daybreak/Models/Guildwars/Attribute.cs rename to Daybreak.Shared/Models/Guildwars/Attribute.cs index 6c35423c..4653d89f 100644 --- a/Daybreak/Models/Guildwars/Attribute.cs +++ b/Daybreak.Shared/Models/Guildwars/Attribute.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(AttributeJsonConverter))] public sealed class Attribute diff --git a/Daybreak/Models/Guildwars/Build.cs b/Daybreak.Shared/Models/Guildwars/Build.cs similarity index 85% rename from Daybreak/Models/Guildwars/Build.cs rename to Daybreak.Shared/Models/Guildwars/Build.cs index 8ca8be49..822ce2fa 100644 --- a/Daybreak/Models/Guildwars/Build.cs +++ b/Daybreak.Shared/Models/Guildwars/Build.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using Daybreak.Models.Builds; +using Daybreak.Shared.Models.Builds; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class Build { diff --git a/Daybreak/Models/Guildwars/BuildEntryBase.cs b/Daybreak.Shared/Models/Guildwars/BuildEntryBase.cs similarity index 97% rename from Daybreak/Models/Guildwars/BuildEntryBase.cs rename to Daybreak.Shared/Models/Guildwars/BuildEntryBase.cs index 107435d8..c7d081ef 100644 --- a/Daybreak/Models/Guildwars/BuildEntryBase.cs +++ b/Daybreak.Shared/Models/Guildwars/BuildEntryBase.cs @@ -1,10 +1,10 @@ -using Daybreak.Models.Builds; +using Daybreak.Shared.Models.Builds; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public abstract class BuildEntryBase : INotifyPropertyChanged, IBuildEntry { diff --git a/Daybreak/Models/Guildwars/BuildMetadata.cs b/Daybreak.Shared/Models/Guildwars/BuildMetadata.cs similarity index 94% rename from Daybreak/Models/Guildwars/BuildMetadata.cs rename to Daybreak.Shared/Models/Guildwars/BuildMetadata.cs index f032ff1c..a661f2cb 100644 --- a/Daybreak/Models/Guildwars/BuildMetadata.cs +++ b/Daybreak.Shared/Models/Guildwars/BuildMetadata.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class BuildMetadata { diff --git a/Daybreak/Models/Guildwars/Campaign.cs b/Daybreak.Shared/Models/Guildwars/Campaign.cs similarity index 97% rename from Daybreak/Models/Guildwars/Campaign.cs rename to Daybreak.Shared/Models/Guildwars/Campaign.cs index 81c135d8..afdc2cba 100644 --- a/Daybreak/Models/Guildwars/Campaign.cs +++ b/Daybreak.Shared/Models/Guildwars/Campaign.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(CampaignJsonConverter))] public sealed class Campaign diff --git a/Daybreak/Models/Guildwars/Continent.cs b/Daybreak.Shared/Models/Guildwars/Continent.cs similarity index 97% rename from Daybreak/Models/Guildwars/Continent.cs rename to Daybreak.Shared/Models/Guildwars/Continent.cs index 5b21e8f0..e788e1e5 100644 --- a/Daybreak/Models/Guildwars/Continent.cs +++ b/Daybreak.Shared/Models/Guildwars/Continent.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(ContinentJsonConverter))] public sealed class Continent diff --git a/Daybreak/Models/Guildwars/Event.cs b/Daybreak.Shared/Models/Guildwars/Event.cs similarity index 99% rename from Daybreak/Models/Guildwars/Event.cs rename to Daybreak.Shared/Models/Guildwars/Event.cs index 65b60de3..4a426054 100644 --- a/Daybreak/Models/Guildwars/Event.cs +++ b/Daybreak.Shared/Models/Guildwars/Event.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; /// /// Seasonal holidays and in-game events, as retrieved from https://www.guildwars.com/en/events. diff --git a/Daybreak/Models/Guildwars/Hero.cs b/Daybreak.Shared/Models/Guildwars/Hero.cs similarity index 99% rename from Daybreak/Models/Guildwars/Hero.cs rename to Daybreak.Shared/Models/Guildwars/Hero.cs index ce16bc25..e219d2c3 100644 --- a/Daybreak/Models/Guildwars/Hero.cs +++ b/Daybreak.Shared/Models/Guildwars/Hero.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class Hero : IWikiEntity { public static readonly Hero None = new() { Id = 0, Profession = Profession.None }; diff --git a/Daybreak/Models/Guildwars/IIconUrlEntity.cs b/Daybreak.Shared/Models/Guildwars/IIconUrlEntity.cs similarity index 60% rename from Daybreak/Models/Guildwars/IIconUrlEntity.cs rename to Daybreak.Shared/Models/Guildwars/IIconUrlEntity.cs index 82223f7a..130d95d8 100644 --- a/Daybreak/Models/Guildwars/IIconUrlEntity.cs +++ b/Daybreak.Shared/Models/Guildwars/IIconUrlEntity.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public interface IIconUrlEntity { diff --git a/Daybreak/Models/Guildwars/IItemModHash.cs b/Daybreak.Shared/Models/Guildwars/IItemModHash.cs similarity index 60% rename from Daybreak/Models/Guildwars/IItemModHash.cs rename to Daybreak.Shared/Models/Guildwars/IItemModHash.cs index 8b110a0c..92d4a138 100644 --- a/Daybreak/Models/Guildwars/IItemModHash.cs +++ b/Daybreak.Shared/Models/Guildwars/IItemModHash.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public interface IItemModHash { diff --git a/Daybreak/Models/Guildwars/IWikiEntity.cs b/Daybreak.Shared/Models/Guildwars/IWikiEntity.cs similarity index 59% rename from Daybreak/Models/Guildwars/IWikiEntity.cs rename to Daybreak.Shared/Models/Guildwars/IWikiEntity.cs index 4c15b120..731fd254 100644 --- a/Daybreak/Models/Guildwars/IWikiEntity.cs +++ b/Daybreak.Shared/Models/Guildwars/IWikiEntity.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public interface IWikiEntity { diff --git a/Daybreak/Models/Guildwars/Inscription.cs b/Daybreak.Shared/Models/Guildwars/Inscription.cs similarity index 96% rename from Daybreak/Models/Guildwars/Inscription.cs rename to Daybreak.Shared/Models/Guildwars/Inscription.cs index 7a5f7baa..0172977d 100644 --- a/Daybreak/Models/Guildwars/Inscription.cs +++ b/Daybreak.Shared/Models/Guildwars/Inscription.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class Inscription : ItemBase, IWikiEntity, IIconUrlEntity { diff --git a/Daybreak/Models/Guildwars/InstanceType.cs b/Daybreak.Shared/Models/Guildwars/InstanceType.cs similarity index 64% rename from Daybreak/Models/Guildwars/InstanceType.cs rename to Daybreak.Shared/Models/Guildwars/InstanceType.cs index f919a7fc..21dd7218 100644 --- a/Daybreak/Models/Guildwars/InstanceType.cs +++ b/Daybreak.Shared/Models/Guildwars/InstanceType.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public enum InstanceType { diff --git a/Daybreak/Models/Guildwars/ItemBase.cs b/Daybreak.Shared/Models/Guildwars/ItemBase.cs similarity index 97% rename from Daybreak/Models/Guildwars/ItemBase.cs rename to Daybreak.Shared/Models/Guildwars/ItemBase.cs index eedc104d..e1c5f65e 100644 --- a/Daybreak/Models/Guildwars/ItemBase.cs +++ b/Daybreak.Shared/Models/Guildwars/ItemBase.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(ItemBaseJsonConverter))] public abstract class ItemBase @@ -14,6 +14,7 @@ public abstract class ItemBase .Concat(Material.All) .Concat(Inscription.Inscriptions) .Concat(Rune.Runes) + .Concat(VialOfDye.Vials) .ToList(); public static bool TryParse(int id, IEnumerable? modifiers, out T item) diff --git a/Daybreak/Models/Guildwars/ItemModifier.cs b/Daybreak.Shared/Models/Guildwars/ItemModifier.cs similarity index 90% rename from Daybreak/Models/Guildwars/ItemModifier.cs rename to Daybreak.Shared/Models/Guildwars/ItemModifier.cs index c69082b0..04307cd1 100644 --- a/Daybreak/Models/Guildwars/ItemModifier.cs +++ b/Daybreak.Shared/Models/Guildwars/ItemModifier.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public readonly struct ItemModifier { public uint Modifier { get; init; } diff --git a/Daybreak/Models/Guildwars/LoginData.cs b/Daybreak.Shared/Models/Guildwars/LoginData.cs similarity index 76% rename from Daybreak/Models/Guildwars/LoginData.cs rename to Daybreak.Shared/Models/Guildwars/LoginData.cs index b00518a9..baa2614a 100644 --- a/Daybreak/Models/Guildwars/LoginData.cs +++ b/Daybreak.Shared/Models/Guildwars/LoginData.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class LoginData { diff --git a/Daybreak/Models/Guildwars/MainPlayerData.cs b/Daybreak.Shared/Models/Guildwars/MainPlayerData.cs similarity index 69% rename from Daybreak/Models/Guildwars/MainPlayerData.cs rename to Daybreak.Shared/Models/Guildwars/MainPlayerData.cs index 886da181..192bb959 100644 --- a/Daybreak/Models/Guildwars/MainPlayerData.cs +++ b/Daybreak.Shared/Models/Guildwars/MainPlayerData.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class MainPlayerData { diff --git a/Daybreak/Models/Guildwars/MainPlayerInformation.cs b/Daybreak.Shared/Models/Guildwars/MainPlayerInformation.cs similarity index 96% rename from Daybreak/Models/Guildwars/MainPlayerInformation.cs rename to Daybreak.Shared/Models/Guildwars/MainPlayerInformation.cs index f889902b..1f586a8a 100644 --- a/Daybreak/Models/Guildwars/MainPlayerInformation.cs +++ b/Daybreak.Shared/Models/Guildwars/MainPlayerInformation.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class MainPlayerInformation { diff --git a/Daybreak/Models/Guildwars/Map.cs b/Daybreak.Shared/Models/Guildwars/Map.cs similarity index 99% rename from Daybreak/Models/Guildwars/Map.cs rename to Daybreak.Shared/Models/Guildwars/Map.cs index 9686a7b0..9a2b17f9 100644 --- a/Daybreak/Models/Guildwars/Map.cs +++ b/Daybreak.Shared/Models/Guildwars/Map.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(MapJsonConverter))] public sealed class Map : IWikiEntity diff --git a/Daybreak/Models/Guildwars/Material.cs b/Daybreak.Shared/Models/Guildwars/Material.cs similarity index 99% rename from Daybreak/Models/Guildwars/Material.cs rename to Daybreak.Shared/Models/Guildwars/Material.cs index 2f9a09a0..aa155e0d 100644 --- a/Daybreak/Models/Guildwars/Material.cs +++ b/Daybreak.Shared/Models/Guildwars/Material.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class Material : ItemBase, IWikiEntity { diff --git a/Daybreak/Models/Guildwars/Npc.cs b/Daybreak.Shared/Models/Guildwars/Npc.cs similarity index 99% rename from Daybreak/Models/Guildwars/Npc.cs rename to Daybreak.Shared/Models/Guildwars/Npc.cs index 3da62b65..f398e1d3 100644 --- a/Daybreak/Models/Guildwars/Npc.cs +++ b/Daybreak.Shared/Models/Guildwars/Npc.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; // TODO: Add missing npcs [JsonConverter(typeof(NpcJsonConverter))] diff --git a/Daybreak/Models/Guildwars/PartyCompositionMetadataEntry.cs b/Daybreak.Shared/Models/Guildwars/PartyCompositionMetadataEntry.cs similarity index 91% rename from Daybreak/Models/Guildwars/PartyCompositionMetadataEntry.cs rename to Daybreak.Shared/Models/Guildwars/PartyCompositionMetadataEntry.cs index 245591e6..69428591 100644 --- a/Daybreak/Models/Guildwars/PartyCompositionMetadataEntry.cs +++ b/Daybreak.Shared/Models/Guildwars/PartyCompositionMetadataEntry.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class PartyCompositionMetadataEntry { diff --git a/Daybreak/Models/Guildwars/PlayerInformation.cs b/Daybreak.Shared/Models/Guildwars/PlayerInformation.cs similarity index 95% rename from Daybreak/Models/Guildwars/PlayerInformation.cs rename to Daybreak.Shared/Models/Guildwars/PlayerInformation.cs index 1a8ef933..51188373 100644 --- a/Daybreak/Models/Guildwars/PlayerInformation.cs +++ b/Daybreak.Shared/Models/Guildwars/PlayerInformation.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class PlayerInformation { diff --git a/Daybreak/Models/Guildwars/Position.cs b/Daybreak.Shared/Models/Guildwars/Position.cs similarity index 94% rename from Daybreak/Models/Guildwars/Position.cs rename to Daybreak.Shared/Models/Guildwars/Position.cs index 7856a6f4..785a65df 100644 --- a/Daybreak/Models/Guildwars/Position.cs +++ b/Daybreak.Shared/Models/Guildwars/Position.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public readonly struct Position : IEquatable { diff --git a/Daybreak/Models/Guildwars/Profession.cs b/Daybreak.Shared/Models/Guildwars/Profession.cs similarity index 98% rename from Daybreak/Models/Guildwars/Profession.cs rename to Daybreak.Shared/Models/Guildwars/Profession.cs index 8e91c4e1..5da2f794 100644 --- a/Daybreak/Models/Guildwars/Profession.cs +++ b/Daybreak.Shared/Models/Guildwars/Profession.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(ProfessionJsonConverter))] public sealed class Profession : IWikiEntity diff --git a/Daybreak/Models/Guildwars/Quest.cs b/Daybreak.Shared/Models/Guildwars/Quest.cs similarity index 99% rename from Daybreak/Models/Guildwars/Quest.cs rename to Daybreak.Shared/Models/Guildwars/Quest.cs index 984fda0b..e6c27227 100644 --- a/Daybreak/Models/Guildwars/Quest.cs +++ b/Daybreak.Shared/Models/Guildwars/Quest.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(QuestJsonConverter))] public sealed class Quest : IWikiEntity diff --git a/Daybreak/Models/Guildwars/QuestMetadata.cs b/Daybreak.Shared/Models/Guildwars/QuestMetadata.cs similarity index 83% rename from Daybreak/Models/Guildwars/QuestMetadata.cs rename to Daybreak.Shared/Models/Guildwars/QuestMetadata.cs index 67a54e07..1e6154bd 100644 --- a/Daybreak/Models/Guildwars/QuestMetadata.cs +++ b/Daybreak.Shared/Models/Guildwars/QuestMetadata.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class QuestMetadata { diff --git a/Daybreak/Models/Guildwars/Region.cs b/Daybreak.Shared/Models/Guildwars/Region.cs similarity index 99% rename from Daybreak/Models/Guildwars/Region.cs rename to Daybreak.Shared/Models/Guildwars/Region.cs index 6246d086..c4f05d1f 100644 --- a/Daybreak/Models/Guildwars/Region.cs +++ b/Daybreak.Shared/Models/Guildwars/Region.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(RegionJsonConverter))] public sealed class Region : IWikiEntity diff --git a/Daybreak/Models/Guildwars/RegionType.cs b/Daybreak.Shared/Models/Guildwars/RegionType.cs similarity index 89% rename from Daybreak/Models/Guildwars/RegionType.cs rename to Daybreak.Shared/Models/Guildwars/RegionType.cs index 4b773c1e..8e99bcf0 100644 --- a/Daybreak/Models/Guildwars/RegionType.cs +++ b/Daybreak.Shared/Models/Guildwars/RegionType.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public enum RegionType { diff --git a/Daybreak/Models/Guildwars/Rune.cs b/Daybreak.Shared/Models/Guildwars/Rune.cs similarity index 99% rename from Daybreak/Models/Guildwars/Rune.cs rename to Daybreak.Shared/Models/Guildwars/Rune.cs index 8b4bd655..f80e04b3 100644 --- a/Daybreak/Models/Guildwars/Rune.cs +++ b/Daybreak.Shared/Models/Guildwars/Rune.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class Rune : ItemBase, IWikiEntity, IIconUrlEntity, IItemModHash { public static readonly Rune KnightsInsignia = new() { Id = 19152, Name = "Knight's Insignia", Modifiers = [0x25B80000, 0x240801F9, 0xA53003F2, 0xA7F80300, 0xC0000000], ModHash = "25B80000240801F9A53003F2A7F80300C0000000", WikiUrl = "https://wiki.guildwars.com/wiki/Knight's_Insignia", IconUrl = "https://wiki.guildwars.com/images/7/79/Knight%27s_Insignia.png" }; @@ -182,8 +182,8 @@ public sealed class Rune : ItemBase, IWikiEntity, IIconUrlEntity, IItemModHash public static readonly Rune RuneOfRestoration = new() { Id = 5550, Name = "Rune of Restoration", Modifiers = [0x25B80000, 0x24080214, 0x25300429, 0x27780300, 0xC0000000], ModHash = "25B80000240802142530042927780300C0000000", WikiUrl = "https://wiki.guildwars.com/wiki/Rune_of_Restoration", IconUrl = "https://wiki.guildwars.com/images/f/f6/Rune_All_Major.png" }; public static readonly Rune RuneOfClarity = new() { Id = 5550, Name = "Rune of Clarity", Modifiers = [0x25B80000, 0x24080215, 0x2530042B, 0x27780801, 0xC0000000], ModHash = "25B80000240802152530042B27780801C0000000", WikiUrl = "https://wiki.guildwars.com/wiki/Rune_of_Clarity", IconUrl = "https://wiki.guildwars.com/images/f/f6/Rune_All_Major.png" }; public static readonly Rune RuneOfPurity = new() { Id = 5550, Name = "Rune of Purity", Modifiers = [0x25B80000, 0x24080216, 0x2530042D, 0x27780605, 0xC0000000], ModHash = "25B80000240802162530042D27780605C0000000", WikiUrl = "https://wiki.guildwars.com/wiki/Rune_of_Purity", IconUrl = "https://wiki.guildwars.com/images/f/f6/Rune_All_Major.png" }; - public static readonly Rune RuneOfMinorVigor = new() { Id = 898, Name = "Rune of Minor Vigor", Modifiers = [0x25B80000, 0x240800C2, 0x25300185, 0x27E802C2, 0xC0000000], ModHash = "25B80000240800C22530018527E802C2C0000000", WikiUrl = "https://wiki.guildwars.com/wiki/Rune_of_Minor_Vigor", IconUrl = "https://wiki.guildwars.com/images/f/fb/Rune_All_Minor.png" }; - public static readonly Rune RuneOfSuperiorVigor = new() { Id = 5551, Name = "Rune of Superior Vigor", Modifiers = [0x25B80000, 0x24080101, 0x25300203, 0x27EA02C2, 0xC0000000], ModHash = "25B80000240801012530020327EA02C2", WikiUrl = "https://wiki.guildwars.com/wiki/Rune_of_Vigor", IconUrl = "https://wiki.guildwars.com/images/9/9e/Rune_All_Sup.png" }; + public static readonly Rune RuneOfMinorVigor = new() { Id = 898, Name = "Rune of Minor Vigor", Modifiers = [0x25B80000, 0x240800FF, 0x253001FF, 0x27E802C2, 0xC0000000], ModHash = "25B80000240800FF253001FF27E802C2C0000000", WikiUrl = "https://wiki.guildwars.com/wiki/Rune_of_Minor_Vigor", IconUrl = "https://wiki.guildwars.com/images/f/fb/Rune_All_Minor.png" }; + public static readonly Rune RuneOfSuperiorVigor = new() { Id = 5551, Name = "Rune of Superior Vigor", Modifiers = [0x25B80000, 0x24080101, 0x25300203, 0x27EA02C2, 0xC0000000], ModHash = "25B80000240801012530020327EA02C2C0000000", WikiUrl = "https://wiki.guildwars.com/wiki/Rune_of_Vigor", IconUrl = "https://wiki.guildwars.com/images/9/9e/Rune_All_Sup.png" }; public static readonly Rune RuneOfMajorVigor = new() { Id = 5550, Name = "Rune of Major Vigor", Modifiers = [0x25B80000, 0x24080100, 0x25300201, 0x27E902C2, 0xC0000000], ModHash = "25B80000240801002530020127E902C2C0000000", WikiUrl = "https://wiki.guildwars.com/wiki/Rune_of_Vigor", IconUrl = "https://wiki.guildwars.com/images/f/f6/Rune_All_Major.png" }; public static readonly Rune RuneOfVitae = new() { Id = 898, Name = "Rune of Vitae", Modifiers = [0x25B80000, 0x24080212, 0x25300425, 0x23480A00, 0xC0000000], ModHash = "25B80000240802122530042523480A00C0000000", WikiUrl = "https://wiki.guildwars.com/wiki/Rune_of_Vitae", IconUrl = "https://wiki.guildwars.com/images/f/fb/Rune_All_Minor.png" }; public static IReadOnlyList Runes { get; } = diff --git a/Daybreak/Models/Guildwars/SessionData.cs b/Daybreak.Shared/Models/Guildwars/SessionData.cs similarity index 65% rename from Daybreak/Models/Guildwars/SessionData.cs rename to Daybreak.Shared/Models/Guildwars/SessionData.cs index 4c6078fa..a931811b 100644 --- a/Daybreak/Models/Guildwars/SessionData.cs +++ b/Daybreak.Shared/Models/Guildwars/SessionData.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class SessionData { diff --git a/Daybreak/Models/Guildwars/SessionInformation.cs b/Daybreak.Shared/Models/Guildwars/SessionInformation.cs similarity index 85% rename from Daybreak/Models/Guildwars/SessionInformation.cs rename to Daybreak.Shared/Models/Guildwars/SessionInformation.cs index 74c651c7..f0b7d797 100644 --- a/Daybreak/Models/Guildwars/SessionInformation.cs +++ b/Daybreak.Shared/Models/Guildwars/SessionInformation.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class SessionInformation { diff --git a/Daybreak/Models/Guildwars/Skill.cs b/Daybreak.Shared/Models/Guildwars/Skill.cs similarity index 99% rename from Daybreak/Models/Guildwars/Skill.cs rename to Daybreak.Shared/Models/Guildwars/Skill.cs index 3dbe72cd..3002afdb 100644 --- a/Daybreak/Models/Guildwars/Skill.cs +++ b/Daybreak.Shared/Models/Guildwars/Skill.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(SkillJsonConverter))] public sealed class Skill diff --git a/Daybreak/Models/Guildwars/SkillMetadata.cs b/Daybreak.Shared/Models/Guildwars/SkillMetadata.cs similarity index 85% rename from Daybreak/Models/Guildwars/SkillMetadata.cs rename to Daybreak.Shared/Models/Guildwars/SkillMetadata.cs index a896efa3..5b2fd0dc 100644 --- a/Daybreak/Models/Guildwars/SkillMetadata.cs +++ b/Daybreak.Shared/Models/Guildwars/SkillMetadata.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class SkillMetadata { diff --git a/Daybreak/Models/Guildwars/TeamBuildData.cs b/Daybreak.Shared/Models/Guildwars/TeamBuildData.cs similarity index 77% rename from Daybreak/Models/Guildwars/TeamBuildData.cs rename to Daybreak.Shared/Models/Guildwars/TeamBuildData.cs index 06b3e10a..dffb3b70 100644 --- a/Daybreak/Models/Guildwars/TeamBuildData.cs +++ b/Daybreak.Shared/Models/Guildwars/TeamBuildData.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class TeamBuildData { public required List TeamBuildPlayers { get; init; } diff --git a/Daybreak/Models/Guildwars/TeamBuildPlayerData.cs b/Daybreak.Shared/Models/Guildwars/TeamBuildPlayerData.cs similarity index 89% rename from Daybreak/Models/Guildwars/TeamBuildPlayerData.cs rename to Daybreak.Shared/Models/Guildwars/TeamBuildPlayerData.cs index df93c89a..933590c0 100644 --- a/Daybreak/Models/Guildwars/TeamBuildPlayerData.cs +++ b/Daybreak.Shared/Models/Guildwars/TeamBuildPlayerData.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public abstract class TeamBuildPlayerData { public required Build Build { get; init; } diff --git a/Daybreak/Models/Guildwars/Title.cs b/Daybreak.Shared/Models/Guildwars/Title.cs similarity index 99% rename from Daybreak/Models/Guildwars/Title.cs rename to Daybreak.Shared/Models/Guildwars/Title.cs index cefe45bf..2aa47d3b 100644 --- a/Daybreak/Models/Guildwars/Title.cs +++ b/Daybreak.Shared/Models/Guildwars/Title.cs @@ -1,10 +1,10 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; [JsonConverter(typeof(TitleJsonConverter))] public sealed class Title : IWikiEntity diff --git a/Daybreak/Models/Guildwars/TitleInformation.cs b/Daybreak.Shared/Models/Guildwars/TitleInformation.cs similarity index 92% rename from Daybreak/Models/Guildwars/TitleInformation.cs rename to Daybreak.Shared/Models/Guildwars/TitleInformation.cs index d855a686..936f6388 100644 --- a/Daybreak/Models/Guildwars/TitleInformation.cs +++ b/Daybreak.Shared/Models/Guildwars/TitleInformation.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class TitleInformation { diff --git a/Daybreak/Models/Guildwars/UserData.cs b/Daybreak.Shared/Models/Guildwars/UserData.cs similarity index 63% rename from Daybreak/Models/Guildwars/UserData.cs rename to Daybreak.Shared/Models/Guildwars/UserData.cs index 45c93f74..aa01c3cc 100644 --- a/Daybreak/Models/Guildwars/UserData.cs +++ b/Daybreak.Shared/Models/Guildwars/UserData.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class UserData { public UserInformation? User { get; init; } diff --git a/Daybreak/Models/Guildwars/UserInformation.cs b/Daybreak.Shared/Models/Guildwars/UserInformation.cs similarity index 94% rename from Daybreak/Models/Guildwars/UserInformation.cs rename to Daybreak.Shared/Models/Guildwars/UserInformation.cs index 8b96c782..c431eac0 100644 --- a/Daybreak/Models/Guildwars/UserInformation.cs +++ b/Daybreak.Shared/Models/Guildwars/UserInformation.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class UserInformation { diff --git a/Daybreak.Shared/Models/Guildwars/VialOfDye.cs b/Daybreak.Shared/Models/Guildwars/VialOfDye.cs new file mode 100644 index 00000000..f5e36499 --- /dev/null +++ b/Daybreak.Shared/Models/Guildwars/VialOfDye.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Daybreak.Shared.Models.Guildwars; + +public sealed class VialOfDye : ItemBase, IItemModHash, IWikiEntity, IIconUrlEntity +{ + public static readonly VialOfDye Black = new() { Id = 146, Name = "Vial of Dye [Black]", Modifiers = [0x24D00A01, 0x24E8000A], ModHash = "24D00A0124E8000A", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/4/4c/Black_Dye.png" }; + public static readonly VialOfDye Blue = new() { Id = 146, Name = "Vial of Dye [Blue]", Modifiers = [0x24D00201, 0x24E80002], ModHash = "24D0020124E80002", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/c/c9/Blue_Dye.png" }; + public static readonly VialOfDye Brown = new() { Id = 146, Name = "Vial of Dye [Brown]", Modifiers = [0x24D00701, 0x24E80007], ModHash = "24D0070124E80007", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/0/07/Brown_Dye.png" }; + public static readonly VialOfDye Gray = new() { Id = 146, Name = "Vial of Dye [Gray]", Modifiers = [0x24D00B01, 0x24E8000B], ModHash = "24D00B0124E8000B", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/b/bc/Gray_Dye.png" }; + public static readonly VialOfDye Green = new() { Id = 146, Name = "Vial of Dye [Green]", Modifiers = [0x24D00301, 0x24E80003], ModHash = "24D0030124E80003", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/b/be/Green_Dye.png" }; + public static readonly VialOfDye Orange = new() { Id = 146, Name = "Vial of Dye [Orange]", Modifiers = [0x24D00801, 0x24E80008], ModHash = "24D0080124E80008", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/3/3a/Orange_Dye.png" }; + public static readonly VialOfDye Pink = new() { Id = 146, Name = "Vial of Dye [Pink]", Modifiers = [0x24D00D01, 0x24E8000D], ModHash = "24D00D0124E8000D", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/6/6a/Pink_Dye.png" }; + public static readonly VialOfDye Purple = new() { Id = 146, Name = "Vial of Dye [Purple]", Modifiers = [0x24D00401, 0x24E80004], ModHash = "24D0040124E80004", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/9/99/Purple_Dye.png" }; + public static readonly VialOfDye Red = new() { Id = 146, Name = "Vial of Dye [Red]", Modifiers = [0x24D00501, 0x24E80005], ModHash = "24D0050124E80005", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/c/c1/Red_Dye.png" }; + public static readonly VialOfDye Silver = new() { Id = 146, Name = "Vial of Dye [Silver]", Modifiers = [0x24D00901, 0x24E80009], ModHash = "24D0090124E80009", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/9/90/Silver_Dye.png" }; + public static readonly VialOfDye White = new() { Id = 146, Name = "Vial of Dye [White]", Modifiers = [0x24D00C01, 0x24E8000C], ModHash = "24D00C0124E8000C", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/9/91/White_Dye.png" }; + public static readonly VialOfDye Yellow = new() { Id = 146, Name = "Vial of Dye [Yellow]", Modifiers = [0x24D00601, 0x24E80006], ModHash = "24D0060124E80006", WikiUrl = "https://wiki.guildwars.com/wiki/Dye", IconUrl = "https://wiki.guildwars.com/images/4/46/Yellow_Dye.png" }; + + public static IReadOnlyList Vials { get; } = + [ + Black, + Blue, + Brown, + Gray, + Green, + Orange, + Pink, + Purple, + Red, + Silver, + White, + Yellow + ]; + + public required string ModHash { get; init; } + public required string IconUrl { get; init; } + public required string? WikiUrl { get; init; } +} diff --git a/Daybreak/Models/Guildwars/WorldData.cs b/Daybreak.Shared/Models/Guildwars/WorldData.cs similarity index 81% rename from Daybreak/Models/Guildwars/WorldData.cs rename to Daybreak.Shared/Models/Guildwars/WorldData.cs index 9fce8571..b17dbfd6 100644 --- a/Daybreak/Models/Guildwars/WorldData.cs +++ b/Daybreak.Shared/Models/Guildwars/WorldData.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class WorldData { diff --git a/Daybreak/Models/Guildwars/WorldPlayerInformation.cs b/Daybreak.Shared/Models/Guildwars/WorldPlayerInformation.cs similarity index 95% rename from Daybreak/Models/Guildwars/WorldPlayerInformation.cs rename to Daybreak.Shared/Models/Guildwars/WorldPlayerInformation.cs index c9070200..e7d2e75b 100644 --- a/Daybreak/Models/Guildwars/WorldPlayerInformation.cs +++ b/Daybreak.Shared/Models/Guildwars/WorldPlayerInformation.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.Guildwars; +namespace Daybreak.Shared.Models.Guildwars; public sealed class WorldPlayerInformation { diff --git a/Daybreak/Models/IconPayload.cs b/Daybreak.Shared/Models/IconPayload.cs similarity index 76% rename from Daybreak/Models/IconPayload.cs rename to Daybreak.Shared/Models/IconPayload.cs index 5942699e..a0ceba0f 100644 --- a/Daybreak/Models/IconPayload.cs +++ b/Daybreak.Shared/Models/IconPayload.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class IconPayload { diff --git a/Daybreak/Models/IconRequest.cs b/Daybreak.Shared/Models/IconRequest.cs similarity index 67% rename from Daybreak/Models/IconRequest.cs rename to Daybreak.Shared/Models/IconRequest.cs index 9a787ced..c32354f0 100644 --- a/Daybreak/Models/IconRequest.cs +++ b/Daybreak.Shared/Models/IconRequest.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class IconRequest { diff --git a/Daybreak/Models/InternetConnectionState.cs b/Daybreak.Shared/Models/InternetConnectionState.cs similarity index 77% rename from Daybreak/Models/InternetConnectionState.cs rename to Daybreak.Shared/Models/InternetConnectionState.cs index f60d9ce3..480a7964 100644 --- a/Daybreak/Models/InternetConnectionState.cs +++ b/Daybreak.Shared/Models/InternetConnectionState.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public enum InternetConnectionState { diff --git a/Daybreak/Models/Interop/AreaContext.cs b/Daybreak.Shared/Models/Interop/AreaContext.cs similarity index 96% rename from Daybreak/Models/Interop/AreaContext.cs rename to Daybreak.Shared/Models/Interop/AreaContext.cs index fd16c2d5..cff95efd 100644 --- a/Daybreak/Models/Interop/AreaContext.cs +++ b/Daybreak.Shared/Models/Interop/AreaContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct AreaContext diff --git a/Daybreak/Models/Interop/AreaInfoContext.cs b/Daybreak.Shared/Models/Interop/AreaInfoContext.cs similarity index 97% rename from Daybreak/Models/Interop/AreaInfoContext.cs rename to Daybreak.Shared/Models/Interop/AreaInfoContext.cs index 5bf82707..fc7c0fcf 100644 --- a/Daybreak/Models/Interop/AreaInfoContext.cs +++ b/Daybreak.Shared/Models/Interop/AreaInfoContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct AreaInfoContext diff --git a/Daybreak/Models/Interop/AttributeContext.cs b/Daybreak.Shared/Models/Interop/AttributeContext.cs similarity index 83% rename from Daybreak/Models/Interop/AttributeContext.cs rename to Daybreak.Shared/Models/Interop/AttributeContext.cs index 221ca3ab..5d7b2299 100644 --- a/Daybreak/Models/Interop/AttributeContext.cs +++ b/Daybreak.Shared/Models/Interop/AttributeContext.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct AttributeContext { diff --git a/Daybreak/Models/Interop/BagInfo.cs b/Daybreak.Shared/Models/Interop/BagInfo.cs similarity index 92% rename from Daybreak/Models/Interop/BagInfo.cs rename to Daybreak.Shared/Models/Interop/BagInfo.cs index c09dd5da..0b194fc5 100644 --- a/Daybreak/Models/Interop/BagInfo.cs +++ b/Daybreak.Shared/Models/Interop/BagInfo.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct BagInfo diff --git a/Daybreak/Models/Interop/EntityAllegiance.cs b/Daybreak.Shared/Models/Interop/EntityAllegiance.cs similarity index 79% rename from Daybreak/Models/Interop/EntityAllegiance.cs rename to Daybreak.Shared/Models/Interop/EntityAllegiance.cs index 8e714f46..33a60663 100644 --- a/Daybreak/Models/Interop/EntityAllegiance.cs +++ b/Daybreak.Shared/Models/Interop/EntityAllegiance.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public enum EntityAllegiance : byte { diff --git a/Daybreak/Models/Interop/EntityContext.cs b/Daybreak.Shared/Models/Interop/EntityContext.cs similarity index 97% rename from Daybreak/Models/Interop/EntityContext.cs rename to Daybreak.Shared/Models/Interop/EntityContext.cs index 8b85a0fe..accc5d9d 100644 --- a/Daybreak/Models/Interop/EntityContext.cs +++ b/Daybreak.Shared/Models/Interop/EntityContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct EntityContext diff --git a/Daybreak/Models/Interop/EntityState.cs b/Daybreak.Shared/Models/Interop/EntityState.cs similarity index 75% rename from Daybreak/Models/Interop/EntityState.cs rename to Daybreak.Shared/Models/Interop/EntityState.cs index 33780790..ff27774f 100644 --- a/Daybreak/Models/Interop/EntityState.cs +++ b/Daybreak.Shared/Models/Interop/EntityState.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public enum EntityState { diff --git a/Daybreak/Models/Interop/EntityType.cs b/Daybreak.Shared/Models/Interop/EntityType.cs similarity index 65% rename from Daybreak/Models/Interop/EntityType.cs rename to Daybreak.Shared/Models/Interop/EntityType.cs index af8d35e7..42b455cf 100644 --- a/Daybreak/Models/Interop/EntityType.cs +++ b/Daybreak.Shared/Models/Interop/EntityType.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public enum EntityType { diff --git a/Daybreak/Models/Interop/GameContext.cs b/Daybreak.Shared/Models/Interop/GameContext.cs similarity index 98% rename from Daybreak/Models/Interop/GameContext.cs rename to Daybreak.Shared/Models/Interop/GameContext.cs index 1b440c3a..28e08a07 100644 --- a/Daybreak/Models/Interop/GameContext.cs +++ b/Daybreak.Shared/Models/Interop/GameContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct GameContext diff --git a/Daybreak/Models/Interop/GamePosition.cs b/Daybreak.Shared/Models/Interop/GamePosition.cs similarity index 67% rename from Daybreak/Models/Interop/GamePosition.cs rename to Daybreak.Shared/Models/Interop/GamePosition.cs index b7a55598..217b11b1 100644 --- a/Daybreak/Models/Interop/GamePosition.cs +++ b/Daybreak.Shared/Models/Interop/GamePosition.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public struct GamePosition { diff --git a/Daybreak/Models/Interop/GenericGuildwarsArray.cs b/Daybreak.Shared/Models/Interop/GenericGuildwarsArray.cs similarity index 80% rename from Daybreak/Models/Interop/GenericGuildwarsArray.cs rename to Daybreak.Shared/Models/Interop/GenericGuildwarsArray.cs index 734a4931..a2111673 100644 --- a/Daybreak/Models/Interop/GenericGuildwarsArray.cs +++ b/Daybreak.Shared/Models/Interop/GenericGuildwarsArray.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct GenericGuildwarsArray { diff --git a/Daybreak/Models/Interop/GlobalContext.cs b/Daybreak.Shared/Models/Interop/GlobalContext.cs similarity index 94% rename from Daybreak/Models/Interop/GlobalContext.cs rename to Daybreak.Shared/Models/Interop/GlobalContext.cs index c1c63dcb..f433d693 100644 --- a/Daybreak/Models/Interop/GlobalContext.cs +++ b/Daybreak.Shared/Models/Interop/GlobalContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct GlobalContext diff --git a/Daybreak/Models/Interop/GuildwarsArray.cs b/Daybreak.Shared/Models/Interop/GuildwarsArray.cs similarity index 91% rename from Daybreak/Models/Interop/GuildwarsArray.cs rename to Daybreak.Shared/Models/Interop/GuildwarsArray.cs index b5cba334..7d77ee98 100644 --- a/Daybreak/Models/Interop/GuildwarsArray.cs +++ b/Daybreak.Shared/Models/Interop/GuildwarsArray.cs @@ -1,7 +1,7 @@ -using Daybreak.Utils; +using Daybreak.Shared.Utils; using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Sequential)] public readonly struct GuildwarsArray diff --git a/Daybreak/Models/Interop/GuildwarsPointer.cs b/Daybreak.Shared/Models/Interop/GuildwarsPointer.cs similarity index 84% rename from Daybreak/Models/Interop/GuildwarsPointer.cs rename to Daybreak.Shared/Models/Interop/GuildwarsPointer.cs index 05c4d99b..541956dd 100644 --- a/Daybreak/Models/Interop/GuildwarsPointer.cs +++ b/Daybreak.Shared/Models/Interop/GuildwarsPointer.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct GuildwarsPointer { diff --git a/Daybreak/Models/Interop/GuildwarsPointerArray.cs b/Daybreak.Shared/Models/Interop/GuildwarsPointerArray.cs similarity index 87% rename from Daybreak/Models/Interop/GuildwarsPointerArray.cs rename to Daybreak.Shared/Models/Interop/GuildwarsPointerArray.cs index 996b698a..9b7580c4 100644 --- a/Daybreak/Models/Interop/GuildwarsPointerArray.cs +++ b/Daybreak.Shared/Models/Interop/GuildwarsPointerArray.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Sequential)] public readonly struct GuildwarsPointerArray diff --git a/Daybreak/Models/Interop/HenchmanPartyMember.cs b/Daybreak.Shared/Models/Interop/HenchmanPartyMember.cs similarity index 87% rename from Daybreak/Models/Interop/HenchmanPartyMember.cs rename to Daybreak.Shared/Models/Interop/HenchmanPartyMember.cs index 3bc8e823..f044315f 100644 --- a/Daybreak/Models/Interop/HenchmanPartyMember.cs +++ b/Daybreak.Shared/Models/Interop/HenchmanPartyMember.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct HenchmanPartyMember diff --git a/Daybreak/Models/Interop/HeroPartyMember.cs b/Daybreak.Shared/Models/Interop/HeroPartyMember.cs similarity index 84% rename from Daybreak/Models/Interop/HeroPartyMember.cs rename to Daybreak.Shared/Models/Interop/HeroPartyMember.cs index 309aba5a..c187d6ca 100644 --- a/Daybreak/Models/Interop/HeroPartyMember.cs +++ b/Daybreak.Shared/Models/Interop/HeroPartyMember.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct HeroPartyMember { diff --git a/Daybreak/Models/Interop/IPAddressContext.cs b/Daybreak.Shared/Models/Interop/IPAddressContext.cs similarity index 85% rename from Daybreak/Models/Interop/IPAddressContext.cs rename to Daybreak.Shared/Models/Interop/IPAddressContext.cs index cbc2c88d..ced6e8ef 100644 --- a/Daybreak/Models/Interop/IPAddressContext.cs +++ b/Daybreak.Shared/Models/Interop/IPAddressContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Sequential)] public readonly struct IPAddressContext diff --git a/Daybreak/Models/Interop/InstanceContext.cs b/Daybreak.Shared/Models/Interop/InstanceContext.cs similarity index 82% rename from Daybreak/Models/Interop/InstanceContext.cs rename to Daybreak.Shared/Models/Interop/InstanceContext.cs index e3241dfb..03fb1146 100644 --- a/Daybreak/Models/Interop/InstanceContext.cs +++ b/Daybreak.Shared/Models/Interop/InstanceContext.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct InstanceContext { diff --git a/Daybreak/Models/Interop/InstanceInfoContext.cs b/Daybreak.Shared/Models/Interop/InstanceInfoContext.cs similarity index 87% rename from Daybreak/Models/Interop/InstanceInfoContext.cs rename to Daybreak.Shared/Models/Interop/InstanceInfoContext.cs index 77d379cb..b9f400b5 100644 --- a/Daybreak/Models/Interop/InstanceInfoContext.cs +++ b/Daybreak.Shared/Models/Interop/InstanceInfoContext.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct InstanceInfoContext { public readonly GuildwarsPointer TerrainInfo; diff --git a/Daybreak/Models/Interop/InstanceType.cs b/Daybreak.Shared/Models/Interop/InstanceType.cs similarity index 61% rename from Daybreak/Models/Interop/InstanceType.cs rename to Daybreak.Shared/Models/Interop/InstanceType.cs index 0be4d5d4..f8313c50 100644 --- a/Daybreak/Models/Interop/InstanceType.cs +++ b/Daybreak.Shared/Models/Interop/InstanceType.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public enum InstanceType { diff --git a/Daybreak/Models/Interop/InventoryContext.cs b/Daybreak.Shared/Models/Interop/InventoryContext.cs similarity index 95% rename from Daybreak/Models/Interop/InventoryContext.cs rename to Daybreak.Shared/Models/Interop/InventoryContext.cs index c4cbc2ad..f98f2255 100644 --- a/Daybreak/Models/Interop/InventoryContext.cs +++ b/Daybreak.Shared/Models/Interop/InventoryContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct InventoryContext diff --git a/Daybreak/Models/Interop/ItemContext.cs b/Daybreak.Shared/Models/Interop/ItemContext.cs similarity index 90% rename from Daybreak/Models/Interop/ItemContext.cs rename to Daybreak.Shared/Models/Interop/ItemContext.cs index f23b8cd3..7f8a355d 100644 --- a/Daybreak/Models/Interop/ItemContext.cs +++ b/Daybreak.Shared/Models/Interop/ItemContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct ItemContext diff --git a/Daybreak/Models/Interop/ItemInfo.cs b/Daybreak.Shared/Models/Interop/ItemInfo.cs similarity index 96% rename from Daybreak/Models/Interop/ItemInfo.cs rename to Daybreak.Shared/Models/Interop/ItemInfo.cs index 0cbaeda7..402c9707 100644 --- a/Daybreak/Models/Interop/ItemInfo.cs +++ b/Daybreak.Shared/Models/Interop/ItemInfo.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct ItemInfo diff --git a/Daybreak/Models/Interop/ItemModifier.cs b/Daybreak.Shared/Models/Interop/ItemModifier.cs similarity index 85% rename from Daybreak/Models/Interop/ItemModifier.cs rename to Daybreak.Shared/Models/Interop/ItemModifier.cs index 04832665..a24acb47 100644 --- a/Daybreak/Models/Interop/ItemModifier.cs +++ b/Daybreak.Shared/Models/Interop/ItemModifier.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct ItemModifier { diff --git a/Daybreak/Models/Interop/LoginCharacterContext.cs b/Daybreak.Shared/Models/Interop/LoginCharacterContext.cs similarity index 91% rename from Daybreak/Models/Interop/LoginCharacterContext.cs rename to Daybreak.Shared/Models/Interop/LoginCharacterContext.cs index 11412563..f05b5597 100644 --- a/Daybreak/Models/Interop/LoginCharacterContext.cs +++ b/Daybreak.Shared/Models/Interop/LoginCharacterContext.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; using System.Text; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public readonly struct LoginCharacterContext diff --git a/Daybreak/Models/Interop/MapContext.cs b/Daybreak.Shared/Models/Interop/MapContext.cs similarity index 91% rename from Daybreak/Models/Interop/MapContext.cs rename to Daybreak.Shared/Models/Interop/MapContext.cs index cb049792..6898a6f9 100644 --- a/Daybreak/Models/Interop/MapContext.cs +++ b/Daybreak.Shared/Models/Interop/MapContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct MapContext diff --git a/Daybreak/Models/Interop/MapEntityContext.cs b/Daybreak.Shared/Models/Interop/MapEntityContext.cs similarity index 96% rename from Daybreak/Models/Interop/MapEntityContext.cs rename to Daybreak.Shared/Models/Interop/MapEntityContext.cs index f75e19e1..fc7bae79 100644 --- a/Daybreak/Models/Interop/MapEntityContext.cs +++ b/Daybreak.Shared/Models/Interop/MapEntityContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct MapEntityContext diff --git a/Daybreak/Models/Interop/MapIconContext.cs b/Daybreak.Shared/Models/Interop/MapIconContext.cs similarity index 92% rename from Daybreak/Models/Interop/MapIconContext.cs rename to Daybreak.Shared/Models/Interop/MapIconContext.cs index 1ce47c0b..441c13e1 100644 --- a/Daybreak/Models/Interop/MapIconContext.cs +++ b/Daybreak.Shared/Models/Interop/MapIconContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct MapIconContext diff --git a/Daybreak/Models/Interop/NpcContext.cs b/Daybreak.Shared/Models/Interop/NpcContext.cs similarity index 93% rename from Daybreak/Models/Interop/NpcContext.cs rename to Daybreak.Shared/Models/Interop/NpcContext.cs index 39eb0baf..7a32e6c9 100644 --- a/Daybreak/Models/Interop/NpcContext.cs +++ b/Daybreak.Shared/Models/Interop/NpcContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct NpcContext diff --git a/Daybreak/Models/Interop/PartyAttributesContext.cs b/Daybreak.Shared/Models/Interop/PartyAttributesContext.cs similarity index 85% rename from Daybreak/Models/Interop/PartyAttributesContext.cs rename to Daybreak.Shared/Models/Interop/PartyAttributesContext.cs index a0d15be1..2d917216 100644 --- a/Daybreak/Models/Interop/PartyAttributesContext.cs +++ b/Daybreak.Shared/Models/Interop/PartyAttributesContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct PartyAttributesContext { diff --git a/Daybreak/Models/Interop/PartyContext.cs b/Daybreak.Shared/Models/Interop/PartyContext.cs similarity index 90% rename from Daybreak/Models/Interop/PartyContext.cs rename to Daybreak.Shared/Models/Interop/PartyContext.cs index 119fddd1..4417b572 100644 --- a/Daybreak/Models/Interop/PartyContext.cs +++ b/Daybreak.Shared/Models/Interop/PartyContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct PartyContext diff --git a/Daybreak/Models/Interop/PartyInfoContext.cs b/Daybreak.Shared/Models/Interop/PartyInfoContext.cs similarity index 93% rename from Daybreak/Models/Interop/PartyInfoContext.cs rename to Daybreak.Shared/Models/Interop/PartyInfoContext.cs index 976b6dae..8cb42fde 100644 --- a/Daybreak/Models/Interop/PartyInfoContext.cs +++ b/Daybreak.Shared/Models/Interop/PartyInfoContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct PartyInfoContext diff --git a/Daybreak/Models/Interop/PathingMap.cs b/Daybreak.Shared/Models/Interop/PathingMap.cs similarity index 91% rename from Daybreak/Models/Interop/PathingMap.cs rename to Daybreak.Shared/Models/Interop/PathingMap.cs index 204cc13b..9533fc1d 100644 --- a/Daybreak/Models/Interop/PathingMap.cs +++ b/Daybreak.Shared/Models/Interop/PathingMap.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct PathingMap diff --git a/Daybreak/Models/Interop/PathingMapContext.cs b/Daybreak.Shared/Models/Interop/PathingMapContext.cs similarity index 83% rename from Daybreak/Models/Interop/PathingMapContext.cs rename to Daybreak.Shared/Models/Interop/PathingMapContext.cs index 39188d1f..5f252155 100644 --- a/Daybreak/Models/Interop/PathingMapContext.cs +++ b/Daybreak.Shared/Models/Interop/PathingMapContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct PathingMapContext diff --git a/Daybreak/Models/Interop/PathingTrapezoid.cs b/Daybreak.Shared/Models/Interop/PathingTrapezoid.cs similarity index 93% rename from Daybreak/Models/Interop/PathingTrapezoid.cs rename to Daybreak.Shared/Models/Interop/PathingTrapezoid.cs index 906d1cc9..12573bc1 100644 --- a/Daybreak/Models/Interop/PathingTrapezoid.cs +++ b/Daybreak.Shared/Models/Interop/PathingTrapezoid.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct PathingTrapezoid { diff --git a/Daybreak/Models/Interop/PlayerContext.cs b/Daybreak.Shared/Models/Interop/PlayerContext.cs similarity index 95% rename from Daybreak/Models/Interop/PlayerContext.cs rename to Daybreak.Shared/Models/Interop/PlayerContext.cs index 95b960f8..b991182a 100644 --- a/Daybreak/Models/Interop/PlayerContext.cs +++ b/Daybreak.Shared/Models/Interop/PlayerContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct PlayerContext diff --git a/Daybreak/Models/Interop/PlayerControlledCharContext.cs b/Daybreak.Shared/Models/Interop/PlayerControlledCharContext.cs similarity index 74% rename from Daybreak/Models/Interop/PlayerControlledCharContext.cs rename to Daybreak.Shared/Models/Interop/PlayerControlledCharContext.cs index 0d4fa68c..ebe86e8f 100644 --- a/Daybreak/Models/Interop/PlayerControlledCharContext.cs +++ b/Daybreak.Shared/Models/Interop/PlayerControlledCharContext.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct PlayerControlledCharContext { diff --git a/Daybreak/Models/Interop/PlayerPartyMember.cs b/Daybreak.Shared/Models/Interop/PlayerPartyMember.cs similarity index 85% rename from Daybreak/Models/Interop/PlayerPartyMember.cs rename to Daybreak.Shared/Models/Interop/PlayerPartyMember.cs index 32034d2a..e37eefe5 100644 --- a/Daybreak/Models/Interop/PlayerPartyMember.cs +++ b/Daybreak.Shared/Models/Interop/PlayerPartyMember.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct PlayerPartyMember { diff --git a/Daybreak/Models/Interop/PreGameContext.cs b/Daybreak.Shared/Models/Interop/PreGameContext.cs similarity index 92% rename from Daybreak/Models/Interop/PreGameContext.cs rename to Daybreak.Shared/Models/Interop/PreGameContext.cs index 3f5b2134..40915dbb 100644 --- a/Daybreak/Models/Interop/PreGameContext.cs +++ b/Daybreak.Shared/Models/Interop/PreGameContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct PreGameContext diff --git a/Daybreak/Models/Interop/ProfessionsContext.cs b/Daybreak.Shared/Models/Interop/ProfessionsContext.cs similarity index 81% rename from Daybreak/Models/Interop/ProfessionsContext.cs rename to Daybreak.Shared/Models/Interop/ProfessionsContext.cs index c042e417..79f00bed 100644 --- a/Daybreak/Models/Interop/ProfessionsContext.cs +++ b/Daybreak.Shared/Models/Interop/ProfessionsContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Sequential)] public readonly struct ProfessionsContext @@ -18,6 +18,6 @@ public readonly struct ProfessionsContext public bool ProfessionUnlocked(int professionId) { - return (this.UnlockedProfessionsFlags & (1U << professionId)) != 0; + return (this.UnlockedProfessionsFlags & 1U << professionId) != 0; } } diff --git a/Daybreak/Models/Interop/PvpTeam.cs b/Daybreak.Shared/Models/Interop/PvpTeam.cs similarity index 66% rename from Daybreak/Models/Interop/PvpTeam.cs rename to Daybreak.Shared/Models/Interop/PvpTeam.cs index 113aa57c..7f9c68c1 100644 --- a/Daybreak/Models/Interop/PvpTeam.cs +++ b/Daybreak.Shared/Models/Interop/PvpTeam.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public enum PvpTeam : byte { diff --git a/Daybreak/Models/Interop/QuestContext.cs b/Daybreak.Shared/Models/Interop/QuestContext.cs similarity index 93% rename from Daybreak/Models/Interop/QuestContext.cs rename to Daybreak.Shared/Models/Interop/QuestContext.cs index d0898875..0ae77eec 100644 --- a/Daybreak/Models/Interop/QuestContext.cs +++ b/Daybreak.Shared/Models/Interop/QuestContext.cs @@ -1,7 +1,7 @@ using System.Numerics; using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit)] public readonly struct QuestContext diff --git a/Daybreak/Models/Interop/RegionType.cs b/Daybreak.Shared/Models/Interop/RegionType.cs similarity index 90% rename from Daybreak/Models/Interop/RegionType.cs rename to Daybreak.Shared/Models/Interop/RegionType.cs index b62c6cda..032383d3 100644 --- a/Daybreak/Models/Interop/RegionType.cs +++ b/Daybreak.Shared/Models/Interop/RegionType.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public enum RegionType : uint { diff --git a/Daybreak/Models/Interop/SkillContext.cs b/Daybreak.Shared/Models/Interop/SkillContext.cs similarity index 87% rename from Daybreak/Models/Interop/SkillContext.cs rename to Daybreak.Shared/Models/Interop/SkillContext.cs index 9afd55d4..18b6303b 100644 --- a/Daybreak/Models/Interop/SkillContext.cs +++ b/Daybreak.Shared/Models/Interop/SkillContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Sequential)] public readonly struct SkillContext diff --git a/Daybreak/Models/Interop/SkillbarContext.cs b/Daybreak.Shared/Models/Interop/SkillbarContext.cs similarity index 93% rename from Daybreak/Models/Interop/SkillbarContext.cs rename to Daybreak.Shared/Models/Interop/SkillbarContext.cs index 0fe194f3..cca3a1e6 100644 --- a/Daybreak/Models/Interop/SkillbarContext.cs +++ b/Daybreak.Shared/Models/Interop/SkillbarContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Sequential, Pack = 0, Size = 0xBC)] public readonly unsafe struct SkillbarContext diff --git a/Daybreak/Models/Interop/TeamColor.cs b/Daybreak.Shared/Models/Interop/TeamColor.cs similarity index 72% rename from Daybreak/Models/Interop/TeamColor.cs rename to Daybreak.Shared/Models/Interop/TeamColor.cs index f0fd73a9..c9ee6a93 100644 --- a/Daybreak/Models/Interop/TeamColor.cs +++ b/Daybreak.Shared/Models/Interop/TeamColor.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public enum TeamColor { Gray, diff --git a/Daybreak/Models/Interop/TitleContext.cs b/Daybreak.Shared/Models/Interop/TitleContext.cs similarity index 92% rename from Daybreak/Models/Interop/TitleContext.cs rename to Daybreak.Shared/Models/Interop/TitleContext.cs index b92126ec..f723f39f 100644 --- a/Daybreak/Models/Interop/TitleContext.cs +++ b/Daybreak.Shared/Models/Interop/TitleContext.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct TitleContext { diff --git a/Daybreak/Models/Interop/TitleIds.cs b/Daybreak.Shared/Models/Interop/TitleIds.cs similarity index 95% rename from Daybreak/Models/Interop/TitleIds.cs rename to Daybreak.Shared/Models/Interop/TitleIds.cs index 22252919..8c81f179 100644 --- a/Daybreak/Models/Interop/TitleIds.cs +++ b/Daybreak.Shared/Models/Interop/TitleIds.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public enum TitleIds { diff --git a/Daybreak/Models/Interop/TitleInfo.cs b/Daybreak.Shared/Models/Interop/TitleInfo.cs similarity index 70% rename from Daybreak/Models/Interop/TitleInfo.cs rename to Daybreak.Shared/Models/Interop/TitleInfo.cs index 39ef74c9..44e5402a 100644 --- a/Daybreak/Models/Interop/TitleInfo.cs +++ b/Daybreak.Shared/Models/Interop/TitleInfo.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct TitleInfo { diff --git a/Daybreak/Models/Interop/TitleTierContext.cs b/Daybreak.Shared/Models/Interop/TitleTierContext.cs similarity index 82% rename from Daybreak/Models/Interop/TitleTierContext.cs rename to Daybreak.Shared/Models/Interop/TitleTierContext.cs index 4f95d98f..95838f8e 100644 --- a/Daybreak/Models/Interop/TitleTierContext.cs +++ b/Daybreak.Shared/Models/Interop/TitleTierContext.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; public readonly struct TitleTierContext { diff --git a/Daybreak/Models/Interop/UserContext.cs b/Daybreak.Shared/Models/Interop/UserContext.cs similarity index 95% rename from Daybreak/Models/Interop/UserContext.cs rename to Daybreak.Shared/Models/Interop/UserContext.cs index 3f987627..d5e6cc69 100644 --- a/Daybreak/Models/Interop/UserContext.cs +++ b/Daybreak.Shared/Models/Interop/UserContext.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Daybreak.Models.Interop; +namespace Daybreak.Shared.Models.Interop; [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)] public readonly struct UserContext diff --git a/Daybreak/Models/KeyMacro.cs b/Daybreak.Shared/Models/KeyMacro.cs similarity index 84% rename from Daybreak/Models/KeyMacro.cs rename to Daybreak.Shared/Models/KeyMacro.cs index fd58676c..15173ab4 100644 --- a/Daybreak/Models/KeyMacro.cs +++ b/Daybreak.Shared/Models/KeyMacro.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Windows.Forms; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class KeyMacro { diff --git a/Daybreak/Models/KeyboardHookEventArgs.cs b/Daybreak.Shared/Models/KeyboardHookEventArgs.cs similarity index 91% rename from Daybreak/Models/KeyboardHookEventArgs.cs rename to Daybreak.Shared/Models/KeyboardHookEventArgs.cs index 0d71bd34..04954b75 100644 --- a/Daybreak/Models/KeyboardHookEventArgs.cs +++ b/Daybreak.Shared/Models/KeyboardHookEventArgs.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class KeyboardHookEventArgs { diff --git a/Daybreak/Models/KeyboardInput.cs b/Daybreak.Shared/Models/KeyboardInput.cs similarity index 95% rename from Daybreak/Models/KeyboardInput.cs rename to Daybreak.Shared/Models/KeyboardInput.cs index e7227344..e931968a 100644 --- a/Daybreak/Models/KeyboardInput.cs +++ b/Daybreak.Shared/Models/KeyboardInput.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; using System.Windows.Forms; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; [StructLayout(LayoutKind.Sequential)] public struct KeyboardInput @@ -36,5 +36,5 @@ public struct KeyboardInput /// /// Additional information associated with the message. /// - public IntPtr AdditionalInformation; + public nint AdditionalInformation; } diff --git a/Daybreak/Models/KeyboardState.cs b/Daybreak.Shared/Models/KeyboardState.cs similarity index 76% rename from Daybreak/Models/KeyboardState.cs rename to Daybreak.Shared/Models/KeyboardState.cs index 793391d0..1bdece5c 100644 --- a/Daybreak/Models/KeyboardState.cs +++ b/Daybreak.Shared/Models/KeyboardState.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public enum KeyboardState { diff --git a/Daybreak/Models/LaunchConfigurations/GuildWarsApplicationLaunchContext.cs b/Daybreak.Shared/Models/LaunchConfigurations/GuildWarsApplicationLaunchContext.cs similarity index 87% rename from Daybreak/Models/LaunchConfigurations/GuildWarsApplicationLaunchContext.cs rename to Daybreak.Shared/Models/LaunchConfigurations/GuildWarsApplicationLaunchContext.cs index b206a8f5..52fb6f4d 100644 --- a/Daybreak/Models/LaunchConfigurations/GuildWarsApplicationLaunchContext.cs +++ b/Daybreak.Shared/Models/LaunchConfigurations/GuildWarsApplicationLaunchContext.cs @@ -1,7 +1,7 @@ using System; using System.Diagnostics; -namespace Daybreak.Models.LaunchConfigurations; +namespace Daybreak.Shared.Models.LaunchConfigurations; public sealed record GuildWarsApplicationLaunchContext : IEquatable { @@ -9,7 +9,7 @@ public sealed record GuildWarsApplicationLaunchContext : IEquatable { diff --git a/Daybreak/Models/LauncherViewContext.cs b/Daybreak.Shared/Models/LauncherViewContext.cs similarity index 93% rename from Daybreak/Models/LauncherViewContext.cs rename to Daybreak.Shared/Models/LauncherViewContext.cs index 2cbe6ceb..8f2003e0 100644 --- a/Daybreak/Models/LauncherViewContext.cs +++ b/Daybreak.Shared/Models/LauncherViewContext.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.LaunchConfigurations; +using Daybreak.Shared.Models.LaunchConfigurations; using System.ComponentModel; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class LauncherViewContext : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; diff --git a/Daybreak/Models/Log.cs b/Daybreak.Shared/Models/Log.cs similarity index 91% rename from Daybreak/Models/Log.cs rename to Daybreak.Shared/Models/Log.cs index 8b332dcb..acf22fa0 100644 --- a/Daybreak/Models/Log.cs +++ b/Daybreak.Shared/Models/Log.cs @@ -1,7 +1,7 @@ using Microsoft.Extensions.Logging; using System; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class Log { diff --git a/Daybreak/Models/LoginCredentials.cs b/Daybreak.Shared/Models/LoginCredentials.cs similarity index 95% rename from Daybreak/Models/LoginCredentials.cs rename to Daybreak.Shared/Models/LoginCredentials.cs index 5f77829e..ddc78889 100644 --- a/Daybreak/Models/LoginCredentials.cs +++ b/Daybreak.Shared/Models/LoginCredentials.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class LoginCredentials : IEquatable { diff --git a/Daybreak/Models/MainPlayerResourceContext.cs b/Daybreak.Shared/Models/MainPlayerResourceContext.cs similarity index 70% rename from Daybreak/Models/MainPlayerResourceContext.cs rename to Daybreak.Shared/Models/MainPlayerResourceContext.cs index 3b102e10..12433ab9 100644 --- a/Daybreak/Models/MainPlayerResourceContext.cs +++ b/Daybreak.Shared/Models/MainPlayerResourceContext.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class MainPlayerResourceContext { public UserData? User { get; init; } diff --git a/Daybreak/Models/Menu/MenuButton.cs b/Daybreak.Shared/Models/Menu/MenuButton.cs similarity index 86% rename from Daybreak/Models/Menu/MenuButton.cs rename to Daybreak.Shared/Models/Menu/MenuButton.cs index 54e5f8cc..2b8f9445 100644 --- a/Daybreak/Models/Menu/MenuButton.cs +++ b/Daybreak.Shared/Models/Menu/MenuButton.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models.Menu; +namespace Daybreak.Shared.Models.Menu; public sealed class MenuButton(string name, string hint, Action action) { diff --git a/Daybreak/Models/Menu/MenuCategory.cs b/Daybreak.Shared/Models/Menu/MenuCategory.cs similarity index 92% rename from Daybreak/Models/Menu/MenuCategory.cs rename to Daybreak.Shared/Models/Menu/MenuCategory.cs index dc786fdc..bccca2de 100644 --- a/Daybreak/Models/Menu/MenuCategory.cs +++ b/Daybreak.Shared/Models/Menu/MenuCategory.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Daybreak.Models.Menu; +namespace Daybreak.Shared.Models.Menu; public sealed class MenuCategory { private readonly List buttons = []; diff --git a/Daybreak/Models/Metrics/AggregationTypes.cs b/Daybreak.Shared/Models/Metrics/AggregationTypes.cs similarity index 63% rename from Daybreak/Models/Metrics/AggregationTypes.cs rename to Daybreak.Shared/Models/Metrics/AggregationTypes.cs index 3ef374b8..e409476d 100644 --- a/Daybreak/Models/Metrics/AggregationTypes.cs +++ b/Daybreak.Shared/Models/Metrics/AggregationTypes.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Metrics; +namespace Daybreak.Shared.Models.Metrics; public enum AggregationTypes { diff --git a/Daybreak/Models/Metrics/Metric.cs b/Daybreak.Shared/Models/Metrics/Metric.cs similarity index 84% rename from Daybreak/Models/Metrics/Metric.cs rename to Daybreak.Shared/Models/Metrics/Metric.cs index 3870fac9..9ba38652 100644 --- a/Daybreak/Models/Metrics/Metric.cs +++ b/Daybreak.Shared/Models/Metrics/Metric.cs @@ -1,7 +1,7 @@ using System; using System.Diagnostics.Metrics; -namespace Daybreak.Models.Metrics; +namespace Daybreak.Shared.Models.Metrics; public readonly struct Metric { diff --git a/Daybreak/Models/Metrics/MetricSet.cs b/Daybreak.Shared/Models/Metrics/MetricSet.cs similarity index 86% rename from Daybreak/Models/Metrics/MetricSet.cs rename to Daybreak.Shared/Models/Metrics/MetricSet.cs index d035ce65..ea8e22bc 100644 --- a/Daybreak/Models/Metrics/MetricSet.cs +++ b/Daybreak.Shared/Models/Metrics/MetricSet.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Diagnostics.Metrics; -namespace Daybreak.Models.Metrics; +namespace Daybreak.Shared.Models.Metrics; public sealed class MetricSet { diff --git a/Daybreak/Models/Metrics/MetricSetViewModel.cs b/Daybreak.Shared/Models/Metrics/MetricSetViewModel.cs similarity index 87% rename from Daybreak/Models/Metrics/MetricSetViewModel.cs rename to Daybreak.Shared/Models/Metrics/MetricSetViewModel.cs index dadc0729..538457e3 100644 --- a/Daybreak/Models/Metrics/MetricSetViewModel.cs +++ b/Daybreak.Shared/Models/Metrics/MetricSetViewModel.cs @@ -1,7 +1,7 @@ using System.Collections.ObjectModel; using System.Diagnostics.Metrics; -namespace Daybreak.Models.Metrics; +namespace Daybreak.Shared.Models.Metrics; public sealed class MetricSetViewModel { diff --git a/Daybreak/Models/Metrics/RecordedMetric.cs b/Daybreak.Shared/Models/Metrics/RecordedMetric.cs similarity index 79% rename from Daybreak/Models/Metrics/RecordedMetric.cs rename to Daybreak.Shared/Models/Metrics/RecordedMetric.cs index 22a93b19..6da15c31 100644 --- a/Daybreak/Models/Metrics/RecordedMetric.cs +++ b/Daybreak.Shared/Models/Metrics/RecordedMetric.cs @@ -1,6 +1,6 @@ using System.Diagnostics.Metrics; -namespace Daybreak.Models.Metrics; +namespace Daybreak.Shared.Models.Metrics; public sealed class RecordedMetric { diff --git a/Daybreak/Models/Mods/GuildWarsCreatedContext.cs b/Daybreak.Shared/Models/Mods/GuildWarsCreatedContext.cs similarity index 80% rename from Daybreak/Models/Mods/GuildWarsCreatedContext.cs rename to Daybreak.Shared/Models/Mods/GuildWarsCreatedContext.cs index 1abb3750..fd243c96 100644 --- a/Daybreak/Models/Mods/GuildWarsCreatedContext.cs +++ b/Daybreak.Shared/Models/Mods/GuildWarsCreatedContext.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Mods; +namespace Daybreak.Shared.Models.Mods; public sealed class GuildWarsCreatedContext { public ApplicationLauncherContext ApplicationLauncherContext { get; init; } diff --git a/Daybreak/Models/Mods/GuildWarsStartedContext.cs b/Daybreak.Shared/Models/Mods/GuildWarsStartedContext.cs similarity index 75% rename from Daybreak/Models/Mods/GuildWarsStartedContext.cs rename to Daybreak.Shared/Models/Mods/GuildWarsStartedContext.cs index 32ec11ec..f2abdb46 100644 --- a/Daybreak/Models/Mods/GuildWarsStartedContext.cs +++ b/Daybreak.Shared/Models/Mods/GuildWarsStartedContext.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Mods; +namespace Daybreak.Shared.Models.Mods; public sealed class GuildWarsStartedContext { public ApplicationLauncherContext ApplicationLauncherContext { get; init; } diff --git a/Daybreak/Models/Mods/GuildWarsStartingContext.cs b/Daybreak.Shared/Models/Mods/GuildWarsStartingContext.cs similarity index 70% rename from Daybreak/Models/Mods/GuildWarsStartingContext.cs rename to Daybreak.Shared/Models/Mods/GuildWarsStartingContext.cs index 35719285..4a56d4a8 100644 --- a/Daybreak/Models/Mods/GuildWarsStartingContext.cs +++ b/Daybreak.Shared/Models/Mods/GuildWarsStartingContext.cs @@ -1,4 +1,6 @@ -namespace Daybreak.Models.Mods; +using Daybreak.Shared.Models; + +namespace Daybreak.Shared.Models.Mods; public sealed class GuildWarsStartingContext { public ApplicationLauncherContext ApplicationLauncherContext { get; init; } diff --git a/Daybreak/Models/Mods/GuildWarsStartingDisabledContext.cs b/Daybreak.Shared/Models/Mods/GuildWarsStartingDisabledContext.cs similarity index 65% rename from Daybreak/Models/Mods/GuildWarsStartingDisabledContext.cs rename to Daybreak.Shared/Models/Mods/GuildWarsStartingDisabledContext.cs index e4f8f8a9..9d70f34b 100644 --- a/Daybreak/Models/Mods/GuildWarsStartingDisabledContext.cs +++ b/Daybreak.Shared/Models/Mods/GuildWarsStartingDisabledContext.cs @@ -1,4 +1,6 @@ -namespace Daybreak.Models.Mods; +using Daybreak.Shared.Models; + +namespace Daybreak.Shared.Models.Mods; public sealed class GuildWarsStartingDisabledContext { public ApplicationLauncherContext ApplicationLauncherContext { get; init; } diff --git a/Daybreak/Models/Notifications/Handling/INotificationHandler.cs b/Daybreak.Shared/Models/Notifications/Handling/INotificationHandler.cs similarity index 61% rename from Daybreak/Models/Notifications/Handling/INotificationHandler.cs rename to Daybreak.Shared/Models/Notifications/Handling/INotificationHandler.cs index 7cf19e37..a2e7ac32 100644 --- a/Daybreak/Models/Notifications/Handling/INotificationHandler.cs +++ b/Daybreak.Shared/Models/Notifications/Handling/INotificationHandler.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Notifications.Handling; +namespace Daybreak.Shared.Models.Notifications.Handling; public interface INotificationHandler { diff --git a/Daybreak/Models/Notifications/ICancellableNotification.cs b/Daybreak.Shared/Models/Notifications/ICancellableNotification.cs similarity index 73% rename from Daybreak/Models/Notifications/ICancellableNotification.cs rename to Daybreak.Shared/Models/Notifications/ICancellableNotification.cs index d0c4f8fd..722bc38b 100644 --- a/Daybreak/Models/Notifications/ICancellableNotification.cs +++ b/Daybreak.Shared/Models/Notifications/ICancellableNotification.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Notifications; +namespace Daybreak.Shared.Models.Notifications; internal interface ICancellableNotification : INotification { diff --git a/Daybreak/Models/Notifications/INotification.cs b/Daybreak.Shared/Models/Notifications/INotification.cs similarity index 87% rename from Daybreak/Models/Notifications/INotification.cs rename to Daybreak.Shared/Models/Notifications/INotification.cs index cc7894d8..19c1333b 100644 --- a/Daybreak/Models/Notifications/INotification.cs +++ b/Daybreak.Shared/Models/Notifications/INotification.cs @@ -1,7 +1,7 @@ using Microsoft.Extensions.Logging; using System; -namespace Daybreak.Models.Notifications; +namespace Daybreak.Shared.Models.Notifications; internal interface INotification { diff --git a/Daybreak/Models/Notifications/Notification.cs b/Daybreak.Shared/Models/Notifications/Notification.cs similarity index 89% rename from Daybreak/Models/Notifications/Notification.cs rename to Daybreak.Shared/Models/Notifications/Notification.cs index 7ad6ae8b..e24d969b 100644 --- a/Daybreak/Models/Notifications/Notification.cs +++ b/Daybreak.Shared/Models/Notifications/Notification.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Notifications.Handling; +using Daybreak.Shared.Models.Notifications.Handling; using Microsoft.Extensions.Logging; using System; -namespace Daybreak.Models.Notifications; +namespace Daybreak.Shared.Models.Notifications; public class Notification : ICancellableNotification { diff --git a/Daybreak/Models/Notifications/NotificationCancellationToken.cs b/Daybreak.Shared/Models/Notifications/NotificationCancellationToken.cs similarity index 91% rename from Daybreak/Models/Notifications/NotificationCancellationToken.cs rename to Daybreak.Shared/Models/Notifications/NotificationCancellationToken.cs index 2bb5ccf5..756cdb97 100644 --- a/Daybreak/Models/Notifications/NotificationCancellationToken.cs +++ b/Daybreak.Shared/Models/Notifications/NotificationCancellationToken.cs @@ -2,7 +2,7 @@ using System.Core.Extensions; using System.Extensions; -namespace Daybreak.Models.Notifications; +namespace Daybreak.Shared.Models.Notifications; public readonly struct NotificationToken { diff --git a/Daybreak/Models/Notifications/NotificationWrapper.cs b/Daybreak.Shared/Models/Notifications/NotificationWrapper.cs similarity index 87% rename from Daybreak/Models/Notifications/NotificationWrapper.cs rename to Daybreak.Shared/Models/Notifications/NotificationWrapper.cs index f3171428..689039fc 100644 --- a/Daybreak/Models/Notifications/NotificationWrapper.cs +++ b/Daybreak.Shared/Models/Notifications/NotificationWrapper.cs @@ -1,6 +1,6 @@ using System.Windows.Threading; -namespace Daybreak.Models.Notifications; +namespace Daybreak.Shared.Models.Notifications; public sealed class NotificationWrapper { public string? Title { get => this.Notification?.Title; } diff --git a/Daybreak/Models/Onboarding/LauncherOnboardingStage.cs b/Daybreak.Shared/Models/Onboarding/LauncherOnboardingStage.cs similarity index 73% rename from Daybreak/Models/Onboarding/LauncherOnboardingStage.cs rename to Daybreak.Shared/Models/Onboarding/LauncherOnboardingStage.cs index 14900ea1..25e15b76 100644 --- a/Daybreak/Models/Onboarding/LauncherOnboardingStage.cs +++ b/Daybreak.Shared/Models/Onboarding/LauncherOnboardingStage.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Onboarding; +namespace Daybreak.Shared.Models.Onboarding; public enum LauncherOnboardingStage { diff --git a/Daybreak/Models/Options/OptionEntry.cs b/Daybreak.Shared/Models/Options/OptionEntry.cs similarity index 85% rename from Daybreak/Models/Options/OptionEntry.cs rename to Daybreak.Shared/Models/Options/OptionEntry.cs index f00b1545..8467f52c 100644 --- a/Daybreak/Models/Options/OptionEntry.cs +++ b/Daybreak.Shared/Models/Options/OptionEntry.cs @@ -1,6 +1,6 @@ using System.Windows.Controls; -namespace Daybreak.Models.Options; +namespace Daybreak.Shared.Models.Options; public sealed class OptionEntry { public OptionHeading Heading { get; init; } = default!; diff --git a/Daybreak/Models/Options/OptionHeading.cs b/Daybreak.Shared/Models/Options/OptionHeading.cs similarity index 81% rename from Daybreak/Models/Options/OptionHeading.cs rename to Daybreak.Shared/Models/Options/OptionHeading.cs index ac713175..b6657102 100644 --- a/Daybreak/Models/Options/OptionHeading.cs +++ b/Daybreak.Shared/Models/Options/OptionHeading.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Options; +namespace Daybreak.Shared.Models.Options; public sealed class OptionHeading { diff --git a/Daybreak/Models/Options/OptionProperty.cs b/Daybreak.Shared/Models/Options/OptionProperty.cs similarity index 91% rename from Daybreak/Models/Options/OptionProperty.cs rename to Daybreak.Shared/Models/Options/OptionProperty.cs index 42f53ec5..f9bdc362 100644 --- a/Daybreak/Models/Options/OptionProperty.cs +++ b/Daybreak.Shared/Models/Options/OptionProperty.cs @@ -1,9 +1,9 @@ -using Daybreak.Validators; +using Daybreak.Shared.Validators; using System; using System.ComponentModel; using System.Core.Extensions; -namespace Daybreak.Models.Options; +namespace Daybreak.Shared.Models.Options; public sealed class OptionProperty { public string Name { get; } diff --git a/Daybreak/Models/Options/OptionSection.cs b/Daybreak.Shared/Models/Options/OptionSection.cs similarity index 80% rename from Daybreak/Models/Options/OptionSection.cs rename to Daybreak.Shared/Models/Options/OptionSection.cs index 265af24e..be7228e2 100644 --- a/Daybreak/Models/Options/OptionSection.cs +++ b/Daybreak.Shared/Models/Options/OptionSection.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models.Options; +namespace Daybreak.Shared.Models.Options; public sealed class OptionSection { public string? Name { get; init; } diff --git a/Daybreak/Models/Options/OptionSetter.cs b/Daybreak.Shared/Models/Options/OptionSetter.cs similarity index 84% rename from Daybreak/Models/Options/OptionSetter.cs rename to Daybreak.Shared/Models/Options/OptionSetter.cs index cad00990..94412a1d 100644 --- a/Daybreak/Models/Options/OptionSetter.cs +++ b/Daybreak.Shared/Models/Options/OptionSetter.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models.Options; +namespace Daybreak.Shared.Models.Options; public sealed class OptionSetter { diff --git a/Daybreak/Models/Plugins/AvailablePlugin.cs b/Daybreak.Shared/Models/Plugins/AvailablePlugin.cs similarity index 80% rename from Daybreak/Models/Plugins/AvailablePlugin.cs rename to Daybreak.Shared/Models/Plugins/AvailablePlugin.cs index 5ddbd863..90439a31 100644 --- a/Daybreak/Models/Plugins/AvailablePlugin.cs +++ b/Daybreak.Shared/Models/Plugins/AvailablePlugin.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Plugins; +namespace Daybreak.Shared.Models.Plugins; public sealed class AvailablePlugin { diff --git a/Daybreak/Models/Plugins/PluginConfigurationBase.cs b/Daybreak.Shared/Models/Plugins/PluginConfigurationBase.cs similarity index 75% rename from Daybreak/Models/Plugins/PluginConfigurationBase.cs rename to Daybreak.Shared/Models/Plugins/PluginConfigurationBase.cs index 67da9774..18516b27 100644 --- a/Daybreak/Models/Plugins/PluginConfigurationBase.cs +++ b/Daybreak.Shared/Models/Plugins/PluginConfigurationBase.cs @@ -1,25 +1,23 @@ -using Daybreak.Services.ApplicationArguments; -using Daybreak.Services.Browser; -using Daybreak.Services.Database; -using Daybreak.Services.Menu; -using Daybreak.Services.Metrics; -using Daybreak.Services.Mods; -using Daybreak.Services.Navigation; -using Daybreak.Services.Notifications; -using Daybreak.Services.Options; -using Daybreak.Services.Startup; -using Daybreak.Services.Updater.PostUpdate; -using Daybreak.Utils; +using Daybreak.Shared.Services.ApplicationArguments; +using Daybreak.Shared.Services.Browser; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Services.Metrics; +using Daybreak.Shared.Services.Mods; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Options; +using Daybreak.Shared.Services.Startup; +using Daybreak.Shared.Services.Updater.PostUpdate; +using Daybreak.Shared.Utils; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Http.Logging; using Microsoft.Extensions.Logging; -using Realms; using Slim; using System.Core.Extensions; using System.Net.Http; using System.Net.Http.Headers; -namespace Daybreak.Models.Plugins; +namespace Daybreak.Shared.Shared.Models.Plugins; public abstract class PluginConfigurationBase { @@ -41,15 +39,6 @@ public abstract class PluginConfigurationBase public PluginConfigurationBase() { } - - public void RegisterCollection(IServiceCollection services) - where TCollectionType : RealmObject, new() - { - services.AddScoped>(sp => - { - return new RealmDatabaseCollection(); - }); - } public HttpMessageHandler SetupLoggingAndMetrics(System.IServiceProvider serviceProvider) { diff --git a/Daybreak/Services/Updater/PostUpdate/PostUpdateActionBase.cs b/Daybreak.Shared/Models/PostUpdateActionBase.cs similarity index 83% rename from Daybreak/Services/Updater/PostUpdate/PostUpdateActionBase.cs rename to Daybreak.Shared/Models/PostUpdateActionBase.cs index 1ad70e70..b3421ddb 100644 --- a/Daybreak/Services/Updater/PostUpdate/PostUpdateActionBase.cs +++ b/Daybreak.Shared/Models/PostUpdateActionBase.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Daybreak.Services.Updater.PostUpdate; +namespace Daybreak.Shared.Models; public abstract class PostUpdateActionBase { diff --git a/Daybreak/Models/Progress/ActionStatus.cs b/Daybreak.Shared/Models/Progress/ActionStatus.cs similarity index 91% rename from Daybreak/Models/Progress/ActionStatus.cs rename to Daybreak.Shared/Models/Progress/ActionStatus.cs index 9211d9b4..e812c8ec 100644 --- a/Daybreak/Models/Progress/ActionStatus.cs +++ b/Daybreak.Shared/Models/Progress/ActionStatus.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public abstract class ActionStatus : INotifyPropertyChanged { diff --git a/Daybreak/Models/Progress/CopyStatus.cs b/Daybreak.Shared/Models/Progress/CopyStatus.cs similarity index 95% rename from Daybreak/Models/Progress/CopyStatus.cs rename to Daybreak.Shared/Models/Progress/CopyStatus.cs index d3b64b6b..5abf5aef 100644 --- a/Daybreak/Models/Progress/CopyStatus.cs +++ b/Daybreak.Shared/Models/Progress/CopyStatus.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class CopyStatus : ActionStatus { diff --git a/Daybreak/Models/Progress/DSOALInstallationStatus.cs b/Daybreak.Shared/Models/Progress/DSOALInstallationStatus.cs similarity index 94% rename from Daybreak/Models/Progress/DSOALInstallationStatus.cs rename to Daybreak.Shared/Models/Progress/DSOALInstallationStatus.cs index 980acbfd..89446eeb 100644 --- a/Daybreak/Models/Progress/DSOALInstallationStatus.cs +++ b/Daybreak.Shared/Models/Progress/DSOALInstallationStatus.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class DSOALInstallationStatus : DownloadStatus { public static readonly LoadStatus StartingStep = new DSOALInstallationStep("Starting"); diff --git a/Daybreak/Models/Progress/DirectSongInstallationStatus.cs b/Daybreak.Shared/Models/Progress/DirectSongInstallationStatus.cs similarity index 96% rename from Daybreak/Models/Progress/DirectSongInstallationStatus.cs rename to Daybreak.Shared/Models/Progress/DirectSongInstallationStatus.cs index bce9c616..57453162 100644 --- a/Daybreak/Models/Progress/DirectSongInstallationStatus.cs +++ b/Daybreak.Shared/Models/Progress/DirectSongInstallationStatus.cs @@ -1,5 +1,4 @@ - -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class DirectSongInstallationStatus : DownloadStatus { public static readonly LoadStatus StartingStep = new DirectSongInstallationStep("Starting"); diff --git a/Daybreak/Models/Progress/DownloadStatus.cs b/Daybreak.Shared/Models/Progress/DownloadStatus.cs similarity index 96% rename from Daybreak/Models/Progress/DownloadStatus.cs rename to Daybreak.Shared/Models/Progress/DownloadStatus.cs index 4aa38dc0..0e5f92d9 100644 --- a/Daybreak/Models/Progress/DownloadStatus.cs +++ b/Daybreak.Shared/Models/Progress/DownloadStatus.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public abstract class DownloadStatus : ActionStatus { diff --git a/Daybreak/Models/Progress/GuildwarsInstallationStatus.cs b/Daybreak.Shared/Models/Progress/GuildwarsInstallationStatus.cs similarity index 97% rename from Daybreak/Models/Progress/GuildwarsInstallationStatus.cs rename to Daybreak.Shared/Models/Progress/GuildwarsInstallationStatus.cs index e71a447d..24b12dfc 100644 --- a/Daybreak/Models/Progress/GuildwarsInstallationStatus.cs +++ b/Daybreak.Shared/Models/Progress/GuildwarsInstallationStatus.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class GuildwarsInstallationStatus : DownloadStatus { public static readonly LoadStatus StartingStep = new GuildwarsInstallationStep("Starting"); diff --git a/Daybreak/Models/Progress/IconDownloadStatus.cs b/Daybreak.Shared/Models/Progress/IconDownloadStatus.cs similarity index 98% rename from Daybreak/Models/Progress/IconDownloadStatus.cs rename to Daybreak.Shared/Models/Progress/IconDownloadStatus.cs index 60c0e0b3..70f03363 100644 --- a/Daybreak/Models/Progress/IconDownloadStatus.cs +++ b/Daybreak.Shared/Models/Progress/IconDownloadStatus.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class IconDownloadStatus : INotifyPropertyChanged { diff --git a/Daybreak/Models/Progress/LoadStatus.cs b/Daybreak.Shared/Models/Progress/LoadStatus.cs similarity index 82% rename from Daybreak/Models/Progress/LoadStatus.cs rename to Daybreak.Shared/Models/Progress/LoadStatus.cs index d8069749..61d85e96 100644 --- a/Daybreak/Models/Progress/LoadStatus.cs +++ b/Daybreak.Shared/Models/Progress/LoadStatus.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public abstract class LoadStatus { diff --git a/Daybreak/Models/Progress/ReShadeInstallationStatus.cs b/Daybreak.Shared/Models/Progress/ReShadeInstallationStatus.cs similarity index 94% rename from Daybreak/Models/Progress/ReShadeInstallationStatus.cs rename to Daybreak.Shared/Models/Progress/ReShadeInstallationStatus.cs index fb16f772..89b00c42 100644 --- a/Daybreak/Models/Progress/ReShadeInstallationStatus.cs +++ b/Daybreak.Shared/Models/Progress/ReShadeInstallationStatus.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class ReShadeInstallationStatus : DownloadStatus { public static readonly LoadStatus StartingStep = new ReShadeInstallationStep("Starting"); diff --git a/Daybreak/Models/Progress/StartupStatus.cs b/Daybreak.Shared/Models/Progress/StartupStatus.cs similarity index 95% rename from Daybreak/Models/Progress/StartupStatus.cs rename to Daybreak.Shared/Models/Progress/StartupStatus.cs index e4b893c9..afba9037 100644 --- a/Daybreak/Models/Progress/StartupStatus.cs +++ b/Daybreak.Shared/Models/Progress/StartupStatus.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class StartupStatus : INotifyPropertyChanged { diff --git a/Daybreak/Models/Progress/ToolboxInstallationStatus.cs b/Daybreak.Shared/Models/Progress/ToolboxInstallationStatus.cs similarity index 91% rename from Daybreak/Models/Progress/ToolboxInstallationStatus.cs rename to Daybreak.Shared/Models/Progress/ToolboxInstallationStatus.cs index d81fb2f4..9fae4ef7 100644 --- a/Daybreak/Models/Progress/ToolboxInstallationStatus.cs +++ b/Daybreak.Shared/Models/Progress/ToolboxInstallationStatus.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class ToolboxInstallationStatus : DownloadStatus { public static readonly LoadStatus StartingStep = new ToolboxInstallationStep("Starting"); diff --git a/Daybreak/Models/Progress/UModInstallationStatus.cs b/Daybreak.Shared/Models/Progress/UModInstallationStatus.cs similarity index 94% rename from Daybreak/Models/Progress/UModInstallationStatus.cs rename to Daybreak.Shared/Models/Progress/UModInstallationStatus.cs index 5e10fa8b..844f79a0 100644 --- a/Daybreak/Models/Progress/UModInstallationStatus.cs +++ b/Daybreak.Shared/Models/Progress/UModInstallationStatus.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class UModInstallationStatus : DownloadStatus { public static readonly LoadStatus StartingStep = new UModInstallationStep("Starting"); diff --git a/Daybreak/Models/Progress/UpdateStatus.cs b/Daybreak.Shared/Models/Progress/UpdateStatus.cs similarity index 92% rename from Daybreak/Models/Progress/UpdateStatus.cs rename to Daybreak.Shared/Models/Progress/UpdateStatus.cs index 451b09ba..aa4af922 100644 --- a/Daybreak/Models/Progress/UpdateStatus.cs +++ b/Daybreak.Shared/Models/Progress/UpdateStatus.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Progress; +namespace Daybreak.Shared.Models.Progress; public sealed class UpdateStatus : DownloadStatus { diff --git a/Daybreak/Models/ProtectedLoginCredentials.cs b/Daybreak.Shared/Models/ProtectedLoginCredentials.cs similarity index 91% rename from Daybreak/Models/ProtectedLoginCredentials.cs rename to Daybreak.Shared/Models/ProtectedLoginCredentials.cs index d0f557b3..efe7e808 100644 --- a/Daybreak/Models/ProtectedLoginCredentials.cs +++ b/Daybreak.Shared/Models/ProtectedLoginCredentials.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class ProtectedLoginCredentials { diff --git a/Daybreak/Models/ReShade/ShaderPackage.cs b/Daybreak.Shared/Models/ReShade/ShaderPackage.cs similarity index 91% rename from Daybreak/Models/ReShade/ShaderPackage.cs rename to Daybreak.Shared/Models/ReShade/ShaderPackage.cs index f3fb8e9e..47cac92b 100644 --- a/Daybreak/Models/ReShade/ShaderPackage.cs +++ b/Daybreak.Shared/Models/ReShade/ShaderPackage.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Models.ReShade; +namespace Daybreak.Shared.Models.ReShade; public sealed class ShaderPackage { diff --git a/Daybreak/Models/ScopeMetadata.cs b/Daybreak.Shared/Models/ScopeMetadata.cs similarity index 88% rename from Daybreak/Models/ScopeMetadata.cs rename to Daybreak.Shared/Models/ScopeMetadata.cs index d58e2ebc..b8e5ea25 100644 --- a/Daybreak/Models/ScopeMetadata.cs +++ b/Daybreak.Shared/Models/ScopeMetadata.cs @@ -1,6 +1,6 @@ using Microsoft.CorrelationVector; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public class ScopeMetadata { diff --git a/Daybreak/Models/Screen.cs b/Daybreak.Shared/Models/Screen.cs similarity index 78% rename from Daybreak/Models/Screen.cs rename to Daybreak.Shared/Models/Screen.cs index 46a7995c..6e3cef53 100644 --- a/Daybreak/Models/Screen.cs +++ b/Daybreak.Shared/Models/Screen.cs @@ -1,6 +1,6 @@ using System.Windows; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class Screen { diff --git a/Daybreak/Models/SecureString.cs b/Daybreak.Shared/Models/SecureString.cs similarity index 98% rename from Daybreak/Models/SecureString.cs rename to Daybreak.Shared/Models/SecureString.cs index 007f9355..bee11831 100644 --- a/Daybreak/Models/SecureString.cs +++ b/Daybreak.Shared/Models/SecureString.cs @@ -1,10 +1,10 @@ -using Daybreak.Utils; +using Daybreak.Shared.Utils; using Newtonsoft.Json; using System; using System.Linq; using System.Security.Cryptography; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; [Serializable] public sealed class SecureString diff --git a/Daybreak/Models/SortedObservableCollection.cs b/Daybreak.Shared/Models/SortedObservableCollection.cs similarity index 97% rename from Daybreak/Models/SortedObservableCollection.cs rename to Daybreak.Shared/Models/SortedObservableCollection.cs index bbf19bc6..3bf229f1 100644 --- a/Daybreak/Models/SortedObservableCollection.cs +++ b/Daybreak.Shared/Models/SortedObservableCollection.cs @@ -2,7 +2,7 @@ using System; using System.Linq; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public class SortedObservableCollection : BatchedObservableCollection { diff --git a/Daybreak/Services/Startup/Actions/StartupActionBase.cs b/Daybreak.Shared/Models/StartupActionBase.cs similarity index 86% rename from Daybreak/Services/Startup/Actions/StartupActionBase.cs rename to Daybreak.Shared/Models/StartupActionBase.cs index 4c24080e..b5913335 100644 --- a/Daybreak/Services/Startup/Actions/StartupActionBase.cs +++ b/Daybreak.Shared/Models/StartupActionBase.cs @@ -1,7 +1,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Startup.Actions; +namespace Daybreak.Shared.Models; public abstract class StartupActionBase { diff --git a/Daybreak/Models/SynchronizationBuild.cs b/Daybreak.Shared/Models/SynchronizationBuild.cs similarity index 81% rename from Daybreak/Models/SynchronizationBuild.cs rename to Daybreak.Shared/Models/SynchronizationBuild.cs index a950c52f..f8d325f6 100644 --- a/Daybreak/Models/SynchronizationBuild.cs +++ b/Daybreak.Shared/Models/SynchronizationBuild.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class SynchronizationBuild { diff --git a/Daybreak/Models/Trade/ITradeAlert.cs b/Daybreak.Shared/Models/Trade/ITradeAlert.cs similarity index 73% rename from Daybreak/Models/Trade/ITradeAlert.cs rename to Daybreak.Shared/Models/Trade/ITradeAlert.cs index 33e797ce..a6759f30 100644 --- a/Daybreak/Models/Trade/ITradeAlert.cs +++ b/Daybreak.Shared/Models/Trade/ITradeAlert.cs @@ -1,7 +1,7 @@ -using Daybreak.Converters; +using Daybreak.Shared.Converters; using Newtonsoft.Json; -namespace Daybreak.Models.Trade; +namespace Daybreak.Shared.Models.Trade; [JsonConverter(typeof(TradeAlertConverter))] public interface ITradeAlert diff --git a/Daybreak/Models/Trade/QuoteAlert.cs b/Daybreak.Shared/Models/Trade/QuoteAlert.cs similarity index 84% rename from Daybreak/Models/Trade/QuoteAlert.cs rename to Daybreak.Shared/Models/Trade/QuoteAlert.cs index bf7e7ed4..b7518f7f 100644 --- a/Daybreak/Models/Trade/QuoteAlert.cs +++ b/Daybreak.Shared/Models/Trade/QuoteAlert.cs @@ -1,7 +1,6 @@ -using Daybreak.Services.TradeChat.Models; -using System; +using System; -namespace Daybreak.Models.Trade; +namespace Daybreak.Shared.Models.Trade; public sealed class QuoteAlert : ITradeAlert { public string Id { get; set; } = Guid.NewGuid().ToString(); diff --git a/Daybreak/Models/Trade/TradeAlert.cs b/Daybreak.Shared/Models/Trade/TradeAlert.cs similarity index 91% rename from Daybreak/Models/Trade/TradeAlert.cs rename to Daybreak.Shared/Models/Trade/TradeAlert.cs index 2ab489d9..dd654cc7 100644 --- a/Daybreak/Models/Trade/TradeAlert.cs +++ b/Daybreak.Shared/Models/Trade/TradeAlert.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models.Trade; +namespace Daybreak.Shared.Models.Trade; public sealed class TradeAlert : ITradeAlert { public string Id { get; set; } = Guid.NewGuid().ToString(); diff --git a/Daybreak/Models/Trade/TraderMessage.cs b/Daybreak.Shared/Models/Trade/TraderMessage.cs similarity index 94% rename from Daybreak/Models/Trade/TraderMessage.cs rename to Daybreak.Shared/Models/Trade/TraderMessage.cs index a54f159a..b655ccda 100644 --- a/Daybreak/Models/Trade/TraderMessage.cs +++ b/Daybreak.Shared/Models/Trade/TraderMessage.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Models.Trade; +namespace Daybreak.Shared.Models.Trade; public sealed class TraderMessage : IEquatable { diff --git a/Daybreak/Models/Trade/TraderMessageViewWrapper.cs b/Daybreak.Shared/Models/Trade/TraderMessageViewWrapper.cs similarity index 97% rename from Daybreak/Models/Trade/TraderMessageViewWrapper.cs rename to Daybreak.Shared/Models/Trade/TraderMessageViewWrapper.cs index 605e2e15..020735e3 100644 --- a/Daybreak/Models/Trade/TraderMessageViewWrapper.cs +++ b/Daybreak.Shared/Models/Trade/TraderMessageViewWrapper.cs @@ -2,7 +2,7 @@ using System.ComponentModel; using System.Windows.Threading; -namespace Daybreak.Models.Trade; +namespace Daybreak.Shared.Models.Trade; public sealed class TraderMessageViewWrapper : INotifyPropertyChanged { diff --git a/Daybreak/Models/Trade/TraderQuote.cs b/Daybreak.Shared/Models/Trade/TraderQuote.cs similarity index 67% rename from Daybreak/Models/Trade/TraderQuote.cs rename to Daybreak.Shared/Models/Trade/TraderQuote.cs index 49a9d91f..0ceb79b9 100644 --- a/Daybreak/Models/Trade/TraderQuote.cs +++ b/Daybreak.Shared/Models/Trade/TraderQuote.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; -namespace Daybreak.Models.Trade; +namespace Daybreak.Shared.Models.Trade; public sealed class TraderQuote { diff --git a/Daybreak/Services/TradeChat/Models/TraderQuoteType.cs b/Daybreak.Shared/Models/Trade/TraderQuoteType.cs similarity index 50% rename from Daybreak/Services/TradeChat/Models/TraderQuoteType.cs rename to Daybreak.Shared/Models/Trade/TraderQuoteType.cs index f39eeea7..43da3775 100644 --- a/Daybreak/Services/TradeChat/Models/TraderQuoteType.cs +++ b/Daybreak.Shared/Models/Trade/TraderQuoteType.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.TradeChat.Models; +namespace Daybreak.Shared.Models.Trade; public enum TraderQuoteType { Buy, diff --git a/Daybreak/Models/UMod/UModEntry.cs b/Daybreak.Shared/Models/UMod/UModEntry.cs similarity index 82% rename from Daybreak/Models/UMod/UModEntry.cs rename to Daybreak.Shared/Models/UMod/UModEntry.cs index 0a1c641e..c0529a7e 100644 --- a/Daybreak/Models/UMod/UModEntry.cs +++ b/Daybreak.Shared/Models/UMod/UModEntry.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.UMod; +namespace Daybreak.Shared.Models.UMod; public sealed class UModEntry { diff --git a/Daybreak/Models/Versioning/Version.cs b/Daybreak.Shared/Models/Versioning/Version.cs similarity index 99% rename from Daybreak/Models/Versioning/Version.cs rename to Daybreak.Shared/Models/Versioning/Version.cs index 8392176d..6f823d15 100644 --- a/Daybreak/Models/Versioning/Version.cs +++ b/Daybreak.Shared/Models/Versioning/Version.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Extensions; using System.Linq; -namespace Daybreak.Models.Versioning; +namespace Daybreak.Shared.Models.Versioning; public sealed class Version : IEquatable, IComparable { diff --git a/Daybreak/Models/Versioning/VersionNumberToken.cs b/Daybreak.Shared/Models/Versioning/VersionNumberToken.cs similarity index 91% rename from Daybreak/Models/Versioning/VersionNumberToken.cs rename to Daybreak.Shared/Models/Versioning/VersionNumberToken.cs index 596b8278..5864315c 100644 --- a/Daybreak/Models/Versioning/VersionNumberToken.cs +++ b/Daybreak.Shared/Models/Versioning/VersionNumberToken.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Models.Versioning; +namespace Daybreak.Shared.Models.Versioning; public sealed class VersionNumberToken : VersionToken { diff --git a/Daybreak/Models/Versioning/VersionStringToken.cs b/Daybreak.Shared/Models/Versioning/VersionStringToken.cs similarity index 92% rename from Daybreak/Models/Versioning/VersionStringToken.cs rename to Daybreak.Shared/Models/Versioning/VersionStringToken.cs index e13907e6..1aeee369 100644 --- a/Daybreak/Models/Versioning/VersionStringToken.cs +++ b/Daybreak.Shared/Models/Versioning/VersionStringToken.cs @@ -1,6 +1,6 @@ using System.Core.Extensions; -namespace Daybreak.Models.Versioning; +namespace Daybreak.Shared.Models.Versioning; public sealed class VersionStringToken : VersionToken { diff --git a/Daybreak/Models/Versioning/VersionToken.cs b/Daybreak.Shared/Models/Versioning/VersionToken.cs similarity index 93% rename from Daybreak/Models/Versioning/VersionToken.cs rename to Daybreak.Shared/Models/Versioning/VersionToken.cs index 5a282953..747a4d28 100644 --- a/Daybreak/Models/Versioning/VersionToken.cs +++ b/Daybreak.Shared/Models/Versioning/VersionToken.cs @@ -1,7 +1,7 @@ using System; using System.Linq; -namespace Daybreak.Models.Versioning; +namespace Daybreak.Shared.Models.Versioning; public abstract class VersionToken { diff --git a/Daybreak/Models/Win32Window.cs b/Daybreak.Shared/Models/Win32Window.cs similarity index 78% rename from Daybreak/Models/Win32Window.cs rename to Daybreak.Shared/Models/Win32Window.cs index 9596c3dc..17f637c0 100644 --- a/Daybreak/Models/Win32Window.cs +++ b/Daybreak.Shared/Models/Win32Window.cs @@ -2,7 +2,7 @@ using System.Windows; using System.Windows.Interop; -namespace Daybreak.Models; +namespace Daybreak.Shared.Models; public sealed class Win32Window : System.Windows.Forms.IWin32Window { @@ -11,5 +11,5 @@ public sealed class Win32Window : System.Windows.Forms.IWin32Window this.Handle = new WindowInteropHelper(window).Handle; } - public IntPtr Handle { get; init; } + public nint Handle { get; init; } } diff --git a/Daybreak.Shared/Services/Api/IDaybreakApiService.cs b/Daybreak.Shared/Services/Api/IDaybreakApiService.cs new file mode 100644 index 00000000..29ea801c --- /dev/null +++ b/Daybreak.Shared/Services/Api/IDaybreakApiService.cs @@ -0,0 +1,6 @@ +using Daybreak.Shared.Services.Mods; + +namespace Daybreak.Shared.Services.Api; +public interface IDaybreakApiService : IModService +{ +} diff --git a/Daybreak/Services/ApplicationArguments/ArgumentHandling/IArgumentHandler.cs b/Daybreak.Shared/Services/ApplicationArguments/ArgumentHandling/IArgumentHandler.cs similarity index 66% rename from Daybreak/Services/ApplicationArguments/ArgumentHandling/IArgumentHandler.cs rename to Daybreak.Shared/Services/ApplicationArguments/ArgumentHandling/IArgumentHandler.cs index 0a4a6618..1e5baa91 100644 --- a/Daybreak/Services/ApplicationArguments/ArgumentHandling/IArgumentHandler.cs +++ b/Daybreak.Shared/Services/ApplicationArguments/ArgumentHandling/IArgumentHandler.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.ApplicationArguments.ArgumentHandling; +namespace Daybreak.Shared.Services.ApplicationArguments.ArgumentHandling; public interface IArgumentHandler { string Identifier { get; } diff --git a/Daybreak/Services/ApplicationArguments/IApplicationArgumentService.cs b/Daybreak.Shared/Services/ApplicationArguments/IApplicationArgumentService.cs similarity index 66% rename from Daybreak/Services/ApplicationArguments/IApplicationArgumentService.cs rename to Daybreak.Shared/Services/ApplicationArguments/IApplicationArgumentService.cs index 47afc2f8..7e845915 100644 --- a/Daybreak/Services/ApplicationArguments/IApplicationArgumentService.cs +++ b/Daybreak.Shared/Services/ApplicationArguments/IApplicationArgumentService.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.ApplicationArguments; +namespace Daybreak.Shared.Services.ApplicationArguments; public interface IApplicationArgumentService : IArgumentHandlerProducer { diff --git a/Daybreak.Shared/Services/ApplicationArguments/IArgumentHandlerProducer.cs b/Daybreak.Shared/Services/ApplicationArguments/IArgumentHandlerProducer.cs new file mode 100644 index 00000000..47faca90 --- /dev/null +++ b/Daybreak.Shared/Services/ApplicationArguments/IArgumentHandlerProducer.cs @@ -0,0 +1,9 @@ +using Daybreak.Shared.Services.ApplicationArguments.ArgumentHandling; + +namespace Daybreak.Shared.Services.ApplicationArguments; + +public interface IArgumentHandlerProducer +{ + void RegisterArgumentHandler() where + T : class, IArgumentHandler; +} diff --git a/Daybreak/Services/ApplicationLauncher/IApplicationLauncher.cs b/Daybreak.Shared/Services/ApplicationLauncher/IApplicationLauncher.cs similarity index 87% rename from Daybreak/Services/ApplicationLauncher/IApplicationLauncher.cs rename to Daybreak.Shared/Services/ApplicationLauncher/IApplicationLauncher.cs index fdc387ec..823e1886 100644 --- a/Daybreak/Services/ApplicationLauncher/IApplicationLauncher.cs +++ b/Daybreak.Shared/Services/ApplicationLauncher/IApplicationLauncher.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.LaunchConfigurations; +using Daybreak.Shared.Models.LaunchConfigurations; using System.Collections.Generic; using System.Diagnostics; using System.Threading.Tasks; -namespace Daybreak.Services.ApplicationLauncher; +namespace Daybreak.Shared.Services.ApplicationLauncher; public interface IApplicationLauncher { diff --git a/Daybreak/Services/Browser/IBrowserExtension.cs b/Daybreak.Shared/Services/Browser/IBrowserExtension.cs similarity index 81% rename from Daybreak/Services/Browser/IBrowserExtension.cs rename to Daybreak.Shared/Services/Browser/IBrowserExtension.cs index 1b748925..f5ddaea0 100644 --- a/Daybreak/Services/Browser/IBrowserExtension.cs +++ b/Daybreak.Shared/Services/Browser/IBrowserExtension.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Daybreak.Services.Browser; +namespace Daybreak.Shared.Services.Browser; public interface IBrowserExtension { diff --git a/Daybreak/Services/Browser/IBrowserExtensionsManager.cs b/Daybreak.Shared/Services/Browser/IBrowserExtensionsManager.cs similarity index 83% rename from Daybreak/Services/Browser/IBrowserExtensionsManager.cs rename to Daybreak.Shared/Services/Browser/IBrowserExtensionsManager.cs index e74a66f9..d7387b5e 100644 --- a/Daybreak/Services/Browser/IBrowserExtensionsManager.cs +++ b/Daybreak.Shared/Services/Browser/IBrowserExtensionsManager.cs @@ -1,7 +1,7 @@ using Microsoft.Web.WebView2.Core; using System.Threading.Tasks; -namespace Daybreak.Services.Browser; +namespace Daybreak.Shared.Services.Browser; public interface IBrowserExtensionsManager { diff --git a/Daybreak/Services/Browser/IBrowserExtensionsProducer.cs b/Daybreak.Shared/Services/Browser/IBrowserExtensionsProducer.cs similarity index 72% rename from Daybreak/Services/Browser/IBrowserExtensionsProducer.cs rename to Daybreak.Shared/Services/Browser/IBrowserExtensionsProducer.cs index c60185af..615c4d9f 100644 --- a/Daybreak/Services/Browser/IBrowserExtensionsProducer.cs +++ b/Daybreak.Shared/Services/Browser/IBrowserExtensionsProducer.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.Browser; +namespace Daybreak.Shared.Services.Browser; public interface IBrowserExtensionsProducer { void RegisterExtension() diff --git a/Daybreak/Services/BuildTemplates/IAttributePointCalculator.cs b/Daybreak.Shared/Services/BuildTemplates/IAttributePointCalculator.cs similarity index 72% rename from Daybreak/Services/BuildTemplates/IAttributePointCalculator.cs rename to Daybreak.Shared/Services/BuildTemplates/IAttributePointCalculator.cs index 4c54d600..e898ef4d 100644 --- a/Daybreak/Services/BuildTemplates/IAttributePointCalculator.cs +++ b/Daybreak.Shared/Services/BuildTemplates/IAttributePointCalculator.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Builds; -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Guildwars; -namespace Daybreak.Services.BuildTemplates; +namespace Daybreak.Shared.Services.BuildTemplates; public interface IAttributePointCalculator { diff --git a/Daybreak/Services/BuildTemplates/IBuildTemplateManager.cs b/Daybreak.Shared/Services/BuildTemplates/IBuildTemplateManager.cs similarity index 89% rename from Daybreak/Services/BuildTemplates/IBuildTemplateManager.cs rename to Daybreak.Shared/Services/BuildTemplates/IBuildTemplateManager.cs index 82f23e1d..f48eb4c0 100644 --- a/Daybreak/Services/BuildTemplates/IBuildTemplateManager.cs +++ b/Daybreak.Shared/Services/BuildTemplates/IBuildTemplateManager.cs @@ -1,11 +1,11 @@ -using Daybreak.Models.Builds; -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Guildwars; using System; using System.Collections.Generic; using System.Extensions; using System.Threading.Tasks; -namespace Daybreak.Services.BuildTemplates; +namespace Daybreak.Shared.Services.BuildTemplates; public interface IBuildTemplateManager { diff --git a/Daybreak/Services/Credentials/ICredentialManager.cs b/Daybreak.Shared/Services/Credentials/ICredentialManager.cs similarity index 80% rename from Daybreak/Services/Credentials/ICredentialManager.cs rename to Daybreak.Shared/Services/Credentials/ICredentialManager.cs index 08cf7c3d..8d4006b7 100644 --- a/Daybreak/Services/Credentials/ICredentialManager.cs +++ b/Daybreak.Shared/Services/Credentials/ICredentialManager.cs @@ -1,7 +1,7 @@ -using Daybreak.Models; +using Daybreak.Shared.Models; using System.Collections.Generic; -namespace Daybreak.Services.Credentials; +namespace Daybreak.Shared.Services.Credentials; public interface ICredentialManager { diff --git a/Daybreak/Services/DSOAL/IDSOALService.cs b/Daybreak.Shared/Services/DSOAL/IDSOALService.cs similarity index 62% rename from Daybreak/Services/DSOAL/IDSOALService.cs rename to Daybreak.Shared/Services/DSOAL/IDSOALService.cs index 8abe369f..e63b6e38 100644 --- a/Daybreak/Services/DSOAL/IDSOALService.cs +++ b/Daybreak.Shared/Services/DSOAL/IDSOALService.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.Mods; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Mods; using System.Threading.Tasks; -namespace Daybreak.Services.DSOAL; +namespace Daybreak.Shared.Services.DSOAL; public interface IDSOALService : IModService { diff --git a/Daybreak/Services/DirectSong/IDirectSongService.cs b/Daybreak.Shared/Services/DirectSong/IDirectSongService.cs similarity index 73% rename from Daybreak/Services/DirectSong/IDirectSongService.cs rename to Daybreak.Shared/Services/DirectSong/IDirectSongService.cs index 8ee6b9df..68e08a6c 100644 --- a/Daybreak/Services/DirectSong/IDirectSongService.cs +++ b/Daybreak.Shared/Services/DirectSong/IDirectSongService.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.Mods; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Mods; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.DirectSong; +namespace Daybreak.Shared.Services.DirectSong; public interface IDirectSongService : IModService { DirectSongInstallationStatus? CachedInstallationStatus { get; } diff --git a/Daybreak/Services/Downloads/IDownloadService.cs b/Daybreak.Shared/Services/Downloads/IDownloadService.cs similarity index 73% rename from Daybreak/Services/Downloads/IDownloadService.cs rename to Daybreak.Shared/Services/Downloads/IDownloadService.cs index 04dcfde1..98f4f9c4 100644 --- a/Daybreak/Services/Downloads/IDownloadService.cs +++ b/Daybreak.Shared/Services/Downloads/IDownloadService.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Progress; +using Daybreak.Shared.Models.Progress; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Downloads; +namespace Daybreak.Shared.Services.Downloads; public interface IDownloadService { diff --git a/Daybreak/Services/Events/IEventService.cs b/Daybreak.Shared/Services/Events/IEventService.cs similarity index 78% rename from Daybreak/Services/Events/IEventService.cs rename to Daybreak.Shared/Services/Events/IEventService.cs index 5a51f914..226d9b5e 100644 --- a/Daybreak/Services/Events/IEventService.cs +++ b/Daybreak.Shared/Services/Events/IEventService.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; using System.Collections.Generic; -namespace Daybreak.Services.Events; +namespace Daybreak.Shared.Services.Events; public interface IEventService { TimeOnly GetLocalizedEventStartTime(); diff --git a/Daybreak/Services/ExecutableManagement/IGuildWarsExecutableManager.cs b/Daybreak.Shared/Services/ExecutableManagement/IGuildWarsExecutableManager.cs similarity index 83% rename from Daybreak/Services/ExecutableManagement/IGuildWarsExecutableManager.cs rename to Daybreak.Shared/Services/ExecutableManagement/IGuildWarsExecutableManager.cs index 911ec89f..6e0658f5 100644 --- a/Daybreak/Services/ExecutableManagement/IGuildWarsExecutableManager.cs +++ b/Daybreak.Shared/Services/ExecutableManagement/IGuildWarsExecutableManager.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Services.ExecutableManagement; +namespace Daybreak.Shared.Services.ExecutableManagement; public interface IGuildWarsExecutableManager { void AddExecutable(string executablePath); diff --git a/Daybreak/Services/Experience/IExperienceCalculator.cs b/Daybreak.Shared/Services/Experience/IExperienceCalculator.cs similarity index 86% rename from Daybreak/Services/Experience/IExperienceCalculator.cs rename to Daybreak.Shared/Services/Experience/IExperienceCalculator.cs index 0b70c705..c50bc40d 100644 --- a/Daybreak/Services/Experience/IExperienceCalculator.cs +++ b/Daybreak.Shared/Services/Experience/IExperienceCalculator.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.Experience; +namespace Daybreak.Shared.Services.Experience; public interface IExperienceCalculator { diff --git a/Daybreak/Services/Guildwars/IGuildWarsVersionChecker.cs b/Daybreak.Shared/Services/Guildwars/IGuildWarsVersionChecker.cs similarity index 60% rename from Daybreak/Services/Guildwars/IGuildWarsVersionChecker.cs rename to Daybreak.Shared/Services/Guildwars/IGuildWarsVersionChecker.cs index 6ad9839f..3fe0cbc3 100644 --- a/Daybreak/Services/Guildwars/IGuildWarsVersionChecker.cs +++ b/Daybreak.Shared/Services/Guildwars/IGuildWarsVersionChecker.cs @@ -1,7 +1,7 @@ -using Daybreak.Services.Mods; +using Daybreak.Shared.Services.Mods; using System.Windows.Extensions.Services; -namespace Daybreak.Services.Guildwars; +namespace Daybreak.Shared.Services.Guildwars; public interface IGuildWarsVersionChecker : IModService, IApplicationLifetimeService { } diff --git a/Daybreak/Services/Guildwars/IGuildwarsCopyService.cs b/Daybreak.Shared/Services/Guildwars/IGuildwarsCopyService.cs similarity index 70% rename from Daybreak/Services/Guildwars/IGuildwarsCopyService.cs rename to Daybreak.Shared/Services/Guildwars/IGuildwarsCopyService.cs index 1c5484e5..b0394e78 100644 --- a/Daybreak/Services/Guildwars/IGuildwarsCopyService.cs +++ b/Daybreak.Shared/Services/Guildwars/IGuildwarsCopyService.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Progress; +using Daybreak.Shared.Models.Progress; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Guildwars; +namespace Daybreak.Shared.Services.Guildwars; public interface IGuildWarsCopyService { diff --git a/Daybreak/Services/Guildwars/IGuildwarsInstaller.cs b/Daybreak.Shared/Services/Guildwars/IGuildwarsInstaller.cs similarity index 85% rename from Daybreak/Services/Guildwars/IGuildwarsInstaller.cs rename to Daybreak.Shared/Services/Guildwars/IGuildwarsInstaller.cs index 580bd550..669e08c6 100644 --- a/Daybreak/Services/Guildwars/IGuildwarsInstaller.cs +++ b/Daybreak.Shared/Services/Guildwars/IGuildwarsInstaller.cs @@ -1,10 +1,10 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.Guildwars.Models; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Progress; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Guildwars; +namespace Daybreak.Shared.Services.Guildwars; public interface IGuildWarsInstaller { Task UpdateGuildwars(string exePath, GuildwarsInstallationStatus installationStatus, CancellationToken cancellationToken); diff --git a/Daybreak/Services/IconRetrieve/IIconCache.cs b/Daybreak.Shared/Services/IconRetrieve/IIconCache.cs similarity index 66% rename from Daybreak/Services/IconRetrieve/IIconCache.cs rename to Daybreak.Shared/Services/IconRetrieve/IIconCache.cs index d3cb4d7b..db67209f 100644 --- a/Daybreak/Services/IconRetrieve/IIconCache.cs +++ b/Daybreak.Shared/Services/IconRetrieve/IIconCache.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System.Threading.Tasks; -namespace Daybreak.Services.IconRetrieve; +namespace Daybreak.Shared.Services.IconRetrieve; public interface IIconCache { diff --git a/Daybreak/Services/Images/IImageCache.cs b/Daybreak.Shared/Services/Images/IImageCache.cs similarity index 76% rename from Daybreak/Services/Images/IImageCache.cs rename to Daybreak.Shared/Services/Images/IImageCache.cs index 8fefa0f3..a2b1527b 100644 --- a/Daybreak/Services/Images/IImageCache.cs +++ b/Daybreak.Shared/Services/Images/IImageCache.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using System.Windows.Media; -namespace Daybreak.Services.Images; +namespace Daybreak.Shared.Services.Images; public interface IImageCache { diff --git a/Daybreak/Services/Injection/IProcessInjector.cs b/Daybreak.Shared/Services/Injection/IProcessInjector.cs similarity index 82% rename from Daybreak/Services/Injection/IProcessInjector.cs rename to Daybreak.Shared/Services/Injection/IProcessInjector.cs index 16682eaa..433f2df4 100644 --- a/Daybreak/Services/Injection/IProcessInjector.cs +++ b/Daybreak.Shared/Services/Injection/IProcessInjector.cs @@ -2,7 +2,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Injection; +namespace Daybreak.Shared.Services.Injection; public interface IProcessInjector { Task Inject(Process process, string pathToDll, CancellationToken cancellationToken); diff --git a/Daybreak.Shared/Services/Injection/IStubInjector.cs b/Daybreak.Shared/Services/Injection/IStubInjector.cs new file mode 100644 index 00000000..03d78891 --- /dev/null +++ b/Daybreak.Shared/Services/Injection/IStubInjector.cs @@ -0,0 +1,7 @@ +using System.Diagnostics; + +namespace Daybreak.Shared.Services.Injection; +public interface IStubInjector +{ + bool Inject(Process target, string dllPath, out int exitCode); +} diff --git a/Daybreak/Services/InternetChecker/IConnectivityStatus.cs b/Daybreak.Shared/Services/InternetChecker/IConnectivityStatus.cs similarity index 59% rename from Daybreak/Services/InternetChecker/IConnectivityStatus.cs rename to Daybreak.Shared/Services/InternetChecker/IConnectivityStatus.cs index 35e07219..b0584b88 100644 --- a/Daybreak/Services/InternetChecker/IConnectivityStatus.cs +++ b/Daybreak.Shared/Services/InternetChecker/IConnectivityStatus.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.InternetChecker; +namespace Daybreak.Shared.Services.InternetChecker; public interface IConnectivityStatus { diff --git a/Daybreak/Services/InternetChecker/IInternetCheckingService.cs b/Daybreak.Shared/Services/InternetChecker/IInternetCheckingService.cs similarity index 55% rename from Daybreak/Services/InternetChecker/IInternetCheckingService.cs rename to Daybreak.Shared/Services/InternetChecker/IInternetCheckingService.cs index ef85be18..89575b89 100644 --- a/Daybreak/Services/InternetChecker/IInternetCheckingService.cs +++ b/Daybreak.Shared/Services/InternetChecker/IInternetCheckingService.cs @@ -1,10 +1,10 @@ -using Daybreak.Models; +using Daybreak.Shared.Models; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.InternetChecker; +namespace Daybreak.Shared.Services.InternetChecker; -internal interface IInternetCheckingService +public interface IInternetCheckingService { Task CheckConnectionAvailable(CancellationToken cancellationToken); } diff --git a/Daybreak/Services/LaunchConfigurations/ILaunchConfigurationService.cs b/Daybreak.Shared/Services/LaunchConfigurations/ILaunchConfigurationService.cs similarity index 86% rename from Daybreak/Services/LaunchConfigurations/ILaunchConfigurationService.cs rename to Daybreak.Shared/Services/LaunchConfigurations/ILaunchConfigurationService.cs index 8fb5853f..43866e1c 100644 --- a/Daybreak/Services/LaunchConfigurations/ILaunchConfigurationService.cs +++ b/Daybreak.Shared/Services/LaunchConfigurations/ILaunchConfigurationService.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.LaunchConfigurations; +using Daybreak.Shared.Models.LaunchConfigurations; using System.Collections.Generic; -namespace Daybreak.Services.LaunchConfigurations; +namespace Daybreak.Shared.Services.LaunchConfigurations; public interface ILaunchConfigurationService { IEnumerable GetLaunchConfigurations(); diff --git a/Daybreak/Services/Logging/IDebugLogsWriter.cs b/Daybreak.Shared/Services/Logging/IDebugLogsWriter.cs similarity index 64% rename from Daybreak/Services/Logging/IDebugLogsWriter.cs rename to Daybreak.Shared/Services/Logging/IDebugLogsWriter.cs index 069c745d..19c26d7a 100644 --- a/Daybreak/Services/Logging/IDebugLogsWriter.cs +++ b/Daybreak.Shared/Services/Logging/IDebugLogsWriter.cs @@ -1,6 +1,6 @@ using System.Logging; -namespace Daybreak.Services.Logging; +namespace Daybreak.Shared.Services.Logging; public interface IDebugLogsWriter : ILogsWriter { diff --git a/Daybreak/Services/Logging/IEventViewerLogsWriter.cs b/Daybreak.Shared/Services/Logging/IEventViewerLogsWriter.cs similarity index 65% rename from Daybreak/Services/Logging/IEventViewerLogsWriter.cs rename to Daybreak.Shared/Services/Logging/IEventViewerLogsWriter.cs index 33f93707..11044957 100644 --- a/Daybreak/Services/Logging/IEventViewerLogsWriter.cs +++ b/Daybreak.Shared/Services/Logging/IEventViewerLogsWriter.cs @@ -1,6 +1,6 @@ using System.Logging; -namespace Daybreak.Services.Logging; +namespace Daybreak.Shared.Services.Logging; public interface IEventViewerLogsWriter : ILogsWriter { diff --git a/Daybreak.Shared/Services/Logging/ILogsManager.cs b/Daybreak.Shared/Services/Logging/ILogsManager.cs new file mode 100644 index 00000000..328b97c4 --- /dev/null +++ b/Daybreak.Shared/Services/Logging/ILogsManager.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Logging; + +namespace Daybreak.Shared.Services.Logging; + +public interface ILogsManager : ILogsWriter +{ + event EventHandler? ReceivedLog; + + IEnumerable GetLogs(Expression> filter); + IEnumerable GetLogs(); + void DeleteLogs(); +} diff --git a/Daybreak/Services/Menu/IMenuService.cs b/Daybreak.Shared/Services/Menu/IMenuService.cs similarity index 69% rename from Daybreak/Services/Menu/IMenuService.cs rename to Daybreak.Shared/Services/Menu/IMenuService.cs index d7173dcc..6a160fbb 100644 --- a/Daybreak/Services/Menu/IMenuService.cs +++ b/Daybreak.Shared/Services/Menu/IMenuService.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.Menu; +namespace Daybreak.Shared.Services.Menu; public interface IMenuService { diff --git a/Daybreak/Services/Menu/IMenuServiceButtonHandler.cs b/Daybreak.Shared/Services/Menu/IMenuServiceButtonHandler.cs similarity index 53% rename from Daybreak/Services/Menu/IMenuServiceButtonHandler.cs rename to Daybreak.Shared/Services/Menu/IMenuServiceButtonHandler.cs index b0cb5598..15dab149 100644 --- a/Daybreak/Services/Menu/IMenuServiceButtonHandler.cs +++ b/Daybreak.Shared/Services/Menu/IMenuServiceButtonHandler.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Menu; +using Daybreak.Shared.Models.Menu; -namespace Daybreak.Services.Menu; +namespace Daybreak.Shared.Services.Menu; public interface IMenuServiceButtonHandler { diff --git a/Daybreak/Services/Menu/IMenuServiceInitializer.cs b/Daybreak.Shared/Services/Menu/IMenuServiceInitializer.cs similarity index 80% rename from Daybreak/Services/Menu/IMenuServiceInitializer.cs rename to Daybreak.Shared/Services/Menu/IMenuServiceInitializer.cs index a9aab556..5d7cff3f 100644 --- a/Daybreak/Services/Menu/IMenuServiceInitializer.cs +++ b/Daybreak.Shared/Services/Menu/IMenuServiceInitializer.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Services.Menu; +namespace Daybreak.Shared.Services.Menu; public interface IMenuServiceInitializer { diff --git a/Daybreak/Services/Menu/IMenuServiceProducer.cs b/Daybreak.Shared/Services/Menu/IMenuServiceProducer.cs similarity index 69% rename from Daybreak/Services/Menu/IMenuServiceProducer.cs rename to Daybreak.Shared/Services/Menu/IMenuServiceProducer.cs index 22a626fa..d13f60f1 100644 --- a/Daybreak/Services/Menu/IMenuServiceProducer.cs +++ b/Daybreak.Shared/Services/Menu/IMenuServiceProducer.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Menu; +using Daybreak.Shared.Models.Menu; using System.Collections.Generic; -namespace Daybreak.Services.Menu; +namespace Daybreak.Shared.Services.Menu; public interface IMenuServiceProducer { diff --git a/Daybreak/Services/Metrics/IMetricsService.cs b/Daybreak.Shared/Services/Metrics/IMetricsService.cs similarity index 91% rename from Daybreak/Services/Metrics/IMetricsService.cs rename to Daybreak.Shared/Services/Metrics/IMetricsService.cs index 70b33ae1..744028ae 100644 --- a/Daybreak/Services/Metrics/IMetricsService.cs +++ b/Daybreak.Shared/Services/Metrics/IMetricsService.cs @@ -1,9 +1,9 @@ using System.Diagnostics.Metrics; using System; -using Daybreak.Models.Metrics; using System.Collections.Generic; +using Daybreak.Shared.Models.Metrics; -namespace Daybreak.Services.Metrics; +namespace Daybreak.Shared.Services.Metrics; public interface IMetricsService { diff --git a/Daybreak/Services/Mods/IModService.cs b/Daybreak.Shared/Services/Mods/IModService.cs similarity index 94% rename from Daybreak/Services/Mods/IModService.cs rename to Daybreak.Shared/Services/Mods/IModService.cs index b98f212e..a0aa960e 100644 --- a/Daybreak/Services/Mods/IModService.cs +++ b/Daybreak.Shared/Services/Mods/IModService.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Mods; +using Daybreak.Shared.Models.Mods; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Mods; +namespace Daybreak.Shared.Services.Mods; public interface IModService { diff --git a/Daybreak/Services/Mods/IModsManager.cs b/Daybreak.Shared/Services/Mods/IModsManager.cs similarity index 87% rename from Daybreak/Services/Mods/IModsManager.cs rename to Daybreak.Shared/Services/Mods/IModsManager.cs index 27129486..9681b70d 100644 --- a/Daybreak/Services/Mods/IModsManager.cs +++ b/Daybreak.Shared/Services/Mods/IModsManager.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Daybreak.Services.Mods; +namespace Daybreak.Shared.Services.Mods; public interface IModsManager { diff --git a/Daybreak/Services/Mutex/IMutexHandler.cs b/Daybreak.Shared/Services/Mutex/IMutexHandler.cs similarity index 74% rename from Daybreak/Services/Mutex/IMutexHandler.cs rename to Daybreak.Shared/Services/Mutex/IMutexHandler.cs index fd432ced..09710ee5 100644 --- a/Daybreak/Services/Mutex/IMutexHandler.cs +++ b/Daybreak.Shared/Services/Mutex/IMutexHandler.cs @@ -1,6 +1,6 @@ using System.Diagnostics; -namespace Daybreak.Services.Mutex; +namespace Daybreak.Shared.Services.Mutex; public interface IMutexHandler { diff --git a/Daybreak/Services/Navigation/IViewManager.cs b/Daybreak.Shared/Services/Navigation/IViewManager.cs similarity index 88% rename from Daybreak/Services/Navigation/IViewManager.cs rename to Daybreak.Shared/Services/Navigation/IViewManager.cs index 089c35e5..5c083ab9 100644 --- a/Daybreak/Services/Navigation/IViewManager.cs +++ b/Daybreak.Shared/Services/Navigation/IViewManager.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Controls; -namespace Daybreak.Services.Navigation; +namespace Daybreak.Shared.Services.Navigation; public interface IViewManager : IViewProducer { diff --git a/Daybreak/Services/Navigation/IViewProducer.cs b/Daybreak.Shared/Services/Navigation/IViewProducer.cs similarity index 80% rename from Daybreak/Services/Navigation/IViewProducer.cs rename to Daybreak.Shared/Services/Navigation/IViewProducer.cs index 735fba0b..072f0b88 100644 --- a/Daybreak/Services/Navigation/IViewProducer.cs +++ b/Daybreak.Shared/Services/Navigation/IViewProducer.cs @@ -1,6 +1,6 @@ using System.Windows.Controls; -namespace Daybreak.Services.Navigation; +namespace Daybreak.Shared.Services.Navigation; public interface IViewProducer { diff --git a/Daybreak/Services/Notifications/INotificationHandlerProducer.cs b/Daybreak.Shared/Services/Notifications/INotificationHandlerProducer.cs similarity index 57% rename from Daybreak/Services/Notifications/INotificationHandlerProducer.cs rename to Daybreak.Shared/Services/Notifications/INotificationHandlerProducer.cs index f6899bcc..2b6d60e7 100644 --- a/Daybreak/Services/Notifications/INotificationHandlerProducer.cs +++ b/Daybreak.Shared/Services/Notifications/INotificationHandlerProducer.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Notifications.Handling; +using Daybreak.Shared.Models.Notifications.Handling; -namespace Daybreak.Services.Notifications; +namespace Daybreak.Shared.Services.Notifications; public interface INotificationHandlerProducer { diff --git a/Daybreak.Shared/Services/Notifications/INotificationProducer.cs b/Daybreak.Shared/Services/Notifications/INotificationProducer.cs new file mode 100644 index 00000000..c7c3f36a --- /dev/null +++ b/Daybreak.Shared/Services/Notifications/INotificationProducer.cs @@ -0,0 +1,16 @@ +using Daybreak.Shared.Models.Notifications; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Daybreak.Shared.Services.Notifications; + +public interface INotificationProducer +{ + ValueTask OpenNotification(Notification notification, bool storeNotification = true, CancellationToken cancellationToken = default); + ValueTask RemoveNotification(Notification notification, CancellationToken cancellationToken); + ValueTask RemoveAllNotifications(CancellationToken cancellationToken); + ValueTask> GetAllNotifications(CancellationToken cancellationToken); + ValueTask> GetPendingNotifications(CancellationToken cancellationToken); + IAsyncEnumerable Consume(CancellationToken cancellationToken); +} diff --git a/Daybreak/Services/Notifications/INotificationService.cs b/Daybreak.Shared/Services/Notifications/INotificationService.cs similarity index 86% rename from Daybreak/Services/Notifications/INotificationService.cs rename to Daybreak.Shared/Services/Notifications/INotificationService.cs index 53abf18d..54fd27cd 100644 --- a/Daybreak/Services/Notifications/INotificationService.cs +++ b/Daybreak.Shared/Services/Notifications/INotificationService.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Notifications; -using Daybreak.Models.Notifications.Handling; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; using System; -namespace Daybreak.Services.Notifications; +namespace Daybreak.Shared.Services.Notifications; public interface INotificationService { diff --git a/Daybreak/Services/Onboarding/IOnboardingService.cs b/Daybreak.Shared/Services/Onboarding/IOnboardingService.cs similarity index 50% rename from Daybreak/Services/Onboarding/IOnboardingService.cs rename to Daybreak.Shared/Services/Onboarding/IOnboardingService.cs index f0ef94cc..2220ab6c 100644 --- a/Daybreak/Services/Onboarding/IOnboardingService.cs +++ b/Daybreak.Shared/Services/Onboarding/IOnboardingService.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Onboarding; +using Daybreak.Shared.Models.Onboarding; -namespace Daybreak.Services.Onboarding; +namespace Daybreak.Shared.Services.Onboarding; public interface IOnboardingService { diff --git a/Daybreak/Services/Options/IOptionsProducer.cs b/Daybreak.Shared/Services/Options/IOptionsProducer.cs similarity index 66% rename from Daybreak/Services/Options/IOptionsProducer.cs rename to Daybreak.Shared/Services/Options/IOptionsProducer.cs index b89d07fb..f9a5261d 100644 --- a/Daybreak/Services/Options/IOptionsProducer.cs +++ b/Daybreak.Shared/Services/Options/IOptionsProducer.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.Options; +namespace Daybreak.Shared.Services.Options; public interface IOptionsProducer { diff --git a/Daybreak/Services/Options/IOptionsProvider.cs b/Daybreak.Shared/Services/Options/IOptionsProvider.cs similarity index 89% rename from Daybreak/Services/Options/IOptionsProvider.cs rename to Daybreak.Shared/Services/Options/IOptionsProvider.cs index 845dc136..93066699 100644 --- a/Daybreak/Services/Options/IOptionsProvider.cs +++ b/Daybreak.Shared/Services/Options/IOptionsProvider.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -namespace Daybreak.Services.Options; +namespace Daybreak.Shared.Services.Options; public interface IOptionsProvider { diff --git a/Daybreak/Services/Options/IOptionsSynchronizationService.cs b/Daybreak.Shared/Services/Options/IOptionsSynchronizationService.cs similarity index 93% rename from Daybreak/Services/Options/IOptionsSynchronizationService.cs rename to Daybreak.Shared/Services/Options/IOptionsSynchronizationService.cs index a0952c3d..03073741 100644 --- a/Daybreak/Services/Options/IOptionsSynchronizationService.cs +++ b/Daybreak.Shared/Services/Options/IOptionsSynchronizationService.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Options; +namespace Daybreak.Shared.Services.Options; public interface IOptionsSynchronizationService { diff --git a/Daybreak/Services/Options/IOptionsUpdateHook.cs b/Daybreak.Shared/Services/Options/IOptionsUpdateHook.cs similarity index 84% rename from Daybreak/Services/Options/IOptionsUpdateHook.cs rename to Daybreak.Shared/Services/Options/IOptionsUpdateHook.cs index 9eb87c81..6dfa849b 100644 --- a/Daybreak/Services/Options/IOptionsUpdateHook.cs +++ b/Daybreak.Shared/Services/Options/IOptionsUpdateHook.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Services.Options; +namespace Daybreak.Shared.Services.Options; public interface IOptionsUpdateHook { diff --git a/Daybreak/Services/Plugins/IPluginsService.cs b/Daybreak.Shared/Services/Plugins/IPluginsService.cs similarity index 65% rename from Daybreak/Services/Plugins/IPluginsService.cs rename to Daybreak.Shared/Services/Plugins/IPluginsService.cs index f393570d..7c240da7 100644 --- a/Daybreak/Services/Plugins/IPluginsService.cs +++ b/Daybreak.Shared/Services/Plugins/IPluginsService.cs @@ -1,18 +1,18 @@ -using Daybreak.Models.Plugins; -using Daybreak.Services.ApplicationArguments; -using Daybreak.Services.Browser; -using Daybreak.Services.Menu; -using Daybreak.Services.Mods; -using Daybreak.Services.Navigation; -using Daybreak.Services.Notifications; -using Daybreak.Services.Options; -using Daybreak.Services.Startup; -using Daybreak.Services.Updater.PostUpdate; +using Daybreak.Shared.Models.Plugins; +using Daybreak.Shared.Services.ApplicationArguments; +using Daybreak.Shared.Services.Browser; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Services.Mods; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Options; +using Daybreak.Shared.Services.Startup; +using Daybreak.Shared.Services.Updater.PostUpdate; using Slim; using System.Collections.Generic; using System.Threading.Tasks; -namespace Daybreak.Services.Plugins; +namespace Daybreak.Shared.Services.Plugins; public interface IPluginsService { diff --git a/Daybreak/Services/Privilege/IPrivilegeManager.cs b/Daybreak.Shared/Services/Privilege/IPrivilegeManager.cs similarity index 89% rename from Daybreak/Services/Privilege/IPrivilegeManager.cs rename to Daybreak.Shared/Services/Privilege/IPrivilegeManager.cs index a9027538..f3e55447 100644 --- a/Daybreak/Services/Privilege/IPrivilegeManager.cs +++ b/Daybreak.Shared/Services/Privilege/IPrivilegeManager.cs @@ -1,6 +1,6 @@ using System.Windows.Controls; -namespace Daybreak.Services.Privilege; +namespace Daybreak.Shared.Services.Privilege; public interface IPrivilegeManager { diff --git a/Daybreak/Services/ReShade/IReShadeService.cs b/Daybreak.Shared/Services/ReShade/IReShadeService.cs similarity index 86% rename from Daybreak/Services/ReShade/IReShadeService.cs rename to Daybreak.Shared/Services/ReShade/IReShadeService.cs index 4c44480f..f237b893 100644 --- a/Daybreak/Services/ReShade/IReShadeService.cs +++ b/Daybreak.Shared/Services/ReShade/IReShadeService.cs @@ -1,11 +1,11 @@ -using Daybreak.Models.Progress; -using Daybreak.Models.ReShade; -using Daybreak.Services.Mods; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Models.ReShade; +using Daybreak.Shared.Services.Mods; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.ReShade; +namespace Daybreak.Shared.Services.ReShade; public interface IReShadeService : IModService { bool AutoUpdate { get; set; } diff --git a/Daybreak/Services/Registry/IRegistryService.cs b/Daybreak.Shared/Services/Registry/IRegistryService.cs similarity index 77% rename from Daybreak/Services/Registry/IRegistryService.cs rename to Daybreak.Shared/Services/Registry/IRegistryService.cs index df541a60..4036f71a 100644 --- a/Daybreak/Services/Registry/IRegistryService.cs +++ b/Daybreak.Shared/Services/Registry/IRegistryService.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.Registry; +namespace Daybreak.Shared.Services.Registry; public interface IRegistryService { diff --git a/Daybreak/Services/Scanner/IGuildwarsMemoryCache.cs b/Daybreak.Shared/Services/Scanner/IGuildwarsMemoryCache.cs similarity index 82% rename from Daybreak/Services/Scanner/IGuildwarsMemoryCache.cs rename to Daybreak.Shared/Services/Scanner/IGuildwarsMemoryCache.cs index 1ae09b90..06510fa9 100644 --- a/Daybreak/Services/Scanner/IGuildwarsMemoryCache.cs +++ b/Daybreak.Shared/Services/Scanner/IGuildwarsMemoryCache.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Guildwars; -using Daybreak.Models.LaunchConfigurations; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.LaunchConfigurations; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Scanner; +namespace Daybreak.Shared.Services.Scanner; public interface IGuildwarsMemoryCache { diff --git a/Daybreak/Services/Scanner/IGuildwarsMemoryReader.cs b/Daybreak.Shared/Services/Scanner/IGuildwarsMemoryReader.cs similarity index 89% rename from Daybreak/Services/Scanner/IGuildwarsMemoryReader.cs rename to Daybreak.Shared/Services/Scanner/IGuildwarsMemoryReader.cs index f39cfdc5..3f9a8e74 100644 --- a/Daybreak/Services/Scanner/IGuildwarsMemoryReader.cs +++ b/Daybreak.Shared/Services/Scanner/IGuildwarsMemoryReader.cs @@ -1,8 +1,8 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Scanner; +namespace Daybreak.Shared.Services.Scanner; public interface IGuildwarsMemoryReader { diff --git a/Daybreak/Services/Scanner/IMemoryScanner.cs b/Daybreak.Shared/Services/Scanner/IMemoryScanner.cs similarity index 91% rename from Daybreak/Services/Scanner/IMemoryScanner.cs rename to Daybreak.Shared/Services/Scanner/IMemoryScanner.cs index a9052e0e..4689deac 100644 --- a/Daybreak/Services/Scanner/IMemoryScanner.cs +++ b/Daybreak.Shared/Services/Scanner/IMemoryScanner.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Interop; +using Daybreak.Shared.Models.Interop; using System.Diagnostics; -namespace Daybreak.Services.Scanner; +namespace Daybreak.Shared.Services.Scanner; public interface IMemoryScanner { diff --git a/Daybreak.Shared/Services/Screens/IGuildwarsScreenPlacer.cs b/Daybreak.Shared/Services/Screens/IGuildwarsScreenPlacer.cs new file mode 100644 index 00000000..c13e49f5 --- /dev/null +++ b/Daybreak.Shared/Services/Screens/IGuildwarsScreenPlacer.cs @@ -0,0 +1,7 @@ +using Daybreak.Shared.Services.Mods; + +namespace Daybreak.Shared.Services.Screens; + +public interface IGuildwarsScreenPlacer : IModService +{ +} diff --git a/Daybreak/Services/Screens/IScreenManager.cs b/Daybreak.Shared/Services/Screens/IScreenManager.cs similarity index 75% rename from Daybreak/Services/Screens/IScreenManager.cs rename to Daybreak.Shared/Services/Screens/IScreenManager.cs index a723ff52..5c630f7b 100644 --- a/Daybreak/Services/Screens/IScreenManager.cs +++ b/Daybreak.Shared/Services/Screens/IScreenManager.cs @@ -1,7 +1,7 @@ -using Daybreak.Models; +using Daybreak.Shared.Models; using System.Collections.Generic; -namespace Daybreak.Services.Screens; +namespace Daybreak.Shared.Services.Screens; public interface IScreenManager { diff --git a/Daybreak/Services/Screens/ISplashScreenService.cs b/Daybreak.Shared/Services/Screens/ISplashScreenService.cs similarity index 68% rename from Daybreak/Services/Screens/ISplashScreenService.cs rename to Daybreak.Shared/Services/Screens/ISplashScreenService.cs index 133f67d9..6849e37a 100644 --- a/Daybreak/Services/Screens/ISplashScreenService.cs +++ b/Daybreak.Shared/Services/Screens/ISplashScreenService.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.Screens; +namespace Daybreak.Shared.Services.Screens; public interface ISplashScreenService { diff --git a/Daybreak/Services/Screenshots/IBackgroundProvider.cs b/Daybreak.Shared/Services/Screenshots/IBackgroundProvider.cs similarity index 57% rename from Daybreak/Services/Screenshots/IBackgroundProvider.cs rename to Daybreak.Shared/Services/Screenshots/IBackgroundProvider.cs index 88c4480e..6492e078 100644 --- a/Daybreak/Services/Screenshots/IBackgroundProvider.cs +++ b/Daybreak.Shared/Services/Screenshots/IBackgroundProvider.cs @@ -1,7 +1,7 @@ -using Daybreak.Services.Screenshots.Models; +using Daybreak.Shared.Models; using System.Threading.Tasks; -namespace Daybreak.Services.Screenshots; +namespace Daybreak.Shared.Services.Screenshots; public interface IBackgroundProvider { diff --git a/Daybreak/Services/Screenshots/IOnlinePictureClient.cs b/Daybreak.Shared/Services/Screenshots/IOnlinePictureClient.cs similarity index 78% rename from Daybreak/Services/Screenshots/IOnlinePictureClient.cs rename to Daybreak.Shared/Services/Screenshots/IOnlinePictureClient.cs index 5aa116ca..d62ba058 100644 --- a/Daybreak/Services/Screenshots/IOnlinePictureClient.cs +++ b/Daybreak.Shared/Services/Screenshots/IOnlinePictureClient.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using System.Windows.Media; -namespace Daybreak.Services.Screenshots; +namespace Daybreak.Shared.Services.Screenshots; public interface IOnlinePictureClient { diff --git a/Daybreak/Services/Screenshots/IScreenshotProvider.cs b/Daybreak.Shared/Services/Screenshots/IScreenshotProvider.cs similarity index 75% rename from Daybreak/Services/Screenshots/IScreenshotProvider.cs rename to Daybreak.Shared/Services/Screenshots/IScreenshotProvider.cs index bf293611..6f37368c 100644 --- a/Daybreak/Services/Screenshots/IScreenshotProvider.cs +++ b/Daybreak.Shared/Services/Screenshots/IScreenshotProvider.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using System.Windows.Media; -namespace Daybreak.Services.Screenshots; +namespace Daybreak.Shared.Services.Screenshots; public interface IScreenshotProvider { diff --git a/Daybreak/Services/SevenZip/ISevenZipExtractor.cs b/Daybreak.Shared/Services/SevenZip/ISevenZipExtractor.cs similarity index 85% rename from Daybreak/Services/SevenZip/ISevenZipExtractor.cs rename to Daybreak.Shared/Services/SevenZip/ISevenZipExtractor.cs index d59686c2..1fdf7159 100644 --- a/Daybreak/Services/SevenZip/ISevenZipExtractor.cs +++ b/Daybreak.Shared/Services/SevenZip/ISevenZipExtractor.cs @@ -2,7 +2,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.SevenZip; +namespace Daybreak.Shared.Services.SevenZip; public interface ISevenZipExtractor { Task ExtractToDirectory(string sourceFile, string destinationDirectory, Action progressTracker, CancellationToken cancellationToken); diff --git a/Daybreak/Services/Shortcuts/IShortcutManager.cs b/Daybreak.Shared/Services/Shortcuts/IShortcutManager.cs similarity index 77% rename from Daybreak/Services/Shortcuts/IShortcutManager.cs rename to Daybreak.Shared/Services/Shortcuts/IShortcutManager.cs index 52d7c6c3..0ae8781c 100644 --- a/Daybreak/Services/Shortcuts/IShortcutManager.cs +++ b/Daybreak.Shared/Services/Shortcuts/IShortcutManager.cs @@ -1,6 +1,6 @@ using System.Windows.Extensions.Services; -namespace Daybreak.Services.Shortcuts; +namespace Daybreak.Shared.Services.Shortcuts; public interface IShortcutManager : IApplicationLifetimeService { diff --git a/Daybreak/Services/Sounds/ISoundService.cs b/Daybreak.Shared/Services/Sounds/ISoundService.cs similarity index 73% rename from Daybreak/Services/Sounds/ISoundService.cs rename to Daybreak.Shared/Services/Sounds/ISoundService.cs index c575277e..7b44abd7 100644 --- a/Daybreak/Services/Sounds/ISoundService.cs +++ b/Daybreak.Shared/Services/Sounds/ISoundService.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.Sounds; +namespace Daybreak.Shared.Services.Sounds; public interface ISoundService { diff --git a/Daybreak/Services/Startup/IStartupActionProducer.cs b/Daybreak.Shared/Services/Startup/IStartupActionProducer.cs similarity index 58% rename from Daybreak/Services/Startup/IStartupActionProducer.cs rename to Daybreak.Shared/Services/Startup/IStartupActionProducer.cs index 7be38fa5..f0584919 100644 --- a/Daybreak/Services/Startup/IStartupActionProducer.cs +++ b/Daybreak.Shared/Services/Startup/IStartupActionProducer.cs @@ -1,6 +1,6 @@ -using Daybreak.Services.Startup.Actions; +using Daybreak.Shared.Models; -namespace Daybreak.Services.Startup; +namespace Daybreak.Shared.Services.Startup; public interface IStartupActionProducer { diff --git a/Daybreak/Services/Themes/IThemeManager.cs b/Daybreak.Shared/Services/Themes/IThemeManager.cs similarity index 78% rename from Daybreak/Services/Themes/IThemeManager.cs rename to Daybreak.Shared/Services/Themes/IThemeManager.cs index 0d92f1a2..ef8ac895 100644 --- a/Daybreak/Services/Themes/IThemeManager.cs +++ b/Daybreak.Shared/Services/Themes/IThemeManager.cs @@ -1,7 +1,7 @@ using ControlzEx.Theming; using System.Windows.Media; -namespace Daybreak.Services.Themes; +namespace Daybreak.Shared.Services.Themes; public interface IThemeManager { Theme GetCurrentTheme(); diff --git a/Daybreak/Services/Toolbox/IToolboxService.cs b/Daybreak.Shared/Services/Toolbox/IToolboxService.cs similarity index 82% rename from Daybreak/Services/Toolbox/IToolboxService.cs rename to Daybreak.Shared/Services/Toolbox/IToolboxService.cs index e5e5a29d..2fb2748f 100644 --- a/Daybreak/Services/Toolbox/IToolboxService.cs +++ b/Daybreak.Shared/Services/Toolbox/IToolboxService.cs @@ -1,11 +1,11 @@ -using Daybreak.Models.Builds; -using Daybreak.Models.Progress; -using Daybreak.Services.Mods; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Mods; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.Toolbox; +namespace Daybreak.Shared.Services.Toolbox; public interface IToolboxService : IModService { bool LoadToolboxFromDisk(); diff --git a/Daybreak.Shared/Services/TradeChat/IItemHashService.cs b/Daybreak.Shared/Services/TradeChat/IItemHashService.cs new file mode 100644 index 00000000..37562ddf --- /dev/null +++ b/Daybreak.Shared/Services/TradeChat/IItemHashService.cs @@ -0,0 +1,8 @@ +using Daybreak.Shared.Models.Guildwars; + +namespace Daybreak.Shared.Services.TradeChat; + +public interface IItemHashService +{ + string? ComputeHash(ItemBase itemBase); +} diff --git a/Daybreak/Services/TradeChat/IPriceHistoryService.cs b/Daybreak.Shared/Services/TradeChat/IPriceHistoryService.cs similarity index 70% rename from Daybreak/Services/TradeChat/IPriceHistoryService.cs rename to Daybreak.Shared/Services/TradeChat/IPriceHistoryService.cs index 1e69840c..a940cc39 100644 --- a/Daybreak/Services/TradeChat/IPriceHistoryService.cs +++ b/Daybreak.Shared/Services/TradeChat/IPriceHistoryService.cs @@ -1,11 +1,11 @@ -using Daybreak.Models.Guildwars; -using Daybreak.Models.Trade; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.Trade; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.TradeChat; +namespace Daybreak.Shared.Services.TradeChat; public interface IPriceHistoryService { diff --git a/Daybreak/Services/TradeChat/ITradeAlertingService.cs b/Daybreak.Shared/Services/TradeChat/ITradeAlertingService.cs similarity index 77% rename from Daybreak/Services/TradeChat/ITradeAlertingService.cs rename to Daybreak.Shared/Services/TradeChat/ITradeAlertingService.cs index 64bc70ca..b26006ee 100644 --- a/Daybreak/Services/TradeChat/ITradeAlertingService.cs +++ b/Daybreak.Shared/Services/TradeChat/ITradeAlertingService.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Trade; +using Daybreak.Shared.Models.Trade; using System.Collections.Generic; -namespace Daybreak.Services.TradeChat; +namespace Daybreak.Shared.Services.TradeChat; public interface ITradeAlertingService { diff --git a/Daybreak/Services/TradeChat/ITradeChatService.cs b/Daybreak.Shared/Services/TradeChat/ITradeChatService.cs similarity index 86% rename from Daybreak/Services/TradeChat/ITradeChatService.cs rename to Daybreak.Shared/Services/TradeChat/ITradeChatService.cs index 641d69ee..2df6080e 100644 --- a/Daybreak/Services/TradeChat/ITradeChatService.cs +++ b/Daybreak.Shared/Services/TradeChat/ITradeChatService.cs @@ -1,11 +1,11 @@ -using Daybreak.Configuration.Options; -using Daybreak.Models.Trade; +using Daybreak.Shared.Configuration.Options; +using Daybreak.Shared.Models.Trade; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.TradeChat; +namespace Daybreak.Shared.Services.TradeChat; public interface ITradeChatService : ITradeChatService where TChannelOptions : class, ITradeChatOptions, new() diff --git a/Daybreak/Services/TradeChat/ITraderQuoteService.cs b/Daybreak.Shared/Services/TradeChat/ITraderQuoteService.cs similarity index 78% rename from Daybreak/Services/TradeChat/ITraderQuoteService.cs rename to Daybreak.Shared/Services/TradeChat/ITraderQuoteService.cs index 2158a1cf..ba43b9cc 100644 --- a/Daybreak/Services/TradeChat/ITraderQuoteService.cs +++ b/Daybreak.Shared/Services/TradeChat/ITraderQuoteService.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Trade; +using Daybreak.Shared.Models.Trade; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Services.TradeChat; +namespace Daybreak.Shared.Services.TradeChat; public interface ITraderQuoteService { diff --git a/Daybreak/Services/TradeChat/IWordHighlightingService.cs b/Daybreak.Shared/Services/TradeChat/IWordHighlightingService.cs similarity index 76% rename from Daybreak/Services/TradeChat/IWordHighlightingService.cs rename to Daybreak.Shared/Services/TradeChat/IWordHighlightingService.cs index 913c1e6b..288f5ebb 100644 --- a/Daybreak/Services/TradeChat/IWordHighlightingService.cs +++ b/Daybreak.Shared/Services/TradeChat/IWordHighlightingService.cs @@ -1,8 +1,8 @@ -using Daybreak.Models; +using Daybreak.Shared.Models; using System.Collections.Generic; using System.Windows.Media; -namespace Daybreak.Services.TradeChat; +namespace Daybreak.Shared.Services.TradeChat; public interface IWordHighlightingService { diff --git a/Daybreak/Services/UMod/IUModService.cs b/Daybreak.Shared/Services/UMod/IUModService.cs similarity index 69% rename from Daybreak/Services/UMod/IUModService.cs rename to Daybreak.Shared/Services/UMod/IUModService.cs index 01adba3b..c6d2594e 100644 --- a/Daybreak/Services/UMod/IUModService.cs +++ b/Daybreak.Shared/Services/UMod/IUModService.cs @@ -1,12 +1,12 @@ -using Daybreak.Models.Progress; -using Daybreak.Models.UMod; -using Daybreak.Models.Versioning; -using Daybreak.Services.Mods; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Models.UMod; +using Daybreak.Shared.Services.Mods; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Version = Daybreak.Shared.Models.Versioning.Version; -namespace Daybreak.Services.UMod; +namespace Daybreak.Shared.Services.UMod; public interface IUModService : IModService { Version Version { get; } diff --git a/Daybreak/Services/Updater/IApplicationUpdater.cs b/Daybreak.Shared/Services/Updater/IApplicationUpdater.cs similarity index 79% rename from Daybreak/Services/Updater/IApplicationUpdater.cs rename to Daybreak.Shared/Services/Updater/IApplicationUpdater.cs index 0503f349..23053450 100644 --- a/Daybreak/Services/Updater/IApplicationUpdater.cs +++ b/Daybreak.Shared/Services/Updater/IApplicationUpdater.cs @@ -1,10 +1,10 @@ -using Daybreak.Models.Progress; -using Daybreak.Models.Versioning; +using Daybreak.Shared.Models.Progress; using System.Collections.Generic; using System.Threading.Tasks; using System.Windows.Extensions.Services; +using Version = Daybreak.Shared.Models.Versioning.Version; -namespace Daybreak.Services.Updater; +namespace Daybreak.Shared.Services.Updater; public interface IApplicationUpdater : IApplicationLifetimeService { diff --git a/Daybreak/Services/Updater/PostUpdate/IPostUpdateActionManager.cs b/Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionManager.cs similarity index 63% rename from Daybreak/Services/Updater/PostUpdate/IPostUpdateActionManager.cs rename to Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionManager.cs index b33b1943..d7135572 100644 --- a/Daybreak/Services/Updater/PostUpdate/IPostUpdateActionManager.cs +++ b/Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionManager.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Services.Updater.PostUpdate; +namespace Daybreak.Shared.Services.Updater.PostUpdate; public interface IPostUpdateActionManager : IPostUpdateActionProducer, IPostUpdateActionProvider { diff --git a/Daybreak/Services/Updater/PostUpdate/IPostUpdateActionProducer.cs b/Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionProducer.cs similarity index 57% rename from Daybreak/Services/Updater/PostUpdate/IPostUpdateActionProducer.cs rename to Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionProducer.cs index 7783687f..b4f7bccf 100644 --- a/Daybreak/Services/Updater/PostUpdate/IPostUpdateActionProducer.cs +++ b/Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionProducer.cs @@ -1,4 +1,6 @@ -namespace Daybreak.Services.Updater.PostUpdate; +using Daybreak.Shared.Models; + +namespace Daybreak.Shared.Services.Updater.PostUpdate; public interface IPostUpdateActionProducer { diff --git a/Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionProvider.cs b/Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionProvider.cs new file mode 100644 index 00000000..c47d9f56 --- /dev/null +++ b/Daybreak.Shared/Services/Updater/PostUpdate/IPostUpdateActionProvider.cs @@ -0,0 +1,9 @@ +using Daybreak.Shared.Models; +using System.Collections.Generic; + +namespace Daybreak.Shared.Services.Updater.PostUpdate; + +public interface IPostUpdateActionProvider +{ + IEnumerable GetPostUpdateActions(); +} diff --git a/Daybreak/Services/Window/IWindowEventsHook.cs b/Daybreak.Shared/Services/Window/IWindowEventsHook.cs similarity index 88% rename from Daybreak/Services/Window/IWindowEventsHook.cs rename to Daybreak.Shared/Services/Window/IWindowEventsHook.cs index 7e69d153..fc73ccde 100644 --- a/Daybreak/Services/Window/IWindowEventsHook.cs +++ b/Daybreak.Shared/Services/Window/IWindowEventsHook.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Services.Window; +namespace Daybreak.Shared.Services.Window; public interface IWindowEventsHook : IDisposable where T : System.Windows.Window diff --git a/Daybreak/Utils/ColorExtensions.cs b/Daybreak.Shared/Utils/ColorExtensions.cs similarity index 72% rename from Daybreak/Utils/ColorExtensions.cs rename to Daybreak.Shared/Utils/ColorExtensions.cs index f82ab484..55d1604e 100644 --- a/Daybreak/Utils/ColorExtensions.cs +++ b/Daybreak.Shared/Utils/ColorExtensions.cs @@ -1,6 +1,6 @@ using System.Windows.Media; -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; public static class ColorExtensions { @@ -16,14 +16,14 @@ public static class ColorExtensions var bg = (float)backColor.G / byte.MaxValue; var bb = (float)backColor.B / byte.MaxValue; - var a = fa + ba - (fa * ba); + var a = fa + ba - fa * ba; if (a <= 0) return Colors.Transparent; - var r = ((fa * (1 - ba) * fr) + (fa * ba * fa) + ((1 - fa) * ba * br)) / a; - var g = ((fa * (1 - ba) * fg) + (fa * ba * fa) + ((1 - fa) * ba * bg)) / a; - var b = ((fa * (1 - ba) * fb) + (fa * ba * fa) + ((1 - fa) * ba * bb)) / a; + var r = (fa * (1 - ba) * fr + fa * ba * fa + (1 - fa) * ba * br) / a; + var g = (fa * (1 - ba) * fg + fa * ba * fa + (1 - fa) * ba * bg) / a; + var b = (fa * (1 - ba) * fb + fa * ba * fa + (1 - fa) * ba * bb) / a; return Color.FromArgb( (byte)(a * byte.MaxValue), diff --git a/Daybreak/Utils/DateTimeExtensions.cs b/Daybreak.Shared/Utils/DateTimeExtensions.cs similarity index 97% rename from Daybreak/Utils/DateTimeExtensions.cs rename to Daybreak.Shared/Utils/DateTimeExtensions.cs index adbe7860..62e69234 100644 --- a/Daybreak/Utils/DateTimeExtensions.cs +++ b/Daybreak.Shared/Utils/DateTimeExtensions.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; public static class DateTimeExtensions { diff --git a/Daybreak/Utils/DependencyObjectExtensions.cs b/Daybreak.Shared/Utils/DependencyObjectExtensions.cs similarity index 96% rename from Daybreak/Utils/DependencyObjectExtensions.cs rename to Daybreak.Shared/Utils/DependencyObjectExtensions.cs index 0bd2b8b4..3c90bb70 100644 --- a/Daybreak/Utils/DependencyObjectExtensions.cs +++ b/Daybreak.Shared/Utils/DependencyObjectExtensions.cs @@ -1,7 +1,7 @@ using System.Windows.Media; using System.Windows; -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; public static class DependencyObjectExtensions { public static T? FindParent(this DependencyObject child) where T : DependencyObject diff --git a/Daybreak/Utils/EncryptionHelper.cs b/Daybreak.Shared/Utils/EncryptionHelper.cs similarity index 84% rename from Daybreak/Utils/EncryptionHelper.cs rename to Daybreak.Shared/Utils/EncryptionHelper.cs index 9ff532d1..9db4f98f 100644 --- a/Daybreak/Utils/EncryptionHelper.cs +++ b/Daybreak.Shared/Utils/EncryptionHelper.cs @@ -2,26 +2,11 @@ using System.Linq; using System.Security.Cryptography; -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; internal static class EncryptionHelper { - private static Aes? AesAlgorithm; - private static Aes Aes - { - get - { - if (AesAlgorithm is null) - { - AesAlgorithm = Aes.Create(); - AesAlgorithm.Mode = CipherMode.CBC; - AesAlgorithm.BlockSize = 128; - AesAlgorithm.Padding = PaddingMode.PKCS7; - } - - return AesAlgorithm; - } - } + private static Aes Aes { get; } = CreateDefault(); private static int Iterations { get; } = 10000; private static RandomNumberGenerator Rng { get; } = RandomNumberGenerator.Create(); @@ -51,7 +36,7 @@ internal static class EncryptionHelper { var saltBytes = new byte[Aes.BlockSize / 8]; var ivBytes = new byte[Aes.BlockSize / 8]; - var cipherBytes = new byte[bytes.Length - (Aes.BlockSize / 4)]; + var cipherBytes = new byte[bytes.Length - Aes.BlockSize / 4]; using var encryptedStream = new MemoryStream(bytes); encryptedStream.Read(saltBytes, 0, saltBytes.Length); @@ -74,4 +59,13 @@ internal static class EncryptionHelper Rng.GetBytes(randomBytes); return randomBytes; } + + private static Aes CreateDefault() + { + var aes = Aes.Create(); + aes.Mode = CipherMode.CBC; + aes.BlockSize = 128; + aes.Padding = PaddingMode.PKCS7; + return aes; + } } diff --git a/Daybreak/Utils/MathUtils.cs b/Daybreak.Shared/Utils/MathUtils.cs similarity index 87% rename from Daybreak/Utils/MathUtils.cs rename to Daybreak.Shared/Utils/MathUtils.cs index 4456820e..66a2495c 100644 --- a/Daybreak/Utils/MathUtils.cs +++ b/Daybreak.Shared/Utils/MathUtils.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; public static class MathUtils { diff --git a/Daybreak/Utils/MetricsHttpMessageHandler.cs b/Daybreak.Shared/Utils/MetricsHttpMessageHandler.cs similarity index 94% rename from Daybreak/Utils/MetricsHttpMessageHandler.cs rename to Daybreak.Shared/Utils/MetricsHttpMessageHandler.cs index fe190952..062dad51 100644 --- a/Daybreak/Utils/MetricsHttpMessageHandler.cs +++ b/Daybreak.Shared/Utils/MetricsHttpMessageHandler.cs @@ -1,11 +1,11 @@ -using Daybreak.Services.Metrics; +using Daybreak.Shared.Services.Metrics; using System.Diagnostics; using System.Diagnostics.Metrics; using System.Net.Http; using System.Threading; using System.Threading.Tasks; -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; public sealed class MetricsHttpMessageHandler : DelegatingHandler { diff --git a/Daybreak/Utils/NativeMethods.cs b/Daybreak.Shared/Utils/NativeMethods.cs similarity index 68% rename from Daybreak/Utils/NativeMethods.cs rename to Daybreak.Shared/Utils/NativeMethods.cs index 5dfd7467..1d7b166a 100644 --- a/Daybreak/Utils/NativeMethods.cs +++ b/Daybreak.Shared/Utils/NativeMethods.cs @@ -3,18 +3,31 @@ using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Text; -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; -internal static class NativeMethods +public static class NativeMethods { public static uint WM_KEYDOWN = 0x0100; public static uint SWP_SHOWWINDOW = 0x0040; - public static IntPtr HWND_TOPMOST = new(-1); - public static IntPtr HWND_TOP = IntPtr.Zero; + public static nint HWND_TOPMOST = new(-1); + public static nint HWND_TOP = nint.Zero; public const int WH_KEYBOARD_LL = 13; public const uint LIST_MODULES_32BIT = 0x01; - public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam); + public delegate nint HookProc(int nCode, nint wParam, nint lParam); + + [Flags] + public enum AllocationType : uint + { + Commit = 0x00001000, + Reserve = 0x00002000, + Reset = 0x00080000, + ResetUndo = 0x1000000, + LargePages = 0x20000000, + Physical = 0x00400000, + TopDown = 0x00100000, + WriteWatch = 0x00200000 + } [Flags] public enum MinidumpType : uint @@ -44,12 +57,12 @@ internal static class NativeMethods MiniDumpValidTypeFlags = 0x001fffff, } [StructLayout(LayoutKind.Sequential)] - internal struct ProcessEntry32 + public struct ProcessEntry32 { public uint dwSize; public uint cntUsage; public uint th32ProcessID; - public IntPtr th32DefaultHeapID; + public nint th32DefaultHeapID; public uint th32ModuleID; public uint cntThreads; public uint th32ParentProcessID; @@ -59,20 +72,20 @@ internal static class NativeMethods public string szExeFile; }; [StructLayout(LayoutKind.Sequential)] - internal struct PEB + public struct PEB { private readonly byte InheritedAddressSpace; private readonly byte ReadImageFileExecOptions; private readonly byte BeingDebugged; private readonly byte BitField; - private readonly IntPtr Mutant; - internal IntPtr ImageBaseAddress; + private readonly nint Mutant; + public nint ImageBaseAddress; } [StructLayout(LayoutKind.Sequential)] public struct SecurityAttributes { public uint nLength; - public IntPtr lpSecurityDescriptor; + public nint lpSecurityDescriptor; public bool bInheritHandle; } [Flags] @@ -118,8 +131,8 @@ internal static class NativeMethods public byte ObjectType; public byte HandleFlags; public ushort HandleValue; - public UIntPtr ObjectPointer; - public IntPtr AccessMask; + public nuint ObjectPointer; + public nint AccessMask; } [StructLayout(LayoutKind.Sequential)] public struct ObjectBasicInformation @@ -227,16 +240,16 @@ internal static class NativeMethods public int dwFlags; public short wShowWindow; public short cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; + public nint lpReserved2; + public nint hStdInput; + public nint hStdOutput; + public nint hStdError; } [StructLayout(LayoutKind.Sequential)] public struct ProcessInformation { - public IntPtr hProcess; - public IntPtr hThread; + public nint hProcess; + public nint hThread; public int dwProcessId; public int dwThreadId; } @@ -255,14 +268,14 @@ internal static class NativeMethods MaxProcessInfoClass = 0x64 } [StructLayout(LayoutKind.Sequential)] - internal struct ProcessBasicInformation + public struct ProcessBasicInformation { - private readonly IntPtr Reserved1; - internal IntPtr PebBaseAddress; - private readonly IntPtr Reserved2; - private readonly IntPtr Reserved3; - private readonly UIntPtr UniqueProcessId; - private readonly IntPtr Reserved4; + private readonly nint Reserved1; + public nint PebBaseAddress; + private readonly nint Reserved2; + private readonly nint Reserved3; + private readonly nuint UniqueProcessId; + private readonly nint Reserved4; } public enum SaferLevel : uint { @@ -329,7 +342,7 @@ internal static class NativeMethods [StructLayout(LayoutKind.Sequential)] public struct SidAndAttributes { - public IntPtr Sid; + public nint Sid; public int Attributes; } [StructLayout(LayoutKind.Sequential)] @@ -347,153 +360,153 @@ internal static class NativeMethods ExtendedStartupInfoPresent = 0x00080000 } - public delegate bool Win32Callback(IntPtr hwnd, IntPtr lParam); + public delegate bool Win32Callback(nint hwnd, nint lParam); public const int WM_SYSCOMMAND = 0x112; [DllImport("Dbghelp.dll", SetLastError = true)] - public static extern bool MiniDumpWriteDump(IntPtr hProcess, int processId, SafeHandle hFile, MinidumpType dumpType, IntPtr expParam, IntPtr userStreamParam, IntPtr callbackParam); + public static extern bool MiniDumpWriteDump(nint hProcess, int processId, SafeHandle hFile, MinidumpType dumpType, nint expParam, nint userStreamParam, nint callbackParam); [DllImport("kernel32.dll", SetLastError = true)] - public static extern IntPtr CreateToolhelp32Snapshot(uint dwFlags, uint th32ProcessID); + public static extern nint CreateToolhelp32Snapshot(uint dwFlags, uint th32ProcessID); [DllImport("kernel32.dll")] - public static extern bool Process32First(IntPtr hSnapshot, ref ProcessEntry32 lppe); + public static extern bool Process32First(nint hSnapshot, ref ProcessEntry32 lppe); [DllImport("kernel32.dll")] - public static extern bool Process32Next(IntPtr hSnapshot, ref ProcessEntry32 lppe); + public static extern bool Process32Next(nint hSnapshot, ref ProcessEntry32 lppe); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); + public static extern nint SendMessage(nint hWnd, uint Msg, nint wParam, nint lParam); [DllImport("kernel32.dll")] - public static extern bool CloseHandle(IntPtr hObject); + public static extern bool CloseHandle(nint hObject); [DllImport("kernel32.dll")] - public static extern bool DuplicateHandle(IntPtr hSourceProcessHandle, IntPtr hSourceHandle, IntPtr hTargetProcessHandle, out IntPtr lpTargetHandle, uint dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, DuplicateOptions dwOptions); + public static extern bool DuplicateHandle(nint hSourceProcessHandle, nint hSourceHandle, nint hTargetProcessHandle, out nint lpTargetHandle, uint dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, DuplicateOptions dwOptions); [DllImport("kernel32.dll")] - public static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, bool bInheritHandle, uint dwProcessID); + public static extern nint OpenProcess(ProcessAccessFlags dwDesiredAccess, bool bInheritHandle, uint dwProcessID); [DllImport("ntdll.dll", SetLastError = true)] - public static extern NtStatus NtQueryInformationFile(IntPtr FileHandle, ref IoStatusBlock IoStatusBlock, IntPtr FileInformation, int FileInformationLength, FileInformationClass FileInformationClass); + public static extern NtStatus NtQueryInformationFile(nint FileHandle, ref IoStatusBlock IoStatusBlock, nint FileInformation, int FileInformationLength, FileInformationClass FileInformationClass); [DllImport("ntdll.dll")] - public static extern NtStatus NtQueryObject(IntPtr ObjectHandle, ObjectInformationClass ObjectInformationClass, IntPtr ObjectInformation, int ObjectInformationLength, out int ReturnLength); + public static extern NtStatus NtQueryObject(nint ObjectHandle, ObjectInformationClass ObjectInformationClass, nint ObjectInformation, int ObjectInformationLength, out int ReturnLength); [DllImport("ntdll.dll")] - public static extern NtStatus NtQuerySystemInformation(SystemInformationClass SystemInformationClass, IntPtr SystemInformation, int SystemInformationLength, out int ReturnLength); + public static extern NtStatus NtQuerySystemInformation(SystemInformationClass SystemInformationClass, nint SystemInformation, int SystemInformationLength, out int ReturnLength); [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - public static extern bool QueryFullProcessImageName(IntPtr hProcess, uint dwFlags, StringBuilder lpExeName, ref uint lpdwSize); + public static extern bool QueryFullProcessImageName(nint hProcess, uint dwFlags, StringBuilder lpExeName, ref uint lpdwSize); [DllImport("user32.dll")] - public static extern bool SetWindowPos(IntPtr hwnd, IntPtr insertAfter, int x, int y, int cx, int cy, uint flags); + public static extern bool SetWindowPos(nint hwnd, nint insertAfter, int x, int y, int cx, int cy, uint flags); [DllImport("user32.dll")] - public static extern bool ShowWindow(IntPtr hwnd, int cmd); + public static extern bool ShowWindow(nint hwnd, int cmd); [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern int GetWindowTextLength(IntPtr hWnd); + public static extern int GetWindowTextLength(nint hWnd); [DllImport("user32.dll", CharSet = CharSet.Unicode)] - public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); + public static extern int GetWindowText(nint hWnd, StringBuilder lpString, int nMaxCount); [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - public static extern IntPtr LoadLibrary(string lpFileName); + public static extern nint LoadLibrary(string lpFileName); [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern bool FreeLibrary(IntPtr hModule); + public static extern bool FreeLibrary(nint hModule); [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hMod, int dwThreadId); + public static extern nint SetWindowsHookEx(int idHook, HookProc lpfn, nint hMod, int dwThreadId); [DllImport("user32.dll", SetLastError = true)] - public static extern bool UnhookWindowsHookEx(IntPtr hHook); + public static extern bool UnhookWindowsHookEx(nint hHook); [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr CallNextHookEx(IntPtr hHook, int code, IntPtr wParam, IntPtr lParam); + public static extern nint CallNextHookEx(nint hHook, int code, nint wParam, nint lParam); [DllImport("user32.dll")] - public static extern IntPtr GetForegroundWindow(); + public static extern nint GetForegroundWindow(); [DllImport("kernel32.dll", SetLastError = true)] - public static extern bool ReadProcessMemory(IntPtr hProcess, uint lpBaseAddress, IntPtr lpBuffer, uint nSize, out uint lpNumberOfBytesRead); + public static extern bool ReadProcessMemory(nint hProcess, uint lpBaseAddress, nint lpBuffer, uint nSize, out uint lpNumberOfBytesRead); [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi)] - internal static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, out IntPtr lpNumberOfBytesRead); + public static extern bool ReadProcessMemory(nint hProcess, nint lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, out nint lpNumberOfBytesRead); [return: MarshalAs(UnmanagedType.Bool)] [DllImport("user32.dll", SetLastError = true)] - public static extern bool GetWindowInfo(IntPtr hwnd, ref WindowInfo pwi); + public static extern bool GetWindowInfo(nint hwnd, ref WindowInfo pwi); [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi)] public static extern bool CreateProcess( string lpApplicationName, string lpCommandLine, ref SecurityAttributes lpProcessAttributes, ref SecurityAttributes lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags, - IntPtr lpEnvironment, string lpCurrentDirectory, [In] ref StartupInfo lpStartupInfo, + nint lpEnvironment, string lpCurrentDirectory, [In] ref StartupInfo lpStartupInfo, out ProcessInformation lpProcessInformation); [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi)] - public static extern uint ResumeThread(IntPtr hThread); + public static extern uint ResumeThread(nint hThread); [DllImport("kernel32.dll", SetLastError = true)] - public static extern IntPtr LocalFree(IntPtr hMem); + public static extern nint LocalFree(nint hMem); [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi)] - public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, int dwSize, out IntPtr lpNumberOfBytesWritten); + public static extern bool WriteProcessMemory(nint hProcess, nint lpBaseAddress, byte[] lpBuffer, int dwSize, out nint lpNumberOfBytesWritten); [DllImport("ntdll.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)] - public static extern int NtQueryInformationProcess(IntPtr hProcess, ProcessInfoClass pic, out ProcessBasicInformation pbi, int cb, out int pSize); + public static extern int NtQueryInformationProcess(nint hProcess, ProcessInfoClass pic, out ProcessBasicInformation pbi, int cb, out int pSize); [DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)] - public static extern bool SaferCreateLevel(SaferLevelScope scopeId, SaferLevel levelId, SaferOpen openFlags, out IntPtr levelHandle, IntPtr reserved); + public static extern bool SaferCreateLevel(SaferLevelScope scopeId, SaferLevel levelId, SaferOpen openFlags, out nint levelHandle, nint reserved); [DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)] - public static extern bool SaferComputeTokenFromLevel(IntPtr levelHandle, IntPtr inAccessToken, out IntPtr outAccessToken, SaferTokenBehaviour flags, IntPtr lpReserved); + public static extern bool SaferComputeTokenFromLevel(nint levelHandle, nint inAccessToken, out nint outAccessToken, SaferTokenBehaviour flags, nint lpReserved); [DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)] - public static extern bool SaferCloseLevel(IntPtr levelHandle); + public static extern bool SaferCloseLevel(nint levelHandle); [DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)] - public static extern bool SetTokenInformation(IntPtr tokenHandle, TokenInformationClass tokenInformationokenInformationClass, ref TokenMandatoryLabel tokenInformation, uint tokenInformationLength); + public static extern bool SetTokenInformation(nint tokenHandle, TokenInformationClass tokenInformationokenInformationClass, ref TokenMandatoryLabel tokenInformation, uint tokenInformationLength); [DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)] - public static extern bool ConvertStringSidToSid(string stringSid, out IntPtr ptrSid); + public static extern bool ConvertStringSidToSid(string stringSid, out nint ptrSid); [DllImport("advapi32.dll")] - public static extern uint GetLengthSid(IntPtr pSid); + public static extern uint GetLengthSid(nint pSid); [DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)] public static extern bool CreateProcessAsUser( - IntPtr hToken, + nint hToken, string lpApplicationName, string lpCommandLine, ref SecurityAttributes lpProcessAttributes, ref SecurityAttributes lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags, - IntPtr lpEnvironment, + nint lpEnvironment, string lpCurrentDirectory, ref StartupInfo lpStartupInfo, out ProcessInformation lpProcessInformation); [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - public static extern IntPtr GetModuleHandle(string lpModuleName); + public static extern nint GetModuleHandle(string lpModuleName); [DllImport("kernel32.dll")] - public static extern IntPtr CreateRemoteThread( - IntPtr hProcess, - IntPtr lpThreadAttributes, + public static extern nint CreateRemoteThread( + nint hProcess, + nint lpThreadAttributes, uint dwStackSize, - IntPtr lpStartAddress, - IntPtr lpParameter, + nint lpStartAddress, + nint lpParameter, uint dwCreationFlags, - out IntPtr lpThreadId); + out nint lpThreadId); [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)] - public static extern IntPtr VirtualAllocEx( - IntPtr hProcess, - IntPtr lpAddress, - IntPtr dwSize, + public static extern nint VirtualAllocEx( + nint hProcess, + nint lpAddress, + nint dwSize, uint dwAllocationType, uint dwProtect); [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)] public static extern bool VirtualFreeEx( - IntPtr hProcess, - IntPtr lpAddress, + nint hProcess, + nint lpAddress, uint dwSize, uint dwFreeType); [DllImport("kernel32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)] - public static extern IntPtr GetProcAddress(IntPtr hModule, string procName); + public static extern nint GetProcAddress(nint hModule, string procName); [DllImport("kernel32.dll", SetLastError = true)] - public static extern uint WaitForSingleObject(IntPtr hHandle, uint dwMilliseconds); + public static extern uint WaitForSingleObject(nint hHandle, uint dwMilliseconds); [DllImport("kernel32.dll", SetLastError = true)] - public static extern uint GetExitCodeThread(IntPtr hHandle, out IntPtr dwMilliseconds); + public static extern uint GetExitCodeThread(nint hHandle, out nint dwMilliseconds); [DllImport("kernel32.dll", SetLastError = true)] public static extern bool WriteProcessMemory( - IntPtr hProcess, - IntPtr lpBaseAddress, - IntPtr lpBuffer, + nint hProcess, + nint lpBaseAddress, + nint lpBuffer, int nSize, - out IntPtr lpNumberOfBytesWritten); + out nint lpNumberOfBytesWritten); [DllImport("kernel32.dll", SetLastError = true)] public static extern bool ReadProcessMemory( - IntPtr hProcess, - IntPtr lpBaseAddress, - IntPtr lpBuffer, + nint hProcess, + nint lpBaseAddress, + nint lpBuffer, int nSize, - out IntPtr lpNumberOfBytesRead); + out nint lpNumberOfBytesRead); [DllImport("user32.dll")] - public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); + public static extern uint GetWindowThreadProcessId(nint hWnd, out uint lpdwProcessId); [DllImport("user32.Dll")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool EnumChildWindows(IntPtr parentHandle, Win32Callback callback, IntPtr lParam); + public static extern bool EnumChildWindows(nint parentHandle, Win32Callback callback, nint lParam); } diff --git a/Daybreak/Utils/PathUtils.cs b/Daybreak.Shared/Utils/PathUtils.cs similarity index 94% rename from Daybreak/Utils/PathUtils.cs rename to Daybreak.Shared/Utils/PathUtils.cs index 228db0bc..f4c52d4c 100644 --- a/Daybreak/Utils/PathUtils.cs +++ b/Daybreak.Shared/Utils/PathUtils.cs @@ -3,7 +3,7 @@ using System.IO; using System.Linq; using System.Reflection; -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; public static class PathUtils { private static readonly Lazy RootPath = new(() => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? throw new InvalidOperationException("Unable to obtain application root path")); diff --git a/Daybreak/Utils/SerializationExtensions.cs b/Daybreak.Shared/Utils/SerializationExtensions.cs similarity index 89% rename from Daybreak/Utils/SerializationExtensions.cs rename to Daybreak.Shared/Utils/SerializationExtensions.cs index b21a0dbc..eba15edc 100644 --- a/Daybreak/Utils/SerializationExtensions.cs +++ b/Daybreak.Shared/Utils/SerializationExtensions.cs @@ -1,6 +1,6 @@ using System.Text; -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; public static class SerializationExtensions { diff --git a/Daybreak/Utils/StringUtils.cs b/Daybreak.Shared/Utils/StringUtils.cs similarity index 98% rename from Daybreak/Utils/StringUtils.cs rename to Daybreak.Shared/Utils/StringUtils.cs index 72143a62..1c62add6 100644 --- a/Daybreak/Utils/StringUtils.cs +++ b/Daybreak.Shared/Utils/StringUtils.cs @@ -3,7 +3,7 @@ using System.Extensions; using System.Linq; using System.Text.RegularExpressions; -namespace Daybreak.Utils; +namespace Daybreak.Shared.Utils; public static class StringUtils { diff --git a/Daybreak/Validators/AllGoesValidator.cs b/Daybreak.Shared/Validators/AllGoesValidator.cs similarity index 75% rename from Daybreak/Validators/AllGoesValidator.cs rename to Daybreak.Shared/Validators/AllGoesValidator.cs index b1004e3e..b7996e8e 100644 --- a/Daybreak/Validators/AllGoesValidator.cs +++ b/Daybreak.Shared/Validators/AllGoesValidator.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Validators; +namespace Daybreak.Shared.Validators; public sealed class AllGoesValidator : IValidator { diff --git a/Daybreak/Validators/BooleanValidator.cs b/Daybreak.Shared/Validators/BooleanValidator.cs similarity index 90% rename from Daybreak/Validators/BooleanValidator.cs rename to Daybreak.Shared/Validators/BooleanValidator.cs index 32567082..8454d497 100644 --- a/Daybreak/Validators/BooleanValidator.cs +++ b/Daybreak.Shared/Validators/BooleanValidator.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Validators; +namespace Daybreak.Shared.Validators; public sealed class BooleanValidator : IValidator { public bool IsValid(object value) diff --git a/Daybreak/Validators/ClampedValidator.cs b/Daybreak.Shared/Validators/ClampedValidator.cs similarity index 96% rename from Daybreak/Validators/ClampedValidator.cs rename to Daybreak.Shared/Validators/ClampedValidator.cs index 6396f87e..df16971a 100644 --- a/Daybreak/Validators/ClampedValidator.cs +++ b/Daybreak.Shared/Validators/ClampedValidator.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; -namespace Daybreak.Validators; +namespace Daybreak.Shared.Validators; public sealed class ClampedValidator : IValidator where T : IComparable diff --git a/Daybreak/Validators/EnumValidator.cs b/Daybreak.Shared/Validators/EnumValidator.cs similarity index 80% rename from Daybreak/Validators/EnumValidator.cs rename to Daybreak.Shared/Validators/EnumValidator.cs index 1ddaa5cd..68873f4a 100644 --- a/Daybreak/Validators/EnumValidator.cs +++ b/Daybreak.Shared/Validators/EnumValidator.cs @@ -1,6 +1,6 @@ using System; -namespace Daybreak.Validators; +namespace Daybreak.Shared.Validators; public sealed class EnumValidator : IValidator where T : struct, Enum @@ -9,7 +9,7 @@ public sealed class EnumValidator : IValidator { if (value is T enumValue) { - return Enum.IsDefined(enumValue); + return Enum.IsDefined(enumValue); } if (value is string stringValue) diff --git a/Daybreak/Validators/IValidator.cs b/Daybreak.Shared/Validators/IValidator.cs similarity index 60% rename from Daybreak/Validators/IValidator.cs rename to Daybreak.Shared/Validators/IValidator.cs index 34e6bb60..d04a5358 100644 --- a/Daybreak/Validators/IValidator.cs +++ b/Daybreak.Shared/Validators/IValidator.cs @@ -1,4 +1,4 @@ -namespace Daybreak.Validators; +namespace Daybreak.Shared.Validators; public interface IValidator { bool IsValid(object value); diff --git a/Daybreak.Tests/Models/InscriptionTests.cs b/Daybreak.Tests/Models/InscriptionTests.cs index febc7d10..a2e36da4 100644 --- a/Daybreak.Tests/Models/InscriptionTests.cs +++ b/Daybreak.Tests/Models/InscriptionTests.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Extensions; diff --git a/Daybreak.Tests/Models/ItemBaseTests.cs b/Daybreak.Tests/Models/ItemBaseTests.cs index a7435875..33e51489 100644 --- a/Daybreak.Tests/Models/ItemBaseTests.cs +++ b/Daybreak.Tests/Models/ItemBaseTests.cs @@ -1,10 +1,10 @@ -using Daybreak.Models.Guildwars; -using FluentAssertions; +using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Text; using System; using System.Linq; +using Daybreak.Shared.Models.Guildwars; namespace Daybreak.Tests.Models; diff --git a/Daybreak.Tests/Models/ItemTestsBase.cs b/Daybreak.Tests/Models/ItemTestsBase.cs index 243f7dcb..3f59fff7 100644 --- a/Daybreak.Tests/Models/ItemTestsBase.cs +++ b/Daybreak.Tests/Models/ItemTestsBase.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Extensions; diff --git a/Daybreak.Tests/Models/MaterialTests.cs b/Daybreak.Tests/Models/MaterialTests.cs index faa9c616..22190d73 100644 --- a/Daybreak.Tests/Models/MaterialTests.cs +++ b/Daybreak.Tests/Models/MaterialTests.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; diff --git a/Daybreak.Tests/Models/NpcTests.cs b/Daybreak.Tests/Models/NpcTests.cs index 98941edc..8b8137ad 100644 --- a/Daybreak.Tests/Models/NpcTests.cs +++ b/Daybreak.Tests/Models/NpcTests.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; diff --git a/Daybreak.Tests/Models/QuestTests.cs b/Daybreak.Tests/Models/QuestTests.cs index 868ab9b6..0694bd36 100644 --- a/Daybreak.Tests/Models/QuestTests.cs +++ b/Daybreak.Tests/Models/QuestTests.cs @@ -1,5 +1,4 @@ -using Daybreak.Models.Guildwars; -using FluentAssertions; +using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Reflection; @@ -7,6 +6,7 @@ using System.Text; using System; using System.Linq; using System.Extensions; +using Daybreak.Shared.Models.Guildwars; namespace Daybreak.Tests.Models; diff --git a/Daybreak.Tests/Models/RuneTests.cs b/Daybreak.Tests/Models/RuneTests.cs index 128300dd..77c06c0e 100644 --- a/Daybreak.Tests/Models/RuneTests.cs +++ b/Daybreak.Tests/Models/RuneTests.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; diff --git a/Daybreak.Tests/Models/VersionTests.cs b/Daybreak.Tests/Models/VersionTests.cs index 1750d394..f26ed8c0 100644 --- a/Daybreak.Tests/Models/VersionTests.cs +++ b/Daybreak.Tests/Models/VersionTests.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Versioning; +using Daybreak.Shared.Models.Versioning; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Linq; -using Version = Daybreak.Models.Versioning.Version; +using Version = Daybreak.Shared.Models.Versioning.Version; namespace Daybreak.Tests.Models; diff --git a/Daybreak.Tests/Models/VialOfDyeTests.cs b/Daybreak.Tests/Models/VialOfDyeTests.cs new file mode 100644 index 00000000..d718eb8c --- /dev/null +++ b/Daybreak.Tests/Models/VialOfDyeTests.cs @@ -0,0 +1,11 @@ +using Daybreak.Shared.Models.Guildwars; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; + +namespace Daybreak.Tests.Models; + +[TestClass] +public sealed class VialOfDyeTests : ItemTestsBase +{ + protected override IEnumerable AllItems { get; } = VialOfDye.Vials; +} diff --git a/Daybreak.Tests/Services/BuildTemplateManagerTests.cs b/Daybreak.Tests/Services/BuildTemplateManagerTests.cs index 5942dfae..ce710ef7 100644 --- a/Daybreak.Tests/Services/BuildTemplateManagerTests.cs +++ b/Daybreak.Tests/Services/BuildTemplateManagerTests.cs @@ -1,6 +1,7 @@ -using Daybreak.Models.Builds; -using Daybreak.Models.Guildwars; -using Daybreak.Services.BuildTemplates; +using Daybreak.Services.BuildTemplates; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.BuildTemplates; using FluentAssertions; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/Daybreak.Tests/Services/Models/TestArgumentHandler.cs b/Daybreak.Tests/Services/Models/TestArgumentHandler.cs index 110f1dfd..3dda9f03 100644 --- a/Daybreak.Tests/Services/Models/TestArgumentHandler.cs +++ b/Daybreak.Tests/Services/Models/TestArgumentHandler.cs @@ -1,4 +1,4 @@ -using Daybreak.Services.ApplicationArguments.ArgumentHandling; +using Daybreak.Shared.Services.ApplicationArguments.ArgumentHandling; using FluentAssertions; namespace Daybreak.Tests.Services.Models; diff --git a/Daybreak.Tests/Services/Models/TestArgumentHandler2.cs b/Daybreak.Tests/Services/Models/TestArgumentHandler2.cs index 5e9fe887..7381b2ed 100644 --- a/Daybreak.Tests/Services/Models/TestArgumentHandler2.cs +++ b/Daybreak.Tests/Services/Models/TestArgumentHandler2.cs @@ -1,4 +1,4 @@ -using Daybreak.Services.ApplicationArguments.ArgumentHandling; +using Daybreak.Shared.Services.ApplicationArguments.ArgumentHandling; using FluentAssertions; namespace Daybreak.Tests.Services.Models; diff --git a/Daybreak.sln b/Daybreak.sln index 91c3028b..8b45afa8 100644 --- a/Daybreak.sln +++ b/Daybreak.sln @@ -34,6 +34,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Daybreak.7ZipExtractor", "Daybreak.7ZipExtractor\Daybreak.7ZipExtractor.csproj", "{CA60F9AC-A496-4DB6-970E-ECE73B051C05}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Daybreak.API", "Daybreak.API\Daybreak.API.csproj", "{38546C66-D14D-47B3-9F13-3CC439C271E6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Daybreak.Shared", "Daybreak.Shared\Daybreak.Shared.csproj", "{B09BC4ED-E9F4-4A4B-B66B-50C307594B02}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -92,6 +96,30 @@ Global {CA60F9AC-A496-4DB6-970E-ECE73B051C05}.Release|x64.Build.0 = Release|Any CPU {CA60F9AC-A496-4DB6-970E-ECE73B051C05}.Release|x86.ActiveCfg = Release|x64 {CA60F9AC-A496-4DB6-970E-ECE73B051C05}.Release|x86.Build.0 = Release|x64 + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Debug|x64.ActiveCfg = Debug|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Debug|x64.Build.0 = Debug|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Debug|x86.ActiveCfg = Debug|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Debug|x86.Build.0 = Debug|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Release|Any CPU.Build.0 = Release|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Release|x64.ActiveCfg = Release|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Release|x64.Build.0 = Release|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Release|x86.ActiveCfg = Release|Any CPU + {38546C66-D14D-47B3-9F13-3CC439C271E6}.Release|x86.Build.0 = Release|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Debug|x64.ActiveCfg = Debug|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Debug|x64.Build.0 = Debug|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Debug|x86.ActiveCfg = Debug|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Debug|x86.Build.0 = Debug|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Release|Any CPU.Build.0 = Release|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Release|x64.ActiveCfg = Release|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Release|x64.Build.0 = Release|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Release|x86.ActiveCfg = Release|Any CPU + {B09BC4ED-E9F4-4A4B-B66B-50C307594B02}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Daybreak/Attributes/OptionCustomValidatorAttribute.cs b/Daybreak/Attributes/OptionCustomValidatorAttribute.cs index f4592a5b..78912575 100644 --- a/Daybreak/Attributes/OptionCustomValidatorAttribute.cs +++ b/Daybreak/Attributes/OptionCustomValidatorAttribute.cs @@ -1,4 +1,4 @@ -using Daybreak.Validators; +using Daybreak.Shared.Validators; using System; namespace Daybreak.Attributes; diff --git a/Daybreak/Attributes/OptionSetterView.cs b/Daybreak/Attributes/OptionSetterView.cs index bc3d5258..1bb77bf6 100644 --- a/Daybreak/Attributes/OptionSetterView.cs +++ b/Daybreak/Attributes/OptionSetterView.cs @@ -6,9 +6,9 @@ namespace Daybreak.Attributes; /// /// Mark a custom view that is supposed to set the value of the option. /// In the option view, a button will be displayed that will redirect to the custom view. -/// The custom view must be registered in the +/// The custom view must be registered in the /// -/// Type of view. Has to be registered in the +/// Type of view. Has to be registered in the [AttributeUsage(AttributeTargets.Property)] public sealed class OptionSetterView : Attribute where T : UserControl diff --git a/Daybreak/Configuration/Options/AscalonTradeChatOptions.cs b/Daybreak/Configuration/Options/AscalonTradeChatOptions.cs index 299d7342..a9279b5e 100644 --- a/Daybreak/Configuration/Options/AscalonTradeChatOptions.cs +++ b/Daybreak/Configuration/Options/AscalonTradeChatOptions.cs @@ -1,4 +1,5 @@ using Daybreak.Attributes; +using Daybreak.Shared.Configuration.Options; namespace Daybreak.Configuration.Options; diff --git a/Daybreak/Configuration/Options/CredentialManagerOptions.cs b/Daybreak/Configuration/Options/CredentialManagerOptions.cs index 86dfd426..952bb080 100644 --- a/Daybreak/Configuration/Options/CredentialManagerOptions.cs +++ b/Daybreak/Configuration/Options/CredentialManagerOptions.cs @@ -1,5 +1,5 @@ using Daybreak.Attributes; -using Daybreak.Models; +using Daybreak.Shared.Models; using Newtonsoft.Json; using System.Collections.Generic; diff --git a/Daybreak/Configuration/Options/FocusViewOptions.cs b/Daybreak/Configuration/Options/FocusViewOptions.cs index 6696e97b..8941413c 100644 --- a/Daybreak/Configuration/Options/FocusViewOptions.cs +++ b/Daybreak/Configuration/Options/FocusViewOptions.cs @@ -1,6 +1,6 @@ using Daybreak.Attributes; using Daybreak.Configuration.FocusView; -using Daybreak.Models.Browser; +using Daybreak.Shared.Models.Browser; using Newtonsoft.Json; namespace Daybreak.Configuration.Options; diff --git a/Daybreak/Configuration/Options/KamadanTradeChatOptions.cs b/Daybreak/Configuration/Options/KamadanTradeChatOptions.cs index 13dd9b17..fefcc922 100644 --- a/Daybreak/Configuration/Options/KamadanTradeChatOptions.cs +++ b/Daybreak/Configuration/Options/KamadanTradeChatOptions.cs @@ -1,4 +1,5 @@ using Daybreak.Attributes; +using Daybreak.Shared.Configuration.Options; namespace Daybreak.Configuration.Options; diff --git a/Daybreak/Configuration/Options/LaunchConfigurationServiceOptions.cs b/Daybreak/Configuration/Options/LaunchConfigurationServiceOptions.cs index c485a3c0..dd42e7cc 100644 --- a/Daybreak/Configuration/Options/LaunchConfigurationServiceOptions.cs +++ b/Daybreak/Configuration/Options/LaunchConfigurationServiceOptions.cs @@ -1,5 +1,5 @@ using Daybreak.Attributes; -using Daybreak.Models.LaunchConfigurations; +using Daybreak.Shared.Models.LaunchConfigurations; using Newtonsoft.Json; using System.Collections.Generic; diff --git a/Daybreak/Configuration/Options/LauncherOptions.cs b/Daybreak/Configuration/Options/LauncherOptions.cs index 780e1948..16e32e83 100644 --- a/Daybreak/Configuration/Options/LauncherOptions.cs +++ b/Daybreak/Configuration/Options/LauncherOptions.cs @@ -54,10 +54,6 @@ public sealed class LauncherOptions [OptionRange(MinValue = 30, MaxValue = 300)] public double ModStartupTimeout { get; set; } = 30; - [JsonProperty(nameof(PersistentLogging))] - [OptionName(Name = "Persistent Logging", Description = "If true, the launcher will save logs in the local database. Otherwise, the launcher will only keep logs in a memory cache")] - public bool PersistentLogging { get; set; } = false; - [JsonProperty(nameof(BetaUpdate))] [OptionName(Name = "Beta Update", Description = "If true, the launcher will use the new update procedure")] public bool BetaUpdate { get; set; } = true; diff --git a/Daybreak/Configuration/Options/ThemeOptions.cs b/Daybreak/Configuration/Options/ThemeOptions.cs index c6bb0511..fb892f7c 100644 --- a/Daybreak/Configuration/Options/ThemeOptions.cs +++ b/Daybreak/Configuration/Options/ThemeOptions.cs @@ -1,5 +1,5 @@ using Daybreak.Attributes; -using Daybreak.Models; +using Daybreak.Shared.Models; namespace Daybreak.Configuration.Options; diff --git a/Daybreak/Configuration/Options/TradeAlertingOptions.cs b/Daybreak/Configuration/Options/TradeAlertingOptions.cs index 755de8a8..32a80670 100644 --- a/Daybreak/Configuration/Options/TradeAlertingOptions.cs +++ b/Daybreak/Configuration/Options/TradeAlertingOptions.cs @@ -1,5 +1,5 @@ using Daybreak.Attributes; -using Daybreak.Models.Trade; +using Daybreak.Shared.Models.Trade; using System; using System.Collections.Generic; diff --git a/Daybreak/Configuration/Options/UModOptions.cs b/Daybreak/Configuration/Options/UModOptions.cs index 8855721f..503d7bb7 100644 --- a/Daybreak/Configuration/Options/UModOptions.cs +++ b/Daybreak/Configuration/Options/UModOptions.cs @@ -1,5 +1,5 @@ using Daybreak.Attributes; -using Daybreak.Models.UMod; +using Daybreak.Shared.Models.UMod; using Newtonsoft.Json; using System.Collections.Generic; diff --git a/Daybreak/Configuration/ProjectConfiguration.cs b/Daybreak/Configuration/ProjectConfiguration.cs index 0b9ce8a2..482dc4d3 100644 --- a/Daybreak/Configuration/ProjectConfiguration.cs +++ b/Daybreak/Configuration/ProjectConfiguration.cs @@ -14,7 +14,6 @@ using Microsoft.Extensions.Logging; using Slim; using System.Extensions; using Daybreak.Services.Options; -using Daybreak.Models; using Microsoft.CorrelationVector; using System.Logging; using Daybreak.Services.Updater.PostUpdate; @@ -44,13 +43,11 @@ using Daybreak.Services.TradeChat; using Daybreak.Views.Trade; using System.Net.WebSockets; using Daybreak.Services.Notifications; -using Daybreak.Services.TradeChat.Models; using Daybreak.Services.Charts; using Daybreak.Services.Images; using Daybreak.Services.InternetChecker; using System; using Daybreak.Services.Sounds; -using Daybreak.Services.Notifications.Models; using Daybreak.Models.Notifications.Handling; using Daybreak.Services.TradeChat.Notifications; using Daybreak.Views.Copy; @@ -61,7 +58,6 @@ using Daybreak.Services.Registry; using Daybreak.Services.DSOAL.Actions; using Daybreak.Services.Events; using Daybreak.Controls; -using Daybreak.Models.Plugins; using Daybreak.Services.Plugins; using Daybreak.Services.Toolbox.Utilities; using Daybreak.Services.Injection; @@ -81,14 +77,65 @@ using Daybreak.Services.ApplicationArguments.ArgumentHandling; using Daybreak.Services.Window; using Daybreak.Launch; using Daybreak.Views.Installation; -using Daybreak.Services.Logging.Models; using Daybreak.Services.Toolbox.Notifications; using Daybreak.Services.Guildwars; +using Daybreak.Services.Api; +using Daybreak.Services.Notifications.Handlers; +using Microsoft.Data.Sqlite; +using Daybreak.Shared.Services.Options; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Services.Screens; +using Daybreak.Shared.Services.Logging; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.TradeChat; +using Daybreak.Shared.Services.Scanner; +using Daybreak.Shared.Services.Themes; +using Daybreak.Shared.Services.Shortcuts; +using Daybreak.Shared.Services.Guildwars; +using Daybreak.Shared.Services.Registry; +using Daybreak.Shared.Services.Images; +using Daybreak.Shared.Services.Credentials; +using Daybreak.Shared.Services.Onboarding; +using Daybreak.Shared.Services.Sounds; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Services.Browser; +using Daybreak.Shared.Services.DSOAL; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.SevenZip; +using Daybreak.Shared.Services.DirectSong; +using Daybreak.Shared.Services.ApplicationArguments; +using Daybreak.Shared.Services.LaunchConfigurations; +using Daybreak.Shared.Services.UMod; +using Daybreak.Shared.Services.Updater; +using Daybreak.Shared.Services.Injection; +using Daybreak.Shared.Services.Metrics; +using Daybreak.Shared.Services.Mutex; +using Daybreak.Shared.Services.IconRetrieve; +using Daybreak.Shared.Services.Updater.PostUpdate; +using Daybreak.Shared.Services.Mods; +using Daybreak.Shared.Services.Screenshots; +using Daybreak.Shared.Services.Plugins; +using Daybreak.Shared.Services.Experience; +using Daybreak.Shared.Services.Window; +using Daybreak.Shared.Services.ApplicationLauncher; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Toolbox; +using Daybreak.Shared.Services.Events; +using Daybreak.Shared.Services.Startup; +using Daybreak.Shared.Services.InternetChecker; +using Daybreak.Shared.Services.ReShade; +using Daybreak.Shared.Services.Api; +using Daybreak.Shared.Services.Privilege; +using Daybreak.Shared.Services.Downloads; +using Daybreak.Shared.Shared.Models.Plugins; +using Daybreak.Shared.Models; namespace Daybreak.Configuration; public class ProjectConfiguration : PluginConfigurationBase { + private const string DbConnectionString = "Data Source=Daybreak.sqlite.db"; + public override void RegisterResolvers(IServiceManager serviceManager) { serviceManager.ThrowIfNull(); @@ -102,8 +149,16 @@ public class ProjectConfiguration : PluginConfigurationBase { services.ThrowIfNull(); - this.RegisterLiteCollections(services); this.RegisterHttpClients(services); + services.AddScoped(sp => + { + var connection = new SqliteConnection(DbConnectionString); + connection.Open(); + return connection; + }); + services.AddScoped(sp => new TradeQuoteDbContext(sp.GetRequiredService())); + services.AddScoped(sp => new NotificationsDbContext(sp.GetRequiredService())); + services.AddScoped(sp => new TradeMessagesDbContext(sp.GetRequiredService())); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); @@ -193,6 +248,7 @@ public class ProjectConfiguration : PluginConfigurationBase services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); @@ -277,6 +333,7 @@ public class ProjectConfiguration : PluginConfigurationBase { startupActionProducer.ThrowIfNull(); + startupActionProducer.RegisterAction(); startupActionProducer.RegisterAction(); startupActionProducer.RegisterAction(); startupActionProducer.RegisterAction(); @@ -352,6 +409,7 @@ public class ProjectConfiguration : PluginConfigurationBase modsManager.RegisterMod(); modsManager.RegisterMod(); modsManager.RegisterMod(singleton: true); + modsManager.RegisterMod(); } public override void RegisterBrowserExtensions(IBrowserExtensionsProducer browserExtensionsProducer) @@ -400,14 +458,6 @@ public class ProjectConfiguration : PluginConfigurationBase .RegisterButton("Metrics", "Open metrics view", sp => sp.GetRequiredService().ShowView()); } - private void RegisterLiteCollections(IServiceCollection services) - { - this.RegisterCollection(services); - this.RegisterCollection(services); - this.RegisterCollection(services); - this.RegisterCollection(services); - } - private IServiceCollection RegisterHttpClients(IServiceCollection services) { return services diff --git a/Daybreak/Controls/AsyncImage.xaml b/Daybreak/Controls/AsyncImage.xaml index 9c5f3217..b91be484 100644 --- a/Daybreak/Controls/AsyncImage.xaml +++ b/Daybreak/Controls/AsyncImage.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" mc:Ignorable="d" x:Name="_this" Loaded="AsyncImage_Loaded" diff --git a/Daybreak/Controls/AsyncImage.xaml.cs b/Daybreak/Controls/AsyncImage.xaml.cs index af0f03e5..1796372a 100644 --- a/Daybreak/Controls/AsyncImage.xaml.cs +++ b/Daybreak/Controls/AsyncImage.xaml.cs @@ -1,4 +1,5 @@ -using Daybreak.Services.Images; +using Daybreak.Shared; +using Daybreak.Shared.Services.Images; using Microsoft.Extensions.DependencyInjection; using System.Core.Extensions; using System.Threading; @@ -39,7 +40,7 @@ public partial class AsyncImage : UserControl } public AsyncImage() - : this(Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + : this(Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/Buttons/BrowserButton.xaml b/Daybreak/Controls/Buttons/BrowserButton.xaml index fb8db836..5e650c2f 100644 --- a/Daybreak/Controls/Buttons/BrowserButton.xaml +++ b/Daybreak/Controls/Buttons/BrowserButton.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Buttons" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Controls/Buttons/CopyButton.xaml b/Daybreak/Controls/Buttons/CopyButton.xaml index 6027511c..c69fa6a1 100644 --- a/Daybreak/Controls/Buttons/CopyButton.xaml +++ b/Daybreak/Controls/Buttons/CopyButton.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Buttons" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Controls/Buttons/HighlightButton.xaml b/Daybreak/Controls/Buttons/HighlightButton.xaml index 1c375a28..7b7a7be4 100644 --- a/Daybreak/Controls/Buttons/HighlightButton.xaml +++ b/Daybreak/Controls/Buttons/HighlightButton.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Buttons" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" x:Name="_this" Cursor="Hand" mc:Ignorable="d" diff --git a/Daybreak/Controls/Buttons/MenuButton.xaml b/Daybreak/Controls/Buttons/MenuButton.xaml index 087db589..053a4d7c 100644 --- a/Daybreak/Controls/Buttons/MenuButton.xaml +++ b/Daybreak/Controls/Buttons/MenuButton.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Buttons" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" x:Name="_this" Cursor="Hand" mc:Ignorable="d" diff --git a/Daybreak/Controls/ChromiumBrowserWrapper.xaml b/Daybreak/Controls/ChromiumBrowserWrapper.xaml index fa019ad5..3e748126 100644 --- a/Daybreak/Controls/ChromiumBrowserWrapper.xaml +++ b/Daybreak/Controls/ChromiumBrowserWrapper.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" xmlns:local="clr-namespace:Daybreak.Controls" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" Loaded="UserControl_Loaded" diff --git a/Daybreak/Controls/ChromiumBrowserWrapper.xaml.cs b/Daybreak/Controls/ChromiumBrowserWrapper.xaml.cs index e89e6e72..63274bdb 100644 --- a/Daybreak/Controls/ChromiumBrowserWrapper.xaml.cs +++ b/Daybreak/Controls/ChromiumBrowserWrapper.xaml.cs @@ -1,9 +1,12 @@ using Daybreak.Configuration.Options; -using Daybreak.Models; -using Daybreak.Models.Browser; -using Daybreak.Models.Builds; using Daybreak.Services.Browser; -using Daybreak.Services.BuildTemplates; +using Daybreak.Shared; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Browser; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Services.Browser; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Utils; using Daybreak.Utils; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -105,12 +108,12 @@ public partial class ChromiumBrowserWrapper : UserControl public ChromiumBrowserWrapper() : this( - Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService>(), - Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService>(), - Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService>()) + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService>(), + Global.GlobalServiceProvider.GetRequiredService>(), + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService>()) { } diff --git a/Daybreak/Controls/DropDownButton.xaml b/Daybreak/Controls/DropDownButton.xaml index 97cba942..c154f852 100644 --- a/Daybreak/Controls/DropDownButton.xaml +++ b/Daybreak/Controls/DropDownButton.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Controls" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:glyphs="clr-namespace:Daybreak.Controls.Glyphs" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" mc:Ignorable="d" x:Name="_this" Tag="{Binding RelativeSource={RelativeSource Self}}" diff --git a/Daybreak/Controls/FocusViewComponents/CurrentMapComponent.xaml.cs b/Daybreak/Controls/FocusViewComponents/CurrentMapComponent.xaml.cs index 94c5e4f3..139eaacd 100644 --- a/Daybreak/Controls/FocusViewComponents/CurrentMapComponent.xaml.cs +++ b/Daybreak/Controls/FocusViewComponents/CurrentMapComponent.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; using System.Windows.Controls; using System.Windows.Input; diff --git a/Daybreak/Controls/FocusViewComponents/CurrentQuestComponent.xaml.cs b/Daybreak/Controls/FocusViewComponents/CurrentQuestComponent.xaml.cs index ff4b9e72..f1fe20d4 100644 --- a/Daybreak/Controls/FocusViewComponents/CurrentQuestComponent.xaml.cs +++ b/Daybreak/Controls/FocusViewComponents/CurrentQuestComponent.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; using System.Windows.Controls; diff --git a/Daybreak/Controls/FocusViewComponents/MainPlayerInformationComponent.xaml.cs b/Daybreak/Controls/FocusViewComponents/MainPlayerInformationComponent.xaml.cs index 5cb48610..240aaa90 100644 --- a/Daybreak/Controls/FocusViewComponents/MainPlayerInformationComponent.xaml.cs +++ b/Daybreak/Controls/FocusViewComponents/MainPlayerInformationComponent.xaml.cs @@ -1,8 +1,9 @@ using Daybreak.Launch; -using Daybreak.Models.Guildwars; -using Daybreak.Services.BuildTemplates; -using Daybreak.Services.Navigation; -using Daybreak.Services.Scanner; +using Daybreak.Shared; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Scanner; using Daybreak.Views; using Microsoft.Extensions.DependencyInjection; using System; @@ -24,9 +25,9 @@ public partial class MainPlayerInformationComponent : UserControl public MainPlayerInformationComponent() : this( - Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/FocusViewComponents/PlayerResourcesComponent.xaml b/Daybreak/Controls/FocusViewComponents/PlayerResourcesComponent.xaml index d5520228..8992517a 100644 --- a/Daybreak/Controls/FocusViewComponents/PlayerResourcesComponent.xaml +++ b/Daybreak/Controls/FocusViewComponents/PlayerResourcesComponent.xaml @@ -4,8 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.FocusViewComponents" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" - xmlns:converters="clr-namespace:Daybreak.Converters" x:Name="_this" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Controls/FocusViewComponents/PlayerResourcesComponent.xaml.cs b/Daybreak/Controls/FocusViewComponents/PlayerResourcesComponent.xaml.cs index ddac2557..8af8fb4c 100644 --- a/Daybreak/Controls/FocusViewComponents/PlayerResourcesComponent.xaml.cs +++ b/Daybreak/Controls/FocusViewComponents/PlayerResourcesComponent.xaml.cs @@ -1,8 +1,9 @@ using Daybreak.Configuration.Options; using Daybreak.Launch; -using Daybreak.Models; -using Daybreak.Models.Guildwars; -using Daybreak.Services.Experience; +using Daybreak.Shared; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.Experience; using Microsoft.Extensions.DependencyInjection; using System.Configuration; using System.Core.Extensions; @@ -58,8 +59,8 @@ public partial class PlayerResourcesComponent : UserControl public PlayerResourcesComponent() : this( - Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService>()) + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService>()) { } diff --git a/Daybreak/Controls/FocusViewComponents/QuestLogComponent.xaml.cs b/Daybreak/Controls/FocusViewComponents/QuestLogComponent.xaml.cs index c047b78c..1c04ebdd 100644 --- a/Daybreak/Controls/FocusViewComponents/QuestLogComponent.xaml.cs +++ b/Daybreak/Controls/FocusViewComponents/QuestLogComponent.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; using System.Windows.Controls; diff --git a/Daybreak/Controls/FocusViewComponents/TitleInformationComponent.xaml.cs b/Daybreak/Controls/FocusViewComponents/TitleInformationComponent.xaml.cs index cb8d3ff6..3e9a0a61 100644 --- a/Daybreak/Controls/FocusViewComponents/TitleInformationComponent.xaml.cs +++ b/Daybreak/Controls/FocusViewComponents/TitleInformationComponent.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; using System.Windows; using System.Windows.Controls; diff --git a/Daybreak/Controls/Glyphs/StarGlyph.xaml b/Daybreak/Controls/Glyphs/StarGlyph.xaml index 2528e95a..7e7eec7f 100644 --- a/Daybreak/Controls/Glyphs/StarGlyph.xaml +++ b/Daybreak/Controls/Glyphs/StarGlyph.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Glyphs" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" mc:Ignorable="d" Cursor="Hand" x:Name="_this" diff --git a/Daybreak/Controls/MenuList.xaml.cs b/Daybreak/Controls/MenuList.xaml.cs index 5936f661..ddf755b8 100644 --- a/Daybreak/Controls/MenuList.xaml.cs +++ b/Daybreak/Controls/MenuList.xaml.cs @@ -2,9 +2,10 @@ using Daybreak.Controls.Buttons; using Daybreak.Controls.Options; using Daybreak.Launch; -using Daybreak.Services.Menu; -using Daybreak.Services.Navigation; using Daybreak.Services.Notifications; +using Daybreak.Shared; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Services.Navigation; using Daybreak.Views; using Daybreak.Views.Copy; using Daybreak.Views.Installation; @@ -49,11 +50,11 @@ public partial class MenuList : UserControl public MenuList() : this( - Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService>()) + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService>()) { } @@ -150,7 +151,7 @@ public partial class MenuList : UserControl { while (!cancellationToken.IsCancellationRequested) { - var unopenedNotifications = this.notificationStorage.GetPendingNotifications(); + var unopenedNotifications = await this.notificationStorage.GetPendingNotifications(cancellationToken); if (unopenedNotifications.Any()) { await this.Dispatcher.InvokeAsync(() => diff --git a/Daybreak/Controls/Notifications/NotificationStackpanel.xaml.cs b/Daybreak/Controls/Notifications/NotificationStackpanel.xaml.cs index 64ef834f..2f7453cb 100644 --- a/Daybreak/Controls/Notifications/NotificationStackpanel.xaml.cs +++ b/Daybreak/Controls/Notifications/NotificationStackpanel.xaml.cs @@ -1,6 +1,7 @@ -using Daybreak.Models.Notifications; -using Daybreak.Services.Notifications; -using Daybreak.Services.Sounds; +using Daybreak.Shared; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Sounds; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using System; @@ -27,8 +28,8 @@ public partial class NotificationStackpanel : UserControl public ObservableCollection Notifications { get; } = []; public NotificationStackpanel() : - this(Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + this(Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/Notifications/NotificationTemplate.xaml b/Daybreak/Controls/Notifications/NotificationTemplate.xaml index bf10a173..01fcd8cc 100644 --- a/Daybreak/Controls/Notifications/NotificationTemplate.xaml +++ b/Daybreak/Controls/Notifications/NotificationTemplate.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Notifications" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Controls/Notifications/NotificationTemplate.xaml.cs b/Daybreak/Controls/Notifications/NotificationTemplate.xaml.cs index b3929421..c2d0a629 100644 --- a/Daybreak/Controls/Notifications/NotificationTemplate.xaml.cs +++ b/Daybreak/Controls/Notifications/NotificationTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Notifications; +using Daybreak.Shared.Models.Notifications; using System; using System.Windows.Controls; diff --git a/Daybreak/Controls/Notifications/NotificationTemplateSelector.cs b/Daybreak/Controls/Notifications/NotificationTemplateSelector.cs index 36d1bcba..73f68009 100644 --- a/Daybreak/Controls/Notifications/NotificationTemplateSelector.cs +++ b/Daybreak/Controls/Notifications/NotificationTemplateSelector.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Notifications; +using Daybreak.Shared.Models.Notifications; using Microsoft.Extensions.Logging; using System.Extensions; using System.Windows; diff --git a/Daybreak/Controls/Notifications/NotificationView.xaml.cs b/Daybreak/Controls/Notifications/NotificationView.xaml.cs index 9e0ede6b..0632b23a 100644 --- a/Daybreak/Controls/Notifications/NotificationView.xaml.cs +++ b/Daybreak/Controls/Notifications/NotificationView.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Notifications; +using Daybreak.Shared.Models.Notifications; using System; using System.Windows; using System.Windows.Controls; diff --git a/Daybreak/Controls/Options/BooleanOptionTemplate.xaml.cs b/Daybreak/Controls/Options/BooleanOptionTemplate.xaml.cs index 1ef54863..9193473d 100644 --- a/Daybreak/Controls/Options/BooleanOptionTemplate.xaml.cs +++ b/Daybreak/Controls/Options/BooleanOptionTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Options; +using Daybreak.Shared.Models.Options; using System.Windows; using System.Windows.Controls; using System.Windows.Extensions; diff --git a/Daybreak/Controls/Options/EnumOptionTemplate.xaml.cs b/Daybreak/Controls/Options/EnumOptionTemplate.xaml.cs index c9f87661..f0a89fe0 100644 --- a/Daybreak/Controls/Options/EnumOptionTemplate.xaml.cs +++ b/Daybreak/Controls/Options/EnumOptionTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Options; +using Daybreak.Shared.Models.Options; using System; using System.Collections.ObjectModel; using System.Extensions; diff --git a/Daybreak/Controls/Options/OptionsSection.xaml b/Daybreak/Controls/Options/OptionsSection.xaml index d37b70f0..1300af00 100644 --- a/Daybreak/Controls/Options/OptionsSection.xaml +++ b/Daybreak/Controls/Options/OptionsSection.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Options" - xmlns:models="clr-namespace:Daybreak.Models.Options" + xmlns:models="clr-namespace:Daybreak.Shared.Models.Options;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" x:Name="_this" diff --git a/Daybreak/Controls/Options/OptionsSection.xaml.cs b/Daybreak/Controls/Options/OptionsSection.xaml.cs index bcbfe823..ffe5904d 100644 --- a/Daybreak/Controls/Options/OptionsSection.xaml.cs +++ b/Daybreak/Controls/Options/OptionsSection.xaml.cs @@ -1,9 +1,10 @@ using Daybreak.Attributes; using Daybreak.Controls.Buttons; using Daybreak.Launch; -using Daybreak.Models.Options; -using Daybreak.Services.Navigation; -using Daybreak.Services.Options; +using Daybreak.Shared; +using Daybreak.Shared.Models.Options; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Options; using Daybreak.Views; using Microsoft.Extensions.DependencyInjection; using System; @@ -34,8 +35,8 @@ public partial class OptionsSection : UserControl } public OptionsSection() - : this(Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + : this(Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService()) { this.InitializeComponent(); this.InitializeOptions(); diff --git a/Daybreak/Controls/Options/PrimitiveRangeOptionTemplate.xaml.cs b/Daybreak/Controls/Options/PrimitiveRangeOptionTemplate.xaml.cs index 78f0f6b4..2fd9b7ec 100644 --- a/Daybreak/Controls/Options/PrimitiveRangeOptionTemplate.xaml.cs +++ b/Daybreak/Controls/Options/PrimitiveRangeOptionTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Options; +using Daybreak.Shared.Models.Options; using System.Windows; using System.Windows.Controls; using System.Windows.Extensions; diff --git a/Daybreak/Controls/Options/StringOptionTemplate.xaml.cs b/Daybreak/Controls/Options/StringOptionTemplate.xaml.cs index 03480e7d..51dce4e0 100644 --- a/Daybreak/Controls/Options/StringOptionTemplate.xaml.cs +++ b/Daybreak/Controls/Options/StringOptionTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Options; +using Daybreak.Shared.Models.Options; using System.Windows; using System.Windows.Controls; using System.Windows.Extensions; diff --git a/Daybreak/Controls/SnowfallOverlay.xaml b/Daybreak/Controls/SnowfallOverlay.xaml index 55ec298c..3f5c4fc5 100644 --- a/Daybreak/Controls/SnowfallOverlay.xaml +++ b/Daybreak/Controls/SnowfallOverlay.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls" xmlns:effects="clr-namespace:System.Windows.Media.Extensions.Effects;assembly=WpfExtended" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" mc:Ignorable="d" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" diff --git a/Daybreak/Controls/Templates/AccountTemplate.xaml b/Daybreak/Controls/Templates/AccountTemplate.xaml index 9b5a06a8..8b4e3159 100644 --- a/Daybreak/Controls/Templates/AccountTemplate.xaml +++ b/Daybreak/Controls/Templates/AccountTemplate.xaml @@ -7,7 +7,7 @@ xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" x:Name="_this" mc:Ignorable="d" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Controls/Templates/AccountTemplate.xaml.cs b/Daybreak/Controls/Templates/AccountTemplate.xaml.cs index 063e24cd..246458e9 100644 --- a/Daybreak/Controls/Templates/AccountTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/AccountTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models; +using Daybreak.Shared.Models; using System; using System.Extensions; using System.Windows; diff --git a/Daybreak/Controls/Templates/AttributeTemplate.xaml.cs b/Daybreak/Controls/Templates/AttributeTemplate.xaml.cs index 5799a329..6b26ee66 100644 --- a/Daybreak/Controls/Templates/AttributeTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/AttributeTemplate.xaml.cs @@ -1,5 +1,6 @@ -using Daybreak.Models.Builds; -using Daybreak.Services.BuildTemplates; +using Daybreak.Shared; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Services.BuildTemplates; using Microsoft.Extensions.DependencyInjection; using System; using System.Core.Extensions; @@ -30,7 +31,7 @@ public partial class AttributeTemplate : UserControl private int attributePoints; public AttributeTemplate() - : this(Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + : this(Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/Templates/BuildEntryTemplate.xaml b/Daybreak/Controls/Templates/BuildEntryTemplate.xaml index 96c5251d..12f401dd 100644 --- a/Daybreak/Controls/Templates/BuildEntryTemplate.xaml +++ b/Daybreak/Controls/Templates/BuildEntryTemplate.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Controls" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Controls/Templates/BuildEntryTemplate.xaml.cs b/Daybreak/Controls/Templates/BuildEntryTemplate.xaml.cs index eb0bf494..7cad6a95 100644 --- a/Daybreak/Controls/Templates/BuildEntryTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/BuildEntryTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Builds; +using Daybreak.Shared.Models.Builds; using System; using System.Windows.Controls; diff --git a/Daybreak/Controls/Templates/BuildTemplate.xaml.cs b/Daybreak/Controls/Templates/BuildTemplate.xaml.cs index 58e8206d..794d77d4 100644 --- a/Daybreak/Controls/Templates/BuildTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/BuildTemplate.xaml.cs @@ -1,11 +1,12 @@ using Daybreak.Controls.Buttons; using Daybreak.Launch; -using Daybreak.Models; -using Daybreak.Models.Builds; -using Daybreak.Models.Guildwars; -using Daybreak.Services.BuildTemplates; -using Daybreak.Services.Navigation; -using Daybreak.Utils; +using Daybreak.Shared; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Utils; using Daybreak.Views; using Microsoft.Extensions.DependencyInjection; using System; @@ -64,9 +65,9 @@ public partial class BuildTemplate : UserControl public event EventHandler? BuildChanged; public BuildTemplate() - : this(Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + : this(Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/Templates/GuildwarsPathTemplate.xaml b/Daybreak/Controls/Templates/GuildwarsPathTemplate.xaml index 2504fcd8..47724690 100644 --- a/Daybreak/Controls/Templates/GuildwarsPathTemplate.xaml +++ b/Daybreak/Controls/Templates/GuildwarsPathTemplate.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:local="clr-namespace:Daybreak.Controls" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:glyphs="clr-namespace:Daybreak.Controls.Glyphs" diff --git a/Daybreak/Controls/Templates/GuildwarsPathTemplate.xaml.cs b/Daybreak/Controls/Templates/GuildwarsPathTemplate.xaml.cs index df9709de..413adbd5 100644 --- a/Daybreak/Controls/Templates/GuildwarsPathTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/GuildwarsPathTemplate.xaml.cs @@ -1,7 +1,8 @@ using Daybreak.Controls.Buttons; -using Daybreak.Models; -using Daybreak.Models.Progress; -using Daybreak.Services.Guildwars; +using Daybreak.Shared; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Guildwars; using Microsoft.Extensions.DependencyInjection; using Microsoft.Win32; using System; @@ -39,7 +40,7 @@ public partial class GuildwarsPathTemplate : UserControl private string updateProgress = string.Empty; public GuildwarsPathTemplate() : - this(Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + this(Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/Templates/LaunchButtonTemplate.xaml b/Daybreak/Controls/Templates/LaunchButtonTemplate.xaml index 45a381d5..b6127687 100644 --- a/Daybreak/Controls/Templates/LaunchButtonTemplate.xaml +++ b/Daybreak/Controls/Templates/LaunchButtonTemplate.xaml @@ -5,9 +5,9 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Templates" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" - xmlns:configs="clr-namespace:Daybreak.Models.LaunchConfigurations" - xmlns:converters="clr-namespace:Daybreak.Converters" - xmlns:models="clr-namespace:Daybreak.Models" + xmlns:configs="clr-namespace:Daybreak.Shared.Models.LaunchConfigurations;assembly=Daybreak.Shared" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" + xmlns:models="clr-namespace:Daybreak.Models;assembly=Daybreak.Shared" mc:Ignorable="d" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" diff --git a/Daybreak/Controls/Templates/LaunchButtonTemplate.xaml.cs b/Daybreak/Controls/Templates/LaunchButtonTemplate.xaml.cs index 5a70202c..62631b79 100644 --- a/Daybreak/Controls/Templates/LaunchButtonTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/LaunchButtonTemplate.xaml.cs @@ -1,6 +1,6 @@ using Daybreak.Controls.Buttons; -using Daybreak.Models; -using Daybreak.Utils; +using Daybreak.Shared.Models; +using Daybreak.Shared.Utils; using System; using System.Threading; using System.Threading.Tasks; diff --git a/Daybreak/Controls/Templates/QuestLogTemplate.xaml b/Daybreak/Controls/Templates/QuestLogTemplate.xaml index c651d85f..828d2794 100644 --- a/Daybreak/Controls/Templates/QuestLogTemplate.xaml +++ b/Daybreak/Controls/Templates/QuestLogTemplate.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Templates" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" - xmlns:models="clr-namespace:Daybreak.Models.FocusView" + xmlns:models="clr-namespace:Daybreak.Shared.Models.FocusView;assembly=Daybreak.Shared" x:Name="_this" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Controls/Templates/QuestLogTemplate.xaml.cs b/Daybreak/Controls/Templates/QuestLogTemplate.xaml.cs index 482fcef9..3077ef5f 100644 --- a/Daybreak/Controls/Templates/QuestLogTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/QuestLogTemplate.xaml.cs @@ -1,6 +1,6 @@ using Daybreak.Controls.Buttons; -using Daybreak.Models.FocusView; -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.FocusView; +using Daybreak.Shared.Models.Guildwars; using System; using System.Collections.Generic; using System.Linq; diff --git a/Daybreak/Controls/Templates/ScreenTemplate.xaml.cs b/Daybreak/Controls/Templates/ScreenTemplate.xaml.cs index e8d3b2f8..8f7073ca 100644 --- a/Daybreak/Controls/Templates/ScreenTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/ScreenTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models; +using Daybreak.Shared.Models; using System; using System.Extensions; using System.Windows; diff --git a/Daybreak/Controls/Templates/SkillListEntryTemplate.xaml b/Daybreak/Controls/Templates/SkillListEntryTemplate.xaml index 20d8690f..39dd5d0b 100644 --- a/Daybreak/Controls/Templates/SkillListEntryTemplate.xaml +++ b/Daybreak/Controls/Templates/SkillListEntryTemplate.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Templates" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" mc:Ignorable="d" DataContextChanged="UserControl_DataContextChanged" diff --git a/Daybreak/Controls/Templates/SkillListEntryTemplate.xaml.cs b/Daybreak/Controls/Templates/SkillListEntryTemplate.xaml.cs index cea414fa..1639549f 100644 --- a/Daybreak/Controls/Templates/SkillListEntryTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/SkillListEntryTemplate.xaml.cs @@ -1,6 +1,7 @@ -using Daybreak.Models.Guildwars; -using Daybreak.Services.IconRetrieve; -using Daybreak.Utils; +using Daybreak.Shared; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.IconRetrieve; +using Daybreak.Shared.Utils; using Microsoft.Extensions.DependencyInjection; using System.Core.Extensions; using System.Extensions; @@ -32,7 +33,7 @@ public partial class SkillListEntryTemplate : UserControl } public SkillListEntryTemplate() - : this(Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + : this(Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/Templates/SkillTemplate.xaml.cs b/Daybreak/Controls/Templates/SkillTemplate.xaml.cs index 9566e8b8..4ef6fd2e 100644 --- a/Daybreak/Controls/Templates/SkillTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/SkillTemplate.xaml.cs @@ -1,6 +1,7 @@ using Daybreak.Launch; -using Daybreak.Models.Guildwars; -using Daybreak.Services.IconRetrieve; +using Daybreak.Shared; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.IconRetrieve; using Microsoft.Extensions.DependencyInjection; using System; using System.Core.Extensions; @@ -29,7 +30,7 @@ public partial class SkillTemplate : UserControl private double borderOpacity; public SkillTemplate() - : this(Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + : this(Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/Templates/TradeChatMessageTemplate.xaml b/Daybreak/Controls/Templates/TradeChatMessageTemplate.xaml index 29c8f7ab..7ac80359 100644 --- a/Daybreak/Controls/Templates/TradeChatMessageTemplate.xaml +++ b/Daybreak/Controls/Templates/TradeChatMessageTemplate.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Templates" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Controls/Templates/TradeChatMessageTemplate.xaml.cs b/Daybreak/Controls/Templates/TradeChatMessageTemplate.xaml.cs index 059e87f5..64c4da18 100644 --- a/Daybreak/Controls/Templates/TradeChatMessageTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/TradeChatMessageTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Trade; +using Daybreak.Shared.Models.Trade; using System; using System.Windows.Controls; diff --git a/Daybreak/Controls/Templates/TradeChatTemplate.xaml b/Daybreak/Controls/Templates/TradeChatTemplate.xaml index 9575c0ce..d839b07c 100644 --- a/Daybreak/Controls/Templates/TradeChatTemplate.xaml +++ b/Daybreak/Controls/Templates/TradeChatTemplate.xaml @@ -4,10 +4,10 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Templates" - xmlns:tradeModels="clr-namespace:Daybreak.Models.Trade" + xmlns:tradeModels="clr-namespace:Daybreak.Shared.Models.Trade;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" - xmlns:converters="clr-namespace:Daybreak.Converters" Unloaded="UserControl_Unloaded" x:Name="_this" mc:Ignorable="d" diff --git a/Daybreak/Controls/Templates/TradeChatTemplate.xaml.cs b/Daybreak/Controls/Templates/TradeChatTemplate.xaml.cs index 183f0176..e812cbdf 100644 --- a/Daybreak/Controls/Templates/TradeChatTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/TradeChatTemplate.xaml.cs @@ -1,6 +1,7 @@ using Daybreak.Launch; -using Daybreak.Models.Trade; -using Daybreak.Services.TradeChat; +using Daybreak.Shared; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.TradeChat; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; @@ -49,7 +50,7 @@ public partial class TradeChatTemplate : UserControl public ObservableCollection TraderMessages { get; } = []; public TradeChatTemplate() - : this(Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + : this(Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/Templates/TradeMessageTemplate.xaml b/Daybreak/Controls/Templates/TradeMessageTemplate.xaml index 819e3405..c086c518 100644 --- a/Daybreak/Controls/Templates/TradeMessageTemplate.xaml +++ b/Daybreak/Controls/Templates/TradeMessageTemplate.xaml @@ -4,8 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Templates" - xmlns:tradeModels="clr-namespace:Daybreak.Models.Trade" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:tradeModels="clr-namespace:Daybreak.Shared.Models.Trade;assembly=Daybreak.Shared" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" Loaded="UserControl_Loaded" diff --git a/Daybreak/Controls/Templates/TradeMessageTemplate.xaml.cs b/Daybreak/Controls/Templates/TradeMessageTemplate.xaml.cs index 724611e5..1ba975ea 100644 --- a/Daybreak/Controls/Templates/TradeMessageTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/TradeMessageTemplate.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Trade; +using Daybreak.Shared.Models.Trade; using System; using System.Extensions; using System.Windows; diff --git a/Daybreak/Controls/Templates/TradeQuoteTemplate.xaml b/Daybreak/Controls/Templates/TradeQuoteTemplate.xaml index ade56ea2..fa8cac24 100644 --- a/Daybreak/Controls/Templates/TradeQuoteTemplate.xaml +++ b/Daybreak/Controls/Templates/TradeQuoteTemplate.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls.Templates" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" mc:Ignorable="d" DataContextChanged="UserControl_DataContextChanged" x:Name="_this" diff --git a/Daybreak/Controls/Templates/TradeQuoteTemplate.xaml.cs b/Daybreak/Controls/Templates/TradeQuoteTemplate.xaml.cs index 04d91c19..c612ce2d 100644 --- a/Daybreak/Controls/Templates/TradeQuoteTemplate.xaml.cs +++ b/Daybreak/Controls/Templates/TradeQuoteTemplate.xaml.cs @@ -1,5 +1,6 @@ -using Daybreak.Services.IconRetrieve; -using Daybreak.Services.Images; +using Daybreak.Shared; +using Daybreak.Shared.Services.IconRetrieve; +using Daybreak.Shared.Services.Images; using Microsoft.Extensions.DependencyInjection; using System; using System.Core.Extensions; @@ -23,8 +24,8 @@ public partial class TradeQuoteTemplate : UserControl private bool imageVisible; public TradeQuoteTemplate() : - this(Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService(), - Launch.Launcher.Instance.ApplicationServiceProvider.GetRequiredService()) + this(Global.GlobalServiceProvider.GetRequiredService(), + Global.GlobalServiceProvider.GetRequiredService()) { } diff --git a/Daybreak/Controls/Templates/TraderQuoteModel.cs b/Daybreak/Controls/Templates/TraderQuoteModel.cs index 054cbbd1..610dd7e1 100644 --- a/Daybreak/Controls/Templates/TraderQuoteModel.cs +++ b/Daybreak/Controls/Templates/TraderQuoteModel.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System; namespace Daybreak.Controls.Templates; diff --git a/Daybreak/Controls/WorldPlayerContextMenu.xaml b/Daybreak/Controls/WorldPlayerContextMenu.xaml index e645b0e7..bb65cd05 100644 --- a/Daybreak/Controls/WorldPlayerContextMenu.xaml +++ b/Daybreak/Controls/WorldPlayerContextMenu.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Controls" - xmlns:guildwars="clr-namespace:Daybreak.Models.Guildwars" + xmlns:guildwars="clr-namespace:Daybreak.Shared.Models.Guildwars;assembly=Daybreak.Shared" mc:Ignorable="d" Background="{StaticResource Daybreak.Brushes.Background}" d:DataContext="{d:DesignInstance Type=guildwars:WorldPlayerInformation, IsDesignTimeCreatable=True}" diff --git a/Daybreak/Daybreak.csproj b/Daybreak/Daybreak.csproj index e126aba9..cd4af1b6 100644 --- a/Daybreak/Daybreak.csproj +++ b/Daybreak/Daybreak.csproj @@ -52,41 +52,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + @@ -101,4 +71,10 @@ + + + + true + win-x86 + diff --git a/Daybreak/FodyWeavers.xml b/Daybreak/FodyWeavers.xml deleted file mode 100644 index cc07b895..00000000 --- a/Daybreak/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/Daybreak/Launch/ExceptionDialog.xaml b/Daybreak/Launch/ExceptionDialog.xaml index 5452d940..bc5ffb57 100644 --- a/Daybreak/Launch/ExceptionDialog.xaml +++ b/Daybreak/Launch/ExceptionDialog.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:local="clr-namespace:Daybreak.Launch" x:Name="_this" diff --git a/Daybreak/Launch/Launcher.cs b/Daybreak/Launch/Launcher.cs index a522db96..26129f63 100644 --- a/Daybreak/Launch/Launcher.cs +++ b/Daybreak/Launch/Launcher.cs @@ -1,19 +1,20 @@ using Daybreak.Configuration; -using Daybreak.Models.Progress; -using Daybreak.Services.ApplicationArguments; -using Daybreak.Services.Browser; using Daybreak.Services.ExceptionHandling; -using Daybreak.Services.Menu; -using Daybreak.Services.Mods; -using Daybreak.Services.Navigation; -using Daybreak.Services.Notifications; -using Daybreak.Services.Options; -using Daybreak.Services.Plugins; -using Daybreak.Services.Screens; -using Daybreak.Services.Startup; -using Daybreak.Services.Themes; -using Daybreak.Services.Updater.PostUpdate; -using Daybreak.Services.Window; +using Daybreak.Shared; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.ApplicationArguments; +using Daybreak.Shared.Services.Browser; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Services.Mods; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Options; +using Daybreak.Shared.Services.Plugins; +using Daybreak.Shared.Services.Screens; +using Daybreak.Shared.Services.Startup; +using Daybreak.Shared.Services.Themes; +using Daybreak.Shared.Services.Updater.PostUpdate; +using Daybreak.Shared.Services.Window; using Daybreak.Views; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -42,8 +43,6 @@ public sealed class Launcher : ExtendedApplication private ILogger? logger; private IExceptionHandler? exceptionHandler; - public System.IServiceProvider ApplicationServiceProvider => this.ServiceProvider; - internal Launcher(string[] args) { this.launchArguments = args.ThrowIfNull(); @@ -79,6 +78,8 @@ public sealed class Launcher : ExtendedApplication protected override void ApplicationStarting() { + Global.GlobalServiceProvider = Instance.ServiceProvider; + /* * Show splash screen before beginning to load the rest of the application. * MainWindow will call HideSplashScreen() on Loaded event @@ -86,7 +87,7 @@ public sealed class Launcher : ExtendedApplication * OptionsProducer needs to be created before everything else, otherwise all * the other services will fail to get options for their needs. */ - + var optionsProducer = this.ServiceProvider.GetRequiredService(); var startupStatus = this.ServiceProvider.GetRequiredService(); startupStatus.CurrentStep = StartupStatus.Custom("Loading options"); diff --git a/Daybreak/Launch/MainWindow.xaml b/Daybreak/Launch/MainWindow.xaml index bac7cb2b..bc358065 100644 --- a/Daybreak/Launch/MainWindow.xaml +++ b/Daybreak/Launch/MainWindow.xaml @@ -4,13 +4,13 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:effects="clr-namespace:System.Windows.Media.Extensions.Effects;assembly=WpfExtended" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:glyphs="clr-namespace:Daybreak.Controls.Glyphs" xmlns:notifications="clr-namespace:Daybreak.Controls.Notifications" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:controls="clr-namespace:Daybreak.Controls" WindowStyle="None" ResizeMode="CanResize" Loaded="Window_Loaded" diff --git a/Daybreak/Launch/MainWindow.xaml.cs b/Daybreak/Launch/MainWindow.xaml.cs index e4704690..bdf562cf 100644 --- a/Daybreak/Launch/MainWindow.xaml.cs +++ b/Daybreak/Launch/MainWindow.xaml.cs @@ -1,11 +1,11 @@ using Daybreak.Configuration.Options; -using Daybreak.Services.Menu; -using Daybreak.Services.Navigation; -using Daybreak.Services.Options; -using Daybreak.Services.Privilege; -using Daybreak.Services.Screens; -using Daybreak.Services.Screenshots; -using Daybreak.Services.Updater; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Options; +using Daybreak.Shared.Services.Privilege; +using Daybreak.Shared.Services.Screens; +using Daybreak.Shared.Services.Screenshots; +using Daybreak.Shared.Services.Updater; using Daybreak.Views; using MahApps.Metro.Controls; using Microsoft.Extensions.Logging; diff --git a/Daybreak/Launch/SplashWindow.xaml b/Daybreak/Launch/SplashWindow.xaml index fe96c9f7..db1b250e 100644 --- a/Daybreak/Launch/SplashWindow.xaml +++ b/Daybreak/Launch/SplashWindow.xaml @@ -5,6 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Daybreak.Launch" xmlns:glyphs="clr-namespace:Daybreak.Controls.Glyphs" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" WindowStyle="None" ResizeMode="NoResize" diff --git a/Daybreak/Launch/SplashWindow.xaml.cs b/Daybreak/Launch/SplashWindow.xaml.cs index 5bcd5ec3..261434c8 100644 --- a/Daybreak/Launch/SplashWindow.xaml.cs +++ b/Daybreak/Launch/SplashWindow.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Progress; +using Daybreak.Shared.Models.Progress; using System.Core.Extensions; using System.Extensions; using System.Windows; diff --git a/Daybreak/Models/Notifications/Handling/NoActionHandler.cs b/Daybreak/Models/Notifications/Handling/NoActionHandler.cs deleted file mode 100644 index 641ca92b..00000000 --- a/Daybreak/Models/Notifications/Handling/NoActionHandler.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Daybreak.Models.Notifications.Handling; - -public sealed class NoActionHandler : INotificationHandler -{ - public void OpenNotification(Notification notification) - { - } -} diff --git a/Daybreak/Services/Api/DaybreakApiService.cs b/Daybreak/Services/Api/DaybreakApiService.cs new file mode 100644 index 00000000..76f64a4b --- /dev/null +++ b/Daybreak/Services/Api/DaybreakApiService.cs @@ -0,0 +1,83 @@ +using Daybreak.Shared.Models.Mods; +using Daybreak.Shared.Services.Api; +using Daybreak.Shared.Services.Injection; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Utils; +using Microsoft.Extensions.Logging; +using System.Collections.Generic; +using System.Core.Extensions; +using System.Extensions.Core; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Daybreak.Services.Api; +public sealed class DaybreakApiService( + IStubInjector stubInjector, + INotificationService notificationService, + ILogger logger) + : IDaybreakApiService +{ + private const string DaybreakApiName = "Daybreak.API.dll"; + + private readonly IStubInjector stubInjector = stubInjector.ThrowIfNull(); + private readonly INotificationService notificationService = notificationService.ThrowIfNull(); + private readonly ILogger logger = logger.ThrowIfNull(); + + public string Name { get; } = "Daybreak API"; + public bool IsEnabled { get; set; } = false; + public bool IsInstalled { get; } = true; + + public IEnumerable GetCustomArguments() => []; + + public Task OnGuildWarsCreated(GuildWarsCreatedContext guildWarsCreatedContext, CancellationToken cancellationToken) => Task.CompletedTask; + + public Task OnGuildWarsStarted(GuildWarsStartedContext guildWarsStartedContext, CancellationToken cancellationToken) => + Task.Factory.StartNew(() => this.InjectWithStub(guildWarsStartedContext), cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current); + + public Task OnGuildWarsStarting(GuildWarsStartingContext guildWarsStartingContext, CancellationToken cancellationToken) => Task.CompletedTask; + + public Task OnGuildWarsStartingDisabled(GuildWarsStartingDisabledContext guildWarsStartingDisabledContext, CancellationToken cancellationToken) => Task.CompletedTask; + + private void InjectWithStub(GuildWarsStartedContext context) + { + var scopedLogger = this.logger.CreateScopedLogger(); + var dllName = + Path.GetFullPath( + Path.Combine( + PathUtils.GetRootFolder(), + DaybreakApiName)); + + if (!File.Exists(dllName)) + { + this.notificationService.NotifyError( + "Daybreak API Failure", + "Failed to inject with stub. Daybreak API dll not found"); + scopedLogger.LogError("Failed to inject with stub. Daybreak API DLL not found at {dllPath}", dllName); + return; + } + + scopedLogger.LogInformation("Injecting {dllName} into {processId}", dllName, context.ApplicationLauncherContext.Process.Id); + if (!this.stubInjector.Inject(context.ApplicationLauncherContext.Process, dllName, out var port)) + { + this.notificationService.NotifyError( + "Daybreak API Failure", + "Failed to inject with stub. Injection failed"); + scopedLogger.LogError("Failed to inject with stub. Injection failed"); + return; + } + + if (port < 0) + { + this.notificationService.NotifyError( + "Daybreak API Failure", + "Failed to start API. Non-success exit code"); + scopedLogger.LogError($"Failed to start API. Exit code {port}"); + return; + } + + this.notificationService.NotifyInformation( + "Injected Daybreak API", + $"Daybreak API started on port {port}"); + } +} diff --git a/Daybreak/Services/ApplicationArguments/ApplicationArgumentService.cs b/Daybreak/Services/ApplicationArguments/ApplicationArgumentService.cs index 37e3b52f..d4e505a4 100644 --- a/Daybreak/Services/ApplicationArguments/ApplicationArgumentService.cs +++ b/Daybreak/Services/ApplicationArguments/ApplicationArgumentService.cs @@ -1,4 +1,5 @@ -using Daybreak.Services.ApplicationArguments.ArgumentHandling; +using Daybreak.Shared.Services.ApplicationArguments; +using Daybreak.Shared.Services.ApplicationArguments.ArgumentHandling; using Microsoft.Extensions.Logging; using Slim; using System.Collections.Generic; diff --git a/Daybreak/Services/ApplicationArguments/ArgumentHandling/AutoLaunchArgumentHandler.cs b/Daybreak/Services/ApplicationArguments/ArgumentHandling/AutoLaunchArgumentHandler.cs index 7390b588..3efe8953 100644 --- a/Daybreak/Services/ApplicationArguments/ArgumentHandling/AutoLaunchArgumentHandler.cs +++ b/Daybreak/Services/ApplicationArguments/ArgumentHandling/AutoLaunchArgumentHandler.cs @@ -1,5 +1,6 @@ -using Daybreak.Services.LaunchConfigurations; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Services.ApplicationArguments.ArgumentHandling; +using Daybreak.Shared.Services.LaunchConfigurations; +using Daybreak.Shared.Services.Navigation; using Daybreak.Views; using Microsoft.Extensions.Logging; using System; diff --git a/Daybreak/Services/ApplicationArguments/IArgumentHandlerProducer.cs b/Daybreak/Services/ApplicationArguments/IArgumentHandlerProducer.cs deleted file mode 100644 index 504e747b..00000000 --- a/Daybreak/Services/ApplicationArguments/IArgumentHandlerProducer.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Daybreak.Services.ApplicationArguments.ArgumentHandling; - -namespace Daybreak.Services.ApplicationArguments; - -public interface IArgumentHandlerProducer -{ - void RegisterArgumentHandler() where - T : class, IArgumentHandler; -} diff --git a/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs b/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs index 79c8feac..fc5640ad 100644 --- a/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs +++ b/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs @@ -1,13 +1,14 @@ using Daybreak.Configuration.Options; -using Daybreak.Exceptions; -using Daybreak.Models; -using Daybreak.Models.LaunchConfigurations; -using Daybreak.Models.Mods; -using Daybreak.Services.Mods; -using Daybreak.Services.Mutex; -using Daybreak.Services.Notifications; -using Daybreak.Services.Privilege; -using Daybreak.Utils; +using Daybreak.Shared.Exceptions; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.LaunchConfigurations; +using Daybreak.Shared.Models.Mods; +using Daybreak.Shared.Services.ApplicationLauncher; +using Daybreak.Shared.Services.Mods; +using Daybreak.Shared.Services.Mutex; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Privilege; +using Daybreak.Shared.Utils; using Daybreak.Views; using Microsoft.Extensions.Logging; using Microsoft.Win32; @@ -26,7 +27,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows; -using static Daybreak.Utils.NativeMethods; +using static Daybreak.Shared.Utils.NativeMethods; namespace Daybreak.Services.ApplicationLauncher; @@ -367,10 +368,10 @@ internal sealed class ApplicationLauncher( } /* - * GW loads more than 110 modules when it starts properly. If there are less than - * 110 modules, GW probably has failed to start or has not started yet + * GW loads more than 90 modules when it starts properly. If there are less than + * 90 modules, GW probably has failed to start or has not started yet */ - if (gwProcess.Modules.Count < 100) + if (gwProcess.Modules.Count < 90) { continue; } diff --git a/Daybreak/Services/Browser/BrowserExtensionsManager.cs b/Daybreak/Services/Browser/BrowserExtensionsManager.cs index 60d27e79..79f4cb15 100644 --- a/Daybreak/Services/Browser/BrowserExtensionsManager.cs +++ b/Daybreak/Services/Browser/BrowserExtensionsManager.cs @@ -1,4 +1,5 @@ -using Microsoft.Web.WebView2.Core; +using Daybreak.Shared.Services.Browser; +using Microsoft.Web.WebView2.Core; using Slim; using System.Core.Extensions; using System.Extensions; diff --git a/Daybreak/Services/Browser/BrowserHistoryManager.cs b/Daybreak/Services/Browser/BrowserHistoryManager.cs index 3974f9b0..37468f32 100644 --- a/Daybreak/Services/Browser/BrowserHistoryManager.cs +++ b/Daybreak/Services/Browser/BrowserHistoryManager.cs @@ -1,5 +1,5 @@ using Daybreak.Controls; -using Daybreak.Models.Browser; +using Daybreak.Shared.Models.Browser; using Microsoft.Web.WebView2.Core; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Browser/IBrowserHistoryManager.cs b/Daybreak/Services/Browser/IBrowserHistoryManager.cs index 59528eac..2826a695 100644 --- a/Daybreak/Services/Browser/IBrowserHistoryManager.cs +++ b/Daybreak/Services/Browser/IBrowserHistoryManager.cs @@ -1,5 +1,5 @@ using Daybreak.Controls; -using Daybreak.Models.Browser; +using Daybreak.Shared.Models.Browser; namespace Daybreak.Services.Browser; public interface IBrowserHistoryManager diff --git a/Daybreak/Services/BuildTemplates/AttributePointCalculator.cs b/Daybreak/Services/BuildTemplates/AttributePointCalculator.cs index 40534a7b..ae10fb16 100644 --- a/Daybreak/Services/BuildTemplates/AttributePointCalculator.cs +++ b/Daybreak/Services/BuildTemplates/AttributePointCalculator.cs @@ -1,5 +1,6 @@ -using Daybreak.Models.Builds; -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.BuildTemplates; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/BuildTemplates/BuildTemplateManager.cs b/Daybreak/Services/BuildTemplates/BuildTemplateManager.cs index ada49622..af69d356 100644 --- a/Daybreak/Services/BuildTemplates/BuildTemplateManager.cs +++ b/Daybreak/Services/BuildTemplates/BuildTemplateManager.cs @@ -1,7 +1,8 @@ -using Daybreak.Models.Builds; -using Daybreak.Models.Guildwars; -using Daybreak.Services.BuildTemplates.Models; -using Daybreak.Utils; +using Daybreak.Services.BuildTemplates.Models; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using NAudio.MediaFoundation; using Newtonsoft.Json; diff --git a/Daybreak/Services/Charts/LiveChartInitializer.cs b/Daybreak/Services/Charts/LiveChartInitializer.cs index fd6cd4e4..71a2de8c 100644 --- a/Daybreak/Services/Charts/LiveChartInitializer.cs +++ b/Daybreak/Services/Charts/LiveChartInitializer.cs @@ -1,5 +1,5 @@ -using Daybreak.Models.Metrics; -using Daybreak.Models.Trade; +using Daybreak.Shared.Models.Metrics; +using Daybreak.Shared.Models.Trade; using LiveChartsCore; using LiveChartsCore.Kernel; using LiveChartsCore.SkiaSharpView; diff --git a/Daybreak/Services/Credentials/CredentialManager.cs b/Daybreak/Services/Credentials/CredentialManager.cs index 2ccb8307..81d99274 100644 --- a/Daybreak/Services/Credentials/CredentialManager.cs +++ b/Daybreak/Services/Credentials/CredentialManager.cs @@ -1,5 +1,6 @@ using Daybreak.Configuration.Options; -using Daybreak.Models; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Credentials; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/DSOAL/Actions/FixSymbolicLinkNotificationHandler.cs b/Daybreak/Services/DSOAL/Actions/FixSymbolicLinkNotificationHandler.cs index 8b5e0e79..3ee7da37 100644 --- a/Daybreak/Services/DSOAL/Actions/FixSymbolicLinkNotificationHandler.cs +++ b/Daybreak/Services/DSOAL/Actions/FixSymbolicLinkNotificationHandler.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Notifications; -using Daybreak.Models.Notifications.Handling; -using Daybreak.Services.Privilege; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; +using Daybreak.Shared.Services.Privilege; using Daybreak.Views; using System.Core.Extensions; diff --git a/Daybreak/Services/DSOAL/Actions/FixSymbolicLinkStartupAction.cs b/Daybreak/Services/DSOAL/Actions/FixSymbolicLinkStartupAction.cs index 0b954342..2cb183dc 100644 --- a/Daybreak/Services/DSOAL/Actions/FixSymbolicLinkStartupAction.cs +++ b/Daybreak/Services/DSOAL/Actions/FixSymbolicLinkStartupAction.cs @@ -1,7 +1,8 @@ -using Daybreak.Services.Notifications; -using Daybreak.Services.Privilege; -using Daybreak.Services.Registry; -using Daybreak.Services.Startup.Actions; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.DSOAL; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Privilege; +using Daybreak.Shared.Services.Registry; using Microsoft.Extensions.Logging; using System; using System.Core.Extensions; diff --git a/Daybreak/Services/DSOAL/DSOALService.cs b/Daybreak/Services/DSOAL/DSOALService.cs index 7420295f..57a7af80 100644 --- a/Daybreak/Services/DSOAL/DSOALService.cs +++ b/Daybreak/Services/DSOAL/DSOALService.cs @@ -1,11 +1,12 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Mods; -using Daybreak.Models.Progress; -using Daybreak.Services.Downloads; -using Daybreak.Services.Notifications; -using Daybreak.Services.Privilege; -using Daybreak.Services.Registry; -using Daybreak.Utils; +using Daybreak.Shared.Models.Mods; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Downloads; +using Daybreak.Shared.Services.DSOAL; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Privilege; +using Daybreak.Shared.Services.Registry; +using Daybreak.Shared.Utils; using Daybreak.Views; using Microsoft.Extensions.Logging; using System; diff --git a/Daybreak/Services/Database/IDatabaseCollection.cs b/Daybreak/Services/Database/IDatabaseCollection.cs deleted file mode 100644 index 294abed0..00000000 --- a/Daybreak/Services/Database/IDatabaseCollection.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; - -namespace Daybreak.Services.Database; - -public interface IDatabaseCollection - where TObject : new() -{ - long Count(); - - bool Add(TObject value); - - bool AddBulk(IEnumerable value); - - bool Update(TObject value); - - void Delete(TObject obj); - - void DeleteAll(); - - IEnumerable FindAll(); - - IEnumerable FindAll(Expression> filter); -} diff --git a/Daybreak/Services/Database/RealmDatabaseCollection.cs b/Daybreak/Services/Database/RealmDatabaseCollection.cs deleted file mode 100644 index bbd93968..00000000 --- a/Daybreak/Services/Database/RealmDatabaseCollection.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Daybreak.Utils; -using Realms; -using System; -using System.Collections.Generic; -using System.Core.Extensions; -using System.Linq; -using System.Linq.Expressions; -using System.Threading; - -namespace Daybreak.Services.Database; - -internal sealed class RealmDatabaseCollection : IDatabaseCollection - where TObject : IRealmObject, new() -{ - private const string RealmDbFileName = "daybreak.realm.db"; - - private static readonly ThreadLocal RealmInstance = new(() => - Realm.GetInstance(PathUtils.GetAbsolutePathFromRoot(RealmDbFileName)) - ); - - public RealmDatabaseCollection() - { - } - - public long Count() - { - var db = RealmInstance.Value.ThrowIfNull(); - return db.All().Count(); - } - - public bool Update(TObject value) - { - var db = RealmInstance.Value.ThrowIfNull(); - using var transaction = db.BeginWrite(); - var result = db.Add(value, true) is not null; - transaction.Commit(); - return result; - } - - public bool AddBulk(IEnumerable values) - { - var db = RealmInstance.Value.ThrowIfNull(); - using var transaction = db.BeginWrite(); - db.Add(values, false); - transaction.Commit(); - return true; - } - - public bool Add(TObject value) - { - var db = RealmInstance.Value.ThrowIfNull(); - using var transaction = db.BeginWrite(); - var result = db.Add(value, false) is not null; - transaction.Commit(); - return result; - } - - public IEnumerable FindAll() - { - var db = RealmInstance.Value.ThrowIfNull(); - return db.All(); - } - - public IEnumerable FindAll(Expression> filter) - { - var db = RealmInstance.Value.ThrowIfNull(); - return db.All().Where(filter); - } - - public void Delete(TObject obj) - { - var db = RealmInstance.Value.ThrowIfNull(); - using var transaction = db.BeginWrite(); - db.Remove(obj); - transaction.Commit(); - } - - public void DeleteAll() - { - var db = RealmInstance.Value.ThrowIfNull(); - using var transaction = db.BeginWrite(); - db.RemoveAll(); - transaction.Commit(); - } -} diff --git a/Daybreak/Services/DirectSong/DirectSongService.cs b/Daybreak/Services/DirectSong/DirectSongService.cs index 835c7173..20ee4c91 100644 --- a/Daybreak/Services/DirectSong/DirectSongService.cs +++ b/Daybreak/Services/DirectSong/DirectSongService.cs @@ -1,11 +1,12 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Mods; -using Daybreak.Models.Progress; -using Daybreak.Services.Downloads; -using Daybreak.Services.Notifications; -using Daybreak.Services.Privilege; -using Daybreak.Services.SevenZip; -using Daybreak.Utils; +using Daybreak.Shared.Models.Mods; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.DirectSong; +using Daybreak.Shared.Services.Downloads; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Privilege; +using Daybreak.Shared.Services.SevenZip; +using Daybreak.Shared.Utils; using Daybreak.Views; using Microsoft.Extensions.Logging; using System.Collections.Generic; diff --git a/Daybreak/Services/Downloads/DownloadService.cs b/Daybreak/Services/Downloads/DownloadService.cs index fa6caa28..6fd211da 100644 --- a/Daybreak/Services/Downloads/DownloadService.cs +++ b/Daybreak/Services/Downloads/DownloadService.cs @@ -1,6 +1,7 @@ -using Daybreak.Models.Metrics; -using Daybreak.Models.Progress; -using Daybreak.Services.Metrics; +using Daybreak.Shared.Models.Metrics; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Downloads; +using Daybreak.Shared.Services.Metrics; using Microsoft.Extensions.Logging; using System; using System.Core.Extensions; diff --git a/Daybreak/Services/Events/EventNotifierService.cs b/Daybreak/Services/Events/EventNotifierService.cs index 707d4802..b43ed6d5 100644 --- a/Daybreak/Services/Events/EventNotifierService.cs +++ b/Daybreak/Services/Events/EventNotifierService.cs @@ -1,8 +1,9 @@ using Daybreak.Configuration.Options; -using Daybreak.Converters; -using Daybreak.Models.Guildwars; -using Daybreak.Models.Notifications.Handling; -using Daybreak.Services.Notifications; +using Daybreak.Services.Notifications.Handlers; +using Daybreak.Shared.Converters; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.Events; +using Daybreak.Shared.Services.Notifications; using Microsoft.Extensions.Logging; using System; using System.Configuration; diff --git a/Daybreak/Services/Events/EventService.cs b/Daybreak/Services/Events/EventService.cs index 4b0340ca..68bcb096 100644 --- a/Daybreak/Services/Events/EventService.cs +++ b/Daybreak/Services/Events/EventService.cs @@ -1,4 +1,5 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.Events; using System; using System.Collections.Generic; using System.Linq; diff --git a/Daybreak/Services/ExceptionHandling/ExceptionHandler.cs b/Daybreak/Services/ExceptionHandling/ExceptionHandler.cs index 9dcff1d3..62c153fe 100644 --- a/Daybreak/Services/ExceptionHandling/ExceptionHandler.cs +++ b/Daybreak/Services/ExceptionHandling/ExceptionHandler.cs @@ -1,8 +1,8 @@ -using Daybreak.Exceptions; -using Daybreak.Launch; -using Daybreak.Models.Notifications.Handling; -using Daybreak.Services.Notifications; -using Daybreak.Utils; +using Daybreak.Launch; +using Daybreak.Services.Notifications.Handlers; +using Daybreak.Shared.Exceptions; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Core.Extensions; diff --git a/Daybreak/Services/ExecutableManagement/GuildWarsExecutableManager.cs b/Daybreak/Services/ExecutableManagement/GuildWarsExecutableManager.cs index e38d66a4..6606fd06 100644 --- a/Daybreak/Services/ExecutableManagement/GuildWarsExecutableManager.cs +++ b/Daybreak/Services/ExecutableManagement/GuildWarsExecutableManager.cs @@ -1,4 +1,5 @@ using Daybreak.Configuration.Options; +using Daybreak.Shared.Services.ExecutableManagement; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Experience/ExperienceCalculator.cs b/Daybreak/Services/Experience/ExperienceCalculator.cs index e0bf9e91..1491ee36 100644 --- a/Daybreak/Services/Experience/ExperienceCalculator.cs +++ b/Daybreak/Services/Experience/ExperienceCalculator.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using Daybreak.Shared.Services.Experience; +using System.Collections.Generic; namespace Daybreak.Services.Experience; diff --git a/Daybreak/Services/Graph/GraphClient.cs b/Daybreak/Services/Graph/GraphClient.cs index b28ffd7a..626a2eb2 100644 --- a/Daybreak/Services/Graph/GraphClient.cs +++ b/Daybreak/Services/Graph/GraphClient.cs @@ -1,10 +1,10 @@ using Daybreak.Configuration; using Daybreak.Configuration.Options; using Daybreak.Controls; -using Daybreak.Models.Builds; -using Daybreak.Services.BuildTemplates; using Daybreak.Services.Graph.Models; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Services.Navigation; using Daybreak.Views; using Microsoft.Extensions.Logging; using Newtonsoft.Json; diff --git a/Daybreak/Services/Guildwars/GuildWarsBatchUpdateNotificationHandler.cs b/Daybreak/Services/Guildwars/GuildWarsBatchUpdateNotificationHandler.cs index 4f63218b..5b044e9e 100644 --- a/Daybreak/Services/Guildwars/GuildWarsBatchUpdateNotificationHandler.cs +++ b/Daybreak/Services/Guildwars/GuildWarsBatchUpdateNotificationHandler.cs @@ -1,10 +1,12 @@ -using Daybreak.Models.Notifications; -using Daybreak.Models.Notifications.Handling; -using Daybreak.Models.Progress; -using Daybreak.Services.ExecutableManagement; -using Daybreak.Services.Guildwars.Models; -using Daybreak.Services.Navigation; -using Daybreak.Services.Notifications; +using Daybreak.Services.Guildwars.Models; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.Guildwars; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Notifications; using Daybreak.Views.Installation; using Microsoft.Extensions.Logging; using System.Collections.Generic; diff --git a/Daybreak/Services/Guildwars/GuildWarsUpdateNotificationHandler.cs b/Daybreak/Services/Guildwars/GuildWarsUpdateNotificationHandler.cs index 9d7f663c..edb37338 100644 --- a/Daybreak/Services/Guildwars/GuildWarsUpdateNotificationHandler.cs +++ b/Daybreak/Services/Guildwars/GuildWarsUpdateNotificationHandler.cs @@ -1,9 +1,10 @@ -using Daybreak.Models.Notifications; -using Daybreak.Models.Notifications.Handling; -using Daybreak.Models.Progress; -using Daybreak.Services.Guildwars.Models; -using Daybreak.Services.Navigation; -using Daybreak.Services.Notifications; +using Daybreak.Services.Guildwars.Models; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Guildwars; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Notifications; using Daybreak.Views.Installation; using Microsoft.Extensions.Logging; using System.Core.Extensions; diff --git a/Daybreak/Services/Guildwars/GuildWarsVersionChecker.cs b/Daybreak/Services/Guildwars/GuildWarsVersionChecker.cs index 0a7d00a6..902058bf 100644 --- a/Daybreak/Services/Guildwars/GuildWarsVersionChecker.cs +++ b/Daybreak/Services/Guildwars/GuildWarsVersionChecker.cs @@ -1,7 +1,8 @@ -using Daybreak.Models.Mods; -using Daybreak.Services.ExecutableManagement; -using Daybreak.Services.Guildwars; -using Daybreak.Services.Notifications; +using Daybreak.Services.Guildwars; +using Daybreak.Shared.Models.Mods; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.Guildwars; +using Daybreak.Shared.Services.Notifications; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Guildwars/GuildwarsCopyService.cs b/Daybreak/Services/Guildwars/GuildwarsCopyService.cs index fbb0f224..df6f1ce6 100644 --- a/Daybreak/Services/Guildwars/GuildwarsCopyService.cs +++ b/Daybreak/Services/Guildwars/GuildwarsCopyService.cs @@ -1,5 +1,6 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.ExecutableManagement; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.Guildwars; using Microsoft.Extensions.Logging; using System; using System.Core.Extensions; diff --git a/Daybreak/Services/Guildwars/IntegratedGuildwarsInstaller.cs b/Daybreak/Services/Guildwars/IntegratedGuildwarsInstaller.cs index 34aad9cf..5a4a3b16 100644 --- a/Daybreak/Services/Guildwars/IntegratedGuildwarsInstaller.cs +++ b/Daybreak/Services/Guildwars/IntegratedGuildwarsInstaller.cs @@ -1,11 +1,12 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.ExecutableManagement; -using Daybreak.Services.Guildwars; -using Daybreak.Services.Guildwars.Models; +using Daybreak.Services.Guildwars.Models; using Daybreak.Services.Guildwars.Utils; using Daybreak.Services.GuildWars.Utils; -using Daybreak.Services.Notifications; -using Daybreak.Utils; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.Guildwars; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Guildwars/Models/GuildWarsDownloadContext.cs b/Daybreak/Services/Guildwars/Models/GuildWarsDownloadContext.cs index 51ae756f..e1e986d1 100644 --- a/Daybreak/Services/Guildwars/Models/GuildWarsDownloadContext.cs +++ b/Daybreak/Services/Guildwars/Models/GuildWarsDownloadContext.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Progress; +using Daybreak.Shared.Models.Progress; using System.Threading; namespace Daybreak.Services.Guildwars.Models; diff --git a/Daybreak/Services/IconRetrieve/IconCache.cs b/Daybreak/Services/IconRetrieve/IconCache.cs index cd3d3197..d96e1ea5 100644 --- a/Daybreak/Services/IconRetrieve/IconCache.cs +++ b/Daybreak/Services/IconRetrieve/IconCache.cs @@ -1,6 +1,7 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Guildwars; -using Daybreak.Utils; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.IconRetrieve; +using Daybreak.Shared.Utils; using HtmlAgilityPack; using Microsoft.Extensions.Logging; using System; diff --git a/Daybreak/Services/Images/ImageCache.cs b/Daybreak/Services/Images/ImageCache.cs index a1ab8518..7d4eb108 100644 --- a/Daybreak/Services/Images/ImageCache.cs +++ b/Daybreak/Services/Images/ImageCache.cs @@ -1,7 +1,8 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Metrics; using Daybreak.Services.Images.Models; -using Daybreak.Services.Metrics; +using Daybreak.Shared.Models.Metrics; +using Daybreak.Shared.Services.Images; +using Daybreak.Shared.Services.Metrics; using Microsoft.Extensions.Logging; using System; using System.Collections.Concurrent; diff --git a/Daybreak/Services/Injection/ProcessInjector.cs b/Daybreak/Services/Injection/ProcessInjector.cs index b6d3be39..a20de844 100644 --- a/Daybreak/Services/Injection/ProcessInjector.cs +++ b/Daybreak/Services/Injection/ProcessInjector.cs @@ -1,4 +1,5 @@ -using Daybreak.Utils; +using Daybreak.Shared.Services.Injection; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Core.Extensions; diff --git a/Daybreak/Services/Injection/StubInjector.cs b/Daybreak/Services/Injection/StubInjector.cs new file mode 100644 index 00000000..e4b1f1d7 --- /dev/null +++ b/Daybreak/Services/Injection/StubInjector.cs @@ -0,0 +1,191 @@ +using Daybreak.Shared.Services.Injection; +using Daybreak.Shared.Utils; +using Microsoft.Extensions.Logging; +using Reloaded.Assembler; +using System; +using System.Core.Extensions; +using System.Diagnostics; +using System.Extensions.Core; +using System.Text; + +namespace Daybreak.Services.Injection; +public sealed class StubInjector( + ILogger logger) : IStubInjector +{ + const string ListenerEntryPoint = "ThreadInit"; + + /// + /// ebp+8 is the dll path pointer + /// 0xDEADBEEF is a placeholder to be patched later for LoadLibraryA + /// 0xFEEDF00D is a placeholder to be patched later for GetProcAddress + /// + const string Asm = @" +use32 +push ebp +mov ebp, esp + +mov esi, [ebp+8] ; ESI = &INJECT_DATA (kept unchanged) + +; -------- LoadLibraryA(dllPath) ------------------------------ +push dword [esi] ; dllPath +mov eax, 0xDEADBEEF ; patched → LoadLibraryA +call eax ; EAX = hModule + +; -------- GetProcAddress(hModule, funcName) ------------------ +push dword [esi+4] ; funcName +push eax ; hModule (still in EAX) +mov eax, 0xFEEDF00D ; patched → GetProcAddress +call eax ; EAX = exported EntryPoint + +; -------- call EntryPoint() ---------------------------------- +call eax ; calls EntryPoint +; xor eax, eax ; thread exit-code 0 + +; -------- return EntryPoint() response ----------------------- +leave ; = mov esp, ebp / pop ebp +ret 4 ; stdcall: pop lpParameter +"; + + private readonly ILogger logger = logger.ThrowIfNull(); + + public bool Inject(Process target, string dllPath, out int exitCode) + { + var scopedLogger = this.logger.CreateScopedLogger(flowIdentifier: dllPath); + var hProcess = NativeMethods.OpenProcess( + NativeMethods.ProcessAccessFlags.All, false, (uint)target.Id); + + exitCode = 0; + if (hProcess is 0) + { + scopedLogger.LogError("Failed to inject with stub. Could not open process by id {processId}", target.Id); + return false; + } + + using var assembler = new Assembler(); + var stubBytes = assembler.Assemble(Asm); + + // patch placeholders + var hKernel = NativeMethods.GetModuleHandle("kernel32.dll"); + if (hKernel is 0) + { + scopedLogger.LogError("Failed to inject with stub. Could not get handle of kernel32.dll"); + return false; + } + + var pLoadLibA = NativeMethods.GetProcAddress(hKernel, "LoadLibraryA"); + if (pLoadLibA is 0) + { + scopedLogger.LogError("Failed to inject with stub. Could not get address of LoadLibraryA"); + return false; + } + + var pGetProc = NativeMethods.GetProcAddress(hKernel, "GetProcAddress"); + if (pGetProc is 0) + { + scopedLogger.LogError("Failed to inject with stub. Could not get address of GetProcAddress"); + return false; + } + + Patch(stubBytes, 0xDEADBEEF, pLoadLibA); + Patch(stubBytes, 0xFEEDF00D, pGetProc); + + var dllBytes = Encoding.ASCII.GetBytes(dllPath + '\0'); + var funcBytes = Encoding.ASCII.GetBytes(ListenerEntryPoint + '\0'); + var remoteDll = AllocWrite(hProcess, dllBytes, NativeMethods.MemoryProtection.PAGE_READWRITE); + if (remoteDll is 0) + { + scopedLogger.LogError("Failed to inject with stub. Could not allocate memory for dll path"); + return false; + } + + var remoteFunc = AllocWrite(hProcess, funcBytes, NativeMethods.MemoryProtection.PAGE_READWRITE); + if (remoteFunc is 0) + { + scopedLogger.LogError("Failed to inject with stub. Could not allocate memory for function name"); + return false; + } + + var injectData = new byte[IntPtr.Size * 2]; + BitConverter.GetBytes(remoteDll.ToInt32()).CopyTo(injectData, 0); + BitConverter.GetBytes(remoteFunc.ToInt32()).CopyTo(injectData, 4); + var remoteStruct = AllocWrite(hProcess, injectData, NativeMethods.MemoryProtection.PAGE_READWRITE); + if (remoteStruct is 0) + { + scopedLogger.LogError("Failed to inject with stub. Could not allocate memory for injectData"); + return false; + } + + var remoteStub = AllocWrite(hProcess, stubBytes, NativeMethods.MemoryProtection.PAGE_EXECUTE_READ_WRITE); + if (remoteStub is 0) + { + scopedLogger.LogError("Failed to inject with stub. Could not allocate memory for stub"); + return false; + } + + var hThread = NativeMethods.CreateRemoteThread( + hProcess, IntPtr.Zero, 0, + remoteStub, + remoteStruct, + 0, out _); + + if (hThread is 0) + { + scopedLogger.LogError("Failed to inject with stub. Could not create remote thread"); + return false; + } + + var waitResult = NativeMethods.WaitForSingleObject(hThread, 10000); // Wait up to 10 seconds + if (waitResult is 0) // WAIT_OBJECT_0 - thread completed + { + // Get the thread exit code, which will be our port number + if (NativeMethods.GetExitCodeThread(hThread, out var moduleExitCode) > 0) + { + scopedLogger.LogInformation("Thread completed with result: {result}", moduleExitCode); + exitCode = (int)moduleExitCode; + } + else + { + scopedLogger.LogWarning("Failed to get thread exit code"); + } + } + else + { + scopedLogger.LogWarning("Thread did not complete within timeout period"); + } + + return true; + } + + private static void Patch(byte[] blob, uint marker, IntPtr value) + { + byte m0 = (byte)(marker & 0xFF); + byte m1 = (byte)((marker >> 8) & 0xFF); + byte m2 = (byte)((marker >> 16) & 0xFF); + byte m3 = (byte)((marker >> 24) & 0xFF); + + for (int i = 0; i <= blob.Length - 4; i++) + { + if (blob[i] == m0 && blob[i + 1] == m1 && + blob[i + 2] == m2 && blob[i + 3] == m3) + { + BitConverter.GetBytes(value.ToInt32()).CopyTo(blob, i); + return; + } + } + + throw new Exception($"Marker 0x{marker:X8} not found"); + } + + private static IntPtr AllocWrite(IntPtr hProcess, byte[] data, + NativeMethods.MemoryProtection protect) + { + var addr = NativeMethods.VirtualAllocEx(hProcess, IntPtr.Zero, + (nint)data.Length, + (uint)(NativeMethods.AllocationType.Commit | + NativeMethods.AllocationType.Reserve), + (uint)protect); + NativeMethods.WriteProcessMemory(hProcess, addr, data, + data.Length, out _); + return addr; + } +} diff --git a/Daybreak/Services/InternetChecker/ConnectivityStatus.cs b/Daybreak/Services/InternetChecker/ConnectivityStatus.cs index d5e9462e..da964604 100644 --- a/Daybreak/Services/InternetChecker/ConnectivityStatus.cs +++ b/Daybreak/Services/InternetChecker/ConnectivityStatus.cs @@ -1,6 +1,7 @@ -using Daybreak.Models; -using Daybreak.Models.Notifications; -using Daybreak.Services.Notifications; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Services.InternetChecker; +using Daybreak.Shared.Services.Notifications; using System; using System.Core.Extensions; using System.Threading; diff --git a/Daybreak/Services/InternetChecker/InternetCheckingService.cs b/Daybreak/Services/InternetChecker/InternetCheckingService.cs index 415cb295..1024cce1 100644 --- a/Daybreak/Services/InternetChecker/InternetCheckingService.cs +++ b/Daybreak/Services/InternetChecker/InternetCheckingService.cs @@ -1,5 +1,7 @@ -using Daybreak.Models; -using Daybreak.Services.Metrics; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Metrics; +using Daybreak.Shared.Services.InternetChecker; +using Daybreak.Shared.Services.Metrics; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Diagnostics; @@ -30,7 +32,7 @@ internal sealed class InternetCheckingService : IInternetCheckingService IHttpClient httpClient, ILogger logger) { - this.connectionCheckingLatency = metricsService.ThrowIfNull().CreateHistogram(ConnectionVerificationLatency, ConnectionVerificationUnit, ConnectionVerificationDescription, Models.Metrics.AggregationTypes.NoAggregate); + this.connectionCheckingLatency = metricsService.ThrowIfNull().CreateHistogram(ConnectionVerificationLatency, ConnectionVerificationUnit, ConnectionVerificationDescription, AggregationTypes.NoAggregate); this.httpClient = httpClient.ThrowIfNull(); this.logger = logger.ThrowIfNull(); } diff --git a/Daybreak/Services/LaunchConfigurations/LaunchConfigurationService.cs b/Daybreak/Services/LaunchConfigurations/LaunchConfigurationService.cs index 9cf085ca..a9689373 100644 --- a/Daybreak/Services/LaunchConfigurations/LaunchConfigurationService.cs +++ b/Daybreak/Services/LaunchConfigurations/LaunchConfigurationService.cs @@ -1,7 +1,8 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.LaunchConfigurations; -using Daybreak.Services.Credentials; -using Daybreak.Services.ExecutableManagement; +using Daybreak.Shared.Models.LaunchConfigurations; +using Daybreak.Shared.Services.Credentials; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.LaunchConfigurations; using System; using System.Collections.Generic; using System.Configuration; diff --git a/Daybreak/Services/Logging/DebugLogsWriter.cs b/Daybreak/Services/Logging/DebugLogsWriter.cs index 4f4520b4..4024026f 100644 --- a/Daybreak/Services/Logging/DebugLogsWriter.cs +++ b/Daybreak/Services/Logging/DebugLogsWriter.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using Daybreak.Shared.Services.Logging; +using System.Diagnostics; using System.Logging; namespace Daybreak.Services.Logging; diff --git a/Daybreak/Services/Logging/EventViewerLogsWriter.cs b/Daybreak/Services/Logging/EventViewerLogsWriter.cs index 60ba1384..c8f6e718 100644 --- a/Daybreak/Services/Logging/EventViewerLogsWriter.cs +++ b/Daybreak/Services/Logging/EventViewerLogsWriter.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Logging; +using Daybreak.Shared.Services.Logging; +using Microsoft.Extensions.Logging; using System.Diagnostics; using System.Logging; diff --git a/Daybreak/Services/Logging/ILogsManager.cs b/Daybreak/Services/Logging/ILogsManager.cs deleted file mode 100644 index 1fd351dd..00000000 --- a/Daybreak/Services/Logging/ILogsManager.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Logging; - -namespace Daybreak.Services.Logging; - -public interface ILogsManager : ILogsWriter -{ - event EventHandler? ReceivedLog; - - IEnumerable GetLogs(Expression> filter); - IEnumerable GetLogs(); - void DeleteLogs(); -} diff --git a/Daybreak/Services/Logging/JsonLogsManager.cs b/Daybreak/Services/Logging/JsonLogsManager.cs index 79b67073..cd663b08 100644 --- a/Daybreak/Services/Logging/JsonLogsManager.cs +++ b/Daybreak/Services/Logging/JsonLogsManager.cs @@ -1,66 +1,31 @@ -using Daybreak.Configuration.Options; -using Daybreak.Services.Database; -using Daybreak.Services.Logging.Models; -using Daybreak.Utils; -using Microsoft.Extensions.Logging; +using Daybreak.Shared.Services.Logging; +using Daybreak.Shared.Utils; using System; using System.Collections.Generic; -using System.Configuration; -using System.Core.Extensions; -using System.Extensions; using System.Linq; using System.Linq.Expressions; -using System.Logging; -using System.Threading; namespace Daybreak.Services.Logging; internal sealed class JsonLogsManager : ILogsManager { - private const int MemoryCacheMaxSize = 5000; + private readonly LinkedList memoryCache = []; - private readonly List memoryCache = []; - private readonly SemaphoreSlim semaphoreSlim = new(1); - private readonly IDatabaseCollection collection; - private readonly ILiveOptions liveOptions; + public event EventHandler? ReceivedLog; - public event EventHandler? ReceivedLog; - - public JsonLogsManager( - IDatabaseCollection collection, - ILiveOptions liveOptions) + public IEnumerable GetLogs(Expression> filter) { - this.collection = collection.ThrowIfNull(); - this.liveOptions = liveOptions.ThrowIfNull(); + return this.memoryCache + .Where(filter.Compile()); } - public IEnumerable GetLogs(Expression> filter) + public IEnumerable GetLogs() { - return this.collection.FindAll().Select(log => new Daybreak.Models.Log - { - Category = log.Category, - CorrelationVector = log.CorrelationVector, - EventId = log.EventId, - Message = log.Message, - LogLevel = (LogLevel)log.LogLevel, - LogTime = log.LogTime - }).Where(filter.Compile()); + return [.. this.memoryCache]; } - public IEnumerable GetLogs() + public void WriteLog(System.Logging.Log log) { - return this.collection.FindAll().Select(log => new Daybreak.Models.Log - { - Category = log.Category, - CorrelationVector = log.CorrelationVector, - EventId = log.EventId, - Message = log.Message, - LogLevel = (LogLevel)log.LogLevel, - LogTime = log.LogTime - }); - } - public async void WriteLog(Log log) - { - var logModel = new Daybreak.Models.Log + var logModel = new Shared.Models.Log { EventId = log.EventId ?? string.Empty, Message = log.Exception is null ? log.Message : $"{log.Message}{Environment.NewLine}{log.Exception}", @@ -70,42 +35,11 @@ internal sealed class JsonLogsManager : ILogsManager CorrelationVector = log.CorrelationVector }; - if (this.liveOptions.Value.PersistentLogging) - { - using var context = await this.semaphoreSlim.Acquire(); - if (this.memoryCache.Count > 100) - { - this.collection.AddBulk(this.memoryCache.Select(l => new LogDTO - { - EventId = l.EventId, - Message = l.Message, - Category = l.Category, - LogLevel = (int)l.LogLevel, - LogTime = l.LogTime, - CorrelationVector = l.CorrelationVector - })); - - this.memoryCache.Clear(); - } - - this.memoryCache.Add(logModel); - } - else - { - using var context = await this.semaphoreSlim.Acquire(); - if (this.memoryCache.Count >= MemoryCacheMaxSize) - { - this.memoryCache.RemoveAt(this.memoryCache.Count - 1); - } - - this.memoryCache.Add(logModel); - } - + this.memoryCache.AddLast(logModel); this.ReceivedLog?.Invoke(this, logModel); } public void DeleteLogs() { this.memoryCache.Clear(); - this.collection.DeleteAll(); } } diff --git a/Daybreak/Services/Logging/Models/LogDTO.cs b/Daybreak/Services/Logging/Models/LogDTO.cs deleted file mode 100644 index 846d8e04..00000000 --- a/Daybreak/Services/Logging/Models/LogDTO.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Realms; -using System; - -namespace Daybreak.Services.Logging.Models; -internal sealed class LogDTO : RealmObject -{ - [PrimaryKey] - public string? Id { get; set; } = Guid.NewGuid().ToString(); - public string? Message { get; set; } - public string? Category { get; set; } - public int LogLevel { get; set; } - public string? CorrelationVector { get; set; } - public string? EventId { get; set; } - public DateTimeOffset LogTime { get; set; } -} diff --git a/Daybreak/Services/Menu/MenuService.cs b/Daybreak/Services/Menu/MenuService.cs index 015ac0f4..7fa3215b 100644 --- a/Daybreak/Services/Menu/MenuService.cs +++ b/Daybreak/Services/Menu/MenuService.cs @@ -1,4 +1,5 @@ -using Daybreak.Models.Menu; +using Daybreak.Shared.Models.Menu; +using Daybreak.Shared.Services.Menu; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Metrics/MetricsService.cs b/Daybreak/Services/Metrics/MetricsService.cs index 3f2a6900..327b923c 100644 --- a/Daybreak/Services/Metrics/MetricsService.cs +++ b/Daybreak/Services/Metrics/MetricsService.cs @@ -1,4 +1,5 @@ -using Daybreak.Models.Metrics; +using Daybreak.Shared.Models.Metrics; +using Daybreak.Shared.Services.Metrics; using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/Daybreak/Services/Mods/ModsManager.cs b/Daybreak/Services/Mods/ModsManager.cs index 3bf6c066..5a1b997f 100644 --- a/Daybreak/Services/Mods/ModsManager.cs +++ b/Daybreak/Services/Mods/ModsManager.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Logging; +using Daybreak.Shared.Services.Mods; +using Microsoft.Extensions.Logging; using Slim; using System.Collections.Generic; using System.Core.Extensions; diff --git a/Daybreak/Services/Monitoring/DiskUsageMonitor.cs b/Daybreak/Services/Monitoring/DiskUsageMonitor.cs index 6f5fd90c..d1d3bb49 100644 --- a/Daybreak/Services/Monitoring/DiskUsageMonitor.cs +++ b/Daybreak/Services/Monitoring/DiskUsageMonitor.cs @@ -1,11 +1,12 @@ -using Daybreak.Services.Metrics; -using System.Diagnostics.Metrics; +using System.Diagnostics.Metrics; using System.Diagnostics; using System.Threading.Tasks; using System.Windows.Extensions.Services; using System.Core.Extensions; using System.Extensions; using System.Threading; +using Daybreak.Shared.Services.Metrics; +using Daybreak.Shared.Models.Metrics; namespace Daybreak.Services.Monitoring; @@ -28,8 +29,8 @@ internal sealed class DiskUsageMonitor : IApplicationLifetimeService public DiskUsageMonitor( IMetricsService metricsService) { - this.writeDiskUsageHistogram = metricsService.ThrowIfNull().CreateHistogram(WriteDiskUsage, WriteDiskUsageUnit, WriteDiskUsageDescription, Models.Metrics.AggregationTypes.NoAggregate); - this.readDiskUsageHistogram = metricsService.ThrowIfNull().CreateHistogram(ReadDiskUsage, ReadDiskUsageUnit, ReadDiskUsageDescription, Models.Metrics.AggregationTypes.NoAggregate); + this.writeDiskUsageHistogram = metricsService.ThrowIfNull().CreateHistogram(WriteDiskUsage, WriteDiskUsageUnit, WriteDiskUsageDescription, AggregationTypes.NoAggregate); + this.readDiskUsageHistogram = metricsService.ThrowIfNull().CreateHistogram(ReadDiskUsage, ReadDiskUsageUnit, ReadDiskUsageDescription, AggregationTypes.NoAggregate); } public void OnClosing() diff --git a/Daybreak/Services/Monitoring/MemoryUsageMonitor.cs b/Daybreak/Services/Monitoring/MemoryUsageMonitor.cs index 40562c98..441d5d45 100644 --- a/Daybreak/Services/Monitoring/MemoryUsageMonitor.cs +++ b/Daybreak/Services/Monitoring/MemoryUsageMonitor.cs @@ -1,11 +1,12 @@ -using Daybreak.Services.Metrics; -using System.Diagnostics.Metrics; +using System.Diagnostics.Metrics; using System.Diagnostics; using System.Threading.Tasks; using System.Windows.Extensions.Services; using System.Core.Extensions; using System.Extensions; using System.Threading; +using Daybreak.Shared.Services.Metrics; +using Daybreak.Shared.Models.Metrics; namespace Daybreak.Services.Monitoring; @@ -24,7 +25,7 @@ internal sealed class MemoryUsageMonitor : IApplicationLifetimeService public MemoryUsageMonitor( IMetricsService metricsService) { - this.memoryUsageHistogram = metricsService.ThrowIfNull().CreateHistogram(MemoryUsage, MemoryUsageUnit, MemoryUsageDescription, Models.Metrics.AggregationTypes.NoAggregate); + this.memoryUsageHistogram = metricsService.ThrowIfNull().CreateHistogram(MemoryUsage, MemoryUsageUnit, MemoryUsageDescription, AggregationTypes.NoAggregate); this.currentProcess = Process.GetCurrentProcess(); } diff --git a/Daybreak/Services/Monitoring/ProcessorUsageMonitor.cs b/Daybreak/Services/Monitoring/ProcessorUsageMonitor.cs index e4a41c54..8ba34cef 100644 --- a/Daybreak/Services/Monitoring/ProcessorUsageMonitor.cs +++ b/Daybreak/Services/Monitoring/ProcessorUsageMonitor.cs @@ -1,4 +1,5 @@ -using Daybreak.Services.Metrics; +using Daybreak.Shared.Models.Metrics; +using Daybreak.Shared.Services.Metrics; using System; using System.Core.Extensions; using System.Diagnostics; @@ -23,7 +24,7 @@ internal sealed class ProcessorUsageMonitor : IApplicationLifetimeService public ProcessorUsageMonitor( IMetricsService metricsService) { - this.processorTimeHistogram = metricsService.ThrowIfNull().CreateHistogram(ProcessorTime, ProcessorTimeUnit, ProcessorTimeDescription, Models.Metrics.AggregationTypes.NoAggregate); + this.processorTimeHistogram = metricsService.ThrowIfNull().CreateHistogram(ProcessorTime, ProcessorTimeUnit, ProcessorTimeDescription, AggregationTypes.NoAggregate); this.currentProcess = Process.GetCurrentProcess(); this.processorCount = Environment.ProcessorCount; } diff --git a/Daybreak/Services/Mutex/MutexHandler.cs b/Daybreak/Services/Mutex/MutexHandler.cs index 2a9ea234..5cbd41c1 100644 --- a/Daybreak/Services/Mutex/MutexHandler.cs +++ b/Daybreak/Services/Mutex/MutexHandler.cs @@ -1,4 +1,5 @@ -using Daybreak.Utils; +using Daybreak.Shared.Services.Mutex; +using Daybreak.Shared.Utils; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/Daybreak/Services/Navigation/ViewManager.cs b/Daybreak/Services/Navigation/ViewManager.cs index 1f7bf487..5a6b924b 100644 --- a/Daybreak/Services/Navigation/ViewManager.cs +++ b/Daybreak/Services/Navigation/ViewManager.cs @@ -1,4 +1,5 @@ -using Slim; +using Daybreak.Shared.Services.Navigation; +using Slim; using System; using System.Extensions; using System.Windows; diff --git a/Daybreak/Models/Notifications/Handling/MessageBoxHandler.cs b/Daybreak/Services/Notifications/Handlers/MessageBoxHandler.cs similarity index 62% rename from Daybreak/Models/Notifications/Handling/MessageBoxHandler.cs rename to Daybreak/Services/Notifications/Handlers/MessageBoxHandler.cs index f17269ac..ae24f5a1 100644 --- a/Daybreak/Models/Notifications/Handling/MessageBoxHandler.cs +++ b/Daybreak/Services/Notifications/Handlers/MessageBoxHandler.cs @@ -1,6 +1,8 @@ using Daybreak.Launch; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; -namespace Daybreak.Models.Notifications.Handling; +namespace Daybreak.Services.Notifications.Handlers; public sealed class MessageBoxHandler : INotificationHandler { diff --git a/Daybreak/Models/Notifications/Handling/NavigateToCalendarViewHandler.cs b/Daybreak/Services/Notifications/Handlers/NavigateToCalendarViewHandler.cs similarity index 73% rename from Daybreak/Models/Notifications/Handling/NavigateToCalendarViewHandler.cs rename to Daybreak/Services/Notifications/Handlers/NavigateToCalendarViewHandler.cs index bb29014d..ea7500a5 100644 --- a/Daybreak/Models/Notifications/Handling/NavigateToCalendarViewHandler.cs +++ b/Daybreak/Services/Notifications/Handlers/NavigateToCalendarViewHandler.cs @@ -1,10 +1,12 @@ -using Daybreak.Models.Guildwars; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; +using Daybreak.Shared.Services.Navigation; using Daybreak.Views; using System.Core.Extensions; using System.Linq; -namespace Daybreak.Models.Notifications.Handling; +namespace Daybreak.Services.Notifications.Handlers; public sealed class NavigateToCalendarViewHandler : INotificationHandler { private readonly IViewManager viewManager; diff --git a/Daybreak/Services/Notifications/Handlers/NoActionHandler.cs b/Daybreak/Services/Notifications/Handlers/NoActionHandler.cs new file mode 100644 index 00000000..bf76a51b --- /dev/null +++ b/Daybreak/Services/Notifications/Handlers/NoActionHandler.cs @@ -0,0 +1,11 @@ +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; + +namespace Daybreak.Models.Notifications.Handling; + +public sealed class NoActionHandler : INotificationHandler +{ + public void OpenNotification(Notification notification) + { + } +} diff --git a/Daybreak/Services/Notifications/INotificationProducer.cs b/Daybreak/Services/Notifications/INotificationProducer.cs deleted file mode 100644 index 6375e813..00000000 --- a/Daybreak/Services/Notifications/INotificationProducer.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Daybreak.Models.Notifications; -using System.Collections.Generic; -using System.Threading; - -namespace Daybreak.Services.Notifications; - -public interface INotificationProducer -{ - void OpenNotification(Notification notification, bool storeNotification = true); - void RemoveNotification(Notification notification); - void RemoveAllNotifications(); - IEnumerable GetAllNotifications(); - IEnumerable GetPendingNotifications(); - IAsyncEnumerable Consume(CancellationToken cancellationToken); -} diff --git a/Daybreak/Services/Notifications/INotificationStorage.cs b/Daybreak/Services/Notifications/INotificationStorage.cs index c77512cb..d620dcd0 100644 --- a/Daybreak/Services/Notifications/INotificationStorage.cs +++ b/Daybreak/Services/Notifications/INotificationStorage.cs @@ -1,19 +1,21 @@ using Daybreak.Services.Notifications.Models; using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; namespace Daybreak.Services.Notifications; public interface INotificationStorage { - IEnumerable GetPendingNotifications(); + ValueTask> GetPendingNotifications(CancellationToken cancellationToken); - IEnumerable GetNotifications(); + ValueTask> GetNotifications(CancellationToken cancellationToken); - void StoreNotification(NotificationDTO notification); + ValueTask StoreNotification(NotificationDTO notification, CancellationToken cancellationToken); - void OpenNotification(NotificationDTO notificationDTO); + ValueTask OpenNotification(NotificationDTO notificationDTO, CancellationToken cancellationToken); - void RemoveNotification(NotificationDTO notificationDTO); + ValueTask RemoveNotification(NotificationDTO notificationDTO, CancellationToken cancellationToken); - void RemoveAllNotifications(); + ValueTask RemoveAllNotifications(CancellationToken cancellationToken); } diff --git a/Daybreak/Services/Notifications/Models/NotificationDTO.cs b/Daybreak/Services/Notifications/Models/NotificationDTO.cs index f57379ad..b6d09b3c 100644 --- a/Daybreak/Services/Notifications/Models/NotificationDTO.cs +++ b/Daybreak/Services/Notifications/Models/NotificationDTO.cs @@ -1,15 +1,15 @@ -using Realms; -using System; +using Squealify; namespace Daybreak.Services.Notifications.Models; -public sealed class NotificationDTO : RealmObject +[Table("notifications")] +public partial class NotificationDTO { [PrimaryKey] - public string Id { get; init; } = string.Empty; + public required string Id { get; init; } = string.Empty; public int Level { get; init; } - public DateTimeOffset ExpirationTime { get; init; } - public DateTimeOffset CreationTime { get; init; } = DateTimeOffset.Now; + public long ExpirationTime { get; set; } + public required long CreationTime { get; init; } public string? Title { get; init; } public string? Description { get; init; } public string? MetaData { get; init; } diff --git a/Daybreak/Services/Notifications/NotificationService.cs b/Daybreak/Services/Notifications/NotificationService.cs index 73f01b88..81b287e8 100644 --- a/Daybreak/Services/Notifications/NotificationService.cs +++ b/Daybreak/Services/Notifications/NotificationService.cs @@ -1,7 +1,9 @@ -using Daybreak.Models.Notifications; -using Daybreak.Models.Notifications.Handling; +using Daybreak.Models.Notifications.Handling; using Daybreak.Services.Notifications.Models; -using Daybreak.Utils; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using Slim; using System; @@ -78,11 +80,11 @@ internal sealed class NotificationService : INotificationService, INotificationP return this.NotifyInternal(title, description, metaData, expirationTime, dismissible, LogLevel.Error, persistent); } - void INotificationProducer.OpenNotification(Notification notification, bool storeNotification) + async ValueTask INotificationProducer.OpenNotification(Notification notification, bool storeNotification, CancellationToken cancellationToken) { if (storeNotification) { - this.storage.OpenNotification(new NotificationDTO + await this.storage.OpenNotification(new NotificationDTO { Title = notification.Title, Description = notification.Description, @@ -90,9 +92,10 @@ internal sealed class NotificationService : INotificationService, INotificationP Level = (int)notification.Level, MetaData = notification.Metadata, HandlerType = notification.HandlingType?.AssemblyQualifiedName, - ExpirationTime = notification.ExpirationTime.ToSafeDateTimeOffset(), + ExpirationTime = notification.ExpirationTime.ToSafeDateTimeOffset().ToUnixTimeMilliseconds(), + CreationTime = notification.CreationTime.ToSafeDateTimeOffset().ToUnixTimeMilliseconds(), Closed = true - }); + }, cancellationToken); } if (notification.HandlingType is null) @@ -104,14 +107,14 @@ internal sealed class NotificationService : INotificationService, INotificationP handler?.OpenNotification(notification); } - void INotificationProducer.RemoveNotification(Notification notification) + async ValueTask INotificationProducer.RemoveNotification(Notification notification, CancellationToken cancellationToken) { - this.storage.RemoveNotification(ToDTO(notification)); + await this.storage.RemoveNotification(ToDTO(notification), cancellationToken); } - void INotificationProducer.RemoveAllNotifications() + async ValueTask INotificationProducer.RemoveAllNotifications(CancellationToken cancellationToken) { - this.storage.RemoveAllNotifications(); + await this.storage.RemoveAllNotifications(cancellationToken); } async IAsyncEnumerable INotificationProducer.Consume([EnumeratorCancellation] CancellationToken cancellationToken) @@ -127,14 +130,14 @@ internal sealed class NotificationService : INotificationService, INotificationP } } - IEnumerable INotificationProducer.GetAllNotifications() + async ValueTask> INotificationProducer.GetAllNotifications(CancellationToken cancellationToken) { - return this.storage.GetNotifications().Select(FromDTO); + return (await this.storage.GetNotifications(cancellationToken)).Select(FromDTO); } - IEnumerable INotificationProducer.GetPendingNotifications() + async ValueTask> INotificationProducer.GetPendingNotifications(CancellationToken cancellationToken) { - return this.storage.GetPendingNotifications().Select(FromDTO); + return (await this.storage.GetPendingNotifications(cancellationToken)).Select(FromDTO); } void INotificationHandlerProducer.RegisterNotificationHandler() @@ -166,11 +169,11 @@ internal sealed class NotificationService : INotificationService, INotificationP return new NotificationToken(notification); } - private void EnqueueNotification(Notification notification, bool persistent) + private async void EnqueueNotification(Notification notification, bool persistent) { if (persistent) { - this.storage.StoreNotification(ToDTO(notification)); + await this.storage.StoreNotification(ToDTO(notification), CancellationToken.None); } this.pendingNotifications.Enqueue(notification); @@ -188,8 +191,8 @@ internal sealed class NotificationService : INotificationService, INotificationP Level = (LogLevel)dto.Level, Title = dto.Title ?? string.Empty, Description = dto.Description ?? string.Empty, - ExpirationTime = dto.ExpirationTime.LocalDateTime, - CreationTime = dto.CreationTime.LocalDateTime, + ExpirationTime = DateTimeOffset.FromUnixTimeMilliseconds(dto.ExpirationTime).LocalDateTime, + CreationTime = DateTimeOffset.FromUnixTimeMilliseconds(dto.CreationTime).LocalDateTime, Metadata = dto.MetaData ?? string.Empty, Dismissible = dto.Dismissible, Closed = dto.Closed, @@ -205,8 +208,8 @@ internal sealed class NotificationService : INotificationService, INotificationP Level = (int)notification.Level, Title = notification.Title, Description = notification.Description, - ExpirationTime = notification.ExpirationTime.ToSafeDateTimeOffset(), - CreationTime = notification.CreationTime.ToSafeDateTimeOffset(), + ExpirationTime = notification.ExpirationTime.ToSafeDateTimeOffset().ToUnixTimeMilliseconds(), + CreationTime = notification.CreationTime.ToSafeDateTimeOffset().ToUnixTimeMilliseconds(), MetaData = notification.Metadata, Dismissible = notification.Dismissible, Closed = notification.Closed, diff --git a/Daybreak/Services/Notifications/NotificationStorage.cs b/Daybreak/Services/Notifications/NotificationStorage.cs index 1efc9f94..80945894 100644 --- a/Daybreak/Services/Notifications/NotificationStorage.cs +++ b/Daybreak/Services/Notifications/NotificationStorage.cs @@ -1,51 +1,63 @@ -using Daybreak.Services.Database; -using Daybreak.Services.Notifications.Models; +using Daybreak.Services.Notifications.Models; using System; using System.Collections.Generic; using System.Core.Extensions; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; namespace Daybreak.Services.Notifications; internal sealed class NotificationStorage : INotificationStorage { - private readonly IDatabaseCollection liteCollection; + private List? notificationsCache; + private readonly NotificationsDbContext liteCollection; public NotificationStorage( - IDatabaseCollection liteCollection) + NotificationsDbContext liteCollection) { this.liteCollection = liteCollection.ThrowIfNull(); } - public IEnumerable GetPendingNotifications() + public async ValueTask> GetPendingNotifications(CancellationToken cancellationToken) { - return this.liteCollection.FindAll(dto => dto.Closed == false && dto.ExpirationTime < DateTimeOffset.Now); + this.notificationsCache ??= await this.liteCollection.FindAll(cancellationToken).ToListAsync(cancellationToken); + return this.notificationsCache + .Where(dto => dto.Closed == false && dto.ExpirationTime < DateTimeOffset.Now.ToUnixTimeMilliseconds()); } - public IEnumerable GetNotifications() + public async ValueTask> GetNotifications(CancellationToken cancellationToken) { - return this.liteCollection.FindAll(); + this.notificationsCache ??= await this.liteCollection.FindAll(cancellationToken).ToListAsync(cancellationToken); + return this.notificationsCache; } - public void StoreNotification(NotificationDTO notification) + public async ValueTask StoreNotification(NotificationDTO notification, CancellationToken cancellationToken) { notification.ThrowIfNull(); - this.liteCollection.Add(notification); + await this.liteCollection.Insert(notification, cancellationToken); + this.notificationsCache ??= await this.liteCollection.FindAll(cancellationToken).ToListAsync(cancellationToken); + this.notificationsCache.Add(notification); } - public void OpenNotification(NotificationDTO notificationDTO) + public async ValueTask OpenNotification(NotificationDTO notificationDTO, CancellationToken cancellationToken) { notificationDTO.ThrowIfNull(); notificationDTO.Closed = true; - this.liteCollection.Update(notificationDTO); + await this.liteCollection.Update(notificationDTO, cancellationToken); + this.notificationsCache = await this.liteCollection.FindAll(cancellationToken).ToListAsync(cancellationToken); } - public void RemoveNotification(NotificationDTO notificationDTO) + public async ValueTask RemoveNotification(NotificationDTO notificationDTO, CancellationToken cancellationToken) { - this.liteCollection.Delete(notificationDTO); + await this.liteCollection.Delete(notificationDTO.Id, cancellationToken); + this.notificationsCache ??= await this.liteCollection.FindAll(cancellationToken).ToListAsync(cancellationToken); + this.notificationsCache.Remove(notificationDTO); } - public void RemoveAllNotifications() + public async ValueTask RemoveAllNotifications(CancellationToken cancellationToken) { - this.liteCollection.DeleteAll(); + await this.liteCollection.DeleteAll(cancellationToken); + this.notificationsCache = default; } } diff --git a/Daybreak/Services/Notifications/NotificationsDbContext.cs b/Daybreak/Services/Notifications/NotificationsDbContext.cs new file mode 100644 index 00000000..1c66649a --- /dev/null +++ b/Daybreak/Services/Notifications/NotificationsDbContext.cs @@ -0,0 +1,7 @@ +using Squealify; +using System.Data.Common; + +namespace Daybreak.Services.Notifications; +public sealed class NotificationsDbContext(DbConnection connection) : NotificationDTOTableContextBase(connection) +{ +} diff --git a/Daybreak/Services/Onboarding/OnboardingService.cs b/Daybreak/Services/Onboarding/OnboardingService.cs index 8af3a327..55910976 100644 --- a/Daybreak/Services/Onboarding/OnboardingService.cs +++ b/Daybreak/Services/Onboarding/OnboardingService.cs @@ -1,8 +1,9 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Onboarding; -using Daybreak.Services.Credentials; -using Daybreak.Services.ExecutableManagement; -using Daybreak.Services.LaunchConfigurations; +using Daybreak.Shared.Models.Onboarding; +using Daybreak.Shared.Services.Credentials; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.LaunchConfigurations; +using Daybreak.Shared.Services.Onboarding; using Microsoft.Extensions.Logging; using System.Configuration; using System.Core.Extensions; diff --git a/Daybreak/Services/Options/OptionsManager.cs b/Daybreak/Services/Options/OptionsManager.cs index 89f2c0ae..f81eb9df 100644 --- a/Daybreak/Services/Options/OptionsManager.cs +++ b/Daybreak/Services/Options/OptionsManager.cs @@ -1,5 +1,6 @@ using Daybreak.Attributes; -using Daybreak.Utils; +using Daybreak.Shared.Services.Options; +using Daybreak.Shared.Utils; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; diff --git a/Daybreak/Services/Options/OptionsSynchronizationService.cs b/Daybreak/Services/Options/OptionsSynchronizationService.cs index 95ff214e..0c3d7515 100644 --- a/Daybreak/Services/Options/OptionsSynchronizationService.cs +++ b/Daybreak/Services/Options/OptionsSynchronizationService.cs @@ -1,6 +1,7 @@ using Daybreak.Attributes; using Daybreak.Configuration.Options; using Daybreak.Services.Graph; +using Daybreak.Shared.Services.Options; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/Daybreak/Services/Plugins/PluginsService.cs b/Daybreak/Services/Plugins/PluginsService.cs index 6c96f39f..1398a21d 100644 --- a/Daybreak/Services/Plugins/PluginsService.cs +++ b/Daybreak/Services/Plugins/PluginsService.cs @@ -1,17 +1,19 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Plugins; -using Daybreak.Services.ApplicationArguments; -using Daybreak.Services.Browser; -using Daybreak.Services.Menu; -using Daybreak.Services.Mods; -using Daybreak.Services.Navigation; -using Daybreak.Services.Notifications; -using Daybreak.Services.Options; using Daybreak.Services.Plugins.Resolvers; using Daybreak.Services.Plugins.Validators; -using Daybreak.Services.Startup; -using Daybreak.Services.Updater.PostUpdate; -using Daybreak.Utils; +using Daybreak.Shared.Models.Plugins; +using Daybreak.Shared.Services.ApplicationArguments; +using Daybreak.Shared.Services.Browser; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Services.Mods; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Options; +using Daybreak.Shared.Services.Plugins; +using Daybreak.Shared.Services.Startup; +using Daybreak.Shared.Services.Updater.PostUpdate; +using Daybreak.Shared.Shared.Models.Plugins; +using Daybreak.Shared.Utils; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Plumsy; diff --git a/Daybreak/Services/Plugins/Validators/DaybreakPluginValidator.cs b/Daybreak/Services/Plugins/Validators/DaybreakPluginValidator.cs index 7efbf81c..47f1728e 100644 --- a/Daybreak/Services/Plugins/Validators/DaybreakPluginValidator.cs +++ b/Daybreak/Services/Plugins/Validators/DaybreakPluginValidator.cs @@ -1,4 +1,5 @@ -using Daybreak.Models.Plugins; +using Daybreak.Shared.Models.Plugins; +using Daybreak.Shared.Shared.Models.Plugins; using Plumsy.Validators; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Privilege/PrivilegeManager.cs b/Daybreak/Services/Privilege/PrivilegeManager.cs index 88ac0fd1..29c8e618 100644 --- a/Daybreak/Services/Privilege/PrivilegeManager.cs +++ b/Daybreak/Services/Privilege/PrivilegeManager.cs @@ -1,5 +1,7 @@ using Daybreak.Models; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Privilege; using Daybreak.Views; using Microsoft.Extensions.Logging; using System.Extensions; diff --git a/Daybreak/Services/ReShade/Notifications/ReShadeConfigChangedHandler.cs b/Daybreak/Services/ReShade/Notifications/ReShadeConfigChangedHandler.cs index 0feb1a4e..e0d63e90 100644 --- a/Daybreak/Services/ReShade/Notifications/ReShadeConfigChangedHandler.cs +++ b/Daybreak/Services/ReShade/Notifications/ReShadeConfigChangedHandler.cs @@ -1,5 +1,6 @@ -using Daybreak.Models.Notifications; -using Daybreak.Models.Notifications.Handling; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; +using Daybreak.Shared.Services.ReShade; using System.Core.Extensions; using System.IO; using System.Threading; diff --git a/Daybreak/Services/ReShade/ReShadeService.cs b/Daybreak/Services/ReShade/ReShadeService.cs index a71c70a1..90de6e0f 100644 --- a/Daybreak/Services/ReShade/ReShadeService.cs +++ b/Daybreak/Services/ReShade/ReShadeService.cs @@ -1,15 +1,17 @@ using Daybreak.Configuration.Options; -using Daybreak.Models; -using Daybreak.Models.Mods; -using Daybreak.Models.Progress; -using Daybreak.Models.ReShade; using Daybreak.Services.Downloads; -using Daybreak.Services.Injection; -using Daybreak.Services.Notifications; using Daybreak.Services.ReShade.Notifications; using Daybreak.Services.ReShade.Utils; -using Daybreak.Services.Scanner; -using Daybreak.Utils; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Mods; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Models.ReShade; +using Daybreak.Shared.Services.Downloads; +using Daybreak.Shared.Services.Injection; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.ReShade; +using Daybreak.Shared.Services.Scanner; +using Daybreak.Shared.Utils; using HtmlAgilityPack; using IniParser.Parser; using Microsoft.Extensions.Logging; @@ -640,19 +642,19 @@ internal sealed class ReShadeService : IReShadeService, IApplicationLifetimeServ } var versionString = downloadUrl.Replace(ReShadeHomepageUrl + "/downloads/ReShade_Setup_", "").Replace(".exe", ""); - if (!Models.Versioning.Version.TryParse(versionString, out var version)) + if (!Shared.Models.Versioning.Version.TryParse(versionString, out var version)) { scopedLogger.LogError("Unable to parse latest version"); return; } - if (!Models.Versioning.Version.TryParse(this.liveUpdateableOptions.Value.InstalledVersion, out var installedVersion)) + if (!Shared.Models.Versioning.Version.TryParse(this.liveUpdateableOptions.Value.InstalledVersion, out var installedVersion)) { scopedLogger.LogError("Unable to parse installed version"); return; } - if (!Models.Versioning.Version.TryParse(DesiredVersion, out var desiredVersion)) + if (!Shared.Models.Versioning.Version.TryParse(DesiredVersion, out var desiredVersion)) { scopedLogger.LogError("Unable to parse desired version"); return; diff --git a/Daybreak/Services/Registry/RegistryService.cs b/Daybreak/Services/Registry/RegistryService.cs index e3e81567..54b7f560 100644 --- a/Daybreak/Services/Registry/RegistryService.cs +++ b/Daybreak/Services/Registry/RegistryService.cs @@ -1,4 +1,5 @@ -using Microsoft.Win32; +using Daybreak.Shared.Services.Registry; +using Microsoft.Win32; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Scanner/GuildwarsMemoryCache.cs b/Daybreak/Services/Scanner/GuildwarsMemoryCache.cs index f5ba7c57..8d6f1875 100644 --- a/Daybreak/Services/Scanner/GuildwarsMemoryCache.cs +++ b/Daybreak/Services/Scanner/GuildwarsMemoryCache.cs @@ -1,7 +1,8 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Guildwars; -using Daybreak.Models.LaunchConfigurations; using Daybreak.Services.Scanner.Models; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.LaunchConfigurations; +using Daybreak.Shared.Services.Scanner; using System; using System.Configuration; using System.Core.Extensions; diff --git a/Daybreak/Services/Scanner/GuildwarsMemoryReader.cs b/Daybreak/Services/Scanner/GuildwarsMemoryReader.cs index 561fed98..fb44b399 100644 --- a/Daybreak/Services/Scanner/GuildwarsMemoryReader.cs +++ b/Daybreak/Services/Scanner/GuildwarsMemoryReader.cs @@ -1,9 +1,9 @@ -using Daybreak.Models.Builds; -using Daybreak.Models.Guildwars; -using Daybreak.Models.Interop; -using Daybreak.Models.Metrics; -using Daybreak.Services.ApplicationLauncher; -using Daybreak.Services.Metrics; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.Interop; +using Daybreak.Shared.Models.Metrics; +using Daybreak.Shared.Services.Metrics; +using Daybreak.Shared.Services.Scanner; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -319,10 +319,10 @@ public sealed class GuildwarsMemoryReader( InstanceTimer = instanceContext.Timer, InstanceType = instanceInfoContext.InstanceType switch { - Daybreak.Models.Interop.InstanceType.Explorable => Daybreak.Models.Guildwars.InstanceType.Explorable, - Daybreak.Models.Interop.InstanceType.Loading => Daybreak.Models.Guildwars.InstanceType.Loading, - Daybreak.Models.Interop.InstanceType.Outpost => Daybreak.Models.Guildwars.InstanceType.Outpost, - _ => Daybreak.Models.Guildwars.InstanceType.Undefined + Shared.Models.Interop.InstanceType.Explorable => Shared.Models.Guildwars.InstanceType.Explorable, + Shared.Models.Interop.InstanceType.Loading => Shared.Models.Guildwars.InstanceType.Loading, + Shared.Models.Interop.InstanceType.Outpost => Shared.Models.Guildwars.InstanceType.Outpost, + _ => Shared.Models.Guildwars.InstanceType.Undefined } } }; @@ -708,7 +708,7 @@ public sealed class GuildwarsMemoryReader( { var attributes = (primaryProfession.PrimaryAttribute is null ? [] : - new List { primaryProfession.PrimaryAttribute! }) + new List { primaryProfession.PrimaryAttribute! }) .Concat(primaryProfession.Attributes) .Concat(secondaryProfession.Attributes) .Select(a => new AttributeEntry { Attribute = a }) diff --git a/Daybreak/Services/Scanner/MemoryScanner.cs b/Daybreak/Services/Scanner/MemoryScanner.cs index 4c081a5b..e98a017e 100644 --- a/Daybreak/Services/Scanner/MemoryScanner.cs +++ b/Daybreak/Services/Scanner/MemoryScanner.cs @@ -1,5 +1,6 @@ -using Daybreak.Models.Interop; -using Daybreak.Utils; +using Daybreak.Shared.Models.Interop; +using Daybreak.Shared.Services.Scanner; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs b/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs index e8e952b9..c427019d 100644 --- a/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs +++ b/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs @@ -1,6 +1,7 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Mods; -using Daybreak.Services.Scanner; +using Daybreak.Shared.Models.Mods; +using Daybreak.Shared.Services.Scanner; +using Daybreak.Shared.Services.Screens; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Screens/IGuildwarsScreenPlacer.cs b/Daybreak/Services/Screens/IGuildwarsScreenPlacer.cs deleted file mode 100644 index a3aa9e0d..00000000 --- a/Daybreak/Services/Screens/IGuildwarsScreenPlacer.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Daybreak.Services.Mods; - -namespace Daybreak.Services.Screens; - -public interface IGuildwarsScreenPlacer : IModService -{ -} diff --git a/Daybreak/Services/Screens/ScreenManager.cs b/Daybreak/Services/Screens/ScreenManager.cs index bb366b70..e07aace9 100644 --- a/Daybreak/Services/Screens/ScreenManager.cs +++ b/Daybreak/Services/Screens/ScreenManager.cs @@ -1,7 +1,8 @@ using Daybreak.Configuration.Options; using Daybreak.Launch; -using Daybreak.Models; -using Daybreak.Utils; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Screens; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Screens/SplashScreenService.cs b/Daybreak/Services/Screens/SplashScreenService.cs index 399c1dde..47d23e88 100644 --- a/Daybreak/Services/Screens/SplashScreenService.cs +++ b/Daybreak/Services/Screens/SplashScreenService.cs @@ -1,7 +1,8 @@ using Daybreak.Configuration.Options; using Daybreak.Launch; -using Daybreak.Models; -using Daybreak.Services.Themes; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Screens; +using Daybreak.Shared.Services.Themes; using Microsoft.Extensions.Options; using System.Collections.Generic; using System.Core.Extensions; diff --git a/Daybreak/Services/Screenshots/BackgroundProvider.cs b/Daybreak/Services/Screenshots/BackgroundProvider.cs index c4629f6e..7478815a 100644 --- a/Daybreak/Services/Screenshots/BackgroundProvider.cs +++ b/Daybreak/Services/Screenshots/BackgroundProvider.cs @@ -1,5 +1,6 @@ using Daybreak.Configuration.Options; -using Daybreak.Services.Screenshots.Models; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Screenshots; using Microsoft.Extensions.Logging; using System; using System.Configuration; diff --git a/Daybreak/Services/Screenshots/Models/Entry.cs b/Daybreak/Services/Screenshots/Models/Entry.cs index 0f9bdd0d..c4ff58a1 100644 --- a/Daybreak/Services/Screenshots/Models/Entry.cs +++ b/Daybreak/Services/Screenshots/Models/Entry.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; namespace Daybreak.Services.Screenshots.Models; internal sealed class Entry diff --git a/Daybreak/Services/Screenshots/Models/Event.cs b/Daybreak/Services/Screenshots/Models/Event.cs index f47bc0cf..ef553fed 100644 --- a/Daybreak/Services/Screenshots/Models/Event.cs +++ b/Daybreak/Services/Screenshots/Models/Event.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System.Collections.Generic; namespace Daybreak.Services.Screenshots.Models; diff --git a/Daybreak/Services/Screenshots/Models/Location.cs b/Daybreak/Services/Screenshots/Models/Location.cs index 54da3c67..97f5ea06 100644 --- a/Daybreak/Services/Screenshots/Models/Location.cs +++ b/Daybreak/Services/Screenshots/Models/Location.cs @@ -1,4 +1,4 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; using System.Collections.Generic; namespace Daybreak.Services.Screenshots.Models; diff --git a/Daybreak/Services/Screenshots/OnlinePictureClient.cs b/Daybreak/Services/Screenshots/OnlinePictureClient.cs index 8d58d7e2..c0105f34 100644 --- a/Daybreak/Services/Screenshots/OnlinePictureClient.cs +++ b/Daybreak/Services/Screenshots/OnlinePictureClient.cs @@ -1,9 +1,10 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Guildwars; -using Daybreak.Services.Images; -using Daybreak.Services.Scanner; using Daybreak.Services.Screenshots.Models; -using Daybreak.Utils; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.Images; +using Daybreak.Shared.Services.Scanner; +using Daybreak.Shared.Services.Screenshots; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/Screenshots/ScreenshotProvider.cs b/Daybreak/Services/Screenshots/ScreenshotProvider.cs index 87ca428d..9f697d27 100644 --- a/Daybreak/Services/Screenshots/ScreenshotProvider.cs +++ b/Daybreak/Services/Screenshots/ScreenshotProvider.cs @@ -1,4 +1,5 @@ -using Daybreak.Services.Images; +using Daybreak.Shared.Services.Images; +using Daybreak.Shared.Services.Screenshots; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Services/SevenZip/SevenZipExtractor.cs b/Daybreak/Services/SevenZip/SevenZipExtractor.cs index e8a15191..7ab02dd6 100644 --- a/Daybreak/Services/SevenZip/SevenZipExtractor.cs +++ b/Daybreak/Services/SevenZip/SevenZipExtractor.cs @@ -1,4 +1,5 @@ -using Daybreak.Utils; +using Daybreak.Shared.Services.SevenZip; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Core.Extensions; diff --git a/Daybreak/Services/Shortcuts/ShortcutManager.cs b/Daybreak/Services/Shortcuts/ShortcutManager.cs index ff721ebd..b35ab300 100644 --- a/Daybreak/Services/Shortcuts/ShortcutManager.cs +++ b/Daybreak/Services/Shortcuts/ShortcutManager.cs @@ -1,5 +1,6 @@ using Daybreak.Configuration.Options; -using Daybreak.Services.Options; +using Daybreak.Shared.Services.Options; +using Daybreak.Shared.Services.Shortcuts; using ShellLink; using System.Configuration; using System.Diagnostics; diff --git a/Daybreak/Services/Sounds/SoundService.cs b/Daybreak/Services/Sounds/SoundService.cs index 260ac2f7..baf0bba4 100644 --- a/Daybreak/Services/Sounds/SoundService.cs +++ b/Daybreak/Services/Sounds/SoundService.cs @@ -1,4 +1,5 @@ using Daybreak.Configuration.Options; +using Daybreak.Shared.Services.Sounds; using NAudio.Wave; using System.Configuration; using System.Core.Extensions; diff --git a/Daybreak/Services/Startup/Actions/BrowserHistorySizeEnforcer.cs b/Daybreak/Services/Startup/Actions/BrowserHistorySizeEnforcer.cs index c160a61f..5bb08751 100644 --- a/Daybreak/Services/Startup/Actions/BrowserHistorySizeEnforcer.cs +++ b/Daybreak/Services/Startup/Actions/BrowserHistorySizeEnforcer.cs @@ -1,4 +1,5 @@ using Daybreak.Configuration.Options; +using Daybreak.Shared.Models; using System.Configuration; using System.Core.Extensions; diff --git a/Daybreak/Services/Startup/Actions/CleanupDatabases.cs b/Daybreak/Services/Startup/Actions/CleanupDatabases.cs index 099245cc..97fc6576 100644 --- a/Daybreak/Services/Startup/Actions/CleanupDatabases.cs +++ b/Daybreak/Services/Startup/Actions/CleanupDatabases.cs @@ -1,66 +1,63 @@ -using Daybreak.Services.Database; -using Daybreak.Services.Logging.Models; -using Daybreak.Services.Notifications.Models; -using Daybreak.Services.TradeChat.Models; +using Daybreak.Services.Logging; +using Daybreak.Services.Notifications; +using Daybreak.Services.TradeChat; +using Daybreak.Shared.Models; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Extensions; +using System.Extensions.Core; using System.Linq; +using System.Threading; +using System.Threading.Tasks; namespace Daybreak.Services.Startup.Actions; internal sealed class CleanupDatabases : StartupActionBase { - private readonly IDatabaseCollection loggingCollection; - private readonly IDatabaseCollection quotesCollection; - private readonly IDatabaseCollection notificationsCollection; - private readonly IDatabaseCollection traderMessagesCollection; + private readonly TradeQuoteDbContext quotesCollection; + private readonly NotificationsDbContext notificationsCollection; + private readonly TradeMessagesDbContext traderMessagesCollection; private readonly ILogger logger; public CleanupDatabases( - IDatabaseCollection loggingCollection, - IDatabaseCollection quotesCollection, - IDatabaseCollection notificationsCollection, - IDatabaseCollection traderMessagesCollection, + TradeQuoteDbContext quotesCollection, + NotificationsDbContext notificationsCollection, + TradeMessagesDbContext traderMessagesCollection, ILogger logger) { - this.loggingCollection = loggingCollection.ThrowIfNull(); this.quotesCollection = quotesCollection.ThrowIfNull(); this.notificationsCollection = notificationsCollection.ThrowIfNull(); this.traderMessagesCollection = traderMessagesCollection.ThrowIfNull(); this.logger = logger.ThrowIfNull(); } - public override void ExecuteOnStartup() + public override async Task ExecuteOnStartupAsync(CancellationToken cancellationToken) { - var scopedLogger = this.logger.CreateScopedLogger(nameof(this.ExecuteOnStartup), string.Empty); - if (this.loggingCollection.Count() > 50000) + var scopedLogger = this.logger.CreateScopedLogger(); + var notifications = await this.notificationsCollection.FindAll(cancellationToken).ToListAsync(cancellationToken); + if (notifications.Count > 1000) { - this.loggingCollection.DeleteAll(); - scopedLogger.LogInformation("Cleared logging database"); - } - - if (this.notificationsCollection.Count() > 1000) - { - this.notificationsCollection.DeleteAll(); + await this.notificationsCollection.DeleteAll(cancellationToken); scopedLogger.LogInformation("Cleared notifications database"); } - if (this.quotesCollection.Count() > 20000) + var allQuotes = await this.quotesCollection.FindAll(cancellationToken).ToListAsync(cancellationToken); + if (allQuotes.Count > 20000) { // Delete the oldest 2000 entries in the db. We probably won't need them anymore - var quotes = this.quotesCollection.FindAll().OrderBy(q => q.TimeStamp).Take(2000).ToList(); - foreach(var quote in quotes) + var quotes = await this.quotesCollection.FindAll(cancellationToken).OrderBy(q => q.TimeStamp).Take(2000).ToListAsync(); + foreach (var quote in quotes) { - this.quotesCollection.Delete(quote); + await this.quotesCollection.Delete(quote.Id, cancellationToken); } - this.quotesCollection.DeleteAll(); + await this.quotesCollection.DeleteAll(cancellationToken); scopedLogger.LogInformation("Cleared quotes database"); } - if (this.traderMessagesCollection.Count() > 1000) + var traderMessages = await this.traderMessagesCollection.FindAll(cancellationToken).ToListAsync(cancellationToken); + if (traderMessages.Count > 1000) { - this.traderMessagesCollection.DeleteAll(); + await this.traderMessagesCollection.DeleteAll(cancellationToken); scopedLogger.LogInformation("Cleared trader messages database"); } } diff --git a/Daybreak/Services/Startup/Actions/CredentialsOptionsMigrator.cs b/Daybreak/Services/Startup/Actions/CredentialsOptionsMigrator.cs index b26e6366..d2d0726f 100644 --- a/Daybreak/Services/Startup/Actions/CredentialsOptionsMigrator.cs +++ b/Daybreak/Services/Startup/Actions/CredentialsOptionsMigrator.cs @@ -1,6 +1,7 @@ using Daybreak.Attributes; using Daybreak.Configuration.Options; -using Daybreak.Services.Options; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Options; using Microsoft.Extensions.Logging; using Newtonsoft.Json.Linq; using System; diff --git a/Daybreak/Services/Startup/Actions/DeleteOldDatabase.cs b/Daybreak/Services/Startup/Actions/DeleteOldDatabase.cs index 3ac0c0e5..b97f87fe 100644 --- a/Daybreak/Services/Startup/Actions/DeleteOldDatabase.cs +++ b/Daybreak/Services/Startup/Actions/DeleteOldDatabase.cs @@ -1,4 +1,5 @@ -using Daybreak.Utils; +using Daybreak.Shared.Models; +using Daybreak.Shared.Utils; using System.IO; namespace Daybreak.Services.Startup.Actions; diff --git a/Daybreak/Services/Startup/Actions/EnsureDatabaseTablesExist.cs b/Daybreak/Services/Startup/Actions/EnsureDatabaseTablesExist.cs new file mode 100644 index 00000000..c091de50 --- /dev/null +++ b/Daybreak/Services/Startup/Actions/EnsureDatabaseTablesExist.cs @@ -0,0 +1,24 @@ +using Daybreak.Services.Notifications; +using Daybreak.Services.TradeChat; +using Daybreak.Shared.Models; +using System.Threading; +using System.Threading.Tasks; + +namespace Daybreak.Services.Startup.Actions; +public sealed class EnsureDatabaseTablesExist( + TradeQuoteDbContext tradeQuoteDbContext, + TradeMessagesDbContext tradeMessagesDbContext, + NotificationsDbContext notificationsDbContext) + : StartupActionBase +{ + private readonly TradeQuoteDbContext tradeQuoteDbContext = tradeQuoteDbContext; + private readonly TradeMessagesDbContext tradeMessagesDbContext = tradeMessagesDbContext; + private readonly NotificationsDbContext notificationsDbContext = notificationsDbContext; + + public override async Task ExecuteOnStartupAsync(CancellationToken cancellationToken) + { + await this.tradeQuoteDbContext.CreateTableIfNotExists(cancellationToken); + await this.tradeMessagesDbContext.CreateTableIfNotExists(cancellationToken); + await this.notificationsDbContext.CreateTableIfNotExists(cancellationToken); + } +} diff --git a/Daybreak/Services/Startup/Actions/RenameInstallerAction.cs b/Daybreak/Services/Startup/Actions/RenameInstallerAction.cs index 24d46456..c1f53f5f 100644 --- a/Daybreak/Services/Startup/Actions/RenameInstallerAction.cs +++ b/Daybreak/Services/Startup/Actions/RenameInstallerAction.cs @@ -1,4 +1,5 @@ -using Daybreak.Utils; +using Daybreak.Shared.Models; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.IO; diff --git a/Daybreak/Services/Startup/Actions/UpdateToolboxAction.cs b/Daybreak/Services/Startup/Actions/UpdateToolboxAction.cs index 7ef80f49..9ab1a06d 100644 --- a/Daybreak/Services/Startup/Actions/UpdateToolboxAction.cs +++ b/Daybreak/Services/Startup/Actions/UpdateToolboxAction.cs @@ -1,4 +1,5 @@ -using Daybreak.Services.Toolbox; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Toolbox; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Extensions.Core; diff --git a/Daybreak/Services/Startup/Actions/UpdateUModAction.cs b/Daybreak/Services/Startup/Actions/UpdateUModAction.cs index 8010a84f..6bc8fac5 100644 --- a/Daybreak/Services/Startup/Actions/UpdateUModAction.cs +++ b/Daybreak/Services/Startup/Actions/UpdateUModAction.cs @@ -1,4 +1,5 @@ -using Daybreak.Services.UMod; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.UMod; using System.Core.Extensions; using System.Threading; using System.Threading.Tasks; diff --git a/Daybreak/Services/Startup/StartupActionManager.cs b/Daybreak/Services/Startup/StartupActionManager.cs index 46050551..2ee6fd57 100644 --- a/Daybreak/Services/Startup/StartupActionManager.cs +++ b/Daybreak/Services/Startup/StartupActionManager.cs @@ -1,4 +1,5 @@ -using Daybreak.Services.Startup.Actions; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Startup; using Microsoft.Extensions.Logging; using Slim; using System; diff --git a/Daybreak/Services/Themes/ThemeManager.cs b/Daybreak/Services/Themes/ThemeManager.cs index 116508c2..38ee2ded 100644 --- a/Daybreak/Services/Themes/ThemeManager.cs +++ b/Daybreak/Services/Themes/ThemeManager.cs @@ -1,9 +1,10 @@ using ControlzEx.Theming; using Daybreak.Configuration.Options; using Daybreak.Launch; -using Daybreak.Models; -using Daybreak.Services.Options; -using Daybreak.Utils; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Options; +using Daybreak.Shared.Services.Themes; +using Daybreak.Shared.Utils; using System; using System.Configuration; using System.Core.Extensions; diff --git a/Daybreak/Services/Toolbox/Notifications/ToolboxUpdateHandler.cs b/Daybreak/Services/Toolbox/Notifications/ToolboxUpdateHandler.cs index 8741eff4..dff1914f 100644 --- a/Daybreak/Services/Toolbox/Notifications/ToolboxUpdateHandler.cs +++ b/Daybreak/Services/Toolbox/Notifications/ToolboxUpdateHandler.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Notifications; -using Daybreak.Models.Notifications.Handling; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; +using Daybreak.Shared.Services.Navigation; using Daybreak.Views.Onboarding.Toolbox; using Microsoft.Extensions.Logging; using System.Core.Extensions; diff --git a/Daybreak/Services/Toolbox/ToolboxService.cs b/Daybreak/Services/Toolbox/ToolboxService.cs index 73e979b2..16d88f95 100644 --- a/Daybreak/Services/Toolbox/ToolboxService.cs +++ b/Daybreak/Services/Toolbox/ToolboxService.cs @@ -1,15 +1,16 @@ using Daybreak.Configuration.Options; -using Daybreak.Exceptions; -using Daybreak.Models.Builds; -using Daybreak.Models.Mods; -using Daybreak.Models.Progress; -using Daybreak.Services.BuildTemplates; -using Daybreak.Services.Injection; -using Daybreak.Services.Notifications; using Daybreak.Services.Toolbox.Models; using Daybreak.Services.Toolbox.Notifications; using Daybreak.Services.Toolbox.Utilities; -using Daybreak.Utils; +using Daybreak.Shared.Exceptions; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Mods; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Services.Injection; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Toolbox; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using Microsoft.Win32; using System; @@ -341,7 +342,7 @@ internal sealed class ToolboxService( current += "-release"; } - if (!Daybreak.Models.Versioning.Version.TryParse(current, out var currentVersion)) + if (!Shared.Models.Versioning.Version.TryParse(current, out var currentVersion)) { return true; } diff --git a/Daybreak/Services/Toolbox/Utilities/IToolboxClient.cs b/Daybreak/Services/Toolbox/Utilities/IToolboxClient.cs index e508af03..12bab68a 100644 --- a/Daybreak/Services/Toolbox/Utilities/IToolboxClient.cs +++ b/Daybreak/Services/Toolbox/Utilities/IToolboxClient.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Progress; -using Daybreak.Models.Versioning; -using Daybreak.Services.Toolbox.Models; +using Daybreak.Services.Toolbox.Models; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Models.Versioning; using System.Threading; using System.Threading.Tasks; diff --git a/Daybreak/Services/Toolbox/Utilities/ToolboxClient.cs b/Daybreak/Services/Toolbox/Utilities/ToolboxClient.cs index 30ef5dfa..0dac13ba 100644 --- a/Daybreak/Services/Toolbox/Utilities/ToolboxClient.cs +++ b/Daybreak/Services/Toolbox/Utilities/ToolboxClient.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Github; -using Daybreak.Models.Progress; -using Daybreak.Services.Downloads; -using Daybreak.Services.Toolbox.Models; +using Daybreak.Services.Toolbox.Models; +using Daybreak.Shared.Models.Github; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Downloads; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -13,7 +13,7 @@ using System.Linq; using System.Net.Http; using System.Threading; using System.Threading.Tasks; -using Version = Daybreak.Models.Versioning.Version; +using Version = Daybreak.Shared.Models.Versioning.Version; namespace Daybreak.Services.Toolbox.Utilities; internal sealed class ToolboxClient : IToolboxClient diff --git a/Daybreak/Services/TradeChat/IItemHashService.cs b/Daybreak/Services/TradeChat/IItemHashService.cs deleted file mode 100644 index 9970501a..00000000 --- a/Daybreak/Services/TradeChat/IItemHashService.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Daybreak.Models.Guildwars; - -namespace Daybreak.Services.TradeChat; - -public interface IItemHashService -{ - string? ComputeHash(ItemBase itemBase); -} diff --git a/Daybreak/Services/TradeChat/IPriceHistoryDatabase.cs b/Daybreak/Services/TradeChat/IPriceHistoryDatabase.cs index 2694ea0b..c1de4b82 100644 --- a/Daybreak/Services/TradeChat/IPriceHistoryDatabase.cs +++ b/Daybreak/Services/TradeChat/IPriceHistoryDatabase.cs @@ -1,19 +1,22 @@ -using Daybreak.Models.Guildwars; -using Daybreak.Services.TradeChat.Models; +using Daybreak.Services.TradeChat.Models; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.Trade; using System; using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; namespace Daybreak.Services.TradeChat; public interface IPriceHistoryDatabase { - IEnumerable GetLatestQuotes(TraderQuoteType traderQuoteType); + ValueTask> GetLatestQuotes(TraderQuoteType traderQuoteType, CancellationToken cancellationToken); - IEnumerable GetQuoteHistory(ItemBase item, DateTime? fromTimestamp, DateTime? toTimestamp); + ValueTask> GetQuoteHistory(ItemBase item, DateTime? fromTimestamp, DateTime? toTimestamp, CancellationToken cancellationToken); - bool AddTraderQuotes(IEnumerable traderQuotes); + ValueTask AddTraderQuotes(IEnumerable traderQuotes, CancellationToken cancellationToken); - IEnumerable GetQuotesByTimestamp(TraderQuoteType type, DateTime? from = default, DateTime? to = default); + ValueTask> GetQuotesByTimestamp(TraderQuoteType type, DateTime? from = default, DateTime? to = default, CancellationToken cancellationToken = default); - IEnumerable GetQuotesByInsertionTime(TraderQuoteType type, DateTime? from = default, DateTime? to = default); + ValueTask> GetQuotesByInsertionTime(TraderQuoteType type, DateTime? from = default, DateTime? to = default, CancellationToken cancellationToken = default); } diff --git a/Daybreak/Services/TradeChat/ITradeHistoryDatabase.cs b/Daybreak/Services/TradeChat/ITradeHistoryDatabase.cs index 238ff9a3..ab45f719 100644 --- a/Daybreak/Services/TradeChat/ITradeHistoryDatabase.cs +++ b/Daybreak/Services/TradeChat/ITradeHistoryDatabase.cs @@ -1,11 +1,13 @@ using Daybreak.Services.TradeChat.Models; using System; using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; namespace Daybreak.Services.TradeChat; public interface ITradeHistoryDatabase { - IEnumerable GetTraderMessagesSinceTime(DateTimeOffset since); - bool StoreTraderMessage(TraderMessageDTO message); + ValueTask> GetTraderMessagesSinceTime(DateTimeOffset since, CancellationToken cancellationToken); + ValueTask StoreTraderMessage(TraderMessageDTO message, CancellationToken cancellationToken); } diff --git a/Daybreak/Services/TradeChat/ItemHashService.cs b/Daybreak/Services/TradeChat/ItemHashService.cs index 3a2ba188..a5fdbfeb 100644 --- a/Daybreak/Services/TradeChat/ItemHashService.cs +++ b/Daybreak/Services/TradeChat/ItemHashService.cs @@ -1,4 +1,5 @@ -using Daybreak.Models.Guildwars; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.TradeChat; using System.Collections.Generic; using System.Extensions; using System.Text; diff --git a/Daybreak/Services/TradeChat/Models/TraderMessageDTO.cs b/Daybreak/Services/TradeChat/Models/TraderMessageDTO.cs index 1d1cc690..ed0ae852 100644 --- a/Daybreak/Services/TradeChat/Models/TraderMessageDTO.cs +++ b/Daybreak/Services/TradeChat/Models/TraderMessageDTO.cs @@ -1,10 +1,14 @@ -using Realms; +using Squealify; using System; namespace Daybreak.Services.TradeChat.Models; -public sealed class TraderMessageDTO : RealmObject +[Table("traderMessages")] +public partial class TraderMessageDTO { + [PrimaryKey] + public required long Id { get; init; } + public int TraderSource { get; init; } public string Message { get; init; } = string.Empty; @@ -12,6 +16,4 @@ public sealed class TraderMessageDTO : RealmObject public string Sender { get; init; } = string.Empty; public DateTimeOffset Timestamp { get; init; } - [PrimaryKey] - public long Id { get; init; } } diff --git a/Daybreak/Services/TradeChat/Models/TraderQuoteDTO.cs b/Daybreak/Services/TradeChat/Models/TraderQuoteDTO.cs index 14cffd45..51a7e402 100644 --- a/Daybreak/Services/TradeChat/Models/TraderQuoteDTO.cs +++ b/Daybreak/Services/TradeChat/Models/TraderQuoteDTO.cs @@ -1,10 +1,14 @@ -using Realms; -using System; +using System; +using Squealify; namespace Daybreak.Services.TradeChat.Models; -public sealed class TraderQuoteDTO : RealmObject +[Table("quotes")] +public sealed class TraderQuoteDTO { + [PrimaryKey] + public required string Id { get; init; } = Guid.NewGuid().ToString(); + public int ItemId { get; set; } public int Price { get; set; } diff --git a/Daybreak/Services/TradeChat/Notifications/TradeMessageNotificationHandler.cs b/Daybreak/Services/TradeChat/Notifications/TradeMessageNotificationHandler.cs index 8b533557..63a42a53 100644 --- a/Daybreak/Services/TradeChat/Notifications/TradeMessageNotificationHandler.cs +++ b/Daybreak/Services/TradeChat/Notifications/TradeMessageNotificationHandler.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Notifications; -using Daybreak.Models.Notifications.Handling; -using Daybreak.Models.Trade; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.Navigation; using Daybreak.Views.Trade; using Newtonsoft.Json; using System.Core.Extensions; diff --git a/Daybreak/Services/TradeChat/PriceHistoryDatabase.cs b/Daybreak/Services/TradeChat/PriceHistoryDatabase.cs index 2414939f..96a55512 100644 --- a/Daybreak/Services/TradeChat/PriceHistoryDatabase.cs +++ b/Daybreak/Services/TradeChat/PriceHistoryDatabase.cs @@ -1,24 +1,27 @@ -using Daybreak.Models.Guildwars; -using Daybreak.Services.Database; -using Daybreak.Services.TradeChat.Models; -using Daybreak.Utils; +using Daybreak.Services.TradeChat.Models; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.TradeChat; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Core.Extensions; using System.Extensions; using System.Linq; +using System.Threading; +using System.Threading.Tasks; namespace Daybreak.Services.TradeChat; internal sealed class PriceHistoryDatabase : IPriceHistoryDatabase { private readonly IItemHashService itemHashService; - private readonly IDatabaseCollection collection; + private readonly TradeQuoteDbContext collection; private readonly ILogger logger; public PriceHistoryDatabase( IItemHashService itemHashService, - IDatabaseCollection collection, + TradeQuoteDbContext collection, ILogger logger) { this.itemHashService = itemHashService.ThrowIfNull(); @@ -26,26 +29,36 @@ internal sealed class PriceHistoryDatabase : IPriceHistoryDatabase this.logger = logger.ThrowIfNull(); } - public bool AddTraderQuotes(IEnumerable traderQuotes) + public async ValueTask AddTraderQuotes(IEnumerable traderQuotes, CancellationToken cancellationToken) { var scopedLogger = this.logger.CreateScopedLogger(nameof(this.AddTraderQuotes), string.Empty); scopedLogger.LogDebug("Inserting quotes"); - this.collection.AddBulk(traderQuotes); + using var transaction = await this.collection.CreateTransaction(cancellationToken); + foreach(var quote in traderQuotes) + { + await this.collection.Insert(quote, cancellationToken); + } + + await transaction.CommitAsync(cancellationToken); scopedLogger.LogDebug("Inserted quotes"); return true; } - public IEnumerable GetLatestQuotes(TraderQuoteType traderQuoteType) + public async ValueTask> GetLatestQuotes(TraderQuoteType traderQuoteType, CancellationToken cancellationToken) { var scopedLogger = this.logger.CreateScopedLogger(nameof(this.GetLatestQuotes), string.Empty); scopedLogger.LogDebug($"Retrieving latest quotes"); - var items = this.collection.FindAll(t => t.TraderQuoteType == (int)traderQuoteType).OrderByDescending(q => q.InsertionTime).ToList(); - var latestItems = items.GroupBy(q => q.ItemId).Select(g => g.First()).ToList(); + var items = await this.collection + .FindAll(cancellationToken) + .Where(t => t.TraderQuoteType == (int)traderQuoteType).OrderByDescending(q => q.InsertionTime) + .GroupBy(q => q.ItemId) + .SelectAwait(async g => await g.FirstAsync(cancellationToken)) + .ToListAsync(cancellationToken); scopedLogger.LogDebug($"Retrieved latest quotes"); - return latestItems; + return items; } - public IEnumerable GetQuoteHistory(ItemBase item, DateTime? fromTimestamp, DateTime? toTimestamp) + public async ValueTask> GetQuoteHistory(ItemBase item, DateTime? fromTimestamp, DateTime? toTimestamp, CancellationToken cancellationToken) { var scopedLogger = this.logger.CreateScopedLogger(nameof(this.GetQuoteHistory), item.Id.ToString()); var fromO = fromTimestamp.HasValue ? @@ -56,17 +69,19 @@ internal sealed class PriceHistoryDatabase : IPriceHistoryDatabase DateTimeOffset.MaxValue; scopedLogger.LogDebug($"Retrieving quotes for item {item.Id} with timestamp between [{fromO}] and [{toO}]"); var modifiersHash = item.Modifiers is not null ? this.itemHashService.ComputeHash(item) : default; - var items = this.collection.FindAll(t => - t.ItemId == item.Id && - t.ModifiersHash == modifiersHash && - t.TimeStamp >= fromO && - t.TimeStamp <= toO && - t.TraderQuoteType == (int)TraderQuoteType.Sell); + var items = await this.collection.FindAll(cancellationToken) + .Where(t => + t.ItemId == item.Id && + t.ModifiersHash == modifiersHash && + t.TimeStamp >= fromO && + t.TimeStamp <= toO && + t.TraderQuoteType == (int)TraderQuoteType.Sell) + .ToListAsync(cancellationToken); scopedLogger.LogDebug($"Retrieved quotes for item {item.Id}"); return items; } - public IEnumerable GetQuotesByTimestamp(TraderQuoteType type, DateTime? from = default, DateTime? to = default) + public async ValueTask> GetQuotesByTimestamp(TraderQuoteType type, DateTime? from = default, DateTime? to = default, CancellationToken cancellationToken = default) { var scopedLogger = this.logger.CreateScopedLogger(nameof(this.GetQuotesByTimestamp), string.Empty); var fromO = from.HasValue ? @@ -76,12 +91,15 @@ internal sealed class PriceHistoryDatabase : IPriceHistoryDatabase to.Value.ToSafeDateTimeOffset() : DateTimeOffset.Now; scopedLogger.LogDebug($"Retrieving all quotes by timestamp between [{fromO}] and [{toO}]"); - var items = this.collection.FindAll(t => t.TimeStamp >= fromO && t.TimeStamp <= toO && t.TraderQuoteType == (int)type); + var items = await this.collection + .FindAll(cancellationToken) + .Where(t => t.TimeStamp >= fromO && t.TimeStamp <= toO && t.TraderQuoteType == (int)type) + .ToListAsync(cancellationToken); scopedLogger.LogDebug("Retrieved quotes by timestamp"); return items; } - public IEnumerable GetQuotesByInsertionTime(TraderQuoteType type, DateTime? from = default, DateTime? to = default) + public async ValueTask> GetQuotesByInsertionTime(TraderQuoteType type, DateTime? from = default, DateTime? to = default, CancellationToken cancellationToken = default) { var scopedLogger = this.logger.CreateScopedLogger(nameof(this.GetQuotesByInsertionTime), string.Empty); var fromO = from.HasValue ? @@ -91,7 +109,10 @@ internal sealed class PriceHistoryDatabase : IPriceHistoryDatabase to.Value.ToSafeDateTimeOffset() : DateTimeOffset.Now; scopedLogger.LogDebug($"Retrieving all quotes by insertion time between [{fromO}] and [{toO}]"); - var items = this.collection.FindAll(t => t.InsertionTime >= fromO && t.InsertionTime <= toO && t.TraderQuoteType == (int)type); + var items = await this.collection + .FindAll(cancellationToken) + .Where(t => t.InsertionTime >= fromO && t.InsertionTime <= toO && t.TraderQuoteType == (int)type) + .ToListAsync(cancellationToken); scopedLogger.LogDebug("Retrieved quotes by insertion time"); return items; } diff --git a/Daybreak/Services/TradeChat/PriceHistoryService.cs b/Daybreak/Services/TradeChat/PriceHistoryService.cs index a2348928..a5531584 100644 --- a/Daybreak/Services/TradeChat/PriceHistoryService.cs +++ b/Daybreak/Services/TradeChat/PriceHistoryService.cs @@ -1,7 +1,8 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Guildwars; -using Daybreak.Models.Trade; using Daybreak.Services.TradeChat.Models; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.TradeChat; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using System; @@ -68,7 +69,7 @@ internal sealed class PriceHistoryService : IPriceHistoryService } var retList = new List(); - foreach (var quote in this.priceHistoryDatabase.GetQuoteHistory(itemBase, from, to)) + foreach (var quote in await this.priceHistoryDatabase.GetQuoteHistory(itemBase, from, to, cancellationToken)) { retList.Add(new TraderQuote { @@ -85,15 +86,16 @@ internal sealed class PriceHistoryService : IPriceHistoryService { var insertionTime = DateTime.UtcNow; var quotes = await this.FetchPricingHistoryInternal(itemBase, cancellationToken, from, to); - this.priceHistoryDatabase.AddTraderQuotes(quotes.Select(quote => new TraderQuoteDTO + await this.priceHistoryDatabase.AddTraderQuotes(quotes.Select(quote => new TraderQuoteDTO { + Id = Guid.NewGuid().ToString(), TimeStamp = quote.Timestamp ?? insertionTime, ItemId = quote.Item?.Id ?? 0, Price = quote.Price, ModifiersHash = quote.Item?.Modifiers is not null ? this.itemHashService.ComputeHash(quote.Item) : default, TraderQuoteType = (int)TraderQuoteType.Sell, InsertionTime = quote.Timestamp ?? insertionTime //Use timestamp as this method basically recreates the kamadan tradechat database - })); + }), cancellationToken); } private async Task> FetchPricingHistoryInternal(ItemBase itemBase, CancellationToken cancellationToken, DateTime? from = default, DateTime? to = default) diff --git a/Daybreak/Services/TradeChat/TradeAlertingService.cs b/Daybreak/Services/TradeChat/TradeAlertingService.cs index dc166b1c..8ccbb0c2 100644 --- a/Daybreak/Services/TradeChat/TradeAlertingService.cs +++ b/Daybreak/Services/TradeChat/TradeAlertingService.cs @@ -1,10 +1,12 @@ using Daybreak.Configuration.Options; -using Daybreak.Converters; -using Daybreak.Models.Trade; -using Daybreak.Services.Notifications; using Daybreak.Services.TradeChat.Models; using Daybreak.Services.TradeChat.Notifications; -using Daybreak.Utils; +using Daybreak.Shared.Configuration.Options; +using Daybreak.Shared.Converters; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.TradeChat; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using System; @@ -114,7 +116,7 @@ internal sealed class TradeAlertingService : ITradeAlertingService, IApplication this.options.Value.LastCheckTime = DateTime.UtcNow; this.options.UpdateOption(); - var savedTrades = this.tradeHistoryDatabase.GetTraderMessagesSinceTime(DateTimeOffset.UtcNow - timeSinceLastCheckTime); + var savedTrades = await this.tradeHistoryDatabase.GetTraderMessagesSinceTime(DateTimeOffset.UtcNow - timeSinceLastCheckTime, cancellationToken); if (savedTrades.None()) { var kamadanHistoryTradesTask = GetTraderMessages(this.kamadanTradeChatService, TraderSource.Kamadan, DateTime.UtcNow - timeSinceLastCheckTime, cancellationToken); @@ -122,10 +124,10 @@ internal sealed class TradeAlertingService : ITradeAlertingService, IApplication await Task.WhenAll(kamadanHistoryTradesTask, ascalonHistoryTradesTask); var kamadanHistoryTrades = await kamadanHistoryTradesTask; var ascalonHistoryTrades = await ascalonHistoryTradesTask; - savedTrades = kamadanHistoryTrades.Concat(ascalonHistoryTrades).ToList(); + savedTrades = [.. kamadanHistoryTrades, .. ascalonHistoryTrades]; foreach(var trade in savedTrades) { - this.tradeHistoryDatabase.StoreTraderMessage(trade); + await this.tradeHistoryDatabase.StoreTraderMessage(trade, cancellationToken); } } @@ -154,7 +156,7 @@ internal sealed class TradeAlertingService : ITradeAlertingService, IApplication TraderSource = (int)traderSource }; - this.tradeHistoryDatabase.StoreTraderMessage(traderMessageDTO); + await this.tradeHistoryDatabase.StoreTraderMessage(traderMessageDTO, cancellationToken); this.CheckTrade(traderMessageDTO); } } diff --git a/Daybreak/Services/TradeChat/TradeChatService.cs b/Daybreak/Services/TradeChat/TradeChatService.cs index b2ba075b..2120548e 100644 --- a/Daybreak/Services/TradeChat/TradeChatService.cs +++ b/Daybreak/Services/TradeChat/TradeChatService.cs @@ -1,6 +1,7 @@ -using Daybreak.Configuration.Options; -using Daybreak.Models.Trade; -using Daybreak.Services.TradeChat.Models; +using Daybreak.Services.TradeChat.Models; +using Daybreak.Shared.Configuration.Options; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.TradeChat; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Newtonsoft.Json; diff --git a/Daybreak/Services/TradeChat/TradeHistoryDatabase.cs b/Daybreak/Services/TradeChat/TradeHistoryDatabase.cs index f51f6118..87660a5b 100644 --- a/Daybreak/Services/TradeChat/TradeHistoryDatabase.cs +++ b/Daybreak/Services/TradeChat/TradeHistoryDatabase.cs @@ -1,28 +1,34 @@ -using Daybreak.Services.Database; -using Daybreak.Services.TradeChat.Models; +using Daybreak.Services.TradeChat.Models; using System; using System.Collections.Generic; using System.Core.Extensions; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; namespace Daybreak.Services.TradeChat; internal sealed class TradeHistoryDatabase : ITradeHistoryDatabase { - private readonly IDatabaseCollection liteCollection; + private readonly TradeMessagesDbContext liteCollection; public TradeHistoryDatabase( - IDatabaseCollection liteCollection) + TradeMessagesDbContext liteCollection) { this.liteCollection = liteCollection.ThrowIfNull(); } - public IEnumerable GetTraderMessagesSinceTime(DateTimeOffset since) + public async ValueTask> GetTraderMessagesSinceTime(DateTimeOffset since, CancellationToken cancellationToken) { - return this.liteCollection.FindAll(t => t.Timestamp > since); + return await this.liteCollection + .FindAll(cancellationToken) + .Where(t => t.Timestamp > since) + .ToListAsync(cancellationToken); } - public bool StoreTraderMessage(TraderMessageDTO message) + public async ValueTask StoreTraderMessage(TraderMessageDTO message, CancellationToken cancellationToken) { - return this.liteCollection.Update(message); + await this.liteCollection.Update(message, cancellationToken); + return true; } } diff --git a/Daybreak/Services/TradeChat/TradeMessagesDbContext.cs b/Daybreak/Services/TradeChat/TradeMessagesDbContext.cs new file mode 100644 index 00000000..05352f15 --- /dev/null +++ b/Daybreak/Services/TradeChat/TradeMessagesDbContext.cs @@ -0,0 +1,7 @@ +using Squealify; +using System.Data.Common; + +namespace Daybreak.Services.TradeChat; +public sealed class TradeMessagesDbContext(DbConnection connection) : TraderMessageDTOTableContextBase(connection) +{ +} diff --git a/Daybreak/Services/TradeChat/TradeQuoteDbContext.cs b/Daybreak/Services/TradeChat/TradeQuoteDbContext.cs new file mode 100644 index 00000000..5a21b35b --- /dev/null +++ b/Daybreak/Services/TradeChat/TradeQuoteDbContext.cs @@ -0,0 +1,10 @@ +using Squealify; +using System.Data.Common; +using System.Threading; +using System.Threading.Tasks; + +namespace Daybreak.Services.TradeChat; +public sealed class TradeQuoteDbContext(DbConnection connection) : TraderQuoteDTOTableContextBase(connection) +{ + public ValueTask CreateTransaction(CancellationToken cancellationToken) => this.Connection.BeginTransactionAsync(cancellationToken); +} diff --git a/Daybreak/Services/TradeChat/TraderQuoteService.cs b/Daybreak/Services/TradeChat/TraderQuoteService.cs index 5953a8ce..4cbf6a23 100644 --- a/Daybreak/Services/TradeChat/TraderQuoteService.cs +++ b/Daybreak/Services/TradeChat/TraderQuoteService.cs @@ -1,8 +1,9 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Guildwars; -using Daybreak.Models.Trade; using Daybreak.Services.TradeChat.Models; -using Daybreak.Utils; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.TradeChat; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using System; @@ -66,7 +67,7 @@ internal sealed class TraderQuoteService : ITraderQuoteService return buyQuotes; } - var quotes = this.priceHistoryDatabase.GetLatestQuotes(TraderQuoteType.Buy); + var quotes = await this.priceHistoryDatabase.GetLatestQuotes(TraderQuoteType.Buy, cancellationToken); var retList = new List(); foreach(var quoteDTO in quotes) { @@ -96,7 +97,7 @@ internal sealed class TraderQuoteService : ITraderQuoteService return sellQuotes; } - var quotes = this.priceHistoryDatabase.GetLatestQuotes(TraderQuoteType.Sell); + var quotes = await this.priceHistoryDatabase.GetLatestQuotes(TraderQuoteType.Sell, cancellationToken); var retList = new List(); foreach (var quoteDTO in quotes) { @@ -123,29 +124,31 @@ internal sealed class TraderQuoteService : ITraderQuoteService var buyQuotes = await this.FetchBuyQuotesInternal(cancellationToken); var sellQuotes = await this.FetchSellQuotesInternal(cancellationToken); var insertionTime = DateTimeOffset.UtcNow; - this.priceHistoryDatabase.AddTraderQuotes(buyQuotes + await this.priceHistoryDatabase.AddTraderQuotes(buyQuotes .Select( quote => new TraderQuoteDTO { + Id = Guid.NewGuid().ToString(), Price = quote.Price, ItemId = quote.Item?.Id ?? 0, ModifiersHash = quote.Item?.Modifiers is null ? string.Empty : this.itemHashService.ComputeHash(quote.Item), InsertionTime = insertionTime, TimeStamp = quote.Timestamp.ToSafeDateTimeOffset() ?? insertionTime, TraderQuoteType = (int)TraderQuoteType.Buy - })); + }), cancellationToken); - this.priceHistoryDatabase.AddTraderQuotes(sellQuotes + await this.priceHistoryDatabase.AddTraderQuotes(sellQuotes .Select( quote => new TraderQuoteDTO { + Id = Guid.NewGuid().ToString(), Price = quote.Price, ItemId = quote.Item?.Id ?? 0, ModifiersHash = quote.Item?.Modifiers is null ? string.Empty : this.itemHashService.ComputeHash(quote.Item), InsertionTime = insertionTime, TimeStamp = quote.Timestamp.ToSafeDateTimeOffset() ?? insertionTime, TraderQuoteType = (int)TraderQuoteType.Sell - })); + }), cancellationToken); this.options.Value.LastCheckTime = insertionTime.UtcDateTime; this.options.UpdateOption(); diff --git a/Daybreak/Services/TradeChat/WordHighlightingService.cs b/Daybreak/Services/TradeChat/WordHighlightingService.cs index 028a1b72..d4a90646 100644 --- a/Daybreak/Services/TradeChat/WordHighlightingService.cs +++ b/Daybreak/Services/TradeChat/WordHighlightingService.cs @@ -1,4 +1,5 @@ -using Daybreak.Models; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.TradeChat; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Windows.Media; diff --git a/Daybreak/Services/UBlockOrigin/UBlockOriginService.cs b/Daybreak/Services/UBlockOrigin/UBlockOriginService.cs index 4fae22ea..614018e3 100644 --- a/Daybreak/Services/UBlockOrigin/UBlockOriginService.cs +++ b/Daybreak/Services/UBlockOrigin/UBlockOriginService.cs @@ -1,6 +1,4 @@ -using Daybreak.Models.Github; -using Daybreak.Models.Progress; -using System.Collections.Generic; +using System.Collections.Generic; using System; using System.IO; using System.Threading; @@ -10,13 +8,15 @@ using System.Net.Http; using Microsoft.Extensions.Logging; using System.Extensions; using System.Linq; -using Daybreak.Services.Downloads; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Daybreak.Services.Notifications; -using Daybreak.Services.Browser; -using Daybreak.Utils; using System.IO.Compression; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Browser; +using Daybreak.Shared.Models.Github; +using Daybreak.Shared.Utils; +using Daybreak.Shared.Services.Downloads; +using Daybreak.Shared.Models.Progress; namespace Daybreak.Services.UBlockOrigin; public sealed class UBlockOriginService : IBrowserExtension @@ -91,8 +91,8 @@ public sealed class UBlockOriginService : IBrowserExtension } if (currentVersionString is not null && - Models.Versioning.Version.TryParse(currentVersionString, out var currentVersion) && - Models.Versioning.Version.TryParse(latestVersionString, out var latestVersion) && + Shared.Models.Versioning.Version.TryParse(currentVersionString, out var currentVersion) && + Shared.Models.Versioning.Version.TryParse(latestVersionString, out var latestVersion) && currentVersion.CompareTo(latestVersion) >= 0) { scopedLogger.LogInformation("uBlock-Origin is up to date"); diff --git a/Daybreak/Services/UMod/UModService.cs b/Daybreak/Services/UMod/UModService.cs index 16790afd..922f0323 100644 --- a/Daybreak/Services/UMod/UModService.cs +++ b/Daybreak/Services/UMod/UModService.cs @@ -1,13 +1,14 @@ using Daybreak.Configuration.Options; -using Daybreak.Models.Github; -using Daybreak.Models.Mods; -using Daybreak.Models.Progress; -using Daybreak.Models.UMod; -using Daybreak.Services.Downloads; -using Daybreak.Services.Injection; -using Daybreak.Services.Notifications; using Daybreak.Services.Toolbox.Models; -using Daybreak.Utils; +using Daybreak.Shared.Models.Github; +using Daybreak.Shared.Models.Mods; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Models.UMod; +using Daybreak.Shared.Services.Downloads; +using Daybreak.Shared.Services.Injection; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.UMod; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -56,11 +57,11 @@ internal sealed class UModService : IUModService public bool IsInstalled => File.Exists(Path.GetFullPath(Path.Combine(UModDirectory, UModDll))); - public Models.Versioning.Version Version => File.Exists(Path.Combine(Path.GetFullPath(UModDirectory), UModDll)) ? - Models.Versioning.Version.TryParse(FileVersionInfo.GetVersionInfo(Path.Combine(Path.GetFullPath(UModDirectory), UModDll)).FileVersion!, out var version) ? + public Shared.Models.Versioning.Version Version => File.Exists(Path.Combine(Path.GetFullPath(UModDirectory), UModDll)) ? + Shared.Models.Versioning.Version.TryParse(FileVersionInfo.GetVersionInfo(Path.Combine(Path.GetFullPath(UModDirectory), UModDll)).FileVersion!, out var version) ? version : - Models.Versioning.Version.Zero : - Models.Versioning.Version.Zero; + Shared.Models.Versioning.Version.Zero : + Shared.Models.Versioning.Version.Zero; public UModService( IProcessInjector processInjector, @@ -204,7 +205,7 @@ internal sealed class UModService : IUModService .OfType() .LastOrDefault(); - if (!Daybreak.Models.Versioning.Version.TryParse(latestRelease ?? string.Empty, out var latestVersion)) + if (!Shared.Models.Versioning.Version.TryParse(latestRelease ?? string.Empty, out var latestVersion)) { scopedLogger.LogError($"Unable to parse latest version {latestRelease}"); return; diff --git a/Daybreak/Services/Updater/ApplicationUpdater.cs b/Daybreak/Services/Updater/ApplicationUpdater.cs index 6b694d2c..b5c400da 100644 --- a/Daybreak/Services/Updater/ApplicationUpdater.cs +++ b/Daybreak/Services/Updater/ApplicationUpdater.cs @@ -1,13 +1,14 @@ using Daybreak.Configuration.Options; -using Daybreak.Exceptions; -using Daybreak.Models.Github; -using Daybreak.Models.Progress; -using Daybreak.Services.Downloads; -using Daybreak.Services.Notifications; -using Daybreak.Services.Registry; using Daybreak.Services.Updater.Models; -using Daybreak.Services.Updater.PostUpdate; -using Daybreak.Utils; +using Daybreak.Shared.Exceptions; +using Daybreak.Shared.Models.Github; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Downloads; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Registry; +using Daybreak.Shared.Services.Updater; +using Daybreak.Shared.Services.Updater.PostUpdate; +using Daybreak.Shared.Utils; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -24,8 +25,8 @@ using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; -using UpdateStatus = Daybreak.Models.Progress.UpdateStatus; -using Version = Daybreak.Models.Versioning.Version; +using UpdateStatus = Daybreak.Shared.Models.Progress.UpdateStatus; +using Version = Daybreak.Shared.Models.Versioning.Version; namespace Daybreak.Services.Updater; diff --git a/Daybreak/Services/Updater/PostUpdate/IPostUpdateActionProvider.cs b/Daybreak/Services/Updater/PostUpdate/IPostUpdateActionProvider.cs deleted file mode 100644 index 50e704ac..00000000 --- a/Daybreak/Services/Updater/PostUpdate/IPostUpdateActionProvider.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Collections.Generic; - -namespace Daybreak.Services.Updater.PostUpdate; - -public interface IPostUpdateActionProvider -{ - IEnumerable GetPostUpdateActions(); -} diff --git a/Daybreak/Services/Updater/PostUpdate/PostUpdateActionManager.cs b/Daybreak/Services/Updater/PostUpdate/PostUpdateActionManager.cs index bd328b63..f86562d0 100644 --- a/Daybreak/Services/Updater/PostUpdate/PostUpdateActionManager.cs +++ b/Daybreak/Services/Updater/PostUpdate/PostUpdateActionManager.cs @@ -1,4 +1,6 @@ -using Microsoft.Extensions.Logging; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Updater.PostUpdate; +using Microsoft.Extensions.Logging; using Slim; using System.Collections.Generic; using System.Core.Extensions; diff --git a/Daybreak/Services/Updater/UpdateNotificationHandler.cs b/Daybreak/Services/Updater/UpdateNotificationHandler.cs index e9ff10e8..fc1c007e 100644 --- a/Daybreak/Services/Updater/UpdateNotificationHandler.cs +++ b/Daybreak/Services/Updater/UpdateNotificationHandler.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Notifications; -using Daybreak.Models.Notifications.Handling; -using Daybreak.Models.Versioning; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Models.Notifications.Handling; +using Daybreak.Shared.Models.Versioning; +using Daybreak.Shared.Services.Navigation; using Daybreak.Views; using System.Core.Extensions; diff --git a/Daybreak/Services/Window/WindowEventsHook.cs b/Daybreak/Services/Window/WindowEventsHook.cs index 04288685..b28d3828 100644 --- a/Daybreak/Services/Window/WindowEventsHook.cs +++ b/Daybreak/Services/Window/WindowEventsHook.cs @@ -1,4 +1,5 @@ using Daybreak.Behaviors; +using Daybreak.Shared.Services.Window; using System; using System.Collections.Generic; using System.Core.Extensions; diff --git a/Daybreak/Views/BuildsListView.xaml b/Daybreak/Views/BuildsListView.xaml index 6d275c2b..976bdea0 100644 --- a/Daybreak/Views/BuildsListView.xaml +++ b/Daybreak/Views/BuildsListView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:glyphs="clr-namespace:Daybreak.Controls.Glyphs" diff --git a/Daybreak/Views/BuildsListView.xaml.cs b/Daybreak/Views/BuildsListView.xaml.cs index 5af9ca6e..f6e93b77 100644 --- a/Daybreak/Views/BuildsListView.xaml.cs +++ b/Daybreak/Views/BuildsListView.xaml.cs @@ -1,10 +1,9 @@ -using Daybreak.Models; -using Daybreak.Models.Builds; -using Daybreak.Models.Guildwars; -using Daybreak.Services.BuildTemplates; -using Daybreak.Services.Navigation; -using Daybreak.Services.Toolbox; -using Daybreak.Utils; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Toolbox; +using Daybreak.Shared.Utils; using System; using System.Collections.Generic; using System.Core.Extensions; diff --git a/Daybreak/Views/BuildsSynchronizationView.xaml b/Daybreak/Views/BuildsSynchronizationView.xaml index 9cc543ed..48f13a35 100644 --- a/Daybreak/Views/BuildsSynchronizationView.xaml +++ b/Daybreak/Views/BuildsSynchronizationView.xaml @@ -4,10 +4,10 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:glyps="clr-namespace:Daybreak.Controls.Glyphs" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:controls="clr-namespace:Daybreak.Controls" Loaded="UserControl_Loaded" mc:Ignorable="d" x:Name="_this" diff --git a/Daybreak/Views/BuildsSynchronizationView.xaml.cs b/Daybreak/Views/BuildsSynchronizationView.xaml.cs index 68f24de0..6522ab0c 100644 --- a/Daybreak/Views/BuildsSynchronizationView.xaml.cs +++ b/Daybreak/Views/BuildsSynchronizationView.xaml.cs @@ -9,11 +9,11 @@ using Daybreak.Services.Graph.Models; using System.Extensions; using System.Threading.Tasks; using System; -using Daybreak.Services.BuildTemplates; using System.Linq; -using Daybreak.Models; using System.Collections.Generic; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Navigation; namespace Daybreak.Views; diff --git a/Daybreak/Views/Copy/GuildwarsCopySelectionView.xaml b/Daybreak/Views/Copy/GuildwarsCopySelectionView.xaml index 2ec159d7..9ec6af8c 100644 --- a/Daybreak/Views/Copy/GuildwarsCopySelectionView.xaml +++ b/Daybreak/Views/Copy/GuildwarsCopySelectionView.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views.Copy" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" Loaded="UserControl_Loaded" x:Name="_this" diff --git a/Daybreak/Views/Copy/GuildwarsCopySelectionView.xaml.cs b/Daybreak/Views/Copy/GuildwarsCopySelectionView.xaml.cs index 7c542400..d8ec4cb4 100644 --- a/Daybreak/Views/Copy/GuildwarsCopySelectionView.xaml.cs +++ b/Daybreak/Views/Copy/GuildwarsCopySelectionView.xaml.cs @@ -1,7 +1,7 @@ using Daybreak.Controls.Buttons; -using Daybreak.Models.Onboarding; -using Daybreak.Services.ExecutableManagement; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Onboarding; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Daybreak/Views/Copy/GuildwarsCopyView.xaml.cs b/Daybreak/Views/Copy/GuildwarsCopyView.xaml.cs index 954a2fe1..99b167dd 100644 --- a/Daybreak/Views/Copy/GuildwarsCopyView.xaml.cs +++ b/Daybreak/Views/Copy/GuildwarsCopyView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.Guildwars; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Guildwars; +using Daybreak.Shared.Services.Navigation; using Daybreak.Views.Launch; using Microsoft.Extensions.Logging; using System; diff --git a/Daybreak/Views/EventCalendarView.xaml b/Daybreak/Views/EventCalendarView.xaml index f01df3c9..f4c13cd5 100644 --- a/Daybreak/Views/EventCalendarView.xaml +++ b/Daybreak/Views/EventCalendarView.xaml @@ -4,8 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" - xmlns:converters="clr-namespace:Daybreak.Converters" x:Name="_this" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Views/EventCalendarView.xaml.cs b/Daybreak/Views/EventCalendarView.xaml.cs index 0b8211e1..9c94df2b 100644 --- a/Daybreak/Views/EventCalendarView.xaml.cs +++ b/Daybreak/Views/EventCalendarView.xaml.cs @@ -1,6 +1,6 @@ using Daybreak.Models; -using Daybreak.Models.Guildwars; -using Daybreak.Services.Events; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Services.Events; using System; using System.Collections.ObjectModel; using System.Core.Extensions; diff --git a/Daybreak/Views/FocusView.xaml b/Daybreak/Views/FocusView.xaml index b990d1aa..c1b9cc8a 100644 --- a/Daybreak/Views/FocusView.xaml +++ b/Daybreak/Views/FocusView.xaml @@ -4,8 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" - xmlns:converters="clr-namespace:Daybreak.Converters" xmlns:templates="clr-namespace:Daybreak.Controls.Templates" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:interactivity="http://schemas.microsoft.com/xaml/behaviors" diff --git a/Daybreak/Views/FocusView.xaml.cs b/Daybreak/Views/FocusView.xaml.cs index 8ed6b840..faa6dbab 100644 --- a/Daybreak/Views/FocusView.xaml.cs +++ b/Daybreak/Views/FocusView.xaml.cs @@ -1,17 +1,17 @@ using Daybreak.Configuration.Options; using Daybreak.Launch; -using Daybreak.Models; -using Daybreak.Models.Builds; -using Daybreak.Models.Guildwars; -using Daybreak.Models.LaunchConfigurations; -using Daybreak.Services.ApplicationLauncher; -using Daybreak.Services.BuildTemplates; -using Daybreak.Services.Experience; -using Daybreak.Services.Navigation; -using Daybreak.Services.Notifications; -using Daybreak.Services.Scanner; -using Daybreak.Services.Screens; -using Daybreak.Services.Window; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.Builds; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.LaunchConfigurations; +using Daybreak.Shared.Services.ApplicationLauncher; +using Daybreak.Shared.Services.BuildTemplates; +using Daybreak.Shared.Services.Experience; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.Scanner; +using Daybreak.Shared.Services.Screens; +using Daybreak.Shared.Services.Window; using Daybreak.Views.Trade; using Microsoft.Extensions.Logging; using System; diff --git a/Daybreak/Views/GraphAuthorizationView.xaml b/Daybreak/Views/GraphAuthorizationView.xaml index 5e80efaa..e677b381 100644 --- a/Daybreak/Views/GraphAuthorizationView.xaml +++ b/Daybreak/Views/GraphAuthorizationView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" diff --git a/Daybreak/Views/GraphAuthorizationView.xaml.cs b/Daybreak/Views/GraphAuthorizationView.xaml.cs index b75020c0..ec7b0bd2 100644 --- a/Daybreak/Views/GraphAuthorizationView.xaml.cs +++ b/Daybreak/Views/GraphAuthorizationView.xaml.cs @@ -1,6 +1,6 @@ using Daybreak.Services.Graph; using Daybreak.Services.Graph.Models; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Threading; diff --git a/Daybreak/Views/GuildWarsPartySearchView.xaml b/Daybreak/Views/GuildWarsPartySearchView.xaml index 80187371..55157bf3 100644 --- a/Daybreak/Views/GuildWarsPartySearchView.xaml +++ b/Daybreak/Views/GuildWarsPartySearchView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" Loaded="UserControl_Loaded" mc:Ignorable="d" diff --git a/Daybreak/Views/GuildWarsPartySearchView.xaml.cs b/Daybreak/Views/GuildWarsPartySearchView.xaml.cs index 8e7c2f38..98617047 100644 --- a/Daybreak/Views/GuildWarsPartySearchView.xaml.cs +++ b/Daybreak/Views/GuildWarsPartySearchView.xaml.cs @@ -1,4 +1,4 @@ -using Daybreak.Services.Menu; +using Daybreak.Shared.Services.Menu; using System.Core.Extensions; using System.Windows.Controls; diff --git a/Daybreak/Views/Installation/GuildWarsDownloadSelectionView.xaml.cs b/Daybreak/Views/Installation/GuildWarsDownloadSelectionView.xaml.cs index 7f56c0ac..19a63120 100644 --- a/Daybreak/Views/Installation/GuildWarsDownloadSelectionView.xaml.cs +++ b/Daybreak/Views/Installation/GuildWarsDownloadSelectionView.xaml.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.Guildwars; -using Daybreak.Services.Guildwars.Models; -using Daybreak.Services.Navigation; +using Daybreak.Services.Guildwars.Models; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Guildwars; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Threading; diff --git a/Daybreak/Views/Installation/GuildWarsDownloadView.xaml b/Daybreak/Views/Installation/GuildWarsDownloadView.xaml index b7456930..6d22e5a1 100644 --- a/Daybreak/Views/Installation/GuildWarsDownloadView.xaml +++ b/Daybreak/Views/Installation/GuildWarsDownloadView.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Views.Installation" mc:Ignorable="d" x:Name="_this" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" DataContextChanged="GuildWarsDownloadView_DataContextChanged" Unloaded="DownloadView_Unloaded" diff --git a/Daybreak/Views/Installation/GuildwarsDownloadView.xaml.cs b/Daybreak/Views/Installation/GuildwarsDownloadView.xaml.cs index b7c732dc..e82aeee8 100644 --- a/Daybreak/Views/Installation/GuildwarsDownloadView.xaml.cs +++ b/Daybreak/Views/Installation/GuildwarsDownloadView.xaml.cs @@ -1,14 +1,14 @@ -using Daybreak.Services.Navigation; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using System.Windows; -using Daybreak.Models.Progress; using System.Core.Extensions; using System.Windows.Extensions; using System.Threading; using System.Windows.Controls; -using Daybreak.Services.Menu; -using Daybreak.Services.Guildwars; using Daybreak.Services.Guildwars.Models; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Guildwars; +using Daybreak.Shared.Services.Navigation; namespace Daybreak.Views.Installation; diff --git a/Daybreak/Views/Launch/AccountsView.xaml b/Daybreak/Views/Launch/AccountsView.xaml index 57fade58..47b337f6 100644 --- a/Daybreak/Views/Launch/AccountsView.xaml +++ b/Daybreak/Views/Launch/AccountsView.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" mc:Ignorable="d" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" x:Name="_this" diff --git a/Daybreak/Views/Launch/AccountsView.xaml.cs b/Daybreak/Views/Launch/AccountsView.xaml.cs index c500b637..331bdb97 100644 --- a/Daybreak/Views/Launch/AccountsView.xaml.cs +++ b/Daybreak/Views/Launch/AccountsView.xaml.cs @@ -1,7 +1,7 @@ using Daybreak.Controls; -using Daybreak.Models; -using Daybreak.Services.Credentials; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Credentials; +using Daybreak.Shared.Services.Navigation; using System; using System.Collections.ObjectModel; using System.Core.Extensions; diff --git a/Daybreak/Views/Launch/ExecutablesView.xaml b/Daybreak/Views/Launch/ExecutablesView.xaml index a899b36c..5ae6529f 100644 --- a/Daybreak/Views/Launch/ExecutablesView.xaml +++ b/Daybreak/Views/Launch/ExecutablesView.xaml @@ -6,6 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Views" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" x:Name="_this" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Views/Launch/ExecutablesView.xaml.cs b/Daybreak/Views/Launch/ExecutablesView.xaml.cs index e1be3f07..385c1490 100644 --- a/Daybreak/Views/Launch/ExecutablesView.xaml.cs +++ b/Daybreak/Views/Launch/ExecutablesView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models; -using Daybreak.Services.ExecutableManagement; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.Navigation; using System; using System.Collections.ObjectModel; using System.Core.Extensions; diff --git a/Daybreak/Views/Launch/LaunchConfigurationView.xaml.cs b/Daybreak/Views/Launch/LaunchConfigurationView.xaml.cs index ba38b6f0..af4a6555 100644 --- a/Daybreak/Views/Launch/LaunchConfigurationView.xaml.cs +++ b/Daybreak/Views/Launch/LaunchConfigurationView.xaml.cs @@ -1,10 +1,10 @@ -using Daybreak.Models; -using Daybreak.Models.LaunchConfigurations; -using Daybreak.Services.Credentials; -using Daybreak.Services.ExecutableManagement; -using Daybreak.Services.LaunchConfigurations; -using Daybreak.Services.Navigation; -using Daybreak.Services.Notifications; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.LaunchConfigurations; +using Daybreak.Shared.Services.Credentials; +using Daybreak.Shared.Services.ExecutableManagement; +using Daybreak.Shared.Services.LaunchConfigurations; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Notifications; using System; using System.Collections.ObjectModel; using System.Core.Extensions; diff --git a/Daybreak/Views/Launch/LaunchConfigurationsView.xaml.cs b/Daybreak/Views/Launch/LaunchConfigurationsView.xaml.cs index c5067a35..730dc4cf 100644 --- a/Daybreak/Views/Launch/LaunchConfigurationsView.xaml.cs +++ b/Daybreak/Views/Launch/LaunchConfigurationsView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.LaunchConfigurations; -using Daybreak.Services.LaunchConfigurations; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.LaunchConfigurations; +using Daybreak.Shared.Services.LaunchConfigurations; +using Daybreak.Shared.Services.Navigation; using System; using System.Collections.ObjectModel; using System.Core.Extensions; diff --git a/Daybreak/Views/LauncherView.xaml b/Daybreak/Views/LauncherView.xaml index 19ec854d..609d8128 100644 --- a/Daybreak/Views/LauncherView.xaml +++ b/Daybreak/Views/LauncherView.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Views" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:effects="clr-namespace:System.Windows.Media.Extensions.Effects;assembly=WpfExtended" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:templates="clr-namespace:Daybreak.Controls.Templates" xmlns:controls="clr-namespace:Daybreak.Controls" diff --git a/Daybreak/Views/LauncherView.xaml.cs b/Daybreak/Views/LauncherView.xaml.cs index 540a5e1b..ebad91e3 100644 --- a/Daybreak/Views/LauncherView.xaml.cs +++ b/Daybreak/Views/LauncherView.xaml.cs @@ -1,15 +1,15 @@ using Daybreak.Configuration.Options; -using Daybreak.Models; -using Daybreak.Models.LaunchConfigurations; -using Daybreak.Models.Onboarding; -using Daybreak.Services.ApplicationLauncher; -using Daybreak.Services.InternetChecker; -using Daybreak.Services.LaunchConfigurations; -using Daybreak.Services.Menu; -using Daybreak.Services.Navigation; -using Daybreak.Services.Onboarding; -using Daybreak.Services.Scanner; -using Daybreak.Services.Screens; +using Daybreak.Shared.Models; +using Daybreak.Shared.Models.LaunchConfigurations; +using Daybreak.Shared.Models.Onboarding; +using Daybreak.Shared.Services.ApplicationLauncher; +using Daybreak.Shared.Services.InternetChecker; +using Daybreak.Shared.Services.LaunchConfigurations; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Onboarding; +using Daybreak.Shared.Services.Scanner; +using Daybreak.Shared.Services.Screens; using System; using System.Collections.ObjectModel; using System.Configuration; diff --git a/Daybreak/Views/LogsView.xaml b/Daybreak/Views/LogsView.xaml index f190184a..1be12a57 100644 --- a/Daybreak/Views/LogsView.xaml +++ b/Daybreak/Views/LogsView.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:avalon="http://icsharpcode.net/sharpdevelop/avalonedit" Loaded="LogsView_Loaded" diff --git a/Daybreak/Views/LogsView.xaml.cs b/Daybreak/Views/LogsView.xaml.cs index 6ee5fd9c..c881efea 100644 --- a/Daybreak/Views/LogsView.xaml.cs +++ b/Daybreak/Views/LogsView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Models; -using Daybreak.Services.Logging; +using Daybreak.Shared.Models; +using Daybreak.Shared.Services.Logging; using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.AvalonEdit.Search; using Microsoft.Extensions.Logging; @@ -47,7 +47,6 @@ public partial class LogsView : UserControl this.simpleGreenHighlightingBrush = new SimpleHighlightingBrush(ColorPalette.Green); this.TextEditor.TextArea.TextView.LineTransformers.Add(new RichTextColorizer(this.richTextModel)); SearchPanel.Install(this.TextEditor); - this.UpdateLogs(); } private async void LogManager_ReceivedLog(object? _, Log e) @@ -57,9 +56,9 @@ public partial class LogsView : UserControl private async void UpdateLogs() { - var logs = this.logManager.GetLogs().ToList(); this.TextEditor.Clear(); this.cachedText.Clear(); + var logs = this.logManager.GetLogs().ToList(); if (logs.Count > MaximumLookbackPeriod) { var maximumLookbackPeriodMessage = string.Format(MaximumLookbackMessageTemplate, MaximumLookbackPeriod); @@ -79,6 +78,11 @@ public partial class LogsView : UserControl await this.semaphoreSlim.WaitAsync(); foreach (var log in logs) { + if (log is null) + { + continue; + } + var logTimeComponent = $"[{log.LogTime}]\t"; this.TextEditor.Document.Insert(this.cachedText.Length, logTimeComponent); this.cachedText.Append(logTimeComponent); diff --git a/Daybreak/Views/MetricsView.xaml.cs b/Daybreak/Views/MetricsView.xaml.cs index 30a04b95..58e82eb1 100644 --- a/Daybreak/Views/MetricsView.xaml.cs +++ b/Daybreak/Views/MetricsView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Models.Metrics; -using Daybreak.Services.Metrics; +using Daybreak.Shared.Models.Metrics; +using Daybreak.Shared.Services.Metrics; using LiveChartsCore; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Painting; diff --git a/Daybreak/Views/NotificationsView.xaml b/Daybreak/Views/NotificationsView.xaml index 9d99b7c5..dcdd1be3 100644 --- a/Daybreak/Views/NotificationsView.xaml +++ b/Daybreak/Views/NotificationsView.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Views" xmlns:notifications="clr-namespace:Daybreak.Controls.Notifications" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" diff --git a/Daybreak/Views/NotificationsView.xaml.cs b/Daybreak/Views/NotificationsView.xaml.cs index 5beb2276..8c20d25b 100644 --- a/Daybreak/Views/NotificationsView.xaml.cs +++ b/Daybreak/Views/NotificationsView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Models.Notifications; -using Daybreak.Services.Notifications; +using Daybreak.Shared.Models.Notifications; +using Daybreak.Shared.Services.Notifications; using Microsoft.Extensions.Logging; using System; using System.Collections.ObjectModel; @@ -58,8 +58,8 @@ public partial class NotificationsView : UserControl while (!cancellationToken.IsCancellationRequested) { var unsortedNotifications = this.ShowAll ? - this.notificationProducer.GetAllNotifications().ToList() : - this.notificationProducer.GetPendingNotifications().ToList(); + (await this.notificationProducer.GetAllNotifications(cancellationToken)).ToList() : + (await this.notificationProducer.GetPendingNotifications(cancellationToken)).ToList(); var notifications = this.Descending ? unsortedNotifications.OrderByDescending(n => n.CreationTime).Take(100).ToList() : unsortedNotifications.OrderBy(n => n.CreationTime).Take(100).ToList(); @@ -96,15 +96,15 @@ public partial class NotificationsView : UserControl e.Closed = true; } - private void NotificationTemplate_RemoveClicked(object _, Notification e) + private async void NotificationTemplate_RemoveClicked(object _, Notification e) { - this.notificationProducer.RemoveNotification(e); + await this.notificationProducer.RemoveNotification(e, CancellationToken.None); this.Notifications.Remove(e); } - private void HighlightButton_Clicked(object sender, EventArgs e) + private async void HighlightButton_Clicked(object sender, EventArgs e) { - this.notificationProducer.RemoveAllNotifications(); + await this.notificationProducer.RemoveAllNotifications(CancellationToken.None); this.Notifications.Clear(); } @@ -124,8 +124,8 @@ public partial class NotificationsView : UserControl { using var context = await this.semaphoreSlim.Acquire(); var unsortedNotifications = this.ShowAll ? - this.notificationProducer.GetAllNotifications() : - this.notificationProducer.GetPendingNotifications(); + (await this.notificationProducer.GetAllNotifications(CancellationToken.None)) : + (await this.notificationProducer.GetPendingNotifications(CancellationToken.None)); var sortedNotification = this.Descending ? unsortedNotifications.OrderByDescending(n => n.CreationTime).ToList() : unsortedNotifications.OrderBy(n => n.CreationTime).ToList(); diff --git a/Daybreak/Views/Onboarding/DSOAL/DSOALBrowserView.xaml b/Daybreak/Views/Onboarding/DSOAL/DSOALBrowserView.xaml index 2046b188..85e976d1 100644 --- a/Daybreak/Views/Onboarding/DSOAL/DSOALBrowserView.xaml +++ b/Daybreak/Views/Onboarding/DSOAL/DSOALBrowserView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views.Onboarding.DSOAL" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" x:Name="_this" mc:Ignorable="d" diff --git a/Daybreak/Views/Onboarding/DSOAL/DSOALHomepageView.xaml b/Daybreak/Views/Onboarding/DSOAL/DSOALHomepageView.xaml index 1d34ee9a..4b042f8c 100644 --- a/Daybreak/Views/Onboarding/DSOAL/DSOALHomepageView.xaml +++ b/Daybreak/Views/Onboarding/DSOAL/DSOALHomepageView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views.Onboarding.DSOAL" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Views/Onboarding/DSOAL/DSOALInstallingView.xaml b/Daybreak/Views/Onboarding/DSOAL/DSOALInstallingView.xaml index 1539f34b..b6717f95 100644 --- a/Daybreak/Views/Onboarding/DSOAL/DSOALInstallingView.xaml +++ b/Daybreak/Views/Onboarding/DSOAL/DSOALInstallingView.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" x:Name="_this" diff --git a/Daybreak/Views/Onboarding/DSOAL/DSOALInstallingView.xaml.cs b/Daybreak/Views/Onboarding/DSOAL/DSOALInstallingView.xaml.cs index add712dd..c90d9f31 100644 --- a/Daybreak/Views/Onboarding/DSOAL/DSOALInstallingView.xaml.cs +++ b/Daybreak/Views/Onboarding/DSOAL/DSOALInstallingView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.DSOAL; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.DSOAL; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Extensions; diff --git a/Daybreak/Views/Onboarding/DSOAL/DSOALOnboardingEntryView.xaml.cs b/Daybreak/Views/Onboarding/DSOAL/DSOALOnboardingEntryView.xaml.cs index 08524e85..4229c7f0 100644 --- a/Daybreak/Views/Onboarding/DSOAL/DSOALOnboardingEntryView.xaml.cs +++ b/Daybreak/Views/Onboarding/DSOAL/DSOALOnboardingEntryView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.DSOAL; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Services.DSOAL; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Windows; diff --git a/Daybreak/Views/Onboarding/DSOAL/DSOALSwitchView.xaml b/Daybreak/Views/Onboarding/DSOAL/DSOALSwitchView.xaml index f77d5b55..e8b99231 100644 --- a/Daybreak/Views/Onboarding/DSOAL/DSOALSwitchView.xaml +++ b/Daybreak/Views/Onboarding/DSOAL/DSOALSwitchView.xaml @@ -4,9 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views.Onboarding.DSOAL" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" - xmlns:converters="clr-namespace:Daybreak.Converters" x:Name="_this" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Views/Onboarding/DSOAL/DSOALSwitchView.xaml.cs b/Daybreak/Views/Onboarding/DSOAL/DSOALSwitchView.xaml.cs index c97d7455..6b19f861 100644 --- a/Daybreak/Views/Onboarding/DSOAL/DSOALSwitchView.xaml.cs +++ b/Daybreak/Views/Onboarding/DSOAL/DSOALSwitchView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.DSOAL; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Services.DSOAL; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Windows.Controls; diff --git a/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationChoiceView.xaml b/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationChoiceView.xaml index c499311e..1c00f13b 100644 --- a/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationChoiceView.xaml +++ b/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationChoiceView.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Views.Onboarding.DirectSong" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" Loaded="UserControl_Loaded" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationChoiceView.xaml.cs b/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationChoiceView.xaml.cs index 8fe82632..996a19c3 100644 --- a/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationChoiceView.xaml.cs +++ b/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationChoiceView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.DirectSong; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Services.DirectSong; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Windows.Controls; diff --git a/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationView.xaml b/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationView.xaml index adc85ce8..bc2e4012 100644 --- a/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationView.xaml +++ b/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationView.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" x:Name="_this" diff --git a/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationView.xaml.cs b/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationView.xaml.cs index ed90ca8c..7ced28c4 100644 --- a/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationView.xaml.cs +++ b/Daybreak/Views/Onboarding/DirectSong/DirectSongInstallationView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.DirectSong; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.DirectSong; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System; using System.Core.Extensions; diff --git a/Daybreak/Views/Onboarding/DirectSong/DirectSongOnboardingEntryView.xaml.cs b/Daybreak/Views/Onboarding/DirectSong/DirectSongOnboardingEntryView.xaml.cs index 1a742b6e..e15b964e 100644 --- a/Daybreak/Views/Onboarding/DirectSong/DirectSongOnboardingEntryView.xaml.cs +++ b/Daybreak/Views/Onboarding/DirectSong/DirectSongOnboardingEntryView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.DirectSong; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Services.DirectSong; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Windows.Controls; diff --git a/Daybreak/Views/Onboarding/DirectSong/DirectSongSwitchView.xaml b/Daybreak/Views/Onboarding/DirectSong/DirectSongSwitchView.xaml index 3391cec6..500bf010 100644 --- a/Daybreak/Views/Onboarding/DirectSong/DirectSongSwitchView.xaml +++ b/Daybreak/Views/Onboarding/DirectSong/DirectSongSwitchView.xaml @@ -4,9 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views.Onboarding.DirectSong" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" - xmlns:converters="clr-namespace:Daybreak.Converters" x:Name="_this" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Views/Onboarding/DirectSong/DirectSongSwitchView.xaml.cs b/Daybreak/Views/Onboarding/DirectSong/DirectSongSwitchView.xaml.cs index 9c0fd225..10c71a2d 100644 --- a/Daybreak/Views/Onboarding/DirectSong/DirectSongSwitchView.xaml.cs +++ b/Daybreak/Views/Onboarding/DirectSong/DirectSongSwitchView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.DirectSong; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Services.DirectSong; +using Daybreak.Shared.Services.Navigation; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Windows.Controls; diff --git a/Daybreak/Views/Onboarding/LauncherOnboardingView.xaml b/Daybreak/Views/Onboarding/LauncherOnboardingView.xaml index 5333566d..041c8a93 100644 --- a/Daybreak/Views/Onboarding/LauncherOnboardingView.xaml +++ b/Daybreak/Views/Onboarding/LauncherOnboardingView.xaml @@ -4,8 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" - xmlns:models="clr-namespace:Daybreak.Models" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:models="clr-namespace:Daybreak.Shared.Models;assembly=Daybreak.Shared" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" x:Name="_this" diff --git a/Daybreak/Views/Onboarding/LauncherOnboardingView.xaml.cs b/Daybreak/Views/Onboarding/LauncherOnboardingView.xaml.cs index d063e719..330cc320 100644 --- a/Daybreak/Views/Onboarding/LauncherOnboardingView.xaml.cs +++ b/Daybreak/Views/Onboarding/LauncherOnboardingView.xaml.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Onboarding; -using Daybreak.Services.LaunchConfigurations; -using Daybreak.Services.Menu; -using Daybreak.Services.Navigation; +using Daybreak.Shared.Models.Onboarding; +using Daybreak.Shared.Services.LaunchConfigurations; +using Daybreak.Shared.Services.Menu; +using Daybreak.Shared.Services.Navigation; using Daybreak.Views.Launch; using Microsoft.Extensions.Logging; using System; diff --git a/Daybreak/Views/Onboarding/ReShade/ReShadeBrowserView.xaml b/Daybreak/Views/Onboarding/ReShade/ReShadeBrowserView.xaml index fa70dec1..094ea029 100644 --- a/Daybreak/Views/Onboarding/ReShade/ReShadeBrowserView.xaml +++ b/Daybreak/Views/Onboarding/ReShade/ReShadeBrowserView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views.Onboarding.ReShade" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" x:Name="_this" mc:Ignorable="d" diff --git a/Daybreak/Views/Onboarding/ReShade/ReShadeBrowserView.xaml.cs b/Daybreak/Views/Onboarding/ReShade/ReShadeBrowserView.xaml.cs index 7824ef23..842382f2 100644 --- a/Daybreak/Views/Onboarding/ReShade/ReShadeBrowserView.xaml.cs +++ b/Daybreak/Views/Onboarding/ReShade/ReShadeBrowserView.xaml.cs @@ -1,5 +1,6 @@ -using Daybreak.Services.Notifications; -using Daybreak.Services.UMod; +using Daybreak.Shared.Models.Browser; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.UMod; using Daybreak.Utils; using System; using System.Core.Extensions; @@ -31,7 +32,7 @@ public partial class ReShadeBrowserView : UserControl this.InitializeComponent(); } - private async void ChromiumBrowserWrapper_DownloadingFile(object? _, Models.Browser.DownloadPayload e) + private async void ChromiumBrowserWrapper_DownloadingFile(object? _, DownloadPayload e) { /* * According to https://wiki.guildwars.com/wiki/Player-made_Modifications#Shared_player_content, diff --git a/Daybreak/Views/Onboarding/ReShade/ReShadeConfigView.xaml.cs b/Daybreak/Views/Onboarding/ReShade/ReShadeConfigView.xaml.cs index 41230f05..21b41360 100644 --- a/Daybreak/Views/Onboarding/ReShade/ReShadeConfigView.xaml.cs +++ b/Daybreak/Views/Onboarding/ReShade/ReShadeConfigView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.Navigation; -using Daybreak.Services.ReShade; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.ReShade; using System.Core.Extensions; using System.Threading; using System.Windows.Controls; diff --git a/Daybreak/Views/Onboarding/ReShade/ReShadeInstallationChoiceView.xaml b/Daybreak/Views/Onboarding/ReShade/ReShadeInstallationChoiceView.xaml index a61aef36..fbd20dfb 100644 --- a/Daybreak/Views/Onboarding/ReShade/ReShadeInstallationChoiceView.xaml +++ b/Daybreak/Views/Onboarding/ReShade/ReShadeInstallationChoiceView.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Views.Onboarding.ReShade" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationChoiceView.xaml b/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationChoiceView.xaml index e1eee3c7..b8322b3f 100644 --- a/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationChoiceView.xaml +++ b/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationChoiceView.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Views.Onboarding.UMod" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" Loaded="UserControl_Loaded" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationChoiceView.xaml.cs b/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationChoiceView.xaml.cs index f4f3f86b..d0c0a10c 100644 --- a/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationChoiceView.xaml.cs +++ b/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationChoiceView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.Navigation; -using Daybreak.Services.Toolbox; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Toolbox; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Windows.Controls; diff --git a/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationView.xaml b/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationView.xaml index a4584ebb..d7452d88 100644 --- a/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationView.xaml +++ b/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationView.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" x:Name="_this" diff --git a/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationView.xaml.cs b/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationView.xaml.cs index 0393d132..ca2adf0f 100644 --- a/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationView.xaml.cs +++ b/Daybreak/Views/Onboarding/Toolbox/ToolboxInstallationView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.Navigation; -using Daybreak.Services.Toolbox; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Toolbox; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Extensions; diff --git a/Daybreak/Views/Onboarding/Toolbox/ToolboxOnboardingEntryView.xaml.cs b/Daybreak/Views/Onboarding/Toolbox/ToolboxOnboardingEntryView.xaml.cs index 99eca51c..dfbbfb1c 100644 --- a/Daybreak/Views/Onboarding/Toolbox/ToolboxOnboardingEntryView.xaml.cs +++ b/Daybreak/Views/Onboarding/Toolbox/ToolboxOnboardingEntryView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.Navigation; -using Daybreak.Services.Toolbox; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Toolbox; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Windows.Controls; diff --git a/Daybreak/Views/Onboarding/Toolbox/ToolboxSwitchView.xaml b/Daybreak/Views/Onboarding/Toolbox/ToolboxSwitchView.xaml index ba8d5875..54551287 100644 --- a/Daybreak/Views/Onboarding/Toolbox/ToolboxSwitchView.xaml +++ b/Daybreak/Views/Onboarding/Toolbox/ToolboxSwitchView.xaml @@ -4,9 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views.Onboarding.UMod" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" - xmlns:converters="clr-namespace:Daybreak.Converters" Loaded="UserControl_Loaded" x:Name="_this" mc:Ignorable="d" diff --git a/Daybreak/Views/Onboarding/Toolbox/ToolboxSwitchView.xaml.cs b/Daybreak/Views/Onboarding/Toolbox/ToolboxSwitchView.xaml.cs index a889a951..c64e7085 100644 --- a/Daybreak/Views/Onboarding/Toolbox/ToolboxSwitchView.xaml.cs +++ b/Daybreak/Views/Onboarding/Toolbox/ToolboxSwitchView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.Navigation; -using Daybreak.Services.Toolbox; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Toolbox; using Microsoft.Extensions.Logging; using System.Core.Extensions; using System.Threading; diff --git a/Daybreak/Views/Onboarding/UMod/UModBrowserView.xaml b/Daybreak/Views/Onboarding/UMod/UModBrowserView.xaml index 7bf3ee10..44d13ee5 100644 --- a/Daybreak/Views/Onboarding/UMod/UModBrowserView.xaml +++ b/Daybreak/Views/Onboarding/UMod/UModBrowserView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views.Onboarding.UMod" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" x:Name="_this" mc:Ignorable="d" diff --git a/Daybreak/Views/Onboarding/UMod/UModBrowserView.xaml.cs b/Daybreak/Views/Onboarding/UMod/UModBrowserView.xaml.cs index 630cf82e..d1865f93 100644 --- a/Daybreak/Views/Onboarding/UMod/UModBrowserView.xaml.cs +++ b/Daybreak/Views/Onboarding/UMod/UModBrowserView.xaml.cs @@ -1,5 +1,6 @@ -using Daybreak.Services.Notifications; -using Daybreak.Services.UMod; +using Daybreak.Shared.Models.Browser; +using Daybreak.Shared.Services.Notifications; +using Daybreak.Shared.Services.UMod; using Daybreak.Utils; using System; using System.Core.Extensions; @@ -31,7 +32,7 @@ public partial class UModBrowserView : UserControl this.InitializeComponent(); } - private async void ChromiumBrowserWrapper_DownloadingFile(object? _, Models.Browser.DownloadPayload e) + private async void ChromiumBrowserWrapper_DownloadingFile(object? _, DownloadPayload e) { /* * According to https://wiki.guildwars.com/wiki/Player-made_Modifications#Shared_player_content, diff --git a/Daybreak/Views/Onboarding/UMod/UModInstallationChoiceView.xaml b/Daybreak/Views/Onboarding/UMod/UModInstallationChoiceView.xaml index 92463e33..53b7ee2d 100644 --- a/Daybreak/Views/Onboarding/UMod/UModInstallationChoiceView.xaml +++ b/Daybreak/Views/Onboarding/UMod/UModInstallationChoiceView.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Daybreak.Views.Onboarding.UMod" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" d:DesignHeight="450" d:DesignWidth="800"> { - var sellQuotes = (await this.traderQuoteService.GetSellQuotes(CancellationToken.None)).OrderBy(q => q.Item!.Name).OrderBy(q => q.Item is Rune); - var buyQuotes = (await this.traderQuoteService.GetBuyQuotes(CancellationToken.None)).OrderBy(q => q.Item!.Name).OrderBy(q => q.Item is Rune); - var quotes = sellQuotes.Select(q => + var sellQuotes = await this.traderQuoteService.GetSellQuotes(CancellationToken.None); + var buyQuotes = await this.traderQuoteService.GetBuyQuotes(CancellationToken.None); + var concatQuotes = new Dictionary(); + InsertQuotes(concatQuotes, buyQuotes, false); + InsertQuotes(concatQuotes, sellQuotes, true); + var orderedQuotes = concatQuotes.Values.OrderBy(q => q.Item!.Name).OrderBy(q => q.Item is not Material).ToList(); + this.traderQuotesCache = [.. orderedQuotes]; + await this.Dispatcher.InvokeAsync(() => { - if (buyQuotes.FirstOrDefault(b => b.Item?.Id == q.Item?.Id) is TraderQuote buyQuote) - { - return new TraderQuoteModel - { - Item = q.Item, - BuyPrice = buyQuote.Price, - SellPrice = q.Price, - TimeStamp = q.Timestamp ?? buyQuote.Timestamp ?? DateTime.UtcNow - }; - } - - return new TraderQuoteModel - { - Item = q.Item, - BuyPrice = q.Price, - SellPrice = q.Price, - TimeStamp = q.Timestamp ?? DateTime.UtcNow - }; + this.TraderQuotes.ClearAnd().AddRange(this.traderQuotesCache); + this.Loading = false; }); - this.traderQuotesCache = [.. quotes]; }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Current); - await this.Dispatcher.InvokeAsync(() => - { - this.TraderQuotes.ClearAnd().AddRange(this.traderQuotesCache); - this.Loading = false; - }); } private void SearchTextBox_TextChanged(object _, string e) @@ -96,4 +79,31 @@ public partial class PriceQuotesView : UserControl this.viewManager.ShowView(item); } + + private static void InsertQuotes(Dictionary concat, IEnumerable items, bool isSellPrice) + { + foreach(var quote in items) + { + if(quote.Item is null) + { + continue; + } + + if (!concat.TryGetValue(quote.Item, out var quoteModel)) + { + quoteModel = new TraderQuoteModel { Item = quote.Item, TimeStamp = quote.Timestamp ?? DateTime.UtcNow, SellPrice = quote.Price, BuyPrice = quote.Price }; + concat[quote.Item] = quoteModel; + + } + + if (isSellPrice) + { + quoteModel.SellPrice = quote.Price; + } + else + { + quoteModel.BuyPrice = quote.Price; + } + } + } } diff --git a/Daybreak/Views/Trade/QuoteAlertSetupView.xaml b/Daybreak/Views/Trade/QuoteAlertSetupView.xaml index 779b7b4d..64d8d3ee 100644 --- a/Daybreak/Views/Trade/QuoteAlertSetupView.xaml +++ b/Daybreak/Views/Trade/QuoteAlertSetupView.xaml @@ -8,7 +8,7 @@ xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" xmlns:tradeModels="clr-namespace:Daybreak.Services.TradeChat.Models" - xmlns:converters="clr-namespace:Daybreak.Converters" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" x:Name="_this" mc:Ignorable="d" Unloaded="UserControl_Unloaded" diff --git a/Daybreak/Views/Trade/QuoteAlertSetupView.xaml.cs b/Daybreak/Views/Trade/QuoteAlertSetupView.xaml.cs index 8532f548..149a6af2 100644 --- a/Daybreak/Views/Trade/QuoteAlertSetupView.xaml.cs +++ b/Daybreak/Views/Trade/QuoteAlertSetupView.xaml.cs @@ -1,7 +1,7 @@ -using Daybreak.Models.Guildwars; -using Daybreak.Models.Trade; -using Daybreak.Services.Navigation; -using Daybreak.Services.TradeChat; +using Daybreak.Shared.Models.Guildwars; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.TradeChat; using System; using System.Collections.Generic; using System.Core.Extensions; diff --git a/Daybreak/Views/Trade/TradeAlertSetupView.xaml.cs b/Daybreak/Views/Trade/TradeAlertSetupView.xaml.cs index fb3b3d7a..6011bed5 100644 --- a/Daybreak/Views/Trade/TradeAlertSetupView.xaml.cs +++ b/Daybreak/Views/Trade/TradeAlertSetupView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Trade; -using Daybreak.Services.Navigation; -using Daybreak.Services.TradeChat; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.TradeChat; using System; using System.Core.Extensions; using System.Windows; diff --git a/Daybreak/Views/Trade/TradeAlertsChoiceView.xaml.cs b/Daybreak/Views/Trade/TradeAlertsChoiceView.xaml.cs index 4499cefe..f5fcd4c9 100644 --- a/Daybreak/Views/Trade/TradeAlertsChoiceView.xaml.cs +++ b/Daybreak/Views/Trade/TradeAlertsChoiceView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Trade; -using Daybreak.Services.Navigation; -using Daybreak.Services.TradeChat; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.TradeChat; using System; using System.Core.Extensions; using System.Windows.Controls; @@ -41,7 +41,7 @@ public partial class TradeAlertsChoiceView : UserControl { Enabled = false, Name = "New buy quote alert", - TraderQuoteType = Services.TradeChat.Models.TraderQuoteType.Buy + TraderQuoteType = TraderQuoteType.Buy }; this.tradeAlertingService.AddTradeAlert(tradeAlert); @@ -54,7 +54,7 @@ public partial class TradeAlertsChoiceView : UserControl { Enabled = false, Name = "New sell quote alert", - TraderQuoteType = Services.TradeChat.Models.TraderQuoteType.Sell + TraderQuoteType = TraderQuoteType.Sell }; this.tradeAlertingService.AddTradeAlert(tradeAlert); diff --git a/Daybreak/Views/Trade/TradeAlertsView.xaml.cs b/Daybreak/Views/Trade/TradeAlertsView.xaml.cs index c54522b3..0441c473 100644 --- a/Daybreak/Views/Trade/TradeAlertsView.xaml.cs +++ b/Daybreak/Views/Trade/TradeAlertsView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Trade; -using Daybreak.Services.Navigation; -using Daybreak.Services.TradeChat; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.TradeChat; using System; using System.Collections.ObjectModel; using System.Core.Extensions; diff --git a/Daybreak/Views/Trade/TradeNotificationView.xaml.cs b/Daybreak/Views/Trade/TradeNotificationView.xaml.cs index 8cb7af9b..1212097b 100644 --- a/Daybreak/Views/Trade/TradeNotificationView.xaml.cs +++ b/Daybreak/Views/Trade/TradeNotificationView.xaml.cs @@ -1,5 +1,6 @@ -using Daybreak.Services.Navigation; -using Daybreak.Services.Notifications; +using Daybreak.Shared.Models.Trade; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Notifications; using System; using System.Core.Extensions; using System.Windows; @@ -24,19 +25,19 @@ public partial class TradeNotificationView : UserControl this.InitializeComponent(); } - private void TradeChatMessageTemplate_NameCopyClicked(object _, Models.Trade.TraderMessage e) + private void TradeChatMessageTemplate_NameCopyClicked(object _, TraderMessage e) { this.notificationService.NotifyInformation("Copied", "Name copied to clipboard"); Clipboard.SetText(e.Sender); } - private void TradeChatMessageTemplate_MessageCopyClicked(object _, Models.Trade.TraderMessage e) + private void TradeChatMessageTemplate_MessageCopyClicked(object _, TraderMessage e) { this.notificationService.NotifyInformation("Copied", "Message copied to clipboard"); Clipboard.SetText(e.Message); } - private void TradeChatMessageTemplate_TimestampCopyClicked(object _, Models.Trade.TraderMessage e) + private void TradeChatMessageTemplate_TimestampCopyClicked(object _, TraderMessage e) { this.notificationService.NotifyInformation("Copied", "Timestamp copied to clipboard"); Clipboard.SetText(e.Timestamp.ToString()); diff --git a/Daybreak/Views/UpdateConfirmationView.xaml.cs b/Daybreak/Views/UpdateConfirmationView.xaml.cs index 32fd584d..163b8514 100644 --- a/Daybreak/Views/UpdateConfirmationView.xaml.cs +++ b/Daybreak/Views/UpdateConfirmationView.xaml.cs @@ -1,6 +1,6 @@ -using Daybreak.Models.Versioning; -using Daybreak.Services.Navigation; -using Daybreak.Services.Updater; +using Daybreak.Shared.Models.Versioning; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Updater; using System.Core.Extensions; using System.Windows; using System.Windows.Controls; diff --git a/Daybreak/Views/UpdateView.xaml b/Daybreak/Views/UpdateView.xaml index 82c9b352..2ca4a0ca 100644 --- a/Daybreak/Views/UpdateView.xaml +++ b/Daybreak/Views/UpdateView.xaml @@ -5,10 +5,9 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" - xmlns:converters="clr-namespace:Daybreak.Converters" mc:Ignorable="d" x:Name="_this" - xmlns:controls="clr-namespace:Daybreak.Controls" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" Loaded="UpdateView_Loaded" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/Daybreak/Views/UpdateView.xaml.cs b/Daybreak/Views/UpdateView.xaml.cs index 5e67e090..6c8a114d 100644 --- a/Daybreak/Views/UpdateView.xaml.cs +++ b/Daybreak/Views/UpdateView.xaml.cs @@ -1,13 +1,13 @@ -using Daybreak.Models.Progress; -using Daybreak.Services.Navigation; -using Daybreak.Services.Updater; +using Daybreak.Shared.Models.Progress; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Updater; using Microsoft.Extensions.Logging; using System; using System.Core.Extensions; using System.Windows; using System.Windows.Controls; using System.Windows.Extensions; -using Version = Daybreak.Models.Versioning.Version; +using Version = Daybreak.Shared.Models.Versioning.Version; namespace Daybreak.Views; diff --git a/Daybreak/Views/VersionManagementView.xaml b/Daybreak/Views/VersionManagementView.xaml index 89e31a11..bd1c5118 100644 --- a/Daybreak/Views/VersionManagementView.xaml +++ b/Daybreak/Views/VersionManagementView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Daybreak.Views" + xmlns:converters="clr-namespace:Daybreak.Shared.Converters;assembly=Daybreak.Shared" xmlns:controls="clr-namespace:Daybreak.Controls" xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons" mc:Ignorable="d" diff --git a/Daybreak/Views/VersionManagementView.xaml.cs b/Daybreak/Views/VersionManagementView.xaml.cs index dea5b359..797c93e6 100644 --- a/Daybreak/Views/VersionManagementView.xaml.cs +++ b/Daybreak/Views/VersionManagementView.xaml.cs @@ -1,5 +1,5 @@ -using Daybreak.Services.Navigation; -using Daybreak.Services.Updater; +using Daybreak.Shared.Services.Navigation; +using Daybreak.Shared.Services.Updater; using System; using System.Collections.ObjectModel; using System.Diagnostics; @@ -7,7 +7,7 @@ using System.Extensions; using System.Linq; using System.Windows.Controls; using System.Windows.Extensions; -using Version = Daybreak.Models.Versioning.Version; +using Version = Daybreak.Shared.Models.Versioning.Version; namespace Daybreak.Views;