1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-22 19:18:47 +00:00

Fix spacing

This commit is contained in:
Oliver Booth 2022-11-30 18:25:05 +00:00
parent 5019ef94b0
commit 88483373ee
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
22 changed files with 53 additions and 52 deletions

View File

@ -36,7 +36,6 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension
/// </summary> /// </summary>
/// <param name="assembly">The assembly whose command modules to register.</param> /// <param name="assembly">The assembly whose command modules to register.</param>
/// <exception cref="ArgumentException"> /// <exception cref="ArgumentException">
///
/// </exception> /// </exception>
/// <exception cref="TypeInitializationException">A command module could not be instantiated.</exception> /// <exception cref="TypeInitializationException">A command module could not be instantiated.</exception>
/// <exception cref="InvalidOperationException"> /// <exception cref="InvalidOperationException">

View File

@ -137,7 +137,7 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
lock (Client.Lock) lock (Client.Lock)
{ {
int session = target?.Session ?? 0; int session = target?.Session ?? 0;
(float x, float y, float z) = (Vector3) (position ?? Vector3d.Zero); (float x, float y, float z) = (Vector3)(position ?? Vector3d.Zero);
_ = vp_object_click(Client.NativeInstanceHandle, Id, session, x, y, z); _ = vp_object_click(Client.NativeInstanceHandle, Id, session, x, y, z);
} }
@ -154,7 +154,7 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
{ {
lock (Client.Lock) lock (Client.Lock)
{ {
var reason = (ReasonCode) vp_object_delete(Client.NativeInstanceHandle, Id); var reason = (ReasonCode)vp_object_delete(Client.NativeInstanceHandle, Id);
switch (reason) switch (reason)
{ {
@ -207,7 +207,7 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
return false; return false;
} }
return Equals((VirtualParadiseObject) obj); return Equals((VirtualParadiseObject)obj);
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@ -70,7 +70,10 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this emitter interpolates its values. /// Gets or sets a value indicating whether this emitter interpolates its values.
/// </summary> /// </summary>
/// <value><see langword="true" /> if this emitter interpolates its values; otherwise, <see langword="false" />, or <see langword="null" /> to leave unchanged.</value> /// <value>
/// <see langword="true" /> if this emitter interpolates its values; otherwise, <see langword="false" />, or
/// <see langword="null" /> to leave unchanged.
/// </value>
[SerializationKey("interpolate")] [SerializationKey("interpolate")]
[ValueConverter(typeof(IntToBoolConverter))] [ValueConverter(typeof(IntToBoolConverter))]
public bool? Interpolate { get; set; } public bool? Interpolate { get; set; }
@ -473,4 +476,4 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
Texture = value; Texture = value;
return this; return this;
} }
} }

View File

@ -42,4 +42,4 @@ public sealed class VirtualParadisePath : ICloneable
{ {
return new VirtualParadisePath(Easing, Name, Points, IsClosed); return new VirtualParadisePath(Easing, Name, Points, IsClosed);
} }
} }

View File

@ -159,4 +159,4 @@ public sealed class VirtualParadisePathObject : VirtualParadiseObject
Path = new VirtualParadisePath((PathEasing)pathType, name, points, closed == 1); Path = new VirtualParadisePath((PathEasing)pathType, name, points, closed == 1);
} }
} }

View File

@ -131,7 +131,7 @@ public sealed class VirtualParadiseUser : IEquatable<VirtualParadiseUser>
if (_client.CurrentAvatar is not { } avatar) if (_client.CurrentAvatar is not { } avatar)
{ {
ThrowHelper.ThrowNotInWorldException(); ThrowHelper.ThrowNotInWorldException();
return (InviteResponse) (-1); return (InviteResponse)(-1);
} }
location ??= avatar.Location; location ??= avatar.Location;
@ -209,8 +209,8 @@ public sealed class VirtualParadiseUser : IEquatable<VirtualParadiseUser>
y = vp_double(handle, FloatAttribute.JoinY); y = vp_double(handle, FloatAttribute.JoinY);
z = vp_double(handle, FloatAttribute.JoinZ); z = vp_double(handle, FloatAttribute.JoinZ);
yaw = (float) vp_double(handle, FloatAttribute.JoinYaw); yaw = (float)vp_double(handle, FloatAttribute.JoinYaw);
pitch = (float) vp_double(handle, FloatAttribute.JoinPitch); pitch = (float)vp_double(handle, FloatAttribute.JoinPitch);
worldName = vp_string(handle, StringAttribute.JoinWorld); worldName = vp_string(handle, StringAttribute.JoinWorld);
} }

View File

@ -30,7 +30,7 @@ internal sealed class Connection : IDisposable
public int Connect(string host, ushort port) public int Connect(string host, ushort port)
{ {
_socket.BeginConnect(host, port, ConnectCallback, this); _socket.BeginConnect(host, port, ConnectCallback, this);
return (int) NetworkReturnCode.Success; return (int)NetworkReturnCode.Success;
} }
public void Dispose() public void Dispose()
@ -120,10 +120,10 @@ internal sealed class Connection : IDisposable
{ {
if (_readyBuffers.Count == 0) if (_readyBuffers.Count == 0)
{ {
return (int) NetworkReturnCode.WouldBlock; return (int)NetworkReturnCode.WouldBlock;
} }
var spaceLeft = (int) length; var spaceLeft = (int)length;
nint destination = data; nint destination = data;
int i; int i;
@ -148,7 +148,7 @@ internal sealed class Connection : IDisposable
_readyBuffers.RemoveRange(0, i); _readyBuffers.RemoveRange(0, i);
return (int) (length - spaceLeft); return (int)(length - spaceLeft);
} }
private static void ReceiveCallback(IAsyncResult ar) private static void ReceiveCallback(IAsyncResult ar)
@ -218,7 +218,7 @@ internal sealed class Connection : IDisposable
public int Send(nint data, uint length) public int Send(nint data, uint length)
{ {
var buffer = new byte[length]; var buffer = new byte[length];
Marshal.Copy(data, buffer, 0, (int) length); Marshal.Copy(data, buffer, 0, (int)length);
try try
{ {
return _socket.Send(buffer); return _socket.Send(buffer);

View File

@ -1,4 +1,4 @@
namespace VpSharp.Internal; namespace VpSharp.Internal;
internal enum ReasonCode internal enum ReasonCode
{ {
@ -45,7 +45,7 @@ internal enum ReasonCode
WorldLoginError, WorldLoginError,
/// <summary> /// <summary>
/// A world request was made while not being connected to a world server. /// A world request was made while not being connected to a world server.
/// </summary> /// </summary>
NotInWorld, NotInWorld,
@ -86,12 +86,12 @@ internal enum ReasonCode
NoSuchUser, NoSuchUser,
/// <summary> /// <summary>
/// Timeout /// Timeout
/// </summary> /// </summary>
Timeout, Timeout,
/// <summary> /// <summary>
/// The instance is not connected to a universe. /// The instance is not connected to a universe.
/// </summary> /// </summary>
NotInUniverse, NotInUniverse,

View File

@ -22,7 +22,7 @@ internal abstract class ValueConverter<T> : ValueConverter
/// <inheritdoc /> /// <inheritdoc />
public override void Serialize(TextWriter writer, object value) public override void Serialize(TextWriter writer, object value)
{ {
Serialize(writer, (T) value); Serialize(writer, (T)value);
} }
public abstract void Deserialize(TextReader reader, out T result); public abstract void Deserialize(TextReader reader, out T result);

View File

@ -1,4 +1,4 @@
using System.Numerics; using System.Numerics;
using Cysharp.Text; using Cysharp.Text;
using VpSharp.Extensions; using VpSharp.Extensions;
@ -18,7 +18,7 @@ internal sealed class Vector2Converter : ValueConverter<Vector2>
{ {
int readChar = reader.Read(); int readChar = reader.Read();
var currentChar = (char) readChar; var currentChar = (char)readChar;
if (currentChar == ' ') if (currentChar == ' ')
{ {
spaceCount++; spaceCount++;

View File

@ -1,4 +1,4 @@
using System.Numerics; using System.Numerics;
using Cysharp.Text; using Cysharp.Text;
using VpSharp.Extensions; using VpSharp.Extensions;
@ -18,7 +18,7 @@ internal sealed class Vector3Converter : ValueConverter<Vector3>
{ {
int readChar = reader.Read(); int readChar = reader.Read();
var currentChar = (char) readChar; var currentChar = (char)readChar;
if (currentChar == ' ') if (currentChar == ' ')
{ {
spaceCount++; spaceCount++;

View File

@ -1,4 +1,4 @@
using Cysharp.Text; using Cysharp.Text;
using VpSharp.Extensions; using VpSharp.Extensions;
namespace VpSharp.Internal.ValueConverters; namespace VpSharp.Internal.ValueConverters;
@ -17,7 +17,7 @@ internal sealed class Vector3ToColorConverter : ValueConverter<ColorF>
{ {
int readChar = reader.Read(); int readChar = reader.Read();
var currentChar = (char) readChar; var currentChar = (char)readChar;
if (currentChar == ' ') if (currentChar == ' ')
{ {
spaceCount++; spaceCount++;

View File

@ -1,4 +1,4 @@
using Cysharp.Text; using Cysharp.Text;
using VpSharp.Extensions; using VpSharp.Extensions;
namespace VpSharp.Internal.ValueConverters; namespace VpSharp.Internal.ValueConverters;
@ -17,7 +17,7 @@ internal sealed class Vector3dConverter : ValueConverter<Vector3d>
{ {
int readChar = reader.Read(); int readChar = reader.Read();
var currentChar = (char) readChar; var currentChar = (char)readChar;
if (currentChar == ' ') if (currentChar == ' ')
{ {
spaceCount++; spaceCount++;

View File

@ -1,4 +1,4 @@
using Cysharp.Text; using Cysharp.Text;
using VpSharp.Extensions; using VpSharp.Extensions;
namespace VpSharp.Internal.ValueConverters; namespace VpSharp.Internal.ValueConverters;
@ -17,7 +17,7 @@ internal sealed class Vector4ToColorConverter : ValueConverter<ColorF>
{ {
int readChar = reader.Read(); int readChar = reader.Read();
var currentChar = (char) readChar; var currentChar = (char)readChar;
if (currentChar == ' ') if (currentChar == ' ')
{ {
spaceCount++; spaceCount++;

View File

@ -1,4 +1,4 @@
using System.Numerics; using System.Numerics;
using Cysharp.Text; using Cysharp.Text;
using VpSharp.Extensions; using VpSharp.Extensions;
@ -18,7 +18,7 @@ internal sealed class Vector4ToVector3Converter : ValueConverter<Vector3>
{ {
int readChar = reader.Read(); int readChar = reader.Read();
var currentChar = (char) readChar; var currentChar = (char)readChar;
if (currentChar == ' ') if (currentChar == ' ')
{ {
spaceCount++; spaceCount++;

View File

@ -1,4 +1,4 @@
using Cysharp.Text; using Cysharp.Text;
using VpSharp.Extensions; using VpSharp.Extensions;
namespace VpSharp.Internal.ValueConverters; namespace VpSharp.Internal.ValueConverters;
@ -30,7 +30,7 @@ internal sealed class VectorToNthComponentConverter : ValueConverter<float>
break; break;
} }
var currentChar = (char) readChar; var currentChar = (char)readChar;
if (currentChar == ' ') if (currentChar == ' ')
{ {
spaceCount++; spaceCount++;

View File

@ -9,7 +9,7 @@ namespace VpSharp;
/// <summary> /// <summary>
/// Represents a vector with three double-precision floating-point values. This structure very closely resembles the API /// Represents a vector with three double-precision floating-point values. This structure very closely resembles the API
/// provided by <see cref="Vector3" />, however its components and the mathematical operations performed on them use /// provided by <see cref="Vector3" />, however its components and the mathematical operations performed on them use
/// <see cref="double" /> arithmetic. /// <see cref="double" /> arithmetic.
/// </summary> /// </summary>
public struct Vector3d : IEquatable<Vector3d>, IFormattable public struct Vector3d : IEquatable<Vector3d>, IFormattable
{ {

View File

@ -1,4 +1,4 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Numerics; using System.Numerics;
using VpSharp.Entities; using VpSharp.Entities;
using VpSharp.Internal.NativeAttributes; using VpSharp.Internal.NativeAttributes;
@ -45,8 +45,8 @@ public sealed partial class VirtualParadiseClient
double x = vp_double(sender, FloatAttribute.AvatarX); double x = vp_double(sender, FloatAttribute.AvatarX);
double y = vp_double(sender, FloatAttribute.AvatarY); double y = vp_double(sender, FloatAttribute.AvatarY);
double z = vp_double(sender, FloatAttribute.AvatarZ); double z = vp_double(sender, FloatAttribute.AvatarZ);
var pitch = (float) vp_double(sender, FloatAttribute.AvatarPitch); var pitch = (float)vp_double(sender, FloatAttribute.AvatarPitch);
var yaw = (float) vp_double(sender, FloatAttribute.AvatarYaw); var yaw = (float)vp_double(sender, FloatAttribute.AvatarYaw);
var position = new Vector3d(x, y, z); var position = new Vector3d(x, y, z);
var rotation = Quaternion.CreateFromYawPitchRoll(yaw, pitch, 0); var rotation = Quaternion.CreateFromYawPitchRoll(yaw, pitch, 0);

View File

@ -15,7 +15,7 @@ public sealed partial class VirtualParadiseClient
private void Initialize() private void Initialize()
{ {
var reason = (ReasonCode) Native.vp_init(); var reason = (ReasonCode)Native.vp_init();
if (reason == ReasonCode.VersionMismatch) if (reason == ReasonCode.VersionMismatch)
{ {
throw new VersionMismatchException(); throw new VersionMismatchException();

View File

@ -1,4 +1,4 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Drawing; using System.Drawing;
using System.Numerics; using System.Numerics;
using System.Threading.Channels; using System.Threading.Channels;
@ -71,7 +71,7 @@ public sealed partial class VirtualParadiseClient
int g = vp_int(sender, IntegerAttribute.ChatColorGreen); int g = vp_int(sender, IntegerAttribute.ChatColorGreen);
int b = vp_int(sender, IntegerAttribute.ChatColorBlue); int b = vp_int(sender, IntegerAttribute.ChatColorBlue);
color = Color.FromArgb(r, g, b); color = Color.FromArgb(r, g, b);
style = (FontStyle) vp_int(sender, IntegerAttribute.ChatEffects); style = (FontStyle)vp_int(sender, IntegerAttribute.ChatEffects);
} }
VirtualParadiseAvatar? avatar = GetAvatar(session); VirtualParadiseAvatar? avatar = GetAvatar(session);
@ -80,7 +80,7 @@ public sealed partial class VirtualParadiseClient
var args = new MessageReceivedEventArgs(message); var args = new MessageReceivedEventArgs(message);
RaiseEvent(MessageReceived, args); RaiseEvent(MessageReceived, args);
foreach (VirtualParadiseClientExtension extension in _extensions) foreach (VirtualParadiseClientExtension extension in _extensions)
{ {
extension.OnMessageReceived(args); extension.OnMessageReceived(args);
@ -114,8 +114,8 @@ public sealed partial class VirtualParadiseClient
double z = vp_double(sender, FloatAttribute.AvatarZ); double z = vp_double(sender, FloatAttribute.AvatarZ);
position = new Vector3d(x, y, z); position = new Vector3d(x, y, z);
var pitch = (float) vp_double(sender, FloatAttribute.AvatarPitch); var pitch = (float)vp_double(sender, FloatAttribute.AvatarPitch);
var yaw = (float) vp_double(sender, FloatAttribute.AvatarYaw); var yaw = (float)vp_double(sender, FloatAttribute.AvatarYaw);
rotation = Quaternion.CreateFromYawPitchRoll(yaw, pitch, 0); rotation = Quaternion.CreateFromYawPitchRoll(yaw, pitch, 0);
} }
@ -325,7 +325,7 @@ public sealed partial class VirtualParadiseClient
DisconnectReason reason; DisconnectReason reason;
lock (Lock) lock (Lock)
{ {
reason = (DisconnectReason) vp_int(sender, IntegerAttribute.DisconnectErrorCode); reason = (DisconnectReason)vp_int(sender, IntegerAttribute.DisconnectErrorCode);
} }
var args = new DisconnectedEventArgs(reason); var args = new DisconnectedEventArgs(reason);
@ -337,7 +337,7 @@ public sealed partial class VirtualParadiseClient
DisconnectReason reason; DisconnectReason reason;
lock (Lock) lock (Lock)
{ {
reason = (DisconnectReason) vp_int(sender, IntegerAttribute.DisconnectErrorCode); reason = (DisconnectReason)vp_int(sender, IntegerAttribute.DisconnectErrorCode);
} }
var args = new DisconnectedEventArgs(reason); var args = new DisconnectedEventArgs(reason);
@ -474,7 +474,7 @@ public sealed partial class VirtualParadiseClient
{ {
session = vp_int(sender, IntegerAttribute.AvatarSession); session = vp_int(sender, IntegerAttribute.AvatarSession);
url = vp_string(sender, StringAttribute.Url); url = vp_string(sender, StringAttribute.Url);
target = (UriTarget) vp_int(sender, IntegerAttribute.UrlTarget); target = (UriTarget)vp_int(sender, IntegerAttribute.UrlTarget);
} }
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
@ -544,8 +544,8 @@ public sealed partial class VirtualParadiseClient
double y = vp_double(sender, FloatAttribute.InviteY); double y = vp_double(sender, FloatAttribute.InviteY);
double z = vp_double(sender, FloatAttribute.InviteZ); double z = vp_double(sender, FloatAttribute.InviteZ);
var yaw = (float) vp_double(sender, FloatAttribute.InviteYaw); var yaw = (float)vp_double(sender, FloatAttribute.InviteYaw);
var pitch = (float) vp_double(sender, FloatAttribute.InvitePitch); var pitch = (float)vp_double(sender, FloatAttribute.InvitePitch);
position = new Vector3d(x, y, z); position = new Vector3d(x, y, z);
rotation = Quaternion.CreateFromYawPitchRoll(yaw, pitch, 0); rotation = Quaternion.CreateFromYawPitchRoll(yaw, pitch, 0);

View File

@ -148,7 +148,7 @@ public sealed partial class VirtualParadiseClient
private async Task<VirtualParadiseObject> ExtractObjectAsync(nint sender) private async Task<VirtualParadiseObject> ExtractObjectAsync(nint sender)
{ {
var type = (ObjectType) vp_int(sender, IntegerAttribute.ObjectType); var type = (ObjectType)vp_int(sender, IntegerAttribute.ObjectType);
int id = vp_int(sender, IntegerAttribute.ObjectId); int id = vp_int(sender, IntegerAttribute.ObjectId);
int owner = vp_int(sender, IntegerAttribute.ObjectUserId); int owner = vp_int(sender, IntegerAttribute.ObjectUserId);

View File

@ -184,7 +184,6 @@ public sealed partial class VirtualParadiseClient : IDisposable
ReleaseUnmanagedResources(); ReleaseUnmanagedResources();
} }
/// <summary> /// <summary>
/// Enters a specified world at a specified position. /// Enters a specified world at a specified position.
/// </summary> /// </summary>