1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-10 02:55:41 +00:00

Discard native return values when irrelevant

This commit is contained in:
Oliver Booth 2022-11-30 18:37:07 +00:00
parent 775f068fe7
commit 17e3795eeb
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
11 changed files with 34 additions and 34 deletions

View File

@ -281,7 +281,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
lock (_client.Lock)
{
vp_url_send(_client.NativeInstanceHandle, Session, uri.ToString(), target);
_ = vp_url_send(_client.NativeInstanceHandle, Session, uri.ToString(), target);
}
return Task.CompletedTask;
@ -369,11 +369,11 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
(double x, double y, double z) = position;
(double pitch, double yaw, double _) = rotation.ToEulerAngles(false);
vp_double_set(handle, FloatAttribute.MyX, x);
vp_double_set(handle, FloatAttribute.MyY, y);
vp_double_set(handle, FloatAttribute.MyZ, z);
vp_double_set(handle, FloatAttribute.MyPitch, pitch);
vp_double_set(handle, FloatAttribute.MyYaw, yaw);
_ = vp_double_set(handle, FloatAttribute.MyX, x);
_ = vp_double_set(handle, FloatAttribute.MyY, y);
_ = vp_double_set(handle, FloatAttribute.MyZ, z);
_ = vp_double_set(handle, FloatAttribute.MyPitch, pitch);
_ = vp_double_set(handle, FloatAttribute.MyYaw, yaw);
var reason = (ReasonCode)vp_state_change(handle);
if (reason == ReasonCode.NotInWorld)

View File

@ -125,9 +125,9 @@ public sealed class VirtualParadiseModelObjectBuilder : VirtualParadiseObjectBui
if (Position is { } position)
{
(double x, double y, double z) = position;
vp_double_set(handle, FloatAttribute.ObjectX, x);
vp_double_set(handle, FloatAttribute.ObjectY, y);
vp_double_set(handle, FloatAttribute.ObjectZ, z);
_ = vp_double_set(handle, FloatAttribute.ObjectX, x);
_ = vp_double_set(handle, FloatAttribute.ObjectY, y);
_ = vp_double_set(handle, FloatAttribute.ObjectZ, z);
}
else if (Mode == ObjectBuilderMode.Create)
{
@ -149,10 +149,10 @@ public sealed class VirtualParadiseModelObjectBuilder : VirtualParadiseObjectBui
(x, y, z) = axis;
}
vp_double_set(handle, FloatAttribute.ObjectRotationX, x);
vp_double_set(handle, FloatAttribute.ObjectRotationY, y);
vp_double_set(handle, FloatAttribute.ObjectRotationZ, z);
vp_double_set(handle, FloatAttribute.ObjectRotationAngle, angle);
_ = vp_double_set(handle, FloatAttribute.ObjectRotationX, x);
_ = vp_double_set(handle, FloatAttribute.ObjectRotationY, y);
_ = vp_double_set(handle, FloatAttribute.ObjectRotationZ, z);
_ = vp_double_set(handle, FloatAttribute.ObjectRotationAngle, angle);
}
if (ModificationTimestamp is { } modificationTimestamp)
@ -162,7 +162,7 @@ public sealed class VirtualParadiseModelObjectBuilder : VirtualParadiseObjectBui
throw new InvalidOperationException("Modification timestamp can only be assigned during an object load.");
}
vp_int_set(handle, IntegerAttribute.ObjectTime, (int) modificationTimestamp.ToUnixTimeSeconds());
_ = vp_int_set(handle, IntegerAttribute.ObjectTime, (int)modificationTimestamp.ToUnixTimeSeconds());
}
if (Owner is { } owner)
@ -172,7 +172,7 @@ public sealed class VirtualParadiseModelObjectBuilder : VirtualParadiseObjectBui
throw new InvalidOperationException("Owner can only be assigned during an object load.");
}
vp_int_set(handle, IntegerAttribute.ObjectUserId, owner.Id);
_ = vp_int_set(handle, IntegerAttribute.ObjectUserId, owner.Id);
}
}
}

View File

@ -146,8 +146,8 @@ public sealed class VirtualParadiseUser : IEquatable<VirtualParadiseUser>
(double x, double y, double z) = location.Value.Position;
(double pitch, double yaw, _) = location.Value.Rotation.ToEulerAngles();
vp_int_set(_client.NativeInstanceHandle, IntegerAttribute.ReferenceNumber, reference);
vp_invite(_client.NativeInstanceHandle, Id, world, x, y, z, (float) yaw, (float) pitch);
_ = vp_int_set(_client.NativeInstanceHandle, IntegerAttribute.ReferenceNumber, reference);
_ = vp_invite(_client.NativeInstanceHandle, Id, world, x, y, z, (float)yaw, (float)pitch);
}
ReasonCode reason = await taskCompletionSource.Task.ConfigureAwait(false);
@ -188,8 +188,8 @@ public sealed class VirtualParadiseUser : IEquatable<VirtualParadiseUser>
lock (_client.Lock)
{
int reference = ObjectReferenceCounter.GetNextReference();
vp_int_set(handle, IntegerAttribute.ReferenceNumber, reference);
vp_join(handle, Id);
_ = vp_int_set(handle, IntegerAttribute.ReferenceNumber, reference);
_ = vp_join(handle, Id);
taskCompletionSource = _client.AddJoinCompletionSource(reference);
}

View File

@ -111,7 +111,7 @@ internal sealed class Connection : IDisposable
{
if (_vpConnection != IntPtr.Zero)
{
Native.vp_net_notify(_vpConnection, (int) notification, rc);
_ = Native.vp_net_notify(_vpConnection, (int)notification, rc);
}
}
}

View File

@ -75,7 +75,7 @@ public sealed class InviteRequest : IEquatable<InviteRequest>
{
lock (_client.Lock)
{
Native.vp_invite_accept(_client.NativeInstanceHandle, _requestId);
_ = Native.vp_invite_accept(_client.NativeInstanceHandle, _requestId);
}
if (suppressTeleport)
@ -93,7 +93,7 @@ public sealed class InviteRequest : IEquatable<InviteRequest>
{
lock (_client.Lock)
{
Native.vp_invite_decline(_client.NativeInstanceHandle, _requestId);
_ = Native.vp_invite_decline(_client.NativeInstanceHandle, _requestId);
}
return Task.CompletedTask;

View File

@ -74,7 +74,7 @@ public sealed class JoinRequest : IEquatable<JoinRequest>
lock (_client.Lock)
{
Native.vp_join_accept(_client.NativeInstanceHandle, _requestId, worldName, x, y, z, (float) yaw, (float) pitch);
_ = Native.vp_join_accept(_client.NativeInstanceHandle, _requestId, worldName, x, y, z, (float)yaw, (float)pitch);
}
return Task.CompletedTask;
@ -87,7 +87,7 @@ public sealed class JoinRequest : IEquatable<JoinRequest>
{
lock (_client.Lock)
{
Native.vp_join_decline(_client.NativeInstanceHandle, _requestId);
_ = Native.vp_join_decline(_client.NativeInstanceHandle, _requestId);
}
return Task.CompletedTask;

View File

@ -1,4 +1,4 @@
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using VpSharp.Entities;
using VpSharp.Internal;
using static VpSharp.Internal.Native;
@ -35,7 +35,7 @@ public sealed partial class VirtualParadiseClient
private void SetNativeCallback(NativeCallback nativeCallback, NativeCallbackHandler handler)
{
_nativeCallbackHandlers.TryAdd(nativeCallback, handler);
vp_callback_set(NativeInstanceHandle, nativeCallback, handler);
_ = vp_callback_set(NativeInstanceHandle, nativeCallback, handler);
}
private async void OnObjectGetNativeCallback(nint sender, ReasonCode reason, int reference)

View File

@ -47,7 +47,7 @@ public sealed partial class VirtualParadiseClient
private void SetNativeEvent(NativeEvent nativeEvent, NativeEventHandler handler)
{
_nativeEventHandlers.TryAdd(nativeEvent, handler);
vp_event_set(NativeInstanceHandle, nativeEvent, handler);
_ = vp_event_set(NativeInstanceHandle, nativeEvent, handler);
}
private void OnChatNativeEvent(nint sender)

View File

@ -105,7 +105,7 @@ public sealed partial class VirtualParadiseClient
lock (Lock)
{
vp_int_set(NativeInstanceHandle, IntegerAttribute.ReferenceNumber, id);
_ = vp_int_set(NativeInstanceHandle, IntegerAttribute.ReferenceNumber, id);
reason = (ReasonCode) vp_object_get(NativeInstanceHandle, id);
if (reason != ReasonCode.Success)
{

View File

@ -1,4 +1,4 @@
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using VpSharp.Entities;
using static VpSharp.Internal.Native;
@ -33,7 +33,7 @@ public sealed partial class VirtualParadiseClient
lock (Lock)
{
vp_user_attributes_by_id(NativeInstanceHandle, userId);
_ = vp_user_attributes_by_id(NativeInstanceHandle, userId);
}
user = await taskCompletionSource.Task.ConfigureAwait(false);

View File

@ -298,7 +298,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
{
lock (Lock)
{
vp_leave(NativeInstanceHandle);
_ = vp_leave(NativeInstanceHandle);
}
}
@ -368,7 +368,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
lock (Lock)
{
vp_state_change(NativeInstanceHandle);
_ = vp_state_change(NativeInstanceHandle);
}
world.Size = new Size(size, size);
@ -532,7 +532,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
}
CurrentUser = await GetUserAsync(userId).ConfigureAwait(false);
vp_friends_get(NativeInstanceHandle);
_ = vp_friends_get(NativeInstanceHandle);
}
/// <summary>
@ -600,7 +600,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
private void ReleaseUnmanagedResources()
{
vp_destroy(NativeInstanceHandle);
_ = vp_destroy(NativeInstanceHandle);
_instanceHandle.Free();
}
}