From 2424f267553042c08d0c971b0b1de2bdf2a1a1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Mon, 26 Sep 2022 21:00:43 +0200 Subject: [PATCH] Renamed namespaces --- Nefarius.Peripherals.SerialPort/ASCII.cs | 50 +++++++++++++++---- .../CommPortException.cs | 29 ++++++----- Nefarius.Peripherals.SerialPort/Handshake.cs | 44 ++++++++-------- Nefarius.Peripherals.SerialPort/HsOutput.cs | 44 ++++++++-------- .../ModemStatus.cs | 4 +- .../Nefarius.Peripherals.SerialPort.csproj | 3 +- Nefarius.Peripherals.SerialPort/Parity.cs | 2 +- .../QueueStatus.cs | 4 +- Nefarius.Peripherals.SerialPort/SerialPort.cs | 4 +- Nefarius.Peripherals.SerialPort/StopBits.cs | 2 +- .../Win32PInvoke/COMMPROP.cs | 2 +- .../Win32PInvoke/COMMTIMEOUTS.cs | 2 +- .../Win32PInvoke/COMSTAT.cs | 2 +- .../Win32PInvoke/DCB.cs | 2 +- .../Win32PInvoke/OVERLAPPED.cs | 2 +- .../Win32PInvoke/Win32Com.cs | 2 +- 16 files changed, 117 insertions(+), 81 deletions(-) diff --git a/Nefarius.Peripherals.SerialPort/ASCII.cs b/Nefarius.Peripherals.SerialPort/ASCII.cs index 102eb98..2ff7265 100644 --- a/Nefarius.Peripherals.SerialPort/ASCII.cs +++ b/Nefarius.Peripherals.SerialPort/ASCII.cs @@ -1,13 +1,41 @@ -namespace PInvokeSerialPort +namespace Nefarius.Peripherals.SerialPort; + +/// +/// Byte type with enumeration constants for ASCII control codes. +/// +public enum ASCII : byte { - /// - /// Byte type with enumeration constants for ASCII control codes. - /// - public enum ASCII : byte - { - NULL = 0x00, SOH = 0x01, STH = 0x02, ETX = 0x03, EOT = 0x04, ENQ = 0x05, ACK = 0x06, BELL = 0x07, - BS = 0x08, HT = 0x09, LF = 0x0A, VT = 0x0B, FF = 0x0C, CR = 0x0D, SO = 0x0E, SI = 0x0F, DC1 = 0x11, - DC2 = 0x12, DC3 = 0x13, DC4 = 0x14, NAK = 0x15, SYN = 0x16, ETB = 0x17, CAN = 0x18, EM = 0x19, - SUB = 0x1A, ESC = 0x1B, FS = 0x1C, GS = 0x1D, RS = 0x1E, US = 0x1F, SP = 0x20, DEL = 0x7F - } + NULL = 0x00, + SOH = 0x01, + STH = 0x02, + ETX = 0x03, + EOT = 0x04, + ENQ = 0x05, + ACK = 0x06, + BELL = 0x07, + BS = 0x08, + HT = 0x09, + LF = 0x0A, + VT = 0x0B, + FF = 0x0C, + CR = 0x0D, + SO = 0x0E, + SI = 0x0F, + DC1 = 0x11, + DC2 = 0x12, + DC3 = 0x13, + DC4 = 0x14, + NAK = 0x15, + SYN = 0x16, + ETB = 0x17, + CAN = 0x18, + EM = 0x19, + SUB = 0x1A, + ESC = 0x1B, + FS = 0x1C, + GS = 0x1D, + RS = 0x1E, + US = 0x1F, + SP = 0x20, + DEL = 0x7F } \ No newline at end of file diff --git a/Nefarius.Peripherals.SerialPort/CommPortException.cs b/Nefarius.Peripherals.SerialPort/CommPortException.cs index b916f0c..bb4c8e7 100644 --- a/Nefarius.Peripherals.SerialPort/CommPortException.cs +++ b/Nefarius.Peripherals.SerialPort/CommPortException.cs @@ -1,22 +1,25 @@ using System; -namespace PInvokeSerialPort +namespace Nefarius.Peripherals.SerialPort; + +/// +/// Exception used for all errors. +/// +public class CommPortException : ApplicationException { /// - /// Exception used for all errors. + /// Constructor for raising direct exceptions /// - public class CommPortException : ApplicationException + /// Description of error + public CommPortException(string desc) : base(desc) { - /// - /// Constructor for raising direct exceptions - /// - /// Description of error - public CommPortException(string desc) : base(desc) { } + } - /// - /// Constructor for re-raising exceptions from receive thread - /// - /// Inner exception raised on receive thread - public CommPortException(Exception e) : base("Receive Thread Exception", e) { } + /// + /// Constructor for re-raising exceptions from receive thread + /// + /// Inner exception raised on receive thread + public CommPortException(Exception e) : base("Receive Thread Exception", e) + { } } \ No newline at end of file diff --git a/Nefarius.Peripherals.SerialPort/Handshake.cs b/Nefarius.Peripherals.SerialPort/Handshake.cs index 6d76eac..ed1bbac 100644 --- a/Nefarius.Peripherals.SerialPort/Handshake.cs +++ b/Nefarius.Peripherals.SerialPort/Handshake.cs @@ -1,25 +1,27 @@ -namespace PInvokeSerialPort +namespace Nefarius.Peripherals.SerialPort; + +/// +/// Standard handshake methods +/// +public enum Handshake { /// - /// Standard handshake methods + /// No handshaking /// - public enum Handshake - { - /// - /// No handshaking - /// - None, - /// - /// Software handshaking using Xon / Xoff - /// - XonXoff, - /// - /// Hardware handshaking using CTS / RTS - /// - CtsRts, - /// - /// Hardware handshaking using DSR / DTR - /// - DsrDtr - } + None, + + /// + /// Software handshaking using Xon / Xoff + /// + XonXoff, + + /// + /// Hardware handshaking using CTS / RTS + /// + CtsRts, + + /// + /// Hardware handshaking using DSR / DTR + /// + DsrDtr } \ No newline at end of file diff --git a/Nefarius.Peripherals.SerialPort/HsOutput.cs b/Nefarius.Peripherals.SerialPort/HsOutput.cs index 3d2e742..a57434d 100644 --- a/Nefarius.Peripherals.SerialPort/HsOutput.cs +++ b/Nefarius.Peripherals.SerialPort/HsOutput.cs @@ -1,25 +1,27 @@ -namespace PInvokeSerialPort +namespace Nefarius.Peripherals.SerialPort; + +/// +/// Uses for RTS or DTR pins +/// +public enum HsOutput { /// - /// Uses for RTS or DTR pins + /// Pin is asserted when this station is able to receive data. /// - public enum HsOutput - { - /// - /// Pin is asserted when this station is able to receive data. - /// - Handshake = 2, - /// - /// Pin is asserted when this station is transmitting data (RTS on NT, 2000 or XP only). - /// - Gate = 3, - /// - /// Pin is asserted when this station is online (port is open). - /// - Online = 1, - /// - /// Pin is never asserted. - /// - None = 0 - }; + Handshake = 2, + + /// + /// Pin is asserted when this station is transmitting data (RTS on NT, 2000 or XP only). + /// + Gate = 3, + + /// + /// Pin is asserted when this station is online (port is open). + /// + Online = 1, + + /// + /// Pin is never asserted. + /// + None = 0 } \ No newline at end of file diff --git a/Nefarius.Peripherals.SerialPort/ModemStatus.cs b/Nefarius.Peripherals.SerialPort/ModemStatus.cs index 0daf900..dc993c9 100644 --- a/Nefarius.Peripherals.SerialPort/ModemStatus.cs +++ b/Nefarius.Peripherals.SerialPort/ModemStatus.cs @@ -1,6 +1,6 @@ -using PInvokeSerialPort.Win32PInvoke; +using Nefarius.Peripherals.SerialPort.Win32PInvoke; -namespace PInvokeSerialPort +namespace Nefarius.Peripherals.SerialPort { /// /// Represents the status of the modem control input signals. diff --git a/Nefarius.Peripherals.SerialPort/Nefarius.Peripherals.SerialPort.csproj b/Nefarius.Peripherals.SerialPort/Nefarius.Peripherals.SerialPort.csproj index c77c26d..99660d7 100644 --- a/Nefarius.Peripherals.SerialPort/Nefarius.Peripherals.SerialPort.csproj +++ b/Nefarius.Peripherals.SerialPort/Nefarius.Peripherals.SerialPort.csproj @@ -5,7 +5,7 @@ Ebrahim Byagowi, Benjamin Höglinger-Stelzer https://github.com/nefarius/PInvokeSerialPort https://github.com/nefarius/PInvokeSerialPort - Nefarius.PInvokeSerialPort + Nefarius.Peripherals.SerialPort P/Invoke wrapper for Win32API serial port Copyright 2012-2017 Ebrahim Byagowi, 2018-2022 Benjamin Höglinger-Stelzer https://raw.githubusercontent.com/Nefarius/PInvokeSerialPort/master/ProjectIcon.png @@ -14,6 +14,7 @@ $(SolutionDir)bin\ NSS-128x128.png + latest diff --git a/Nefarius.Peripherals.SerialPort/Parity.cs b/Nefarius.Peripherals.SerialPort/Parity.cs index 9889b7c..b2130a5 100644 --- a/Nefarius.Peripherals.SerialPort/Parity.cs +++ b/Nefarius.Peripherals.SerialPort/Parity.cs @@ -1,4 +1,4 @@ -namespace PInvokeSerialPort +namespace Nefarius.Peripherals.SerialPort { /// /// Parity settings diff --git a/Nefarius.Peripherals.SerialPort/QueueStatus.cs b/Nefarius.Peripherals.SerialPort/QueueStatus.cs index 33979c6..69bf8de 100644 --- a/Nefarius.Peripherals.SerialPort/QueueStatus.cs +++ b/Nefarius.Peripherals.SerialPort/QueueStatus.cs @@ -1,7 +1,7 @@ using System.Text; -using PInvokeSerialPort.Win32PInvoke; +using Nefarius.Peripherals.SerialPort.Win32PInvoke; -namespace PInvokeSerialPort +namespace Nefarius.Peripherals.SerialPort { /// /// Represents the current condition of the port queues. diff --git a/Nefarius.Peripherals.SerialPort/SerialPort.cs b/Nefarius.Peripherals.SerialPort/SerialPort.cs index 08b551b..673e2a5 100644 --- a/Nefarius.Peripherals.SerialPort/SerialPort.cs +++ b/Nefarius.Peripherals.SerialPort/SerialPort.cs @@ -2,9 +2,9 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading; -using PInvokeSerialPort.Win32PInvoke; +using Nefarius.Peripherals.SerialPort.Win32PInvoke; -namespace PInvokeSerialPort +namespace Nefarius.Peripherals.SerialPort { /// /// PInvokeSerialPort main class. diff --git a/Nefarius.Peripherals.SerialPort/StopBits.cs b/Nefarius.Peripherals.SerialPort/StopBits.cs index cb72f33..f59b705 100644 --- a/Nefarius.Peripherals.SerialPort/StopBits.cs +++ b/Nefarius.Peripherals.SerialPort/StopBits.cs @@ -1,4 +1,4 @@ -namespace PInvokeSerialPort +namespace Nefarius.Peripherals.SerialPort { /// /// Stop bit settings diff --git a/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMMPROP.cs b/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMMPROP.cs index 2fa0a66..bbd37be 100644 --- a/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMMPROP.cs +++ b/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMMPROP.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace PInvokeSerialPort.Win32PInvoke +namespace Nefarius.Peripherals.SerialPort.Win32PInvoke { [StructLayout(LayoutKind.Sequential)] internal struct COMMPROP diff --git a/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMMTIMEOUTS.cs b/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMMTIMEOUTS.cs index 506c49a..6f74e2b 100644 --- a/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMMTIMEOUTS.cs +++ b/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMMTIMEOUTS.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace PInvokeSerialPort.Win32PInvoke +namespace Nefarius.Peripherals.SerialPort.Win32PInvoke { [StructLayout(LayoutKind.Sequential)] internal struct COMMTIMEOUTS diff --git a/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMSTAT.cs b/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMSTAT.cs index c4d5be0..523182c 100644 --- a/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMSTAT.cs +++ b/Nefarius.Peripherals.SerialPort/Win32PInvoke/COMSTAT.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace PInvokeSerialPort.Win32PInvoke +namespace Nefarius.Peripherals.SerialPort.Win32PInvoke { [StructLayout(LayoutKind.Sequential)] internal struct COMSTAT diff --git a/Nefarius.Peripherals.SerialPort/Win32PInvoke/DCB.cs b/Nefarius.Peripherals.SerialPort/Win32PInvoke/DCB.cs index 4ef5aba..ff3bee2 100644 --- a/Nefarius.Peripherals.SerialPort/Win32PInvoke/DCB.cs +++ b/Nefarius.Peripherals.SerialPort/Win32PInvoke/DCB.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace PInvokeSerialPort.Win32PInvoke +namespace Nefarius.Peripherals.SerialPort.Win32PInvoke { [StructLayout(LayoutKind.Sequential)] internal struct DCB diff --git a/Nefarius.Peripherals.SerialPort/Win32PInvoke/OVERLAPPED.cs b/Nefarius.Peripherals.SerialPort/Win32PInvoke/OVERLAPPED.cs index c26ff13..8bd992a 100644 --- a/Nefarius.Peripherals.SerialPort/Win32PInvoke/OVERLAPPED.cs +++ b/Nefarius.Peripherals.SerialPort/Win32PInvoke/OVERLAPPED.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace PInvokeSerialPort.Win32PInvoke +namespace Nefarius.Peripherals.SerialPort.Win32PInvoke { [StructLayout(LayoutKind.Sequential)] internal struct OVERLAPPED diff --git a/Nefarius.Peripherals.SerialPort/Win32PInvoke/Win32Com.cs b/Nefarius.Peripherals.SerialPort/Win32PInvoke/Win32Com.cs index 029af99..cd2cbb7 100644 --- a/Nefarius.Peripherals.SerialPort/Win32PInvoke/Win32Com.cs +++ b/Nefarius.Peripherals.SerialPort/Win32PInvoke/Win32Com.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace PInvokeSerialPort.Win32PInvoke +namespace Nefarius.Peripherals.SerialPort.Win32PInvoke { internal class Win32Com {