コード例 #1
0
        public static string GetJoystickName(int joystickNum)
        {
            byte * name    = lowLevel.HAL_GetJoystickName(joystickNum);
            string strName = UTF8String.ReadUTF8String(name);

            lowLevel.HAL_FreeJoystickName(name);
            return(strName);
        }
コード例 #2
0
 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;
 }
コード例 #3
0
ファイル: EntryInfo.cs プロジェクト: robotdotnet/WPILib
 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;
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        public unsafe void TestReadWorksNullTerminator()
        {
            byte *testBytes = stackalloc byte[] {
                72,
                101,
                108,
                108,
                111,
                0 // Hello
            };

            var str = UTF8String.ReadUTF8String(testBytes);

            Assert.Equal("Hello", str);
        }
    }