1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
using System;
using System.Runtime.InteropServices;
namespace Steamworks;
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct SteamNetworkingIdentity : IEquatable<SteamNetworkingIdentity>
{
public ESteamNetworkingIdentityType m_eType;
private int m_cbSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
private uint[] m_reserved;
public const int k_cchMaxString = 128;
public const int k_cchMaxGenericString = 32;
public const int k_cbMaxGenericBytes = 32;
public void Clear()
{
NativeMethods.SteamAPI_SteamNetworkingIdentity_Clear(ref this);
}
public bool IsInvalid()
{
return NativeMethods.SteamAPI_SteamNetworkingIdentity_IsInvalid(ref this);
}
public void SetSteamID(CSteamID steamID)
{
NativeMethods.SteamAPI_SteamNetworkingIdentity_SetSteamID(ref this, (ulong)steamID);
}
public CSteamID GetSteamID()
{
return (CSteamID)NativeMethods.SteamAPI_SteamNetworkingIdentity_GetSteamID(ref this);
}
public void SetSteamID64(ulong steamID)
{
NativeMethods.SteamAPI_SteamNetworkingIdentity_SetSteamID64(ref this, steamID);
}
public ulong GetSteamID64()
{
return NativeMethods.SteamAPI_SteamNetworkingIdentity_GetSteamID64(ref this);
}
public void SetIPAddr(SteamNetworkingIPAddr addr)
{
NativeMethods.SteamAPI_SteamNetworkingIdentity_SetIPAddr(ref this, ref addr);
}
public SteamNetworkingIPAddr GetIPAddr()
{
throw new NotImplementedException();
}
public void SetLocalHost()
{
NativeMethods.SteamAPI_SteamNetworkingIdentity_SetLocalHost(ref this);
}
public bool IsLocalHost()
{
return NativeMethods.SteamAPI_SteamNetworkingIdentity_IsLocalHost(ref this);
}
public bool SetGenericString(string pszString)
{
using InteropHelp.UTF8StringHandle pszString2 = new InteropHelp.UTF8StringHandle(pszString);
return NativeMethods.SteamAPI_SteamNetworkingIdentity_SetGenericString(ref this, pszString2);
}
public string GetGenericString()
{
return InteropHelp.PtrToStringUTF8(NativeMethods.SteamAPI_SteamNetworkingIdentity_GetGenericString(ref this));
}
public bool SetGenericBytes(byte[] data, uint cbLen)
{
return NativeMethods.SteamAPI_SteamNetworkingIdentity_SetGenericBytes(ref this, data, cbLen);
}
public byte[] GetGenericBytes(out int cbLen)
{
throw new NotImplementedException();
}
public bool Equals(SteamNetworkingIdentity x)
{
return NativeMethods.SteamAPI_SteamNetworkingIdentity_IsEqualTo(ref this, ref x);
}
public void ToString(out string buf)
{
IntPtr intPtr = Marshal.AllocHGlobal(128);
NativeMethods.SteamNetworkingIdentity_ToString(ref this, intPtr, 128u);
buf = InteropHelp.PtrToStringUTF8(intPtr);
Marshal.FreeHGlobal(intPtr);
}
public bool ParseString(string pszStr)
{
using InteropHelp.UTF8StringHandle pszStr2 = new InteropHelp.UTF8StringHandle(pszStr);
return NativeMethods.SteamNetworkingIdentity_ParseString(ref this, pszStr2);
}
}
|