Unstable 1.8.4.0
This commit is contained in:
@@ -210,7 +210,7 @@ namespace Steamworks.Data
|
||||
internal static extern bool InternalIsIPv6AllZeros( ref NetAddress self );
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIPAddr_SetIPv6", CallingConvention = Platform.CC)]
|
||||
internal static extern void InternalSetIPv6( ref NetAddress self, ref byte ipv6, ushort nPort );
|
||||
internal static extern void InternalSetIPv6( ref NetAddress self, IntPtr ipv6, ushort nPort );
|
||||
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIPAddr_SetIPv4", CallingConvention = Platform.CC)]
|
||||
internal static extern void InternalSetIPv4( ref NetAddress self, uint nIP, ushort nPort );
|
||||
|
||||
@@ -60,18 +60,33 @@ namespace Steamworks.Data
|
||||
/// Specific IP, specific port
|
||||
/// </summary>
|
||||
public static NetAddress From( IPAddress address, ushort port )
|
||||
{
|
||||
var addr = address.GetAddressBytes();
|
||||
{
|
||||
var local = Cleared;
|
||||
switch (address.AddressFamily)
|
||||
{
|
||||
case System.Net.Sockets.AddressFamily.InterNetwork:
|
||||
InternalSetIPv4(ref local, address.IpToInt32(), port);
|
||||
return local;
|
||||
case System.Net.Sockets.AddressFamily.InterNetworkV6:
|
||||
var ptr = GetIpv6AddressBytesPtr(address);
|
||||
InternalSetIPv6(ref local, ptr, port);
|
||||
FreeMemory(ptr);
|
||||
return local;
|
||||
default:
|
||||
throw new System.NotImplementedException( $"Oops - no {address.AddressFamily} support yet?" );
|
||||
}
|
||||
|
||||
if ( address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork )
|
||||
{
|
||||
var local = Cleared;
|
||||
InternalSetIPv4( ref local, Utility.IpToInt32( address ), port );
|
||||
return local;
|
||||
}
|
||||
static System.IntPtr GetIpv6AddressBytesPtr(IPAddress address)
|
||||
{
|
||||
byte[] bytes = address.GetAddressBytes();
|
||||
var unmanagedPointer = Marshal.AllocHGlobal(bytes.Length);
|
||||
Marshal.Copy(bytes, 0, unmanagedPointer, bytes.Length);
|
||||
return unmanagedPointer;
|
||||
}
|
||||
|
||||
throw new System.NotImplementedException( "Oops - no IPV6 support yet?" );
|
||||
}
|
||||
void FreeMemory(System.IntPtr unmanagedMemory)
|
||||
=> Marshal.FreeHGlobal(unmanagedMemory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set everything to zero
|
||||
|
||||
@@ -116,10 +116,10 @@ namespace Steamworks.Ugc
|
||||
/// The number of downvotes of this item
|
||||
/// </summary>
|
||||
public uint VotesDown => details.VotesDown;
|
||||
/// <summary>
|
||||
/// Dependencies/children of this item or collection, available only from WithDependencies(true) queries
|
||||
/// </summary>
|
||||
public PublishedFileId[]? Children;
|
||||
/// <summary>
|
||||
/// Dependencies/children of this item or collection, available only from WithChildren(true) queries
|
||||
/// </summary>
|
||||
public PublishedFileId[]? Children;
|
||||
|
||||
/// <summary>
|
||||
/// Additional previews of this item or collection, available only from WithAdditionalPreviews(true) queries
|
||||
|
||||
Reference in New Issue
Block a user