public static string GetJoystickName(int joystickNum) { byte * name = lowLevel.HAL_GetJoystickName(joystickNum); string strName = UTF8String.ReadUTF8String(name); lowLevel.HAL_FreeJoystickName(name); return(strName); }
internal unsafe ConnectionInfo(NtConnectionInfo *info) { RemoteId = UTF8String.ReadUTF8String(info->remote_id.str, info->remote_id.len); RemoteIp = UTF8String.ReadUTF8String(info->remote_ip.str, info->remote_ip.len); RemotePort = (int)info->remote_port; LastUpdate = (long)info->last_update; ProtocolVersion = (int)info->protocol_version; }
internal unsafe EntryInfo(NetworkTableInstance instance, NtEntryInfo *entryInfo) { EntryHandle = entryInfo->entry; Type = (NtType)entryInfo->type; Flags = (EntryFlags)entryInfo->flags; LastChange = (long)entryInfo->last_change; Name = UTF8String.ReadUTF8String(entryInfo->name.str, (int)entryInfo->name.len); m_instance = instance; }
public unsafe void TestReadWorksCorrectly() { byte *testBytes = stackalloc byte[] { 72, 101, 108, 108, 111, 0 // Hello }; var str = UTF8String.ReadUTF8String(testBytes, 5); Assert.Equal("Hello", str); }
public unsafe void TestReadWorksNullTerminator() { byte *testBytes = stackalloc byte[] { 72, 101, 108, 108, 111, 0 // Hello }; var str = UTF8String.ReadUTF8String(testBytes); Assert.Equal("Hello", str); } }