You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using System.Text;
|
|
|
|
|
|
namespace HidLibrary
|
|
|
{
|
|
|
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));
|
|
|
}
|
|
|
}
|
|
|
}
|