diff --git a/.gitignore b/.gitignore index d29d198..af5c6a9 100755 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ _ReSharper*/ /packages /.tmp *.DotSettings +/misc diff --git a/Nefarius.Peripherals.SerialPort.sln b/Nefarius.Peripherals.SerialPort.sln index 3b5a375..0275349 100644 --- a/Nefarius.Peripherals.SerialPort.sln +++ b/Nefarius.Peripherals.SerialPort.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29613.14 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32825.248 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PInvokeSerialPort", "Nefarius.Peripherals.SerialPort\Nefarius.Peripherals.SerialPort.csproj", "{AEC711A5-AA9B-4127-A82C-C4D8FDA9741A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nefarius.Peripherals.SerialPort", "Nefarius.Peripherals.SerialPort\Nefarius.Peripherals.SerialPort.csproj", "{AEC711A5-AA9B-4127-A82C-C4D8FDA9741A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{99052083-B245-462F-8778-4C94662ABABE}" ProjectSection(SolutionItems) = preProject @@ -49,12 +49,14 @@ Global {928609B4-70AB-4D93-A43E-4BE75C279066}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {928609B4-70AB-4D93-A43E-4BE75C279066}.Release|Mixed Platforms.Build.0 = Release|Any CPU {928609B4-70AB-4D93-A43E-4BE75C279066}.Release|x86.ActiveCfg = Release|Any CPU - {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Debug|Any CPU.ActiveCfg = Debug|x86 + {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Debug|Any CPU.Build.0 = Debug|Any CPU {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Debug|Mixed Platforms.Build.0 = Debug|x86 {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Debug|x86.ActiveCfg = Debug|x86 {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Debug|x86.Build.0 = Debug|x86 - {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Release|Any CPU.ActiveCfg = Release|x86 + {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Release|Any CPU.Build.0 = Release|Any CPU {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Release|Mixed Platforms.ActiveCfg = Release|x86 {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Release|Mixed Platforms.Build.0 = Release|x86 {76FAB402-7515-4A9B-8605-4FEC0736C78A}.Release|x86.ActiveCfg = Release|x86 diff --git a/Nefarius.Peripherals.SerialPort/Nefarius.Peripherals.SerialPort.csproj b/Nefarius.Peripherals.SerialPort/Nefarius.Peripherals.SerialPort.csproj index ce80c6b..c462703 100644 --- a/Nefarius.Peripherals.SerialPort/Nefarius.Peripherals.SerialPort.csproj +++ b/Nefarius.Peripherals.SerialPort/Nefarius.Peripherals.SerialPort.csproj @@ -17,9 +17,10 @@ latest - - + + + diff --git a/PInvokeSerialPort.Sample/PInvokeSerialPort.Sample.csproj b/PInvokeSerialPort.Sample/PInvokeSerialPort.Sample.csproj index 3582d0a..5777734 100755 --- a/PInvokeSerialPort.Sample/PInvokeSerialPort.Sample.csproj +++ b/PInvokeSerialPort.Sample/PInvokeSerialPort.Sample.csproj @@ -1,69 +1,18 @@ - - + - Debug - x86 8.0.30703 - 2.0 {76FAB402-7515-4A9B-8605-4FEC0736C78A} Exe - Properties - PInvokeSerialPort.Sample - PInvokeSerialPort.Sample - v4.6.1 - - - 512 - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false + net6 + PInvokeSerialPort.Sample + PInvokeSerialPort.Sample + Copyright © 2012 + bin\$(Configuration)\ + latest + - - - - - - - + - - - - - - - {AEC711A5-AA9B-4127-A82C-C4D8FDA9741A} - PInvokeSerialPort - - - - - - - + \ No newline at end of file diff --git a/PInvokeSerialPort.Sample/Program.cs b/PInvokeSerialPort.Sample/Program.cs index 926e95c..0d3358f 100755 --- a/PInvokeSerialPort.Sample/Program.cs +++ b/PInvokeSerialPort.Sample/Program.cs @@ -1,19 +1,23 @@ using System; -using PInvokeSerialPort; +using Nefarius.Peripherals.SerialPort; -namespace PInvokeSerialPort.Sample +namespace PInvokeSerialPort.Sample; + +internal class Program { - class Program + private static void Main(string[] args) { - static void Main(string[] args) + var serialPort = new SerialPort("com7") { UseRts = HsOutput.Online }; + + serialPort.DataReceived += x => { - var serialPort = new SerialPort("com1", 14400); - serialPort.DataReceived += x => Console.Write((char)x); - serialPort.Open(); - while (true) - { - serialPort.Write(Console.ReadKey().KeyChar); - } - } + Console.Write($"{x:X2} "); + }; + + serialPort.Open(); + + serialPort.Write("START\r\n"); + + Console.ReadKey(); } -} +} \ No newline at end of file diff --git a/PInvokeSerialPort.Sample/Properties/AssemblyInfo.cs b/PInvokeSerialPort.Sample/Properties/AssemblyInfo.cs index 6d4480c..5dcf965 100755 --- a/PInvokeSerialPort.Sample/Properties/AssemblyInfo.cs +++ b/PInvokeSerialPort.Sample/Properties/AssemblyInfo.cs @@ -2,18 +2,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("PInvokeSerialPort.Sample")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PInvokeSerialPort.Sample")] -[assembly: AssemblyCopyright("Copyright © 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. @@ -21,16 +9,3 @@ using System.Runtime.InteropServices; // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9628528d-5e4d-4071-aad1-b1f85f3d45d5")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PInvokeSerialPort.Test/PInvokeSerialPortTest.cs b/PInvokeSerialPort.Test/PInvokeSerialPortTest.cs index e1553f5..cddff64 100755 --- a/PInvokeSerialPort.Test/PInvokeSerialPortTest.cs +++ b/PInvokeSerialPort.Test/PInvokeSerialPortTest.cs @@ -2,6 +2,7 @@ using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Threading; +using Nefarius.Peripherals.SerialPort; namespace PInvokeSerialPort.Test {