├── .editorconfig
├── .gitattributes
├── .github
├── CODEOWNERS
├── dependabot.yml
└── workflows
│ └── test-build.yml
├── .gitignore
├── .run
└── Fragment.NetSlum.Server.run.xml
├── Dockerfile
├── Fragment.NetSlum.sln
├── LICENSE
├── README.md
├── docker-compose.yml
├── docs
├── about
│ ├── coding-style.md
│ ├── contributing.md
│ ├── license.md
│ └── project-overview.md
├── hosting
│ └── area-server-hosting.md
├── index.md
├── networking
│ ├── encoding.md
│ ├── framing.md
│ └── index.md
└── static
│ ├── fragment.jpg
│ └── project_diagram.png
├── mkdocs.yml
├── src
├── Fragment.NetSlum.Console
│ ├── Commands
│ │ ├── MigrateBbsCommand.cs
│ │ ├── MigrateGuildShopCommand.cs
│ │ ├── MigrateGuildsCommand.cs
│ │ ├── MigrateMailCommand.cs
│ │ └── MigratePlayersCommand.cs
│ ├── DependencyInjection
│ │ ├── TypeRegistrar.cs
│ │ └── TypeResolver.cs
│ ├── Fragment.NetSlum.Console.csproj
│ └── Program.cs
├── Fragment.NetSlum.Core
│ ├── Buffers
│ │ ├── MemoryWriter.cs
│ │ └── SpanReader.cs
│ ├── CommandBus
│ │ ├── Contracts
│ │ │ ├── Commands
│ │ │ │ ├── CommandHandler.cs
│ │ │ │ ├── ICommand.cs
│ │ │ │ └── ICommandHandler.cs
│ │ │ ├── Events
│ │ │ │ ├── EventHandler.cs
│ │ │ │ ├── IEvent.cs
│ │ │ │ └── IEventHandler.cs
│ │ │ └── Queries
│ │ │ │ ├── IQuery.cs
│ │ │ │ ├── IQueryHandler.cs
│ │ │ │ └── QueryHandler.cs
│ │ ├── ICommandBus.cs
│ │ └── MediatorCommandBus.cs
│ ├── Constants
│ │ ├── CharacterClass.cs
│ │ ├── CharacterColor.cs
│ │ ├── CharacterRanks.cs
│ │ ├── ChatLobbyStatus.cs
│ │ ├── ChatLobbyType.cs
│ │ └── GuildStatus.cs
│ ├── DependencyInjection
│ │ └── IScopeable.cs
│ ├── Extensions
│ │ ├── CharacterExtensions.cs
│ │ ├── DataExtensions.cs
│ │ ├── DateExtensions.cs
│ │ ├── IpAddressExtensions.cs
│ │ ├── ServiceCollectionExtensions.cs
│ │ └── StringExtensions.cs
│ ├── Fragment.NetSlum.Core.csproj
│ └── Models
│ │ ├── CharacterInfo.cs
│ │ └── ImageInfo.cs
├── Fragment.NetSlum.Networking
│ ├── Attributes
│ │ └── FragmentPacket.cs
│ ├── Commands
│ │ ├── Accounts
│ │ │ └── RegisterPlayerAccountCommand.cs
│ │ ├── Characters
│ │ │ └── RegisterCharacterCommand.cs
│ │ └── News
│ │ │ └── MarkNewsArticleReadCommand.cs
│ ├── Constants
│ │ ├── MessageType.cs
│ │ └── OpCodes.cs
│ ├── Crypto
│ │ ├── BlowfishProvider.cs
│ │ └── CryptoHandler.cs
│ ├── Entrypoint.cs
│ ├── Events
│ │ └── CharacterLoggedInEvent.cs
│ ├── Extensions
│ │ ├── PacketExtensions.cs
│ │ └── ServiceCollectionExtensions.cs
│ ├── Fragment.NetSlum.Networking.csproj
│ ├── Messaging
│ │ ├── FragmentPacketHandler.cs
│ │ ├── IPacketHandler.cs
│ │ └── PacketCache.cs
│ ├── Models
│ │ ├── AreaServerInformation.cs
│ │ ├── ChatLobbyModel.cs
│ │ └── ChatLobbyPlayer.cs
│ ├── Objects
│ │ └── FragmentMessage.cs
│ ├── Packets
│ │ ├── Request
│ │ │ ├── AreaServer
│ │ │ │ ├── AreaServerDateTimeRequest.cs
│ │ │ │ ├── AreaServerFavoritesRequest.cs
│ │ │ │ ├── AreaServerIPAddressPortRequest.cs
│ │ │ │ ├── AreaServerPublishDetailsRequest.cs
│ │ │ │ ├── AreaServerPublishRequest.cs
│ │ │ │ ├── AreaServerUpdateStatusRequest.cs
│ │ │ │ └── AreaServerUpdateUserCountRequest.cs
│ │ │ ├── Articles
│ │ │ │ ├── ArticleCheckRequest.cs
│ │ │ │ ├── GetNewsArticlesRequest.cs
│ │ │ │ └── GetNewsPostRequest.cs
│ │ │ ├── BBS
│ │ │ │ ├── CheckCreateBBSThreadRequest.cs
│ │ │ │ ├── CreateBBSPostRequest.cs
│ │ │ │ ├── GetBBSMenuRequest.cs
│ │ │ │ ├── GetBBSPostContent.cs
│ │ │ │ ├── GetBBSThreadDetailsRequest.cs
│ │ │ │ └── GetBBSUpdatesRequest.cs
│ │ │ ├── BaseRequest.cs
│ │ │ ├── Character
│ │ │ │ ├── RegisterCharacterRequest.cs
│ │ │ │ ├── Select2CharacterRequest.cs
│ │ │ │ ├── SelectCharacterRequest.cs
│ │ │ │ └── UnregisterCharacterRequest.cs
│ │ │ ├── ChatLobby
│ │ │ │ ├── ChatLobbyEnterRoomRequest.cs
│ │ │ │ ├── ChatLobbyGetMenuRequest.cs
│ │ │ │ ├── ChatLobbyStatusUpdateRequest.cs
│ │ │ │ ├── CreateLobbyChatroomRequest.cs
│ │ │ │ ├── GetLobbyChatroomListRequest.cs
│ │ │ │ ├── GetLobbyServerListRequest.cs
│ │ │ │ ├── GetLobbyServersExitRequest.cs
│ │ │ │ ├── GetLobbyServersRequest.cs
│ │ │ │ ├── LobbyEventRequest.cs
│ │ │ │ └── LobbyExitRoomRequest.cs
│ │ │ ├── Guilds
│ │ │ │ ├── CreateGuildRequest.cs
│ │ │ │ ├── DissolveGuildRequest.cs
│ │ │ │ ├── DonateCoinsToGuildRequest.cs
│ │ │ │ ├── GetGuildInfoRequest.cs
│ │ │ │ ├── GetGuildItemListRequest.cs
│ │ │ │ ├── GetGuildLoggedInMembersRequest.cs
│ │ │ │ ├── GetGuildMenuRequest.cs
│ │ │ │ ├── GetGuildShopItemsRequest.cs
│ │ │ │ ├── GetShoppableGuildListRequest.cs
│ │ │ │ ├── GuildInvitationResultRequest.cs
│ │ │ │ ├── GuildMemberListRequest.cs
│ │ │ │ ├── KickPlayerFromGuildRequest.cs
│ │ │ │ ├── LeaveGuildRequest.cs
│ │ │ │ ├── PurchaseGuildShopItemRequest.cs
│ │ │ │ ├── ReassignGuildMasterRequest.cs
│ │ │ │ ├── SendGuildInviteRequest.cs
│ │ │ │ ├── TakeGuildShopItemRequest.cs
│ │ │ │ ├── UpdateGuildDetailsRequest.cs
│ │ │ │ ├── UpdateGuildShopItemRequest.cs
│ │ │ │ └── ViewGuildRequest.cs
│ │ │ ├── Login
│ │ │ │ ├── AreaServerDiskAuthorizationRequest.cs
│ │ │ │ ├── AreaServerShutdownRequest.cs
│ │ │ │ ├── DiskAuthorizationRequest.cs
│ │ │ │ ├── LogonRepeatRequest.cs
│ │ │ │ └── LogonRequest.cs
│ │ │ ├── Mail
│ │ │ │ ├── GetMailContentRequest.cs
│ │ │ │ ├── GetMailListRequest.cs
│ │ │ │ ├── MailCheckRequest.cs
│ │ │ │ ├── SendGuildMailRequest.cs
│ │ │ │ └── SendMailRequest.cs
│ │ │ ├── Misc
│ │ │ │ ├── DataComRequest.cs
│ │ │ │ ├── PingRequest.cs
│ │ │ │ ├── PrivateBroadcastRequest.cs
│ │ │ │ ├── ReturnToDesktopRequest.cs
│ │ │ │ └── Unknown787ERequest.cs
│ │ │ ├── Ranking
│ │ │ │ ├── RankingLeaderboardRequest.cs
│ │ │ │ └── RankingPlayerInfoRequest.cs
│ │ │ ├── Saves
│ │ │ │ └── GetAccountInfoForSaveIdRequest.cs
│ │ │ └── Security
│ │ │ │ ├── KeyExchangeAcknowledgementRequest.cs
│ │ │ │ └── KeyExchangeRequest.cs
│ │ └── Response
│ │ │ ├── AreaServer
│ │ │ ├── AreaServerDateTimeResponse.cs
│ │ │ ├── AreaServerFavoriteEntry.cs
│ │ │ ├── AreaServerFavoritesCountResponse.cs
│ │ │ ├── AreaServerIPAddressPortResponse.cs
│ │ │ ├── AreaServerPublishDetailsResponse.cs
│ │ │ └── AreaServerPublishResponse.cs
│ │ │ ├── Articles
│ │ │ ├── ArticleCheckResponse.cs
│ │ │ ├── GetNewsPostErrorResponse.cs
│ │ │ ├── NewsArticleCountResponse.cs
│ │ │ ├── NewsArticleEntryResponse.cs
│ │ │ ├── NewsArticleListResponse.cs
│ │ │ ├── NewsCategoryCountResponse.cs
│ │ │ ├── NewsCategoryEntryResponse.cs
│ │ │ ├── NewsPostImageDetailsResponse.cs
│ │ │ └── NewsPostImageSizeResponse.cs
│ │ │ ├── BBS
│ │ │ ├── BbsCategoryCountResponse.cs
│ │ │ ├── BbsCategoryEntryResponse.cs
│ │ │ ├── BbsPostContentResponse.cs
│ │ │ ├── BbsThreadCountResponse.cs
│ │ │ ├── BbsThreadEntryResponse.cs
│ │ │ ├── BbsThreadPostCountResponse.cs
│ │ │ ├── BbsThreadPostEntryInfoResponse.cs
│ │ │ ├── CheckCreateBBSThreadResponse.cs
│ │ │ ├── CreateBBSPostResponse.cs
│ │ │ └── GetBBSUpdatesResponse.cs
│ │ │ ├── BaseResponse.cs
│ │ │ ├── Character
│ │ │ ├── RegisterCharacterResponse.cs
│ │ │ ├── Select2CharacterResponse.cs
│ │ │ ├── SelectCharacterResponse.cs
│ │ │ └── UnregisterCharacterResponse.cs
│ │ │ ├── ChatLobby
│ │ │ ├── ChatLobbyCountResponse.cs
│ │ │ ├── ChatLobbyEnterRoomResponse.cs
│ │ │ ├── ChatLobbyEntryResponse.cs
│ │ │ ├── ChatLobbyStatusUpdateResponse.cs
│ │ │ ├── ClientLeftChatLobbyResponse.cs
│ │ │ ├── CreateLobbyChatroomResponse.cs
│ │ │ ├── LobbyChatroomCategoryCountResponse.cs
│ │ │ ├── LobbyChatroomCategoryEntryResponse.cs
│ │ │ ├── LobbyEventResponse.cs
│ │ │ ├── LobbyExitResponse.cs
│ │ │ ├── LobbyGetServersExitResponse.cs
│ │ │ ├── LobbyGetServersResponse.cs
│ │ │ ├── LobbyServerCategoryCountResponse.cs
│ │ │ ├── LobbyServerCategoryEntryResponse.cs
│ │ │ ├── LobbyServerEntryCountResponse.cs
│ │ │ └── LobbyServerEntryResponse.cs
│ │ │ ├── Guilds
│ │ │ ├── CreateGuildResponse.cs
│ │ │ ├── DissolveGuildResponse.cs
│ │ │ ├── DonateCoinsToGuildResponse.cs
│ │ │ ├── GuildInfoResponse.cs
│ │ │ ├── GuildInvitationResultConfirmationResponse.cs
│ │ │ ├── GuildItemListCountResponse.cs
│ │ │ ├── GuildItemListEntryResponse.cs
│ │ │ ├── GuildListEntryCountResponse.cs
│ │ │ ├── GuildLoggedInMembersResponse.cs
│ │ │ ├── GuildMemberListCategoryCountResponse.cs
│ │ │ ├── GuildMemberListCategoryEntryResponse.cs
│ │ │ ├── GuildMemberListEntryCountResponse.cs
│ │ │ ├── GuildMemberListEntryResponse.cs
│ │ │ ├── GuildMenuCategoryCountResponse.cs
│ │ │ ├── GuildMenuCategoryResponse.cs
│ │ │ ├── GuildMenuListEntryResponse.cs
│ │ │ ├── GuildShopEntryCountResponse.cs
│ │ │ ├── GuildShopEntryResponse.cs
│ │ │ ├── GuildShopItemCountResponse.cs
│ │ │ ├── GuildShopItemEntryResponse.cs
│ │ │ ├── InvitePlayerToGuildResponse.cs
│ │ │ ├── KickPlayerFromGuildResponse.cs
│ │ │ ├── LeaveGuildResponse.cs
│ │ │ ├── PurchaseGuildShopItemResponse.cs
│ │ │ ├── ReassignGuildMasterResponse.cs
│ │ │ ├── ShoppableGuildEntryCountResponse.cs
│ │ │ ├── ShoppableGuildEntryResponse.cs
│ │ │ ├── TakeGuildShopItemResponse.cs
│ │ │ ├── UpdateGuildDetailsResponse.cs
│ │ │ └── UpdateGuildShopItemResponse.cs
│ │ │ ├── Login
│ │ │ ├── AreaServerDiskAuthorizationResponse.cs
│ │ │ ├── AreaServerLogonResponse.cs
│ │ │ ├── AreaServerShutdownResponse.cs
│ │ │ ├── DiskAuthorizationResponse.cs
│ │ │ ├── LogonRepeatResponse.cs
│ │ │ └── LogonResponse.cs
│ │ │ ├── Mail
│ │ │ ├── MailCheckResponse.cs
│ │ │ ├── MailContentResponse.cs
│ │ │ ├── MailEntryResponse.cs
│ │ │ ├── MailListCountResponse.cs
│ │ │ └── SendMailResponse.cs
│ │ │ ├── Misc
│ │ │ ├── DataComResponse.cs
│ │ │ ├── PingResponse.cs
│ │ │ ├── PrivateBroadcastResponse.cs
│ │ │ ├── ReturnToDesktopResponse.cs
│ │ │ └── UnknownResponse.cs
│ │ │ ├── Ranking
│ │ │ ├── RankingLeaderboardCategoryCountResponse.cs
│ │ │ ├── RankingLeaderboardCategoryEntryResponse.cs
│ │ │ ├── RankingLeaderboardPlayerCountResponse.cs
│ │ │ ├── RankingLeaderboardPlayerEntryResponse.cs
│ │ │ └── RankingPlayerInfoResponse.cs
│ │ │ ├── Saves
│ │ │ └── PlayerAccountInformationResponse.cs
│ │ │ └── Security
│ │ │ └── KeyExchangeResponse.cs
│ ├── Pipeline
│ │ ├── Builder
│ │ │ ├── PacketPipelineBuilder.cs
│ │ │ └── PacketPipelineBuilderExtensions.cs
│ │ ├── Decoders
│ │ │ ├── FragmentFrameDecoder.cs
│ │ │ └── IPacketDecoder.cs
│ │ ├── Encoders
│ │ │ ├── DataTypeEnvelopeEncoder.cs
│ │ │ ├── EncryptionEncoder.cs
│ │ │ └── IMessageEncoder.cs
│ │ └── FragmentPacketPipeline.cs
│ ├── Queries
│ │ ├── Images
│ │ │ └── GetImageInfoQuery.cs
│ │ ├── Infrastructure
│ │ │ └── IsIpAddressBannedQuery.cs
│ │ └── News
│ │ │ └── HasPlayerReadNewsArticle.cs
│ ├── Sessions
│ │ └── FragmentTcpSession.cs
│ └── Stores
│ │ └── ChatLobbyStore.cs
├── Fragment.NetSlum.Persistence
│ ├── Attributes
│ │ └── TimestampableAttribute.cs
│ ├── Builders
│ │ └── EntityListenerBuilder.cs
│ ├── Entities
│ │ ├── AreaServerCategory.cs
│ │ ├── AreaServerIpMapping.cs
│ │ ├── BannedIp.cs
│ │ ├── BbsCategory.cs
│ │ ├── BbsPost.cs
│ │ ├── BbsPostContent.cs
│ │ ├── BbsThread.cs
│ │ ├── Character.cs
│ │ ├── CharacterIpLog.cs
│ │ ├── CharacterStatHistory.cs
│ │ ├── CharacterStats.cs
│ │ ├── ChatLobby.cs
│ │ ├── Deprecated
│ │ │ ├── BbsCategory.cs
│ │ │ ├── BbsPostBody.cs
│ │ │ ├── BbsPostMetum.cs
│ │ │ ├── BbsThread.cs
│ │ │ ├── Characterrepository.cs
│ │ │ ├── FailedJob.cs
│ │ │ ├── Guilditemshop.cs
│ │ │ ├── Guildrepository.cs
│ │ │ ├── MailBody.cs
│ │ │ ├── MailMetum.cs
│ │ │ ├── Messageoftheday.cs
│ │ │ ├── Migration.cs
│ │ │ ├── News.cs
│ │ │ ├── NewsSection.cs
│ │ │ ├── NewsSectionLog.cs
│ │ │ ├── PasswordReset.cs
│ │ │ ├── PlayerAccountId.cs
│ │ │ ├── RankingDatum.cs
│ │ │ ├── SaveFileIntegration.cs
│ │ │ └── User.cs
│ │ ├── Guild.cs
│ │ ├── GuildActivityLog.cs
│ │ ├── GuildShopItem.cs
│ │ ├── GuildStats.cs
│ │ ├── IConfigurableEntity.cs
│ │ ├── Mail.cs
│ │ ├── MailContent.cs
│ │ ├── PlayerAccount.cs
│ │ ├── ServerNews.cs
│ │ ├── WebNewsArticle.cs
│ │ ├── WebNewsCategory.cs
│ │ └── WebNewsReadLog.cs
│ ├── Extensions
│ │ ├── EntityListenerServerExtensions.cs
│ │ ├── QueryExtensions.cs
│ │ └── ServiceCollectionExtensions.cs
│ ├── Fragment.NetSlum.Persistence.csproj
│ ├── FragmentContext.cs
│ ├── Interceptors
│ │ └── EntityChangeInterceptor.cs
│ ├── Listeners
│ │ ├── AbstractEntityChangeListener.cs
│ │ ├── CharacterStatsChangeListener.cs
│ │ ├── IEntityChangeListener.cs
│ │ └── TimestampableEntityListener.cs
│ ├── Migrations
│ │ ├── 20230609073554_Initial.Designer.cs
│ │ ├── 20230609073554_Initial.cs
│ │ ├── 20230610143706_AreaServerIpMappingsForDiscord.Designer.cs
│ │ ├── 20230610143706_AreaServerIpMappingsForDiscord.cs
│ │ ├── 20230612015705_GuildActivityLog.Designer.cs
│ │ ├── 20230612015705_GuildActivityLog.cs
│ │ ├── 20230612020916_GuildShopItems.Designer.cs
│ │ ├── 20230612020916_GuildShopItems.cs
│ │ ├── 20230707151942_ChatLobbyTypes.Designer.cs
│ │ ├── 20230707151942_ChatLobbyTypes.cs
│ │ ├── 20230710144002_IpLogs.Designer.cs
│ │ ├── 20230710144002_IpLogs.cs
│ │ ├── 20230711022204_Mail.Designer.cs
│ │ ├── 20230711022204_Mail.cs
│ │ ├── 20230711034307_MailLengthConstraints.Designer.cs
│ │ ├── 20230711034307_MailLengthConstraints.cs
│ │ ├── 20240110034631_CharSaveSlot.Designer.cs
│ │ ├── 20240110034631_CharSaveSlot.cs
│ │ └── FragmentContextModelSnapshot.cs
│ ├── OldFragmentContext.cs
│ └── Services
│ │ └── AutoDbContextMigrationService.cs
├── Fragment.NetSlum.Server
│ ├── Api
│ │ ├── Controllers
│ │ │ ├── AreaServersController.cs
│ │ │ ├── GuildsController.cs
│ │ │ ├── LobbiesController.cs
│ │ │ ├── PlayersController.cs
│ │ │ └── StatsController.cs
│ │ └── Models
│ │ │ ├── AreaServerStatus.cs
│ │ │ ├── Client.cs
│ │ │ ├── GuildInfo.cs
│ │ │ ├── Lobby.cs
│ │ │ ├── LobbyPlayer.cs
│ │ │ ├── PagedResult.cs
│ │ │ ├── PlayerInfo.cs
│ │ │ ├── PlayerStats.cs
│ │ │ └── ServerStats.cs
│ ├── Converters
│ │ └── ImageConverter.cs
│ ├── Fragment.NetSlum.Server.csproj
│ ├── Handlers
│ │ ├── Accounts
│ │ │ └── RegisterPlayerAccountCommandHandler.cs
│ │ ├── Character
│ │ │ └── RegisterCharacterCommandHandler.cs
│ │ ├── Events
│ │ │ └── CharacterLoggedInEventHandler.cs
│ │ ├── Images
│ │ │ └── GetImageInfoQueryHandler.cs
│ │ ├── Infrastructure
│ │ │ └── IsIpAddressBannedQueryHandler.cs
│ │ └── News
│ │ │ ├── HasPlayerReadNewsArticleQueryHandler.cs
│ │ │ └── MarksNewsArticleReadCommandHandler.cs
│ ├── Mappings
│ │ ├── AreaServerMapper.cs
│ │ ├── CharacterInfoMapper.cs
│ │ ├── CharacterMapper.cs
│ │ ├── GuildMapper.cs
│ │ └── LobbyMapper.cs
│ ├── Program.cs
│ ├── Servers
│ │ ├── Server.cs
│ │ └── ServerConfiguration.cs
│ ├── Services
│ │ ├── ChatLobbyBackgroundServicecs.cs
│ │ ├── ClientTickService.cs
│ │ └── ServerBackgroundService.cs
│ ├── Startup.cs
│ ├── serverConfig.Production.json
│ ├── serverConfig.json
│ └── wwwroot
│ │ └── swagger
│ │ ├── css
│ │ └── ui.css
│ │ └── img
│ │ └── logo.svg
└── Fragment.NetSlum.TcpServer
│ ├── Buffers
│ └── PooledBuffer.cs
│ ├── Extensions
│ └── SocketExtensions.cs
│ ├── Fragment.NetSlum.TcpServer.csproj
│ ├── ITcpServer.cs
│ ├── Options
│ └── TcpServerOptions.cs
│ ├── TcpServer.cs
│ └── TcpSession.cs
└── test
└── Fragment.NetSlum.Networking.Test
├── Fragment.NetSlum.Networking.Test.csproj
├── Pipeline
├── Decoders
│ └── FragmentFrameDecoderTest.cs
└── FragmentPacketPipelineTest.cs
└── UnitTest1.cs
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | indent_size = 4
7 | indent_style = space
8 | insert_final_newline = true
9 | max_line_length = 140
10 | tab_width = 4
11 | trim_trailing_whitespace = true
12 | ij_continuation_indent_size = 8
13 | ij_formatter_off_tag = @formatter:off
14 | ij_formatter_on_tag = @formatter:on
15 | ij_formatter_tags_enabled = false
16 | ij_smart_tabs = false
17 | ij_visual_guides = none
18 | ij_wrap_on_typing = false
19 |
20 | [.editorconfig]
21 | ij_editorconfig_align_group_field_declarations = false
22 | ij_editorconfig_space_after_colon = false
23 | ij_editorconfig_space_after_comma = true
24 | ij_editorconfig_space_before_colon = false
25 | ij_editorconfig_space_before_comma = false
26 | ij_editorconfig_spaces_around_assignment_operators = true
27 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto encoding=UTF-8
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | *.cs diff=csharp text
14 | *.vb text
15 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @Blackburn29 @Zero1UP
2 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: nuget
4 | directory: "/src/Fragment.NetSlum.Console"
5 | schedule:
6 | interval: weekly
7 | open-pull-requests-limit: 5
8 | - package-ecosystem: nuget
9 | directory: "/src/Fragment.NetSlum.Server"
10 | schedule:
11 | interval: weekly
12 | open-pull-requests-limit: 5
13 |
--------------------------------------------------------------------------------
/.github/workflows/test-build.yml:
--------------------------------------------------------------------------------
1 | name: Docker Image CI
2 |
3 | on:
4 | push:
5 | branches: [ "master" ]
6 | pull_request:
7 | branches: [ "master" ]
8 |
9 | jobs:
10 | build:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v3
14 | - name: Build image and run tests
15 | run: docker build . --file Dockerfile --target testrunner --tag fragment-netslum:${{ github.ref_name }}-${{github.run_number}}
16 |
--------------------------------------------------------------------------------
/.run/Fragment.NetSlum.Server.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS base
2 | WORKDIR /app
3 | EXPOSE 80
4 |
5 | FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
6 | WORKDIR /srv
7 | COPY Fragment.NetSlum.sln .
8 | COPY src/. src/.
9 |
10 | RUN dotnet restore src/Fragment.NetSlum.Server
11 |
12 | FROM build as testrunner
13 | COPY test/. test/.
14 | RUN dotnet test -c Release --filter "Category=Unit" /p:CollectCoverage=true /p:ExcludeByFile="**/Migrations/*.cs" /p:CoverletOutput='/test/build/' /p:CoverletOutputFormat='json%2ccobertura' /p:MergeWith='/test/build/coverage.json'
15 |
16 | FROM build AS publish
17 | WORKDIR /srv/src/Fragment.NetSlum.Server
18 |
19 | RUN dotnet publish Fragment.NetSlum.Server.csproj -c Release --runtime linux-x64 -o /app --self-contained
20 |
21 | WORKDIR /srv/src/Fragment.NetSlum.Console
22 | RUN dotnet publish Fragment.NetSlum.Console.csproj -c Release --runtime linux-x64 -o /app/console --self-contained
23 |
24 | FROM base AS final
25 | EXPOSE 49000
26 |
27 | WORKDIR /app
28 | COPY --from=publish /app .
29 | CMD ["./Fragment.NetSlum.Server"]
30 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # Example docker-compose setup for running Fragment.NetSlum in a containerized environment.
2 | #
3 | # *The configuration defined here is for testing purposes only and should not be used in
4 | # a production environment.
5 | #
6 | # For more information, see:
7 | # https://docs.docker.com/compose/yml/
8 | version: '3.4'
9 | services:
10 | fragment_server:
11 | image: psrewired/fragment-netslum
12 | build:
13 | context: .
14 | target: final
15 | ports:
16 | - '49000:49000' #Game Server
17 | - '5000:5000' #API
18 | environment:
19 | - ASPNETCORE_URLS=http://+:5000
20 | - ConnectionStrings__Database=server=fragment_mysql;port=3306;database=fragment_redux;username=root;password=d3ve10pm3nt;
21 | - Serilog__MinimumLevel__Default=Information
22 | depends_on:
23 | - fragment_mysql
24 |
25 | fragment_mysql:
26 | image: 'mysql:8'
27 | ports:
28 | - '3308:3306'
29 | environment:
30 | MYSQL_ROOT_PASSWORD: 'd3ve10pm3nt'
31 | restart: always
32 |
--------------------------------------------------------------------------------
/docs/about/contributing.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 | ___
3 | ## Reporting issues
4 | We appreciate contributions of any kind, including bug reports. Please use the issue
5 | tracker [Here](http://github.com/PSRewired/FragmentServer/issues)
6 | to report any issues or concerns you may have.
7 |
8 | ### Issue formatting
9 | When filing an issue, please try and be as descriptive as possible. It is heavily appreciated if you are
10 | able to provide us with the steps used in order to reproduce the problem. You may also file issues to
11 | track new features that you which to see implemented or plan to implement yourself.
12 |
13 | Issues filed for the following reasons will be ignored/closed:
14 | - Generalized questions including (but not limited to) software support, installation support
15 | - Off Topic discussions that are not related to this repository or the information within it
16 |
17 | ## Contributing Code or Documentation Changes
18 | All contributions are accepted for review and must be submitted as Pull-Requests for the
19 | [CODEOWNERS](/.github/CODEOWNERS) to review. It is never a guarantee that your code will be merged
20 | and you should be receptive to feedback at any time.
21 |
22 | For what we expect in contributions, please review our [Coding Guidelines](coding-style.md)
23 |
--------------------------------------------------------------------------------
/docs/about/license.md:
--------------------------------------------------------------------------------
1 | # License
2 | FragmentServer is licensed under GPLv3. For more information please view the included license in the
3 | project which can be found [Here](https://github.com/PSRewired/FragmentServer/LICENSE)
4 |
--------------------------------------------------------------------------------
/docs/about/project-overview.md:
--------------------------------------------------------------------------------
1 | # Project Overview
2 | ---
3 |
4 | ## Application Hierarchy
5 | 
6 |
7 | ## Project Structure
8 | This application strives to keep application code separated using the principles of
9 | [Clean Architecture](https://learn.microsoft.com/en-us/dotnet/architecture/modern-web-apps-azure/common-web-application-architectures#clean-architectureI)
10 |
11 | The TL;DR of this is:
12 | - Separate code by concern. (Ex: database models do not belong in the Networking project)
13 | - Attempt to stick to SOLID principles by making each function have **one** purpose only. Split logic into private singular functions
14 | if necessary
15 | - Project structure should closely resemble an "onion" by separating logic into new projects/libraries as deemed necessary
16 | - Follow the [Rule of Three](https://en.wikipedia.org/wiki/Rule_of_three_(computer_programming)) when creating abstractions
17 |
--------------------------------------------------------------------------------
/docs/hosting/area-server-hosting.md:
--------------------------------------------------------------------------------
1 | # Hosting an Area Server
2 |
3 | ## Patching the Area Server Executable
4 | - Download the latest release of the [Fragment Patcher](https://github.com/Zero1UP/dot-Hack-Fragment-Patcher/releases/latest)
5 | - Open the AreaServer executable in the patcher and update the IP address to the server you wish to connect to
6 | - Click Patch.
7 | - No prompt will be given, but you may now close the patcher tool.
8 |
9 | ## Assigning your server to a specific category
10 | By design, the lobby server support the use of multiple defined AreaServer categories. By default, area servers will
11 | be assigned to the "Main" category unless the following format is used in the server's name. `|` (Ex: Test|MyAreaServer)
12 |
13 | Using the above format will instruct the lobby server to assign your AreaServer to the specified category within the game.
14 | If the category does not exist, the full name of your AreaServer will be used and assigned to the "Main" category.
15 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | # .hack//Frägment Technical Overview and Documentation
2 | ___
3 |
4 | ## Table of Contents
5 | 1. [Networking and Messaging](networking/index.md)
6 | 2. [Project Design Overview](about/project-overview.md)
7 | 3. [Contributing to the project](about/contributing.md)
8 | 4. [License](about/license.md)
9 | 5. [Hosting an Area Server](hosting/area-server-hosting.md)
10 |
--------------------------------------------------------------------------------
/docs/networking/encoding.md:
--------------------------------------------------------------------------------
1 | # Fragment Binary Message Framing
2 | ___
3 |
4 | ## Endianness
5 | - Primitive types (int,short, etc) are represented in big-endian notation.
6 |
7 | ## Text Encoding
8 | - Initially it was thought that the game was encoding using Shift-JIS strings, however during the development of this project,
9 | it was determined to be partially incorrect. The game, since it supports control characters, uses [MS/CP932](https://en.wikipedia.org/wiki/Code_page_932)
10 | for its encoding and expect all strings to be null-terminated.
11 |
12 | ## Image Encoding
13 | Images in Fragment are encoded in [TGA/TARGA](http://www.paulbourke.net/dataformats/tga/) format using 32-bit color depth, RGB colorspace, and Top-Left orientation.
14 |
15 | ### Known Image Usage
16 | - News posts require an image size of 128x128px
17 |
18 |
--------------------------------------------------------------------------------
/docs/networking/index.md:
--------------------------------------------------------------------------------
1 | # Networking and Message Framing
2 | Documentation for Fragment's networking infrastructure and messaging architecture
3 | ___
4 |
5 | ## Table of Contents
6 | 1. [Message Framing](framing.md)
7 | 1. [Message Encoding](encoding.md)
8 |
--------------------------------------------------------------------------------
/docs/static/fragment.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PSRewired/FragmentServer/7276b8216d3b188fe65b5e2d3fd22944341b60d0/docs/static/fragment.jpg
--------------------------------------------------------------------------------
/docs/static/project_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PSRewired/FragmentServer/7276b8216d3b188fe65b5e2d3fd22944341b60d0/docs/static/project_diagram.png
--------------------------------------------------------------------------------
/mkdocs.yml:
--------------------------------------------------------------------------------
1 | site_name: FragmentServer
2 | site_url: https://www.mkdocs.org/
3 | site_description: A emulated server for the game .hack//Frägment
4 | site_author: PSRewired
5 |
6 | repo_url: https://github.com/PSRewired/FragmentServer/
7 | edit_uri: blob/master/docs/
8 |
9 | theme:
10 | name: mkdocs
11 | locale: en
12 |
13 | nav:
14 | - Home: index.md
15 | - Networking and Messaging: networking/
16 | - About:
17 | - Contributing: about/contributing.md
18 | - License: about/license.md
19 |
20 | markdown_extensions:
21 | - toc:
22 | permalink:
23 |
24 | copyright: Copyright © 2023 PSRewired
25 |
26 | plugins:
27 | - search
28 |
--------------------------------------------------------------------------------
/src/Fragment.NetSlum.Console/DependencyInjection/TypeRegistrar.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using Spectre.Console.Cli;
4 |
5 | namespace Fragment.NetSlum.Console.DependencyInjection;
6 |
7 | public sealed class TypeRegistrar : ITypeRegistrar
8 | {
9 | private readonly IServiceCollection _builder;
10 |
11 | public TypeRegistrar(IServiceCollection builder)
12 | {
13 | _builder = builder;
14 | }
15 |
16 | public ITypeResolver Build()
17 | {
18 | return new TypeResolver(_builder.BuildServiceProvider());
19 | }
20 |
21 | public void Register(Type service, Type implementation)
22 | {
23 | _builder.AddSingleton(service, implementation);
24 | }
25 |
26 | public void RegisterInstance(Type service, object implementation)
27 | {
28 | _builder.AddSingleton(service, implementation);
29 | }
30 |
31 | public void RegisterLazy(Type service, Func