From d70c9f0e98cb2df07c6846e3ffb62a2159e954d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20CORTIER?= Date: Tue, 9 Apr 2024 23:38:21 +0900 Subject: [PATCH] style(dotnet): run dotnet format --- .../Program.cs | 4 ++-- .../Generated/DiplomatRuntime.cs | 6 +++--- .../Devolutions.IronRdp/src/Connection.cs | 4 ++-- .../Devolutions.IronRdp/src/Exceptions.cs | 2 +- ffi/dotnet/Devolutions.IronRdp/src/Framed.cs | 20 ++++++++++++------- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/ffi/dotnet/Devolutions.IronRdp.ConnectExample/Program.cs b/ffi/dotnet/Devolutions.IronRdp.ConnectExample/Program.cs index 7e9a7f85..5421598e 100644 --- a/ffi/dotnet/Devolutions.IronRdp.ConnectExample/Program.cs +++ b/ffi/dotnet/Devolutions.IronRdp.ConnectExample/Program.cs @@ -87,7 +87,7 @@ namespace Devolutions.IronRdp.ConnectExample bytes[i + 2] = temp; // Move original Blue to Red's position // Green (bytes[i+1]) and Alpha (bytes[i+3]) remain unchanged } - #if WINDOWS // Bitmap is only available on Windows +#if WINDOWS // Bitmap is only available on Windows using (var bmp = new Bitmap(width, height)) { // Lock the bits of the bitmap. @@ -104,7 +104,7 @@ namespace Devolutions.IronRdp.ConnectExample // Save the bitmap to the specified output path bmp.Save("./output.bmp", ImageFormat.Bmp); } - #endif +#endif } diff --git a/ffi/dotnet/Devolutions.IronRdp/Generated/DiplomatRuntime.cs b/ffi/dotnet/Devolutions.IronRdp/Generated/DiplomatRuntime.cs index 18223e37..158688dd 100644 --- a/ffi/dotnet/Devolutions.IronRdp/Generated/DiplomatRuntime.cs +++ b/ffi/dotnet/Devolutions.IronRdp/Generated/DiplomatRuntime.cs @@ -46,11 +46,11 @@ public struct DiplomatWriteable : IDisposable IntPtr flushFuncPtr = Marshal.GetFunctionPointerForDelegate(flushFunc); IntPtr growFuncPtr = Marshal.GetFunctionPointerForDelegate(growFunc); - + // flushFunc and growFunc are managed objects and might be disposed of by the garbage collector. // To prevent this, we make the context hold the references and protect the context itself // for automatic disposal by moving it behind a GCHandle. - DiplomatWriteableContext ctx = new DiplomatWriteableContext(); + DiplomatWriteableContext ctx = new DiplomatWriteableContext(); ctx.flushFunc = flushFunc; ctx.growFunc = growFunc; GCHandle ctxHandle = GCHandle.Alloc(ctx); @@ -81,7 +81,7 @@ public struct DiplomatWriteable : IDisposable { throw new IndexOutOfRangeException("DiplomatWriteable buffer is too big"); } - return Marshal.PtrToStringUTF8(buf, (int) len); + return Marshal.PtrToStringUTF8(buf, (int)len); #else byte[] utf8 = ToUtf8Bytes(); return DiplomatUtils.Utf8ToString(utf8); diff --git a/ffi/dotnet/Devolutions.IronRdp/src/Connection.cs b/ffi/dotnet/Devolutions.IronRdp/src/Connection.cs index 48086ee4..7e810e74 100644 --- a/ffi/dotnet/Devolutions.IronRdp/src/Connection.cs +++ b/ffi/dotnet/Devolutions.IronRdp/src/Connection.cs @@ -7,7 +7,7 @@ using Devolutions.IronRdp; public class Connection { - public static async Task<(ConnectionResult,Framed)> Connect(Config config,string servername) + public static async Task<(ConnectionResult, Framed)> Connect(Config config, string servername) { var stream = await CreateTcpConnection(servername, 3389); @@ -26,7 +26,7 @@ public class Connection await connectBegin(framed, connector); var (serverPublicKey, framedSsl) = await securityUpgrade(servername, framed, connector); - var result = await ConnectFinalize(servername, connector, serverPublicKey, framedSsl); + var result = await ConnectFinalize(servername, connector, serverPublicKey, framedSsl); return (result, framedSsl); } diff --git a/ffi/dotnet/Devolutions.IronRdp/src/Exceptions.cs b/ffi/dotnet/Devolutions.IronRdp/src/Exceptions.cs index b03ba733..88a2286b 100644 --- a/ffi/dotnet/Devolutions.IronRdp/src/Exceptions.cs +++ b/ffi/dotnet/Devolutions.IronRdp/src/Exceptions.cs @@ -3,7 +3,7 @@ public class IronRdpLibException : Exception { public IronRdpLibExceptionType type { get; private set; } - public IronRdpLibException(IronRdpLibExceptionType type, string message): base(message) + public IronRdpLibException(IronRdpLibExceptionType type, string message) : base(message) { this.type = type; } diff --git a/ffi/dotnet/Devolutions.IronRdp/src/Framed.cs b/ffi/dotnet/Devolutions.IronRdp/src/Framed.cs index c31763df..56a336ad 100644 --- a/ffi/dotnet/Devolutions.IronRdp/src/Framed.cs +++ b/ffi/dotnet/Devolutions.IronRdp/src/Framed.cs @@ -18,19 +18,25 @@ public class Framed where S : Stream return (this.stream, this.buffer); } - public async Task<(Devolutions.IronRdp.Action,byte[])> ReadPdu() { + public async Task<(Devolutions.IronRdp.Action, byte[])> ReadPdu() + { - while(true) { + while (true) + { var pduInfo = IronRdpPdu.New().FindSize(this.buffer.ToArray()); - if (null != pduInfo) { + if (null != pduInfo) + { var frame = await this.ReadExact(pduInfo.GetLength()); var action = pduInfo.GetAction(); - return (action,frame); - }else { + return (action, frame); + } + else + { var len = await this.Read(); - if (len == 0) { - throw new IronRdpLibException(IronRdpLibExceptionType.EndOfFile,"EOF on ReadPdu"); + if (len == 0) + { + throw new IronRdpLibException(IronRdpLibExceptionType.EndOfFile, "EOF on ReadPdu"); } } }