From 17e3795eeba5d650cc4d4ff2659406970347eb53 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Wed, 30 Nov 2022 18:37:07 +0000 Subject: [PATCH] Discard native return values when irrelevant --- VpSharp/src/Entities/VirtualParadiseAvatar.cs | 12 ++++++------ .../VirtualParadiseModelObjectBuilder.cs | 18 +++++++++--------- VpSharp/src/Entities/VirtualParadiseUser.cs | 8 ++++---- VpSharp/src/Internal/Connection.cs | 2 +- VpSharp/src/InviteRequest.cs | 4 ++-- VpSharp/src/JoinRequest.cs | 4 ++-- .../VirtualParadiseClient.NativeCallbacks.cs | 4 ++-- .../src/VirtualParadiseClient.NativeEvents.cs | 2 +- VpSharp/src/VirtualParadiseClient.Objects.cs | 2 +- VpSharp/src/VirtualParadiseClient.Users.cs | 4 ++-- VpSharp/src/VirtualParadiseClient.cs | 8 ++++---- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/VpSharp/src/Entities/VirtualParadiseAvatar.cs b/VpSharp/src/Entities/VirtualParadiseAvatar.cs index 0d1461f..ae4b459 100644 --- a/VpSharp/src/Entities/VirtualParadiseAvatar.cs +++ b/VpSharp/src/Entities/VirtualParadiseAvatar.cs @@ -281,7 +281,7 @@ public sealed class VirtualParadiseAvatar : IEquatable 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 (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) diff --git a/VpSharp/src/Entities/VirtualParadiseModelObjectBuilder.cs b/VpSharp/src/Entities/VirtualParadiseModelObjectBuilder.cs index 5fee11b..d7f1aa0 100644 --- a/VpSharp/src/Entities/VirtualParadiseModelObjectBuilder.cs +++ b/VpSharp/src/Entities/VirtualParadiseModelObjectBuilder.cs @@ -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); } } } diff --git a/VpSharp/src/Entities/VirtualParadiseUser.cs b/VpSharp/src/Entities/VirtualParadiseUser.cs index 938e2cf..127b45d 100644 --- a/VpSharp/src/Entities/VirtualParadiseUser.cs +++ b/VpSharp/src/Entities/VirtualParadiseUser.cs @@ -146,8 +146,8 @@ public sealed class VirtualParadiseUser : IEquatable (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 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); } diff --git a/VpSharp/src/Internal/Connection.cs b/VpSharp/src/Internal/Connection.cs index 406abe9..67dd1ab 100644 --- a/VpSharp/src/Internal/Connection.cs +++ b/VpSharp/src/Internal/Connection.cs @@ -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); } } } diff --git a/VpSharp/src/InviteRequest.cs b/VpSharp/src/InviteRequest.cs index a107e4d..b61ce3b 100644 --- a/VpSharp/src/InviteRequest.cs +++ b/VpSharp/src/InviteRequest.cs @@ -75,7 +75,7 @@ public sealed class InviteRequest : IEquatable { 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 { lock (_client.Lock) { - Native.vp_invite_decline(_client.NativeInstanceHandle, _requestId); + _ = Native.vp_invite_decline(_client.NativeInstanceHandle, _requestId); } return Task.CompletedTask; diff --git a/VpSharp/src/JoinRequest.cs b/VpSharp/src/JoinRequest.cs index 8c5ef71..a3ff415 100644 --- a/VpSharp/src/JoinRequest.cs +++ b/VpSharp/src/JoinRequest.cs @@ -74,7 +74,7 @@ public sealed class JoinRequest : IEquatable 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 { lock (_client.Lock) { - Native.vp_join_decline(_client.NativeInstanceHandle, _requestId); + _ = Native.vp_join_decline(_client.NativeInstanceHandle, _requestId); } return Task.CompletedTask; diff --git a/VpSharp/src/VirtualParadiseClient.NativeCallbacks.cs b/VpSharp/src/VirtualParadiseClient.NativeCallbacks.cs index 626fdc0..f9d2848 100644 --- a/VpSharp/src/VirtualParadiseClient.NativeCallbacks.cs +++ b/VpSharp/src/VirtualParadiseClient.NativeCallbacks.cs @@ -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) diff --git a/VpSharp/src/VirtualParadiseClient.NativeEvents.cs b/VpSharp/src/VirtualParadiseClient.NativeEvents.cs index bde17d3..9c6081a 100644 --- a/VpSharp/src/VirtualParadiseClient.NativeEvents.cs +++ b/VpSharp/src/VirtualParadiseClient.NativeEvents.cs @@ -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) diff --git a/VpSharp/src/VirtualParadiseClient.Objects.cs b/VpSharp/src/VirtualParadiseClient.Objects.cs index 48ec1d4..7e71b5e 100644 --- a/VpSharp/src/VirtualParadiseClient.Objects.cs +++ b/VpSharp/src/VirtualParadiseClient.Objects.cs @@ -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) { diff --git a/VpSharp/src/VirtualParadiseClient.Users.cs b/VpSharp/src/VirtualParadiseClient.Users.cs index e0d5a36..d57c0bc 100644 --- a/VpSharp/src/VirtualParadiseClient.Users.cs +++ b/VpSharp/src/VirtualParadiseClient.Users.cs @@ -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); diff --git a/VpSharp/src/VirtualParadiseClient.cs b/VpSharp/src/VirtualParadiseClient.cs index 856e4da..69ea777 100644 --- a/VpSharp/src/VirtualParadiseClient.cs +++ b/VpSharp/src/VirtualParadiseClient.cs @@ -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); } /// @@ -600,7 +600,7 @@ public sealed partial class VirtualParadiseClient : IDisposable private void ReleaseUnmanagedResources() { - vp_destroy(NativeInstanceHandle); + _ = vp_destroy(NativeInstanceHandle); _instanceHandle.Free(); } }