初始化
This commit is contained in:
BIN
.vs/KeyPressTest/v16/.suo
Normal file
BIN
.vs/KeyPressTest/v16/.suo
Normal file
Binary file not shown.
33
App.config
Normal file
33
App.config
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<section name="KeyPressTest.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
</sectionGroup>
|
||||||
|
</configSections>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||||
|
</startup>
|
||||||
|
<userSettings>
|
||||||
|
<KeyPressTest.My.MySettings>
|
||||||
|
<setting name="SerialPortName" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="scope" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
</KeyPressTest.My.MySettings>
|
||||||
|
</userSettings>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
||||||
15
Database/Base/ColumnSchema.vb
Normal file
15
Database/Base/ColumnSchema.vb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
''' <summary>
|
||||||
|
''' Contains the schema of a single DB column.
|
||||||
|
''' </summary>
|
||||||
|
Public Class ColumnSchema
|
||||||
|
Public ColumnName As String
|
||||||
|
Public ColumnType As String
|
||||||
|
Public Length As Integer
|
||||||
|
Public IsNullable As Boolean
|
||||||
|
Public DefaultValue As String
|
||||||
|
Public IsIdentity As Boolean
|
||||||
|
Public IsCaseSensitivity As Boolean? = Nothing
|
||||||
|
End Class
|
||||||
|
End NameSpace
|
||||||
297
Database/Base/CommandHelpers.vb
Normal file
297
Database/Base/CommandHelpers.vb
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
|
||||||
|
Public MustInherit Class CommandHelpers
|
||||||
|
Public Overridable Function Search(param As SearchParams) As String
|
||||||
|
Dim searchString As New StringBuilder
|
||||||
|
|
||||||
|
'基础查询
|
||||||
|
searchString.Append("Select")
|
||||||
|
searchString.Append(" ")
|
||||||
|
searchString.Append($"{String.Join(",", param.SearchColNames)}")
|
||||||
|
searchString.Append(" ")
|
||||||
|
searchString.Append("From")
|
||||||
|
searchString.Append(" ")
|
||||||
|
searchString.Append($"`{param.TableName}`")
|
||||||
|
|
||||||
|
'筛选条件
|
||||||
|
If param.SearchCondition IsNot Nothing Then
|
||||||
|
If param.SearchCondition.Count > 0 Then
|
||||||
|
searchString.Append(" ")
|
||||||
|
searchString.Append("Where")
|
||||||
|
For i As Integer = 0 To param.SearchCondition.Count - 1
|
||||||
|
If i > 0 Then
|
||||||
|
searchString.Append(" ")
|
||||||
|
searchString.Append(param.SearchCondition(i).LogicPrevious.ToString())
|
||||||
|
End If
|
||||||
|
searchString.Append(param.SearchCondition(i).ToString())
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'排序与排序方式
|
||||||
|
If param.OrderType <> SearchParams.OrderTypeEnum.None Then
|
||||||
|
searchString.Append($" Order By {param.OrderColName} {param.OrderType}")
|
||||||
|
End If
|
||||||
|
|
||||||
|
'返回结果行数
|
||||||
|
If param.Limit > -1 Then
|
||||||
|
searchString.Append($" Limit {param.Limit}")
|
||||||
|
End If
|
||||||
|
|
||||||
|
searchString.Append(";")
|
||||||
|
Return searchString.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Overridable Function SearchAll(tableName As String) As String
|
||||||
|
Return $"Select * FROM `{tableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchAll(tableName As String, condition As String) As String
|
||||||
|
Return $"Select * FROM `{tableName}` WHERE {condition};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function Search(columnName As List(Of String), tableName As String) As String
|
||||||
|
Dim colNameString As New StringBuilder
|
||||||
|
For i As Integer = 0 To columnName.Count - 1
|
||||||
|
If i = 0 Then
|
||||||
|
colNameString.Append($"`{columnName(i)}`")
|
||||||
|
Else
|
||||||
|
colNameString.Append($",`{columnName(i)}`")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return $"Select {colNameString} FROM `{tableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function Search(columnName As String, tableName As String) As String
|
||||||
|
Return $"Select {columnName} FROM `{tableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function Search(columnName As String, tableName As String, condition As String) As String
|
||||||
|
Return $"Select {columnName} FROM `{tableName}` WHERE {condition};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function Search(columnName As String, tableName As String, condition As String, limit As Integer) As String
|
||||||
|
Return $"Select {columnName} FROM `{tableName}` WHERE {condition} Limit {limit};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchDistinct(columnName As String, tableName As String) As String
|
||||||
|
Return $"Select Distinct {columnName} FROM `{tableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchDistinct(columnName As String, tableName As String, condition As String) As String
|
||||||
|
Return $"Select Distinct {columnName} FROM `{tableName}` WHERE {condition};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchDescOrder(columnName As String, tableName As String, orderCol As String) As String
|
||||||
|
Return $"Select {columnName} FROM `{tableName}` Order By {orderCol} Desc;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchDescOrder(columnName As String, tableName As String, orderCol As String, limit As Integer) As String
|
||||||
|
Return $"Select {columnName} FROM `{tableName}` Order By {orderCol} Desc Limit {limit};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchDescOrder(columnName As String, ByVal tableName As String, ByVal condition As String, ByVal orderCol As String) As String
|
||||||
|
Return $"Select {columnName} FROM `{tableName}` WHERE {condition} Order By `{orderCol}` Desc;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchDescOrder(columnName As String, ByVal tableName As String, ByVal condition As String, ByVal orderCol As String, limit As Integer) As String
|
||||||
|
Return $"Select {columnName} FROM `{tableName}` WHERE {condition} Order By `{orderCol}` Desc Limit {limit};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchAscOrder(ByVal columnName As String, ByVal tableName As String, ByVal orderCol As String) As String
|
||||||
|
Return $"Select {columnName} FROM `{tableName}` Order By {orderCol} Asc;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Overridable Function SearchAscOrder(ByVal columnName As String, ByVal tableName As String, ByVal condition As String, ByVal orderCol As String) As String
|
||||||
|
Return $"Select {columnName} FROM `{tableName}` WHERE {condition} Order By {orderCol} Asc;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchNullTable(tableName As String) As String
|
||||||
|
Return $"Select * FROM `{tableName}` Where Limit 0;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Overridable Function Insert(ByVal tableName As String, ByVal values As String) As String
|
||||||
|
Return $"Insert into `{tableName}` Values ( {values} );"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function Insert(ByVal tableName As String, ByVal colNames As String, ByVal values As String) As String
|
||||||
|
Return $"Insert into `{tableName}` ({colNames}) Values ( {values} );"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function Insert(tableName As String, dicNameValues As Dictionary(Of String, String)) As String
|
||||||
|
Dim colNames As New StringBuilder
|
||||||
|
Dim values As New StringBuilder
|
||||||
|
For Each keyValuePair As KeyValuePair(Of String, String) In dicNameValues
|
||||||
|
If colNames.Length = 0 Then
|
||||||
|
colNames.Append($"`{keyValuePair.Key}`")
|
||||||
|
values.Append($"'{keyValuePair.Value}'")
|
||||||
|
Else
|
||||||
|
colNames.Append($",`{keyValuePair.Key}`")
|
||||||
|
values.Append($",'{keyValuePair.Value}'")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return Insert(tableName, colNames.ToString(), values.ToString())
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function InsertByParameters(tableName As String, dicNameValues As Dictionary(Of String, String)) As String
|
||||||
|
Dim colNames As New StringBuilder
|
||||||
|
Dim values As New StringBuilder
|
||||||
|
For Each keyValuePair As KeyValuePair(Of String, String) In dicNameValues
|
||||||
|
If colNames.Length = 0 Then
|
||||||
|
colNames.Append($"`{keyValuePair.Key}`")
|
||||||
|
values.Append($"{keyValuePair.Value}")
|
||||||
|
Else
|
||||||
|
colNames.Append($",`{keyValuePair.Key}`")
|
||||||
|
values.Append($",{keyValuePair.Value}")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return Insert(tableName, colNames.ToString(), values.ToString())
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Overridable Function AddCol(ByVal tableName As String, ByVal colName As String, ByVal colType As String, Optional isNull As Boolean = True) As String
|
||||||
|
Return $"Alter Table `{tableName}` Add `{colName}` {colType} {IIf(isNull, "Default Null", "Not Null")};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function AddCol(ByVal tableName As String, colParam As DatabaseData) As String
|
||||||
|
Dim sb As New StringBuilder
|
||||||
|
sb.Append($"Alter Table `{tableName}` ")
|
||||||
|
sb.Append("Add ")
|
||||||
|
sb.Append(colParam.ToAddColString())
|
||||||
|
Return sb.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Overridable Function AddCols(tableName As String, colList As List(Of DatabaseData)) As String
|
||||||
|
Dim sb As New StringBuilder
|
||||||
|
sb.Append($"Alter Table `{tableName}` ")
|
||||||
|
sb.Append("Add ")
|
||||||
|
sb.Append("( ")
|
||||||
|
|
||||||
|
sb.Append(colList(0).ToAddColString())
|
||||||
|
For i As Integer = 1 To colList.Count - 1
|
||||||
|
sb.Append($",{colList(i).ToAddColString()}")
|
||||||
|
Next
|
||||||
|
|
||||||
|
sb.Append(");")
|
||||||
|
|
||||||
|
Return sb.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Overridable Function Update(ByVal tableName As String, ByVal destStr As String, ByVal condition As String) As String
|
||||||
|
Return $"Update `{tableName}` Set {destStr} Where {condition};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function Update(ByVal tableName As String, dicNameValues As Dictionary(Of String, String), ByVal condition As String) As String
|
||||||
|
Dim destStr As New StringBuilder
|
||||||
|
For Each keyValuePair As KeyValuePair(Of String, String) In dicNameValues
|
||||||
|
If destStr.Length = 0 Then
|
||||||
|
destStr.Append($"`{keyValuePair.Key}` = '{keyValuePair.Value}'")
|
||||||
|
Else
|
||||||
|
destStr.Append($",`{keyValuePair.Key}` = '{keyValuePair.Value}'")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return Update(tableName, destStr.ToString(), condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function Update(ByVal tableName As String, names() As String, values() As String, condition As String) As String
|
||||||
|
Dim destStr As New StringBuilder
|
||||||
|
If names.Length <> values.Length Then
|
||||||
|
Throw New Exception("DBHelpers_Update:names.Length <> values.Length")
|
||||||
|
End If
|
||||||
|
|
||||||
|
For i As Integer = 0 To names.Length - 1
|
||||||
|
If i = 0 Then
|
||||||
|
destStr.Append($"{names(i)} = '{values(i)}'")
|
||||||
|
Else
|
||||||
|
destStr.Append($",{names(i)} = '{values(i)}'")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return Update(tableName, destStr.ToString(), condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function DeleteRows(ByVal tableName As String, ByVal condition As String) As String
|
||||||
|
Return $"Delete From `{tableName}` Where {condition};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 清空数据表
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DeleteTable(ByVal tableName As String) As String
|
||||||
|
Return $"Delete From `{tableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function DropCol(ByVal tableName As String, ByVal colName As String) As String
|
||||||
|
Return $"Alter Table `{tableName}` Drop Column `{colName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 删除数据表
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DropTable(ByVal tableName As String) As String
|
||||||
|
Return $"Drop Table `{tableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function CreateTable(ByVal tableName As String, ByVal createStr As String) As String
|
||||||
|
Return $"Create Table `{tableName}` ( {createStr} );"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function CreateTableWhenNotExists(tableName As String, createStr As String) As String
|
||||||
|
Return $"Create Table if not exists `{tableName}` ( {createStr} );"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Overridable Function CreateLikeTable(tableName As String, baseTableName As String) As String
|
||||||
|
Return $"create table `{tableName}` like `{baseTableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function CreateLikeTableNotExists(tableName As String, baseTableName As String) As String
|
||||||
|
Return $"create table if not exists `{tableName}` like `{baseTableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 创建表,同时复制基础表数据(不包含原表索引与主键)
|
||||||
|
''' 若想复制表结构加数据,则先复制表结构创建表,再拷贝数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="baseTableName">基础表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function CreateCopyTable(tableName As String, baseTableName As String) As String
|
||||||
|
Return $"create table `{tableName}` as select * from `{baseTableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 不存在表时即创建表,同时复制基础表数据(不包含原表索引与主键)
|
||||||
|
''' 若想复制表结构加数据,则先复制表结构创建表,再拷贝数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="baseTableName">基础表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function CreateCopyTableNotExists(tableName As String, baseTableName As String) As String
|
||||||
|
Return $"create table if not exists `{tableName}` as select * from `{baseTableName}`;"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 复制基础表数据到新表中
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="baseTableName">基础表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function InsertCopyTable(tableName As String, baseTableName As String) As String
|
||||||
|
Return $"insert into `{tableName}` select * from `{baseTableName}`;"
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
94
Database/Base/DatabaseData.vb
Normal file
94
Database/Base/DatabaseData.vb
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
Public Class DatabaseData
|
||||||
|
Enum TypeEnum
|
||||||
|
[Bit]
|
||||||
|
[Char]
|
||||||
|
[Date]
|
||||||
|
[DateTime]
|
||||||
|
[Double]
|
||||||
|
[Enum]
|
||||||
|
[Float]
|
||||||
|
[Int]
|
||||||
|
[IntUnsigned]
|
||||||
|
[Json]
|
||||||
|
[Text]
|
||||||
|
[Time]
|
||||||
|
Varchar
|
||||||
|
[Year]
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 列名
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property ColumnName() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 当前值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property Value() As String
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 默认值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DefaultValue() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataType() As TypeEnum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型长度
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataTypeLength() As Integer
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否允许为空
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsNull() As Boolean = True
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否自动增长
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsAutoIncrement() As Boolean
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否为主键
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsPrimaryKey() As Boolean
|
||||||
|
|
||||||
|
Public Function ToAddColString() As String
|
||||||
|
Dim sb As New StringBuilder
|
||||||
|
sb.Append($"`{ColumnName}`")
|
||||||
|
|
||||||
|
Select Case DataType
|
||||||
|
Case TypeEnum.Char, TypeEnum.Varchar
|
||||||
|
sb.Append($" {DataType}({DataTypeLength}) ")
|
||||||
|
Case TypeEnum.Int
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
If IsAutoIncrement Then sb.Append($" AUTO_INCREMENT")
|
||||||
|
Case Else
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
End Select
|
||||||
|
|
||||||
|
sb.Append(IIf(IsNull, " Default Null", " Not Null"))
|
||||||
|
|
||||||
|
If IsPrimaryKey Then
|
||||||
|
sb.Append($" PRIMARY KEY")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return sb.ToString()
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
12
Database/Base/DatabaseSchema.vb
Normal file
12
Database/Base/DatabaseSchema.vb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Imports System.Collections.Generic
|
||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Contains the entire database schema
|
||||||
|
''' </summary>
|
||||||
|
Public Class DatabaseSchema
|
||||||
|
Public Tables As List(Of TableSchema) = New List(Of TableSchema)()
|
||||||
|
Public Views As List(Of ViewSchema) = New List(Of ViewSchema)()
|
||||||
|
End Class
|
||||||
|
End NameSpace
|
||||||
11
Database/Base/ForeignKeySchema.vb
Normal file
11
Database/Base/ForeignKeySchema.vb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
Public Class ForeignKeySchema
|
||||||
|
Public TableName As String
|
||||||
|
Public ColumnName As String
|
||||||
|
Public ForeignTableName As String
|
||||||
|
Public ForeignColumnName As String
|
||||||
|
Public CascadeOnDelete As Boolean
|
||||||
|
Public IsNullable As Boolean
|
||||||
|
End Class
|
||||||
|
End NameSpace
|
||||||
16
Database/Base/IndexSchema.vb
Normal file
16
Database/Base/IndexSchema.vb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
Imports System.Collections.Generic
|
||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
|
||||||
|
|
||||||
|
Public Class IndexSchema
|
||||||
|
Public IndexName As String
|
||||||
|
Public IsUnique As Boolean
|
||||||
|
Public Columns As List(Of IndexColumn)
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Public Class IndexColumn
|
||||||
|
Public ColumnName As String
|
||||||
|
Public IsAscending As Boolean
|
||||||
|
End Class
|
||||||
|
End NameSpace
|
||||||
7
Database/Base/InsertParams.vb
Normal file
7
Database/Base/InsertParams.vb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Namespace Database.Base
|
||||||
|
Public Class InsertParams
|
||||||
|
Public Property TableName() As String
|
||||||
|
|
||||||
|
Public Property InsertKeyValue As Dictionary(Of String, String)
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
71
Database/Base/SearchCondition.vb
Normal file
71
Database/Base/SearchCondition.vb
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
Public Class SearchCondition
|
||||||
|
Enum ConditionType
|
||||||
|
LessThan
|
||||||
|
GreaterThen
|
||||||
|
EqualTo
|
||||||
|
LessThanOrEqualTo
|
||||||
|
GreaterThenOrEqualTo
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
Enum LogicType
|
||||||
|
[And]
|
||||||
|
[Or]
|
||||||
|
[Not]
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 判断列名
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property ColName() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 判断条件
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property Condition() As ConditionType = ConditionType.EqualTo
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 判断值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property ColValue() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 当前条件与上一个条件的逻辑关系
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property LogicPrevious() As LogicType = LogicType.And
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 将当前条件转换为字符串,不支持将条件逻辑关系同时转换
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overrides Function ToString() As String
|
||||||
|
Dim stringBuilder As New StringBuilder
|
||||||
|
stringBuilder.Append(" ")
|
||||||
|
stringBuilder.Append(ColName)
|
||||||
|
|
||||||
|
Select Case Condition
|
||||||
|
Case ConditionType.EqualTo
|
||||||
|
stringBuilder.Append("=")
|
||||||
|
Case ConditionType.LessThan
|
||||||
|
stringBuilder.Append("<")
|
||||||
|
Case ConditionType.LessThanOrEqualTo
|
||||||
|
stringBuilder.Append("<=")
|
||||||
|
Case ConditionType.GreaterThen
|
||||||
|
stringBuilder.Append(">")
|
||||||
|
Case ConditionType.GreaterThenOrEqualTo
|
||||||
|
stringBuilder.Append(">=")
|
||||||
|
End Select
|
||||||
|
|
||||||
|
stringBuilder.Append($"'{ColValue}'")
|
||||||
|
|
||||||
|
Return stringBuilder.ToString()
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
46
Database/Base/SearchParams.vb
Normal file
46
Database/Base/SearchParams.vb
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
Namespace Database.Base
|
||||||
|
Public Class SearchParams
|
||||||
|
Enum OrderTypeEnum
|
||||||
|
None
|
||||||
|
Desc
|
||||||
|
Asc
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询条件的表名
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property TableName() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 当IsSearchAllCols = False时,查询返回列名集合
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property SearchColNames() As String()
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询的条件
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property SearchCondition() As List(Of SearchCondition)
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 排序方式
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property OrderType As OrderTypeEnum = OrderTypeEnum.None
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 但需要排序时排序列名
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property OrderColName() As String
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 从返回结果提取指定行的内容
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property Limit() As Integer = 0
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
14
Database/Base/TableSchema.vb
Normal file
14
Database/Base/TableSchema.vb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
Imports System.Collections.Generic
|
||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
|
||||||
|
|
||||||
|
Public Class TableSchema
|
||||||
|
Public TableName As String
|
||||||
|
Public TableSchemaName As String
|
||||||
|
Public Columns As List(Of ColumnSchema)
|
||||||
|
Public PrimaryKey As List(Of String)
|
||||||
|
Public ForeignKeys As List(Of ForeignKeySchema)
|
||||||
|
Public Indexes As List(Of IndexSchema)
|
||||||
|
End Class
|
||||||
|
End NameSpace
|
||||||
71
Database/Base/TriggerBuilder.vb
Normal file
71
Database/Base/TriggerBuilder.vb
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
Imports System.Collections.Generic
|
||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
|
||||||
|
Public Module TriggerBuilder
|
||||||
|
Public Function GetForeignKeyTriggers(ByVal dt As TableSchema) As IList(Of TriggerSchema)
|
||||||
|
Dim result As IList(Of TriggerSchema) = New List(Of TriggerSchema)()
|
||||||
|
For Each fks As ForeignKeySchema In dt.ForeignKeys
|
||||||
|
result.Add(GenerateInsertTrigger(fks))
|
||||||
|
result.Add(GenerateUpdateTrigger(fks))
|
||||||
|
result.Add(GenerateDeleteTrigger(fks))
|
||||||
|
Next
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function MakeTriggerName(ByVal fks As ForeignKeySchema, ByVal prefix As String) As String
|
||||||
|
Return prefix & "_" & fks.TableName & "_" & fks.ColumnName & "_" & fks.ForeignTableName & "_" & fks.ForeignColumnName
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function GenerateInsertTrigger(ByVal fks As ForeignKeySchema) As TriggerSchema
|
||||||
|
Dim trigger As TriggerSchema = New TriggerSchema()
|
||||||
|
trigger.Name = MakeTriggerName(fks, "fki")
|
||||||
|
trigger.Type = TriggerType.Before
|
||||||
|
trigger.Event = TriggerEvent.Insert
|
||||||
|
trigger.Table = fks.TableName
|
||||||
|
Dim nullString As String = ""
|
||||||
|
|
||||||
|
If fks.IsNullable Then
|
||||||
|
nullString = " NEW." & fks.ColumnName & " IS NOT NULL AND"
|
||||||
|
End If
|
||||||
|
|
||||||
|
trigger.Body = "SELECT RAISE(ROLLBACK, 'insert on table " & fks.TableName & " violates foreign key constraint " & trigger.Name & "')" & " WHERE" & nullString & " (SELECT " & fks.ForeignColumnName & " FROM " & fks.ForeignTableName & " WHERE " & fks.ForeignColumnName & " = NEW." & fks.ColumnName & ") IS NULL; "
|
||||||
|
Return trigger
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function GenerateUpdateTrigger(ByVal fks As ForeignKeySchema) As TriggerSchema
|
||||||
|
Dim trigger As TriggerSchema = New TriggerSchema()
|
||||||
|
trigger.Name = MakeTriggerName(fks, "fku")
|
||||||
|
trigger.Type = TriggerType.Before
|
||||||
|
trigger.Event = TriggerEvent.Update
|
||||||
|
trigger.Table = fks.TableName
|
||||||
|
Dim triggerName As String = trigger.Name
|
||||||
|
Dim nullString As String = ""
|
||||||
|
|
||||||
|
If fks.IsNullable Then
|
||||||
|
nullString = " NEW." & fks.ColumnName & " IS NOT NULL AND"
|
||||||
|
End If
|
||||||
|
|
||||||
|
trigger.Body = "SELECT RAISE(ROLLBACK, 'update on table " & fks.TableName & " violates foreign key constraint " & triggerName & "')" & " WHERE" & nullString & " (SELECT " & fks.ForeignColumnName & " FROM " & fks.ForeignTableName & " WHERE " & fks.ForeignColumnName & " = NEW." & fks.ColumnName & ") IS NULL; "
|
||||||
|
Return trigger
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function GenerateDeleteTrigger(ByVal fks As ForeignKeySchema) As TriggerSchema
|
||||||
|
Dim trigger As TriggerSchema = New TriggerSchema()
|
||||||
|
trigger.Name = MakeTriggerName(fks, "fkd")
|
||||||
|
trigger.Type = TriggerType.Before
|
||||||
|
trigger.Event = TriggerEvent.Delete
|
||||||
|
trigger.Table = fks.ForeignTableName
|
||||||
|
Dim triggerName as String = trigger.Name
|
||||||
|
|
||||||
|
If Not fks.CascadeOnDelete Then
|
||||||
|
trigger.Body = "SELECT RAISE(ROLLBACK, 'delete on table " & fks.ForeignTableName & " violates foreign key constraint " & triggerName & "')" & " WHERE (SELECT " & fks.ColumnName & " FROM " & fks.TableName & " WHERE " & fks.ColumnName & " = OLD." & fks.ForeignColumnName & ") IS NOT NULL; "
|
||||||
|
Else
|
||||||
|
trigger.Body = "DELETE FROM [" & fks.TableName & "] WHERE " & fks.ColumnName & " = OLD." & fks.ForeignColumnName & "; "
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return trigger
|
||||||
|
End Function
|
||||||
|
End Module
|
||||||
|
End NameSpace
|
||||||
20
Database/Base/TriggerSchema.vb
Normal file
20
Database/Base/TriggerSchema.vb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
Namespace Database.Base
|
||||||
|
Public Enum TriggerEvent
|
||||||
|
Delete
|
||||||
|
Update
|
||||||
|
Insert
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
Public Enum TriggerType
|
||||||
|
After
|
||||||
|
Before
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
Public Class TriggerSchema
|
||||||
|
Public Name As String
|
||||||
|
Public [Event] As TriggerEvent
|
||||||
|
Public Type As TriggerType
|
||||||
|
Public Body As String
|
||||||
|
Public Table As String
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
17
Database/Base/ViewSchema.vb
Normal file
17
Database/Base/ViewSchema.vb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
Namespace Database.Base
|
||||||
|
''' <summary>
|
||||||
|
''' Describes a single view schema
|
||||||
|
''' </summary>
|
||||||
|
Public Class ViewSchema
|
||||||
|
''' <summary>
|
||||||
|
''' Contains the view name
|
||||||
|
''' </summary>
|
||||||
|
Public ViewName As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Contains the view SQL statement
|
||||||
|
''' </summary>
|
||||||
|
Public ViewSql As String
|
||||||
|
End Class
|
||||||
|
End NameSpace
|
||||||
747
Database/DbCmdHelper.vb
Normal file
747
Database/DbCmdHelper.vb
Normal file
@@ -0,0 +1,747 @@
|
|||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据库语句助手
|
||||||
|
''' 时间:2020-12-21
|
||||||
|
''' 作者:ML
|
||||||
|
''' 版本:1.0
|
||||||
|
'''
|
||||||
|
''' 注意:添加一条数据库帮助语句时,需要考虑Mysql/Sqlite/Mssql等数据库是否支持命令,不支持则需要在对应帮助类中重写该帮助语句
|
||||||
|
''' 注意:Sqlite数据库与大多数据库不相同,DB开头数据库语句大多不适用
|
||||||
|
'''
|
||||||
|
''' </summary>
|
||||||
|
Public MustInherit Class DbCmdHelper
|
||||||
|
Protected FiledSuffix As Char
|
||||||
|
Protected FiledPrefix As Char
|
||||||
|
|
||||||
|
Public Shared Function CreateCmdHelper(type As DbExecutor.DbTypeEnum) As DbCmdHelper
|
||||||
|
Select Case type
|
||||||
|
Case DbExecutor.DbTypeEnum.Mysql
|
||||||
|
Return New MysqlCmdHelper()
|
||||||
|
Case DbExecutor.DbTypeEnum.Mssql
|
||||||
|
Return New MssqlCmdHelper()
|
||||||
|
Case DbExecutor.DbTypeEnum.Sqlite
|
||||||
|
Return New SqliteCmdHelper()
|
||||||
|
Case Else
|
||||||
|
Throw New Exception($"CreateCmdHelper :Unknown Type {type}")
|
||||||
|
End Select
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
#Region "访问单数据库连接"
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据表符合条件的所有数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">指定表名</param>
|
||||||
|
''' <param name="condition">查询条件,</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function SearchAll(tableName As String, Optional condition As String = "") As String
|
||||||
|
If String.IsNullOrWhiteSpace(condition) Then
|
||||||
|
Return $"Select * FROM {FiledSuffix}{tableName}{FiledPrefix};"
|
||||||
|
Else
|
||||||
|
Return $"Select * FROM {FiledSuffix}{tableName}{FiledPrefix} WHERE {condition};"
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询表符合条件的所有指定列的数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="columnName">列名集合,需要返回多列时用','符号分隔列名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="condition">条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function Search(columnName As String, tableName As String, Optional condition As String = "") As String
|
||||||
|
If String.IsNullOrWhiteSpace(condition) Then
|
||||||
|
Return $"Select {columnName} FROM {FiledSuffix}{tableName}{FiledPrefix};"
|
||||||
|
Else
|
||||||
|
Return $"Select {columnName} FROM {FiledSuffix}{tableName}{FiledPrefix} WHERE {condition};"
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询表符合条件的所有指定列的数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="columnName">表名</param>
|
||||||
|
''' <param name="tableName">条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function Search(columnName As List(Of String), tableName As String, Optional condition As String = "") As String
|
||||||
|
Dim colNameString As New StringBuilder
|
||||||
|
For i As Integer = 0 To columnName.Count - 1
|
||||||
|
If i = 0 Then
|
||||||
|
colNameString.Append($"{FiledSuffix}{columnName(i)}{FiledPrefix}")
|
||||||
|
Else
|
||||||
|
colNameString.Append($",{FiledSuffix}{columnName(i)}{FiledPrefix}")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
If String.IsNullOrWhiteSpace(condition) Then
|
||||||
|
Return $"Select {colNameString} FROM {FiledSuffix}{tableName}{FiledPrefix};"
|
||||||
|
Else
|
||||||
|
Return $"Select {colNameString} FROM {FiledSuffix}{tableName}{FiledPrefix} Where {condition};"
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Overridable Function SearchOrder(columnName As List(Of String), tableName As String, Optional orderString As String = "") As String
|
||||||
|
Dim colNameString As New StringBuilder
|
||||||
|
For i As Integer = 0 To columnName.Count - 1
|
||||||
|
If i = 0 Then
|
||||||
|
colNameString.Append($"{FiledSuffix}{columnName(i)}{FiledPrefix}")
|
||||||
|
Else
|
||||||
|
colNameString.Append($",{FiledSuffix}{columnName(i)}{FiledPrefix}")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
If String.IsNullOrWhiteSpace(orderString) Then
|
||||||
|
Return $"Select {colNameString} FROM {FiledSuffix}{tableName}{FiledPrefix};"
|
||||||
|
Else
|
||||||
|
Return $"Select {colNameString} FROM {FiledSuffix}{tableName}{FiledPrefix} {orderString};"
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定表包含的内容行数
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <param name="condition">查询条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function SearchCount(tableName As String, Optional condition As String = "") As String
|
||||||
|
Return Search("count(*)", tableName, condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据表的信息
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function SearchTableInfo(tableName As String) As String
|
||||||
|
Return $"Select * from information_schema.tables where table_name = '{tableName}';"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据表是否存在的信息,返回查询当前表在数据库中存在的数量
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function SearchTableExists(tableName As String) As String
|
||||||
|
Return $"Select count(*) from information_schema.tables where table_name = '{tableName}';"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据表插入一行数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="colNames">列名字符串</param>
|
||||||
|
''' <param name="values">列值字符串</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function Insert(tableName As String, colNames As String, values As String) As String
|
||||||
|
Return $"Insert into {FiledSuffix}{tableName}{FiledPrefix} ({colNames}) Values ( {values} );"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据表插入一行数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="dicNameValues">列名与列值键值对</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function Insert(tableName As String, dicNameValues As Dictionary(Of String, String)) As String
|
||||||
|
Dim colNames As New StringBuilder
|
||||||
|
Dim values As New StringBuilder
|
||||||
|
For Each keyValuePair As KeyValuePair(Of String, String) In dicNameValues
|
||||||
|
If colNames.Length = 0 Then
|
||||||
|
colNames.Append($"{FiledSuffix}{keyValuePair.Key}{FiledPrefix}")
|
||||||
|
values.Append($"'{keyValuePair.Value}'")
|
||||||
|
Else
|
||||||
|
colNames.Append($",{FiledSuffix}{keyValuePair.Key}{FiledPrefix}")
|
||||||
|
values.Append($",'{keyValuePair.Value}'")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return Insert(tableName, colNames.ToString(), values.ToString())
|
||||||
|
End Function
|
||||||
|
Public Overridable Function Insert2(tableName As String, dicNameValues As Dictionary(Of String, Object )) As String
|
||||||
|
Dim colNames As New StringBuilder
|
||||||
|
Dim values As New StringBuilder
|
||||||
|
For Each keyValuePair As KeyValuePair(Of String, Object) In dicNameValues
|
||||||
|
|
||||||
|
If colNames.Length = 0 Then
|
||||||
|
colNames.Append($"{FiledSuffix}{keyValuePair.Key}{FiledPrefix}")
|
||||||
|
values.Append($"'{keyValuePair.Value}'")
|
||||||
|
Else
|
||||||
|
colNames.Append($",{FiledSuffix}{keyValuePair.Key}{FiledPrefix}")
|
||||||
|
values.Append($",'{keyValuePair.Value}'")
|
||||||
|
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return Insert(tableName, colNames.ToString(), values.ToString())
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据表插入一行,通过命令参数方式执行时使用
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName"></param>
|
||||||
|
''' <param name="dicNameValues"></param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function InsertParam(tableName As String, dicNameValues As Dictionary(Of String, String)) As String
|
||||||
|
Dim colNames As New StringBuilder
|
||||||
|
Dim values As New StringBuilder
|
||||||
|
For Each keyValuePair As KeyValuePair(Of String, String) In dicNameValues
|
||||||
|
If colNames.Length = 0 Then
|
||||||
|
colNames.Append($"{FiledSuffix}{keyValuePair.Key}{FiledPrefix}")
|
||||||
|
values.Append($"{keyValuePair.Value}")
|
||||||
|
Else
|
||||||
|
colNames.Append($",{FiledSuffix}{keyValuePair.Key}{FiledPrefix}")
|
||||||
|
values.Append($",{keyValuePair.Value}")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return Insert(tableName, colNames.ToString(), values.ToString())
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据表插入一行,通过命令参数方式执行时使用,参数名由@{ColName}
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="colNames">字段列表</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function InsertParam(tableName As String, colNames As List(Of String)) As String
|
||||||
|
Dim colNameString As New StringBuilder
|
||||||
|
Dim values As New StringBuilder
|
||||||
|
For Each colName As String In colNames
|
||||||
|
If colNameString.Length = 0 Then
|
||||||
|
colNameString.Append($"{FiledSuffix}{colName}{FiledPrefix}")
|
||||||
|
values.Append($"@{colName}")
|
||||||
|
Else
|
||||||
|
colNameString.Append($",{FiledSuffix}{colName}{FiledPrefix}")
|
||||||
|
values.Append($",@{colName}")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return Insert(tableName, colNameString.ToString(), values.ToString())
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 更新指定表数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">指定表名</param>
|
||||||
|
''' <param name="destStr">更新字符串</param>
|
||||||
|
''' <param name="condition"></param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function Update(tableName As String, destStr As String, condition As String) As String
|
||||||
|
Return $"Update {FiledSuffix}{tableName}{FiledPrefix} Set {destStr} Where {condition};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 更新指定表数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">指定表名</param>
|
||||||
|
''' <param name="dicNameValues">更新列名与列值键值对</param>
|
||||||
|
''' <param name="condition">更新列索引条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function Update(tableName As String, dicNameValues As Dictionary(Of String, String), condition As String) As String
|
||||||
|
Dim destStr As New StringBuilder
|
||||||
|
For Each keyValuePair As KeyValuePair(Of String, String) In dicNameValues
|
||||||
|
If destStr.Length = 0 Then
|
||||||
|
destStr.Append($"{FiledSuffix}{keyValuePair.Key}{FiledPrefix} = '{keyValuePair.Value}'")
|
||||||
|
Else
|
||||||
|
destStr.Append($",{FiledSuffix}{keyValuePair.Key}{FiledPrefix} = '{keyValuePair.Value}'")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return Update(tableName, destStr.ToString(), condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 更新指定数据库中指定表数据,参数名由@{ColName}
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">指定表名</param>
|
||||||
|
''' <param name="colNames">更新列名的集合</param>
|
||||||
|
''' <param name="condition">更新列索引条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function UpdateParam(tableName As String, colNames As List(Of String), condition As String) As String
|
||||||
|
Dim destStr As New StringBuilder
|
||||||
|
For Each colName As String In colNames
|
||||||
|
If destStr.Length = 0 Then
|
||||||
|
destStr.Append($"{FiledSuffix}{colName}{FiledPrefix} = @{colName}")
|
||||||
|
Else
|
||||||
|
destStr.Append($",{FiledSuffix}{colName}{FiledPrefix} = @{colName}")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return Update(tableName, destStr.ToString(), condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 指定数据表增加一列数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="colName">列名</param>
|
||||||
|
''' <param name="colType">列类型</param>
|
||||||
|
''' <param name="isNull">是否允许为空</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function AddCol(tableName As String, colName As String, colType As String, Optional isNull As Boolean = True) As String
|
||||||
|
Return $"Alter Table {FiledSuffix}{tableName}{FiledPrefix} Add {FiledSuffix}{colName}{FiledPrefix} {colType} {IIf(isNull, "Default Null", "Not Null")};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据表删除一列数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="colName">需要删除的列名,仅一列</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DropCol(tableName As String, colName As String) As String
|
||||||
|
Return $"Alter Table {FiledSuffix}{tableName}{FiledPrefix} Drop Column {FiledSuffix}{colName}{FiledPrefix};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 删除指定表多行数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="condition">条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DeleteRows(tableName As String, condition As String) As String
|
||||||
|
Return $"Delete From {FiledSuffix}{tableName}{FiledPrefix} Where {condition};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 创建数据表
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="createStr">创建表的列信息字符串</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function CreateTable(tableName As String, createStr As String) As String
|
||||||
|
Return $"Create Table {FiledSuffix}{tableName}{FiledPrefix} ( {createStr} );"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 创建数据表,如果存在则不创建
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="createStr">创建表的列信息字符串</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function CreateTableWhenNotExists(tableName As String, createStr As String) As String
|
||||||
|
Return $"Create Table if not exists {FiledSuffix}{tableName}{FiledPrefix} ( {createStr} );"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 清空数据表,表依旧存在
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DeleteTable(tableName As String) As String
|
||||||
|
Return $"Delete From {FiledSuffix}{tableName}{FiledPrefix};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 删除数据表
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DropTable(tableName As String) As String
|
||||||
|
Return $"Drop Table {FiledSuffix}{tableName}{FiledPrefix};"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 删除数据表
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DropTableWhenExists(tableName As String) As String
|
||||||
|
Return $"Drop Table If Exists {FiledSuffix}{tableName}{FiledPrefix};"
|
||||||
|
End Function
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
#Region "访问多数据库连接"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据库中指定数据表符合条件的所有指定列的数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="ColsName">列名集合,需要返回多列时用','符号分隔列名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="condition">条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbSearch(dbName As String, colsName As String, tableName As String, Optional condition As String = "") As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Select {colsName} From ")
|
||||||
|
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
|
||||||
|
If String.IsNullOrWhiteSpace(condition) = False Then
|
||||||
|
cmdText.Append($" WHERE {condition}")
|
||||||
|
End If
|
||||||
|
|
||||||
|
cmdText.Append($";")
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据库中指定数据表符合条件的所有指定列的去重数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="ColsName">列名集合,需要返回多列时用','符号分隔列名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="condition">条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbDistinctSearch(dbName As String, colsName As String, tableName As String, Optional condition As String = "") As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Select Distinct {colsName} From ")
|
||||||
|
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
|
||||||
|
If String.IsNullOrWhiteSpace(condition) = False Then
|
||||||
|
cmdText.Append($" WHERE {condition}")
|
||||||
|
End If
|
||||||
|
|
||||||
|
cmdText.Append($";")
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据库中指定数据表符合条件的所有指定列的数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="columnName">表名</param>
|
||||||
|
''' <param name="tableName">条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbSearch(dbName As String, columnName As List(Of String), tableName As String, Optional condition As String = "") As String
|
||||||
|
Dim colNameString As New StringBuilder
|
||||||
|
For i As Integer = 0 To columnName.Count - 1
|
||||||
|
If i = 0 Then
|
||||||
|
colNameString.Append($"{FiledSuffix}{columnName(i)}{FiledPrefix}")
|
||||||
|
Else
|
||||||
|
colNameString.Append($",{FiledSuffix}{columnName(i)}{FiledPrefix}")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return DbSearch(dbName, colNameString.ToString(), tableName, condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定表包含的内容行数
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <param name="condition">查询条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbSearchCount(dbName As String, tableName As String, Optional condition As String = "") As String
|
||||||
|
Return DbSearch(dbName, "count(*)", tableName, condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据库中指定数据表符合条件的所有数据
|
||||||
|
'''
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <param name="condition">查询条件(可选)</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbSearchAll(dbName As String, tableName As String, Optional condition As String = "") As String
|
||||||
|
Return DbSearch(dbName, "*", tableName, condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据库中指定数据表的信息
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbSearchTableInfo(dbName As String, tableName As String) As String
|
||||||
|
Return DbSearch("", "*", "information_schema.tables", "table_schema = '{dbName}' and table_name = '{tableName}'")
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据表是否存在的信息,返回查询当前表在指定数据库中存在的数量
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbSearchTableExists(dbName As String, tableName As String) As String
|
||||||
|
Return DbSearch("", "count(*)", "information_schema.tables", "table_schema = '{dbName}' and table_name = '{tableName}'")
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 指定数据库中数据表插入一行数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="colNames">列名字符串</param>
|
||||||
|
''' <param name="values">列值字符串</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbInsert(dbName As String, tableName As String, colNames As String, values As String) As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Insert into ")
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
cmdText.Append($" ({colNames}) Values ( {values} );")
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 指定数据库中数据表插入一行数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="dicNameValues">列名与列值键值对</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbInsert(dbName As String, tableName As String, dicNameValues As Dictionary(Of String, String)) As String
|
||||||
|
Dim colNames As New StringBuilder
|
||||||
|
Dim values As New StringBuilder
|
||||||
|
For Each keyValuePair As KeyValuePair(Of String, String) In dicNameValues
|
||||||
|
If colNames.Length = 0 Then
|
||||||
|
colNames.Append($"{FiledSuffix}{keyValuePair.Key}{FiledPrefix}")
|
||||||
|
values.Append($"'{keyValuePair.Value}'")
|
||||||
|
Else
|
||||||
|
colNames.Append($",{FiledSuffix}{keyValuePair.Key}{FiledPrefix}")
|
||||||
|
values.Append($",'{keyValuePair.Value}'")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return DbInsert(dbName, tableName, colNames.ToString(), values.ToString())
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 指定数据库中数据表插入一行,通过命令参数方式执行时使用,参数名由@{ColName}
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName"></param>
|
||||||
|
''' <param name="colNames">需要插入列名的集合</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbInsertParam(dbName As String, tableName As String, colNames As List(Of String)) As String
|
||||||
|
Dim colNameBuilder As New StringBuilder
|
||||||
|
Dim valueBuilder As New StringBuilder
|
||||||
|
For Each colName As String In colNames
|
||||||
|
If colNameBuilder.Length = 0 Then
|
||||||
|
colNameBuilder.Append($"{FiledSuffix}{colName}{FiledPrefix}")
|
||||||
|
valueBuilder.Append($"@{colName}")
|
||||||
|
Else
|
||||||
|
colNameBuilder.Append($",{FiledSuffix}{colName}{FiledPrefix}")
|
||||||
|
valueBuilder.Append($",@{colName}")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
'insert into dbName.tablename (1,2,3) value (@1,@2,@3)
|
||||||
|
Return DbInsert(dbName, tableName, colNameBuilder.ToString(), valueBuilder.ToString())
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 更新指定数据库中指定表数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">指定表名</param>
|
||||||
|
''' <param name="destStr">更新字符串</param>
|
||||||
|
''' <param name="condition"></param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbUpdate(dbName As String, tableName As String, destStr As String, condition As String) As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
Dim tmpStrCmdText As String = ""
|
||||||
|
|
||||||
|
cmdText.Append($"Update ")
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
cmdText.Append($" Set {destStr} Where {condition};")
|
||||||
|
tmpStrCmdText = cmdText.ToString()
|
||||||
|
Console.WriteLine("SQL_CMD = " & tmpStrCmdText)
|
||||||
|
|
||||||
|
Return tmpStrCmdText
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 更新指定数据库中指定表数据,参数名由@{ColName}
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">指定表名</param>
|
||||||
|
''' <param name="colNames">更新列名的集合</param>
|
||||||
|
''' <param name="condition">更新列索引条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbUpdateParam(dbName As String, tableName As String, colNames As List(Of String), condition As String) As String
|
||||||
|
Dim destStr As New StringBuilder
|
||||||
|
For Each colName As String In colNames
|
||||||
|
If destStr.Length = 0 Then
|
||||||
|
destStr.Append($"{FiledSuffix}{colName}{FiledPrefix} = @{colName}")
|
||||||
|
Else
|
||||||
|
destStr.Append($",{FiledSuffix}{colName}{FiledPrefix} = @{colName}")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return DbUpdate(dbName, tableName, destStr.ToString(), condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 更新指定数据库中指定表数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">指定表名</param>
|
||||||
|
''' <param name="filedDictionary">更新列名与列值键值对</param>
|
||||||
|
''' <param name="condition">更新列索引条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbUpdate(dbName As String, tableName As String, filedDictionary As Dictionary(Of String, String), condition As String) As String
|
||||||
|
Dim destStr As New StringBuilder
|
||||||
|
For Each filed As KeyValuePair(Of String, String) In filedDictionary
|
||||||
|
If destStr.Length = 0 Then
|
||||||
|
destStr.Append($"{FiledSuffix}{filed.Key}{FiledPrefix} = '{filed.Value}'")
|
||||||
|
Else
|
||||||
|
destStr.Append($",{FiledSuffix}{filed.Key}{FiledPrefix} = '{filed.Value}'")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return DbUpdate(dbName, tableName, destStr.ToString(), condition)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 指定数据库中指定数据表增加一列数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="colName">列名</param>
|
||||||
|
''' <param name="colType">列类型</param>
|
||||||
|
''' <param name="isNull">是否允许为空</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbAddCol(dbName As String, tableName As String, colName As String, colType As String, Optional isNull As Boolean = True) As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Alter Table ")
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
cmdText.Append($" Add {FiledSuffix}{colName}{FiledPrefix} {colType} {IIf(isNull, "Default Null", "Not Null")};")
|
||||||
|
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 指定数据库中数据表删除一列数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="colName">需要删除的列名,仅一列</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbDropCol(dbName As String, tableName As String, colName As String) As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Alter Table ")
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
cmdText.Append($" Drop Column {FiledSuffix}{colName}{FiledPrefix};")
|
||||||
|
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 指定数据库中指定表删除多行数据
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="condition">条件</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbDeleteRows(dbName As String, tableName As String, condition As String) As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Delete From ")
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
cmdText.Append($" Where {condition};")
|
||||||
|
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 指定数据库中创建数据表
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="createStr">创建表的列信息字符串</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbCreateTable(dbName As String, tableName As String, createStr As String) As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Create Table ")
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
cmdText.Append($" ( {createStr} );")
|
||||||
|
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 指定数据库中创建数据表,如果存在则不创建
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">表名</param>
|
||||||
|
''' <param name="createStr">创建表的列信息字符串</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbCreateTableWhenNotExists(dbName As String, tableName As String, createStr As String) As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Create Table if not exists ")
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
cmdText.Append($" ( {createStr} );")
|
||||||
|
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 清空指定数据库中数据表,表依旧存在
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbDeleteTable(dbName As String, tableName As String) As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Delete From ")
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
cmdText.Append($";")
|
||||||
|
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 删除指定数据库中数据表
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="dbName">数据库名</param>
|
||||||
|
''' <param name="tableName">数据表名</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overridable Function DbDropTable(dbName As String, tableName As String) As String
|
||||||
|
Dim cmdText As New StringBuilder
|
||||||
|
cmdText.Append($"Drop Table ")
|
||||||
|
If String.IsNullOrEmpty(dbName) = False Then
|
||||||
|
cmdText.Append($"{FiledSuffix}{dbName}{FiledPrefix}.")
|
||||||
|
End If
|
||||||
|
cmdText.Append($"{FiledSuffix}{tableName}{FiledPrefix}")
|
||||||
|
cmdText.Append($";")
|
||||||
|
|
||||||
|
Return cmdText.ToString()
|
||||||
|
End Function
|
||||||
|
#End Region
|
||||||
|
End Class
|
||||||
377
Database/DbExecutor.vb
Normal file
377
Database/DbExecutor.vb
Normal file
@@ -0,0 +1,377 @@
|
|||||||
|
Imports System.Data.Common
|
||||||
|
Imports System.Data.SqlClient
|
||||||
|
Imports System.Data.SQLite
|
||||||
|
Imports MySql.Data.MySqlClient
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据库通用命令执行器
|
||||||
|
''' 时间:2020-12-21
|
||||||
|
''' 作者:ML
|
||||||
|
''' 版本:1.0
|
||||||
|
''' </summary>
|
||||||
|
Public Class DbExecutor
|
||||||
|
Implements IDisposable
|
||||||
|
''' <summary>
|
||||||
|
''' 数据库类型,目前支持Mysql与Sqlite
|
||||||
|
''' </summary>
|
||||||
|
Enum DbTypeEnum
|
||||||
|
Mysql
|
||||||
|
Sqlite
|
||||||
|
Mssql
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
|
||||||
|
Private ReadOnly _connectionString As String '数据库连接语句
|
||||||
|
|
||||||
|
Private ReadOnly _dbType As DbTypeEnum '数据库类型
|
||||||
|
|
||||||
|
Private _connection As DbConnection '数据库连接句柄
|
||||||
|
|
||||||
|
Private _command As DbCommand '数据库命令句柄
|
||||||
|
|
||||||
|
Private _dataAdapter As DbDataAdapter '数据库查询填充器句柄
|
||||||
|
|
||||||
|
Private _transaction As DbTransaction '数据库事务句柄
|
||||||
|
|
||||||
|
Private _commandHelper As DbCmdHelper '数据库语句填充助手
|
||||||
|
|
||||||
|
Sub New(type As DbTypeEnum, connectionString As String)
|
||||||
|
_dbType = type
|
||||||
|
_connectionString = connectionString
|
||||||
|
InitByDbType(_dbType)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub InitByDbType(type As DbTypeEnum)
|
||||||
|
Select Case type
|
||||||
|
Case DbTypeEnum.Mysql
|
||||||
|
_connection = New MySqlConnection()
|
||||||
|
_command = _connection.CreateCommand()
|
||||||
|
_dataAdapter = New MySqlDataAdapter() With {.MissingSchemaAction = MissingSchemaAction.AddWithKey}
|
||||||
|
|
||||||
|
_commandHelper = New MysqlCmdHelper()
|
||||||
|
Case DbTypeEnum.Sqlite
|
||||||
|
_connection = New SQLiteConnection()
|
||||||
|
_command = _connection.CreateCommand()
|
||||||
|
_dataAdapter = New SQLiteDataAdapter() With {.MissingSchemaAction = MissingSchemaAction.AddWithKey}
|
||||||
|
|
||||||
|
_commandHelper = New SqliteCmdHelper()
|
||||||
|
Case DbTypeEnum.Mssql
|
||||||
|
_connection = New SqlConnection()
|
||||||
|
_command = _connection.CreateCommand()
|
||||||
|
_dataAdapter = New SqlDataAdapter() With {.MissingSchemaAction = MissingSchemaAction.AddWithKey}
|
||||||
|
|
||||||
|
_commandHelper = New MssqlCmdHelper()
|
||||||
|
End Select
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Public ReadOnly Property DatabaseType() As DbTypeEnum
|
||||||
|
Get
|
||||||
|
Return _dbType
|
||||||
|
End Get
|
||||||
|
'Set(value As DbTypeEnum)
|
||||||
|
' _dbType = value
|
||||||
|
' '执行上一个数据库的关闭操作
|
||||||
|
' InitByDbType(_dbType)
|
||||||
|
'End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property Connection() As DbConnection
|
||||||
|
Get
|
||||||
|
Return _connection
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
|
||||||
|
Public ReadOnly Property Command() As DbCommand
|
||||||
|
Get
|
||||||
|
Return _command
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property CmdHelper() As DbCmdHelper
|
||||||
|
Get
|
||||||
|
Return _commandHelper
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 打开数据库连接
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function Open() As Boolean
|
||||||
|
If _connection Is Nothing Then Return False
|
||||||
|
If String.IsNullOrWhiteSpace(_connectionString) Then Return False
|
||||||
|
Try
|
||||||
|
_connection.ConnectionString = _connectionString
|
||||||
|
_connection.Open()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 关闭数据库连接
|
||||||
|
''' </summary>
|
||||||
|
Public Sub Close()
|
||||||
|
If _connection Is Nothing Then Return
|
||||||
|
If _connection.State = ConnectionState.Closed Then Return
|
||||||
|
_connection.Close()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 创建当前连接的命令执行句柄
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function CreateCommand() As DbCommand
|
||||||
|
Return _connection.CreateCommand()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 运行非查询语句,返回执行该语句受到影响的行数
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="commandText">执行的数据库命令文本</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function ExecuteNonQuery(commandText As String) As Integer
|
||||||
|
Dim result As Integer
|
||||||
|
Try
|
||||||
|
_command.CommandText = commandText
|
||||||
|
result = _command.ExecuteNonQuery()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 使用命令参数模式执行非查询语句,返回执行该语句受到影响的行数
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="commandText">执行的数据库命令文本</param>
|
||||||
|
''' <param name="commandParams">执行的数据库命令参数</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function ExecuteNonQuery(commandText As String, commandParams As DbParameterCollection) As Integer
|
||||||
|
Dim result As Integer
|
||||||
|
Try
|
||||||
|
_command.CommandText = commandText
|
||||||
|
_command.Parameters.Clear()
|
||||||
|
For Each param As DbParameter In commandParams
|
||||||
|
_command.Parameters.Add(param)
|
||||||
|
Next
|
||||||
|
result = _command.ExecuteNonQuery()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 执行数据库语句,返回数据库读取流的句柄
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="commandText">执行的数据库命令文本</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function ExecuteReader(commandText As String) As DbDataReader
|
||||||
|
Dim result As DbDataReader
|
||||||
|
Try
|
||||||
|
_command.CommandText = commandText
|
||||||
|
result = _command.ExecuteReader()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 使用命令参数模式执行数据库语句,返回数据库读取流的句柄
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="commandText">执行的数据库命令文本</param>
|
||||||
|
''' <param name="commandParams">执行的数据库命令参数</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function ExecuteReader(commandText As String, commandParams As DbParameterCollection) As DbDataReader
|
||||||
|
Dim result As DbDataReader
|
||||||
|
Try
|
||||||
|
_command.CommandText = commandText
|
||||||
|
_command.Parameters.Clear()
|
||||||
|
For Each param As DbParameter In commandParams
|
||||||
|
_command.Parameters.Add(param)
|
||||||
|
Next
|
||||||
|
result = _command.ExecuteReader()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 执行数据库语句,返回查询结果的第一行第一列的内容
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="commandText">执行的数据库命令文本</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function ExecuteScalar(commandText As String) As Object
|
||||||
|
Dim result As Object
|
||||||
|
Try
|
||||||
|
_command.CommandText = commandText
|
||||||
|
result = _command.ExecuteScalar()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 使用命令参数模式执行数据库语句,返回查询结果的第一行第一列的内容
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="commandText">执行的数据库命令文本</param>
|
||||||
|
''' <param name="commandParams">执行的数据库命令参数</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function ExecuteScalar(commandText As String, commandParams As DbParameterCollection) As Object
|
||||||
|
Dim result As Object
|
||||||
|
Try
|
||||||
|
_command.CommandText = commandText
|
||||||
|
_command.Parameters.Clear()
|
||||||
|
For Each param As DbParameter In commandParams
|
||||||
|
_command.Parameters.Add(param)
|
||||||
|
Next
|
||||||
|
result = _command.ExecuteScalar()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 执行数据库语句,返回执行结果返回的数据表,常用于查询命令
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="commandText">执行的数据库命令文本</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function ExecuteDataTable(commandText As String, Optional withKey As Boolean = True) As DataTable
|
||||||
|
Dim dataTable As New DataTable
|
||||||
|
Try
|
||||||
|
_command.CommandText = commandText
|
||||||
|
If withKey Then
|
||||||
|
_dataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
|
||||||
|
Else
|
||||||
|
_dataAdapter.MissingSchemaAction = MissingSchemaAction.Add
|
||||||
|
End If
|
||||||
|
_dataAdapter.SelectCommand = _command
|
||||||
|
_dataAdapter.Fill(dataTable)
|
||||||
|
Catch ex As Exception
|
||||||
|
Return Nothing
|
||||||
|
End Try
|
||||||
|
Return dataTable
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 执行数据库语句,返回执行结果返回的数据表,常用于查询命令
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="commandText">执行的数据库命令文本</param>
|
||||||
|
''' <param name="commandParams">执行的数据库命令参数</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function ExecuteDataTable(commandText As String, commandParams As DbParameterCollection) As DataTable
|
||||||
|
Dim dataTable As New DataTable
|
||||||
|
Try
|
||||||
|
_command.CommandText = commandText
|
||||||
|
_command.Parameters.Clear()
|
||||||
|
For Each param As DbParameter In commandParams
|
||||||
|
_command.Parameters.Add(param)
|
||||||
|
Next
|
||||||
|
_dataAdapter.SelectCommand = _command
|
||||||
|
_dataAdapter.Fill(dataTable)
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
Return dataTable
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 开启事务
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function BeginTransaction() As DbTransaction
|
||||||
|
_transaction = _connection.BeginTransaction()
|
||||||
|
Return _transaction
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 提交事务
|
||||||
|
''' </summary>
|
||||||
|
Public Sub CommitTransaction()
|
||||||
|
Try
|
||||||
|
_transaction.Commit()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 回滚事务
|
||||||
|
''' </summary>
|
||||||
|
Public Sub RollbackTransaction()
|
||||||
|
Try
|
||||||
|
_transaction.Rollback()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 创建数据参数
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="type">参数数据类型</param>
|
||||||
|
''' <param name="ParameterName">参数名称</param>
|
||||||
|
''' <param name="value">参数值</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function CreateDbParameter(type As DbType, parameterName As String, value As Object) As DbParameter
|
||||||
|
Dim dbParam As DbParameter = _command.CreateParameter()
|
||||||
|
dbParam.DbType = type
|
||||||
|
dbParam.ParameterName = parameterName
|
||||||
|
dbParam.Value = value
|
||||||
|
Return dbParam
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 添加数据参数
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="type"></param>
|
||||||
|
''' <param name="parameterName"></param>
|
||||||
|
''' <param name="value"></param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function AddDbParameter(type As DbType, parameterName As String, value As Object) As DbParameter
|
||||||
|
Dim dbParam As DbParameter = _command.CreateParameter()
|
||||||
|
dbParam.DbType = type
|
||||||
|
dbParam.ParameterName = parameterName
|
||||||
|
dbParam.Value = value
|
||||||
|
_command.Parameters.Add(dbParam)
|
||||||
|
Return dbParam
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 清空数据
|
||||||
|
''' </summary>
|
||||||
|
Public Sub ClearDbParameter()
|
||||||
|
_command.Parameters.Clear()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 回收资源
|
||||||
|
''' </summary>
|
||||||
|
Public Sub Dispose() Implements IDisposable.Dispose
|
||||||
|
If _connection IsNot Nothing Then
|
||||||
|
If _connection.State = ConnectionState.Open Then
|
||||||
|
_connection.Close()
|
||||||
|
End If
|
||||||
|
_connection.Dispose()
|
||||||
|
End If
|
||||||
|
|
||||||
|
If _command IsNot Nothing Then _command.Dispose()
|
||||||
|
If _dataAdapter IsNot Nothing Then _dataAdapter.Dispose()
|
||||||
|
|
||||||
|
GC.Collect() '对所有缓存垃圾进行回收
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
10
Database/Mssql/MssqlCmdHelper.vb
Normal file
10
Database/Mssql/MssqlCmdHelper.vb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Namespace Database.Mssql
|
||||||
|
Public Class MssqlCmdHelper
|
||||||
|
Inherits DbCmdHelper
|
||||||
|
|
||||||
|
Sub New()
|
||||||
|
FiledSuffix = "["c
|
||||||
|
FiledPrefix = "]"c
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
8
Database/MssqlCmdHelper.vb
Normal file
8
Database/MssqlCmdHelper.vb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Public Class MssqlCmdHelper
|
||||||
|
Inherits DbCmdHelper
|
||||||
|
|
||||||
|
Sub New()
|
||||||
|
FiledSuffix = "["c
|
||||||
|
FiledPrefix = "]"c
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
222
Database/Mysql/DataParam.vb
Normal file
222
Database/Mysql/DataParam.vb
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
Namespace Database.Mysql
|
||||||
|
Public Class DataParam
|
||||||
|
Enum DataTypeEnum
|
||||||
|
'###############################数值类型#############################
|
||||||
|
''' <summary>
|
||||||
|
''' 1 byte,小整数值
|
||||||
|
''' </summary>
|
||||||
|
Tinyint
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 2 bytes,大整数值
|
||||||
|
''' </summary>
|
||||||
|
Smallint
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 3 bytes,大整数值
|
||||||
|
''' </summary>
|
||||||
|
Mediumint
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 4 bytes,大整数值
|
||||||
|
''' </summary>
|
||||||
|
Int
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 4 bytes,大整数值
|
||||||
|
''' </summary>
|
||||||
|
[Integer]
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 8 bytes,极大整数值
|
||||||
|
''' </summary>
|
||||||
|
Bigint
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 4 bytes,单精度浮点数值
|
||||||
|
''' </summary>
|
||||||
|
Float
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 8 bytes,双精度浮点数值
|
||||||
|
''' </summary>
|
||||||
|
[Double]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'####################日期类型###############################
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 对DECIMAL(M,D) ,如果M>D,为M+2否则为D+2.小数值
|
||||||
|
''' </summary>
|
||||||
|
[Decimal]
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 3 bytes,日期值,YYYY-MM-DD
|
||||||
|
''' </summary>
|
||||||
|
[Date]
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 3 bytes,时间值或持续时间,HH:MM:SS
|
||||||
|
''' </summary>
|
||||||
|
Time
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 1 bytes,年份值,YYYY
|
||||||
|
''' </summary>
|
||||||
|
Year
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 8 bytes,混合日期和时间值,YYYY-MM-DD HH:MM:SS
|
||||||
|
''' </summary>
|
||||||
|
Datetime
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 4 bytes,混合日期和时间值,时间戳,YYYYMMDD HHMMSS
|
||||||
|
''' </summary>
|
||||||
|
Timestamp
|
||||||
|
|
||||||
|
|
||||||
|
'####################字符类型###############################
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-255 bytes,定长字符串
|
||||||
|
''' </summary>
|
||||||
|
[Char]
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-65535 bytes,变长字符串
|
||||||
|
''' </summary>
|
||||||
|
Varchar
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-255 bytes,不超过 255 个字符的二进制字符串
|
||||||
|
''' </summary>
|
||||||
|
Tinyblob
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-255 bytes,短文本字符串
|
||||||
|
''' </summary>
|
||||||
|
Tinytext
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-65 535 bytes,二进制形式的长文本数据
|
||||||
|
''' </summary>
|
||||||
|
Blob
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-65 535 bytes,长文本数据
|
||||||
|
''' </summary>
|
||||||
|
Text
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-16 777 215 bytes,二进制形式的中等长度文本数据
|
||||||
|
''' </summary>
|
||||||
|
Mediumblob
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-16 777 215 bytes,中等长度文本数据
|
||||||
|
''' </summary>
|
||||||
|
Mediumtext
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-4 294 967 295 bytes,二进制形式的极大文本数据
|
||||||
|
''' </summary>
|
||||||
|
Longblob
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-4 294 967 295 bytes,极大文本数据
|
||||||
|
''' </summary>
|
||||||
|
Longtext
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 列名
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property ColumnName() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 当前值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property Value() As String
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 默认值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DefaultValue() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataType() As DataTypeEnum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型长度
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataTypeLength() As Integer
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型是否带符号
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsUnsigned() As Boolean
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否允许为空
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsNull() As Boolean = True
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否自动增长
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsAutoIncrement() As Boolean
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否为主键
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsPrimaryKey() As Boolean
|
||||||
|
|
||||||
|
Public Function ToAddColString() As String
|
||||||
|
Dim sb As New StringBuilder
|
||||||
|
sb.Append($"`{ColumnName}`")
|
||||||
|
|
||||||
|
Select Case DataType
|
||||||
|
Case DataTypeEnum.Varchar,DataTypeEnum.[Char]
|
||||||
|
sb.Append($" {DataType}({DataTypeLength}) ")
|
||||||
|
Case DataTypeEnum.Int
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
if IsUnsigned Then sb.Append($" Unsigned")
|
||||||
|
If IsAutoIncrement Then sb.Append($" AUTO_INCREMENT")
|
||||||
|
Case Else
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
End Select
|
||||||
|
|
||||||
|
sb.Append(IIf(IsNull, " Default Null", " Not Null"))
|
||||||
|
|
||||||
|
If IsPrimaryKey Then
|
||||||
|
sb.Append($" PRIMARY KEY")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return sb.ToString()
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
13
Database/Mysql/MysqlCmdHelper.vb
Normal file
13
Database/Mysql/MysqlCmdHelper.vb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
Namespace Database.Mysql
|
||||||
|
Public Class MysqlCmdHelper
|
||||||
|
Inherits DbCmdHelper
|
||||||
|
|
||||||
|
Sub New
|
||||||
|
FiledSuffix = "`"c
|
||||||
|
FiledPrefix = "`"c
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
9
Database/MysqlCmdHelper.vb
Normal file
9
Database/MysqlCmdHelper.vb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Public Class MysqlCmdHelper
|
||||||
|
Inherits DbCmdHelper
|
||||||
|
|
||||||
|
Sub New()
|
||||||
|
FiledSuffix = "`"c
|
||||||
|
FiledPrefix = "`"c
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Class
|
||||||
220
Database/MysqlDataParam.vb
Normal file
220
Database/MysqlDataParam.vb
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
Public Class MysqlDataParam
|
||||||
|
Enum DataTypeEnum
|
||||||
|
'###############################数值类型#############################
|
||||||
|
''' <summary>
|
||||||
|
''' 1 byte,小整数值
|
||||||
|
''' </summary>
|
||||||
|
Tinyint
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 2 bytes,大整数值
|
||||||
|
''' </summary>
|
||||||
|
Smallint
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 3 bytes,大整数值
|
||||||
|
''' </summary>
|
||||||
|
Mediumint
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 4 bytes,大整数值
|
||||||
|
''' </summary>
|
||||||
|
Int
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 4 bytes,大整数值
|
||||||
|
''' </summary>
|
||||||
|
[Integer]
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 8 bytes,极大整数值
|
||||||
|
''' </summary>
|
||||||
|
Bigint
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 4 bytes,单精度浮点数值
|
||||||
|
''' </summary>
|
||||||
|
Float
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 8 bytes,双精度浮点数值
|
||||||
|
''' </summary>
|
||||||
|
[Double]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'####################日期类型###############################
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 对DECIMAL(M,D) ,如果M>D,为M+2否则为D+2.小数值
|
||||||
|
''' </summary>
|
||||||
|
[Decimal]
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 3 bytes,日期值,YYYY-MM-DD
|
||||||
|
''' </summary>
|
||||||
|
[Date]
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 3 bytes,时间值或持续时间,HH:MM:SS
|
||||||
|
''' </summary>
|
||||||
|
Time
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 1 bytes,年份值,YYYY
|
||||||
|
''' </summary>
|
||||||
|
Year
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 8 bytes,混合日期和时间值,YYYY-MM-DD HH:MM:SS
|
||||||
|
''' </summary>
|
||||||
|
Datetime
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 4 bytes,混合日期和时间值,时间戳,YYYYMMDD HHMMSS
|
||||||
|
''' </summary>
|
||||||
|
Timestamp
|
||||||
|
|
||||||
|
|
||||||
|
'####################字符类型###############################
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-255 bytes,定长字符串
|
||||||
|
''' </summary>
|
||||||
|
[Char]
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-65535 bytes,变长字符串
|
||||||
|
''' </summary>
|
||||||
|
Varchar
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-255 bytes,不超过 255 个字符的二进制字符串
|
||||||
|
''' </summary>
|
||||||
|
Tinyblob
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-255 bytes,短文本字符串
|
||||||
|
''' </summary>
|
||||||
|
Tinytext
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-65 535 bytes,二进制形式的长文本数据
|
||||||
|
''' </summary>
|
||||||
|
Blob
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-65 535 bytes,长文本数据
|
||||||
|
''' </summary>
|
||||||
|
Text
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-16 777 215 bytes,二进制形式的中等长度文本数据
|
||||||
|
''' </summary>
|
||||||
|
Mediumblob
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-16 777 215 bytes,中等长度文本数据
|
||||||
|
''' </summary>
|
||||||
|
Mediumtext
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-4 294 967 295 bytes,二进制形式的极大文本数据
|
||||||
|
''' </summary>
|
||||||
|
Longblob
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 0-4 294 967 295 bytes,极大文本数据
|
||||||
|
''' </summary>
|
||||||
|
Longtext
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 列名
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property ColumnName() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 当前值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property Value() As String
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 默认值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DefaultValue() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataType() As DataTypeEnum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型长度
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataTypeLength() As Integer
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型是否带符号
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsUnsigned() As Boolean
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否允许为空
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsNull() As Boolean = True
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否自动增长
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsAutoIncrement() As Boolean
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否为主键
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsPrimaryKey() As Boolean
|
||||||
|
|
||||||
|
Public Function ToAddColString() As String
|
||||||
|
Dim sb As New StringBuilder
|
||||||
|
sb.Append($"`{ColumnName}`")
|
||||||
|
|
||||||
|
Select Case DataType
|
||||||
|
Case DataTypeEnum.Varchar, DataTypeEnum.[Char]
|
||||||
|
sb.Append($" {DataType}({DataTypeLength}) ")
|
||||||
|
Case DataTypeEnum.Int
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
If IsUnsigned Then sb.Append($" Unsigned")
|
||||||
|
If IsAutoIncrement Then sb.Append($" AUTO_INCREMENT")
|
||||||
|
Case Else
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
End Select
|
||||||
|
|
||||||
|
sb.Append(IIf(IsNull, " Default Null", " Not Null"))
|
||||||
|
|
||||||
|
If IsPrimaryKey Then
|
||||||
|
sb.Append($" PRIMARY KEY")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return sb.ToString()
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
106
Database/Sqlite/DataParam.vb
Normal file
106
Database/Sqlite/DataParam.vb
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
Namespace Database.Sqlite
|
||||||
|
Public Class DataParam
|
||||||
|
Enum DataTypeEnum
|
||||||
|
Varchar
|
||||||
|
Nchar
|
||||||
|
Blob
|
||||||
|
Bit
|
||||||
|
Datetime
|
||||||
|
[Decimal]
|
||||||
|
Real
|
||||||
|
UniqueIdentifier
|
||||||
|
Int
|
||||||
|
[Integer]
|
||||||
|
TinyInt
|
||||||
|
[Single]
|
||||||
|
Nvarchar
|
||||||
|
SmallInt
|
||||||
|
SmallUint
|
||||||
|
Uint
|
||||||
|
UnsignedInteger
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 列名
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property ColumnName() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 当前值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property Value() As String
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 默认值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DefaultValue() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataType() As DataTypeEnum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型长度
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataTypeLength() As Integer
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否允许为空
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsNull() As Boolean = True
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否自动增长
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsAutoIncrement() As Boolean
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否为主键
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsPrimaryKey() As Boolean
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否为唯一值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsUnique() As Boolean
|
||||||
|
|
||||||
|
|
||||||
|
Public Function ToAddColString() As String
|
||||||
|
Dim sb As New StringBuilder
|
||||||
|
sb.Append($"`{ColumnName}`")
|
||||||
|
|
||||||
|
Select Case DataType
|
||||||
|
Case DataTypeEnum.Varchar, DataTypeEnum.Nchar, DataTypeEnum.Nvarchar
|
||||||
|
sb.Append($" {DataType}({DataTypeLength}) ")
|
||||||
|
Case DataTypeEnum.Int,DataTypeEnum.Integer
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
Case Else
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
End Select
|
||||||
|
|
||||||
|
If IsAutoIncrement Then sb.Append($" AUTOINCREMENT")
|
||||||
|
|
||||||
|
sb.Append(IIf(IsNull, " Default Null", " Not Null"))
|
||||||
|
|
||||||
|
If IsPrimaryKey Then
|
||||||
|
sb.Append($" PRIMARY KEY")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return sb.ToString()
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
20
Database/Sqlite/SqliteCmdHelper.vb
Normal file
20
Database/Sqlite/SqliteCmdHelper.vb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
Namespace Database.Sqlite
|
||||||
|
Public Class SqliteCmdHelper
|
||||||
|
Inherits DbCmdHelper
|
||||||
|
|
||||||
|
Sub New()
|
||||||
|
FiledSuffix = "["c
|
||||||
|
FiledPrefix = "]"c
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据表的信息
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName"></param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overrides Function SearchTableInfo(tableName As String) As String
|
||||||
|
Return $"select * from sqlite_master where tbl_name = '{tableName}';"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
19
Database/SqliteCmdHelper.vb
Normal file
19
Database/SqliteCmdHelper.vb
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
Public Class SqliteCmdHelper
|
||||||
|
Inherits DbCmdHelper
|
||||||
|
|
||||||
|
Sub New()
|
||||||
|
FiledSuffix = "["c
|
||||||
|
FiledPrefix = "]"c
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 查询指定数据表的信息
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tableName"></param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Overrides Function SearchTableInfo(tableName As String) As String
|
||||||
|
Return $"select * from sqlite_master where tbl_name = '{tableName}';"
|
||||||
|
End Function
|
||||||
|
|
||||||
|
End Class
|
||||||
105
Database/SqliteDataParam.vb
Normal file
105
Database/SqliteDataParam.vb
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
|
||||||
|
Public Class SqliteDataParam
|
||||||
|
Enum DataTypeEnum
|
||||||
|
Varchar
|
||||||
|
Nchar
|
||||||
|
Blob
|
||||||
|
Bit
|
||||||
|
Datetime
|
||||||
|
[Decimal]
|
||||||
|
Real
|
||||||
|
UniqueIdentifier
|
||||||
|
Int
|
||||||
|
[Integer]
|
||||||
|
TinyInt
|
||||||
|
[Single]
|
||||||
|
Nvarchar
|
||||||
|
SmallInt
|
||||||
|
SmallUint
|
||||||
|
Uint
|
||||||
|
UnsignedInteger
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 列名
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property ColumnName() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 当前值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property Value() As String
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 默认值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DefaultValue() As String
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataType() As DataTypeEnum
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 数据类型长度
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property DataTypeLength() As Integer
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否允许为空
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsNull() As Boolean = True
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否自动增长
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsAutoIncrement() As Boolean
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否为主键
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsPrimaryKey() As Boolean
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 是否为唯一值
|
||||||
|
''' </summary>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Property IsUnique() As Boolean
|
||||||
|
|
||||||
|
|
||||||
|
Public Function ToAddColString() As String
|
||||||
|
Dim sb As New StringBuilder
|
||||||
|
sb.Append($"`{ColumnName}`")
|
||||||
|
|
||||||
|
Select Case DataType
|
||||||
|
Case DataTypeEnum.Varchar, DataTypeEnum.Nchar, DataTypeEnum.Nvarchar
|
||||||
|
sb.Append($" {DataType}({DataTypeLength}) ")
|
||||||
|
Case DataTypeEnum.Int, DataTypeEnum.Integer
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
Case Else
|
||||||
|
sb.Append($" {DataType}")
|
||||||
|
End Select
|
||||||
|
|
||||||
|
If IsAutoIncrement Then sb.Append($" AUTOINCREMENT")
|
||||||
|
|
||||||
|
sb.Append(IIf(IsNull, " Default Null", " Not Null"))
|
||||||
|
|
||||||
|
If IsPrimaryKey Then
|
||||||
|
sb.Append($" PRIMARY KEY")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return sb.ToString()
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
876
Form1.Designer.vb
generated
Normal file
876
Form1.Designer.vb
generated
Normal file
@@ -0,0 +1,876 @@
|
|||||||
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||||
|
Partial Class Form1
|
||||||
|
Inherits System.Windows.Forms.Form
|
||||||
|
|
||||||
|
'Form 重写 Dispose,以清理组件列表。
|
||||||
|
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||||
|
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||||
|
Try
|
||||||
|
If disposing AndAlso components IsNot Nothing Then
|
||||||
|
components.Dispose()
|
||||||
|
End If
|
||||||
|
Finally
|
||||||
|
MyBase.Dispose(disposing)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Windows 窗体设计器所必需的
|
||||||
|
Private components As System.ComponentModel.IContainer
|
||||||
|
|
||||||
|
'注意: 以下过程是 Windows 窗体设计器所必需的
|
||||||
|
'可以使用 Windows 窗体设计器修改它。
|
||||||
|
'不要使用代码编辑器修改它。
|
||||||
|
<System.Diagnostics.DebuggerStepThrough()> _
|
||||||
|
Private Sub InitializeComponent()
|
||||||
|
Me.components = New System.ComponentModel.Container()
|
||||||
|
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
|
||||||
|
Me.TabControl1 = New System.Windows.Forms.TabControl()
|
||||||
|
Me.TabPage1 = New System.Windows.Forms.TabPage()
|
||||||
|
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
|
||||||
|
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer()
|
||||||
|
Me.Label_Time = New System.Windows.Forms.Label()
|
||||||
|
Me.label_Tip = New System.Windows.Forms.Label()
|
||||||
|
Me.SplitContainer4 = New System.Windows.Forms.SplitContainer()
|
||||||
|
Me.Label18 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label17 = New System.Windows.Forms.Label()
|
||||||
|
Me.TextBox14 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.Cbo_Port = New System.Windows.Forms.ComboBox()
|
||||||
|
Me.TextBox15 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.TextBox3 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.Label15 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label1 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label16 = New System.Windows.Forms.Label()
|
||||||
|
Me.Button2 = New System.Windows.Forms.Button()
|
||||||
|
Me.TextBox12 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.Text_Row = New System.Windows.Forms.TextBox()
|
||||||
|
Me.TextBox13 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.TextBox1 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.Label13 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label2 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label14 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label3 = New System.Windows.Forms.Label()
|
||||||
|
Me.TextBox10 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.TextBox2 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.TextBox11 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.Label4 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label11 = New System.Windows.Forms.Label()
|
||||||
|
Me.Button1 = New System.Windows.Forms.Button()
|
||||||
|
Me.Label12 = New System.Windows.Forms.Label()
|
||||||
|
Me.Btn_OpenPort = New System.Windows.Forms.Button()
|
||||||
|
Me.TextBox8 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.TextBox9 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.Cbo_Baud = New System.Windows.Forms.ComboBox()
|
||||||
|
Me.Label9 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label6 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label10 = New System.Windows.Forms.Label()
|
||||||
|
Me.Label5 = New System.Windows.Forms.Label()
|
||||||
|
Me.TextBox6 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.TextBox5 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.TextBox7 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.Button3 = New System.Windows.Forms.Button()
|
||||||
|
Me.Label7 = New System.Windows.Forms.Label()
|
||||||
|
Me.TextBox4 = New System.Windows.Forms.TextBox()
|
||||||
|
Me.Label8 = New System.Windows.Forms.Label()
|
||||||
|
Me.SplitContainer3 = New System.Windows.Forms.SplitContainer()
|
||||||
|
Me.RichTextBox1 = New System.Windows.Forms.RichTextBox()
|
||||||
|
Me.ToolStrip3 = New System.Windows.Forms.ToolStrip()
|
||||||
|
Me.ToolStripButton1 = New System.Windows.Forms.ToolStripButton()
|
||||||
|
Me.Grid1 = New FlexCell.Grid()
|
||||||
|
Me.ToolStrip2 = New System.Windows.Forms.ToolStrip()
|
||||||
|
Me.ToolStrip1 = New System.Windows.Forms.ToolStrip()
|
||||||
|
Me.ToolStripLabel1 = New System.Windows.Forms.ToolStripLabel()
|
||||||
|
Me.ToolStripLabel2 = New System.Windows.Forms.ToolStripLabel()
|
||||||
|
Me.TabPage2 = New System.Windows.Forms.TabPage()
|
||||||
|
Me.SerialPort1 = New System.IO.Ports.SerialPort(Me.components)
|
||||||
|
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
|
||||||
|
Me.CheckBox1 = New System.Windows.Forms.CheckBox()
|
||||||
|
Me.TabControl1.SuspendLayout()
|
||||||
|
Me.TabPage1.SuspendLayout()
|
||||||
|
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
Me.SplitContainer1.Panel1.SuspendLayout()
|
||||||
|
Me.SplitContainer1.Panel2.SuspendLayout()
|
||||||
|
Me.SplitContainer1.SuspendLayout()
|
||||||
|
CType(Me.SplitContainer2, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
Me.SplitContainer2.Panel1.SuspendLayout()
|
||||||
|
Me.SplitContainer2.Panel2.SuspendLayout()
|
||||||
|
Me.SplitContainer2.SuspendLayout()
|
||||||
|
CType(Me.SplitContainer4, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
Me.SplitContainer4.Panel2.SuspendLayout()
|
||||||
|
Me.SplitContainer4.SuspendLayout()
|
||||||
|
CType(Me.SplitContainer3, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
Me.SplitContainer3.Panel1.SuspendLayout()
|
||||||
|
Me.SplitContainer3.Panel2.SuspendLayout()
|
||||||
|
Me.SplitContainer3.SuspendLayout()
|
||||||
|
Me.ToolStrip3.SuspendLayout()
|
||||||
|
Me.ToolStrip1.SuspendLayout()
|
||||||
|
Me.SuspendLayout()
|
||||||
|
'
|
||||||
|
'TabControl1
|
||||||
|
'
|
||||||
|
Me.TabControl1.Controls.Add(Me.TabPage1)
|
||||||
|
Me.TabControl1.Controls.Add(Me.TabPage2)
|
||||||
|
Me.TabControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.TabControl1.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.TabControl1.Name = "TabControl1"
|
||||||
|
Me.TabControl1.SelectedIndex = 0
|
||||||
|
Me.TabControl1.Size = New System.Drawing.Size(1240, 863)
|
||||||
|
Me.TabControl1.TabIndex = 0
|
||||||
|
'
|
||||||
|
'TabPage1
|
||||||
|
'
|
||||||
|
Me.TabPage1.Controls.Add(Me.SplitContainer1)
|
||||||
|
Me.TabPage1.Controls.Add(Me.ToolStrip2)
|
||||||
|
Me.TabPage1.Controls.Add(Me.ToolStrip1)
|
||||||
|
Me.TabPage1.Location = New System.Drawing.Point(4, 22)
|
||||||
|
Me.TabPage1.Name = "TabPage1"
|
||||||
|
Me.TabPage1.Padding = New System.Windows.Forms.Padding(3)
|
||||||
|
Me.TabPage1.Size = New System.Drawing.Size(1232, 837)
|
||||||
|
Me.TabPage1.TabIndex = 0
|
||||||
|
Me.TabPage1.Text = "测试"
|
||||||
|
Me.TabPage1.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'SplitContainer1
|
||||||
|
'
|
||||||
|
Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.SplitContainer1.Location = New System.Drawing.Point(3, 28)
|
||||||
|
Me.SplitContainer1.Name = "SplitContainer1"
|
||||||
|
Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
|
||||||
|
'
|
||||||
|
'SplitContainer1.Panel1
|
||||||
|
'
|
||||||
|
Me.SplitContainer1.Panel1.Controls.Add(Me.SplitContainer2)
|
||||||
|
'
|
||||||
|
'SplitContainer1.Panel2
|
||||||
|
'
|
||||||
|
Me.SplitContainer1.Panel2.Controls.Add(Me.SplitContainer3)
|
||||||
|
Me.SplitContainer1.Size = New System.Drawing.Size(1226, 781)
|
||||||
|
Me.SplitContainer1.SplitterDistance = 238
|
||||||
|
Me.SplitContainer1.TabIndex = 4
|
||||||
|
'
|
||||||
|
'SplitContainer2
|
||||||
|
'
|
||||||
|
Me.SplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.SplitContainer2.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.SplitContainer2.Name = "SplitContainer2"
|
||||||
|
'
|
||||||
|
'SplitContainer2.Panel1
|
||||||
|
'
|
||||||
|
Me.SplitContainer2.Panel1.Controls.Add(Me.Label_Time)
|
||||||
|
Me.SplitContainer2.Panel1.Controls.Add(Me.label_Tip)
|
||||||
|
Me.SplitContainer2.Panel1Collapsed = True
|
||||||
|
'
|
||||||
|
'SplitContainer2.Panel2
|
||||||
|
'
|
||||||
|
Me.SplitContainer2.Panel2.Controls.Add(Me.SplitContainer4)
|
||||||
|
Me.SplitContainer2.Size = New System.Drawing.Size(1226, 238)
|
||||||
|
Me.SplitContainer2.SplitterDistance = 571
|
||||||
|
Me.SplitContainer2.TabIndex = 5
|
||||||
|
'
|
||||||
|
'Label_Time
|
||||||
|
'
|
||||||
|
Me.Label_Time.BackColor = System.Drawing.Color.Black
|
||||||
|
Me.Label_Time.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.Label_Time.Font = New System.Drawing.Font("宋体", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label_Time.ForeColor = System.Drawing.Color.White
|
||||||
|
Me.Label_Time.Location = New System.Drawing.Point(0, 140)
|
||||||
|
Me.Label_Time.Name = "Label_Time"
|
||||||
|
Me.Label_Time.Size = New System.Drawing.Size(571, 0)
|
||||||
|
Me.Label_Time.TabIndex = 1
|
||||||
|
Me.Label_Time.Text = "时间"
|
||||||
|
Me.Label_Time.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'label_Tip
|
||||||
|
'
|
||||||
|
Me.label_Tip.BackColor = System.Drawing.Color.Black
|
||||||
|
Me.label_Tip.Dock = System.Windows.Forms.DockStyle.Top
|
||||||
|
Me.label_Tip.Font = New System.Drawing.Font("宋体", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.label_Tip.ForeColor = System.Drawing.Color.White
|
||||||
|
Me.label_Tip.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.label_Tip.Name = "label_Tip"
|
||||||
|
Me.label_Tip.Size = New System.Drawing.Size(571, 140)
|
||||||
|
Me.label_Tip.TabIndex = 0
|
||||||
|
Me.label_Tip.Text = "测试提示"
|
||||||
|
Me.label_Tip.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'SplitContainer4
|
||||||
|
'
|
||||||
|
Me.SplitContainer4.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.SplitContainer4.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.SplitContainer4.Name = "SplitContainer4"
|
||||||
|
Me.SplitContainer4.Panel1Collapsed = True
|
||||||
|
'
|
||||||
|
'SplitContainer4.Panel2
|
||||||
|
'
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.CheckBox1)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label18)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label17)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox14)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Cbo_Port)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox15)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox3)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label15)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label1)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label16)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Button2)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox12)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Text_Row)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox13)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox1)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label13)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label2)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label14)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label3)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox10)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox2)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox11)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label4)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label11)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Button1)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label12)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Btn_OpenPort)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox8)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox9)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Cbo_Baud)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label9)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label6)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label10)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label5)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox6)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox5)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox7)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Button3)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label7)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.TextBox4)
|
||||||
|
Me.SplitContainer4.Panel2.Controls.Add(Me.Label8)
|
||||||
|
Me.SplitContainer4.Size = New System.Drawing.Size(1226, 238)
|
||||||
|
Me.SplitContainer4.SplitterDistance = 500
|
||||||
|
Me.SplitContainer4.TabIndex = 46
|
||||||
|
'
|
||||||
|
'Label18
|
||||||
|
'
|
||||||
|
Me.Label18.Font = New System.Drawing.Font("宋体", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label18.Location = New System.Drawing.Point(976, 11)
|
||||||
|
Me.Label18.Name = "Label18"
|
||||||
|
Me.Label18.Size = New System.Drawing.Size(245, 77)
|
||||||
|
Me.Label18.TabIndex = 72
|
||||||
|
Me.Label18.Text = "按键序号"
|
||||||
|
Me.Label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Label17
|
||||||
|
'
|
||||||
|
Me.Label17.Font = New System.Drawing.Font("宋体", 51.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label17.Location = New System.Drawing.Point(968, 91)
|
||||||
|
Me.Label17.Name = "Label17"
|
||||||
|
Me.Label17.Size = New System.Drawing.Size(253, 142)
|
||||||
|
Me.Label17.TabIndex = 71
|
||||||
|
Me.Label17.Text = "1000"
|
||||||
|
Me.Label17.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'TextBox14
|
||||||
|
'
|
||||||
|
Me.TextBox14.Location = New System.Drawing.Point(276, 169)
|
||||||
|
Me.TextBox14.MaxLength = 6
|
||||||
|
Me.TextBox14.Name = "TextBox14"
|
||||||
|
Me.TextBox14.Size = New System.Drawing.Size(59, 21)
|
||||||
|
Me.TextBox14.TabIndex = 68
|
||||||
|
Me.TextBox14.Text = "2"
|
||||||
|
Me.TextBox14.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'Cbo_Port
|
||||||
|
'
|
||||||
|
Me.Cbo_Port.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
|
||||||
|
Me.Cbo_Port.Font = New System.Drawing.Font("Consolas", 9.75!)
|
||||||
|
Me.Cbo_Port.FormattingEnabled = True
|
||||||
|
Me.Cbo_Port.Location = New System.Drawing.Point(633, 167)
|
||||||
|
Me.Cbo_Port.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
|
||||||
|
Me.Cbo_Port.Name = "Cbo_Port"
|
||||||
|
Me.Cbo_Port.Size = New System.Drawing.Size(126, 23)
|
||||||
|
Me.Cbo_Port.TabIndex = 38
|
||||||
|
'
|
||||||
|
'TextBox15
|
||||||
|
'
|
||||||
|
Me.TextBox15.Location = New System.Drawing.Point(421, 170)
|
||||||
|
Me.TextBox15.MaxLength = 6
|
||||||
|
Me.TextBox15.Name = "TextBox15"
|
||||||
|
Me.TextBox15.Size = New System.Drawing.Size(55, 21)
|
||||||
|
Me.TextBox15.TabIndex = 70
|
||||||
|
Me.TextBox15.Text = "3"
|
||||||
|
Me.TextBox15.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'TextBox3
|
||||||
|
'
|
||||||
|
Me.TextBox3.Enabled = False
|
||||||
|
Me.TextBox3.Location = New System.Drawing.Point(552, 15)
|
||||||
|
Me.TextBox3.MaxLength = 6
|
||||||
|
Me.TextBox3.Name = "TextBox3"
|
||||||
|
Me.TextBox3.Size = New System.Drawing.Size(59, 21)
|
||||||
|
Me.TextBox3.TabIndex = 42
|
||||||
|
Me.TextBox3.Text = "2"
|
||||||
|
Me.TextBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
Me.TextBox3.Visible = False
|
||||||
|
'
|
||||||
|
'Label15
|
||||||
|
'
|
||||||
|
Me.Label15.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label15.Location = New System.Drawing.Point(339, 168)
|
||||||
|
Me.Label15.Name = "Label15"
|
||||||
|
Me.Label15.Size = New System.Drawing.Size(76, 23)
|
||||||
|
Me.Label15.TabIndex = 69
|
||||||
|
Me.Label15.Text = "上限:"
|
||||||
|
Me.Label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Label1
|
||||||
|
'
|
||||||
|
Me.Label1.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label1.Location = New System.Drawing.Point(208, 208)
|
||||||
|
Me.Label1.Name = "Label1"
|
||||||
|
Me.Label1.Size = New System.Drawing.Size(46, 23)
|
||||||
|
Me.Label1.TabIndex = 0
|
||||||
|
Me.Label1.Text = "行:"
|
||||||
|
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Label16
|
||||||
|
'
|
||||||
|
Me.Label16.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label16.Location = New System.Drawing.Point(192, 168)
|
||||||
|
Me.Label16.Name = "Label16"
|
||||||
|
Me.Label16.Size = New System.Drawing.Size(78, 23)
|
||||||
|
Me.Label16.TabIndex = 67
|
||||||
|
Me.Label16.Text = "下限:"
|
||||||
|
Me.Label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Button2
|
||||||
|
'
|
||||||
|
Me.Button2.Enabled = False
|
||||||
|
Me.Button2.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Button2.Location = New System.Drawing.Point(749, 11)
|
||||||
|
Me.Button2.Name = "Button2"
|
||||||
|
Me.Button2.Size = New System.Drawing.Size(84, 28)
|
||||||
|
Me.Button2.TabIndex = 45
|
||||||
|
Me.Button2.Text = "设置"
|
||||||
|
Me.Button2.UseVisualStyleBackColor = True
|
||||||
|
Me.Button2.Visible = False
|
||||||
|
'
|
||||||
|
'TextBox12
|
||||||
|
'
|
||||||
|
Me.TextBox12.Location = New System.Drawing.Point(276, 142)
|
||||||
|
Me.TextBox12.MaxLength = 6
|
||||||
|
Me.TextBox12.Name = "TextBox12"
|
||||||
|
Me.TextBox12.Size = New System.Drawing.Size(59, 21)
|
||||||
|
Me.TextBox12.TabIndex = 64
|
||||||
|
Me.TextBox12.Text = "2"
|
||||||
|
Me.TextBox12.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'Text_Row
|
||||||
|
'
|
||||||
|
Me.Text_Row.Location = New System.Drawing.Point(276, 209)
|
||||||
|
Me.Text_Row.MaxLength = 2
|
||||||
|
Me.Text_Row.Name = "Text_Row"
|
||||||
|
Me.Text_Row.Size = New System.Drawing.Size(59, 21)
|
||||||
|
Me.Text_Row.TabIndex = 1
|
||||||
|
Me.Text_Row.Text = "2"
|
||||||
|
Me.Text_Row.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'TextBox13
|
||||||
|
'
|
||||||
|
Me.TextBox13.Location = New System.Drawing.Point(421, 143)
|
||||||
|
Me.TextBox13.MaxLength = 6
|
||||||
|
Me.TextBox13.Name = "TextBox13"
|
||||||
|
Me.TextBox13.Size = New System.Drawing.Size(55, 21)
|
||||||
|
Me.TextBox13.TabIndex = 66
|
||||||
|
Me.TextBox13.Text = "3"
|
||||||
|
Me.TextBox13.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'TextBox1
|
||||||
|
'
|
||||||
|
Me.TextBox1.Enabled = False
|
||||||
|
Me.TextBox1.Location = New System.Drawing.Point(676, 15)
|
||||||
|
Me.TextBox1.MaxLength = 6
|
||||||
|
Me.TextBox1.Name = "TextBox1"
|
||||||
|
Me.TextBox1.Size = New System.Drawing.Size(55, 21)
|
||||||
|
Me.TextBox1.TabIndex = 44
|
||||||
|
Me.TextBox1.Text = "3"
|
||||||
|
Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
Me.TextBox1.Visible = False
|
||||||
|
'
|
||||||
|
'Label13
|
||||||
|
'
|
||||||
|
Me.Label13.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label13.Location = New System.Drawing.Point(339, 141)
|
||||||
|
Me.Label13.Name = "Label13"
|
||||||
|
Me.Label13.Size = New System.Drawing.Size(76, 23)
|
||||||
|
Me.Label13.TabIndex = 65
|
||||||
|
Me.Label13.Text = "上限:"
|
||||||
|
Me.Label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Label2
|
||||||
|
'
|
||||||
|
Me.Label2.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label2.Location = New System.Drawing.Point(354, 208)
|
||||||
|
Me.Label2.Name = "Label2"
|
||||||
|
Me.Label2.Size = New System.Drawing.Size(46, 23)
|
||||||
|
Me.Label2.TabIndex = 2
|
||||||
|
Me.Label2.Text = "列:"
|
||||||
|
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Label14
|
||||||
|
'
|
||||||
|
Me.Label14.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label14.Location = New System.Drawing.Point(192, 141)
|
||||||
|
Me.Label14.Name = "Label14"
|
||||||
|
Me.Label14.Size = New System.Drawing.Size(78, 23)
|
||||||
|
Me.Label14.TabIndex = 63
|
||||||
|
Me.Label14.Text = "下限:"
|
||||||
|
Me.Label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Label3
|
||||||
|
'
|
||||||
|
Me.Label3.Enabled = False
|
||||||
|
Me.Label3.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label3.Location = New System.Drawing.Point(605, 14)
|
||||||
|
Me.Label3.Name = "Label3"
|
||||||
|
Me.Label3.Size = New System.Drawing.Size(76, 23)
|
||||||
|
Me.Label3.TabIndex = 43
|
||||||
|
Me.Label3.Text = "上限:"
|
||||||
|
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
Me.Label3.Visible = False
|
||||||
|
'
|
||||||
|
'TextBox10
|
||||||
|
'
|
||||||
|
Me.TextBox10.Location = New System.Drawing.Point(276, 117)
|
||||||
|
Me.TextBox10.MaxLength = 6
|
||||||
|
Me.TextBox10.Name = "TextBox10"
|
||||||
|
Me.TextBox10.Size = New System.Drawing.Size(59, 21)
|
||||||
|
Me.TextBox10.TabIndex = 60
|
||||||
|
Me.TextBox10.Text = "2"
|
||||||
|
Me.TextBox10.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'TextBox2
|
||||||
|
'
|
||||||
|
Me.TextBox2.Location = New System.Drawing.Point(421, 209)
|
||||||
|
Me.TextBox2.MaxLength = 2
|
||||||
|
Me.TextBox2.Name = "TextBox2"
|
||||||
|
Me.TextBox2.Size = New System.Drawing.Size(55, 21)
|
||||||
|
Me.TextBox2.TabIndex = 3
|
||||||
|
Me.TextBox2.Text = "3"
|
||||||
|
Me.TextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'TextBox11
|
||||||
|
'
|
||||||
|
Me.TextBox11.Location = New System.Drawing.Point(421, 118)
|
||||||
|
Me.TextBox11.MaxLength = 6
|
||||||
|
Me.TextBox11.Name = "TextBox11"
|
||||||
|
Me.TextBox11.Size = New System.Drawing.Size(55, 21)
|
||||||
|
Me.TextBox11.TabIndex = 62
|
||||||
|
Me.TextBox11.Text = "3"
|
||||||
|
Me.TextBox11.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'Label4
|
||||||
|
'
|
||||||
|
Me.Label4.Enabled = False
|
||||||
|
Me.Label4.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label4.Location = New System.Drawing.Point(482, 14)
|
||||||
|
Me.Label4.Name = "Label4"
|
||||||
|
Me.Label4.Size = New System.Drawing.Size(78, 23)
|
||||||
|
Me.Label4.TabIndex = 41
|
||||||
|
Me.Label4.Text = "下限:"
|
||||||
|
Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
Me.Label4.Visible = False
|
||||||
|
'
|
||||||
|
'Label11
|
||||||
|
'
|
||||||
|
Me.Label11.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label11.Location = New System.Drawing.Point(339, 116)
|
||||||
|
Me.Label11.Name = "Label11"
|
||||||
|
Me.Label11.Size = New System.Drawing.Size(76, 23)
|
||||||
|
Me.Label11.TabIndex = 61
|
||||||
|
Me.Label11.Text = "上限:"
|
||||||
|
Me.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Button1
|
||||||
|
'
|
||||||
|
Me.Button1.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Button1.Location = New System.Drawing.Point(489, 205)
|
||||||
|
Me.Button1.Name = "Button1"
|
||||||
|
Me.Button1.Size = New System.Drawing.Size(84, 28)
|
||||||
|
Me.Button1.TabIndex = 4
|
||||||
|
Me.Button1.Text = "设置"
|
||||||
|
Me.Button1.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'Label12
|
||||||
|
'
|
||||||
|
Me.Label12.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label12.Location = New System.Drawing.Point(192, 116)
|
||||||
|
Me.Label12.Name = "Label12"
|
||||||
|
Me.Label12.Size = New System.Drawing.Size(78, 23)
|
||||||
|
Me.Label12.TabIndex = 59
|
||||||
|
Me.Label12.Text = "下限:"
|
||||||
|
Me.Label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Btn_OpenPort
|
||||||
|
'
|
||||||
|
Me.Btn_OpenPort.Font = New System.Drawing.Font("Consolas", 9.75!)
|
||||||
|
Me.Btn_OpenPort.ImeMode = System.Windows.Forms.ImeMode.NoControl
|
||||||
|
Me.Btn_OpenPort.Location = New System.Drawing.Point(789, 172)
|
||||||
|
Me.Btn_OpenPort.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
|
||||||
|
Me.Btn_OpenPort.Name = "Btn_OpenPort"
|
||||||
|
Me.Btn_OpenPort.Size = New System.Drawing.Size(88, 54)
|
||||||
|
Me.Btn_OpenPort.TabIndex = 40
|
||||||
|
Me.Btn_OpenPort.Text = "Open CommPort"
|
||||||
|
Me.Btn_OpenPort.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'TextBox8
|
||||||
|
'
|
||||||
|
Me.TextBox8.Location = New System.Drawing.Point(276, 92)
|
||||||
|
Me.TextBox8.MaxLength = 6
|
||||||
|
Me.TextBox8.Name = "TextBox8"
|
||||||
|
Me.TextBox8.Size = New System.Drawing.Size(59, 21)
|
||||||
|
Me.TextBox8.TabIndex = 56
|
||||||
|
Me.TextBox8.Text = "2"
|
||||||
|
Me.TextBox8.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'TextBox9
|
||||||
|
'
|
||||||
|
Me.TextBox9.Location = New System.Drawing.Point(421, 93)
|
||||||
|
Me.TextBox9.MaxLength = 6
|
||||||
|
Me.TextBox9.Name = "TextBox9"
|
||||||
|
Me.TextBox9.Size = New System.Drawing.Size(55, 21)
|
||||||
|
Me.TextBox9.TabIndex = 58
|
||||||
|
Me.TextBox9.Text = "3"
|
||||||
|
Me.TextBox9.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'Cbo_Baud
|
||||||
|
'
|
||||||
|
Me.Cbo_Baud.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
|
||||||
|
Me.Cbo_Baud.Font = New System.Drawing.Font("Consolas", 9.75!)
|
||||||
|
Me.Cbo_Baud.FormattingEnabled = True
|
||||||
|
Me.Cbo_Baud.Items.AddRange(New Object() {"1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200", "256000", "512000", "9216000", "1000000"})
|
||||||
|
Me.Cbo_Baud.Location = New System.Drawing.Point(633, 206)
|
||||||
|
Me.Cbo_Baud.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
|
||||||
|
Me.Cbo_Baud.Name = "Cbo_Baud"
|
||||||
|
Me.Cbo_Baud.Size = New System.Drawing.Size(126, 23)
|
||||||
|
Me.Cbo_Baud.TabIndex = 39
|
||||||
|
'
|
||||||
|
'Label9
|
||||||
|
'
|
||||||
|
Me.Label9.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label9.Location = New System.Drawing.Point(339, 91)
|
||||||
|
Me.Label9.Name = "Label9"
|
||||||
|
Me.Label9.Size = New System.Drawing.Size(76, 23)
|
||||||
|
Me.Label9.TabIndex = 57
|
||||||
|
Me.Label9.Text = "上限:"
|
||||||
|
Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Label6
|
||||||
|
'
|
||||||
|
Me.Label6.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label6.Location = New System.Drawing.Point(192, 41)
|
||||||
|
Me.Label6.Name = "Label6"
|
||||||
|
Me.Label6.Size = New System.Drawing.Size(78, 23)
|
||||||
|
Me.Label6.TabIndex = 46
|
||||||
|
Me.Label6.Text = "下限:"
|
||||||
|
Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Label10
|
||||||
|
'
|
||||||
|
Me.Label10.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label10.Location = New System.Drawing.Point(192, 91)
|
||||||
|
Me.Label10.Name = "Label10"
|
||||||
|
Me.Label10.Size = New System.Drawing.Size(78, 23)
|
||||||
|
Me.Label10.TabIndex = 55
|
||||||
|
Me.Label10.Text = "下限:"
|
||||||
|
Me.Label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'Label5
|
||||||
|
'
|
||||||
|
Me.Label5.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label5.Location = New System.Drawing.Point(341, 41)
|
||||||
|
Me.Label5.Name = "Label5"
|
||||||
|
Me.Label5.Size = New System.Drawing.Size(76, 23)
|
||||||
|
Me.Label5.TabIndex = 48
|
||||||
|
Me.Label5.Text = "上限:"
|
||||||
|
Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'TextBox6
|
||||||
|
'
|
||||||
|
Me.TextBox6.Location = New System.Drawing.Point(276, 67)
|
||||||
|
Me.TextBox6.MaxLength = 6
|
||||||
|
Me.TextBox6.Name = "TextBox6"
|
||||||
|
Me.TextBox6.Size = New System.Drawing.Size(59, 21)
|
||||||
|
Me.TextBox6.TabIndex = 52
|
||||||
|
Me.TextBox6.Text = "2"
|
||||||
|
Me.TextBox6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'TextBox5
|
||||||
|
'
|
||||||
|
Me.TextBox5.Location = New System.Drawing.Point(423, 43)
|
||||||
|
Me.TextBox5.MaxLength = 6
|
||||||
|
Me.TextBox5.Name = "TextBox5"
|
||||||
|
Me.TextBox5.Size = New System.Drawing.Size(55, 21)
|
||||||
|
Me.TextBox5.TabIndex = 49
|
||||||
|
Me.TextBox5.Text = "3"
|
||||||
|
Me.TextBox5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'TextBox7
|
||||||
|
'
|
||||||
|
Me.TextBox7.Location = New System.Drawing.Point(421, 68)
|
||||||
|
Me.TextBox7.MaxLength = 6
|
||||||
|
Me.TextBox7.Name = "TextBox7"
|
||||||
|
Me.TextBox7.Size = New System.Drawing.Size(55, 21)
|
||||||
|
Me.TextBox7.TabIndex = 54
|
||||||
|
Me.TextBox7.Text = "3"
|
||||||
|
Me.TextBox7.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'Button3
|
||||||
|
'
|
||||||
|
Me.Button3.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Button3.Location = New System.Drawing.Point(490, 163)
|
||||||
|
Me.Button3.Name = "Button3"
|
||||||
|
Me.Button3.Size = New System.Drawing.Size(84, 28)
|
||||||
|
Me.Button3.TabIndex = 50
|
||||||
|
Me.Button3.Text = "设置"
|
||||||
|
Me.Button3.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'Label7
|
||||||
|
'
|
||||||
|
Me.Label7.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label7.Location = New System.Drawing.Point(339, 66)
|
||||||
|
Me.Label7.Name = "Label7"
|
||||||
|
Me.Label7.Size = New System.Drawing.Size(76, 23)
|
||||||
|
Me.Label7.TabIndex = 53
|
||||||
|
Me.Label7.Text = "上限:"
|
||||||
|
Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'TextBox4
|
||||||
|
'
|
||||||
|
Me.TextBox4.Location = New System.Drawing.Point(278, 42)
|
||||||
|
Me.TextBox4.MaxLength = 6
|
||||||
|
Me.TextBox4.Name = "TextBox4"
|
||||||
|
Me.TextBox4.Size = New System.Drawing.Size(59, 21)
|
||||||
|
Me.TextBox4.TabIndex = 47
|
||||||
|
Me.TextBox4.Text = "2"
|
||||||
|
Me.TextBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
|
||||||
|
'
|
||||||
|
'Label8
|
||||||
|
'
|
||||||
|
Me.Label8.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.Label8.Location = New System.Drawing.Point(192, 66)
|
||||||
|
Me.Label8.Name = "Label8"
|
||||||
|
Me.Label8.Size = New System.Drawing.Size(78, 23)
|
||||||
|
Me.Label8.TabIndex = 51
|
||||||
|
Me.Label8.Text = "下限:"
|
||||||
|
Me.Label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||||
|
'
|
||||||
|
'SplitContainer3
|
||||||
|
'
|
||||||
|
Me.SplitContainer3.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.SplitContainer3.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.SplitContainer3.Name = "SplitContainer3"
|
||||||
|
'
|
||||||
|
'SplitContainer3.Panel1
|
||||||
|
'
|
||||||
|
Me.SplitContainer3.Panel1.Controls.Add(Me.RichTextBox1)
|
||||||
|
Me.SplitContainer3.Panel1.Controls.Add(Me.ToolStrip3)
|
||||||
|
Me.SplitContainer3.Panel1.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
|
Me.SplitContainer3.Panel1Collapsed = True
|
||||||
|
'
|
||||||
|
'SplitContainer3.Panel2
|
||||||
|
'
|
||||||
|
Me.SplitContainer3.Panel2.Controls.Add(Me.Grid1)
|
||||||
|
Me.SplitContainer3.Size = New System.Drawing.Size(1226, 539)
|
||||||
|
Me.SplitContainer3.SplitterDistance = 424
|
||||||
|
Me.SplitContainer3.TabIndex = 6
|
||||||
|
'
|
||||||
|
'RichTextBox1
|
||||||
|
'
|
||||||
|
Me.RichTextBox1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.RichTextBox1.Location = New System.Drawing.Point(0, 25)
|
||||||
|
Me.RichTextBox1.Name = "RichTextBox1"
|
||||||
|
Me.RichTextBox1.Size = New System.Drawing.Size(424, 75)
|
||||||
|
Me.RichTextBox1.TabIndex = 0
|
||||||
|
Me.RichTextBox1.Text = ""
|
||||||
|
'
|
||||||
|
'ToolStrip3
|
||||||
|
'
|
||||||
|
Me.ToolStrip3.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripButton1})
|
||||||
|
Me.ToolStrip3.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.ToolStrip3.Name = "ToolStrip3"
|
||||||
|
Me.ToolStrip3.Size = New System.Drawing.Size(424, 25)
|
||||||
|
Me.ToolStrip3.TabIndex = 4
|
||||||
|
Me.ToolStrip3.Text = "ToolStrip3"
|
||||||
|
'
|
||||||
|
'ToolStripButton1
|
||||||
|
'
|
||||||
|
Me.ToolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text
|
||||||
|
Me.ToolStripButton1.Image = CType(resources.GetObject("ToolStripButton1.Image"), System.Drawing.Image)
|
||||||
|
Me.ToolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta
|
||||||
|
Me.ToolStripButton1.Name = "ToolStripButton1"
|
||||||
|
Me.ToolStripButton1.Size = New System.Drawing.Size(36, 22)
|
||||||
|
Me.ToolStripButton1.Text = "清空"
|
||||||
|
'
|
||||||
|
'Grid1
|
||||||
|
'
|
||||||
|
Me.Grid1.DefaultFont = New System.Drawing.Font("宋体", 9.0!)
|
||||||
|
Me.Grid1.DefaultRowHeight = CType(30, Short)
|
||||||
|
Me.Grid1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.Grid1.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.Grid1.MouseWheelSpeed = CType(3, Short)
|
||||||
|
Me.Grid1.Name = "Grid1"
|
||||||
|
Me.Grid1.Size = New System.Drawing.Size(1226, 539)
|
||||||
|
Me.Grid1.TabIndex = 0
|
||||||
|
'
|
||||||
|
'ToolStrip2
|
||||||
|
'
|
||||||
|
Me.ToolStrip2.Location = New System.Drawing.Point(3, 3)
|
||||||
|
Me.ToolStrip2.Name = "ToolStrip2"
|
||||||
|
Me.ToolStrip2.Size = New System.Drawing.Size(1226, 25)
|
||||||
|
Me.ToolStrip2.TabIndex = 3
|
||||||
|
Me.ToolStrip2.Text = "ToolStrip2"
|
||||||
|
'
|
||||||
|
'ToolStrip1
|
||||||
|
'
|
||||||
|
Me.ToolStrip1.Dock = System.Windows.Forms.DockStyle.Bottom
|
||||||
|
Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripLabel1, Me.ToolStripLabel2})
|
||||||
|
Me.ToolStrip1.Location = New System.Drawing.Point(3, 809)
|
||||||
|
Me.ToolStrip1.Name = "ToolStrip1"
|
||||||
|
Me.ToolStrip1.Size = New System.Drawing.Size(1226, 25)
|
||||||
|
Me.ToolStrip1.TabIndex = 0
|
||||||
|
Me.ToolStrip1.Text = "ToolStrip1"
|
||||||
|
'
|
||||||
|
'ToolStripLabel1
|
||||||
|
'
|
||||||
|
Me.ToolStripLabel1.Name = "ToolStripLabel1"
|
||||||
|
Me.ToolStripLabel1.Size = New System.Drawing.Size(92, 22)
|
||||||
|
Me.ToolStripLabel1.Text = "数据入库状态:"
|
||||||
|
'
|
||||||
|
'ToolStripLabel2
|
||||||
|
'
|
||||||
|
Me.ToolStripLabel2.AutoSize = False
|
||||||
|
Me.ToolStripLabel2.Name = "ToolStripLabel2"
|
||||||
|
Me.ToolStripLabel2.Size = New System.Drawing.Size(500, 22)
|
||||||
|
'
|
||||||
|
'TabPage2
|
||||||
|
'
|
||||||
|
Me.TabPage2.Location = New System.Drawing.Point(4, 22)
|
||||||
|
Me.TabPage2.Name = "TabPage2"
|
||||||
|
Me.TabPage2.Padding = New System.Windows.Forms.Padding(3)
|
||||||
|
Me.TabPage2.Size = New System.Drawing.Size(1232, 837)
|
||||||
|
Me.TabPage2.TabIndex = 1
|
||||||
|
Me.TabPage2.Text = "参数设置"
|
||||||
|
Me.TabPage2.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'SerialPort1
|
||||||
|
'
|
||||||
|
'
|
||||||
|
'Timer1
|
||||||
|
'
|
||||||
|
'
|
||||||
|
'CheckBox1
|
||||||
|
'
|
||||||
|
Me.CheckBox1.AutoSize = True
|
||||||
|
Me.CheckBox1.Checked = True
|
||||||
|
Me.CheckBox1.CheckState = System.Windows.Forms.CheckState.Checked
|
||||||
|
Me.CheckBox1.Location = New System.Drawing.Point(212, 17)
|
||||||
|
Me.CheckBox1.Name = "CheckBox1"
|
||||||
|
Me.CheckBox1.Size = New System.Drawing.Size(108, 16)
|
||||||
|
Me.CheckBox1.TabIndex = 73
|
||||||
|
Me.CheckBox1.Text = "是否写入数据库"
|
||||||
|
Me.CheckBox1.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'Form1
|
||||||
|
'
|
||||||
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
|
||||||
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
|
Me.ClientSize = New System.Drawing.Size(1240, 863)
|
||||||
|
Me.Controls.Add(Me.TabControl1)
|
||||||
|
Me.Name = "Form1"
|
||||||
|
Me.Text = "Form1"
|
||||||
|
Me.TabControl1.ResumeLayout(False)
|
||||||
|
Me.TabPage1.ResumeLayout(False)
|
||||||
|
Me.TabPage1.PerformLayout()
|
||||||
|
Me.SplitContainer1.Panel1.ResumeLayout(False)
|
||||||
|
Me.SplitContainer1.Panel2.ResumeLayout(False)
|
||||||
|
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
Me.SplitContainer1.ResumeLayout(False)
|
||||||
|
Me.SplitContainer2.Panel1.ResumeLayout(False)
|
||||||
|
Me.SplitContainer2.Panel2.ResumeLayout(False)
|
||||||
|
CType(Me.SplitContainer2, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
Me.SplitContainer2.ResumeLayout(False)
|
||||||
|
Me.SplitContainer4.Panel2.ResumeLayout(False)
|
||||||
|
Me.SplitContainer4.Panel2.PerformLayout()
|
||||||
|
CType(Me.SplitContainer4, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
Me.SplitContainer4.ResumeLayout(False)
|
||||||
|
Me.SplitContainer3.Panel1.ResumeLayout(False)
|
||||||
|
Me.SplitContainer3.Panel1.PerformLayout()
|
||||||
|
Me.SplitContainer3.Panel2.ResumeLayout(False)
|
||||||
|
CType(Me.SplitContainer3, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
Me.SplitContainer3.ResumeLayout(False)
|
||||||
|
Me.ToolStrip3.ResumeLayout(False)
|
||||||
|
Me.ToolStrip3.PerformLayout()
|
||||||
|
Me.ToolStrip1.ResumeLayout(False)
|
||||||
|
Me.ToolStrip1.PerformLayout()
|
||||||
|
Me.ResumeLayout(False)
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Friend WithEvents TabControl1 As TabControl
|
||||||
|
Friend WithEvents TabPage1 As TabPage
|
||||||
|
Friend WithEvents ToolStrip1 As ToolStrip
|
||||||
|
Friend WithEvents TabPage2 As TabPage
|
||||||
|
Friend WithEvents SplitContainer1 As SplitContainer
|
||||||
|
Friend WithEvents SplitContainer2 As SplitContainer
|
||||||
|
Friend WithEvents Label_Time As Label
|
||||||
|
Friend WithEvents label_Tip As Label
|
||||||
|
Friend WithEvents Text_Row As TextBox
|
||||||
|
Friend WithEvents Label1 As Label
|
||||||
|
Friend WithEvents SplitContainer3 As SplitContainer
|
||||||
|
Friend WithEvents ToolStrip2 As ToolStrip
|
||||||
|
Friend WithEvents TextBox2 As TextBox
|
||||||
|
Friend WithEvents Label2 As Label
|
||||||
|
Friend WithEvents Button1 As Button
|
||||||
|
Friend WithEvents Grid1 As FlexCell.Grid
|
||||||
|
Friend WithEvents Btn_OpenPort As Button
|
||||||
|
Friend WithEvents Cbo_Baud As ComboBox
|
||||||
|
Friend WithEvents Cbo_Port As ComboBox
|
||||||
|
Friend WithEvents SerialPort1 As IO.Ports.SerialPort
|
||||||
|
Friend WithEvents Timer1 As Timer
|
||||||
|
Friend WithEvents Button2 As Button
|
||||||
|
Friend WithEvents TextBox1 As TextBox
|
||||||
|
Friend WithEvents Label3 As Label
|
||||||
|
Friend WithEvents TextBox3 As TextBox
|
||||||
|
Friend WithEvents Label4 As Label
|
||||||
|
Friend WithEvents RichTextBox1 As RichTextBox
|
||||||
|
Friend WithEvents ToolStrip3 As ToolStrip
|
||||||
|
Friend WithEvents ToolStripButton1 As ToolStripButton
|
||||||
|
Friend WithEvents SplitContainer4 As SplitContainer
|
||||||
|
Friend WithEvents TextBox14 As TextBox
|
||||||
|
Friend WithEvents TextBox15 As TextBox
|
||||||
|
Friend WithEvents Label15 As Label
|
||||||
|
Friend WithEvents Label16 As Label
|
||||||
|
Friend WithEvents TextBox12 As TextBox
|
||||||
|
Friend WithEvents TextBox13 As TextBox
|
||||||
|
Friend WithEvents Label13 As Label
|
||||||
|
Friend WithEvents Label14 As Label
|
||||||
|
Friend WithEvents TextBox10 As TextBox
|
||||||
|
Friend WithEvents TextBox11 As TextBox
|
||||||
|
Friend WithEvents Label11 As Label
|
||||||
|
Friend WithEvents Label12 As Label
|
||||||
|
Friend WithEvents TextBox8 As TextBox
|
||||||
|
Friend WithEvents TextBox9 As TextBox
|
||||||
|
Friend WithEvents Label9 As Label
|
||||||
|
Friend WithEvents Label10 As Label
|
||||||
|
Friend WithEvents TextBox6 As TextBox
|
||||||
|
Friend WithEvents TextBox7 As TextBox
|
||||||
|
Friend WithEvents Label7 As Label
|
||||||
|
Friend WithEvents Label8 As Label
|
||||||
|
Friend WithEvents TextBox4 As TextBox
|
||||||
|
Friend WithEvents Button3 As Button
|
||||||
|
Friend WithEvents TextBox5 As TextBox
|
||||||
|
Friend WithEvents Label5 As Label
|
||||||
|
Friend WithEvents Label6 As Label
|
||||||
|
Friend WithEvents ToolStripLabel1 As ToolStripLabel
|
||||||
|
Friend WithEvents ToolStripLabel2 As ToolStripLabel
|
||||||
|
Friend WithEvents Label17 As Label
|
||||||
|
Friend WithEvents Label18 As Label
|
||||||
|
Friend WithEvents CheckBox1 As CheckBox
|
||||||
|
End Class
|
||||||
151
Form1.resx
Normal file
151
Form1.resx
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="ToolStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>673, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ToolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>353, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<data name="ToolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||||
|
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||||
|
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||||
|
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||||
|
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||||
|
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
|
||||||
|
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
|
||||||
|
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
|
||||||
|
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
|
||||||
|
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
|
||||||
|
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<metadata name="SerialPort1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>465, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>581, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
670
Form1.vb
Normal file
670
Form1.vb
Normal file
@@ -0,0 +1,670 @@
|
|||||||
|
Imports System.Data.Common
|
||||||
|
Imports System.IO
|
||||||
|
Imports System.IO.Ports
|
||||||
|
Imports System.Threading
|
||||||
|
Imports Newtonsoft.Json
|
||||||
|
|
||||||
|
Public Class Form1
|
||||||
|
|
||||||
|
'创建串口对象
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Text_Row.KeyPress, TextBox3.KeyPress, TextBox2.KeyPress, TextBox1.KeyPress
|
||||||
|
'限制TextBox1只能输入数字
|
||||||
|
e.Handled = Not $"0123456789{vbBack}".Contains(e.KeyChar) '如果要只允许输入数字,
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||||
|
inintGrid1(CInt(Text_Row.Text), (CInt(TextBox2.Text)))
|
||||||
|
Button3_Click(Nothing, Nothing)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub inintGrid1(r As Integer, c As Integer)
|
||||||
|
Grid1.NewFile()
|
||||||
|
Grid1.Rows = r * 3 + 1
|
||||||
|
Grid1.Cols = c * 2 + 1
|
||||||
|
Dim iWidth As Integer
|
||||||
|
|
||||||
|
iWidth = (Grid1.Width - 20) / (c * 2)
|
||||||
|
With Grid1
|
||||||
|
.DefaultRowHeight = 70
|
||||||
|
.Row(0).Visible = False
|
||||||
|
For j = 0 To Grid1.Cols - 1
|
||||||
|
If j = 0 Then
|
||||||
|
.Column(0).Visible = False
|
||||||
|
.Column(j).Width = 0
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
|
.Column(j).Width = iWidth
|
||||||
|
.Column(j).Alignment = FlexCell.AlignmentEnum.CenterCenter
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
End With
|
||||||
|
For i = 1 To r
|
||||||
|
For j = 1 To c
|
||||||
|
Grid1.Range(i * 3 - 2, j * 2 - 1, i * 3, j * 2).MergeCells = True
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
Grid1.Range(1, 1, Grid1.Rows - 1, Grid1.Cols - 1).FontBold = True
|
||||||
|
Grid1.Range(1, 1, Grid1.Rows - 1, Grid1.Cols - 1).FontSize = 72
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Public Sub InitGrid2(r As Integer, c As Integer)
|
||||||
|
' Grid2.NewFile()
|
||||||
|
' Grid2.Rows = r * c + 1
|
||||||
|
' Grid2.Cols = 3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'End Sub
|
||||||
|
|
||||||
|
Private Sub Cbo_Port_DropDown(sender As Object, e As EventArgs) Handles Cbo_Port.DropDown
|
||||||
|
Cbo_Port.Items.Clear()
|
||||||
|
Cbo_Port.Items.AddRange(SerialPort.GetPortNames())
|
||||||
|
End Sub
|
||||||
|
Public IsRead As Boolean = False
|
||||||
|
Public listening As Boolean = False
|
||||||
|
Private Sub Btn_OpenPort_Click(sender As Object, e As EventArgs) Handles Btn_OpenPort.Click
|
||||||
|
If Btn_OpenPort.Text = "Disconnect" Then
|
||||||
|
Btn_OpenPort.Text = "Connect"
|
||||||
|
Btn_OpenPort.BackColor = Color.Transparent
|
||||||
|
Cbo_Port.Enabled = True
|
||||||
|
Cbo_Baud.Enabled = True
|
||||||
|
Try
|
||||||
|
|
||||||
|
If SerialPort1.IsOpen Then
|
||||||
|
'判断是否有接收数据
|
||||||
|
'Isread = False
|
||||||
|
'将串口接收关联事件取消
|
||||||
|
'RemoveHandler SerialPort1.DataReceived, AddressOf SerialPort1_DataReceived
|
||||||
|
|
||||||
|
IsRead = True
|
||||||
|
While (listening)
|
||||||
|
Application.DoEvents()
|
||||||
|
Thread.Sleep(10)
|
||||||
|
End While
|
||||||
|
Thread.Sleep(10)
|
||||||
|
SerialPort1.DiscardInBuffer()
|
||||||
|
|
||||||
|
SerialPort1.Close()
|
||||||
|
|
||||||
|
IsRead = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox("关闭连接失败!")
|
||||||
|
End Try
|
||||||
|
|
||||||
|
' m_CommunicationFlow.m_Transmitter.CloseTransmitter()
|
||||||
|
Else
|
||||||
|
IsRead = False
|
||||||
|
'AddHandler SerialPort1.DataReceived, AddressOf SerialPort1_DataReceived
|
||||||
|
Btn_OpenPort.Text = "Disconnect"
|
||||||
|
Btn_OpenPort.BackColor = Color.Red
|
||||||
|
Cbo_Port.Enabled = False
|
||||||
|
Cbo_Baud.Enabled = False
|
||||||
|
'If IsNothing(m_CommunicationFlow.m_Transmitter) Then
|
||||||
|
' Tab_SerialSettings_SelectedIndexChanged(Nothing, Nothing)
|
||||||
|
'End If
|
||||||
|
'设置 SerialPort1 端口名
|
||||||
|
Try
|
||||||
|
If SerialPort1.IsOpen Then
|
||||||
|
SerialPort1.Close()
|
||||||
|
End If
|
||||||
|
SerialPort1.PortName = Cbo_Port.Text
|
||||||
|
SerialPort1.BaudRate = CInt(Cbo_Baud.Text)
|
||||||
|
SerialPort1.Open()
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox("创建连接失败!")
|
||||||
|
'setToolStripLabel2color($"sqlite创建连接失败!!!{vbCrLf }", Color.Green, RichTextBox1)
|
||||||
|
Btn_OpenPort_Click(Nothing, Nothing)
|
||||||
|
Return
|
||||||
|
End Try
|
||||||
|
|
||||||
|
|
||||||
|
'If IsNothing(SerialPort1) Then
|
||||||
|
' Return CreateSerial(m_SerialComfig)
|
||||||
|
'End If
|
||||||
|
'If Not m_Serial.IsOpen Then
|
||||||
|
' Try
|
||||||
|
' m_Serial.Open()
|
||||||
|
' Catch ex As Exception
|
||||||
|
' Return False
|
||||||
|
' End Try
|
||||||
|
|
||||||
|
'End If
|
||||||
|
'Return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'm_CommunicationFlow.m_Transmitter.OpenTransmitter()
|
||||||
|
'If m_CommunicationFlow.m_Transmitter.IsTransmitter AndAlso m_CommunicationFlow.m_Transmitter.GetTransmitterStatus Then
|
||||||
|
'Else
|
||||||
|
' MsgBox("创建连接失败!")
|
||||||
|
' Btn_OpenPort_Click(Nothing, Nothing)
|
||||||
|
' Return
|
||||||
|
'End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
''定义数据入库线程
|
||||||
|
'Private DataToSqlThread As Thread
|
||||||
|
''创建线程
|
||||||
|
'Public Sub CreateDataToSqlThread()
|
||||||
|
' DataToSqlThread = New Thread(AddressOf DataToSql)
|
||||||
|
' 'DataToSqlThread.IsBackground = True
|
||||||
|
' DataToSqlThread.Start()
|
||||||
|
'End Sub
|
||||||
|
'线程方法
|
||||||
|
'Private Sub DataToSql()
|
||||||
|
' While True
|
||||||
|
|
||||||
|
' End While
|
||||||
|
'End Sub
|
||||||
|
'队列变量
|
||||||
|
' Public DataToSqlQueue As Queue(Of Dictionary(Of String, String))
|
||||||
|
'键值对对象
|
||||||
|
Public Sqldic As Dictionary(Of String, String)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
'Text = Application.ProductName
|
||||||
|
'页面标题显示程序名称加版本号
|
||||||
|
Text = Application.ProductName & " " & Application.ProductVersion
|
||||||
|
'CheckBox1.Checked = True
|
||||||
|
Cbo_Baud.SelectedIndex = 3
|
||||||
|
recvBufferli = New List(Of Byte)()
|
||||||
|
Counter = 0
|
||||||
|
'DataToSqlQueue = New Queue(Of Dictionary(Of String, String))()
|
||||||
|
pardic = New Dictionary(Of Integer, (Integer, Integer))
|
||||||
|
Sqldic = New Dictionary(Of String, String)()
|
||||||
|
Timer1.Start()
|
||||||
|
Button1.PerformClick()
|
||||||
|
GetMeSeting()
|
||||||
|
|
||||||
|
ClearDeviceform()
|
||||||
|
' CreateDataToSqlThread()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'读取系统缓存
|
||||||
|
Public Sub GetMeSeting()
|
||||||
|
My.Settings.Reload()
|
||||||
|
If Not String.IsNullOrEmpty(My.Settings.SerialPortName) Then
|
||||||
|
Cbo_Port.Text = My.Settings.SerialPortName
|
||||||
|
' pardic = JsonConvert.DeserializeObject(Of Dictionary(Of Integer, (Integer, Integer)))(My.Settings.m_Applicationconfig)
|
||||||
|
End If
|
||||||
|
If Not String.IsNullOrEmpty(My.Settings.scope) Then
|
||||||
|
pardic = JsonConvert.DeserializeObject(Of Dictionary(Of Integer, (Integer, Integer)))(My.Settings.scope)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
'保存系统缓存
|
||||||
|
Public Sub SaveMeSeting()
|
||||||
|
My.Settings.SerialPortName = Cbo_Port.Text
|
||||||
|
My.Settings.scope = JsonConvert.SerializeObject(pardic)
|
||||||
|
My.Settings.Save()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public recvBufferli As List(Of Byte)
|
||||||
|
Private Sub SerialPort1_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
|
||||||
|
|
||||||
|
If IsRead Then Return
|
||||||
|
listening = True
|
||||||
|
|
||||||
|
Dim bytes As Integer = 0
|
||||||
|
|
||||||
|
Try
|
||||||
|
|
||||||
|
|
||||||
|
Do
|
||||||
|
bytes = SerialPort1.BytesToRead
|
||||||
|
If bytes <= 0 Then Exit Sub
|
||||||
|
'If bytes + _recvOffset >= 4096 Then
|
||||||
|
|
||||||
|
' 'ShowPortReceData(_recvBuffer)
|
||||||
|
|
||||||
|
' sp.Read(_recvBuffer, _recvOffset, 4096 - _recvOffset)
|
||||||
|
|
||||||
|
' _recvOffset = 0
|
||||||
|
'Else
|
||||||
|
' sp.Read(_recvBuffer, _recvOffset, bytes)
|
||||||
|
' _recvOffset += bytes
|
||||||
|
'End If
|
||||||
|
|
||||||
|
Dim buf(bytes - 1) As Byte
|
||||||
|
If SerialPort1.IsOpen Then
|
||||||
|
SerialPort1.Read(buf, 0, bytes)
|
||||||
|
End If
|
||||||
|
recvBufferli.AddRange(buf)
|
||||||
|
|
||||||
|
|
||||||
|
Thread.Sleep(5)
|
||||||
|
Loop While (SerialPort1.IsOpen AndAlso (SerialPort1.BytesToRead > 0))
|
||||||
|
If recvBufferli.Count > 0 Then
|
||||||
|
Dim buf(recvBufferli.Count - 1) As Byte
|
||||||
|
Array.Copy(recvBufferli.ToArray, 0, buf, 0, buf.Length)
|
||||||
|
recvBufferli.Clear()
|
||||||
|
Counter = 0
|
||||||
|
|
||||||
|
RuningLog.OutputLogsToTheControl(RichTextBox1, New RuningLogConfig($"RX:{ByteToString2(buf)}", Color.Blue), 1)
|
||||||
|
'处理接收到的数据(recvBufferli.ToArray())
|
||||||
|
ProcessRecvData(buf)
|
||||||
|
'listening = False
|
||||||
|
|
||||||
|
End If
|
||||||
|
listening = False
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.Message)
|
||||||
|
listening = False
|
||||||
|
RuningLog.OutputLogsToTheControl(RichTextBox1, New RuningLogConfig($"串口接收数据失败,原因:{ex.Message}", Color.Red), 1)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'处理接收结果
|
||||||
|
Private Sub ProcessRecvData(recvData As Byte())
|
||||||
|
'获取行数列数
|
||||||
|
Dim row As Integer = CInt(Text_Row.Text)
|
||||||
|
Dim col As Integer = CInt(TextBox2.Text)
|
||||||
|
row = row * col * 10 + 2
|
||||||
|
If recvData.Length = row Then
|
||||||
|
If recvData(0) = &HD AndAlso recvData(1) = &HA Then
|
||||||
|
|
||||||
|
ParsingCommandResponse(recvData, Grid1, RichTextBox1)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
RuningLog.OutputLogsToTheControl(RichTextBox1, New RuningLogConfig($"接收数据长度异常,接收长度{recvData.Length},实际长度{row}", Color.Red), 1)
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
'判断数据长度是否正确
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Public Counter As Integer = 0
|
||||||
|
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
|
||||||
|
'判断串口是否发开
|
||||||
|
If SerialPort1.IsOpen Then
|
||||||
|
'判断计数器是否小于10
|
||||||
|
If Counter > 20 Then '1S
|
||||||
|
If Counter > 30 Then
|
||||||
|
|
||||||
|
Dim buf() As Byte = HexStringToByteArray("AF 00 07 4B 03 01 FA")
|
||||||
|
RuningLog.OutputLogsToTheControl(RichTextBox1, New RuningLogConfig($"TX:{ByteToString2(buf)}", Color.Green), 1)
|
||||||
|
'清除发送缓存
|
||||||
|
SerialPort1.DiscardOutBuffer()
|
||||||
|
SerialPort1.Write(buf, 0, buf.Length)
|
||||||
|
Counter = 22
|
||||||
|
Else
|
||||||
|
|
||||||
|
End If
|
||||||
|
If Counter = 21 Then
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'DataToSqlQueue
|
||||||
|
|
||||||
|
''数据到达次数计数变量
|
||||||
|
'Public ReleaseCounter, TriggerCounter, Triggerindex As Integer
|
||||||
|
|
||||||
|
ReleaseCounter = 0
|
||||||
|
TriggerCounter = 0
|
||||||
|
Triggerindex = 0
|
||||||
|
If Sqldic.Count > 0 Then
|
||||||
|
If CheckBox1.Checked Then
|
||||||
|
Sqldic.Add("CreateTime", Now.ToString("yyyy-MM-dd HH:mm:ss"))
|
||||||
|
InsertDeviceform(Sqldic)
|
||||||
|
WriteTomysql(Sqldic)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Sqldic.Clear()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Counter += 1
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
|
||||||
|
Timer1.Stop()
|
||||||
|
If SerialPort1.IsOpen Then
|
||||||
|
SerialPort1.Close()
|
||||||
|
End If
|
||||||
|
'判断线程是否在运行
|
||||||
|
'If Not IsNothing(DataToSqlThread) AndAlso DataToSqlThread.ThreadState = ThreadState.Running Then
|
||||||
|
' DataToSqlThread.Abort()
|
||||||
|
'End If
|
||||||
|
|
||||||
|
SaveMeSeting()
|
||||||
|
End Sub
|
||||||
|
Public Shared Function ByteToString2(databuff() As Byte)
|
||||||
|
Dim strData As String = String.Empty
|
||||||
|
For i = 0 To databuff.Length - 1
|
||||||
|
strData &= $" {ByteToHex1(databuff(i)).PadLeft(2, "0"c)}"
|
||||||
|
Next
|
||||||
|
Return strData
|
||||||
|
End Function
|
||||||
|
Public Shared Function HexStringToByteArray(hex As String) As Byte()
|
||||||
|
|
||||||
|
Dim bytes As New List(Of Byte)
|
||||||
|
hex = hex.Replace(" ", "").Trim.ToUpper()
|
||||||
|
For i As Integer = 0 To hex.Length - 1 Step 2
|
||||||
|
Dim hexByte As String = hex.Substring(i, 2)
|
||||||
|
bytes.Add(Convert.ToByte(hexByte, 16))
|
||||||
|
Next
|
||||||
|
Return bytes.ToArray()
|
||||||
|
End Function
|
||||||
|
Public Shared Function ByteToHex1(ByVal b As Byte) As String
|
||||||
|
Return b.ToString("X2")
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
' DataToSqlQueue
|
||||||
|
|
||||||
|
'数据到达次数计数变量
|
||||||
|
Public ReleaseCounter, TriggerCounter, Triggerindex As Integer
|
||||||
|
|
||||||
|
Delegate Sub delParsingCommandResponse(recvData As Byte(), gTable As FlexCell.Grid, gRicText As RichTextBox)
|
||||||
|
Public Sub ParsingCommandResponse(recvData As Byte(), gTable As FlexCell.Grid, gRicText As RichTextBox)
|
||||||
|
|
||||||
|
If gRicText.InvokeRequired Then
|
||||||
|
Dim d As New delParsingCommandResponse(AddressOf ParsingCommandResponse)
|
||||||
|
gRicText.Invoke(d, recvData, gTable, gRicText)
|
||||||
|
Else
|
||||||
|
Dim row As Integer = CInt(Text_Row.Text)
|
||||||
|
Dim col As Integer = CInt(TextBox2.Text)
|
||||||
|
Dim lowint As Integer = CInt(TextBox3.Text)
|
||||||
|
Dim upint As Integer = CInt(TextBox1.Text)
|
||||||
|
Dim s As Short
|
||||||
|
Dim vstr As String
|
||||||
|
' row = row * col
|
||||||
|
Dim r, c, index, val As Integer
|
||||||
|
|
||||||
|
For i As Integer = 1 To row
|
||||||
|
For j As Integer = 1 To col
|
||||||
|
r = i * 3 - 2
|
||||||
|
c = j * 2 - 1
|
||||||
|
|
||||||
|
index = (i - 1) * col + j
|
||||||
|
|
||||||
|
s = recvData(1 + (index * 10 - 3))
|
||||||
|
s = s << 8
|
||||||
|
s += recvData(1 + (index * 10 - 2))
|
||||||
|
val = s 'recvData(1 + (index * 10 - 3)) * 255 + recvData(1 + (index * 10 - 2))
|
||||||
|
|
||||||
|
|
||||||
|
With gTable.Cell(r, c)
|
||||||
|
.Text = val
|
||||||
|
If recvData(1 + (index * 10)) = 1 Then
|
||||||
|
Console.WriteLine($"触发按键序号{index}:{val}{vbCrLf}{ ByteToString2(recvData)}")
|
||||||
|
If pardic(index).Item1 <= val AndAlso val <= pardic(index).Item2 Then
|
||||||
|
.BackColor = Color.Green
|
||||||
|
Else
|
||||||
|
.BackColor = Color.OrangeRed
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Triggerindex = index Then
|
||||||
|
setToolStripLabel2color2(index, Color.Black, RichTextBox1, Label18)
|
||||||
|
If TriggerCounter = 4 Then
|
||||||
|
|
||||||
|
vstr = $"key{index}_Trigger_Difference"
|
||||||
|
setToolStripLabel2color2(val, Color.Black, RichTextBox1, Label17)
|
||||||
|
If Sqldic.ContainsKey(vstr) Then
|
||||||
|
Sqldic(vstr) = val
|
||||||
|
Else
|
||||||
|
Sqldic.Add(vstr, val)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
'setToolStripLabel2color2("", Color.Black, RichTextBox1, Label17)
|
||||||
|
' TriggerCounter += 1
|
||||||
|
End If
|
||||||
|
If TriggerCounter > 10 Then
|
||||||
|
|
||||||
|
Else
|
||||||
|
TriggerCounter += 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
setToolStripLabel2color2("", Color.Black, RichTextBox1, Label18)
|
||||||
|
setToolStripLabel2color2("", Color.Black, RichTextBox1, Label17)
|
||||||
|
Triggerindex = index
|
||||||
|
TriggerCounter = 0
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
Else
|
||||||
|
.BackColor = Color.White
|
||||||
|
End If
|
||||||
|
|
||||||
|
End With
|
||||||
|
|
||||||
|
|
||||||
|
If ReleaseCounter = 6 Then
|
||||||
|
vstr = $"key{index}_Release_Difference"
|
||||||
|
|
||||||
|
If Sqldic.ContainsKey(vstr) Then
|
||||||
|
Sqldic(vstr) = val
|
||||||
|
Else
|
||||||
|
Sqldic.Add(vstr, val)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
|
||||||
|
vstr = "ClosingRemarks"
|
||||||
|
If Sqldic.ContainsKey(vstr) Then
|
||||||
|
Sqldic(vstr) = ByteToString2(recvData)
|
||||||
|
Else
|
||||||
|
Sqldic.Add(vstr, ByteToString2(recvData))
|
||||||
|
End If
|
||||||
|
If ReleaseCounter > 100 Then
|
||||||
|
Else
|
||||||
|
ReleaseCounter += 1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
|
||||||
|
RichTextBox1.Clear()
|
||||||
|
End Sub
|
||||||
|
Public pardic As Dictionary(Of Integer, (Integer, Integer))
|
||||||
|
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||||
|
pardic.Clear()
|
||||||
|
pardic.Add(1, (CInt(TextBox4.Text), CInt(TextBox5.Text)))
|
||||||
|
pardic.Add(2, (CInt(TextBox6.Text), CInt(TextBox7.Text)))
|
||||||
|
pardic.Add(3, (CInt(TextBox8.Text), CInt(TextBox9.Text)))
|
||||||
|
pardic.Add(4, (CInt(TextBox10.Text), CInt(TextBox11.Text)))
|
||||||
|
pardic.Add(5, (CInt(TextBox12.Text), CInt(TextBox13.Text)))
|
||||||
|
pardic.Add(6, (CInt(TextBox14.Text), CInt(TextBox15.Text)))
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'创建slqit
|
||||||
|
Public FileCPatrh = "C:\KeyPressTest"
|
||||||
|
Public Sqlitedbpath As String = FileCPatrh & "\SQlitedb\test.db"
|
||||||
|
Public SqliteTableName As String = "keypresstest"
|
||||||
|
Public Function ClearDeviceform() As Boolean
|
||||||
|
|
||||||
|
Dim localConn As New DbConnectionStringBuilder
|
||||||
|
localConn.Add("Data Source", Sqlitedbpath)
|
||||||
|
'localConn.Add("Password", "123456")
|
||||||
|
Dim LocalConnString = localConn.ToString()
|
||||||
|
'判断有没有文件夹
|
||||||
|
If Not Directory.Exists(FileCPatrh & "\SQlitedb\") Then
|
||||||
|
Directory.CreateDirectory(FileCPatrh & "\SQlitedb\")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim selectstr As String = $"CREATE TABLE IF NOT EXISTS `{SqliteTableName}` (
|
||||||
|
`ID` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`CreateTime` TEXT NOT NULL,
|
||||||
|
`key1_Release_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key2_Release_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key3_Release_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key4_Release_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key5_Release_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key6_Release_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key1_Trigger_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key2_Trigger_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key3_Trigger_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key4_Trigger_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key5_Trigger_Difference` TEXT DEFAULT NULL,
|
||||||
|
`key6_Trigger_Difference` TEXT DEFAULT NULL,
|
||||||
|
`ClosingRemarks` TEXT DEFAULT NULL
|
||||||
|
);"
|
||||||
|
|
||||||
|
|
||||||
|
Dim dt As DataTable
|
||||||
|
Try
|
||||||
|
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Sqlite, LocalConnString)
|
||||||
|
|
||||||
|
db.Open()
|
||||||
|
'Try
|
||||||
|
' 'Dim vselectstr = $"DELETE FROM {Tftp_Log};"
|
||||||
|
' 'db.ExecuteNonQuery(vselectstr)
|
||||||
|
'Catch ex As Exception
|
||||||
|
|
||||||
|
|
||||||
|
'End Try
|
||||||
|
dt = db.ExecuteDataTable(selectstr)
|
||||||
|
db.Close()
|
||||||
|
If IsNothing(dt) Then
|
||||||
|
MsgBox($"数据表创建失败!!!{vbCrLf }")
|
||||||
|
Return False
|
||||||
|
Else
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
|
Return True
|
||||||
|
|
||||||
|
End Using
|
||||||
|
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox($"数据表创建失败!!!{vbCrLf }原因:{vbCrLf }{ex.Message }")
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
'设置数据库状态
|
||||||
|
Delegate Sub DelegatesetToolStripLabel2color(strtext As String, bcolor As Color, gRicText As RichTextBox)
|
||||||
|
Public Sub setToolStripLabel2color(strtext As String, bcolor As Color, gRicText As RichTextBox)
|
||||||
|
If gRicText.InvokeRequired Then
|
||||||
|
Dim d As New DelegatesetToolStripLabel2color(AddressOf setToolStripLabel2color)
|
||||||
|
gRicText.Invoke(d, strtext, bcolor, gRicText)
|
||||||
|
Else
|
||||||
|
ToolStripLabel2.Text = strtext
|
||||||
|
ToolStripLabel2.BackColor = bcolor
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
Delegate Sub DelegatesetToolStripLabel2color2(strtext As String, bcolor As Color, gRicText As RichTextBox, lab As Label)
|
||||||
|
Public Sub setToolStripLabel2color2(strtext As String, bcolor As Color, gRicText As RichTextBox, lab As Label)
|
||||||
|
If gRicText.InvokeRequired Then
|
||||||
|
Dim d As New DelegatesetToolStripLabel2color(AddressOf setToolStripLabel2color)
|
||||||
|
gRicText.Invoke(d, strtext, bcolor, gRicText, lab)
|
||||||
|
Else
|
||||||
|
lab.Text = strtext
|
||||||
|
'ToolStripLabel2.BackColor = bcolor
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Public Function InsertDeviceform(dic As Dictionary(Of String, String)) As Boolean
|
||||||
|
|
||||||
|
Dim localConn As New DbConnectionStringBuilder
|
||||||
|
localConn.Add("Data Source", Sqlitedbpath)
|
||||||
|
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Sqlite, localConn.ToString())
|
||||||
|
Try
|
||||||
|
db.Open()
|
||||||
|
Dim caint = db.ExecuteNonQuery(db.CmdHelper.Insert(SqliteTableName, dic))
|
||||||
|
If caint = 0 Then
|
||||||
|
'MsgBox($"Sqlite入库失败!!!{vbCrLf }")
|
||||||
|
setToolStripLabel2color($"Sqlite入库失败!!!{vbCrLf }", Color.Red, RichTextBox1)
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
db.Close()
|
||||||
|
Catch ex As Exception
|
||||||
|
'MsgBox($"Sqlite入库失败!!!{vbCrLf }原因:{vbCrLf }{ex.Message }")
|
||||||
|
setToolStripLabel2color($"Sqlite入库失败!!!{vbCrLf }原因:{vbCrLf }{ex.Message }", Color.Red, RichTextBox1)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
|
||||||
|
' Return True
|
||||||
|
End Using
|
||||||
|
setToolStripLabel2color($"Sqlite入库成功!!!{vbCrLf }", Color.Green, RichTextBox1)
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
Public DbConnString As String = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Port=3307;Database=keypresstest;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;"
|
||||||
|
|
||||||
|
'写入mysql
|
||||||
|
Private Function WriteTomysql(dic As Dictionary(Of String, String)) As Boolean
|
||||||
|
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Mysql, DbConnString)
|
||||||
|
Try
|
||||||
|
db.Open()
|
||||||
|
Dim caint = db.ExecuteNonQuery(db.CmdHelper.Insert("Blv_keypresstest", dic))
|
||||||
|
If caint = 0 Then
|
||||||
|
'result = "Mysql入库失败!"
|
||||||
|
'MsgBox($"Mysql入库失败!!!{vbCrLf }")
|
||||||
|
setToolStripLabel2color($"Mysql入库失败!!!", Color.Red, RichTextBox1)
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
db.Close()
|
||||||
|
Catch ex As Exception
|
||||||
|
'result = $"Mysql入库失败!{ex.Message}"
|
||||||
|
'MsgBox($"Mysql入库失败!!!{vbCrLf }原因:{vbCrLf }{ex.Message }")
|
||||||
|
setToolStripLabel2color($"Mysql入库失败!!!原因:{ex.Message }", Color.Red, RichTextBox1)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
|
||||||
|
'
|
||||||
|
End Using
|
||||||
|
|
||||||
|
setToolStripLabel2color($"Mysql入库成功!!!{vbCrLf }", Color.Green, RichTextBox1)
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
'写入到表格
|
||||||
|
'Private Sub WriteToTable(dic As Dictionary(Of String, String))
|
||||||
|
' If Me.InvokeRequired = True Then
|
||||||
|
' Dim dd As New DelegateWriteToTable(AddressOf WriteToTable)
|
||||||
|
' Me.Invoke(dd, {dic})
|
||||||
|
' Else
|
||||||
|
' Grid_table.AddItem("")
|
||||||
|
' Dim con As Integer = 0
|
||||||
|
' Dim str As String = String.Empty
|
||||||
|
' For i = 1 To Grid_table.Cols - 1
|
||||||
|
' str = Grid_table.Cell(0, i).Text
|
||||||
|
' If dic.ContainsKey(str) Then
|
||||||
|
' Grid_table.Cell(Grid_table.Rows - 1, i).Text = dic(str)
|
||||||
|
' Else
|
||||||
|
' con += 1
|
||||||
|
' End If
|
||||||
|
' Next
|
||||||
|
' If dic.Item("测试结果") = "1" Then
|
||||||
|
|
||||||
|
' Grid_table.Range(Grid_table.Rows - 1, 1, Grid_table.Rows - 1, Grid_table.Cols - 1).ForeColor = Color.Green
|
||||||
|
' Grid_table.Range(Grid_table.Rows - 1, 1, Grid_table.Rows - 1, Grid_table.Cols - 1).FontBold = True
|
||||||
|
' Else
|
||||||
|
' Grid_table.Range(Grid_table.Rows - 1, 1, Grid_table.Rows - 1, Grid_table.Cols - 1).ForeColor = Color.Red
|
||||||
|
' Grid_table.Range(Grid_table.Rows - 1, 1, Grid_table.Rows - 1, Grid_table.Cols - 1).FontBold = True
|
||||||
|
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
|
||||||
|
'End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End Class
|
||||||
25
KeyPressTest.sln
Normal file
25
KeyPressTest.sln
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.32602.291
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "KeyPressTest", "KeyPressTest.vbproj", "{C060EEB2-95C5-4CB7-B3F1-AB6203D1F364}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{C060EEB2-95C5-4CB7-B3F1-AB6203D1F364}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C060EEB2-95C5-4CB7-B3F1-AB6203D1F364}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C060EEB2-95C5-4CB7-B3F1-AB6203D1F364}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C060EEB2-95C5-4CB7-B3F1-AB6203D1F364}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {BCDBB56D-95F7-4FE5-B568-868314E84D25}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
209
KeyPressTest.vbproj
Normal file
209
KeyPressTest.vbproj
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{C060EEB2-95C5-4CB7-B3F1-AB6203D1F364}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<StartupObject>KeyPressTest.My.MyApplication</StartupObject>
|
||||||
|
<RootNamespace>KeyPressTest</RootNamespace>
|
||||||
|
<AssemblyName>KeyPressTest</AssemblyName>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<MyType>WindowsForms</MyType>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<DefineDebug>true</DefineDebug>
|
||||||
|
<DefineTrace>true</DefineTrace>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DocumentationFile>KeyPressTest.xml</DocumentationFile>
|
||||||
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<DefineDebug>false</DefineDebug>
|
||||||
|
<DefineTrace>true</DefineTrace>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DocumentationFile>KeyPressTest.xml</DocumentationFile>
|
||||||
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionExplicit>On</OptionExplicit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionCompare>Binary</OptionCompare>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionStrict>Off</OptionStrict>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionInfer>On</OptionInfer>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\BouncyCastle.Cryptography.2.5.1\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="FlexCell, Version=4.7.0.0, Culture=neutral, PublicKeyToken=6f86587eb70ee309, processorArchitecture=MSIL" />
|
||||||
|
<Reference Include="Google.Protobuf, Version=3.30.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Google.Protobuf.3.30.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="K4os.Compression.LZ4, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="MySql.Data, Version=9.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\MySql.Data.9.3.0\lib\net48\MySql.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Configuration.ConfigurationManager, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Data.SQLite">
|
||||||
|
<HintPath>..\..\DataAnalysisAndViewing\DataAnalysisAndViewing\bin\Debug\System.Data.SQLite.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Management" />
|
||||||
|
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="ZstdSharp, Version=0.8.5.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\ZstdSharp.Port.0.8.5\lib\net462\ZstdSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Import Include="Microsoft.VisualBasic" />
|
||||||
|
<Import Include="System" />
|
||||||
|
<Import Include="System.Collections" />
|
||||||
|
<Import Include="System.Collections.Generic" />
|
||||||
|
<Import Include="System.Data" />
|
||||||
|
<Import Include="System.Drawing" />
|
||||||
|
<Import Include="System.Diagnostics" />
|
||||||
|
<Import Include="System.Windows.Forms" />
|
||||||
|
<Import Include="System.Linq" />
|
||||||
|
<Import Include="System.Xml.Linq" />
|
||||||
|
<Import Include="System.Threading.Tasks" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Database\Base\ColumnSchema.vb" />
|
||||||
|
<Compile Include="Database\Base\CommandHelpers.vb" />
|
||||||
|
<Compile Include="Database\Base\DatabaseData.vb" />
|
||||||
|
<Compile Include="Database\Base\DatabaseSchema.vb" />
|
||||||
|
<Compile Include="Database\Base\ForeignKeySchema.vb" />
|
||||||
|
<Compile Include="Database\Base\IndexSchema.vb" />
|
||||||
|
<Compile Include="Database\Base\InsertParams.vb" />
|
||||||
|
<Compile Include="Database\Base\SearchCondition.vb" />
|
||||||
|
<Compile Include="Database\Base\SearchParams.vb" />
|
||||||
|
<Compile Include="Database\Base\TableSchema.vb" />
|
||||||
|
<Compile Include="Database\Base\TriggerBuilder.vb" />
|
||||||
|
<Compile Include="Database\Base\TriggerSchema.vb" />
|
||||||
|
<Compile Include="Database\Base\ViewSchema.vb" />
|
||||||
|
<Compile Include="Database\DbCmdHelper.vb" />
|
||||||
|
<Compile Include="Database\DbExecutor.vb" />
|
||||||
|
<Compile Include="Database\MssqlCmdHelper.vb" />
|
||||||
|
<Compile Include="Database\Mssql\MssqlCmdHelper.vb" />
|
||||||
|
<Compile Include="Database\MysqlCmdHelper.vb" />
|
||||||
|
<Compile Include="Database\MysqlDataParam.vb" />
|
||||||
|
<Compile Include="Database\Mysql\DataParam.vb" />
|
||||||
|
<Compile Include="Database\Mysql\MysqlCmdHelper.vb" />
|
||||||
|
<Compile Include="Database\SqliteCmdHelper.vb" />
|
||||||
|
<Compile Include="Database\SqliteDataParam.vb" />
|
||||||
|
<Compile Include="Database\Sqlite\DataParam.vb" />
|
||||||
|
<Compile Include="Database\Sqlite\SqliteCmdHelper.vb" />
|
||||||
|
<Compile Include="Form1.vb">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form1.Designer.vb">
|
||||||
|
<DependentUpon>Form1.vb</DependentUpon>
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
|
<Compile Include="My Project\Application.Designer.vb">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Application.myapp</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="My Project\Resources.Designer.vb">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="My Project\Settings.Designer.vb">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="RuningLog.vb" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Form1.resx">
|
||||||
|
<DependentUpon>Form1.vb</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="My Project\Resources.resx">
|
||||||
|
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||||
|
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="My Project\Application.myapp">
|
||||||
|
<Generator>MyApplicationCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<None Include="My Project\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<CustomToolNamespace>My</CustomToolNamespace>
|
||||||
|
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
|
</Project>
|
||||||
38
My Project/Application.Designer.vb
generated
Normal file
38
My Project/Application.Designer.vb
generated
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
'------------------------------------------------------------------------------
|
||||||
|
' <auto-generated>
|
||||||
|
' This code was generated by a tool.
|
||||||
|
' Runtime Version:4.0.30319.42000
|
||||||
|
'
|
||||||
|
' Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
' the code is regenerated.
|
||||||
|
' </auto-generated>
|
||||||
|
'------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Option Strict On
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
|
|
||||||
|
Namespace My
|
||||||
|
|
||||||
|
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
|
||||||
|
' or if you encounter build errors in this file, go to the Project Designer
|
||||||
|
' (go to Project Properties or double-click the My Project node in
|
||||||
|
' Solution Explorer), and make changes on the Application tab.
|
||||||
|
'
|
||||||
|
Partial Friend Class MyApplication
|
||||||
|
|
||||||
|
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||||
|
Public Sub New()
|
||||||
|
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
|
||||||
|
Me.IsSingleInstance = false
|
||||||
|
Me.EnableVisualStyles = true
|
||||||
|
Me.SaveMySettingsOnExit = true
|
||||||
|
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||||
|
Protected Overrides Sub OnCreateMainForm()
|
||||||
|
Me.MainForm = Global.KeyPressTest.Form1
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
11
My Project/Application.myapp
Normal file
11
My Project/Application.myapp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<MySubMain>true</MySubMain>
|
||||||
|
<MainForm>Form1</MainForm>
|
||||||
|
<SingleInstance>false</SingleInstance>
|
||||||
|
<ShutdownMode>0</ShutdownMode>
|
||||||
|
<EnableVisualStyles>true</EnableVisualStyles>
|
||||||
|
<AuthenticationMode>0</AuthenticationMode>
|
||||||
|
<ApplicationType>0</ApplicationType>
|
||||||
|
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||||
|
</MyApplicationData>
|
||||||
35
My Project/AssemblyInfo.vb
Normal file
35
My Project/AssemblyInfo.vb
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
Imports System
|
||||||
|
Imports System.Reflection
|
||||||
|
Imports System.Runtime.InteropServices
|
||||||
|
|
||||||
|
' 有关程序集的一般信息由以下
|
||||||
|
' 控制。更改这些特性值可修改
|
||||||
|
' 与程序集关联的信息。
|
||||||
|
|
||||||
|
'查看程序集特性的值
|
||||||
|
|
||||||
|
<Assembly: AssemblyTitle("KeyPressTest")>
|
||||||
|
<Assembly: AssemblyDescription("")>
|
||||||
|
<Assembly: AssemblyCompany("")>
|
||||||
|
<Assembly: AssemblyProduct("KeyPressTest")>
|
||||||
|
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||||
|
<Assembly: AssemblyTrademark("")>
|
||||||
|
|
||||||
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
|
'如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID
|
||||||
|
<Assembly: Guid("9993bf62-bf79-44c4-a792-5d2673df059c")>
|
||||||
|
|
||||||
|
' 程序集的版本信息由下列四个值组成:
|
||||||
|
'
|
||||||
|
' 主版本
|
||||||
|
' 次版本
|
||||||
|
' 生成号
|
||||||
|
' 修订号
|
||||||
|
'
|
||||||
|
'可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
|
'通过使用 "*",如下所示:
|
||||||
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
|
<Assembly: AssemblyVersion("1.0.0.2")>
|
||||||
|
<Assembly: AssemblyFileVersion("1.0.0.2")>
|
||||||
62
My Project/Resources.Designer.vb
generated
Normal file
62
My Project/Resources.Designer.vb
generated
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
'------------------------------------------------------------------------------
|
||||||
|
' <auto-generated>
|
||||||
|
' This code was generated by a tool.
|
||||||
|
' Runtime Version:4.0.30319.42000
|
||||||
|
'
|
||||||
|
' Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
' the code is regenerated.
|
||||||
|
' </auto-generated>
|
||||||
|
'------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Option Strict On
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
|
|
||||||
|
Namespace My.Resources
|
||||||
|
|
||||||
|
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
'class via a tool like ResGen or Visual Studio.
|
||||||
|
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
'with the /str option, or rebuild your VS project.
|
||||||
|
'''<summary>
|
||||||
|
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
'''</summary>
|
||||||
|
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||||
|
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||||
|
Friend Module Resources
|
||||||
|
|
||||||
|
Private resourceMan As Global.System.Resources.ResourceManager
|
||||||
|
|
||||||
|
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Returns the cached ResourceManager instance used by this class.
|
||||||
|
'''</summary>
|
||||||
|
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||||
|
Get
|
||||||
|
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||||
|
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("KeyPressTest.Resources", GetType(Resources).Assembly)
|
||||||
|
resourceMan = temp
|
||||||
|
End If
|
||||||
|
Return resourceMan
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Overrides the current thread's CurrentUICulture property for all
|
||||||
|
''' resource lookups using this strongly typed resource class.
|
||||||
|
'''</summary>
|
||||||
|
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||||
|
Get
|
||||||
|
Return resourceCulture
|
||||||
|
End Get
|
||||||
|
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||||
|
resourceCulture = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
End Module
|
||||||
|
End Namespace
|
||||||
117
My Project/Resources.resx
Normal file
117
My Project/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
97
My Project/Settings.Designer.vb
generated
Normal file
97
My Project/Settings.Designer.vb
generated
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
'------------------------------------------------------------------------------
|
||||||
|
' <auto-generated>
|
||||||
|
' 此代码由工具生成。
|
||||||
|
' 运行时版本:4.0.30319.42000
|
||||||
|
'
|
||||||
|
' 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
' 重新生成代码,这些更改将会丢失。
|
||||||
|
' </auto-generated>
|
||||||
|
'------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Option Strict On
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
|
|
||||||
|
Namespace My
|
||||||
|
|
||||||
|
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||||
|
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0"), _
|
||||||
|
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Partial Friend NotInheritable Class MySettings
|
||||||
|
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||||
|
|
||||||
|
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||||
|
|
||||||
|
#Region "My.Settings 自动保存功能"
|
||||||
|
#If _MyType = "WindowsForms" Then
|
||||||
|
Private Shared addedHandler As Boolean
|
||||||
|
|
||||||
|
Private Shared addedHandlerLockObject As New Object
|
||||||
|
|
||||||
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||||
|
If My.Application.SaveMySettingsOnExit Then
|
||||||
|
My.Settings.Save()
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
#End If
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
Public Shared ReadOnly Property [Default]() As MySettings
|
||||||
|
Get
|
||||||
|
|
||||||
|
#If _MyType = "WindowsForms" Then
|
||||||
|
If Not addedHandler Then
|
||||||
|
SyncLock addedHandlerLockObject
|
||||||
|
If Not addedHandler Then
|
||||||
|
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||||
|
addedHandler = True
|
||||||
|
End If
|
||||||
|
End SyncLock
|
||||||
|
End If
|
||||||
|
#End If
|
||||||
|
Return defaultInstance
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||||
|
Public Property SerialPortName() As String
|
||||||
|
Get
|
||||||
|
Return CType(Me("SerialPortName"),String)
|
||||||
|
End Get
|
||||||
|
Set
|
||||||
|
Me("SerialPortName") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||||
|
Public Property scope() As String
|
||||||
|
Get
|
||||||
|
Return CType(Me("scope"),String)
|
||||||
|
End Get
|
||||||
|
Set
|
||||||
|
Me("scope") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
|
|
||||||
|
Namespace My
|
||||||
|
|
||||||
|
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||||
|
Friend Module MySettingsProperty
|
||||||
|
|
||||||
|
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||||
|
Friend ReadOnly Property Settings() As Global.KeyPressTest.My.MySettings
|
||||||
|
Get
|
||||||
|
Return Global.KeyPressTest.My.MySettings.Default
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
End Module
|
||||||
|
End Namespace
|
||||||
12
My Project/Settings.settings
Normal file
12
My Project/Settings.settings
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
|
||||||
|
<Profiles />
|
||||||
|
<Settings>
|
||||||
|
<Setting Name="SerialPortName" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="scope" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
</Settings>
|
||||||
|
</SettingsFile>
|
||||||
103
RuningLog.vb
Normal file
103
RuningLog.vb
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
Public Class RuningLog
|
||||||
|
|
||||||
|
|
||||||
|
Delegate Function Deleg_OutputLogsToTheControl(c As Control, config As RuningLogConfig, Controltype As Integer) As Boolean
|
||||||
|
'输出日志到控件
|
||||||
|
''' <summary>
|
||||||
|
''' ''输出日志到控件
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="c">控件 </param>
|
||||||
|
''' <param name="config">日志</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Shared Function OutputLogsToTheControl(c As Control, config As RuningLogConfig, Controltype As Integer) As Boolean
|
||||||
|
Try
|
||||||
|
If c.InvokeRequired Then
|
||||||
|
Dim dev As New Deleg_OutputLogsToTheControl(AddressOf OutputLogsToTheControl)
|
||||||
|
c.Invoke(dev, New Object() {c, config, Controltype})
|
||||||
|
Else
|
||||||
|
If Controltype = 1 Then
|
||||||
|
Dim nc As RichTextBox = c
|
||||||
|
'获取富文本字符串末端位置
|
||||||
|
Dim index As Integer = nc.TextLength
|
||||||
|
Dim strtxt = AddTimeStamps(config.logstr)
|
||||||
|
'设置光标位置
|
||||||
|
nc.SelectionStart = index
|
||||||
|
'添加文本
|
||||||
|
nc.AppendText(strtxt)
|
||||||
|
'设置选择区域
|
||||||
|
nc.Select(index, strtxt.Length)
|
||||||
|
'设置选择区域颜色
|
||||||
|
nc.SelectionColor = config.logstrColor
|
||||||
|
'设置选择区域字体
|
||||||
|
nc.SelectionFont = config.logstrFont
|
||||||
|
'取消选中区域
|
||||||
|
nc.DeselectAll()
|
||||||
|
Else
|
||||||
|
c.Text = AddTimeStamps(config.logstr)
|
||||||
|
c.ForeColor = config.logstrColor
|
||||||
|
c.Font = config.logstrFont
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
|
||||||
|
End Try
|
||||||
|
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
'字符串附加时间戳
|
||||||
|
Public Shared Function AddTimeStamps(str As String) As String
|
||||||
|
Return Now.ToString("yyyy-MM-dd HH:mm:ss") & " " & str & vbCrLf
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End Class
|
||||||
|
Public Class RuningLogConfig
|
||||||
|
'日志信息
|
||||||
|
Public logstr As String
|
||||||
|
'日志信息颜色
|
||||||
|
Public logstrColor As Color
|
||||||
|
'日志信息字体
|
||||||
|
Public logstrFont As Font
|
||||||
|
'日志信息字体大小
|
||||||
|
'Public logstrFontSize As Integer
|
||||||
|
''日志信息字体粗细
|
||||||
|
'Public logstrFontBold As Boolean
|
||||||
|
''日志信息字体斜体
|
||||||
|
'Public logstrFontItalic As Boolean
|
||||||
|
''日志信息字体下划线
|
||||||
|
'Public logstrFontUnderline As Boolean
|
||||||
|
''日志信息字体删除线
|
||||||
|
'Public logstrFontStrikeout As Boolean
|
||||||
|
''日志信息字体对齐方式
|
||||||
|
'Public logstrFontAlign As StringAlignment
|
||||||
|
'日志信息字体背景色
|
||||||
|
Public logstrFontBackColor As Color
|
||||||
|
''' <summary>
|
||||||
|
''' 文本、颜色、Font
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="args"></param>
|
||||||
|
Sub New(ParamArray args() As Object)
|
||||||
|
If args.Length > 0 Then
|
||||||
|
logstr = args(0).ToString
|
||||||
|
If args.Length > 1 Then
|
||||||
|
logstrColor = args(1)
|
||||||
|
If args.Length > 2 Then
|
||||||
|
logstrFont = args(2)
|
||||||
|
Else
|
||||||
|
logstrFont = New Font("宋体", 8)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
logstrColor = Color.Black
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
logstr = "输空文本"
|
||||||
|
logstrColor = Color.Black
|
||||||
|
logstrFont = New Font("宋体", 12)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
' <autogenerated/>
|
||||||
|
Option Strict Off
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
|
Imports System
|
||||||
|
Imports System.Reflection
|
||||||
|
<Assembly: Global.System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName:=".NET Framework 4.8")>
|
||||||
BIN
obj/Debug/DesignTimeResolveAssemblyReferences.cache
Normal file
BIN
obj/Debug/DesignTimeResolveAssemblyReferences.cache
Normal file
Binary file not shown.
BIN
obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Normal file
BIN
obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Normal file
Binary file not shown.
BIN
obj/Debug/KeyPressTest.Form1.resources
Normal file
BIN
obj/Debug/KeyPressTest.Form1.resources
Normal file
Binary file not shown.
BIN
obj/Debug/KeyPressTest.Resources.resources
Normal file
BIN
obj/Debug/KeyPressTest.Resources.resources
Normal file
Binary file not shown.
BIN
obj/Debug/KeyPressTest.exe
Normal file
BIN
obj/Debug/KeyPressTest.exe
Normal file
Binary file not shown.
BIN
obj/Debug/KeyPressTest.pdb
Normal file
BIN
obj/Debug/KeyPressTest.pdb
Normal file
Binary file not shown.
BIN
obj/Debug/KeyPressTest.vbproj.AssemblyReference.cache
Normal file
BIN
obj/Debug/KeyPressTest.vbproj.AssemblyReference.cache
Normal file
Binary file not shown.
0
obj/Debug/KeyPressTest.vbproj.CopyComplete
Normal file
0
obj/Debug/KeyPressTest.vbproj.CopyComplete
Normal file
1
obj/Debug/KeyPressTest.vbproj.CoreCompileInputs.cache
Normal file
1
obj/Debug/KeyPressTest.vbproj.CoreCompileInputs.cache
Normal file
@@ -0,0 +1 @@
|
|||||||
|
2dd643da2e46897e7267460d53ac27d0c358b31b
|
||||||
49
obj/Debug/KeyPressTest.vbproj.FileListAbsolute.txt
Normal file
49
obj/Debug/KeyPressTest.vbproj.FileListAbsolute.txt
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\KeyPressTest.exe.config
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\KeyPressTest.exe
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\KeyPressTest.pdb
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\KeyPressTest.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\FlexCell.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\obj\Debug\KeyPressTest.vbproj.AssemblyReference.cache
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\obj\Debug\KeyPressTest.Form1.resources
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\obj\Debug\KeyPressTest.Resources.resources
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\obj\Debug\KeyPressTest.vbproj.GenerateResource.cache
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\obj\Debug\KeyPressTest.vbproj.CoreCompileInputs.cache
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\obj\Debug\KeyPressTest.vbproj.CopyComplete
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\obj\Debug\KeyPressTest.exe
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\obj\Debug\KeyPressTest.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\obj\Debug\KeyPressTest.pdb
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\BouncyCastle.Cryptography.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\Google.Protobuf.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\K4os.Compression.LZ4.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\K4os.Compression.LZ4.Streams.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\K4os.Hash.xxHash.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\Microsoft.Bcl.AsyncInterfaces.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\MySql.Data.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\Newtonsoft.Json.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Buffers.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Configuration.ConfigurationManager.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Data.SQLite.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Diagnostics.DiagnosticSource.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.IO.Pipelines.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Memory.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Numerics.Vectors.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Threading.Tasks.Extensions.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\ZstdSharp.dll
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\BouncyCastle.Cryptography.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\Google.Protobuf.pdb
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\Google.Protobuf.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\K4os.Compression.LZ4.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\K4os.Compression.LZ4.Streams.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\K4os.Hash.xxHash.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\Microsoft.Bcl.AsyncInterfaces.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\MySql.Data.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\Newtonsoft.Json.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Buffers.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Configuration.ConfigurationManager.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Diagnostics.DiagnosticSource.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.IO.Pipelines.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Memory.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Numerics.Vectors.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml
|
||||||
|
E:\Sync\KeyPressTest\KeyPressTest\bin\Debug\System.Threading.Tasks.Extensions.xml
|
||||||
BIN
obj/Debug/KeyPressTest.vbproj.GenerateResource.cache
Normal file
BIN
obj/Debug/KeyPressTest.vbproj.GenerateResource.cache
Normal file
Binary file not shown.
1190
obj/Debug/KeyPressTest.xml
Normal file
1190
obj/Debug/KeyPressTest.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
obj/Debug/TempPE/My Project.Resources.Designer.vb.dll
Normal file
BIN
obj/Debug/TempPE/My Project.Resources.Designer.vb.dll
Normal file
Binary file not shown.
20
packages.config
Normal file
20
packages.config
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="BouncyCastle.Cryptography" version="2.5.1" targetFramework="net48" />
|
||||||
|
<package id="Google.Protobuf" version="3.30.0" targetFramework="net48" />
|
||||||
|
<package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net48" />
|
||||||
|
<package id="K4os.Compression.LZ4.Streams" version="1.3.8" targetFramework="net48" />
|
||||||
|
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net48" />
|
||||||
|
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net48" />
|
||||||
|
<package id="MySql.Data" version="9.3.0" targetFramework="net48" />
|
||||||
|
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||||
|
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
|
||||||
|
<package id="System.Configuration.ConfigurationManager" version="8.0.0" targetFramework="net48" />
|
||||||
|
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net48" />
|
||||||
|
<package id="System.IO.Pipelines" version="5.0.2" targetFramework="net48" />
|
||||||
|
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
|
||||||
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
|
||||||
|
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
|
||||||
|
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
|
||||||
|
<package id="ZstdSharp.Port" version="0.8.5" targetFramework="net48" />
|
||||||
|
</packages>
|
||||||
BIN
packages/BouncyCastle.Cryptography.2.5.1/.signature.p7s
vendored
Normal file
BIN
packages/BouncyCastle.Cryptography.2.5.1/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
packages/BouncyCastle.Cryptography.2.5.1/BouncyCastle.Cryptography.2.5.1.nupkg
vendored
Normal file
BIN
packages/BouncyCastle.Cryptography.2.5.1/BouncyCastle.Cryptography.2.5.1.nupkg
vendored
Normal file
Binary file not shown.
13
packages/BouncyCastle.Cryptography.2.5.1/LICENSE.md
vendored
Normal file
13
packages/BouncyCastle.Cryptography.2.5.1/LICENSE.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
Copyright (c) 2000-2024 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org).
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
|
sub license, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions: The above copyright notice and this
|
||||||
|
permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||||
|
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||||
|
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**
|
||||||
45
packages/BouncyCastle.Cryptography.2.5.1/README.md
vendored
Normal file
45
packages/BouncyCastle.Cryptography.2.5.1/README.md
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# The Bouncy Castle Cryptography Library For .NET
|
||||||
|
[](https://www.nuget.org/packages/BouncyCastle.Cryptography) [](https://www.nuget.org/packages/BouncyCastle.Cryptography)
|
||||||
|
|
||||||
|
The Bouncy Castle Cryptography library is a .NET implementation of cryptographic algorithms and protocols. It was developed by the Legion of the Bouncy Castle, a registered Australian Charity, with a little help! The Legion, and the latest goings on with this package, can be found at [https://www.bouncycastle.org](https://www.bouncycastle.org).
|
||||||
|
|
||||||
|
In addition to providing basic cryptography algorithms, the package also provides support for CMS, OpenPGP, (D)TLS, TSP, X.509 certificate generation and more. The package also includes implementations of the following NIST Post-Quantum Cryptography Standardization algorithms: CRYSTALS-Dilithium, CRYSTALS-Kyber, Falcon, SPHINCS+, Classic McEliece, FrodoKEM, NTRU, NTRU Prime, Picnic, Saber, BIKE, and SIKE. These should all be considered EXPERIMENTAL and subject to change or removal. SIKE in particular is already slated for removal and should be used for research purposes only.
|
||||||
|
|
||||||
|
The Legion also gratefully acknowledges the contributions made to this package by others (see [here](https://www.bouncycastle.org/csharp/contributors.html) for the current list). If you would like to contribute to our efforts please feel free to get in touch with us or visit our [donations page](https://www.bouncycastle.org/donate), sponsor some specific work, or purchase a [support contract](https://www.keyfactor.com/platform/bouncy-castle-support/).
|
||||||
|
|
||||||
|
Except where otherwise stated, this software is distributed under a license based on the MIT X Consortium license. To view the license, [see here](https://www.bouncycastle.org/licence.html). This software includes a modified Bzip2 library, which is licensed under the [Apache Software License, Version 2.0](http://www.apache.org/licenses/).
|
||||||
|
|
||||||
|
**Note**: This source tree is not the FIPS version of the APIs - if you are interested in our FIPS version please visit us [here](https://www.bouncycastle.org/fips-csharp) or contact us directly at [office@bouncycastle.org](mailto:office@bouncycastle.org).
|
||||||
|
|
||||||
|
## Installing BouncyCastle
|
||||||
|
You should install [BouncyCastle with NuGet:](https://www.nuget.org/packages/BouncyCastle.Cryptography)
|
||||||
|
|
||||||
|
Install-Package BouncyCastle.Cryptography
|
||||||
|
|
||||||
|
Or via the .NET Core command line interface:
|
||||||
|
|
||||||
|
dotnet add package BouncyCastle.Cryptography
|
||||||
|
|
||||||
|
Either commands, from Package Manager Console or .NET Core CLI, will download and install BouncyCastle.Cryptography.
|
||||||
|
|
||||||
|
|
||||||
|
## Mailing Lists
|
||||||
|
|
||||||
|
For those who are interested, there are 2 mailing lists for participation in this project. To subscribe use the links below and include the word subscribe in the message body. (To unsubscribe, replace **subscribe** with **unsubscribe** in the message body)
|
||||||
|
|
||||||
|
* [announce-crypto-csharp-request@bouncycastle.org](mailto:announce-crypto-csharp-request@bouncycastle.org)
|
||||||
|
This mailing list is for new release announcements only, general subscribers cannot post to it.
|
||||||
|
* [dev-crypto-csharp-request@bouncycastle.org](mailto:dev-crypto-csharp-request@bouncycastle.org)
|
||||||
|
This mailing list is for discussion of development of the package. This includes bugs, comments, requests for enhancements, questions about use or operation.
|
||||||
|
|
||||||
|
**NOTE:** You need to be subscribed to send mail to the above mailing list.
|
||||||
|
|
||||||
|
## Feedback
|
||||||
|
|
||||||
|
If you want to provide feedback directly to the members of **The Legion** then please use [feedback-crypto@bouncycastle.org](mailto:feedback-crypto@bouncycastle.org). If you want to help this project survive please consider [donating](https://www.bouncycastle.org/donate).
|
||||||
|
|
||||||
|
For bug reporting/requests you can report issues on [github](https://github.com/bcgit/bc-csharp), or via [feedback-crypto@bouncycastle.org](mailto:feedback-crypto@bouncycastle.org) if required. We will accept pull requests based on this repository as well, but only on the basis that any code included may be distributed under the [Bouncy Castle License](https://www.bouncycastle.org/licence.html).
|
||||||
|
|
||||||
|
## Finally
|
||||||
|
|
||||||
|
Enjoy!
|
||||||
BIN
packages/BouncyCastle.Cryptography.2.5.1/lib/net461/BouncyCastle.Cryptography.dll
vendored
Normal file
BIN
packages/BouncyCastle.Cryptography.2.5.1/lib/net461/BouncyCastle.Cryptography.dll
vendored
Normal file
Binary file not shown.
30259
packages/BouncyCastle.Cryptography.2.5.1/lib/net461/BouncyCastle.Cryptography.xml
vendored
Normal file
30259
packages/BouncyCastle.Cryptography.2.5.1/lib/net461/BouncyCastle.Cryptography.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/BouncyCastle.Cryptography.2.5.1/lib/net6.0/BouncyCastle.Cryptography.dll
vendored
Normal file
BIN
packages/BouncyCastle.Cryptography.2.5.1/lib/net6.0/BouncyCastle.Cryptography.dll
vendored
Normal file
Binary file not shown.
30381
packages/BouncyCastle.Cryptography.2.5.1/lib/net6.0/BouncyCastle.Cryptography.xml
vendored
Normal file
30381
packages/BouncyCastle.Cryptography.2.5.1/lib/net6.0/BouncyCastle.Cryptography.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/BouncyCastle.Cryptography.2.5.1/lib/netstandard2.0/BouncyCastle.Cryptography.dll
vendored
Normal file
BIN
packages/BouncyCastle.Cryptography.2.5.1/lib/netstandard2.0/BouncyCastle.Cryptography.dll
vendored
Normal file
Binary file not shown.
30259
packages/BouncyCastle.Cryptography.2.5.1/lib/netstandard2.0/BouncyCastle.Cryptography.xml
vendored
Normal file
30259
packages/BouncyCastle.Cryptography.2.5.1/lib/netstandard2.0/BouncyCastle.Cryptography.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/BouncyCastle.Cryptography.2.5.1/packageIcon.png
vendored
Normal file
BIN
packages/BouncyCastle.Cryptography.2.5.1/packageIcon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
BIN
packages/Google.Protobuf.3.30.0/.signature.p7s
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
packages/Google.Protobuf.3.30.0/Google.Protobuf.3.30.0.nupkg
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/Google.Protobuf.3.30.0.nupkg
vendored
Normal file
Binary file not shown.
BIN
packages/Google.Protobuf.3.30.0/lib/net45/Google.Protobuf.dll
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/lib/net45/Google.Protobuf.dll
vendored
Normal file
Binary file not shown.
BIN
packages/Google.Protobuf.3.30.0/lib/net45/Google.Protobuf.pdb
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/lib/net45/Google.Protobuf.pdb
vendored
Normal file
Binary file not shown.
11896
packages/Google.Protobuf.3.30.0/lib/net45/Google.Protobuf.xml
vendored
Normal file
11896
packages/Google.Protobuf.3.30.0/lib/net45/Google.Protobuf.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Google.Protobuf.3.30.0/lib/net5.0/Google.Protobuf.dll
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/lib/net5.0/Google.Protobuf.dll
vendored
Normal file
Binary file not shown.
BIN
packages/Google.Protobuf.3.30.0/lib/net5.0/Google.Protobuf.pdb
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/lib/net5.0/Google.Protobuf.pdb
vendored
Normal file
Binary file not shown.
11683
packages/Google.Protobuf.3.30.0/lib/net5.0/Google.Protobuf.xml
vendored
Normal file
11683
packages/Google.Protobuf.3.30.0/lib/net5.0/Google.Protobuf.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Google.Protobuf.3.30.0/lib/netstandard1.1/Google.Protobuf.dll
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/lib/netstandard1.1/Google.Protobuf.dll
vendored
Normal file
Binary file not shown.
BIN
packages/Google.Protobuf.3.30.0/lib/netstandard1.1/Google.Protobuf.pdb
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/lib/netstandard1.1/Google.Protobuf.pdb
vendored
Normal file
Binary file not shown.
11896
packages/Google.Protobuf.3.30.0/lib/netstandard1.1/Google.Protobuf.xml
vendored
Normal file
11896
packages/Google.Protobuf.3.30.0/lib/netstandard1.1/Google.Protobuf.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Google.Protobuf.3.30.0/lib/netstandard2.0/Google.Protobuf.dll
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/lib/netstandard2.0/Google.Protobuf.dll
vendored
Normal file
Binary file not shown.
BIN
packages/Google.Protobuf.3.30.0/lib/netstandard2.0/Google.Protobuf.pdb
vendored
Normal file
BIN
packages/Google.Protobuf.3.30.0/lib/netstandard2.0/Google.Protobuf.pdb
vendored
Normal file
Binary file not shown.
11896
packages/Google.Protobuf.3.30.0/lib/netstandard2.0/Google.Protobuf.xml
vendored
Normal file
11896
packages/Google.Protobuf.3.30.0/lib/netstandard2.0/Google.Protobuf.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/K4os.Compression.LZ4.1.3.8/.signature.p7s
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.1.3.8/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
packages/K4os.Compression.LZ4.1.3.8/K4os.Compression.LZ4.1.3.8.nupkg
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.1.3.8/K4os.Compression.LZ4.1.3.8.nupkg
vendored
Normal file
Binary file not shown.
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/net462/K4os.Compression.LZ4.dll
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/net462/K4os.Compression.LZ4.dll
vendored
Normal file
Binary file not shown.
1673
packages/K4os.Compression.LZ4.1.3.8/lib/net462/K4os.Compression.LZ4.xml
vendored
Normal file
1673
packages/K4os.Compression.LZ4.1.3.8/lib/net462/K4os.Compression.LZ4.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/net5.0/K4os.Compression.LZ4.dll
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/net5.0/K4os.Compression.LZ4.dll
vendored
Normal file
Binary file not shown.
1402
packages/K4os.Compression.LZ4.1.3.8/lib/net5.0/K4os.Compression.LZ4.xml
vendored
Normal file
1402
packages/K4os.Compression.LZ4.1.3.8/lib/net5.0/K4os.Compression.LZ4.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/net6.0/K4os.Compression.LZ4.dll
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/net6.0/K4os.Compression.LZ4.dll
vendored
Normal file
Binary file not shown.
1351
packages/K4os.Compression.LZ4.1.3.8/lib/net6.0/K4os.Compression.LZ4.xml
vendored
Normal file
1351
packages/K4os.Compression.LZ4.1.3.8/lib/net6.0/K4os.Compression.LZ4.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/netstandard2.0/K4os.Compression.LZ4.dll
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/netstandard2.0/K4os.Compression.LZ4.dll
vendored
Normal file
Binary file not shown.
1727
packages/K4os.Compression.LZ4.1.3.8/lib/netstandard2.0/K4os.Compression.LZ4.xml
vendored
Normal file
1727
packages/K4os.Compression.LZ4.1.3.8/lib/netstandard2.0/K4os.Compression.LZ4.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/netstandard2.1/K4os.Compression.LZ4.dll
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.1.3.8/lib/netstandard2.1/K4os.Compression.LZ4.dll
vendored
Normal file
Binary file not shown.
1503
packages/K4os.Compression.LZ4.1.3.8/lib/netstandard2.1/K4os.Compression.LZ4.xml
vendored
Normal file
1503
packages/K4os.Compression.LZ4.1.3.8/lib/netstandard2.1/K4os.Compression.LZ4.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/.signature.p7s
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/K4os.Compression.LZ4.Streams.1.3.8.nupkg
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/K4os.Compression.LZ4.Streams.1.3.8.nupkg
vendored
Normal file
Binary file not shown.
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net462/K4os.Compression.LZ4.Streams.dll
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net462/K4os.Compression.LZ4.Streams.dll
vendored
Normal file
Binary file not shown.
2072
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net462/K4os.Compression.LZ4.Streams.xml
vendored
Normal file
2072
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net462/K4os.Compression.LZ4.Streams.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net5.0/K4os.Compression.LZ4.Streams.dll
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net5.0/K4os.Compression.LZ4.Streams.dll
vendored
Normal file
Binary file not shown.
1871
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net5.0/K4os.Compression.LZ4.Streams.xml
vendored
Normal file
1871
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net5.0/K4os.Compression.LZ4.Streams.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net6.0/K4os.Compression.LZ4.Streams.dll
vendored
Normal file
BIN
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net6.0/K4os.Compression.LZ4.Streams.dll
vendored
Normal file
Binary file not shown.
1820
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net6.0/K4os.Compression.LZ4.Streams.xml
vendored
Normal file
1820
packages/K4os.Compression.LZ4.Streams.1.3.8/lib/net6.0/K4os.Compression.LZ4.Streams.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user