Skip to content

Integration - #28

Merged
Spi3lot merged 135 commits into
mainfrom
integration
May 13, 2026
Merged

Spi3lot merged 135 commits into
mainfrom
integration

Conversation

@Spi3lot

@Spi3lot Spi3lot commented May 13, 2026

Copy link
Copy Markdown
Owner

Fix #1, #8, #10, #11, #13, #16, #17, #18, #20, #23 and #24

Spi3lot and others added 30 commits March 29, 2026 22:46
- Implement clientbound KeepAlivepacket
- Pass ServerService to ClientHandler
- Make use of the above points in StatusRequestPacket
- Refactor ServerStatus
- Add Information property to ClientHandler
- Make source gen add 'new' keyword to State and Id of IPacket for packet inheritance to work without warnings
Added notes about Sharpmine.AppHost and Sharpmine.ServiceDefaults for future use.
- Add static extension methdos to System.Threading.Channels.Channel itself for creating Clientbound/Serverbound channels
- Make ProcessAsync take way fewer parameters and return ValueTask instead of Task since it rarely ever actually has async implementations
- Move LoggerMessage partial methods to separate file if the main file got too cluttered
- Make use of System.Threading.Channels
- Add static extension methdos to System.Threading.Channels.Channel itself for creating Clientbound/Serverbound channels
- Make ProcessAsync take way fewer parameters and return ValueTask instead of Task since it rarely ever actually has async implementations
- Move LoggerMessage partial methods to separate file if the main file got too cluttered
- Rename SwitchProtocolState to TransitionTo
- Update logging messages accordingly
# Conflicts:
#	Sharpmine.Server/Protocol/ClientHandler.Logging.cs
#	Sharpmine.Server/Protocol/ClientHandler.cs
#	Sharpmine.Server/Protocol/ClientHandlerFactory.cs
#	Sharpmine.Server/Protocol/Packets/Configuration/Serverbound/FinishConfigurationPacket.cs
#	Sharpmine.Server/Protocol/Packets/Handshake/Serverbound/IntentionPacket.cs
#	Sharpmine.Server/Protocol/Packets/Login/Serverbound/LoginAcknowledgedPacket.cs
- Put parameters of ProcessAsync into a single line
- Make it read a normal Int64 (long) instead of a 7BitEncodedInt64
- Make it not disconnect as that should be handled from the client side automatically and is only necessary for legacy pings
- Add explicit interface (re-)implementations instead of "abstract-cascading"
- Remove new keyword in auto-generated code to avoid warnings, as this was only required back when I used to inherit from concrete packets
- Cancel CTS only in Disconnect[Async] so that Dispose[Async] does not have to be called multiple times anymore
- Add TODO in ServerService
- Disable ReSharper hint to invert it back to its original state
… and handling those transitions synchronously before even enqueueing the packet that caused the state transition

- Remove 'ReSharper disable once InvertIf' in favor of just hiding the error in Rider
… the [de]serialization and processing of packets

- Add ProtocolResult enum
- Add ProtocolException class
…disconnect process when encountering a legacy packet, which is now handled in an entirely differnet way
- Delete ProtocolResult
- Delete ProtocolException
- Change return type of ProcessAsync from ProtocolResult to void
- Change return type of DeserializeContent from ProtocolResult to bool
- Change return type of SerializeContent from Task to void
- Make SerializeContent synchronous
- Make Read/WriteJson synchronous
- Handle ServerboundPackets of length 0
- Move write/process task awaiting logic into finally-block
…ent tense as it is always called prior to Disconnect[Async]
Spi3lot and others added 14 commits May 10, 2026 23:46
- Change parameter of DisconnectAsync from string to IClientboundPacket to make the last sent packet before attempt a graceful abortion dynamic
- Provide a new overload for DisconnectAsync instead, which accepts a string again and then chooses the correct way to handle it based on the current state
- Add log method for disconnect requested in state no disconnect packet exists in
- Fix #20 along the way (Properly update ListViews in GUI instead of clearing and refilling them)
- Fix #1 along the way (Add indicator to represent different connection states of clients in GUI)
- Use ObservableCollection instead of Lists+Events
- Make Program.Main synchronous to prevent STAThread error
- Add System.IO to GlobalUsings.cs
#24 Drop WinForms entirely and switch to WPF

- Fix #20 along the way (Properly update ListViews in GUI instead of clearing and refilling them)
- Fix #1 along the way (Add indicator to represent different connection states of clients in GUI)
- Use ObservableCollection instead of Lists+Events
- Make Program.Main synchronous to prevent STAThread error
- Add System.IO to GlobalUsings.cs
…nection is in progress

- Fix race condition in SendPacket by checking _disconnecting after attempting to write
- Completely rewrite BinaryReaderExtensions to SequenceReaderExtensions
- Completely rewrite BinaryWriterExtensions to BufferWriterExtensions
- Move json (de)serialization logic from extensions for Stream to extensions for SequenceReader<byte>/IBufferWriter<byte> and improve underlying logic along the way
- Fix #23 along the way (Get rid of delegate allocations when reading/writing optionals and arrays)
- Rewrite packet deserialization using try-pattern, turning TSelf from IServerboundDataType covariant back to invariant to make it usable as an out-parameter
- Make network-transmitted enums use int as underlying type again to go hand in hand with VarInt and for easier deserialization using the new logic with int as default
- Fix legacy ping check for versions prior to 1.4 (which send only 0xFE with nothing after)
#10 Use System.IO.Pipelines instead of BinaryReader/Writer
#23 Get rid of delegate allocations when reading/writing optionals and arrays
- Register PacketTransmitter as transient
- Register PacketReceiver as singleton
- Vastly improve ClientHandlerFactory using ActivatorUtilities instead of manual instantiation
… Core as the main project

This allows for other operating systems to run Sharpmine, as WPF was the only thing tying it to Windows

- Adapt all namespaces and usings thereof
- Add HostApplicationBuilderExtensions.AddCoreServices for easy addition of all that's necessary to integrate Sharpmine.Server.Core into a project
- Improve configuration addition of server.properties, using builder.Configuration instead of a custom ConfigurationBuilder
- Replace Scrutor's .FromEntryAssembly with .FromAssemblyOf<ServerService> because now the entry assembly is not the same as the one of IPacketHandler<> anymore
- Upgrade dependencies and unnecessary (e.g. transient or even entirely unused) ones
- Move appsettings.json and appsettings.Development.json to SharedConfig folder, sharing it between Sharpmine.Server.Console and Sharpmine.Server.Wpf
- Adapt to project restructuring
- Improve general project description, adding more detailed/accurate explanations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment