M Samples/InterceptNameChanger/NameChanger.cs => Samples/InterceptNameChanger/NameChanger.cs +10 -0
@@ 14,6 14,8 @@ using NosSmooth.LocalClient;
using NosSmooth.LocalClient.Extensions;
using NosSmooth.Packets.Enums;
using NosSmooth.Packets.Enums.Chat;
+using NosSmooth.Packets.Extensions;
+using NosSmooth.Packets.Packets;
using NosSmooth.Packets.Server.Chat;
namespace InterceptNameChanger
@@ 57,6 59,14 @@ namespace InterceptNameChanger
logger.LogResultError(initializeResult);
}
+ var packetTypesRepository = provider.GetRequiredService<IPacketTypesRepository>();
+ var packetAddResult = packetTypesRepository.AddDefaultPackets();
+ if (!packetAddResult.IsSuccess)
+ {
+ logger.LogError("Could not initialize default packet serializers correctly");
+ logger.LogResultError(packetAddResult);
+ }
+
var client = provider.GetRequiredService<INostaleClient>();
var sayResult = await client.ReceivePacketAsync
M Samples/SimpleChat/SimpleChat.cs => Samples/SimpleChat/SimpleChat.cs +10 -0
@@ 12,6 12,8 @@ using NosSmooth.LocalBinding;
using NosSmooth.LocalClient.Extensions;
using NosSmooth.Packets.Enums;
using NosSmooth.Packets.Enums.Chat;
+using NosSmooth.Packets.Extensions;
+using NosSmooth.Packets.Packets;
using NosSmooth.Packets.Server.Chat;
namespace SimpleChat;
@@ 52,6 54,14 @@ public class SimpleChat
logger.LogResultError(initializeResult);
}
+ var packetTypesRepository = provider.GetRequiredService<IPacketTypesRepository>();
+ var packetAddResult = packetTypesRepository.AddDefaultPackets();
+ if (!packetAddResult.IsSuccess)
+ {
+ logger.LogError("Could not initialize default packet serializers correctly");
+ logger.LogResultError(packetAddResult);
+ }
+
var client = provider.GetRequiredService<INostaleClient>();
await client.ReceivePacketAsync
M Samples/WalkCommands/Startup.cs => Samples/WalkCommands/Startup.cs +10 -0
@@ 12,6 12,8 @@ using NosSmooth.Core.Extensions;
using NosSmooth.LocalBinding;
using NosSmooth.LocalClient;
using NosSmooth.LocalClient.Extensions;
+using NosSmooth.Packets.Extensions;
+using NosSmooth.Packets.Packets;
using Remora.Commands.Extensions;
using WalkCommands.Commands;
@@ 64,6 66,14 @@ public class Startup
logger.LogResultError(initializeResult);
}
+ var packetTypesRepository = provider.GetRequiredService<IPacketTypesRepository>();
+ var packetAddResult = packetTypesRepository.AddDefaultPackets();
+ if (!packetAddResult.IsSuccess)
+ {
+ logger.LogError("Could not initialize default packet serializers correctly");
+ logger.LogResultError(packetAddResult);
+ }
+
var mainCancellation = provider.GetRequiredService<CancellationTokenSource>();
var client = provider.GetRequiredService<INostaleClient>();