<commit_before># GodSharp.SerialPort
Easy to use SerialPort class.

[![AppVeyor build status](https://img.shields.io/appveyor/ci/seayxu/godsharp-serialport.svg?label=appveyor&style=flat-square)](https://ci.appveyor.com/project/seayxu/godsharp-serialport/) [![NuGet](https://img.shields.io/nuget/v/GodSharp.SerialPort.svg?label=nuget&style=flat-square)](https://www.nuget.org/packages/GodSharp.SerialPort/) [![MyGet](https://img.shields.io/myget/seay/v/GodSharp.SerialPort.svg?label=myget&style=flat-square)](https://www.myget.org/Package/Details/seay?packageType=nuget&packageId=GodSharp.SerialPort)

# Getting Started

1. New instance GodSerialPort.

```
GodSerialPort serial = new GodSerialPort("COM1", 9600);
```

2. Initialize the GodSerialPort instance with received data action: `Action<byte[]>`.

```
serial.Init((bytes)=>{});
```

3. Open SerialPort object.

```
serial.Open();
```

4. Write/Send data.

```
byte[] bytes = new byte[]{31,32,33,34};
serial.Write(bytes);
serial.WriteAsciiString("ascii string");
serial.WriteHexString("7E 48 53 44");
```

5. Parity value.

-Parity.Space0|s|space
- Parity.Mark1|m|mark
- Parity.Even2|e|even
- Parity.Odd3|o|odd
- Parity.None4|n|none

6. StopBits value.

- StopBits.None0|n|none
- StopBits.One1|o|one
- StopBits.OnePointFive3|opf|of|f
- StopBits.Two2|t|two

7. Handshake value.

- Handshake.None0|n|none
- Handshake.RequestToSend1|r|rst
- Handshake.RequestToSendXOnXOff2|rtsxx|rsxx|rtsx|rsx|rx
- Handshake.XOnXOff3|x|xx

# Sample

```
class Program
{
    static void Main(string[] args)
    {
        Console.Write("input serialport number(only 0-9):");<commit_msg>fix a space in README file<commit_after># GodSharp.SerialPort
Easy to use SerialPort class.

[![AppVeyor build status](https://img.shields.io/appveyor/ci/seayxu/godsharp-serialport.svg?label=appveyor&style=flat-square)](https://ci.appveyor.com/project/seayxu/godsharp-serialport/) [![NuGet](https://img.shields.io/nuget/v/GodSharp.SerialPort.svg?label=nuget&style=flat-square)](https://www.nuget.org/packages/GodSharp.SerialPort/) [![MyGet](https://img.shields.io/myget/seay/v/GodSharp.SerialPort.svg?label=myget&style=flat-square)](https://www.myget.org/Package/Details/seay?packageType=nuget&packageId=GodSharp.SerialPort)

# Getting Started

1. New instance GodSerialPort.

```
GodSerialPort serial = new GodSerialPort("COM1", 9600);
```

2. Initialize the GodSerialPort instance with received data action: `Action<byte[]>`.

```
serial.Init((bytes)=>{});
```

3. Open SerialPort object.

```
serial.Open();
```

4. Write/Send data.

```
byte[] bytes = new byte[]{31,32,33,34};
serial.Write(bytes);
serial.WriteAsciiString("ascii string");
serial.WriteHexString("7E 48 53 44");
```

5. Parity value.

- Parity.Space0|s|space
- Parity.Mark1|m|mark
- Parity.Even2|e|even
- Parity.Odd3|o|odd
- Parity.None4|n|none

6. StopBits value.

- StopBits.None0|n|none
- StopBits.One1|o|one
- StopBits.OnePointFive3|opf|of|f
- StopBits.Two2|t|two

7. Handshake value.

- Handshake.None0|n|none
- Handshake.RequestToSend1|r|rst
- Handshake.RequestToSendXOnXOff2|rtsxx|rsxx|rtsx|rsx|rx
- Handshake.XOnXOff3|x|xx

# Sample

```
class Program
{
    static void Main(string[] args)
    {
        Console.Write("input serialport number(only 0-9):");
{'fraction_non_alphanumeric': 0.17404674046740468, 'fraction_numerical': 0.025830258302583026, 'mean_word_length': 5.341130604288499, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 12, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2508536', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1234, 'n_words': 176}