Initial Client/Server Communication
#1 Followed the MagicOnion quickstart guide, borrowing code from the chat sample app to get something working
This commit is contained in:
parent
52b0d4d8ff
commit
a0c8dbee72
493 changed files with 57790 additions and 3 deletions
31
Assets/Scripts/MessagePack/StringEncoding.cs
Normal file
31
Assets/Scripts/MessagePack/StringEncoding.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (c) All contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace MessagePack
|
||||
{
|
||||
internal static class StringEncoding
|
||||
{
|
||||
internal static readonly Encoding UTF8 = new UTF8Encoding(false);
|
||||
|
||||
#if !NETCOREAPP2_1 // Define the extension method only where an instance method does not already exist.
|
||||
internal static unsafe string GetString(this Encoding encoding, ReadOnlySpan<byte> bytes)
|
||||
{
|
||||
if (bytes.Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
fixed (byte* pBytes = bytes)
|
||||
{
|
||||
return encoding.GetString(pBytes, bytes.Length);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue