<commit_before># secs4net

[![NuGet](https://img.shields.io/nuget/v/secs4net.svg)](https://www.nuget.org/packages/secs4net/)

**Project Description**  
Note: Secs4net will only support .net6.0+ starting from v2.

SECS-II/HSMS-SS/GEM implementation on .NET. This library provide easy way to communicate with SEMI standard compatible device.  

1\. Send message to device
```cs
try
{
    var s3f17 = new SecsMessage(3, 17)
    {
        Name = "CreateProcessJob",
        SecsItem = L(
            U4(0),
            L(
                L(
                    A("Id"),
                    B(0x0D),
                    L(
                        A("carrier id"),
                        L(
                            U1(1)),
                        L(
                            U1(1),
                            A("recipe"),
                            L()),
                        Boolean(true),
                        L()))))
    };

    //access list
    s3f17.SecsItem[1][0][0] == A("Id");
    s3f17.SecsItem[1][0][2].Take(1..2); // LINQ Take with range
  
    //access item value
    byte b2 = s3f18.SecsItem[0].GetValue<byte>();
    string str = s3f18.SecsItem[0].GetString();

    //await secondary message
    var s3f18 = await device.SendAsync(s3f17); 

    // LINQ query
    var query =
        from a in s3f18.SecsItem.Items[3].Items
        select new {
            num = a.GetValue<int>(),
        };
}
catch(SecsException)
{
    // exception  when
    // T3 timeout
    // device reply SxF0
    // device reply S9Fx
}
```
2\. Handle primary message from device
```cs
secsGem.PrimaryMessageReceived += async (sender, messageWrapper) => 
{
    try 
    {
        //do something for primaryMsg
        var primaryMsg = messageWrapper.PrimaryMessage;
	   

        // reply secondary msg to device
        await messageWrapper.TryReplyAsync( secondaryMsg ); 
    }
    catch (Exception ex) 
    {

    }
};
```

3\. SecsMessage/Item construction is also LINQ friendly

```cs<commit_msg>update document<commit_after># secs4net

[![NuGet](https://img.shields.io/nuget/v/secs4net.svg)](https://www.nuget.org/packages/secs4net/)

**Project Description**  
Note: Secs4net will only support .net6.0+ starting from v2.

SECS-II/HSMS-SS/GEM implementation on .NET. This library provide easy way to communicate with SEMI standard compatible device.  

1\. Send message to device
```cs
try
{
    var s3f17 = new SecsMessage(3, 17)
    {
        Name = "CreateProcessJob",
        SecsItem = L(
            U4(0),
            L(
                L(
                    A("Id"),
                    B(0x0D),
                    L(
                        A("carrier id"),
                        L(
                            U1(1)),
                        L(
                            U1(1),
                            A("recipe"),
                            L()),
                        Boolean(true),
                        L()))))
    };

    //access list
    s3f17.SecsItem[1][0][0] == A("Id");
    s3f17.SecsItem[1][0][2].Take(1..2); // LINQ Take with range
  
    //access item value
    byte b2 = s3f18.SecsItem[0].GetValue<byte>();
    string str = s3f18.SecsItem[0].GetString();

    //await secondary message
    var s3f18 = await device.SendAsync(s3f17); 

    // LINQ query
    var query =
        from a in s3f18.SecsItem.Items[3]
        select new {
            num = a.GetValue<int>(),
        };
}
catch(SecsException)
{
    // exception  when
    // T3 timeout
    // device reply SxF0
    // device reply S9Fx
}
```
2\. Handle primary message from device
```cs
secsGem.PrimaryMessageReceived += async (sender, messageWrapper) => 
{
    try 
    {
        //do something for primaryMsg
        var primaryMsg = messageWrapper.PrimaryMessage;
       

        // reply secondary msg to device
        await messageWrapper.TryReplyAsync( secondaryMsg ); 
    }
    catch (Exception ex) 
    {

    }
};
```

3\. SecsMessage/Item construction is also LINQ friendly

```cs
{'fraction_non_alphanumeric': 0.12240300375469337, 'fraction_numerical': 0.030037546933667083, 'mean_word_length': 1.519546027742749, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '7259188', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1218, 'n_words': 296}