mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-10 02:35:42 +00:00
Cleanup
This commit is contained in:
parent
80f30b36bb
commit
bac905e742
@ -28,16 +28,11 @@ internal static class NativeMethods
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_connect_universe(nint instance,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string host,
|
||||
int port);
|
||||
public static extern int vp_connect_universe(nint instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string host, int port);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_login(nint instance,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string username,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string password,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string botname);
|
||||
public static extern int vp_login(nint instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string username, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string password, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string botname);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
@ -45,8 +40,7 @@ internal static class NativeMethods
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_enter(nint instance,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string world_name);
|
||||
public static extern int vp_enter(nint instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string world_name);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
@ -54,32 +48,19 @@ internal static class NativeMethods
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_say(
|
||||
nint instance,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string message);
|
||||
public static extern int vp_say(nint instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string message);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_console_message(nint instance,
|
||||
int session,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string name,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string message,
|
||||
int effects,
|
||||
byte red,
|
||||
byte green,
|
||||
byte blue);
|
||||
public static extern int vp_console_message(nint instance, int session, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string name, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string message, int effects, byte red, byte green, byte blue);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_event_set(nint instance,
|
||||
[MarshalAs(UnmanagedType.I4)] NativeEvent event_name,
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)] NativeEventHandler @event);
|
||||
public static extern int vp_event_set(nint instance, [MarshalAs(UnmanagedType.I4)] NativeEvent event_name, [MarshalAs(UnmanagedType.FunctionPtr)] NativeEventHandler @event);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_callback_set(nint instance,
|
||||
[MarshalAs(UnmanagedType.I4)] NativeCallback callbackname,
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackHandler callback);
|
||||
public static extern int vp_callback_set(nint instance, [MarshalAs(UnmanagedType.I4)] NativeCallback callbackname, [MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackHandler callback);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
@ -108,34 +89,23 @@ internal static class NativeMethods
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_int_set(nint instance,
|
||||
[MarshalAs(UnmanagedType.I4)] IntegerAttribute name,
|
||||
int value);
|
||||
public static extern int vp_int_set(nint instance, [MarshalAs(UnmanagedType.I4)] IntegerAttribute name, int value);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_float_set(nint instance,
|
||||
[MarshalAs(UnmanagedType.I4)] FloatAttribute name,
|
||||
float value);
|
||||
public static extern int vp_float_set(nint instance, [MarshalAs(UnmanagedType.I4)] FloatAttribute name, float value);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_double_set(nint instance,
|
||||
[MarshalAs(UnmanagedType.I4)] FloatAttribute attr,
|
||||
double value);
|
||||
public static extern int vp_double_set(nint instance, [MarshalAs(UnmanagedType.I4)] FloatAttribute attr, double value);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern void vp_string_set(nint instance,
|
||||
StringAttribute name,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string str);
|
||||
public static extern void vp_string_set(nint instance, StringAttribute name, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string str);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_data_set(nint instance,
|
||||
[MarshalAs(UnmanagedType.I4)] DataAttribute name,
|
||||
int length,
|
||||
byte[] data);
|
||||
public static extern int vp_data_set(nint instance, [MarshalAs(UnmanagedType.I4)] DataAttribute name, int length, byte[] data);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
@ -167,12 +137,7 @@ internal static class NativeMethods
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_object_click(nint instance,
|
||||
int object_id,
|
||||
int session_to,
|
||||
float hit_x,
|
||||
float hit_y,
|
||||
float hit_z);
|
||||
public static extern int vp_object_click(nint instance, int object_id, int session_to, float hit_x, float hit_y, float hit_z);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
@ -192,8 +157,7 @@ internal static class NativeMethods
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_user_attributes_by_name(nint instance,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string name);
|
||||
public static extern int vp_user_attributes_by_name(nint instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string name);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
@ -201,8 +165,7 @@ internal static class NativeMethods
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_friend_add_by_name(nint instance,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string name);
|
||||
public static extern int vp_friend_add_by_name(nint instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string name);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
@ -214,28 +177,17 @@ internal static class NativeMethods
|
||||
public static extern int vp_terrain_query(nint instance, int tile_x, int tile_z, int[,] revision);
|
||||
#pragma warning restore CA1814
|
||||
|
||||
// [DllImport(VpSdkLibrary, CallingConvention=CallingConvention.Cdecl)] public static extern int vp_terrain_node_set(IntPtr instance, int tile_x, int tile_z, int node_x, int node_z, struct vp_terrain_cell_t* cells);
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_avatar_click(nint instance, int avatar_session);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_teleport_avatar(nint instance,
|
||||
int target_session,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string world,
|
||||
float x,
|
||||
float y,
|
||||
float z,
|
||||
float yaw,
|
||||
float pitch);
|
||||
public static extern int vp_teleport_avatar(nint instance, int target_session, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string world, float x, float y, float z, float yaw, float pitch);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_url_send(nint instance,
|
||||
int session_id,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string url,
|
||||
[MarshalAs(UnmanagedType.I4)] UriTarget url_target);
|
||||
public static extern int vp_url_send(nint instance, int session_id, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string url, [MarshalAs(UnmanagedType.I4)] UriTarget url_target);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
@ -243,14 +195,7 @@ internal static class NativeMethods
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_join_accept(nint instance,
|
||||
int requestId,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string world,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
float yaw,
|
||||
float pitch);
|
||||
public static extern int vp_join_accept(nint instance, int requestId, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string world, double x, double y, double z, float yaw, float pitch);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
@ -258,35 +203,19 @@ internal static class NativeMethods
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_world_permission_user_set(nint instance,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string permission,
|
||||
int user_id,
|
||||
int enable);
|
||||
public static extern int vp_world_permission_user_set(nint instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string permission, int user_id, int enable);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_world_permission_session_set(nint instance,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string permission,
|
||||
int session_id,
|
||||
int enable);
|
||||
public static extern int vp_world_permission_session_set(nint instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string permission, int session_id, int enable);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_world_setting_set(nint instance,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string setting,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string value,
|
||||
int session_to);
|
||||
public static extern int vp_world_setting_set(nint instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string setting, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string value, int session_to);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
public static extern int vp_invite(nint instance,
|
||||
int user_id,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string world,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
float yaw,
|
||||
float pitch);
|
||||
public static extern int vp_invite(nint instance, int user_id, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string world, double x, double y, double z, float yaw, float pitch);
|
||||
|
||||
[DllImport(VpSdkLibrary, CallingConvention = CallingConvention.Cdecl)]
|
||||
[DefaultDllImportSearchPaths(SearchPaths)]
|
||||
|
@ -40,12 +40,16 @@ public sealed partial class VirtualParadiseClient
|
||||
|
||||
private async void OnObjectGetNativeCallback(nint sender, ReasonCode reason, int reference)
|
||||
{
|
||||
if (!_objectCompletionSources.TryGetValue(reference, out TaskCompletionSource<(ReasonCode, VirtualParadiseObject)>? taskCompletionSource))
|
||||
if (!_objectCompletionSources.TryGetValue(reference,
|
||||
out TaskCompletionSource<(ReasonCode, VirtualParadiseObject?)>? taskCompletionSource))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VirtualParadiseObject? virtualParadiseObject = reason == ReasonCode.Success ? await ExtractObjectAsync(sender).ConfigureAwait(true) : null;
|
||||
VirtualParadiseObject? virtualParadiseObject = reason == ReasonCode.Success
|
||||
? await ExtractObjectAsync(sender).ConfigureAwait(true)
|
||||
: null;
|
||||
|
||||
taskCompletionSource.SetResult((reason, virtualParadiseObject));
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ public sealed partial class VirtualParadiseClient
|
||||
ObjectType.Model => new VirtualParadiseModelObject(this, id),
|
||||
ObjectType.ParticleEmitter => new VirtualParadiseParticleEmitterObject(this, id),
|
||||
ObjectType.Path => new VirtualParadisePathObject(this, id),
|
||||
var _ => throw new NotSupportedException("Unsupported object type.")
|
||||
_ => throw new NotSupportedException("Unsupported object type.")
|
||||
};
|
||||
|
||||
virtualParadiseObject.ExtractFromInstance(sender);
|
||||
@ -229,6 +229,7 @@ public sealed partial class VirtualParadiseClient
|
||||
virtualParadiseObject.Location = location;
|
||||
virtualParadiseObject.ModificationTimestamp = DateTimeOffset.FromUnixTimeSeconds(time);
|
||||
virtualParadiseObject.Owner = await GetUserAsync(owner).ConfigureAwait(false);
|
||||
|
||||
return virtualParadiseObject;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user