Skip to content

Commit

Permalink
Fix code style errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhett12321 committed Jan 11, 2025
1 parent b2d9bf5 commit c7a983c
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,8 @@ public void Update()
}
}

private readonly struct QueuedTask
private readonly struct QueuedTask(SendOrPostCallback callback, object? state)
{
private readonly SendOrPostCallback callback;
private readonly object? state;

public QueuedTask(SendOrPostCallback callback, object? state)
{
this.callback = callback;
this.state = state;
}

public void Invoke()
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@ namespace NWNX.NET.Tests.Async
/// <summary>
/// Awaits for the current async context to return to the specified context.
/// </summary>
internal readonly struct SynchronizationContextAwaiter : IAwaiter
internal readonly struct SynchronizationContextAwaiter(SynchronizationContext context) : IAwaiter
{
private static readonly SendOrPostCallback PostCallback = state => ((System.Action?)state)?.Invoke();

private readonly SynchronizationContext context;

public SynchronizationContextAwaiter(SynchronizationContext context)
{
this.context = context;
}

public bool IsCompleted => context == SynchronizationContext.Current;

public void GetResult() {}
Expand Down
2 changes: 2 additions & 0 deletions NWNX.NET.Tests/src/main/Constants/VMFunctions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ReSharper disable InconsistentNaming

namespace NWNX.NET.Tests.Constants
{
public static class VMFunctions
Expand Down
3 changes: 1 addition & 2 deletions NWNX.NET.Tests/src/main/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static unsafe class Program
private static readonly MainThreadSynchronizationContext TestSyncContext = new MainThreadSynchronizationContext();
private static readonly TestRunner TestRunner = new TestRunner(TestSyncContext);

public static event Action<ulong> OnMainLoop;
public static event Action<ulong>? OnMainLoop;

public static void Main()
{
Expand Down Expand Up @@ -40,7 +40,6 @@ private static void NWNXSignalHandler(IntPtr signalPtr)
TestRunner.RunTestsAsync();
break;
case "ON_DESTROY_SERVER":
break;
case "ON_DESTROY_SERVER_AFTER":
break;
}
Expand Down
2 changes: 1 addition & 1 deletion NWNX.NET.Tests/src/main/TestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private void ExecuteTestRun()
}
}

private string[] GetRunnerArguments()
private static string[] GetRunnerArguments()
{
return ["--mainthread", $"--work={TestResultPath}"];
}
Expand Down
2 changes: 1 addition & 1 deletion NWNX.NET.Tests/src/main/Tests/Hooks/HookTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task WriteLogFileDelegateHookTest()
Assert.That(logMessage, Is.EqualTo(expectedMessage + "\n"));
}

private unsafe void WriteLogFileDelegateHandler(void* pExoDebugInternal, void* pMessage)
private static unsafe void WriteLogFileDelegateHandler(void* pExoDebugInternal, void* pMessage)
{
callCount++;
logMessage = StringUtils.ReadNullTerminatedString(CExoStringCStr(pMessage));
Expand Down
1 change: 1 addition & 0 deletions NWNX.NET.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NWM/@EntryIndexedValue">NWM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NWNX/@EntryIndexedValue">NWNX</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NWNXAPI/@EntryIndexedValue">NWNXAPI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NWNXVM/@EntryIndexedValue">NWNXVM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NWS/@EntryIndexedValue">NWS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PC/@EntryIndexedValue">PC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PLH/@EntryIndexedValue">PLH</s:String>
Expand Down
1 change: 1 addition & 0 deletions NWNX.NET/src/main/API/NWNXAPI.VM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static partial class NWNXAPI
/// <summary>
/// VM Function. Push a game defined structure (pointer) to the current argument stack.
/// </summary>
/// <param name="type">The engine structure type.</param>
/// <param name="value">The value to push.</param>
[LibraryImport("NWNX_DotNET", EntryPoint = "StackPushGameDefinedStructure")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
Expand Down

0 comments on commit c7a983c

Please sign in to comment.