From f1c5ad4002ab0a673c7881dcc9c5d1f44f311ddc Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 13 Feb 2023 22:02:58 -0600 Subject: [PATCH] Major refactor and reorganization of types (#652) * Start of reorganization and cleanup * Remove duplicate title id * Refactor types * Fix Release building * Move classes in /Types to a Types namespace * Fix compilation error (RoomVisualizerPage strikes again) * Fix bugs created from auto merge * Fix auto-merge compilation error * Changes from review/fix failed merge --- .../ApiEndpointController.cs | 6 +- .../Controllers/SlotEndpoints.cs | 3 +- .../Controllers/StatisticsEndpoints.cs | 2 +- .../Controllers/UserEndpoints.cs | 9 +- ProjectLighthouse.Servers.API/Program.cs | 2 +- .../Responses/MinimalSlot.cs | 5 +- .../{ => Startup}/SwaggerFilter.cs | 2 +- .../ClientConfigurationController.cs | 7 +- .../Controllers/CommentController.cs | 9 +- .../Controllers/FriendsController.cs | 10 +- .../Controllers/LoginController.cs | 7 +- .../Controllers/LogoutController.cs | 5 +- .../Matching/EnterLevelController.cs | 6 +- .../Controllers/Matching/MatchController.cs | 11 +- .../Controllers/MessageController.cs | 5 +- .../Controllers/ReportController.cs | 8 +- .../Controllers/Resources/PhotosController.cs | 10 +- .../Resources/ResourcesController.cs | 6 +- .../Controllers/Slots/CollectionController.cs | 10 +- .../Controllers/Slots/LevelTagsController.cs | 7 +- .../Controllers/Slots/ListController.cs | 9 +- .../Controllers/Slots/PublishController.cs | 18 +- .../Controllers/Slots/ReviewController.cs | 10 +- .../Controllers/Slots/ScoreController.cs | 8 +- .../Controllers/Slots/SearchController.cs | 5 +- .../Controllers/Slots/SlotsController.cs | 11 +- .../Controllers/StatisticsController.cs | 1 - .../Controllers/UserController.cs | 12 +- .../Middlewares/SetLastContactMiddleware.cs | 4 +- .../Program.cs | 2 +- .../Startup/GameServerStartup.cs | 3 +- .../Startup/TokenAuthHandler.cs | 2 +- .../Types}/Categories/CategoryHelper.cs | 5 +- .../Types}/Categories/CategoryWithUser.cs | 8 +- .../Types}/Categories/CustomCategory.cs | 8 +- .../Types}/Categories/HeartedCategory.cs | 11 +- .../Types}/Categories/HighestRatedCategory.cs | 9 +- .../Types}/Categories/LuckyDipCategory.cs | 9 +- .../Types}/Categories/MostHeartedCategory.cs | 9 +- .../Types}/Categories/MostPlayedCategory.cs | 9 +- .../Types}/Categories/NewestLevelsCategory.cs | 9 +- .../Types}/Categories/QueueCategory.cs | 11 +- .../Types}/Categories/TeamPicksCategory.cs | 12 +- .../Types/Misc/ResourceList.cs | 16 + .../Types/User}/ClientsConnected.cs | 2 +- .../Types/User/NPData.cs | 21 + .../Types/User/Pins.cs | 15 + .../Types/User}/PrivacySettings.cs | 2 +- .../Types/User}/UserUpdate.cs | 24 +- .../Admin/AdminReportController.cs | 13 +- .../Controllers/Admin/AdminUserController.cs | 6 +- .../Debug/RoomVisualizerController.cs | 5 +- .../ExternalAuth/AuthenticationController.cs | 4 +- .../Moderator/ModerationCaseController.cs | 3 +- .../Moderator/ModerationRemovalController.cs | 10 +- .../Moderator/ModerationSlotController.cs | 4 +- .../Controllers/ResourcesController.cs | 1 + .../Controllers/SlotPageController.cs | 9 +- .../Controllers/UserPageController.cs | 6 +- .../Extensions/PartialExtensions.cs | 5 +- .../UserRequiredRedirectMiddleware.cs | 4 +- ...IKeyPage.cshtml => AdminApiKeyPage.cshtml} | 9 +- ...ge.cshtml.cs => AdminApiKeyPage.cshtml.cs} | 25 +- .../Pages/Admin/AdminPanelPage.cshtml | 7 +- .../Pages/Admin/AdminPanelPage.cshtml.cs | 10 +- .../Pages/Admin/AdminPanelUsersPage.cshtml | 4 +- .../Pages/Admin/AdminPanelUsersPage.cshtml.cs | 3 +- .../Admin/AdminSetGrantedSlotsPage.cshtml.cs | 3 +- .../Pages/Debug/FilterTestPage.cshtml.cs | 9 +- .../Pages/Debug/RoomVisualizerPage.cshtml | 7 +- .../Pages/Debug/RoomVisualizerPage.cshtml.cs | 3 +- .../Pages/Debug/VersionInfoPage.cshtml.cs | 3 +- .../CompleteEmailVerificationPage.cshtml.cs | 5 +- .../Email/SendVerificationEmailPage.cshtml.cs | 2 +- .../Pages/Email/SetEmailForm.cshtml.cs | 4 +- .../ExternalAuth/AuthenticationPage.cshtml | 2 +- .../ExternalAuth/AuthenticationPage.cshtml.cs | 2 +- .../Pages/LandingPage.cshtml | 4 +- .../Pages/LandingPage.cshtml.cs | 5 +- .../Pages/Layouts/BaseLayout.cshtml | 2 +- .../Pages/Layouts/BaseLayout.cshtml.cs | 4 +- .../Pages/Login/LoginForm.cshtml.cs | 5 +- .../Pages/Login/LogoutPage.cshtml.cs | 2 +- .../Pages/Login/PasswordResetPage.cshtml.cs | 2 +- .../Login/PasswordResetRequestForm.cshtml.cs | 4 +- .../Login/PasswordResetRequiredPage.cshtml.cs | 2 +- .../Pages/Login/PirateSignupPage.cshtml.cs | 2 +- .../Pages/Login/RegisterForm.cshtml.cs | 4 +- .../Pages/Moderation/BannedUsersPage.cshtml | 2 +- .../Moderation/BannedUsersPage.cshtml.cs | 5 +- .../Pages/Moderation/CasePage.cshtml | 2 +- .../Pages/Moderation/CasePage.cshtml.cs | 4 +- .../Pages/Moderation/HiddenLevelsPage.cshtml | 2 +- .../Moderation/HiddenLevelsPage.cshtml.cs | 5 +- .../Pages/Moderation/ModPanelPage.cshtml | 1 + .../Pages/Moderation/ModPanelPage.cshtml.cs | 4 +- .../Pages/Moderation/NewCasePage.cshtml.cs | 5 +- .../Pages/Moderation/ReportPage.cshtml.cs | 5 +- .../Pages/Moderation/ReportsPage.cshtml | 2 +- .../Pages/Moderation/ReportsPage.cshtml.cs | 5 +- .../AdminPanelStatisticPartial.cshtml | 2 +- .../AdminSetGrantedSlotsFormPartial.cshtml | 2 +- .../Pages/Partials/CaptchaPartial.cshtml | 1 + .../Pages/Partials/CommentsPartial.cshtml | 2 +- .../Pages/Partials/LeaderboardPartial.cshtml | 4 +- .../Partials/Links/UserLinkPartial.cshtml | 2 +- .../Partials/ModerationCasePartial.cshtml | 8 +- .../Pages/Partials/PhotoPartial.cshtml | 6 +- .../Pages/Partials/ReportPartial.cshtml | 4 +- .../Pages/Partials/ReviewPartial.cshtml | 3 +- .../Pages/Partials/SlotCardPartial.cshtml | 6 +- .../Pages/Partials/UserCardPartial.cshtml | 3 +- .../Pages/PhotosPage.cshtml | 2 +- .../Pages/PhotosPage.cshtml.cs | 3 +- .../Pages/SlotPage.cshtml | 5 +- .../Pages/SlotPage.cshtml.cs | 10 +- .../Pages/SlotSettingsPage.cshtml | 4 +- .../Pages/SlotSettingsPage.cshtml.cs | 2 +- .../Pages/SlotsPage.cshtml | 2 +- .../Pages/SlotsPage.cshtml.cs | 6 +- .../TwoFactor/DisableTwoFactorPage.cshtml.cs | 2 +- .../TwoFactor/SetupTwoFactorPage.cshtml.cs | 4 +- .../TwoFactor/TwoFactorLoginPage.cshtml.cs | 4 +- .../Pages/UserPage.cshtml | 6 +- .../Pages/UserPage.cshtml.cs | 9 +- .../Pages/UserSettingsPage.cshtml.cs | 2 +- .../Pages/UsersPage.cshtml | 2 +- .../Pages/UsersPage.cshtml.cs | 5 +- ProjectLighthouse.Servers.Website/Program.cs | 2 +- .../Types}/AdminPanelStatistic.cs | 2 +- .../Types/PageNavigationItem.cs | 7 +- .../Tests/AuthenticationTests.cs | 2 +- .../Tests/DatabaseTests.cs | 2 +- .../Tests/LoginTests.cs | 4 +- .../Tests/MatchTests.cs | 3 +- .../Tests/SlotTests.cs | 7 +- .../Tests/UploadTests.cs | 2 +- .../Tests/AdminTests.cs | 6 +- .../Tests/AuthenticationTests.cs | 4 +- .../Tests/RegisterTests.cs | 2 +- .../LighthouseServerTest.cs | 4 +- .../Tests/FileTypeTests.cs | 5 +- .../Tests/ResourceTests.cs | 1 + ProjectLighthouse/Administration/DeletedBy.cs | 17 - .../Commands/CreateAPIKeyCommand.cs | 6 +- .../Maintenance/Commands/CreateUserCommand.cs | 4 +- .../Maintenance/Commands/DeleteUserCommand.cs | 4 +- .../Maintenance/Commands/FlushRedisCommand.cs | 1 + .../Maintenance/Commands/RenameUserCommand.cs | 4 +- .../Commands/ResetPasswordCommand.cs | 4 +- .../Commands/TestWebhookCommand.cs | 1 + .../Commands/WipeTokensForUserCommand.cs | 3 +- .../Maintenance/MaintenanceHelper.cs | 7 +- .../CleanupBrokenPhotosMaintenanceJob.cs | 4 +- .../CleanupUnusedLocationsMaintenanceJob.cs | 3 +- .../CleanupUnusedPhotoSubjects.cs | 3 +- .../DeleteAllTokensMaintenanceJob.cs | 1 + .../CleanupBrokenVersusScoresMigration.cs | 3 +- .../CleanupDuplicateScoresMigration.cs | 4 +- .../CleanupSlotVersionMismatchMigration.cs | 6 +- .../CleanupXMLInjectionMigration.cs | 1 + .../RepeatingTasks/CleanupRoomsTask.cs | 3 +- .../RepeatingTasks/PerformCaseActionsTask.cs | 9 +- .../RepeatingTasks/RemoveExpiredTokensTask.cs | 1 + .../Administration/RepeatingTaskHandler.cs | 2 + .../Configuration/CaptchaType.cs | 16 - .../Configuration/CensorConfiguration.cs | 15 +- .../Configuration/ConfigurationBase.cs | 1 + .../AuthenticationConfiguration.cs | 2 - .../CaptchaConfiguration.cs | 16 + .../RateLimitConfiguration.cs | 7 + .../TwoFactorConfiguration.cs | 2 +- .../Configuration/RateLimitOptions.cs | 8 - .../Configuration/ServerStatics.cs | 5 +- ProjectLighthouse/Database.cs | 95 +++-- .../Extensions/AspLogLevelExtensions.cs | 22 -- .../Extensions/ControllerExtensions.cs | 7 +- .../Extensions/DatabaseExtensions.cs | 6 +- .../Extensions/LogLevelExtensions.cs | 18 - .../Extensions/LogLineListExtensions.cs | 13 - .../Extensions/LoggingExtensions.cs | 40 ++ .../Extensions/RedisCollectionExtensions.cs | 11 - .../Extensions/RedisConnectionExtensions.cs | 2 +- .../Extensions/RequestExtensions.cs | 39 +- .../Extensions/RoomExtensions.cs | 5 +- ProjectLighthouse/Files/FileHelper.cs | 371 +----------------- ProjectLighthouse/Files/LbpFileParser.cs | 197 ++++++++++ ProjectLighthouse/Files/LbpImageHelper.cs | 200 ++++++++++ ProjectLighthouse/Files/ResourceDescriptor.cs | 11 - ProjectLighthouse/Helpers/CensorHelper.cs | 1 - ProjectLighthouse/Helpers/EmailHelper.cs | 4 +- ProjectLighthouse/Helpers/LabelHelper.cs | 10 +- .../LastContactHelper.cs | 8 +- ProjectLighthouse/Helpers/MatchHelper.cs | 8 +- .../{Match/Rooms => Helpers}/RoomHelper.cs | 12 +- ProjectLighthouse/Helpers/SMTPHelper.cs | 1 + ProjectLighthouse/Helpers/SlotHelper.cs | 8 +- ProjectLighthouse/Helpers/StatisticsHelper.cs | 7 +- ProjectLighthouse/Helpers/TimeHelper.cs | 7 +- ProjectLighthouse/Helpers/VersionHelper.cs | 1 + ProjectLighthouse/Helpers/WebhookHelper.cs | 8 +- ProjectLighthouse/Logging/Logger.cs | 1 + .../AspNet/AspNetToLighthouseLogger.cs | 3 +- .../Logging/Loggers/ConsoleLogger.cs | 1 + .../Logging/Loggers/FileLogger.cs | 1 + .../Logging/Loggers/InMemoryLogger.cs | 1 + .../Match/MatchCommands/IMatchCommand.cs | 4 - .../Middlewares/RateLimitMiddleware.cs | 2 + .../Middlewares/RequestLogMiddleware.cs | 1 + .../20211028015915_AddSlotTimestamp.cs | 2 +- ...1513_AddSlotFirstUploadedAndLastUpdated.cs | 2 +- .../20211103194917_RemoveStartupMigrations.cs | 2 +- ProjectLighthouse/PlayerData/APIKey.cs | 19 - ProjectLighthouse/PlayerData/GameVersion.cs | 16 - ProjectLighthouse/PlayerData/PhotoSlot.cs | 20 - .../PlayerData/Profiles/NPData.cs | 17 - ProjectLighthouse/PlayerData/Profiles/Pins.cs | 15 - .../PlayerData/Profiles/StatusType.cs | 7 - .../PlayerData/Profiles/UserUpdateSlot.cs | 20 - .../PlayerData/RegistrationToken.cs | 18 - .../Startup/DebugWarmupLifetime.cs | 3 +- ProjectLighthouse/StartupTasks.cs | 8 +- .../StorableLists/RedisDatabase.cs | 5 +- .../StorableLists/Stores/RoomStore.cs | 2 +- .../StorableLists/Stores/UserFriendStore.cs | 2 +- ProjectLighthouse/Tickets/Data/DataHeader.cs | 7 - ProjectLighthouse/Tickets/Data/DataType.cs | 11 - .../Tickets/Data/SectionHeader.cs | 7 - ProjectLighthouse/Tickets/Data/SectionType.cs | 7 - ProjectLighthouse/Tickets/NPTicket.cs | 31 +- ProjectLighthouse/Tickets/TicketBuilder.cs | 1 - ProjectLighthouse/Tickets/TicketReader.cs | 33 +- ProjectLighthouse/Tickets/TicketTypes.cs | 179 +++++++++ .../Version.cs => Tickets/TicketVersion.cs} | 8 +- ProjectLighthouse/Tickets/Types/BinaryData.cs | 23 -- ProjectLighthouse/Tickets/Types/BlobData.cs | 29 -- ProjectLighthouse/Tickets/Types/EmptyData.cs | 15 - ProjectLighthouse/Tickets/Types/StringData.cs | 29 -- ProjectLighthouse/Tickets/Types/TicketData.cs | 21 - .../Tickets/Types/TimestampData.cs | 26 -- ProjectLighthouse/Tickets/Types/UInt32Data.cs | 26 -- ProjectLighthouse/Tickets/Types/UInt64Data.cs | 26 -- ProjectLighthouse/Types/CommentType.cs | 7 - .../Entities/Interaction}/HeartedLevel.cs | 5 +- .../Entities/Interaction}/HeartedPlaylist.cs | 5 +- .../Entities/Interaction}/HeartedProfile.cs | 4 +- .../Entities/Interaction}/QueuedLevel.cs | 5 +- .../Entities/Interaction}/RatedLevel.cs | 5 +- .../Entities/Interaction}/RatedReview.cs | 5 +- .../Entities/Interaction}/Reaction.cs | 3 +- .../Entities/Interaction}/VisitedLevel.cs | 5 +- .../Entities/Level}/DatabaseCategory.cs | 2 +- .../Entities/Level}/Playlist.cs | 4 +- .../Entities/Level}/Review.cs | 21 +- .../Entities/Level}/Score.cs | 3 +- .../{Levels => Types/Entities/Level}/Slot.cs | 13 +- .../Maintenance}/CompletedMigration.cs | 4 +- .../Entities/Moderation}/GriefReport.cs | 5 +- .../Entities/Moderation}/ModerationCase.cs | 7 +- .../Entities/Profile}/BlockedProfile.cs | 3 +- .../Entities/Profile}/Comment.cs | 13 +- .../Entities/Profile}/LastContact.cs | 6 +- .../Entities/Profile}/Photo.cs | 22 +- .../Entities/Profile}/PhotoSubject.cs | 3 +- .../Entities/Profile}/PlatformLinkAttempt.cs | 4 +- .../Entities/Profile}/User.cs | 6 +- .../Types/Entities/Token/ApiKey.cs | 16 + .../Entities/Token}/EmailSetToken.cs | 4 +- .../Entities/Token}/EmailVerificationToken.cs | 4 +- .../Entities/Token}/GameToken.cs | 5 +- .../Entities/Token}/PasswordResetToken.cs | 2 +- .../Types/Entities/Token/RegistrationToken.cs | 17 + .../Entities/Token}/WebToken.cs | 2 +- ProjectLighthouse/Types/FilterMode.cs | 9 - .../Categories => Types/Levels}/Category.cs | 3 +- .../{ => Types}/Levels/LevelLabels.cs | 2 +- .../{ => Types}/Levels/LevelTags.cs | 3 +- .../{ => Types}/Levels/SlotType.cs | 2 +- .../{ => Types}/Logging/ILogger.cs | 2 +- .../{ => Types}/Logging/LogArea.cs | 2 +- .../{ => Types}/Logging/LogLevel.cs | 2 +- .../{ => Types}/Logging/LogLine.cs | 2 +- .../{ => Types}/Logging/LogTrace.cs | 2 +- .../Maintenance/ICommand.cs | 2 +- .../Maintenance/IMaintenanceJob.cs | 2 +- .../Maintenance/IMigrationTask.cs | 2 +- .../Maintenance/IRepeatingTask.cs | 2 +- .../Matchmaking}/MatchCommands/CreateRoom.cs | 6 +- .../MatchCommands/FindBestRoom.cs | 6 +- .../MatchCommands/IMatchCommand.cs | 4 + .../MatchCommands/UpdateMyPlayerData.cs | 4 +- .../MatchCommands/UpdatePlayersInRoom.cs | 2 +- .../{Match => Types/Matchmaking}/NatType.cs | 2 +- .../{Match => Types/Matchmaking}/Player.cs | 4 +- .../Rooms/FindBestRoomResponse.cs | 2 +- .../Matchmaking}/Rooms/Room.cs | 6 +- .../Matchmaking}/Rooms/RoomSlot.cs | 4 +- .../Matchmaking}/Rooms/RoomState.cs | 2 +- .../Profiles => Types/Misc}/Location.cs | 2 +- .../Types/{ => Misc}/ServerType.cs | 2 +- .../Moderation/Cases}/CaseType.cs | 2 +- .../Moderation}/Reports/GriefType.cs | 9 +- .../Moderation}/Reports/Marqee.cs | 2 +- .../Moderation}/Reports/Rectangle.cs | 2 +- .../Moderation}/Reports/ReportPlayer.cs | 2 +- .../Moderation}/Reports/VisiblePlayer.cs | 2 +- ProjectLighthouse/Types/ResourceList.cs | 11 - .../{Files => Types/Resources}/LbpFile.cs | 3 +- .../{Files => Types/Resources}/LbpFileType.cs | 2 +- .../Users/GameVersion.cs} | 57 ++- .../Users}/LoginResult.cs | 2 +- .../Users}/PermissionLevel.cs | 2 +- .../{PlayerData => Types/Users}/Platform.cs | 2 +- .../Profiles => Types/Users}/PrivacyType.cs | 6 +- .../Users}/UserFriendData.cs | 2 +- .../Profiles => Types/Users}/UserStatus.cs | 11 +- 316 files changed, 1623 insertions(+), 1518 deletions(-) rename {ProjectLighthouse => ProjectLighthouse.Servers.API}/ApiEndpointController.cs (57%) rename ProjectLighthouse.Servers.API/{ => Startup}/SwaggerFilter.cs (91%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/CategoryHelper.cs (79%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/CategoryWithUser.cs (90%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/CustomCategory.cs (86%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/HeartedCategory.cs (86%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/HighestRatedCategory.cs (83%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/LuckyDipCategory.cs (82%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/MostHeartedCategory.cs (83%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/MostPlayedCategory.cs (85%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/NewestLevelsCategory.cs (81%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/QueueCategory.cs (86%) rename {ProjectLighthouse/Levels => ProjectLighthouse.Servers.GameServer/Types}/Categories/TeamPicksCategory.cs (74%) create mode 100644 ProjectLighthouse.Servers.GameServer/Types/Misc/ResourceList.cs rename {ProjectLighthouse/PlayerData/Profiles => ProjectLighthouse.Servers.GameServer/Types/User}/ClientsConnected.cs (92%) create mode 100644 ProjectLighthouse.Servers.GameServer/Types/User/NPData.cs create mode 100644 ProjectLighthouse.Servers.GameServer/Types/User/Pins.cs rename {ProjectLighthouse/PlayerData => ProjectLighthouse.Servers.GameServer/Types/User}/PrivacySettings.cs (91%) rename {ProjectLighthouse/PlayerData/Profiles => ProjectLighthouse.Servers.GameServer/Types/User}/UserUpdate.cs (57%) rename ProjectLighthouse.Servers.Website/Pages/Admin/{AdminAPIKeyPage.cshtml => AdminApiKeyPage.cshtml} (90%) rename ProjectLighthouse.Servers.Website/Pages/Admin/{AdminAPIKeyPage.cshtml.cs => AdminApiKeyPage.cshtml.cs} (62%) rename {ProjectLighthouse/Administration => ProjectLighthouse.Servers.Website/Types}/AdminPanelStatistic.cs (90%) rename {ProjectLighthouse => ProjectLighthouse.Servers.Website}/Types/PageNavigationItem.cs (85%) delete mode 100644 ProjectLighthouse/Administration/DeletedBy.cs delete mode 100644 ProjectLighthouse/Configuration/CaptchaType.cs delete mode 100644 ProjectLighthouse/Configuration/RateLimitOptions.cs delete mode 100644 ProjectLighthouse/Extensions/AspLogLevelExtensions.cs delete mode 100644 ProjectLighthouse/Extensions/LogLevelExtensions.cs delete mode 100644 ProjectLighthouse/Extensions/LogLineListExtensions.cs create mode 100644 ProjectLighthouse/Extensions/LoggingExtensions.cs delete mode 100644 ProjectLighthouse/Extensions/RedisCollectionExtensions.cs create mode 100644 ProjectLighthouse/Files/LbpFileParser.cs create mode 100644 ProjectLighthouse/Files/LbpImageHelper.cs delete mode 100644 ProjectLighthouse/Files/ResourceDescriptor.cs rename ProjectLighthouse/{PlayerData => Helpers}/LastContactHelper.cs (74%) rename ProjectLighthouse/{Match/Rooms => Helpers}/RoomHelper.cs (96%) delete mode 100644 ProjectLighthouse/Match/MatchCommands/IMatchCommand.cs delete mode 100644 ProjectLighthouse/PlayerData/APIKey.cs delete mode 100644 ProjectLighthouse/PlayerData/GameVersion.cs delete mode 100644 ProjectLighthouse/PlayerData/PhotoSlot.cs delete mode 100644 ProjectLighthouse/PlayerData/Profiles/NPData.cs delete mode 100644 ProjectLighthouse/PlayerData/Profiles/Pins.cs delete mode 100644 ProjectLighthouse/PlayerData/Profiles/StatusType.cs delete mode 100644 ProjectLighthouse/PlayerData/Profiles/UserUpdateSlot.cs delete mode 100644 ProjectLighthouse/PlayerData/RegistrationToken.cs delete mode 100644 ProjectLighthouse/Tickets/Data/DataHeader.cs delete mode 100644 ProjectLighthouse/Tickets/Data/DataType.cs delete mode 100644 ProjectLighthouse/Tickets/Data/SectionHeader.cs delete mode 100644 ProjectLighthouse/Tickets/Data/SectionType.cs create mode 100644 ProjectLighthouse/Tickets/TicketTypes.cs rename ProjectLighthouse/{Types/Version.cs => Tickets/TicketVersion.cs} (52%) delete mode 100644 ProjectLighthouse/Tickets/Types/BinaryData.cs delete mode 100644 ProjectLighthouse/Tickets/Types/BlobData.cs delete mode 100644 ProjectLighthouse/Tickets/Types/EmptyData.cs delete mode 100644 ProjectLighthouse/Tickets/Types/StringData.cs delete mode 100644 ProjectLighthouse/Tickets/Types/TicketData.cs delete mode 100644 ProjectLighthouse/Tickets/Types/TimestampData.cs delete mode 100644 ProjectLighthouse/Tickets/Types/UInt32Data.cs delete mode 100644 ProjectLighthouse/Tickets/Types/UInt64Data.cs delete mode 100644 ProjectLighthouse/Types/CommentType.cs rename ProjectLighthouse/{Levels => Types/Entities/Interaction}/HeartedLevel.cs (71%) rename ProjectLighthouse/{Levels => Types/Entities/Interaction}/HeartedPlaylist.cs (70%) rename ProjectLighthouse/{PlayerData/Profiles => Types/Entities/Interaction}/HeartedProfile.cs (77%) rename ProjectLighthouse/{Levels => Types/Entities/Interaction}/QueuedLevel.cs (71%) rename ProjectLighthouse/{Levels => Types/Entities/Interaction}/RatedLevel.cs (76%) rename ProjectLighthouse/{PlayerData/Reviews => Types/Entities/Interaction}/RatedReview.cs (73%) rename ProjectLighthouse/{PlayerData => Types/Entities/Interaction}/Reaction.cs (67%) rename ProjectLighthouse/{Levels => Types/Entities/Interaction}/VisitedLevel.cs (76%) rename ProjectLighthouse/{Levels/Categories => Types/Entities/Level}/DatabaseCategory.cs (91%) rename ProjectLighthouse/{Levels => Types/Entities/Level}/Playlist.cs (95%) rename ProjectLighthouse/{PlayerData/Reviews => Types/Entities/Level}/Review.cs (87%) rename ProjectLighthouse/{PlayerData => Types/Entities/Level}/Score.cs (94%) rename ProjectLighthouse/{Levels => Types/Entities/Level}/Slot.cs (97%) rename ProjectLighthouse/{Administration => Types/Entities/Maintenance}/CompletedMigration.cs (82%) rename ProjectLighthouse/{Administration/Reports => Types/Entities/Moderation}/GriefReport.cs (87%) rename ProjectLighthouse/{Administration => Types/Entities/Moderation}/ModerationCase.cs (87%) rename ProjectLighthouse/{PlayerData/Profiles => Types/Entities/Profile}/BlockedProfile.cs (79%) rename ProjectLighthouse/{PlayerData/Profiles => Types/Entities/Profile}/Comment.cs (89%) rename ProjectLighthouse/{PlayerData/Profiles => Types/Entities/Profile}/LastContact.cs (70%) rename ProjectLighthouse/{PlayerData => Types/Entities/Profile}/Photo.cs (89%) rename ProjectLighthouse/{PlayerData => Types/Entities/Profile}/PhotoSubject.cs (91%) rename ProjectLighthouse/{PlayerData => Types/Entities/Profile}/PlatformLinkAttempt.cs (81%) rename ProjectLighthouse/{PlayerData/Profiles => Types/Entities/Profile}/User.cs (98%) create mode 100644 ProjectLighthouse/Types/Entities/Token/ApiKey.cs rename ProjectLighthouse/{PlayerData/Profiles/Email => Types/Entities/Token}/EmailSetToken.cs (70%) rename ProjectLighthouse/{PlayerData/Profiles/Email => Types/Entities/Token}/EmailVerificationToken.cs (71%) rename ProjectLighthouse/{PlayerData => Types/Entities/Token}/GameToken.cs (79%) rename ProjectLighthouse/{PlayerData => Types/Entities/Token}/PasswordResetToken.cs (84%) create mode 100644 ProjectLighthouse/Types/Entities/Token/RegistrationToken.cs rename ProjectLighthouse/{PlayerData => Types/Entities/Token}/WebToken.cs (85%) delete mode 100644 ProjectLighthouse/Types/FilterMode.cs rename ProjectLighthouse/{Levels/Categories => Types/Levels}/Category.cs (94%) rename ProjectLighthouse/{ => Types}/Levels/LevelLabels.cs (97%) rename ProjectLighthouse/{ => Types}/Levels/LevelTags.cs (94%) rename ProjectLighthouse/{ => Types}/Levels/SlotType.cs (85%) rename ProjectLighthouse/{ => Types}/Logging/ILogger.cs (55%) rename ProjectLighthouse/{ => Types}/Logging/LogArea.cs (88%) rename ProjectLighthouse/{ => Types}/Logging/LogLevel.cs (66%) rename ProjectLighthouse/{ => Types}/Logging/LogLine.cs (71%) rename ProjectLighthouse/{ => Types}/Logging/LogTrace.cs (65%) rename ProjectLighthouse/{Administration => Types}/Maintenance/ICommand.cs (86%) rename ProjectLighthouse/{Administration => Types}/Maintenance/IMaintenanceJob.cs (78%) rename ProjectLighthouse/{Administration => Types}/Maintenance/IMigrationTask.cs (88%) rename ProjectLighthouse/{Administration => Types}/Maintenance/IRepeatingTask.cs (78%) rename ProjectLighthouse/{Match => Types/Matchmaking}/MatchCommands/CreateRoom.cs (87%) rename ProjectLighthouse/{Match => Types/Matchmaking}/MatchCommands/FindBestRoom.cs (84%) create mode 100644 ProjectLighthouse/Types/Matchmaking/MatchCommands/IMatchCommand.cs rename ProjectLighthouse/{Match => Types/Matchmaking}/MatchCommands/UpdateMyPlayerData.cs (56%) rename ProjectLighthouse/{Match => Types/Matchmaking}/MatchCommands/UpdatePlayersInRoom.cs (80%) rename ProjectLighthouse/{Match => Types/Matchmaking}/NatType.cs (56%) rename ProjectLighthouse/{Match => Types/Matchmaking}/Player.cs (76%) rename ProjectLighthouse/{Match => Types/Matchmaking}/Rooms/FindBestRoomResponse.cs (88%) rename ProjectLighthouse/{Match => Types/Matchmaking}/Rooms/Room.cs (94%) rename ProjectLighthouse/{Match => Types/Matchmaking}/Rooms/RoomSlot.cs (67%) rename ProjectLighthouse/{Match => Types/Matchmaking}/Rooms/RoomState.cs (91%) rename ProjectLighthouse/{PlayerData/Profiles => Types/Misc}/Location.cs (89%) rename ProjectLighthouse/Types/{ => Misc}/ServerType.cs (61%) rename ProjectLighthouse/{Administration => Types/Moderation/Cases}/CaseType.cs (95%) rename ProjectLighthouse/{Administration => Types/Moderation}/Reports/GriefType.cs (83%) rename ProjectLighthouse/{Administration => Types/Moderation}/Reports/Marqee.cs (69%) rename ProjectLighthouse/{Administration => Types/Moderation}/Reports/Rectangle.cs (82%) rename ProjectLighthouse/{Administration => Types/Moderation}/Reports/ReportPlayer.cs (87%) rename ProjectLighthouse/{Administration => Types/Moderation}/Reports/VisiblePlayer.cs (85%) delete mode 100644 ProjectLighthouse/Types/ResourceList.cs rename ProjectLighthouse/{Files => Types/Resources}/LbpFile.cs (89%) rename ProjectLighthouse/{Files => Types/Resources}/LbpFileType.cs (90%) rename ProjectLighthouse/{Helpers/GameVersionHelper.cs => Types/Users/GameVersion.cs} (66%) rename ProjectLighthouse/{PlayerData => Types/Users}/LoginResult.cs (94%) rename ProjectLighthouse/{Administration => Types/Users}/PermissionLevel.cs (73%) rename ProjectLighthouse/{PlayerData => Types/Users}/Platform.cs (69%) rename ProjectLighthouse/{PlayerData/Profiles => Types/Users}/PrivacyType.cs (83%) rename ProjectLighthouse/{PlayerData/Profiles => Types/Users}/UserFriendData.cs (90%) rename ProjectLighthouse/{PlayerData/Profiles => Types/Users}/UserStatus.cs (92%) diff --git a/ProjectLighthouse/ApiEndpointController.cs b/ProjectLighthouse.Servers.API/ApiEndpointController.cs similarity index 57% rename from ProjectLighthouse/ApiEndpointController.cs rename to ProjectLighthouse.Servers.API/ApiEndpointController.cs index c42889cb..97423a50 100644 --- a/ProjectLighthouse/ApiEndpointController.cs +++ b/ProjectLighthouse.Servers.API/ApiEndpointController.cs @@ -1,9 +1,9 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; -namespace LBPUnion.ProjectLighthouse; +namespace LBPUnion.ProjectLighthouse.Servers.API; [ApiController] [Route("/api/v1")] [Produces("application/json")] public class ApiEndpointController : ControllerBase -{} \ No newline at end of file +{ } \ No newline at end of file diff --git a/ProjectLighthouse.Servers.API/Controllers/SlotEndpoints.cs b/ProjectLighthouse.Servers.API/Controllers/SlotEndpoints.cs index b3a48c21..1ccfeb34 100644 --- a/ProjectLighthouse.Servers.API/Controllers/SlotEndpoints.cs +++ b/ProjectLighthouse.Servers.API/Controllers/SlotEndpoints.cs @@ -1,8 +1,7 @@ #nullable enable using LBPUnion.ProjectLighthouse.Configuration; -using LBPUnion.ProjectLighthouse.Levels; using LBPUnion.ProjectLighthouse.Servers.API.Responses; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.API/Controllers/StatisticsEndpoints.cs b/ProjectLighthouse.Servers.API/Controllers/StatisticsEndpoints.cs index a72ab4ac..7165849e 100644 --- a/ProjectLighthouse.Servers.API/Controllers/StatisticsEndpoints.cs +++ b/ProjectLighthouse.Servers.API/Controllers/StatisticsEndpoints.cs @@ -1,6 +1,6 @@ using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.PlayerData; using LBPUnion.ProjectLighthouse.Servers.API.Responses; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Mvc; namespace LBPUnion.ProjectLighthouse.Servers.API.Controllers; diff --git a/ProjectLighthouse.Servers.API/Controllers/UserEndpoints.cs b/ProjectLighthouse.Servers.API/Controllers/UserEndpoints.cs index 4ed6439a..c9a3e278 100644 --- a/ProjectLighthouse.Servers.API/Controllers/UserEndpoints.cs +++ b/ProjectLighthouse.Servers.API/Controllers/UserEndpoints.cs @@ -1,12 +1,11 @@ #nullable enable -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; -using LBPUnion.ProjectLighthouse.PlayerData; using LBPUnion.ProjectLighthouse.Helpers; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -// ReSharper disable RouteTemplates.ActionRoutePrefixCanBeExtractedToControllerRoute - namespace LBPUnion.ProjectLighthouse.Servers.API.Controllers; /// @@ -79,7 +78,7 @@ public class UserEndpoints : ApiEndpointController string authToken = authHeader[(authHeader.IndexOf(' ') + 1)..]; - APIKey? apiKey = await this.database.APIKeys.FirstOrDefaultAsync(k => k.Key == authToken); + ApiKey? apiKey = await this.database.APIKeys.FirstOrDefaultAsync(k => k.Key == authToken); if (apiKey == null) return this.StatusCode(403, null); if (!string.IsNullOrWhiteSpace(username)) diff --git a/ProjectLighthouse.Servers.API/Program.cs b/ProjectLighthouse.Servers.API/Program.cs index f2cb06d4..e689dc98 100644 --- a/ProjectLighthouse.Servers.API/Program.cs +++ b/ProjectLighthouse.Servers.API/Program.cs @@ -1,7 +1,7 @@ using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Logging.Loggers.AspNet; using LBPUnion.ProjectLighthouse.Servers.API.Startup; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Types.Misc; using Microsoft.Extensions.DependencyInjection.Extensions; namespace LBPUnion.ProjectLighthouse.Servers.API; diff --git a/ProjectLighthouse.Servers.API/Responses/MinimalSlot.cs b/ProjectLighthouse.Servers.API/Responses/MinimalSlot.cs index 326b9265..33016135 100644 --- a/ProjectLighthouse.Servers.API/Responses/MinimalSlot.cs +++ b/ProjectLighthouse.Servers.API/Responses/MinimalSlot.cs @@ -1,6 +1,5 @@ -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Users; namespace LBPUnion.ProjectLighthouse.Servers.API.Responses; diff --git a/ProjectLighthouse.Servers.API/SwaggerFilter.cs b/ProjectLighthouse.Servers.API/Startup/SwaggerFilter.cs similarity index 91% rename from ProjectLighthouse.Servers.API/SwaggerFilter.cs rename to ProjectLighthouse.Servers.API/Startup/SwaggerFilter.cs index 1a922717..226e294e 100644 --- a/ProjectLighthouse.Servers.API/SwaggerFilter.cs +++ b/ProjectLighthouse.Servers.API/Startup/SwaggerFilter.cs @@ -1,7 +1,7 @@ using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; -namespace LBPUnion.ProjectLighthouse.Servers.API; +namespace LBPUnion.ProjectLighthouse.Servers.API.Startup; /// /// diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/ClientConfigurationController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/ClientConfigurationController.cs index 923d6fac..fac95b30 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/ClientConfigurationController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/ClientConfigurationController.cs @@ -2,11 +2,12 @@ using System.Diagnostics.CodeAnalysis; using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Servers.GameServer.Types; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/CommentController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/CommentController.cs index 36d7dc81..b6c3e676 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/CommentController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/CommentController.cs @@ -1,12 +1,11 @@ #nullable enable -using LBPUnion.ProjectLighthouse.Administration; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Serialization; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/FriendsController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/FriendsController.cs index 6a60ddb6..3ae620f3 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/FriendsController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/FriendsController.cs @@ -1,10 +1,12 @@ #nullable enable using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Servers.GameServer.Types; using LBPUnion.ProjectLighthouse.StorableLists.Stores; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -34,7 +36,7 @@ public class FriendsController : ControllerBase SanitizationHelper.SanitizeStringsInClass(npData); List friends = new(); - foreach (string friendName in npData.Friends) + foreach (string friendName in npData.Friends ?? new List()) { User? friend = await this.database.Users.FirstOrDefaultAsync(u => u.Username == friendName); if (friend == null) continue; @@ -43,7 +45,7 @@ public class FriendsController : ControllerBase } List blockedUsers = new(); - foreach (string blockedUserName in npData.BlockedUsers) + foreach (string blockedUserName in npData.BlockedUsers ?? new List()) { User? blockedUser = await this.database.Users.FirstOrDefaultAsync(u => u.Username == blockedUserName); if (blockedUser == null) continue; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs index 1fbb4dbe..ac226955 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs @@ -4,10 +4,11 @@ using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.Match.Rooms; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Tickets; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Logging; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/LogoutController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/LogoutController.cs index 3ecfcb6e..e3a9d310 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/LogoutController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/LogoutController.cs @@ -1,10 +1,9 @@ using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Matching/EnterLevelController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Matching/EnterLevelController.cs index cb57e0c5..6698c936 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Matching/EnterLevelController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Matching/EnterLevelController.cs @@ -1,8 +1,10 @@ #nullable enable using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Interaction; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Matching/MatchController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Matching/MatchController.cs index 2cb4d637..98578973 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Matching/MatchController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Matching/MatchController.cs @@ -3,11 +3,12 @@ using System.Text.Json; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.Match; -using LBPUnion.ProjectLighthouse.Match.MatchCommands; -using LBPUnion.ProjectLighthouse.Match.Rooms; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Logging; +using LBPUnion.ProjectLighthouse.Types.Matchmaking; +using LBPUnion.ProjectLighthouse.Types.Matchmaking.MatchCommands; +using LBPUnion.ProjectLighthouse.Types.Matchmaking.Rooms; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs index c6f8f1c8..8b289794 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs @@ -3,8 +3,9 @@ using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Logging; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/ReportController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/ReportController.cs index e5de5e4b..c8b56b30 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/ReportController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/ReportController.cs @@ -1,11 +1,11 @@ #nullable enable using System.Text.Json; -using LBPUnion.ProjectLighthouse.Administration.Reports; using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Moderation; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Moderation.Reports; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -38,7 +38,7 @@ public class ReportController : ControllerBase report.Bounds = JsonSerializer.Serialize(report.XmlBounds.Rect, typeof(Rectangle)); report.Players = JsonSerializer.Serialize(report.XmlPlayers, typeof(ReportPlayer[])); - report.Timestamp = TimeHelper.UnixTimeMilliseconds(); + report.Timestamp = TimeHelper.TimestampMillis; report.ReportingPlayerId = token.UserId; this.database.Reports.Add(report); diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Resources/PhotosController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Resources/PhotosController.cs index 4ef80e9d..02d9cca7 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Resources/PhotosController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Resources/PhotosController.cs @@ -4,11 +4,13 @@ using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Files; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Logging; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -52,7 +54,7 @@ public class PhotosController : ControllerBase photo.CreatorId = user.UserId; photo.Creator = user; - if (photo.XmlLevelInfo != null) + if (photo.XmlLevelInfo?.RootLevel != null) { bool validLevel = false; PhotoSlot photoSlot = photo.XmlLevelInfo; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Resources/ResourcesController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Resources/ResourcesController.cs index a0bc3a7b..446206c5 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Resources/ResourcesController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Resources/ResourcesController.cs @@ -5,7 +5,9 @@ using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Files; using LBPUnion.ProjectLighthouse.Logging; using LBPUnion.ProjectLighthouse.Serialization; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Misc; +using LBPUnion.ProjectLighthouse.Types.Logging; +using LBPUnion.ProjectLighthouse.Types.Resources; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using IOFile = System.IO.File; @@ -27,7 +29,7 @@ public class ResourcesController : ControllerBase public async Task FilterResources() { ResourceList? resourceList = await this.DeserializeBody(); - if (resourceList == null) return this.BadRequest(); + if (resourceList?.Resources == null) return this.BadRequest(); string resources = resourceList.Resources.Where (s => !FileHelper.ResourceExists(s)) diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs index bba25fd9..5096721d 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs @@ -1,12 +1,14 @@ #nullable enable using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.Levels.Categories; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Logging; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/LevelTagsController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/LevelTagsController.cs index e937ac68..40ae0d84 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/LevelTagsController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/LevelTagsController.cs @@ -1,7 +1,10 @@ using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Interaction; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ListController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ListController.cs index 118742c3..7ee2ce79 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ListController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ListController.cs @@ -1,10 +1,13 @@ #nullable enable using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Types.Entities.Interaction; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs index 6468e022..b7f2752d 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs @@ -3,11 +3,15 @@ using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Files; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Logging; +using LBPUnion.ProjectLighthouse.Types.Misc; +using LBPUnion.ProjectLighthouse.Types.Resources; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -219,7 +223,7 @@ public class PublishController : ControllerBase #endregion slot.FirstUploaded = oldSlot.FirstUploaded; - slot.LastUpdated = TimeHelper.UnixTimeMilliseconds(); + slot.LastUpdated = TimeHelper.TimestampMillis; slot.TeamPick = oldSlot.TeamPick; @@ -253,8 +257,8 @@ public class PublishController : ControllerBase await this.database.SaveChangesAsync(); slot.LocationId = l.Id; slot.CreatorId = user.UserId; - slot.FirstUploaded = TimeHelper.UnixTimeMilliseconds(); - slot.LastUpdated = TimeHelper.UnixTimeMilliseconds(); + slot.FirstUploaded = TimeHelper.TimestampMillis; + slot.LastUpdated = TimeHelper.TimestampMillis; if (slot.MinimumPlayers == 0 || slot.MaximumPlayers == 0) { @@ -287,7 +291,7 @@ public class PublishController : ControllerBase Slot? slot = await this.database.Slots.Include(s => s.Location).FirstOrDefaultAsync(s => s.SlotId == id); if (slot == null) return this.NotFound(); - if (slot.Location == null) throw new ArgumentNullException(); + if (slot.Location == null) throw new ArgumentNullException(nameof(id)); if (slot.CreatorId != token.UserId) return this.StatusCode(403, ""); diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ReviewController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ReviewController.cs index 2bd91bc8..4303f695 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ReviewController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ReviewController.cs @@ -1,11 +1,11 @@ #nullable enable -using LBPUnion.ProjectLighthouse.Administration; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Reviews; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Types.Entities.Interaction; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -117,7 +117,7 @@ public class ReviewController : ControllerBase review.Text = newReview.Text; review.Deleted = false; - review.Timestamp = TimeHelper.UnixTimeMilliseconds(); + review.Timestamp = TimeHelper.TimestampMillis; // sometimes the game posts/updates a review rating without also calling dpadrate/user/etc (why??) RatedLevel? ratedLevel = await this.database.RatedLevels.FirstOrDefaultAsync(r => r.SlotId == slotId && r.UserId == token.UserId); diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ScoreController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ScoreController.cs index 277f7a2c..91bb0ff4 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ScoreController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ScoreController.cs @@ -2,12 +2,14 @@ using System.Diagnostics.CodeAnalysis; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.StorableLists.Stores; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Logging; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SearchController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SearchController.cs index a3431423..80af2faa 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SearchController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SearchController.cs @@ -1,8 +1,9 @@ #nullable enable using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Levels; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs index 8a6deaee..da23d25b 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs @@ -2,12 +2,13 @@ using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.Match.Rooms; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; -using LBPUnion.ProjectLighthouse.PlayerData.Reviews; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Types.Entities.Interaction; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Matchmaking.Rooms; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/StatisticsController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/StatisticsController.cs index 0999b344..0c65f3c1 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/StatisticsController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/StatisticsController.cs @@ -2,7 +2,6 @@ using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Serialization; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using LBPUnion.ProjectLighthouse.PlayerData; using LBPUnion.ProjectLighthouse.Extensions; namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers; diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/UserController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/UserController.cs index 143cd16d..60433956 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/UserController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/UserController.cs @@ -3,10 +3,14 @@ using System.Text.Json; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Files; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Servers.GameServer.Types; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Misc; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -185,7 +189,7 @@ public class UserController : ControllerBase string bodyString = await this.ReadBodyAsync(); Pins? pinJson = JsonSerializer.Deserialize(bodyString); - if (pinJson == null) return this.BadRequest(); + if (pinJson?.ProfilePins == null) return this.BadRequest(); // Sometimes the update gets called periodically as pin progress updates via playing, // may not affect equipped profile pins however, so check before setting it. diff --git a/ProjectLighthouse.Servers.GameServer/Middlewares/SetLastContactMiddleware.cs b/ProjectLighthouse.Servers.GameServer/Middlewares/SetLastContactMiddleware.cs index 76c94f35..3b08710f 100644 --- a/ProjectLighthouse.Servers.GameServer/Middlewares/SetLastContactMiddleware.cs +++ b/ProjectLighthouse.Servers.GameServer/Middlewares/SetLastContactMiddleware.cs @@ -1,5 +1,7 @@ +using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Middlewares; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Users; namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Middlewares; diff --git a/ProjectLighthouse.Servers.GameServer/Program.cs b/ProjectLighthouse.Servers.GameServer/Program.cs index 35acb397..50ef3ad6 100644 --- a/ProjectLighthouse.Servers.GameServer/Program.cs +++ b/ProjectLighthouse.Servers.GameServer/Program.cs @@ -1,7 +1,7 @@ using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Logging.Loggers.AspNet; using LBPUnion.ProjectLighthouse.Servers.GameServer.Startup; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Types.Misc; using Microsoft.Extensions.DependencyInjection.Extensions; namespace LBPUnion.ProjectLighthouse.Servers.GameServer; diff --git a/ProjectLighthouse.Servers.GameServer/Startup/GameServerStartup.cs b/ProjectLighthouse.Servers.GameServer/Startup/GameServerStartup.cs index 26c0093a..9fd17804 100644 --- a/ProjectLighthouse.Servers.GameServer/Startup/GameServerStartup.cs +++ b/ProjectLighthouse.Servers.GameServer/Startup/GameServerStartup.cs @@ -3,8 +3,7 @@ using LBPUnion.ProjectLighthouse.Logging; using LBPUnion.ProjectLighthouse.Middlewares; using LBPUnion.ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Servers.GameServer.Middlewares; -using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Authentication.Cookies; +using LBPUnion.ProjectLighthouse.Types.Logging; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.HttpOverrides; diff --git a/ProjectLighthouse.Servers.GameServer/Startup/TokenAuthHandler.cs b/ProjectLighthouse.Servers.GameServer/Startup/TokenAuthHandler.cs index d0cb8b54..101fd47f 100644 --- a/ProjectLighthouse.Servers.GameServer/Startup/TokenAuthHandler.cs +++ b/ProjectLighthouse.Servers.GameServer/Startup/TokenAuthHandler.cs @@ -1,6 +1,6 @@ using System.Security.Claims; using System.Text.Encodings.Web; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; using Microsoft.AspNetCore.Authentication; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; diff --git a/ProjectLighthouse/Levels/Categories/CategoryHelper.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/CategoryHelper.cs similarity index 79% rename from ProjectLighthouse/Levels/Categories/CategoryHelper.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/CategoryHelper.cs index 7330fbe9..d6ff6681 100644 --- a/ProjectLighthouse/Levels/Categories/CategoryHelper.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/CategoryHelper.cs @@ -1,6 +1,7 @@ -using System.Collections.Generic; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Levels; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public static class CategoryHelper { diff --git a/ProjectLighthouse/Levels/Categories/CategoryWithUser.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/CategoryWithUser.cs similarity index 90% rename from ProjectLighthouse/Levels/Categories/CategoryWithUser.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/CategoryWithUser.cs index 893d32a1..9a74f81f 100644 --- a/ProjectLighthouse/Levels/Categories/CategoryWithUser.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/CategoryWithUser.cs @@ -1,11 +1,13 @@ #nullable enable -using System.Collections.Generic; using System.Diagnostics; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; using LBPUnion.ProjectLighthouse.Serialization; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Logging; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public abstract class CategoryWithUser : Category { diff --git a/ProjectLighthouse/Levels/Categories/CustomCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/CustomCategory.cs similarity index 86% rename from ProjectLighthouse/Levels/Categories/CustomCategory.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/CustomCategory.cs index 295f0842..92300efa 100644 --- a/ProjectLighthouse/Levels/Categories/CustomCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/CustomCategory.cs @@ -1,10 +1,10 @@ #nullable enable -using System.Collections.Generic; -using System.Linq; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public class CustomCategory : Category { diff --git a/ProjectLighthouse/Levels/Categories/HeartedCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/HeartedCategory.cs similarity index 86% rename from ProjectLighthouse/Levels/Categories/HeartedCategory.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/HeartedCategory.cs index e5f080df..22d13997 100644 --- a/ProjectLighthouse/Levels/Categories/HeartedCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/HeartedCategory.cs @@ -1,13 +1,12 @@ #nullable enable -using System; -using System.Collections.Generic; -using System.Linq; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.EntityFrameworkCore; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public class HeartedCategory : CategoryWithUser { diff --git a/ProjectLighthouse/Levels/Categories/HighestRatedCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/HighestRatedCategory.cs similarity index 83% rename from ProjectLighthouse/Levels/Categories/HighestRatedCategory.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/HighestRatedCategory.cs index aa41324d..962530c0 100644 --- a/ProjectLighthouse/Levels/Categories/HighestRatedCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/HighestRatedCategory.cs @@ -1,12 +1,11 @@ #nullable enable -using System; -using System.Collections.Generic; -using System.Linq; using System.Security.Cryptography; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public class HighestRatedCategory : Category { diff --git a/ProjectLighthouse/Levels/Categories/LuckyDipCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/LuckyDipCategory.cs similarity index 82% rename from ProjectLighthouse/Levels/Categories/LuckyDipCategory.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/LuckyDipCategory.cs index e49b8f88..69483a50 100644 --- a/ProjectLighthouse/Levels/Categories/LuckyDipCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/LuckyDipCategory.cs @@ -1,12 +1,11 @@ #nullable enable -using System; -using System.Collections.Generic; -using System.Linq; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.EntityFrameworkCore; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public class LuckyDipCategory : Category { diff --git a/ProjectLighthouse/Levels/Categories/MostHeartedCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/MostHeartedCategory.cs similarity index 83% rename from ProjectLighthouse/Levels/Categories/MostHeartedCategory.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/MostHeartedCategory.cs index e11a055c..db4b5cda 100644 --- a/ProjectLighthouse/Levels/Categories/MostHeartedCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/MostHeartedCategory.cs @@ -1,12 +1,11 @@ #nullable enable -using System; -using System.Collections.Generic; -using System.Linq; using System.Security.Cryptography; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public class MostHeartedCategory : Category { diff --git a/ProjectLighthouse/Levels/Categories/MostPlayedCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/MostPlayedCategory.cs similarity index 85% rename from ProjectLighthouse/Levels/Categories/MostPlayedCategory.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/MostPlayedCategory.cs index f69870a6..ffa28e68 100644 --- a/ProjectLighthouse/Levels/Categories/MostPlayedCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/MostPlayedCategory.cs @@ -1,11 +1,10 @@ #nullable enable -using System; -using System.Collections.Generic; -using System.Linq; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public class MostPlayedCategory : Category { diff --git a/ProjectLighthouse/Levels/Categories/NewestLevelsCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/NewestLevelsCategory.cs similarity index 81% rename from ProjectLighthouse/Levels/Categories/NewestLevelsCategory.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/NewestLevelsCategory.cs index 12fe8fa6..3977f85a 100644 --- a/ProjectLighthouse/Levels/Categories/NewestLevelsCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/NewestLevelsCategory.cs @@ -1,11 +1,10 @@ #nullable enable -using System; -using System.Collections.Generic; -using System.Linq; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public class NewestLevelsCategory : Category { diff --git a/ProjectLighthouse/Levels/Categories/QueueCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/QueueCategory.cs similarity index 86% rename from ProjectLighthouse/Levels/Categories/QueueCategory.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/QueueCategory.cs index a3eb9151..f7e1570c 100644 --- a/ProjectLighthouse/Levels/Categories/QueueCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/QueueCategory.cs @@ -1,13 +1,12 @@ #nullable enable -using System; -using System.Collections.Generic; -using System.Linq; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.EntityFrameworkCore; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public class QueueCategory : CategoryWithUser { diff --git a/ProjectLighthouse/Levels/Categories/TeamPicksCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/TeamPicksCategory.cs similarity index 74% rename from ProjectLighthouse/Levels/Categories/TeamPicksCategory.cs rename to ProjectLighthouse.Servers.GameServer/Types/Categories/TeamPicksCategory.cs index 3288e6a1..13624956 100644 --- a/ProjectLighthouse/Levels/Categories/TeamPicksCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/TeamPicksCategory.cs @@ -1,11 +1,10 @@ #nullable enable -using System; -using System.Collections.Generic; -using System.Linq; using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Users; -namespace LBPUnion.ProjectLighthouse.Levels.Categories; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; public class TeamPicksCategory : Category { @@ -16,8 +15,7 @@ public class TeamPicksCategory : Category public override Slot? GetPreviewSlot(Database database) => database.Slots.OrderByDescending(s => s.FirstUploaded).FirstOrDefault(s => s.TeamPick); public override IEnumerable GetSlots (Database database, int pageStart, int pageSize) - => database.Slots.ByGameVersion - (GameVersion.LittleBigPlanet3, false, true) + => database.Slots.ByGameVersion(GameVersion.LittleBigPlanet3, false, true) .OrderByDescending(s => s.FirstUploaded) .Where(s => s.TeamPick) .Skip(Math.Max(0, pageStart - 1)) diff --git a/ProjectLighthouse.Servers.GameServer/Types/Misc/ResourceList.cs b/ProjectLighthouse.Servers.GameServer/Types/Misc/ResourceList.cs new file mode 100644 index 00000000..140e4394 --- /dev/null +++ b/ProjectLighthouse.Servers.GameServer/Types/Misc/ResourceList.cs @@ -0,0 +1,16 @@ +using System.Xml.Serialization; + +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Misc; + +/// +/// Used by the game to send a list of hashed resources +/// Use cases include requesting which resources are filtered +/// or what resources aren't currently uploaded to the server +/// +[XmlRoot("resources")] +[XmlType("resources")] +public class ResourceList +{ + [XmlElement("resource")] + public string[]? Resources; +} \ No newline at end of file diff --git a/ProjectLighthouse/PlayerData/Profiles/ClientsConnected.cs b/ProjectLighthouse.Servers.GameServer/Types/User/ClientsConnected.cs similarity index 92% rename from ProjectLighthouse/PlayerData/Profiles/ClientsConnected.cs rename to ProjectLighthouse.Servers.GameServer/Types/User/ClientsConnected.cs index b0b9c57a..dc1d206e 100644 --- a/ProjectLighthouse/PlayerData/Profiles/ClientsConnected.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/User/ClientsConnected.cs @@ -1,7 +1,7 @@ using LBPUnion.ProjectLighthouse.Serialization; using Microsoft.EntityFrameworkCore; -namespace LBPUnion.ProjectLighthouse.PlayerData.Profiles; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types; [Keyless] public class ClientsConnected diff --git a/ProjectLighthouse.Servers.GameServer/Types/User/NPData.cs b/ProjectLighthouse.Servers.GameServer/Types/User/NPData.cs new file mode 100644 index 00000000..d7ccb175 --- /dev/null +++ b/ProjectLighthouse.Servers.GameServer/Types/User/NPData.cs @@ -0,0 +1,21 @@ +using System.Xml.Serialization; + +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types; + +/// +/// Sent by the game client to inform the server +/// of the user's friend list +/// Used to filter activities from friends +/// +[XmlRoot("npdata")] +[XmlType("npdata")] +public class NPData +{ + [XmlArray("friends")] + [XmlArrayItem("npHandle")] + public List? Friends { get; set; } + + [XmlArray("blocked")] + [XmlArrayItem("npHandle")] + public List? BlockedUsers { get; set; } +} \ No newline at end of file diff --git a/ProjectLighthouse.Servers.GameServer/Types/User/Pins.cs b/ProjectLighthouse.Servers.GameServer/Types/User/Pins.cs new file mode 100644 index 00000000..e9658caf --- /dev/null +++ b/ProjectLighthouse.Servers.GameServer/Types/User/Pins.cs @@ -0,0 +1,15 @@ +using System.Text.Json.Serialization; + +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types; + +public class Pins +{ + [JsonPropertyName("progress")] + public long[]? Progress { get; set; } + + [JsonPropertyName("awards")] + public long[]? Awards { get; set; } + + [JsonPropertyName("profile_pins")] + public long[]? ProfilePins { get; set; } +} \ No newline at end of file diff --git a/ProjectLighthouse/PlayerData/PrivacySettings.cs b/ProjectLighthouse.Servers.GameServer/Types/User/PrivacySettings.cs similarity index 91% rename from ProjectLighthouse/PlayerData/PrivacySettings.cs rename to ProjectLighthouse.Servers.GameServer/Types/User/PrivacySettings.cs index de57b9a1..084efba3 100644 --- a/ProjectLighthouse/PlayerData/PrivacySettings.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/User/PrivacySettings.cs @@ -2,7 +2,7 @@ using System.Xml.Serialization; using LBPUnion.ProjectLighthouse.Serialization; -namespace LBPUnion.ProjectLighthouse.PlayerData; +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types; [XmlRoot("privacySettings")] [XmlType("privacySettings")] diff --git a/ProjectLighthouse/PlayerData/Profiles/UserUpdate.cs b/ProjectLighthouse.Servers.GameServer/Types/User/UserUpdate.cs similarity index 57% rename from ProjectLighthouse/PlayerData/Profiles/UserUpdate.cs rename to ProjectLighthouse.Servers.GameServer/Types/User/UserUpdate.cs index f7d75a79..be9d959f 100644 --- a/ProjectLighthouse/PlayerData/Profiles/UserUpdate.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/User/UserUpdate.cs @@ -1,9 +1,14 @@ #nullable enable -using System.Collections.Generic; using System.Xml.Serialization; +using LBPUnion.ProjectLighthouse.Types.Levels; +using LBPUnion.ProjectLighthouse.Types.Misc; -namespace LBPUnion.ProjectLighthouse.PlayerData.Profiles; - +namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types; +/// +/// Used by the games to update details about a user's profile +/// LBP1 only uses Location and IconHash +/// LBP2 and onward uses the rest +/// public class UserUpdate { [XmlElement("location")] @@ -33,4 +38,17 @@ public class UserUpdate [XmlElement("boo2")] public string? BooHash { get; set; } +} + +[XmlRoot("slot")] +public class UserUpdateSlot +{ + [XmlElement("type")] + public SlotType? Type { get; set; } + + [XmlElement("id")] + public int? SlotId { get; set; } + + [XmlElement("location")] + public Location? Location { get; set; } } \ No newline at end of file diff --git a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminReportController.cs b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminReportController.cs index 5effec26..cefea838 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminReportController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminReportController.cs @@ -1,7 +1,7 @@ #nullable enable -using LBPUnion.ProjectLighthouse.Administration.Reports; using LBPUnion.ProjectLighthouse.Files; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Moderation; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -54,14 +54,7 @@ public class AdminReportController : ControllerBase GriefReport? report = await this.database.Reports.FirstOrDefaultAsync(r => r.ReportId == id); if (report == null) return this.NotFound(); - if (System.IO.File.Exists(Path.Combine("png", $"{report.JpegHash}.png"))) - { - System.IO.File.Delete(Path.Combine("png", $"{report.JpegHash}.png")); - } - if (System.IO.File.Exists(Path.Combine("r", report.JpegHash))) - { - System.IO.File.Delete(Path.Combine("r", report.JpegHash)); - } + FileHelper.DeleteResource(report.JpegHash); this.database.Reports.Remove(report); diff --git a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs index 61e65eda..8e624ef4 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs @@ -1,8 +1,10 @@ #nullable enable -using LBPUnion.ProjectLighthouse.Administration; using LBPUnion.ProjectLighthouse.Files; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Logging; +using LBPUnion.ProjectLighthouse.Types.Moderation.Cases; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using IOFile = System.IO.File; diff --git a/ProjectLighthouse.Servers.Website/Controllers/Debug/RoomVisualizerController.cs b/ProjectLighthouse.Servers.Website/Controllers/Debug/RoomVisualizerController.cs index d5ce4164..ec2e7d50 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Debug/RoomVisualizerController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Debug/RoomVisualizerController.cs @@ -1,8 +1,5 @@ -using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Match.Rooms; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.Website/Controllers/ExternalAuth/AuthenticationController.cs b/ProjectLighthouse.Servers.Website/Controllers/ExternalAuth/AuthenticationController.cs index 57cf9909..6ab846ee 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/ExternalAuth/AuthenticationController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/ExternalAuth/AuthenticationController.cs @@ -1,7 +1,7 @@ #nullable enable using LBPUnion.ProjectLighthouse.Extensions; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Users; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationCaseController.cs b/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationCaseController.cs index 497b51a3..af54fb84 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationCaseController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationCaseController.cs @@ -1,5 +1,6 @@ using LBPUnion.ProjectLighthouse.Administration; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Moderation; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationRemovalController.cs b/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationRemovalController.cs index 6b17ea79..9a9d10f8 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationRemovalController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationRemovalController.cs @@ -1,8 +1,5 @@ -using LBPUnion.ProjectLighthouse.Administration; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; -using LBPUnion.ProjectLighthouse.PlayerData.Reviews; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -12,7 +9,6 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Moderator; [Route("moderation")] public class ModerationRemovalController : ControllerBase { - private readonly Database database; public ModerationRemovalController(Database database) @@ -69,7 +65,7 @@ public class ModerationRemovalController : ControllerBase case CommentType.Profile: canDelete = user.UserId == comment.PosterUserId || user.UserId == comment.TargetId; break; - default: throw new ArgumentOutOfRangeException(); + default: throw new ArgumentOutOfRangeException(nameof(commentId)); } if (!canDelete && !user.IsModerator) return this.Redirect(callbackUrl ?? "~/"); diff --git a/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationSlotController.cs b/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationSlotController.cs index f5cacba2..ae98bb43 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationSlotController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationSlotController.cs @@ -1,8 +1,8 @@ #nullable enable using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.Website/Controllers/ResourcesController.cs b/ProjectLighthouse.Servers.Website/Controllers/ResourcesController.cs index f54da460..6b031a54 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/ResourcesController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/ResourcesController.cs @@ -1,4 +1,5 @@ using LBPUnion.ProjectLighthouse.Files; +using LBPUnion.ProjectLighthouse.Types.Resources; using Microsoft.AspNetCore.Mvc; using IOFile = System.IO.File; diff --git a/ProjectLighthouse.Servers.Website/Controllers/SlotPageController.cs b/ProjectLighthouse.Servers.Website/Controllers/SlotPageController.cs index 46189c2c..2da7311d 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/SlotPageController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/SlotPageController.cs @@ -1,9 +1,10 @@ #nullable enable using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Levels; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Logging; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -34,7 +35,7 @@ public class SlotPageController : ControllerBase Slot? targetSlot = await this.database.Slots.Include(s => s.Location).FirstOrDefaultAsync(s => s.SlotId == id); if (targetSlot == null) return this.Redirect("~/slots/0"); - if (targetSlot.Location == null) throw new ArgumentNullException(); + if (targetSlot.Location == null) throw new ArgumentNullException(nameof(id)); if (targetSlot.CreatorId != token.UserId) return this.Redirect("~/slot/" + id); diff --git a/ProjectLighthouse.Servers.Website/Controllers/UserPageController.cs b/ProjectLighthouse.Servers.Website/Controllers/UserPageController.cs index 1d361f13..76bd0e9f 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/UserPageController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/UserPageController.cs @@ -1,9 +1,9 @@ #nullable enable using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Logging; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; -using LBPUnion.ProjectLighthouse.Types; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; +using LBPUnion.ProjectLighthouse.Types.Logging; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; diff --git a/ProjectLighthouse.Servers.Website/Extensions/PartialExtensions.cs b/ProjectLighthouse.Servers.Website/Extensions/PartialExtensions.cs index a907da5b..71be2f75 100644 --- a/ProjectLighthouse.Servers.Website/Extensions/PartialExtensions.cs +++ b/ProjectLighthouse.Servers.Website/Extensions/PartialExtensions.cs @@ -1,6 +1,5 @@ -using LBPUnion.ProjectLighthouse.Levels; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; diff --git a/ProjectLighthouse.Servers.Website/Middlewares/UserRequiredRedirectMiddleware.cs b/ProjectLighthouse.Servers.Website/Middlewares/UserRequiredRedirectMiddleware.cs index 28b279dd..9e40e014 100644 --- a/ProjectLighthouse.Servers.Website/Middlewares/UserRequiredRedirectMiddleware.cs +++ b/ProjectLighthouse.Servers.Website/Middlewares/UserRequiredRedirectMiddleware.cs @@ -1,7 +1,7 @@ using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Middlewares; -using LBPUnion.ProjectLighthouse.PlayerData; -using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Types.Entities.Profile; +using LBPUnion.ProjectLighthouse.Types.Entities.Token; using Microsoft.EntityFrameworkCore; namespace LBPUnion.ProjectLighthouse.Servers.Website.Middlewares; diff --git a/ProjectLighthouse.Servers.Website/Pages/Admin/AdminAPIKeyPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/Admin/AdminApiKeyPage.cshtml similarity index 90% rename from ProjectLighthouse.Servers.Website/Pages/Admin/AdminAPIKeyPage.cshtml rename to ProjectLighthouse.Servers.Website/Pages/Admin/AdminApiKeyPage.cshtml index 67a541cf..7a32a1fe 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Admin/AdminAPIKeyPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Admin/AdminApiKeyPage.cshtml @@ -1,7 +1,6 @@ @page "/admin/keys" - -@using LBPUnion.ProjectLighthouse.PlayerData -@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.AdminAPIKeyPageModel +@using LBPUnion.ProjectLighthouse.Types.Entities.Token +@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.AdminApiKeyPageModel @{ Layout = "Layouts/BaseLayout"; Model.Title = "API Keys"; @@ -9,7 +8,7 @@ @inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Antiforgery @{ - var token = Antiforgery.GetAndStoreTokens(HttpContext).RequestToken; + string? token = Antiforgery.GetAndStoreTokens(HttpContext).RequestToken; }