// <copyright file="ConnectionManager.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
//------------------------------------------------------------------------------
// <auto-generated>
// This source code was auto-generated by an XSL transformation.
// Do not change this file. Instead, change the XML data which contains
// the packet definitions and re-run the transformation (publish/rebuild the
// client library project).
// </auto-generated>
//------------------------------------------------------------------------------
// ReSharper disable RedundantVerbatimPrefix
// ReSharper disable AssignmentIsFullyDiscarded
// ReSharper disable UnusedMember.Global
// ReSharper disable UseObjectOrCollectionInitializer
#nullable enable
namespace MUnique.Client.Library;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using MUnique.OpenMU.Network;
using MUnique.OpenMU.Network.Packets;
using MUnique.OpenMU.Network.Packets.;
/// <summary>
/// Extension methods to start writing messages of this namespace on a <see cref="IConnection"/>.
/// </summary>
public unsafe partial class ConnectionManager
{
}
/// <summary>
/// Sends a <see cref="
" /> to this connection.
/// </summary>
/// <param name="handle">The handle of the connection.</param>
[UnmanagedCallersOnly(EntryPoint = "Send
")]
public static void
Send
(int handle
,
)
{
if (!Connections.TryGetValue(handle, out var connection))
{
return;
}
try
{
connection.CreateAndSend(pipeWriter =>
{
var length =
Ref.Length
Ref.GetRequiredSize(
)
throw new NotImplementedException()
;
var packet = new
Ref(pipeWriter.GetSpan(length)[..length]);
return length;
});
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
(int)
ByteLength
Encoding.UTF8.GetByteCount(Marshal.PtrToStringAuto(@
)!)
/// <param name="
">
The
.
</param>
/// <param name="
ByteLength
">The length of <paramref name="
"/>.
</param>
Memory<byte>
1
,
@
=
, uint
ByteLength
,
@
new Span<byte>(@
, (int)
ByteLength).CopyTo(packet.
);
packet.
= @
== 1;
packet.
= Marshal.PtrToStringAuto(@
);
packet.
= new Span<byte>(@
, (int)
ByteLength);
packet.
= @
;
/// <remarks>
/// Is sent
by the client when:
by the server when:
/// Causes reaction
on server side:
on client side:
/// </remarks>