cemu-DS4Windows/DS4Windows/HidLibrary/Extensions.cs

19 lines
491 B
C#
Raw Normal View History

using System.Text;
namespace DS4Windows
{
public static class Extensions
{
public static string ToUTF8String(this byte[] buffer)
{
var value = Encoding.UTF8.GetString(buffer);
return value.Remove(value.IndexOf((char)0));
}
public static string ToUTF16String(this byte[] buffer)
{
var value = Encoding.Unicode.GetString(buffer);
return value.Remove(value.IndexOf((char)0));
}
}
}