点击或拖拽改变大小

HslExtension 类

扩展的辅助类方法
继承层次
SystemObject
  HslCommunicationHslExtension

命名空间:  HslCommunication
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public static class HslExtension

HslExtension 类型公开以下成员。

方法
  名称说明
公共方法静态成员BeginReceiveResult(Socket, AsyncCallback)
启动接收数据,需要传入回调方法,传递对象默认为socket本身
To start receiving data, you need to pass in a callback method. The default object is the socket itself.
公共方法静态成员BeginReceiveResult(Socket, AsyncCallback, Object)
启动接收数据,需要传入回调方法,传递对象
To start receiving data, you need to pass in a callback method and pass an object
公共方法静态成员CopyArrayT
拷贝当前的实例数组,是基于引用层的浅拷贝,如果类型为值类型,那就是深度拷贝,如果类型为引用类型,就是浅拷贝
公共方法静态成员DecryptLargeData
对超过117字节限制的加密数据进行解密,解密出原始的字节数据,因为RSA本身限制了117字节,所以此处进行数据切割解密。
Decrypt the encrypted data that exceeds the 117-byte limit and decrypt the original byte data, because RSA itself limits 117 bytes, so the data is cut and decrypted here.
公共方法静态成员EncryptLargeData
对原始字节的数据进行加密,不限制长度,因为RSA本身限制了117字节,所以此处进行数据切割加密。
Encrypt the original byte data without limiting the length, because RSA itself limits 117 bytes, so the data is cut and encrypted here.
公共方法静态成员EndReceiveResult
结束挂起的异步读取,返回读取的字节数,如果成功的情况。
Ends the pending asynchronous read and returns the number of bytes read, if successful.
公共方法静态成员EveryByteAdd
将指定的数据添加到数组的每个元素上去,会改变每个元素的值
公共方法静态成员GetBoolByIndex(Byte, Int32)
获取Byte的第 boolIndex 偏移的bool值,比如3,就是第4位
Get the bool value of Byte's boolIndex offset, such as 3, which is the 4th bit
公共方法静态成员GetBoolByIndex(Byte, Int32)
获取Byte数组的第 boolIndex 偏移的bool值,这个偏移值可以为 10,就是第 1 个字节的 第3位
Get the bool value of the boolIndex offset of the Byte array. The offset value can be 10, which is the third bit of the first byte
公共方法静态成员GetBoolByIndex(Int16, Int32)
获取short类型数据的第 boolIndex (从0起始)偏移的bool值,比如3,就是第4位
Get the bool value of the boolIndex (starting from 0) offset of the short type data, such as 3, which is the 4th bit
公共方法静态成员GetBoolByIndex(Int32, Int32)
获取int类型数据的第 boolIndex (从0起始)偏移的bool值,比如3,就是第4位
Get the bool value of the boolIndex (starting from 0) offset of the int type data, such as 3, which is the 4th bit
公共方法静态成员GetBoolByIndex(Int64, Int32)
获取long类型数据的第 boolIndex (从0起始)偏移的bool值,比如3,就是第4位
Get the bool value of the boolIndex (starting from 0) offset of the long type data, such as 3, which is the 4th bit
公共方法静态成员GetBoolByIndex(UInt16, Int32)
获取ushort类型数据的第 boolIndex (从0起始)偏移的bool值,比如3,就是第4位
Get the bool value of the boolIndex (starting from 0) offset of the ushort type data, such as 3, which is the 4th bit
公共方法静态成员GetBoolByIndex(UInt32, Int32)
获取uint类型数据的第 boolIndex (从0起始)偏移的bool值,比如3,就是第4位
Get the bool value of the boolIndex (starting from 0) offset of the uint type data, such as 3, which is the 4th bit
公共方法静态成员GetBoolByIndex(UInt64, Int32)
获取ulong类型数据的第 boolIndex (从0起始)偏移的bool值,比如3,就是第4位
Get the bool value of the boolIndex (starting from 0) offset of the ulong type data, such as 3, which is the 4th bit
公共方法静态成员GetBoolValue
获取Byte数组的第 bytIndex 个位置的,boolIndex偏移的bool值
Get the bool value of the bytIndex position of the Byte array and the boolIndex offset
公共方法静态成员GetBytes
根据指定的字节长度信息,获取到随机的字节信息
Obtain random byte information according to the specified byte length information
公共方法静态成员GetPEMPrivateKey
从RSA的算法对象里,获取到PEM格式的原始私钥数据,如果需要存储,或是显示,只需要 Convert.ToBase64String 方法
Obtain the original private key data in PEM format from the RSA algorithm object. If you need to store or display it, you only need the Convert.ToBase64String method
公共方法静态成员GetPEMPublicKey
从RSA的算法对象里,获取到PEM格式的原始公钥数据,如果需要存储,或是显示,只需要 Convert.ToBase64String 方法
Obtain the original public key data in PEM format from the RSA algorithm object. If you need to store or display it, you only need the Convert.ToBase64String method
公共方法静态成员GetStringOrEndChar
从字节数组里提取字符串数据,如果碰到0x00字节,就直接结束
公共方法静态成员代码示例GetValueOrDefaultT
一个泛型方法,提供json对象的数据读取
A generic method that provides data read for a JSON object
公共方法静态成员IncreaseByT
将指定的数据添加到数组的每个元素上去,使用表达式树的形式实现,将会修改原数组。不适用byte类型
公共方法静态成员IniSerialByFormatString
使用格式化的串口参数信息来初始化串口的参数,举例:9600-8-N-1,分别表示波特率,数据位,奇偶校验,停止位,当然也可以携带串口名称,例如:COM3-9600-8-N-1,linux环境也是支持的。
Use the formatted serial port parameter information to initialize the serial port parameters, for example: 9600-8-N-1, which means baud rate, data bit, parity, stop bit, of course, can also carry the serial port name, for example: COM3- 9600-8-N-1, linux environment is also supported.
公共方法静态成员Receive
从串口接收指定长度的字节数组信息,还可以指定超时时间,以及休眠间歇时间。
Receive byte array information of specified length from the serial port, and can also specify the timeout time and sleep intermittent time.
公共方法静态成员代码示例RemoveBeginT
将一个数组的前面指定位数移除,返回新的一个数组
Removes the preceding specified number of bits in a array, returning a new array
公共方法静态成员代码示例RemoveDoubleT
将一个数组的前后移除指定位数,返回新的一个数组
Removes a array before and after the specified number of bits, returning a new array
公共方法静态成员RemoveLast(String, Int32)
移除指定字符串数据的最后 length 个字符。如果字符串本身的长度不足 length,则返回为空字符串。
Remove the last "length" characters of the specified string data. If the length of the string itself is less than length, an empty string is returned.
公共方法静态成员代码示例RemoveLastT(T, Int32)
将一个数组的后面指定位数移除,返回新的一个数组
Removes the specified number of digits after a array, returning a new array
公共方法静态成员代码示例ReverseByWord
将byte数组按照双字节进行反转,如果为单数的情况,则自动补齐
Reverses the byte array by double byte, or if the singular is the case, automatically
公共方法静态成员ReverseNewT
获取当前数组的倒序数组,这是一个新的实例,不改变原来的数组值
Get the reversed array of the current byte array, this is a new instance, does not change the original array value
公共方法静态成员代码示例SelectBeginT
选择一个数组的前面的几个数据信息
Select the begin few items of data information of a array
公共方法静态成员代码示例SelectLastT
选择一个数组的后面的几个数据信息
Select the last few items of data information of a array
公共方法静态成员代码示例SelectMiddleT
获取到数组里面的中间指定长度的数组
Get an array of the specified length in the array
公共方法静态成员SetBoolByIndex(Byte, Int32, Boolean)
设置Byte的第 boolIndex 位的bool值,可以强制为 true 或是 false, 不影响其他的位
Set the bool value of the boolIndex bit of Byte, which can be forced to true or false, without affecting other bits
公共方法静态成员SetBoolByIndex(Byte, Int32, Boolean)
设置Byte[]的第 boolIndex 位的bool值,可以强制为 true 或是 false, 不影响其他的位,如果是第 10 位,则表示第 1 个字节的第 2 位(都是从 0 地址开始算的)
Set the bool value of the boolIndex bit of Byte[], which can be forced to true or false, without affecting other bits. If it is the 10th bit, it means the second bit of the first byte (both starting from the 0 address Calculated)
公共方法静态成员SetBoolByIndex(Int16, Int32, Boolean)
修改short数据的某个位,并且返回修改后的值,不影响原来的值。位索引为 0~15,之外的值会引发异常
Modify a bit of short data and return the modified value without affecting the original value. Bit index is 0~15, values outside will raise an exception
公共方法静态成员SetBoolByIndex(Int32, Int32, Boolean)
修改int数据的某个位,并且返回修改后的值,不影响原来的值。位索引为 0~31,之外的值会引发异常
Modify a bit of int data and return the modified value without affecting the original value. Bit index is 0~31, values outside will raise an exception
公共方法静态成员SetBoolByIndex(Int64, Int32, Boolean)
修改long数据的某个位,并且返回修改后的值,不影响原来的值。位索引为 0~63,之外的值会引发异常
Modify a bit of long data and return the modified value without affecting the original value. Bit index is 0~63, values outside will raise an exception
公共方法静态成员SetBoolByIndex(UInt16, Int32, Boolean)
修改ushort数据的某个位,并且返回修改后的值,不影响原来的值。位索引为 0~15,之外的值会引发异常
Modify a bit of ushort data and return the modified value without affecting the original value. Bit index is 0~15, values outside will raise an exception
公共方法静态成员SetBoolByIndex(UInt32, Int32, Boolean)
修改uint数据的某个位,并且返回修改后的值,不影响原来的值。位索引为 0~31,之外的值会引发异常
Modify a bit of uint data and return the modified value without affecting the original value. Bit index is 0~31, values outside will raise an exception
公共方法静态成员SetBoolByIndex(UInt64, Int32, Boolean)
修改ulong数据的某个位,并且返回修改后的值,不影响原来的值。位索引为 0~63,之外的值会引发异常
Modify a bit of ulong data and return the modified value without affecting the original value. Bit index is 0~63, values outside will raise an exception
公共方法静态成员SetKeepAlive
设置套接字的活动时间和活动间歇时间,此值会设置到socket低级别的控制中,传入值如果为负数,则表示不使用 KeepAlive 功能。
Set the active time and active intermittent time of the socket. This value will be set to the low-level control of the socket. If the incoming value is a negative number, it means that the KeepAlive function is not used.
公共方法静态成员代码示例SpliceArrayT
拼接任意个泛型数组为一个总的泛型数组对象,采用深度拷贝实现。
Splicing any number of generic arrays into a total generic array object is implemented using deep copy.
公共方法静态成员SplitDot
根据英文小数点进行切割字符串,去除空白的字符
Cut the string according to the English decimal point and remove the blank characters
公共方法静态成员ToArrayStringT(T)
将数组格式化为显示的字符串的信息,支持所有的类型对象
Formats the array into the displayed string information, supporting all types of objects
公共方法静态成员ToArrayStringT(T, String)
将数组格式化为显示的字符串的信息,支持所有的类型对象
Formats the array into the displayed string information, supporting all types of objects
公共方法静态成员代码示例ToBoolArray(Byte)
从Byte数组中提取所有的位数组
Extracts a bit array from a byte array, length represents the number of digits
公共方法静态成员代码示例ToBoolArray(Byte, Int32)
从Byte数组中提取位数组,length代表位数,例如数组 03 A1 长度10转为 [1100 0000 10]
Extracts a bit array from a byte array, length represents the number of digits
公共方法静态成员代码示例ToByteArray
将bool数组转换到byte数组
Converting a bool array to a byte array
公共方法静态成员代码示例ToHexBytes
将16进制的字符串转化成Byte数据,将检测每2个字符转化,也就是说,中间可以是任意字符
Converts a 16-character string into byte data, which will detect every 2 characters converted, that is, the middle can be any character
公共方法静态成员代码示例ToHexString(Byte)
字节数据转化成16进制表示的字符串
Byte data into a string of 16 binary representations
公共方法静态成员代码示例ToHexString(Byte, Char)
字节数据转化成16进制表示的字符串
Byte data into a string of 16 binary representations
公共方法静态成员代码示例ToHexString(Byte, Char, Int32, String)
字节数据转化成16进制表示的字符串
Byte data into a string of 16 binary representations
公共方法静态成员ToJsonString
获取当前对象的JSON格式表示的字符串。
Gets the string represented by the JSON format of the current object.
公共方法静态成员ToStringArrayT(String)
将字符串数组转换为实际的数据数组。支持byte,sbyte,bool,short,ushort,int,uint,long,ulong,float,double,使用默认的十进制,例如字符串格式[1,2,3,4,5],可以转成实际的数组对象
Converts a string array into an actual data array. Support byte, sbyte, bool, short, ushort, int, uint, long, ulong, float, double, use the default decimal, such as the string format [1,2,3,4,5], which can be converted into an actual array Object
公共方法静态成员ToStringArrayT(String, FuncString, T)
将字符串数组转换为实际的数据数组。例如字符串格式[1,2,3,4,5],可以转成实际的数组对象
Converts a string array into an actual data array. For example, the string format [1,2,3,4,5] can be converted into an actual array object
公共方法静态成员Write
公共方法静态成员WriteReverse
UInt16数据写入到字节流,字节顺序为相反
Write UInt16 data to the byte stream, the byte order is reversed
Top
参见