点击或拖拽改变大小

SoftBasic 类

一个软件基础类,提供常用的一些静态方法,比如字符串转换,字节转换的方法
A software-based class that provides some common static methods,Such as string conversion, byte conversion method
继承层次
SystemObject
  HslCommunication.BasicFrameworkSoftBasic

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

SoftBasic 类型公开以下成员。

构造函数
  名称说明
公共方法SoftBasic
初始化 SoftBasic 类的一个新实例
Top
属性
  名称说明
公共属性静态成员FrameworkVersion
设置或获取系统框架的版本号
Set or get the version number of the system framework
Top
方法
  名称说明
公共方法静态成员代码示例AddArrayDataT
一个通用的数组新增个数方法,会自动判断越界情况,越界的情况下,会自动的截断或是填充
A common array of new methods, will automatically determine the cross-border situation, in the case of cross-border, will be automatically truncated or filled
公共方法静态成员代码示例ArrayExpandToLengthT
将一个数组进行扩充到指定长度,或是缩短到指定长度
Extend an array to a specified length, or shorten to a specified length or fill
公共方法静态成员代码示例ArrayExpandToLengthEvenT
将一个数组进行扩充到偶数长度
Extend an array to even lengths
公共方法静态成员ArrayFormatT(T)
将数组格式化为显示的字符串的信息,支持所有的类型对象
Formats the array into the displayed string information, supporting all types of objects
公共方法静态成员ArrayFormatT(T)
将数组格式化为显示的字符串的信息,支持所有的类型对象
Formats the array into the displayed string information, supporting all types of objects
公共方法静态成员ArrayFormatT(T, String)
将数组格式化为显示的字符串的信息,支持所有的类型对象
Formats the array into the displayed string information, supporting all types of objects
公共方法静态成员ArrayFormatT(T, String)
将数组格式化为显示的字符串的信息,支持所有的类型对象
Formats the array into the displayed string information, supporting all types of objects
公共方法静态成员代码示例ArrayRemoveBeginT
将一个数组的前面指定位数移除,返回新的一个数组
Removes the preceding specified number of bits in a array, returning a new array
公共方法静态成员代码示例ArrayRemoveDoubleT
将一个数组的前后移除指定位数,返回新的一个数组
Removes a array before and after the specified number of bits, returning a new array
公共方法静态成员代码示例ArrayRemoveLastT
将一个数组的后面指定位数移除,返回新的一个数组
Removes the specified number of digits after a array, returning a new array
公共方法静态成员代码示例ArraySelectBeginT
选择一个数组的前面的几个数据信息
Select the begin few items of data information of a array
公共方法静态成员代码示例ArraySelectLastT
选择一个数组的后面的几个数据信息
Select the last few items of data information of a array
公共方法静态成员代码示例ArraySelectMiddleT
获取到数组里面的中间指定长度的数组
Get an array of the specified length in the array
公共方法静态成员代码示例ArraySplitByLengthT
将指定的数据按照指定长度进行分割,例如int[10],指定长度4,就分割成int[4],int[4],int[2],然后拼接list
Divide the specified data according to the specified length, such as int [10], and specify the length of 4 to divide into int [4], int [4], int [2], and then concatenate the list
公共方法静态成员AsciiBytesToBytes
将ascii格式的byte数组转换成原始的byte数组
Converts an ASCII-formatted byte array to the original byte array
公共方法静态成员代码示例BoolArrayToByte
将bool数组转换到byte数组
Converting a bool array to a byte array
公共方法静态成员BoolArrayToString
将bool数组转换为字符串进行显示,true被转为1,false转换为0
Convert the bool array to a string for display, true is converted to 1, false is converted to 0
公共方法静态成员代码示例BoolOnByteIndex
获取byte数据类型的第offset位,是否为True
Gets the index bit of the byte data type, whether it is True
公共方法静态成员BuildAsciiBytesFrom(Byte)
从字节构建一个ASCII格式的数据内容
Build an ASCII-formatted data content from bytes
公共方法静态成员BuildAsciiBytesFrom(Byte)
从字节数组构建一个ASCII格式的数据内容
Byte array to construct an ASCII format data content
公共方法静态成员BuildAsciiBytesFrom(Int16)
从short构建一个ASCII格式的数据内容
Constructing an ASCII-formatted data content from a short
公共方法静态成员BuildAsciiBytesFrom(UInt16)
从ushort构建一个ASCII格式的数据内容
Constructing an ASCII-formatted data content from ushort
公共方法静态成员BuildAsciiBytesFrom(UInt32)
从uint构建一个ASCII格式的数据内容
Constructing an ASCII-formatted data content from uint
公共方法静态成员代码示例BytesReverseByWord
将byte数组按照双字节进行反转,如果为单数的情况,则自动补齐
Reverses the byte array by double byte, or if the singular is the case, automatically
公共方法静态成员BytesToAsciiBytes
将原始的byte数组转换成ascii格式的byte数组
Converts the original byte array to an ASCII-formatted byte array
公共方法静态成员代码示例ByteToBoolArray(Byte)
从Byte数组中提取所有的位数组
Extracts a bit array from a byte array, length represents the number of digits
公共方法静态成员代码示例ByteToBoolArray(Byte, Int32)
从Byte数组中提取位数组,length代表位数,例如数组 03 A1 长度10转为 [1100 0000 10]
Extracts a bit array from a byte array, length represents the number of digits
公共方法静态成员ByteToBoolArray(Byte, Int32, Byte)
从Byte数组中提取位数组,length代表位数,例如数组 01 00 长度10转为 [true,false]
公共方法静态成员代码示例ByteToHexString(Byte)
字节数据转化成16进制表示的字符串
Byte data into a string of 16 binary representations
公共方法静态成员ByteToHexString(String)
字符串数据转化成16进制表示的字符串
String data into a string of 16 binary representations
公共方法静态成员代码示例ByteToHexString(Byte, Char)
字节数据转化成16进制表示的字符串
Byte data into a string of 16 binary representations
公共方法静态成员代码示例ByteToHexString(Byte, Char, Int32, String)
字节数据转化成16进制表示的字符串
Byte data into a string of 16 binary representations
公共方法静态成员代码示例CalculateFileMD5
获取文件的md5码
Get the MD5 code of the file
公共方法静态成员代码示例CalculateStreamMD5(Bitmap)
获取内存图片的md5码
Get the MD5 code of the memory picture
公共方法静态成员代码示例CalculateStreamMD5(Stream)
获取数据流的md5码
Get the MD5 code for the data stream
公共方法静态成员CalculateStreamMD5(String)
获取文本字符串信息的Md5码,编码为UTF8
Get the Md5 code of the text string information, using the utf-8 encoding
公共方法静态成员CalculateStreamMD5(String, Encoding)
获取文本字符串信息的Md5码,使用指定的编码
Get the Md5 code of the text string information, using the specified encoding
公共方法静态成员代码示例DeepClone
使用序列化反序列化深度克隆一个对象,该对象需要支持序列化特性
Cloning an object with serialization deserialization depth that requires support for serialization attributes
公共方法Equals (继承自 Object。)
受保护的方法Finalize (继承自 Object。)
公共方法静态成员GetAsciiStringRender
将字节数组显示为ASCII格式的字符串,当遇到0x20以下及0x7E以上的不可见字符时,使用十六进制的数据显示
Display the byte array as a string in ASCII format, when encountering invisible characters below 0x20 and above 0x7E, use hexadecimal data to display
公共方法静态成员代码示例GetEnumFromStringTEnum
从字符串的枚举值数据转换成真实的枚举值数据
Convert enumeration value data from strings to real enumeration value data
公共方法静态成员代码示例GetEnumValuesTEnum
获取一个枚举类型的所有枚举值,可直接应用于组合框数据
Gets all the enumeration values of an enumeration type that can be applied directly to the combo box data
公共方法静态成员代码示例GetExceptionMessage(Exception)
获取一个异常的完整错误信息
Gets the complete error message for an exception
公共方法静态成员代码示例GetExceptionMessage(String, Exception)
获取一个异常的完整错误信息,和额外的字符串描述信息
Gets the complete error message for an exception, and additional string description information
公共方法静态成员GetFromAsciiStringRender
从显示的ASCII格式的字符串,转为原始字节数组,如果遇到 \00 这种表示原始字节的内容,则直接进行转换操作,遇到 \r 直接转换 0x0D, \n 直接转换 0x0A
Convert from the displayed string in ASCII format to the original byte array. If you encounter \00, which represents the original byte content, the conversion operation is performed directly. When encountering \r, it is directly converted to 0x0D, and \n is directly converted to 0x0A.
公共方法GetHashCode (继承自 Object。)
公共方法静态成员代码示例GetSizeDescription
从一个字节大小返回带单位的描述,主要是用于显示操作
Returns a description with units from a byte size, mainly for display operations
公共方法静态成员代码示例GetTimeSpanDescription
从一个时间差返回带单位的描述,主要是用于显示操作。
Returns a description with units from a time difference, mainly for display operations.
公共方法GetType (继承自 Object。)
公共方法静态成员代码示例GetUniqueStringByGuidAndRandom
获取一串唯一的随机字符串,长度为20,由Guid码和4位数的随机数组成,保证字符串的唯一性
Gets a string of unique random strings with a length of 20, consisting of a GUID code and a 4-digit random number to guarantee the uniqueness of the string
公共方法静态成员代码示例GetValueFromJsonObjectT
一个泛型方法,提供json对象的数据读取
A generic method that provides data read for a JSON object
公共方法静态成员GetXmlValueT
一个泛型的方法,提供XML对象的数据读取为实际的数据,支持BCL的基础类型。
A generic method that provides data for XML objects to be read as actual data, supporting the underlying types of BCL.
公共方法静态成员代码示例HexStringToBytes
将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
公共方法静态成员代码示例IsByteTokenEquel
判断两个数据的令牌是否相等
Determines whether the tokens of two data are equal
公共方法静态成员代码示例IsTwoBytesEquel(Byte, Byte)
判断两个字节的指定部分是否相同
Determines whether the specified portion of a two-byte is the same
公共方法静态成员代码示例IsTwoBytesEquel(Byte, Int32, Byte, Int32, Int32)
判断两个字节的指定部分是否相同
Determines whether the specified portion of a two-byte is the same
公共方法静态成员IsTwoTokenEquel
判断两个数据的令牌是否相等
Determines whether the tokens of two data are equal
公共方法静态成员代码示例JsonSetValueT
一个泛型方法,提供json对象的数据写入
A generic method that provides data writing to a JSON object
受保护的方法MemberwiseClone (继承自 Object。)
公共方法静态成员代码示例SetBoolOnByteIndex
设置取byte数据类型的第offset位,是否为True
Set the offset bit of the byte data type, whether it is True
公共方法静态成员ShowExceptionMessage(Exception)
显示一个完整的错误信息
Displays a complete error message
公共方法静态成员ShowExceptionMessage(String, Exception)
显示一个完整的错误信息,和额外的字符串描述信息
Displays a complete error message, and additional string description information
公共方法静态成员代码示例SpliceArrayT
拼接任意个泛型数组为一个总的泛型数组对象,采用深度拷贝实现。
Splicing any number of generic arrays into a total generic array object is implemented using deep copy.
公共方法静态成员SpliceStringArray(String, String)
将一个String的数组和多个String 类型的对象整合成一个数组
Combine an array of String and multiple objects of type String into an array
公共方法静态成员SpliceStringArray(String, String, String)
将两个String的数组和多个String 类型的对象整合成一个数组
Combine two arrays of String and multiple objects of type String into one array
公共方法静态成员SpliceStringArray(String, String, String, String)
将两个String的数组和多个String 类型的对象整合成一个数组
Combine two arrays of String and multiple objects of type String into one array
公共方法静态成员代码示例SplitIntegerToArray
将整数进行有效的拆分成数组,指定每个元素的最大值
Effectively split integers into arrays, specifying the maximum value for each element
公共方法ToString (继承自 Object。)
公共方法静态成员UrlDecode
将url的编码解码为真实的字符串,例如 %2F%E4%B8%AD%E6%96%87 解码为 中文
Decode the encoding of url as a real string, for example %2F%E4%B8%AD%E6%96%87 to 中文
公共方法静态成员UrlEncode
将字符串编码为URL可以识别的字符串,中文会被编码为%开头的数据,例如 中文 转义为 %2F%E4%B8%AD%E6%96%87
Encoding a string as a URL-recognizable string Chinese encoded as data that begins with %, such as 中文 escaped as %2F%E4%B8%AD%E6%96%87
Top
扩展方法
  名称说明
公共扩展器方法ToJsonString
获取当前对象的JSON格式表示的字符串。
Gets the string represented by the JSON format of the current object.
(由 HslExtension 定义。)
Top
参见