M Samples/SimpleChat/SimpleChat.cs => Samples/SimpleChat/SimpleChat.cs +9 -0
@@ 8,6 8,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NosSmooth.Core.Client;
using NosSmooth.Core.Extensions;
+using NosSmooth.LocalBinding;
using NosSmooth.LocalClient.Extensions;
using NosSmooth.Packets.Enums;
using NosSmooth.Packets.Enums.Chat;
@@ 43,6 44,14 @@ public class SimpleChat
var logger = provider.GetRequiredService<ILogger<SimpleChat>>();
logger.LogInformation("Hello world from SimpleChat!");
+ var bindingManager = provider.GetRequiredService<NosBindingManager>();
+ var initializeResult = bindingManager.Initialize();
+ if (!initializeResult.IsSuccess)
+ {
+ logger.LogError($"Could not initialize the bindings {initializeResult.Error.Message}.");
+ return;
+ }
+
var client = provider.GetRequiredService<INostaleClient>();
await client.ReceivePacketAsync
M Samples/WalkCommands/ChatPacketInterceptor.cs => Samples/WalkCommands/ChatPacketInterceptor.cs +2 -2
@@ 88,8 88,8 @@ public class ChatPacketInterceptor : IPacketInterceptor
var walkCommand = scope.ServiceProvider.GetRequiredService<Commands.WalkCommands>();
result = await walkCommand.HandleWalkToAsync
(
- int.Parse(splitted[1]),
- int.Parse(splitted[2]),
+ ushort.Parse(splitted[1]),
+ ushort.Parse(splitted[2]),
splitted.Length > 3 ? bool.Parse(splitted[3]) : true
);
break;
M Samples/WalkCommands/Startup.cs => Samples/WalkCommands/Startup.cs +12 -0
@@ 7,8 7,12 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NosSmooth.Core.Client;
+using NosSmooth.LocalBinding;
using NosSmooth.LocalClient;
using NosSmooth.LocalClient.Extensions;
+using NosSmooth.Packets.Enums;
+using NosSmooth.Packets.Enums.Chat;
+using NosSmooth.Packets.Packets.Server.Chat;
using WalkCommands.Commands;
namespace WalkCommands;
@@ 43,6 47,14 @@ public class Startup
public async Task RunAsync()
{
var provider = BuildServices();
+ var bindingManager = provider.GetRequiredService<NosBindingManager>();
+ var logger = provider.GetRequiredService<ILogger<Startup>>();
+ var initializeResult = bindingManager.Initialize();
+ if (!initializeResult.IsSuccess)
+ {
+ logger.LogError($"Could not initialize {initializeResult.Error.Message}.");
+ }
+
var mainCancellation = provider.GetRequiredService<CancellationTokenSource>();
var client = provider.GetRequiredService<INostaleClient>();