初始化提交

仓库转移到Gitea,初始化提交,可能丢失以前的git版本日志
This commit is contained in:
2025-11-27 16:41:05 +08:00
commit 027d0f8024
663 changed files with 171319 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -0,0 +1,250 @@
<?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>{D0702D4A-EA29-4F12-815A-950BE4C55B38}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>AUTS_SeviceControler.My.MyApplication</StartupObject>
<RootNamespace>AUTS_SeviceControler</RootNamespace>
<AssemblyName>AUTS_SeviceControler</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</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>AUTS_SeviceControler.xml</DocumentationFile>
<NoWarn>
</NoWarn>
<WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
</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>AUTS_SeviceControler.xml</DocumentationFile>
<NoWarn>
</NoWarn>
<WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>On</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>Off</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>AUTS.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="FlexCell, Version=4.7.0.0, Culture=neutral, PublicKeyToken=6f86587eb70ee309, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\FlexCell Technologies\FlexCell.NET4\bin\FlexCell.dll</HintPath>
</Reference>
<Reference Include="FluentFTP">
<HintPath>..\AUTS_UpdateService\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.CodeDom, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.CodeDom.6.0.0\lib\net461\System.CodeDom.dll</HintPath>
</Reference>
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Numerics" />
<Reference Include="System.ServiceProcess" />
<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" />
</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="ApplicationEvents.vb" />
<Compile Include="CheckSum.vb" />
<Compile Include="FrmAddTask.Designer.vb">
<DependentUpon>FrmAddTask.vb</DependentUpon>
</Compile>
<Compile Include="FrmAddTask.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmListenTasks.Designer.vb">
<DependentUpon>FrmListenTasks.vb</DependentUpon>
</Compile>
<Compile Include="FrmListenTasks.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.vb">
<DependentUpon>FrmMain.vb</DependentUpon>
</Compile>
<Compile Include="FrmMain.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmSyncTasks.Designer.vb">
<DependentUpon>FrmSyncTasks.vb</DependentUpon>
</Compile>
<Compile Include="FrmSyncTasks.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmTasksDbType.Designer.vb">
<DependentUpon>FrmTasksDbType.vb</DependentUpon>
</Compile>
<Compile Include="FrmTasksDbType.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmUpdateConfig.Designer.vb">
<DependentUpon>FrmUpdateConfig.vb</DependentUpon>
</Compile>
<Compile Include="FrmUpdateConfig.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="IDataPacket.vb" />
<Compile Include="ITaskForm.vb" />
<Compile Include="License.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</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="ServiceRegister.vb" />
<Compile Include="TaskForms.vb" />
<Compile Include="UpdatePackageInfo.vb" />
<Compile Include="UtsService.vb" />
<Compile Include="UtsWebPacket.vb" />
<Compile Include="WinService.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="FrmAddTask.resx">
<DependentUpon>FrmAddTask.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmListenTasks.resx">
<DependentUpon>FrmListenTasks.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmSyncTasks.resx">
<DependentUpon>FrmSyncTasks.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmTasksDbType.resx">
<DependentUpon>FrmTasksDbType.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmUpdateConfig.resx">
<DependentUpon>FrmUpdateConfig.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\app.manifest" />
<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>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="AUTS.ico" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\UTS_Core\UTS_Core.vbproj">
<Project>{33C6456C-F00D-41AC-A6FB-DB0601495C6A}</Project>
<Name>UTS_Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
</dependentAssembly>
<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>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.30.1.0" newVersion="3.30.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,10 @@
Namespace My
' 以下事件可用于 MyApplication:
' Startup:应用程序启动时在创建启动窗体之前引发。
' Shutdown:在关闭所有应用程序窗体后引发。如果应用程序非正常终止,则不会引发此事件。
' UnhandledException:在应用程序遇到未经处理的异常时引发。
' StartupNextInstance:在启动单实例应用程序且应用程序已处于活动状态时引发。
' NetworkAvailabilityChanged:在连接或断开网络连接时引发。
Partial Friend Class MyApplication
End Class
End Namespace

View File

@@ -0,0 +1,18 @@
Public Class CheckSum
''' <summary>
''' 获取数据包的和校验
''' </summary>
''' <param name="packet">数据包的内容</param>
''' <returns></returns>
Public Shared Function GetPacketCheck(packet() As Byte) As Byte
Dim result As Integer
'当packet的相加综合超过INT_MAX则会异常
For Each b As Byte In packet
result += b
Next
Return CByte(&HFF - (result And &HFF))
End Function
End Class

View File

@@ -0,0 +1,123 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class FrmAddTask
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.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
Me.OK_Button = New System.Windows.Forms.Button()
Me.Cancel_Button = New System.Windows.Forms.Button()
Me.CboTasksType = New System.Windows.Forms.ComboBox()
Me.TabTasksPages = New System.Windows.Forms.TabControl()
Me.Label1 = New System.Windows.Forms.Label()
Me.TableLayoutPanel1.SuspendLayout
Me.SuspendLayout
'
'TableLayoutPanel1
'
Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.TableLayoutPanel1.ColumnCount = 2
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0)
Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0)
Me.TableLayoutPanel1.Location = New System.Drawing.Point(282, 323)
Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
Me.TableLayoutPanel1.RowCount = 1
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 27)
Me.TableLayoutPanel1.TabIndex = 0
'
'OK_Button
'
Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None
Me.OK_Button.Location = New System.Drawing.Point(3, 3)
Me.OK_Button.Name = "OK_Button"
Me.OK_Button.Size = New System.Drawing.Size(67, 21)
Me.OK_Button.TabIndex = 0
Me.OK_Button.Text = "确定"
'
'Cancel_Button
'
Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None
Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Cancel_Button.Location = New System.Drawing.Point(76, 3)
Me.Cancel_Button.Name = "Cancel_Button"
Me.Cancel_Button.Size = New System.Drawing.Size(67, 21)
Me.Cancel_Button.TabIndex = 1
Me.Cancel_Button.Text = "取消"
'
'CboTasksType
'
Me.CboTasksType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.CboTasksType.FormattingEnabled = true
Me.CboTasksType.Location = New System.Drawing.Point(71, 30)
Me.CboTasksType.Name = "CboTasksType"
Me.CboTasksType.Size = New System.Drawing.Size(314, 20)
Me.CboTasksType.TabIndex = 1
'
'TabTasksPages
'
Me.TabTasksPages.Location = New System.Drawing.Point(12, 56)
Me.TabTasksPages.Name = "TabTasksPages"
Me.TabTasksPages.SelectedIndex = 0
Me.TabTasksPages.Size = New System.Drawing.Size(420, 260)
Me.TabTasksPages.TabIndex = 2
'
'Label1
'
Me.Label1.AutoSize = true
Me.Label1.Location = New System.Drawing.Point(12, 33)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(53, 12)
Me.Label1.TabIndex = 3
Me.Label1.Text = "任务类型"
'
'FrmAddTask
'
Me.AcceptButton = Me.OK_Button
Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 12!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.Cancel_Button
Me.ClientSize = New System.Drawing.Size(440, 361)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TabTasksPages)
Me.Controls.Add(Me.CboTasksType)
Me.Controls.Add(Me.TableLayoutPanel1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = false
Me.MinimizeBox = false
Me.Name = "FrmAddTask"
Me.ShowInTaskbar = false
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "FrmAddTask"
Me.TableLayoutPanel1.ResumeLayout(false)
Me.ResumeLayout(false)
Me.PerformLayout
End Sub
Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
Friend WithEvents OK_Button As System.Windows.Forms.Button
Friend WithEvents Cancel_Button As System.Windows.Forms.Button
Friend WithEvents CboTasksType As ComboBox
Friend WithEvents TabTasksPages As TabControl
Friend WithEvents Label1 As Label
End Class

View File

@@ -0,0 +1,120 @@
<?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>
</root>

View File

@@ -0,0 +1,80 @@
Imports UTS_Core.UTSModule.Service
Public Class FrmAddTask
Public TaskForm As ITaskForm
Private _syncForm As FrmSyncTasks
Private _listenForm As FrmListenTasks
''' <summary>
''' 加载窗体时,添加任务类型
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub FrmAddTask_Load(sender As Object, e As EventArgs) Handles Me.Load
InitTabMain()
CboTasksType.Items.Clear()
CboTasksType.Items.Add(ServiceTask.ServiceTaskTypeEnum.DbSync.ToString())
CboTasksType.Items.Add(ServiceTask.ServiceTaskTypeEnum.ListenJsonFile.ToString())
If CboTasksType.Items.Count > 0 Then
CboTasksType.SelectedIndex = 0
End If
End Sub
Private Sub InitTabMain()
TabTasksPages.SizeMode = TabSizeMode.Fixed '隐藏TabControl的表头
TabTasksPages.ItemSize = New Size(0, 1)
Dim tp As New TabPage
_syncForm = New FrmSyncTasks
_syncForm.ShowForm(tp)
TabTasksPages.TabPages.Add(tp)
Dim tp2 As New TabPage
_listenForm = New FrmListenTasks
_listenForm.ShowForm(tp2)
TabTasksPages.TabPages.Add(tp2)
End Sub
''' <summary>
''' 任务类型分页
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub CboTasksType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CboTasksType.SelectedIndexChanged
TabTasksPages.SelectedIndex = CboTasksType.SelectedIndex
Select Case CboTasksType.SelectedIndex
Case ServiceTask.ServiceTaskTypeEnum.DbSync
TaskForm = _syncForm
Case ServiceTask.ServiceTaskTypeEnum.ListenJsonFile
TaskForm = _listenForm
Case Else
End Select
Dim param As New Dictionary(Of String, String)
param.Add("Name", $"Task{Now.Ticks}")
TaskForm.SetParam(param)
End Sub
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
End Class

View File

@@ -0,0 +1,173 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FrmListenTasks
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.Label8 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.TBoTasksName = New System.Windows.Forms.TextBox()
Me.TBoTasksType = New System.Windows.Forms.TextBox()
Me.TBoConnStringListen = New System.Windows.Forms.TextBox()
Me.BtnRapidGeneratListen = New System.Windows.Forms.Button()
Me.NudTasksInterval = New System.Windows.Forms.NumericUpDown()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label9 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.GroupBox1.SuspendLayout()
CType(Me.NudTasksInterval, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Label8
'
Me.Label8.AutoSize = True
Me.Label8.Location = New System.Drawing.Point(20, 65)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(53, 12)
Me.Label8.TabIndex = 30
Me.Label8.Text = "监听间隔"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(20, 105)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(53, 12)
Me.Label1.TabIndex = 31
Me.Label1.Text = "监听路径"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Label2)
Me.GroupBox1.Controls.Add(Me.TBoTasksName)
Me.GroupBox1.Controls.Add(Me.TBoTasksType)
Me.GroupBox1.Controls.Add(Me.TBoConnStringListen)
Me.GroupBox1.Controls.Add(Me.BtnRapidGeneratListen)
Me.GroupBox1.Controls.Add(Me.NudTasksInterval)
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.Label8)
Me.GroupBox1.Controls.Add(Me.Label9)
Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(394, 212)
Me.GroupBox1.TabIndex = 42
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "监听任务"
'
'TBoTasksName
'
Me.TBoTasksName.Location = New System.Drawing.Point(259, 26)
Me.TBoTasksName.Name = "TBoTasksName"
Me.TBoTasksName.Size = New System.Drawing.Size(115, 21)
Me.TBoTasksName.TabIndex = 37
'
'TBoTasksType
'
Me.TBoTasksType.Location = New System.Drawing.Point(79, 26)
Me.TBoTasksType.Name = "TBoTasksType"
Me.TBoTasksType.ReadOnly = True
Me.TBoTasksType.Size = New System.Drawing.Size(103, 21)
Me.TBoTasksType.TabIndex = 36
Me.TBoTasksType.Text = "Listen"
'
'TBoConnStringListen
'
Me.TBoConnStringListen.Location = New System.Drawing.Point(43, 125)
Me.TBoConnStringListen.Multiline = True
Me.TBoConnStringListen.Name = "TBoConnStringListen"
Me.TBoConnStringListen.Size = New System.Drawing.Size(331, 75)
Me.TBoConnStringListen.TabIndex = 35
'
'BtnRapidGeneratListen
'
Me.BtnRapidGeneratListen.Location = New System.Drawing.Point(302, 99)
Me.BtnRapidGeneratListen.Name = "BtnRapidGeneratListen"
Me.BtnRapidGeneratListen.Size = New System.Drawing.Size(72, 22)
Me.BtnRapidGeneratListen.TabIndex = 34
Me.BtnRapidGeneratListen.Text = "快速生成"
Me.BtnRapidGeneratListen.UseVisualStyleBackColor = True
'
'NudTasksInterval
'
Me.NudTasksInterval.Location = New System.Drawing.Point(79, 63)
Me.NudTasksInterval.Maximum = New Decimal(New Integer() {65535, 0, 0, 0})
Me.NudTasksInterval.Name = "NudTasksInterval"
Me.NudTasksInterval.Size = New System.Drawing.Size(71, 21)
Me.NudTasksInterval.TabIndex = 31
Me.NudTasksInterval.Value = New Decimal(New Integer() {100, 0, 0, 0})
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(200, 29)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(53, 12)
Me.Label3.TabIndex = 26
Me.Label3.Text = "任务名称"
'
'Label9
'
Me.Label9.AutoSize = True
Me.Label9.Location = New System.Drawing.Point(20, 29)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(53, 12)
Me.Label9.TabIndex = 25
Me.Label9.Text = "任务类型"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(154, 65)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(35, 12)
Me.Label2.TabIndex = 38
Me.Label2.Text = "(min)"
'
'FrmListenTasks
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(394, 212)
Me.Controls.Add(Me.GroupBox1)
Me.Name = "FrmListenTasks"
Me.Text = " FrmListenTasks"
Me.GroupBox1.ResumeLayout(false)
Me.GroupBox1.PerformLayout
CType(Me.NudTasksInterval,System.ComponentModel.ISupportInitialize).EndInit
Me.ResumeLayout(false)
End Sub
Friend WithEvents Label8 As Label
Friend WithEvents Label1 As Label
Friend WithEvents GroupBox1 As GroupBox
Friend WithEvents TBoTasksName As TextBox
Friend WithEvents TBoTasksType As TextBox
Friend WithEvents TBoConnStringListen As TextBox
Friend WithEvents BtnRapidGeneratListen As Button
Friend WithEvents NudTasksInterval As NumericUpDown
Friend WithEvents Label3 As Label
Friend WithEvents Label9 As Label
Friend WithEvents Label2 As Label
End Class

View File

@@ -0,0 +1,120 @@
<?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>
</root>

View File

@@ -0,0 +1,74 @@
Imports System.Text
Imports UTS_Core.UTSModule.Service
Public Class FrmListenTasks
Implements ITaskForm
''' <summary>
''' 显示窗体
''' </summary>
''' <param name="parentControl">把本窗体打包放在其他容器内</param>
Public Sub ShowForm(parentControl As Control) Implements ITaskForm.ShowForm
FormBorderStyle = FormBorderStyle.None
TopLevel = False
Dock = DockStyle.Fill
Parent = parentControl
Show()
End Sub
''' <summary>
''' 根据类型不同快速生成ConnJsonString
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnRapidGenerating_Click(sender As Object, e As EventArgs) Handles BtnRapidGeneratListen.Click
TBoConnStringListen.Text = RapidGenerating()
End Sub
''' <summary>
''' 快捷生成字符串
''' </summary>
''' <returns></returns>
Private Function RapidGenerating() As String
Dim connStr As New StringBuilder
Using fileDialog As New OpenFileDialog
fileDialog.InitialDirectory = Application.StartupPath
If fileDialog.ShowDialog() = DialogResult.OK Then
connStr.Append(fileDialog.FileName)
connStr = connStr.Replace("\", "/")
End If
End Using
Return connStr.ToString
End Function
Public Function GetParams() As Dictionary(Of String, String) Implements ITaskForm.GetParams
Dim jsonParam As New Dictionary(Of String, String) From {
{"Type", TBoTasksType.Text},
{"Name", TBoTasksName.Text},
{"Interval", NudTasksInterval.Value.ToString()},
{"Path", TBoConnStringListen.Text}
}
Return jsonParam
End Function
Public Sub SetParam(params As Dictionary(Of String, String)) Implements ITaskForm.SetParam
For Each param As KeyValuePair(Of String, String) In params
Select Case param.Key
Case "Name"
TBoTasksName.Text = param.Value
Case "Interval"
NudTasksInterval.Value = CInt(param.Value)
Case "Path"
TBoConnStringListen.Text = param.Value
End Select
Next
End Sub
Private Sub FrmListenTasks_Load(sender As Object, e As EventArgs) Handles Me.Load
TBoTasksType.Text = ServiceTask.ServiceTaskTypeEnum.ListenJsonFile.ToString()
End Sub
End Class

736
AUTS_ServiceControler/FrmMain.Designer.vb generated Normal file
View File

@@ -0,0 +1,736 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class FrmMain
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(FrmMain))
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
Me.TsMenuM = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem()
Me.TsmConfigUpdate = New System.Windows.Forms.ToolStripMenuItem()
Me.卸载服务ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.输入路径卸载服务ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.任务ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.TsMenuDebug = New System.Windows.Forms.ToolStripMenuItem()
Me.TsMenuSet = New System.Windows.Forms.ToolStripMenuItem()
Me.TsmPackUpRecord = New System.Windows.Forms.ToolStripMenuItem()
Me.TsmClearRecord = New System.Windows.Forms.ToolStripMenuItem()
Me.注册表ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.TsMenuHelp = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStrip1 = New System.Windows.Forms.ToolStrip()
Me.TsBtnReflushServices = New System.Windows.Forms.ToolStripButton()
Me.TsCboServiceName = New System.Windows.Forms.ToolStripComboBox()
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
Me.TsBtnTestingServices = New System.Windows.Forms.ToolStripButton()
Me.ToolStripSeparator3 = New System.Windows.Forms.ToolStripSeparator()
Me.TsBtnServiceInstall = New System.Windows.Forms.ToolStripButton()
Me.TsBtnServiceUninstall = New System.Windows.Forms.ToolStripButton()
Me.ToolStripSeparator2 = New System.Windows.Forms.ToolStripSeparator()
Me.TsBtnStartService = New System.Windows.Forms.ToolStripButton()
Me.TsBtnCloseService = New System.Windows.Forms.ToolStripButton()
Me.TsBtnRestartService = New System.Windows.Forms.ToolStripButton()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.TssLblServiceName = New System.Windows.Forms.ToolStripStatusLabel()
Me.TssLblServiceStatus = New System.Windows.Forms.ToolStripStatusLabel()
Me.TssLblConnState = New System.Windows.Forms.ToolStripStatusLabel()
Me.TssLblExcuteTip = New System.Windows.Forms.ToolStripStatusLabel()
Me.SplTaskList = New System.Windows.Forms.SplitContainer()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.Grid1 = New FlexCell.Grid()
Me.CmsTasks = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.CmsBtnRefreshList = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator8 = New System.Windows.Forms.ToolStripSeparator()
Me.CmsBtnAddTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.CmsBtnDeleteTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator11 = New System.Windows.Forms.ToolStripSeparator()
Me.CmsBtnStartTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripMenuItem2 = New System.Windows.Forms.ToolStripMenuItem()
Me.CmsBtnStopTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator9 = New System.Windows.Forms.ToolStripSeparator()
Me.CmsBtnGetTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.CmsBtnSetTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator10 = New System.Windows.Forms.ToolStripSeparator()
Me.CmsBtnStartAllTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.CmsBtnStopAllTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.CmsBtnDeleteAllTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.CmsBtnGetAllTasks = New System.Windows.Forms.ToolStripMenuItem()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.TabTasks = New System.Windows.Forms.TabControl()
Me.ToolStrip2 = New System.Windows.Forms.ToolStrip()
Me.TsBtnConnService = New System.Windows.Forms.ToolStripButton()
Me.ToolStripSeparator12 = New System.Windows.Forms.ToolStripSeparator()
Me.TsBtnAddTasks = New System.Windows.Forms.ToolStripButton()
Me.TsBtDelTasks = New System.Windows.Forms.ToolStripButton()
Me.ToolStripSeparator6 = New System.Windows.Forms.ToolStripSeparator()
Me.TsBtnStartTasks = New System.Windows.Forms.ToolStripButton()
Me.TsBtnRestartTasks = New System.Windows.Forms.ToolStripButton()
Me.TsBtnStopTasks = New System.Windows.Forms.ToolStripButton()
Me.ToolStripSeparator7 = New System.Windows.Forms.ToolStripSeparator()
Me.TsBtnGetTask = New System.Windows.Forms.ToolStripButton()
Me.TsBtnSetTasks = New System.Windows.Forms.ToolStripButton()
Me.SplMain = New System.Windows.Forms.SplitContainer()
Me.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.RtxCommunicationLogs = New System.Windows.Forms.RichTextBox()
Me.MenuStrip1.SuspendLayout()
Me.ToolStrip1.SuspendLayout()
Me.StatusStrip1.SuspendLayout()
CType(Me.SplTaskList, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplTaskList.Panel1.SuspendLayout()
Me.SplTaskList.Panel2.SuspendLayout()
Me.SplTaskList.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.CmsTasks.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.ToolStrip2.SuspendLayout()
CType(Me.SplMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplMain.Panel1.SuspendLayout()
Me.SplMain.Panel2.SuspendLayout()
Me.SplMain.SuspendLayout()
Me.GroupBox3.SuspendLayout()
Me.SuspendLayout()
'
'MenuStrip1
'
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TsMenuM, Me.ToolStripMenuItem1, Me.任务ToolStripMenuItem, Me.TsMenuDebug, Me.TsMenuSet, Me.TsMenuHelp})
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
Me.MenuStrip1.Name = "MenuStrip1"
Me.MenuStrip1.Size = New System.Drawing.Size(712, 25)
Me.MenuStrip1.TabIndex = 6
Me.MenuStrip1.Text = "MenuStrip1"
'
'TsMenuM
'
Me.TsMenuM.Name = "TsMenuM"
Me.TsMenuM.Size = New System.Drawing.Size(44, 21)
Me.TsMenuM.Text = "菜单"
'
'ToolStripMenuItem1
'
Me.ToolStripMenuItem1.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TsmConfigUpdate, Me.卸载服务ToolStripMenuItem, Me.输入路径卸载服务ToolStripMenuItem})
Me.ToolStripMenuItem1.Name = "ToolStripMenuItem1"
Me.ToolStripMenuItem1.Size = New System.Drawing.Size(44, 21)
Me.ToolStripMenuItem1.Text = "服务"
'
'TsmConfigUpdate
'
Me.TsmConfigUpdate.Name = "TsmConfigUpdate"
Me.TsmConfigUpdate.Size = New System.Drawing.Size(180, 22)
Me.TsmConfigUpdate.Text = "一键配置更新"
'
'卸载服务ToolStripMenuItem
'
Me.卸载服务ToolStripMenuItem.Name = "卸载服务ToolStripMenuItem"
Me.卸载服务ToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.卸载服务ToolStripMenuItem.Text = "选择路径卸载服务"
'
'输入路径卸载服务ToolStripMenuItem
'
Me.输入路径卸载服务ToolStripMenuItem.Name = "输入路径卸载服务ToolStripMenuItem"
Me.输入路径卸载服务ToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.输入路径卸载服务ToolStripMenuItem.Text = "输入路径卸载服务"
'
'任务ToolStripMenuItem
'
Me.任务ToolStripMenuItem.Name = "任务ToolStripMenuItem"
Me.任务ToolStripMenuItem.Size = New System.Drawing.Size(44, 21)
Me.任务ToolStripMenuItem.Text = "任务"
'
'TsMenuDebug
'
Me.TsMenuDebug.Name = "TsMenuDebug"
Me.TsMenuDebug.Size = New System.Drawing.Size(44, 21)
Me.TsMenuDebug.Text = "调试"
'
'TsMenuSet
'
Me.TsMenuSet.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TsmPackUpRecord, Me.TsmClearRecord, Me.注册表ToolStripMenuItem})
Me.TsMenuSet.Name = "TsMenuSet"
Me.TsMenuSet.Size = New System.Drawing.Size(44, 21)
Me.TsMenuSet.Text = "设置"
'
'TsmPackUpRecord
'
Me.TsmPackUpRecord.Name = "TsmPackUpRecord"
Me.TsmPackUpRecord.Size = New System.Drawing.Size(180, 22)
Me.TsmPackUpRecord.Text = "隐藏通讯日志"
'
'TsmClearRecord
'
Me.TsmClearRecord.Name = "TsmClearRecord"
Me.TsmClearRecord.Size = New System.Drawing.Size(180, 22)
Me.TsmClearRecord.Text = "清空通讯日志"
'
'注册表ToolStripMenuItem
'
Me.注册表ToolStripMenuItem.Name = "注册表ToolStripMenuItem"
Me.注册表ToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.注册表ToolStripMenuItem.Text = "注册表"
'
'TsMenuHelp
'
Me.TsMenuHelp.Name = "TsMenuHelp"
Me.TsMenuHelp.Size = New System.Drawing.Size(44, 21)
Me.TsMenuHelp.Text = "帮助"
'
'ToolStrip1
'
Me.ToolStrip1.BackColor = System.Drawing.SystemColors.Control
Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TsBtnReflushServices, Me.TsCboServiceName, Me.ToolStripSeparator1, Me.TsBtnTestingServices, Me.ToolStripSeparator3, Me.TsBtnServiceInstall, Me.TsBtnServiceUninstall, Me.ToolStripSeparator2, Me.TsBtnStartService, Me.TsBtnCloseService, Me.TsBtnRestartService})
Me.ToolStrip1.Location = New System.Drawing.Point(0, 25)
Me.ToolStrip1.Name = "ToolStrip1"
Me.ToolStrip1.Size = New System.Drawing.Size(712, 40)
Me.ToolStrip1.TabIndex = 7
Me.ToolStrip1.Text = "ToolStrip1"
'
'TsBtnReflushServices
'
Me.TsBtnReflushServices.Image = CType(resources.GetObject("TsBtnReflushServices.Image"), System.Drawing.Image)
Me.TsBtnReflushServices.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnReflushServices.Name = "TsBtnReflushServices"
Me.TsBtnReflushServices.Size = New System.Drawing.Size(60, 37)
Me.TsBtnReflushServices.Text = "更新列表"
Me.TsBtnReflushServices.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'TsCboServiceName
'
Me.TsCboServiceName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.TsCboServiceName.Name = "TsCboServiceName"
Me.TsCboServiceName.Size = New System.Drawing.Size(121, 40)
'
'ToolStripSeparator1
'
Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
Me.ToolStripSeparator1.Size = New System.Drawing.Size(6, 40)
'
'TsBtnTestingServices
'
Me.TsBtnTestingServices.Image = CType(resources.GetObject("TsBtnTestingServices.Image"), System.Drawing.Image)
Me.TsBtnTestingServices.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnTestingServices.Name = "TsBtnTestingServices"
Me.TsBtnTestingServices.Size = New System.Drawing.Size(60, 37)
Me.TsBtnTestingServices.Text = "检测服务"
Me.TsBtnTestingServices.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'ToolStripSeparator3
'
Me.ToolStripSeparator3.Name = "ToolStripSeparator3"
Me.ToolStripSeparator3.Size = New System.Drawing.Size(6, 40)
'
'TsBtnServiceInstall
'
Me.TsBtnServiceInstall.Image = CType(resources.GetObject("TsBtnServiceInstall.Image"), System.Drawing.Image)
Me.TsBtnServiceInstall.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnServiceInstall.Name = "TsBtnServiceInstall"
Me.TsBtnServiceInstall.Size = New System.Drawing.Size(60, 37)
Me.TsBtnServiceInstall.Text = "安装服务"
Me.TsBtnServiceInstall.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'TsBtnServiceUninstall
'
Me.TsBtnServiceUninstall.Image = CType(resources.GetObject("TsBtnServiceUninstall.Image"), System.Drawing.Image)
Me.TsBtnServiceUninstall.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnServiceUninstall.Name = "TsBtnServiceUninstall"
Me.TsBtnServiceUninstall.Size = New System.Drawing.Size(60, 37)
Me.TsBtnServiceUninstall.Text = "卸载服务"
Me.TsBtnServiceUninstall.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'ToolStripSeparator2
'
Me.ToolStripSeparator2.Name = "ToolStripSeparator2"
Me.ToolStripSeparator2.Size = New System.Drawing.Size(6, 40)
'
'TsBtnStartService
'
Me.TsBtnStartService.Image = CType(resources.GetObject("TsBtnStartService.Image"), System.Drawing.Image)
Me.TsBtnStartService.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnStartService.Name = "TsBtnStartService"
Me.TsBtnStartService.Size = New System.Drawing.Size(60, 37)
Me.TsBtnStartService.Text = "启用服务"
Me.TsBtnStartService.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'TsBtnCloseService
'
Me.TsBtnCloseService.Image = CType(resources.GetObject("TsBtnCloseService.Image"), System.Drawing.Image)
Me.TsBtnCloseService.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnCloseService.Name = "TsBtnCloseService"
Me.TsBtnCloseService.Size = New System.Drawing.Size(60, 37)
Me.TsBtnCloseService.Text = "关闭服务"
Me.TsBtnCloseService.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'TsBtnRestartService
'
Me.TsBtnRestartService.Image = CType(resources.GetObject("TsBtnRestartService.Image"), System.Drawing.Image)
Me.TsBtnRestartService.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnRestartService.Name = "TsBtnRestartService"
Me.TsBtnRestartService.Size = New System.Drawing.Size(60, 37)
Me.TsBtnRestartService.Text = "重启服务"
Me.TsBtnRestartService.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'StatusStrip1
'
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TssLblServiceName, Me.TssLblServiceStatus, Me.TssLblConnState, Me.TssLblExcuteTip})
Me.StatusStrip1.Location = New System.Drawing.Point(0, 610)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Size = New System.Drawing.Size(712, 22)
Me.StatusStrip1.TabIndex = 8
Me.StatusStrip1.Text = "StatusStrip1"
'
'TssLblServiceName
'
Me.TssLblServiceName.Font = New System.Drawing.Font("Microsoft YaHei UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.TssLblServiceName.ForeColor = System.Drawing.Color.Blue
Me.TssLblServiceName.Image = CType(resources.GetObject("TssLblServiceName.Image"), System.Drawing.Image)
Me.TssLblServiceName.Name = "TssLblServiceName"
Me.TssLblServiceName.Size = New System.Drawing.Size(48, 17)
Me.TssLblServiceName.Text = "服务"
'
'TssLblServiceStatus
'
Me.TssLblServiceStatus.Name = "TssLblServiceStatus"
Me.TssLblServiceStatus.Size = New System.Drawing.Size(32, 17)
Me.TssLblServiceStatus.Text = "状态"
'
'TssLblConnState
'
Me.TssLblConnState.Image = CType(resources.GetObject("TssLblConnState.Image"), System.Drawing.Image)
Me.TssLblConnState.Name = "TssLblConnState"
Me.TssLblConnState.Size = New System.Drawing.Size(60, 17)
Me.TssLblConnState.Text = "无连接"
'
'TssLblExcuteTip
'
Me.TssLblExcuteTip.Name = "TssLblExcuteTip"
Me.TssLblExcuteTip.Size = New System.Drawing.Size(48, 17)
Me.TssLblExcuteTip.Text = " "
'
'SplTaskList
'
Me.SplTaskList.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplTaskList.Location = New System.Drawing.Point(0, 0)
Me.SplTaskList.Name = "SplTaskList"
'
'SplTaskList.Panel1
'
Me.SplTaskList.Panel1.Controls.Add(Me.GroupBox2)
'
'SplTaskList.Panel2
'
Me.SplTaskList.Panel2.Controls.Add(Me.GroupBox1)
Me.SplTaskList.Size = New System.Drawing.Size(712, 412)
Me.SplTaskList.SplitterDistance = 175
Me.SplTaskList.TabIndex = 9
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.Grid1)
Me.GroupBox2.Dock = System.Windows.Forms.DockStyle.Fill
Me.GroupBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.GroupBox2.Location = New System.Drawing.Point(0, 0)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(175, 412)
Me.GroupBox2.TabIndex = 1
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "任务列表"
'
'Grid1
'
Me.Grid1.BackColorBkg = System.Drawing.Color.Transparent
Me.Grid1.BorderStyle = FlexCell.BorderStyleEnum.None
Me.Grid1.CheckedImage = Nothing
Me.Grid1.Cols = 4
Me.Grid1.ContextMenuStrip = Me.CmsTasks
Me.Grid1.DefaultFont = New System.Drawing.Font("宋体", 9.0!)
Me.Grid1.Dock = System.Windows.Forms.DockStyle.Fill
Me.Grid1.ExtendLastCol = True
Me.Grid1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Grid1.GridColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
Me.Grid1.Location = New System.Drawing.Point(3, 25)
Me.Grid1.Name = "Grid1"
Me.Grid1.Rows = 1
Me.Grid1.Size = New System.Drawing.Size(169, 384)
Me.Grid1.TabIndex = 0
Me.Grid1.UncheckedImage = Nothing
'
'CmsTasks
'
Me.CmsTasks.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.CmsBtnRefreshList, Me.ToolStripSeparator8, Me.CmsBtnAddTasks, Me.CmsBtnDeleteTasks, Me.ToolStripSeparator11, Me.CmsBtnStartTasks, Me.ToolStripMenuItem2, Me.CmsBtnStopTasks, Me.ToolStripSeparator9, Me.CmsBtnGetTasks, Me.CmsBtnSetTasks, Me.ToolStripSeparator10, Me.CmsBtnStartAllTasks, Me.CmsBtnStopAllTasks, Me.CmsBtnDeleteAllTasks, Me.CmsBtnGetAllTasks})
Me.CmsTasks.Name = "CmsTasks"
Me.CmsTasks.Size = New System.Drawing.Size(125, 292)
'
'CmsBtnRefreshList
'
Me.CmsBtnRefreshList.Name = "CmsBtnRefreshList"
Me.CmsBtnRefreshList.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnRefreshList.Text = "刷新列表"
'
'ToolStripSeparator8
'
Me.ToolStripSeparator8.Name = "ToolStripSeparator8"
Me.ToolStripSeparator8.Size = New System.Drawing.Size(121, 6)
'
'CmsBtnAddTasks
'
Me.CmsBtnAddTasks.Name = "CmsBtnAddTasks"
Me.CmsBtnAddTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnAddTasks.Text = "添加任务"
'
'CmsBtnDeleteTasks
'
Me.CmsBtnDeleteTasks.Name = "CmsBtnDeleteTasks"
Me.CmsBtnDeleteTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnDeleteTasks.Text = "删除任务"
'
'ToolStripSeparator11
'
Me.ToolStripSeparator11.Name = "ToolStripSeparator11"
Me.ToolStripSeparator11.Size = New System.Drawing.Size(121, 6)
'
'CmsBtnStartTasks
'
Me.CmsBtnStartTasks.Name = "CmsBtnStartTasks"
Me.CmsBtnStartTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnStartTasks.Text = "开启任务"
'
'ToolStripMenuItem2
'
Me.ToolStripMenuItem2.Name = "ToolStripMenuItem2"
Me.ToolStripMenuItem2.Size = New System.Drawing.Size(124, 22)
Me.ToolStripMenuItem2.Text = "重启任务"
'
'CmsBtnStopTasks
'
Me.CmsBtnStopTasks.Name = "CmsBtnStopTasks"
Me.CmsBtnStopTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnStopTasks.Text = "暂停任务"
'
'ToolStripSeparator9
'
Me.ToolStripSeparator9.Name = "ToolStripSeparator9"
Me.ToolStripSeparator9.Size = New System.Drawing.Size(121, 6)
'
'CmsBtnGetTasks
'
Me.CmsBtnGetTasks.Name = "CmsBtnGetTasks"
Me.CmsBtnGetTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnGetTasks.Text = "获取参数"
'
'CmsBtnSetTasks
'
Me.CmsBtnSetTasks.Name = "CmsBtnSetTasks"
Me.CmsBtnSetTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnSetTasks.Text = "设置参数"
'
'ToolStripSeparator10
'
Me.ToolStripSeparator10.Name = "ToolStripSeparator10"
Me.ToolStripSeparator10.Size = New System.Drawing.Size(121, 6)
'
'CmsBtnStartAllTasks
'
Me.CmsBtnStartAllTasks.Name = "CmsBtnStartAllTasks"
Me.CmsBtnStartAllTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnStartAllTasks.Text = "全部开启"
'
'CmsBtnStopAllTasks
'
Me.CmsBtnStopAllTasks.Name = "CmsBtnStopAllTasks"
Me.CmsBtnStopAllTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnStopAllTasks.Text = "全部暂停"
'
'CmsBtnDeleteAllTasks
'
Me.CmsBtnDeleteAllTasks.Name = "CmsBtnDeleteAllTasks"
Me.CmsBtnDeleteAllTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnDeleteAllTasks.Text = "全部删除"
'
'CmsBtnGetAllTasks
'
Me.CmsBtnGetAllTasks.Name = "CmsBtnGetAllTasks"
Me.CmsBtnGetAllTasks.Size = New System.Drawing.Size(124, 22)
Me.CmsBtnGetAllTasks.Text = "全部参数"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.TabTasks)
Me.GroupBox1.Controls.Add(Me.ToolStrip2)
Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(533, 412)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "参数"
'
'TabTasks
'
Me.TabTasks.Dock = System.Windows.Forms.DockStyle.Fill
Me.TabTasks.Location = New System.Drawing.Point(3, 62)
Me.TabTasks.Name = "TabTasks"
Me.TabTasks.SelectedIndex = 0
Me.TabTasks.Size = New System.Drawing.Size(527, 347)
Me.TabTasks.TabIndex = 7
'
'ToolStrip2
'
Me.ToolStrip2.BackColor = System.Drawing.Color.Transparent
Me.ToolStrip2.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TsBtnConnService, Me.ToolStripSeparator12, Me.TsBtnAddTasks, Me.TsBtDelTasks, Me.ToolStripSeparator6, Me.TsBtnStartTasks, Me.TsBtnRestartTasks, Me.TsBtnStopTasks, Me.ToolStripSeparator7, Me.TsBtnGetTask, Me.TsBtnSetTasks})
Me.ToolStrip2.Location = New System.Drawing.Point(3, 22)
Me.ToolStrip2.Name = "ToolStrip2"
Me.ToolStrip2.Size = New System.Drawing.Size(527, 40)
Me.ToolStrip2.TabIndex = 6
Me.ToolStrip2.Text = "ToolStrip2"
'
'TsBtnConnService
'
Me.TsBtnConnService.Image = CType(resources.GetObject("TsBtnConnService.Image"), System.Drawing.Image)
Me.TsBtnConnService.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnConnService.Name = "TsBtnConnService"
Me.TsBtnConnService.Size = New System.Drawing.Size(60, 37)
Me.TsBtnConnService.Text = "连接服务"
Me.TsBtnConnService.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'ToolStripSeparator12
'
Me.ToolStripSeparator12.Name = "ToolStripSeparator12"
Me.ToolStripSeparator12.Size = New System.Drawing.Size(6, 40)
'
'TsBtnAddTasks
'
Me.TsBtnAddTasks.Image = CType(resources.GetObject("TsBtnAddTasks.Image"), System.Drawing.Image)
Me.TsBtnAddTasks.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnAddTasks.Name = "TsBtnAddTasks"
Me.TsBtnAddTasks.Size = New System.Drawing.Size(60, 37)
Me.TsBtnAddTasks.Text = "添加任务"
Me.TsBtnAddTasks.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'TsBtDelTasks
'
Me.TsBtDelTasks.Image = CType(resources.GetObject("TsBtDelTasks.Image"), System.Drawing.Image)
Me.TsBtDelTasks.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtDelTasks.Name = "TsBtDelTasks"
Me.TsBtDelTasks.Size = New System.Drawing.Size(60, 37)
Me.TsBtDelTasks.Text = "删除任务"
Me.TsBtDelTasks.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'ToolStripSeparator6
'
Me.ToolStripSeparator6.Name = "ToolStripSeparator6"
Me.ToolStripSeparator6.Size = New System.Drawing.Size(6, 40)
'
'TsBtnStartTasks
'
Me.TsBtnStartTasks.Image = CType(resources.GetObject("TsBtnStartTasks.Image"), System.Drawing.Image)
Me.TsBtnStartTasks.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnStartTasks.Name = "TsBtnStartTasks"
Me.TsBtnStartTasks.Size = New System.Drawing.Size(60, 37)
Me.TsBtnStartTasks.Text = "开启任务"
Me.TsBtnStartTasks.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'TsBtnRestartTasks
'
Me.TsBtnRestartTasks.Image = CType(resources.GetObject("TsBtnRestartTasks.Image"), System.Drawing.Image)
Me.TsBtnRestartTasks.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnRestartTasks.Name = "TsBtnRestartTasks"
Me.TsBtnRestartTasks.Size = New System.Drawing.Size(60, 37)
Me.TsBtnRestartTasks.Text = "重启任务"
Me.TsBtnRestartTasks.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'TsBtnStopTasks
'
Me.TsBtnStopTasks.Image = CType(resources.GetObject("TsBtnStopTasks.Image"), System.Drawing.Image)
Me.TsBtnStopTasks.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnStopTasks.Name = "TsBtnStopTasks"
Me.TsBtnStopTasks.Size = New System.Drawing.Size(60, 37)
Me.TsBtnStopTasks.Text = "暂停任务"
Me.TsBtnStopTasks.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'ToolStripSeparator7
'
Me.ToolStripSeparator7.Name = "ToolStripSeparator7"
Me.ToolStripSeparator7.Size = New System.Drawing.Size(6, 40)
'
'TsBtnGetTask
'
Me.TsBtnGetTask.Image = CType(resources.GetObject("TsBtnGetTask.Image"), System.Drawing.Image)
Me.TsBtnGetTask.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnGetTask.Name = "TsBtnGetTask"
Me.TsBtnGetTask.Size = New System.Drawing.Size(60, 37)
Me.TsBtnGetTask.Text = "获取参数"
Me.TsBtnGetTask.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'TsBtnSetTasks
'
Me.TsBtnSetTasks.Image = CType(resources.GetObject("TsBtnSetTasks.Image"), System.Drawing.Image)
Me.TsBtnSetTasks.ImageTransparentColor = System.Drawing.Color.Magenta
Me.TsBtnSetTasks.Name = "TsBtnSetTasks"
Me.TsBtnSetTasks.Size = New System.Drawing.Size(60, 37)
Me.TsBtnSetTasks.Text = "设置参数"
Me.TsBtnSetTasks.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'SplMain
'
Me.SplMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplMain.Location = New System.Drawing.Point(0, 65)
Me.SplMain.Name = "SplMain"
Me.SplMain.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplMain.Panel1
'
Me.SplMain.Panel1.Controls.Add(Me.SplTaskList)
'
'SplMain.Panel2
'
Me.SplMain.Panel2.Controls.Add(Me.GroupBox3)
Me.SplMain.Size = New System.Drawing.Size(712, 545)
Me.SplMain.SplitterDistance = 412
Me.SplMain.TabIndex = 10
'
'GroupBox3
'
Me.GroupBox3.Controls.Add(Me.RtxCommunicationLogs)
Me.GroupBox3.Dock = System.Windows.Forms.DockStyle.Fill
Me.GroupBox3.Location = New System.Drawing.Point(0, 0)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(712, 129)
Me.GroupBox3.TabIndex = 0
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "通讯日志"
'
'RtxCommunicationLogs
'
Me.RtxCommunicationLogs.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.RtxCommunicationLogs.Dock = System.Windows.Forms.DockStyle.Fill
Me.RtxCommunicationLogs.Location = New System.Drawing.Point(3, 17)
Me.RtxCommunicationLogs.Name = "RtxCommunicationLogs"
Me.RtxCommunicationLogs.Size = New System.Drawing.Size(706, 109)
Me.RtxCommunicationLogs.TabIndex = 0
Me.RtxCommunicationLogs.Text = ""
'
'FrmMain
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 12!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.SystemColors.Control
Me.ClientSize = New System.Drawing.Size(712, 632)
Me.Controls.Add(Me.SplMain)
Me.Controls.Add(Me.StatusStrip1)
Me.Controls.Add(Me.ToolStrip1)
Me.Controls.Add(Me.MenuStrip1)
Me.Icon = CType(resources.GetObject("$this.Icon"),System.Drawing.Icon)
Me.Name = "FrmMain"
Me.Text = "同步监听客户端"
Me.MenuStrip1.ResumeLayout(false)
Me.MenuStrip1.PerformLayout
Me.ToolStrip1.ResumeLayout(false)
Me.ToolStrip1.PerformLayout
Me.StatusStrip1.ResumeLayout(false)
Me.StatusStrip1.PerformLayout
Me.SplTaskList.Panel1.ResumeLayout(false)
Me.SplTaskList.Panel2.ResumeLayout(false)
CType(Me.SplTaskList,System.ComponentModel.ISupportInitialize).EndInit
Me.SplTaskList.ResumeLayout(false)
Me.GroupBox2.ResumeLayout(false)
Me.CmsTasks.ResumeLayout(false)
Me.GroupBox1.ResumeLayout(false)
Me.GroupBox1.PerformLayout
Me.ToolStrip2.ResumeLayout(false)
Me.ToolStrip2.PerformLayout
Me.SplMain.Panel1.ResumeLayout(false)
Me.SplMain.Panel2.ResumeLayout(false)
CType(Me.SplMain,System.ComponentModel.ISupportInitialize).EndInit
Me.SplMain.ResumeLayout(false)
Me.GroupBox3.ResumeLayout(false)
Me.ResumeLayout(false)
Me.PerformLayout
End Sub
Friend WithEvents MenuStrip1 As MenuStrip
Friend WithEvents TsMenuM As ToolStripMenuItem
Friend WithEvents TsMenuDebug As ToolStripMenuItem
Friend WithEvents TsMenuSet As ToolStripMenuItem
Friend WithEvents TsMenuHelp As ToolStripMenuItem
Friend WithEvents ToolStrip1 As ToolStrip
Friend WithEvents TsCboServiceName As ToolStripComboBox
Friend WithEvents ToolStripSeparator1 As ToolStripSeparator
Friend WithEvents TsBtnTestingServices As ToolStripButton
Friend WithEvents ToolStripSeparator3 As ToolStripSeparator
Friend WithEvents TsBtnServiceInstall As ToolStripButton
Friend WithEvents TsBtnStartService As ToolStripButton
Friend WithEvents ToolStripSeparator2 As ToolStripSeparator
Friend WithEvents TsBtnRestartService As ToolStripButton
Friend WithEvents TsBtnCloseService As ToolStripButton
Friend WithEvents TsBtnServiceUninstall As ToolStripButton
Friend WithEvents StatusStrip1 As StatusStrip
Friend WithEvents TssLblServiceStatus As ToolStripStatusLabel
Friend WithEvents SplTaskList As SplitContainer
Friend WithEvents GroupBox2 As GroupBox
Friend WithEvents GroupBox1 As GroupBox
Friend WithEvents TabTasks As TabControl
Friend WithEvents ToolStrip2 As ToolStrip
Friend WithEvents TsBtnAddTasks As ToolStripButton
Friend WithEvents ToolStripSeparator6 As ToolStripSeparator
Friend WithEvents TsBtDelTasks As ToolStripButton
Friend WithEvents ToolStripSeparator7 As ToolStripSeparator
Friend WithEvents TsBtnGetTask As ToolStripButton
Friend WithEvents TsBtnSetTasks As ToolStripButton
Friend WithEvents Grid1 As FlexCell.Grid
Friend WithEvents CmsTasks As ContextMenuStrip
Friend WithEvents CmsBtnRefreshList As ToolStripMenuItem
Friend WithEvents ToolStripSeparator8 As ToolStripSeparator
Friend WithEvents CmsBtnAddTasks As ToolStripMenuItem
Friend WithEvents CmsBtnDeleteTasks As ToolStripMenuItem
Friend WithEvents ToolStripSeparator11 As ToolStripSeparator
Friend WithEvents CmsBtnStartTasks As ToolStripMenuItem
Friend WithEvents CmsBtnStopTasks As ToolStripMenuItem
Friend WithEvents ToolStripSeparator9 As ToolStripSeparator
Friend WithEvents CmsBtnGetTasks As ToolStripMenuItem
Friend WithEvents CmsBtnSetTasks As ToolStripMenuItem
Friend WithEvents ToolStripSeparator10 As ToolStripSeparator
Friend WithEvents CmsBtnStartAllTasks As ToolStripMenuItem
Friend WithEvents CmsBtnStopAllTasks As ToolStripMenuItem
Friend WithEvents CmsBtnDeleteAllTasks As ToolStripMenuItem
Friend WithEvents CmsBtnGetAllTasks As ToolStripMenuItem
Friend WithEvents ToolStripMenuItem1 As ToolStripMenuItem
Friend WithEvents 任务ToolStripMenuItem As ToolStripMenuItem
Friend WithEvents TsBtnStartTasks As ToolStripButton
Friend WithEvents TsBtnStopTasks As ToolStripButton
Friend WithEvents TssLblConnState As ToolStripStatusLabel
Friend WithEvents TsBtnRestartTasks As ToolStripButton
Friend WithEvents TssLblExcuteTip As ToolStripStatusLabel
Friend WithEvents ToolStripMenuItem2 As ToolStripMenuItem
Friend WithEvents SplMain As SplitContainer
Friend WithEvents GroupBox3 As GroupBox
Friend WithEvents RtxCommunicationLogs As RichTextBox
Friend WithEvents TsmPackUpRecord As ToolStripMenuItem
Friend WithEvents TsmClearRecord As ToolStripMenuItem
Friend WithEvents 注册表ToolStripMenuItem As ToolStripMenuItem
Friend WithEvents TsmConfigUpdate As ToolStripMenuItem
Friend WithEvents ToolStripSeparator12 As ToolStripSeparator
Friend WithEvents TsBtnConnService As ToolStripButton
Friend WithEvents TssLblServiceName As ToolStripStatusLabel
Friend WithEvents 卸载服务ToolStripMenuItem As ToolStripMenuItem
Friend WithEvents 输入路径卸载服务ToolStripMenuItem As ToolStripMenuItem
Friend WithEvents TsBtnReflushServices As ToolStripButton
End Class

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,908 @@
Imports UTS_Core.UTSModule
Imports UTS_Core.UTSModule.Service
Public Class FrmMain
#Region "窗体初始化"
''' <summary>
''' 窗体加载时启动项
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
InitSerName()
InitTabMain()
InitGrid()
Text = $"{Application.ProductName} {Application.ProductVersion}"
End Sub
Private Sub InitTabMain()
TabTasks.SizeMode = TabSizeMode.Fixed '隐藏TabControl的表头
TabTasks.ItemSize = New Size(0, 1)
End Sub
''' <summary> 初始化本地IP </summary>
Private Sub InitSerName()
TsCboServiceName.Items.Clear()
InitUtsServices()
For Each service As UtsService In _services
TsCboServiceName.Items.Add(service.Name)
Next
If TsCboServiceName.Items.Count > 0 Then TsCboServiceName.SelectedIndex = 0
End Sub
#End Region
#Region "服务控制信息"
''' <summary>
''' 所有服务的信息
''' </summary>
Private _services As List(Of UtsService)
Private _service As UtsService
Private Sub InitUtsServices()
_services = New List(Of UtsService)()
Try
_services.Add(New UtsService(UtsRegistry.UpdateServiceName, UtsRegistry.UpdateServiceVersion))
Catch ex As Exception
Console.WriteLine($"Init UpdateService Error:{ex.Message}")
End Try
Try
_services.Add(New UtsService(UtsRegistry.DataServiceName, UtsRegistry.DataServiceVersion))
Catch ex As Exception
Console.WriteLine($"Init DataService Error:{ex.Message}")
End Try
End Sub
''' <summary>
''' 选择下拉框改变值
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsCboServiceName_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TsCboServiceName.SelectedIndexChanged
_service = _services(TsCboServiceName.SelectedIndex)
TssLblServiceName.Text = $"{_service.Name} {_service.Version} :"
UpdateServiceStatusTip(_service.ServicesStatus())
End Sub
Private Sub TsBtnReflushServices_Click(sender As Object, e As EventArgs) Handles TsBtnReflushServices.Click
InitSerName()
End Sub
''' <summary>
''' 更新服务状态
''' </summary>
''' <param name="status"></param>
Private Sub UpdateServiceStatusTip(status As UtsService.ServiceStatusEnum)
Static tipColor() As Color = {Color.Gray, Color.Red, Color.Aquamarine, Color.Blue, Color.Orange, Color.Blue, Color.Green}
TssLblServiceStatus.ForeColor = tipColor(status)
TssLblServiceStatus.Text = $"{ UtsService.GetEnumDescription(status)}"
UpdateServiceEnabled(status)
End Sub
Private Sub UpdateServiceEnabled(status As UtsService.ServiceStatusEnum)
If status <= UtsService.ServiceStatusEnum.Nonentity Then '服务不存在状态
TsBtnStartService.Enabled = False
TsBtnCloseService.Enabled = False
TsBtnRestartService.Enabled = False
TsBtnConnService.Enabled = False
TsBtnServiceInstall.Enabled = False
TsBtnServiceUninstall.Enabled = False
If _tcpClient IsNot Nothing Then
_tcpClient.Close()
UpdateTcpTip(_tcpClient.IsOpen) '更新连接提示
UpdateConnectionEnabled(_tcpClient.IsOpen) '根据连接,设置控件可操作性
End If
ElseIf status <= UtsService.ServiceStatusEnum.StartPending Then '服务存在未启用状态
TsBtnStartService.Enabled = True
TsBtnCloseService.Enabled = True
TsBtnRestartService.Enabled = True
TsBtnConnService.Enabled = False
TsBtnServiceInstall.Enabled = True
TsBtnServiceUninstall.Enabled = True
If _tcpClient IsNot Nothing Then
_tcpClient.Close()
UpdateTcpTip(_tcpClient.IsOpen) '更新连接提示
UpdateConnectionEnabled(_tcpClient.IsOpen) '根据连接,设置控件可操作性
End If
Else '服务存在且启用状态
TsBtnStartService.Enabled = True
TsBtnCloseService.Enabled = True
TsBtnRestartService.Enabled = True
TsBtnConnService.Enabled = True
TsBtnServiceInstall.Enabled = True
TsBtnServiceUninstall.Enabled = True
Try
If _tcpClient Is Nothing Then
InitTcpClient()
_tcpClient.Open()
ElseIf _tcpClient.IsOpen = False Then
_tcpClient.Open()
End If
UpdateTcpTip(_tcpClient.IsOpen) '更新连接提示
UpdateConnectionEnabled(_tcpClient.IsOpen) '根据连接,设置控件可操作性
Catch ex As Exception
Console.WriteLine($"Tcp Client Open Error:{ex.Message}")
End Try
End If
End Sub
''' <summary>
''' 工具栏检测服务按键
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnTestingServices_Click(sender As Object, e As EventArgs) Handles TsBtnTestingServices.Click
If _service Is Nothing Then Return
UpdateServiceStatusTip(_service.ServicesStatus())
End Sub
''' <summary>
''' 工具栏点击一键安装
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnServiceInstall_Click(sender As Object, e As EventArgs) Handles TsBtnServiceInstall.Click
Try
_service.InstallService()
MsgBox($"{_service.Name}服务安装成功!")
Catch ex As Exception
MsgBox($"InstallService Error:{ex.Message}")
End Try
UpdateServiceStatusTip(_service.ServicesStatus())
End Sub
''' <summary>
''' 工具栏卸载按键
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnServiceUninstall_Click(sender As Object, e As EventArgs) Handles TsBtnServiceUninstall.Click
If MsgBox($"是否确定卸载操作", MsgBoxStyle.OkCancel) <> MsgBoxResult.Ok Then Return
Try
_service.UnInstallService()
MsgBox($"{_service.Name}服务卸载成功!")
Catch ex As Exception
MsgBox($"UnInstallService Error:{ex.Message}")
End Try
UpdateServiceStatusTip(_service.ServicesStatus())
End Sub
''' <summary>
''' 工具栏启用服务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnStartService_Click(sender As Object, e As EventArgs) Handles TsBtnStartService.Click
Try
_service.StartService()
Catch ex As Exception
MsgBox($"StartService Error:{ex.Message}")
End Try
UpdateServiceStatusTip(_service.ServicesStatus())
End Sub
''' <summary>
''' 工具栏停止服务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnCloseService_Click(sender As Object, e As EventArgs) Handles TsBtnCloseService.Click
Try
_service.StopService()
Catch ex As Exception
MsgBox($"StopService Error:{ex.Message}")
End Try
UpdateServiceStatusTip(_service.ServicesStatus())
End Sub
''' <summary>
''' 工具栏重启服务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnRestartService_Click(sender As Object, e As EventArgs) Handles TsBtnRestartService.Click
Try
_service.RestartService()
Catch ex As Exception
MsgBox($"RestartService Error:{ex.Message}")
End Try
UpdateServiceStatusTip(_service.ServicesStatus())
End Sub
#End Region
#Region "任务表格操作"
Enum ColNameEnum
Sn
Act
Type
Name
Max
End Enum
Private Sub InitGrid()
With Grid1
.NewFile()
.BorderStyle = FlexCell.BorderStyleEnum.None
.BackColorBkg = Color.Transparent
.DisplayRowNumber = True
.AutoRedraw = False
.ExtendLastCol = True
.Rows = 1
.Cols = ColNameEnum.Max
.Column(ColNameEnum.Sn).Width = 20
.Column(ColNameEnum.Act).Width = 30
.Column(ColNameEnum.Type).Width = 40
.Column(ColNameEnum.Act).CellType = FlexCell.CellTypeEnum.CheckBox
For col As Integer = 0 To ColNameEnum.Max - 1
.Cell(0, col).Text = [Enum].GetName(GetType(ColNameEnum), col) '设置列名
Next
.AutoRedraw = True
.Refresh()
End With
End Sub
Private Sub Grid1_SelChange(sender As Object, e As FlexCell.Grid.SelChangeEventArgs) Handles Grid1.SelChange
If e.FirstRow > 0 Then
TabTasks.SelectedIndex = e.FirstRow - 1
End If
End Sub
#End Region
#Region "服务通讯"
Private _tcpClient As AutsTcpClient
''' <summary>
''' 连接服务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnConnService_Click(sender As Object, e As EventArgs) Handles TsBtnConnService.Click
UpdateTcpClient()
End Sub
''' <summary>
''' 初始化网络套接字
''' 注册表中无端口号时会引发异常
''' </summary>
Private Sub InitTcpClient()
Static remoteIp As String = "127.0.0.1"
Static remotePort As Integer = -1 '默认55533,实际使用从注册表中获取
remotePort = CInt(UtsRegistry.DataServicePort)
_tcpClient = New AutsTcpClient(remoteIp, remotePort)
End Sub
Private Sub UpdateTcpClient()
Dim tcpConnect As Boolean
If _tcpClient IsNot Nothing AndAlso _tcpClient.IsOpen Then
_tcpClient.Close()
tcpConnect = False
Else
Try
InitTcpClient()
_tcpClient.Open()
tcpConnect = True
Catch ex As Exception
Console.WriteLine($"Open Tcp Client Error:{ex.Message}")
tcpConnect = False
End Try
End If
UpdateTcpTip(tcpConnect) '更新连接提示
UpdateConnectionEnabled(tcpConnect) '根据连接,设置控件可操作性
End Sub
''' <summary>
''' 更新网络的提示状态
''' </summary>
''' <param name="connected">是否连接成功</param>
Private Sub UpdateTcpTip(connected As Boolean)
If connected Then
TssLblConnState.Text = $"已建立TCP连接"
TssLblConnState.ForeColor = Color.Green
TsBtnConnService.Text = $"断连服务"
TsBtnConnService.ForeColor = Color.Red
Else
TssLblConnState.Text = $"无TCP连接"
TssLblConnState.ForeColor = Color.Red
TsBtnConnService.Text = $"连接服务"
TsBtnConnService.ForeColor = Color.Green
End If
End Sub
Private Sub UpdateConnectionEnabled(connected As Boolean)
TsBtDelTasks.Enabled = connected
TsBtnAddTasks.Enabled = connected
TsBtnStartTasks.Enabled = connected
TsBtnStopTasks.Enabled = connected
TsBtnRestartTasks.Enabled = connected
TsBtnGetTask.Enabled = connected
TsBtnSetTasks.Enabled = connected
End Sub
#End Region
#Region "任务命令"
''' <summary> 公共用户 </summary>
Private _user As String = "Root"
Private _tasks As New TaskForms
''' <summary>
''' 校验回复字符串
''' </summary>
''' <param name="replyString"></param>
''' <param name="cmdName"></param>
''' <returns></returns>
Private Function CheckReplyString(replyString As String, cmdName As TaskJsonParam.CmdNamesEnum) As TaskJsonParam
If String.IsNullOrWhiteSpace(replyString) Then Return Nothing
Dim replyParam As TaskJsonParam
replyParam = TaskJsonParam.DeserializeFormJson(replyString)
If replyParam.CmdName <> cmdName Then Return Nothing
Return replyParam
End Function
''' <summary>
''' 添加任务
''' </summary>
Private Sub AddTasks()
_addFrom = New FrmAddTask
If _addFrom.ShowDialog <> DialogResult.OK Then Return
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.AddTasks, _user, Application.ProductName)
taskParam.TasksInfo.Add(_addFrom.TaskForm.GetParams())
ServiceCommunicator(taskParam)
_addFrom.Dispose()
End Sub
Private Sub AddTaskGrid(taskStatus As String, taskType As String, taskName As String)
Grid1.AddItem("")
Grid1.Cell(Grid1.Rows - 1, ColNameEnum.Act).Text = CStr(IIf(taskStatus = "Start", "1", "0"))
Grid1.Cell(Grid1.Rows - 1, ColNameEnum.Type).Text = taskType
Grid1.Cell(Grid1.Rows - 1, ColNameEnum.Name).Text = taskName
Grid1.Cell(Grid1.Rows - 1, ColNameEnum.Sn).SetFocus()
End Sub
Private Sub ChangeTaskGrid(taskStatus As String, taskType As String, taskName As String)
Grid1.Cell(Grid1.Rows - 1, ColNameEnum.Act).Text = CStr(IIf(taskStatus = "Start", "1", "0"))
Grid1.Cell(Grid1.Rows - 1, ColNameEnum.Type).Text = taskType
Grid1.Cell(Grid1.Rows - 1, ColNameEnum.Name).Text = taskName
Grid1.Cell(Grid1.Rows - 1, ColNameEnum.Sn).SetFocus()
End Sub
Private Sub AddTaskForm(taskForm As ITaskForm)
Dim tp As New TabPage
taskForm.ShowForm(tp)
TabTasks.TabPages.Add(tp)
End Sub
Private Sub RemoveTaskGrid(index As Integer)
Grid1.Row(index + 1).Delete()
End Sub
Private Sub RemoveAtTaskForm(index As Integer)
TabTasks.TabPages.RemoveAt(index)
End Sub
Private Sub StartTaskForm(index As Integer)
Grid1.Cell(index + 1, ColNameEnum.Act).Text = "1"
End Sub
Private Sub StopTaskForm(index As Integer)
Grid1.Cell(index + 1, ColNameEnum.Act).Text = "0"
End Sub
''' <summary>
''' 删除任务
''' </summary>
Private Sub DeleteTasks()
If MsgBox("是否删除当前任务?", MsgBoxStyle.OkCancel) <> MsgBoxResult.Ok Then Return
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.DeleteTasks, _user, Application.ProductName)
taskParam.TasksName.Add(Grid1.Cell(TabTasks.SelectedIndex + 1, ColNameEnum.Name).Text)
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 开启任务
''' </summary>
Private Sub StartTasks()
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.StartTasks, _user, Application.ProductName)
taskParam.TasksName.Add(Grid1.Cell(TabTasks.SelectedIndex + 1, ColNameEnum.Name).Text)
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 暂停任务
''' </summary>
Private Sub StopTasks()
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.StopTasks, _user, Application.ProductName)
taskParam.TasksName.Add(Grid1.Cell(TabTasks.SelectedIndex + 1, ColNameEnum.Name).Text)
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 获取任务参数
''' </summary>
Private Sub GetTasksParam()
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.GetTasks, _user, Application.ProductName)
taskParam.TasksName.Add(Grid1.Cell(TabTasks.SelectedIndex + 1, ColNameEnum.Name).Text)
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 设置任务参数
''' </summary>
Private Sub SetTasksParam()
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.SetTasks, _user, Application.ProductName)
taskParam.TasksName.Add(Grid1.Cell(TabTasks.SelectedIndex + 1, ColNameEnum.Name).Text)
taskParam.TasksInfo.Add(_tasks.GetParams(TabTasks.SelectedIndex))
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 重启任务,立即执行
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnRestartTasks_Click(sender As Object, e As EventArgs) Handles TsBtnRestartTasks.Click
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.RestartTasks, _user, Application.ProductName)
taskParam.TasksName.Add(Grid1.Cell(TabTasks.SelectedIndex + 1, ColNameEnum.Name).Text)
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 工具栏添加任务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnAddTasks_Click(sender As Object, e As EventArgs) Handles TsBtnAddTasks.Click, CmsBtnAddTasks.Click
AddTasks()
End Sub
''' <summary>
''' 工具栏删除任务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtDelTasks_Click(sender As Object, e As EventArgs) Handles TsBtDelTasks.Click, CmsBtnDeleteTasks.Click
DeleteTasks()
End Sub
''' <summary>
''' 工具栏开启任务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnStartTasks_Click(sender As Object, e As EventArgs) Handles TsBtnStartTasks.Click, CmsBtnStartTasks.Click
StartTasks()
End Sub
''' <summary>
''' 工具栏暂停任务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnStopTasks_Click(sender As Object, e As EventArgs) Handles TsBtnStopTasks.Click, CmsBtnStopTasks.Click
StopTasks()
End Sub
''' <summary>
''' 工具栏获取任务参数
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnGetTask_Click(sender As Object, e As EventArgs) Handles TsBtnGetTask.Click, CmsBtnGetTasks.Click
GetTasksParam()
End Sub
''' <summary>
''' 工具栏设置任务参数
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsBtnSetTasks_Click(sender As Object, e As EventArgs) Handles TsBtnSetTasks.Click, CmsBtnSetTasks.Click
SetTasksParam()
End Sub
''' <summary>
''' 右键菜单全部开启任务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub CmsBtnStartAllTasks_Click(sender As Object, e As EventArgs) Handles CmsBtnStartAllTasks.Click
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.StartAllTasks, _user, Application.ProductName)
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 右键菜单全部暂停任务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub CmsBtnStopAllTasks_Click(sender As Object, e As EventArgs) Handles CmsBtnStopAllTasks.Click
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.StopAllTasks, _user, Application.ProductName)
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 右键菜单全部删除任务
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub CmsBtnDeleteAllTasks_Click(sender As Object, e As EventArgs) Handles CmsBtnDeleteAllTasks.Click
If MsgBox("是否删除所有任务?", MsgBoxStyle.OkCancel) <> MsgBoxResult.Ok Then Return
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.DeleteAllTasks, _user, Application.ProductName)
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 右键菜单获取全部任务参数
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub CmsBtnGetAllTasks_Click(sender As Object, e As EventArgs) Handles CmsBtnGetAllTasks.Click, CmsBtnRefreshList.Click
Dim taskParam As New TaskJsonParam(TaskJsonParam.CmdNamesEnum.GetAllTasks, _user, Application.ProductName)
ServiceCommunicator(taskParam)
End Sub
''' <summary>
''' 与服务通讯,包含发送,接收,处理过程
'''→◆Recv: '接收
'''←◇Send: '发送
''' </summary>
''' <param name="taskParam"></param>
Private Sub ServiceCommunicator(taskParam As TaskJsonParam)
Dim aTime As String = Date.Now.ToString("yyyy-MM-dd HH:mm:ss:fff ")
Try
Dim jsonString As String = TaskJsonParam.SerializeToJson(taskParam) & vbCrLf
_tcpClient.WriteJsonString(jsonString) '发送数据
AppendTextTip($"←◇Send[{aTime}]{vbLf}", Color.Gray)
AppendTextTip($"{jsonString}{vbCrLf}", Color.Blue)
Catch ex As Exception
MsgBox($"SendJsonString Error:{ex.Message}")
Return
End Try
Dim replyString As String = _tcpClient.ReadJsonString()
Try
Dim replyParam As TaskJsonParam = CheckReplyString(replyString, taskParam.CmdName) '接收数据校验
AppendTextTip($"→◆Recv[{aTime}]{vbLf}", Color.Gray)
AppendTextTip($"{replyString}{vbCrLf}", Color.Green)
If replyParam.CmdStatus = TaskJsonParam.CmdStatusEnum.Pass.ToString() Then
DealFunction(replyParam)
TssLblExcuteTip.Text = $"Cmd:{replyParam.CmdName},Excute Pass!"
TssLblExcuteTip.ForeColor = Color.Green
Else
TssLblExcuteTip.Text = $"Cmd:{replyParam.CmdName} {replyParam.CmdStatus},Msg:{replyParam.CmdMsg}"
TssLblExcuteTip.ForeColor = Color.Red
End If
Catch ex As Exception
TssLblExcuteTip.Text = $"Cmd:{taskParam.CmdName} Deal ReplyString Error:{ex.Message}"
TssLblExcuteTip.ForeColor = Color.Blue
Return
End Try
End Sub
Private Sub DealFunction(replyParam As TaskJsonParam)
Select Case replyParam.CmdName
Case TaskJsonParam.CmdNamesEnum.AddTasks
DealAddTasks(replyParam)
Case TaskJsonParam.CmdNamesEnum.DeleteTasks
DealDeleteTasks(replyParam)
Case TaskJsonParam.CmdNamesEnum.StartTasks, TaskJsonParam.CmdNamesEnum.RestartTasks
DealStartTasks(replyParam)
Case TaskJsonParam.CmdNamesEnum.StopTasks
DealStopTasks(replyParam)
Case TaskJsonParam.CmdNamesEnum.GetTasks
DealGetTasks(replyParam)
Case TaskJsonParam.CmdNamesEnum.SetTasks
DealSetTasks(replyParam)
Case TaskJsonParam.CmdNamesEnum.StartAllTasks, TaskJsonParam.CmdNamesEnum.RestartAllTasks
DealStartAllTasks(replyParam)
Case TaskJsonParam.CmdNamesEnum.StopAllTasks
DealStopAllTasks(replyParam)
Case TaskJsonParam.CmdNamesEnum.DeleteAllTasks
DealDeleteAllTasks(replyParam)
Case TaskJsonParam.CmdNamesEnum.GetAllTasks
DealGetAllTasks(replyParam)
End Select
End Sub
Private Sub DealStartAllTasks(replyParam As TaskJsonParam)
For i As Integer = 1 To Grid1.Rows - 1
Grid1.Cell(i, ColNameEnum.Act).Text = "1"
Next
End Sub
Private Sub DealStopAllTasks(replyParam As TaskJsonParam)
For i As Integer = 1 To Grid1.Rows - 1
Grid1.Cell(i, ColNameEnum.Act).Text = "0"
Next
End Sub
Private Sub DealDeleteAllTasks(replyParam As TaskJsonParam)
Grid1.Rows = 1
TabTasks.TabPages.Clear()
_tasks.Clear()
End Sub
Private Sub DealGetAllTasks(replyParam As TaskJsonParam)
DealDeleteAllTasks(replyParam)
For Each taskInfo As Dictionary(Of String, String) In replyParam.TasksInfo
Dim taskType As ServiceTask.ServiceTaskTypeEnum = CType([Enum].Parse(GetType(ServiceTask.ServiceTaskTypeEnum), taskInfo("Type")), ServiceTask.ServiceTaskTypeEnum)
Dim taskForm As ITaskForm
Select Case taskType
Case ServiceTask.ServiceTaskTypeEnum.DbSync
taskForm = New FrmSyncTasks()
Case ServiceTask.ServiceTaskTypeEnum.ListenJsonFile
taskForm = New FrmListenTasks()
Case Else
Throw New Exception($"Unknow TaskType:{taskType}")
End Select
_tasks.Add(taskForm)
AddTaskForm(taskForm)
AddTaskGrid(taskInfo("Status"), taskInfo("Type"), taskInfo("Name"))
taskForm.SetParam(taskInfo)
Next
End Sub
Private _addFrom As FrmAddTask
Private Sub DealAddTasks(replyParam As TaskJsonParam)
_tasks.Add(_addFrom.TaskForm)
AddTaskForm(_addFrom.TaskForm)
AddTaskGrid("0", _addFrom.TaskForm.GetParams("Type"), _addFrom.TaskForm.GetParams("Name"))
End Sub
Private Sub DealDeleteTasks(replyParam As TaskJsonParam)
_tasks.RemoveAt(TabTasks.SelectedIndex)
RemoveTaskGrid(TabTasks.SelectedIndex)
RemoveAtTaskForm(TabTasks.SelectedIndex)
End Sub
Private Sub DealStartTasks(replyParam As TaskJsonParam)
_tasks.SetStatus(TabTasks.SelectedIndex, ServiceTask.ServiceTaskStatusEnum.Start)
StartTaskForm(TabTasks.SelectedIndex)
End Sub
Private Sub DealStopTasks(replyParam As TaskJsonParam)
_tasks.SetStatus(TabTasks.SelectedIndex, ServiceTask.ServiceTaskStatusEnum.Stop)
StopTaskForm(TabTasks.SelectedIndex)
End Sub
Private Sub DealGetTasks(replyParam As TaskJsonParam)
For Each taskInfo As Dictionary(Of String, String) In replyParam.TasksInfo
If taskInfo.ContainsKey("Name") Then
If _tasks.GetParams(TabTasks.SelectedIndex).Item("Name") = taskInfo.Item("Name") Then
ChangeTaskGrid(taskInfo("Status"), taskInfo("Type"), taskInfo("Name"))
_tasks.SetParams(TabTasks.SelectedIndex, taskInfo)
Else
Console.WriteLine($"Unsearch Name:{taskInfo.Item("Name")}")
End If
Else
Console.WriteLine($"UnExitst Name Filed!")
End If
Next
End Sub
Private Sub DealSetTasks(replyParam As TaskJsonParam)
End Sub
#End Region
#Region "添加通讯记录"
Private _isShowLog As Boolean = True '是否显示通讯记录数据
Private _isShowTip As Boolean = True '是否显示通讯记录提示
Private _isClosing As Boolean = False '是否窗体处于关闭状态
''' <summary>
''' 添加记录并设置格式
''' </summary>
''' <param name="str">添加的记录内容</param>
''' <param name="cor">需要设置的记录颜色</param>
Private Sub AppendTextTip(ByVal str As String, ByVal cor As Color)
Dim selStart As Integer
Dim selLength As Integer
selStart = RtxCommunicationLogs.TextLength
RtxCommunicationLogs.AppendText(str)
RtxCommunicationLogs.ScrollToCaret() '关键语句:将焦点滚动到文本内容后
selLength = RtxCommunicationLogs.TextLength - selStart
RtxCommunicationLogs.Select(selStart, selLength)
RtxCommunicationLogs.SelectionColor = cor
End Sub
Private Sub AppendTipText(recordString As String, col As Color)
If _isClosing Then Return
If _isShowTip = False Then Return
If RtxCommunicationLogs.InvokeRequired Then
RtxCommunicationLogs.Invoke(New Action(Sub()
If RtxCommunicationLogs.Lines.Count >= 256 Then RtxCommunicationLogs.Clear()
AppendTextTip($"{recordString}", col)
RtxCommunicationLogs.ScrollToCaret()
End Sub))
Else
If RtxCommunicationLogs.Lines.Count >= 256 Then RtxCommunicationLogs.Clear()
AppendTextTip($"{recordString}", col)
RtxCommunicationLogs.ScrollToCaret()
End If
End Sub
''' <summary>
''' 点击是否收起通讯日志
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsmPackUpRecord_Click(sender As Object, e As EventArgs) Handles TsmPackUpRecord.Click
SplMain.Panel2Collapsed = Not SplMain.Panel2Collapsed
If Not SplMain.Panel2Collapsed Then
TsmPackUpRecord.Text = $"隐藏通讯日志"
Else
TsmPackUpRecord.Text = $"显示通讯日志"
End If
End Sub
''' <summary>
''' 点击清空通讯日志
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub TsmClearRecord_Click(sender As Object, e As EventArgs) Handles TsmClearRecord.Click
RtxCommunicationLogs.Clear()
End Sub
#End Region
#Region "一键配置更新"
Private Sub TsmConfigUpdate_Click(sender As Object, e As EventArgs) Handles TsmConfigUpdate.Click
Dim root As String = $"software\AUTS"
If UtsRegistry.RootDirExists = False Then
Try
Microsoft.Win32.Registry.LocalMachine.CreateSubKey($"{root}\LocalDb")
Microsoft.Win32.Registry.LocalMachine.CreateSubKey($"{root}\AUTS_DataService")
Microsoft.Win32.Registry.LocalMachine.CreateSubKey($"{root}\AUTS_UpdateService")
Catch ex As Exception
Console.WriteLine($"创建注册表项失败! 失败原因:{ex.Message}")
End Try
End If
'配置更新
Dim result As DialogResult = FrmUpdateConfig.ShowDialog()
InitSerName()
End Sub
#End Region
#Region "关闭窗体"
Private Sub FrmMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
End Sub
Private Sub 卸载服务ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 卸载服务ToolStripMenuItem.Click
Dim filePath As String
Using fileOpen As OpenFileDialog = New OpenFileDialog()
fileOpen.Filter = $"服务执行程序(*.exe)|*.exe"
If fileOpen.ShowDialog() <> DialogResult.OK Then
Return
End If
filePath = fileOpen.FileName
End Using
If WinService.UnInstallService(filePath, Nothing) Then
MsgBox($"路径:{filePath},卸载服务成功")
Else
MsgBox($"路径:{filePath},卸载服务失败!")
End If
End Sub
Private Sub 输入路径卸载服务ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 输入路径卸载服务ToolStripMenuItem.Click
Dim filePath As String = InputBox($"请输入服务执行文件路径", "卸载服务")
If String.IsNullOrWhiteSpace(filePath) Then
MsgBox($"路径:{filePath},是无效路径,请重新输入!")
Return
End If
If WinService.UnInstallService(filePath, Nothing) Then
MsgBox($"路径:{filePath},卸载服务成功")
Else
MsgBox($"路径:{filePath},卸载服务失败!")
End If
End Sub
#End Region
End Class

View File

@@ -0,0 +1,288 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FrmRegistry
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.Licnese = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.TBoLicnese = New System.Windows.Forms.TextBox()
Me.TBoDataSerPath = New System.Windows.Forms.TextBox()
Me.TBoUpDateSerPath = New System.Windows.Forms.TextBox()
Me.BtnLicense = New System.Windows.Forms.Button()
Me.BtnDataSerPath = New System.Windows.Forms.Button()
Me.BtnUpDateSerPath = New System.Windows.Forms.Button()
Me.BtnDefault = New System.Windows.Forms.Button()
Me.BtnSaveTheKeyValue = New System.Windows.Forms.Button()
Me.BtnCloseFrmRegistry = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.TBoLocalDb = New System.Windows.Forms.TextBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.BtnLocalDb = New System.Windows.Forms.Button()
Me.Label5 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.TBoDataServiceVersion = New System.Windows.Forms.TextBox()
Me.TBoUpdateServiceVersion = New System.Windows.Forms.TextBox()
Me.Panel1.SuspendLayout()
Me.SuspendLayout()
'
'Licnese
'
Me.Licnese.AutoSize = True
Me.Licnese.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Licnese.Location = New System.Drawing.Point(14, 22)
Me.Licnese.Name = "Licnese"
Me.Licnese.Size = New System.Drawing.Size(56, 14)
Me.Licnese.TabIndex = 0
Me.Licnese.Text = "Licnese"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(14, 190)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(84, 14)
Me.Label2.TabIndex = 1
Me.Label2.Text = "DataSerPath"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label3.Location = New System.Drawing.Point(14, 232)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(98, 14)
Me.Label3.TabIndex = 2
Me.Label3.Text = "UpdateSerPath" & Global.Microsoft.VisualBasic.ChrW(9)
'
'TBoLicnese
'
Me.TBoLicnese.Location = New System.Drawing.Point(117, 21)
Me.TBoLicnese.Name = "TBoLicnese"
Me.TBoLicnese.Size = New System.Drawing.Size(159, 21)
Me.TBoLicnese.TabIndex = 3
'
'TBoDataSerPath
'
Me.TBoDataSerPath.Location = New System.Drawing.Point(118, 189)
Me.TBoDataSerPath.Name = "TBoDataSerPath"
Me.TBoDataSerPath.Size = New System.Drawing.Size(159, 21)
Me.TBoDataSerPath.TabIndex = 4
'
'TBoUpDateSerPath
'
Me.TBoUpDateSerPath.Location = New System.Drawing.Point(118, 231)
Me.TBoUpDateSerPath.Name = "TBoUpDateSerPath"
Me.TBoUpDateSerPath.Size = New System.Drawing.Size(159, 21)
Me.TBoUpDateSerPath.TabIndex = 5
'
'BtnLicense
'
Me.BtnLicense.Location = New System.Drawing.Point(283, 19)
Me.BtnLicense.Name = "BtnLicense"
Me.BtnLicense.Size = New System.Drawing.Size(52, 23)
Me.BtnLicense.TabIndex = 6
Me.BtnLicense.Text = "自定义"
Me.BtnLicense.UseVisualStyleBackColor = True
'
'BtnDataSerPath
'
Me.BtnDataSerPath.Location = New System.Drawing.Point(283, 187)
Me.BtnDataSerPath.Name = "BtnDataSerPath"
Me.BtnDataSerPath.Size = New System.Drawing.Size(52, 23)
Me.BtnDataSerPath.TabIndex = 7
Me.BtnDataSerPath.Text = "自定义"
Me.BtnDataSerPath.UseVisualStyleBackColor = True
'
'BtnUpDateSerPath
'
Me.BtnUpDateSerPath.Location = New System.Drawing.Point(283, 229)
Me.BtnUpDateSerPath.Name = "BtnUpDateSerPath"
Me.BtnUpDateSerPath.Size = New System.Drawing.Size(52, 23)
Me.BtnUpDateSerPath.TabIndex = 8
Me.BtnUpDateSerPath.Text = "自定义"
Me.BtnUpDateSerPath.UseVisualStyleBackColor = True
'
'BtnDefault
'
Me.BtnDefault.Location = New System.Drawing.Point(20, 326)
Me.BtnDefault.Name = "BtnDefault"
Me.BtnDefault.Size = New System.Drawing.Size(75, 30)
Me.BtnDefault.TabIndex = 9
Me.BtnDefault.Text = "默认值"
Me.BtnDefault.UseVisualStyleBackColor = True
'
'BtnSaveTheKeyValue
'
Me.BtnSaveTheKeyValue.Location = New System.Drawing.Point(204, 326)
Me.BtnSaveTheKeyValue.Name = "BtnSaveTheKeyValue"
Me.BtnSaveTheKeyValue.Size = New System.Drawing.Size(75, 30)
Me.BtnSaveTheKeyValue.TabIndex = 10
Me.BtnSaveTheKeyValue.Text = "应用"
Me.BtnSaveTheKeyValue.UseVisualStyleBackColor = True
'
'BtnCloseFrmRegistry
'
Me.BtnCloseFrmRegistry.Location = New System.Drawing.Point(296, 326)
Me.BtnCloseFrmRegistry.Name = "BtnCloseFrmRegistry"
Me.BtnCloseFrmRegistry.Size = New System.Drawing.Size(75, 30)
Me.BtnCloseFrmRegistry.TabIndex = 11
Me.BtnCloseFrmRegistry.Text = "取消"
Me.BtnCloseFrmRegistry.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(136, 21)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(93, 16)
Me.Label1.TabIndex = 12
Me.Label1.Text = "注册表信息"
'
'Panel1
'
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Panel1.Controls.Add(Me.Label5)
Me.Panel1.Controls.Add(Me.Label6)
Me.Panel1.Controls.Add(Me.TBoDataServiceVersion)
Me.Panel1.Controls.Add(Me.TBoUpdateServiceVersion)
Me.Panel1.Controls.Add(Me.TBoLocalDb)
Me.Panel1.Controls.Add(Me.Label4)
Me.Panel1.Controls.Add(Me.BtnLocalDb)
Me.Panel1.Controls.Add(Me.TBoLicnese)
Me.Panel1.Controls.Add(Me.Licnese)
Me.Panel1.Controls.Add(Me.Label2)
Me.Panel1.Controls.Add(Me.Label3)
Me.Panel1.Controls.Add(Me.TBoDataSerPath)
Me.Panel1.Controls.Add(Me.BtnUpDateSerPath)
Me.Panel1.Controls.Add(Me.TBoUpDateSerPath)
Me.Panel1.Controls.Add(Me.BtnDataSerPath)
Me.Panel1.Controls.Add(Me.BtnLicense)
Me.Panel1.Location = New System.Drawing.Point(12, 53)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(369, 267)
Me.Panel1.TabIndex = 13
'
'TBoLocalDb
'
Me.TBoLocalDb.Location = New System.Drawing.Point(117, 63)
Me.TBoLocalDb.Name = "TBoLocalDb"
Me.TBoLocalDb.Size = New System.Drawing.Size(159, 21)
Me.TBoLocalDb.TabIndex = 10
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label4.Location = New System.Drawing.Point(14, 64)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(56, 14)
Me.Label4.TabIndex = 9
Me.Label4.Text = "LocalDb"
'
'BtnLocalDb
'
Me.BtnLocalDb.Location = New System.Drawing.Point(283, 61)
Me.BtnLocalDb.Name = "BtnLocalDb"
Me.BtnLocalDb.Size = New System.Drawing.Size(52, 23)
Me.BtnLocalDb.TabIndex = 11
Me.BtnLocalDb.Text = "自定义"
Me.BtnLocalDb.UseVisualStyleBackColor = True
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label5.Location = New System.Drawing.Point(13, 106)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(70, 14)
Me.Label5.TabIndex = 12
Me.Label5.Text = "DSVersion"
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label6.Location = New System.Drawing.Point(14, 148)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(70, 14)
Me.Label6.TabIndex = 13
Me.Label6.Text = "USVersion"
'
'TBoDataServiceVersion
'
Me.TBoDataServiceVersion.Location = New System.Drawing.Point(117, 105)
Me.TBoDataServiceVersion.Name = "TBoDataServiceVersion"
Me.TBoDataServiceVersion.Size = New System.Drawing.Size(159, 21)
Me.TBoDataServiceVersion.TabIndex = 14
'
'TBoUpdateServiceVersion
'
Me.TBoUpdateServiceVersion.Location = New System.Drawing.Point(118, 147)
Me.TBoUpdateServiceVersion.Name = "TBoUpdateServiceVersion"
Me.TBoUpdateServiceVersion.Size = New System.Drawing.Size(159, 21)
Me.TBoUpdateServiceVersion.TabIndex = 15
'
'FrmRegistry
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(395, 371)
Me.Controls.Add(Me.Panel1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.BtnCloseFrmRegistry)
Me.Controls.Add(Me.BtnSaveTheKeyValue)
Me.Controls.Add(Me.BtnDefault)
Me.Name = "FrmRegistry"
Me.Text = " "
Me.Panel1.ResumeLayout(false)
Me.Panel1.PerformLayout
Me.ResumeLayout(false)
Me.PerformLayout
End Sub
Friend WithEvents Licnese As Label
Friend WithEvents Label2 As Label
Friend WithEvents Label3 As Label
Friend WithEvents TBoLicnese As TextBox
Friend WithEvents TBoDataSerPath As TextBox
Friend WithEvents TBoUpDateSerPath As TextBox
Friend WithEvents BtnLicense As Button
Friend WithEvents BtnDataSerPath As Button
Friend WithEvents BtnUpDateSerPath As Button
Friend WithEvents BtnDefault As Button
Friend WithEvents BtnSaveTheKeyValue As Button
Friend WithEvents BtnCloseFrmRegistry As Button
Friend WithEvents Label1 As Label
Friend WithEvents Panel1 As Panel
Friend WithEvents TBoLocalDb As TextBox
Friend WithEvents Label4 As Label
Friend WithEvents BtnLocalDb As Button
Friend WithEvents Label5 As Label
Friend WithEvents Label6 As Label
Friend WithEvents TBoDataServiceVersion As TextBox
Friend WithEvents TBoUpdateServiceVersion As TextBox
End Class

View File

@@ -0,0 +1,186 @@
<?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="Licnese.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TBoLicnese.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TBoDataSerPath.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TBoUpDateSerPath.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BtnLicense.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BtnDataSerPath.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BtnUpDateSerPath.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BtnDefault.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BtnSaveTheKeyValue.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BtnCloseFrmRegistry.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Panel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label5.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label6.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TBoDataServiceVersion.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TBoUpdateServiceVersion.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TBoLocalDb.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BtnLocalDb.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@@ -0,0 +1,198 @@
Imports Microsoft.Win32.Registry
Public Class FrmRegistry
''' <summary>
''' 软件存放在注册表的根路径
''' </summary>
Private ReadOnly _appConfig As String = $"software\AUTS"
Private ReadOnly _dataServiceName As String = $"AUTS_DataService"
Private ReadOnly _updateServiceName As String = $"AUTS_UpdateService"
''' <summary>
''' License可访问的公共路径
''' </summary>
Private ReadOnly _licensePath As String = $"C:\AUTS\Licnese"
''' <summary>
''' 数据库文件夹路径
''' </summary>
Private ReadOnly _localDbDirPath As String = $"C:\AUTS\localDb"
''' <summary>
''' 数据服务的路径
''' </summary>
Private ReadOnly _dataServicePath As String = $"C:\AUTS\DataService"
''' <summary>
''' 更新服务的路径
''' </summary>
Private ReadOnly _updateServicePath As String = $"C:\AUTS\UpdateService"
''' <summary>
''' 自定义选择文件夹
''' </summary>
''' <returns></returns>
Private Function SelectFolderString() As String
Dim txtString As String = String.Empty
Using folder As New FolderBrowserDialog
If folder.ShowDialog() = DialogResult.OK Then
txtString = folder.SelectedPath
End If
End Using
Return txtString
End Function
''' <summary>
''' 自定义选择文件
''' </summary>
''' <returns></returns>
Private Function SelectFileString() As String
Dim txtString As String = String.Empty
Using folder As New OpenFileDialog
If folder.ShowDialog() = DialogResult.OK Then
txtString = folder.FileName
End If
End Using
Return txtString
End Function
''' <summary>
''' License自定义文件夹路径
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnLicense_Click(sender As Object, e As EventArgs) Handles BtnLicense.Click
TBoLicnese.Text = SelectFileString()
End Sub
''' <summary>
''' LocalDb自定义文件夹路径
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnLocalDb_Click(sender As Object, e As EventArgs) Handles BtnLocalDb.Click
TBoLocalDb.Text = SelectFileString()
End Sub
''' <summary>
''' DataServicePath自定义文件夹路径
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnDataSerPath_Click(sender As Object, e As EventArgs) Handles BtnDataSerPath.Click
TBoDataSerPath.Text = SelectFolderString()
End Sub
''' <summary>
''' UpDateServicePath自定义文件夹路径
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnUpDateSerPath_Click(sender As Object, e As EventArgs) Handles BtnUpDateSerPath.Click
TBoUpDateSerPath.Text = SelectFolderString()
End Sub
Private Sub FrmRegistry_Load(sender As Object, e As EventArgs) Handles Me.Load
If Registry.RootDirExists() = False Then
MsgBox("AUTS RootDir Not Exists !")
Return
End If
'获取本地注册表设定值
Dim licensePath As String = Registry.LicensePath
Dim localdbPath As String = Registry.LocalDb
Dim dsName As String = Registry.DataServiceName
Dim dsVer As String = Registry.DataServiceVersion
Dim dsDir As String = $"{Registry.DataServiceDirPath}\{dsVer}"
Dim dsFile As String = Registry.DataServiceExeName
Dim usName As String = Registry.UpdateServiceName
Dim usVer As String = Registry.UpdateServiceVersion
Dim usDir As String = $"{Registry.UpdateServiceDirPath}\{usVer}"
Dim usFile As String = Registry.UpdateServiceExeName
TBoLicnese.Text = licensePath
TBoLocalDb.Text = localdbPath
TBoDataServiceVersion.Text = dsDir
TBoUpdateServiceVersion.Text = usDir
TBoDataSerPath.Text = dsDir
TBoUpDateSerPath.Text = usDir
Console.WriteLine($"dsName:{dsName},dsFile:{dsFile},usName:{usName},usFile:{usFile}!")
End Sub
''' <summary>
''' 应用键值
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnSaveTheKeyValue_Click(sender As Object, e As EventArgs) Handles BtnSaveTheKeyValue.Click
'设置键值
Dim valLicense As String = TBoLicnese.Text
Dim valLocalDb As String = TBoLocalDb.Text
Dim valDSVer As String = TBoDataServiceVersion.Text
Dim valUSVer As String = TBoUpdateServiceVersion.Text
Dim valDataSer As String = TBoDataSerPath.Text
Dim valUpdateSer As String = TBoUpDateSerPath.Text
'创建项
Registry.LicensePath = valLicense
Registry.LocalDb = valLocalDb
Registry.DataServiceName = _dataServiceName
Registry.DataServiceVersion = valDSVer
Registry.DataServiceDirPath = valDataSer
Registry.DataServiceExeName = $"{_dataServiceName}.exe"
Registry.UpdateServiceName = _updateServiceName
Registry.UpdateServiceVersion = valUSVer
Registry.UpdateServiceDirPath = valUpdateSer
Registry.UpdateServiceExeName = $"{_updateServiceName}.exe"
If MsgBox($"Save Settings Success!Do you want to close the settings form?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
DialogResult = DialogResult.Yes
End If
End Sub
''' <summary>
''' 默认值按键
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnDefault_Click(sender As Object, e As EventArgs) Handles BtnDefault.Click
'设置键值
TBoLicnese.Text = _licensePath
TBoLocalDb.Text = _localDbDirPath
TBoDataSerPath.Text = _dataServicePath
TBoUpDateSerPath.Text = _updateServicePath
End Sub
''' <summary>
''' 关闭注册表窗体
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnCloseFrmRegistry_Click(sender As Object, e As EventArgs) Handles BtnCloseFrmRegistry.Click
DialogResult = DialogResult.No
End Sub
End Class

View File

@@ -0,0 +1,203 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FrmSyncTasks
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.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.TBoTasksName = New System.Windows.Forms.TextBox()
Me.TBoTasksType = New System.Windows.Forms.TextBox()
Me.TBoConnStringSync = New System.Windows.Forms.TextBox()
Me.BtnRapidGenerating = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label7 = New System.Windows.Forms.Label()
Me.NudTasksInterval = New System.Windows.Forms.NumericUpDown()
Me.CboDbTypeName = New System.Windows.Forms.ComboBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.Label2 = New System.Windows.Forms.Label()
Me.GroupBox1.SuspendLayout()
CType(Me.NudTasksInterval, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Label2)
Me.GroupBox1.Controls.Add(Me.TBoTasksName)
Me.GroupBox1.Controls.Add(Me.TBoTasksType)
Me.GroupBox1.Controls.Add(Me.TBoConnStringSync)
Me.GroupBox1.Controls.Add(Me.BtnRapidGenerating)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.Label7)
Me.GroupBox1.Controls.Add(Me.NudTasksInterval)
Me.GroupBox1.Controls.Add(Me.CboDbTypeName)
Me.GroupBox1.Controls.Add(Me.Label6)
Me.GroupBox1.Controls.Add(Me.Label4)
Me.GroupBox1.Controls.Add(Me.Label5)
Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(394, 212)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "同步任务"
'
'TBoTasksName
'
Me.TBoTasksName.Location = New System.Drawing.Point(259, 26)
Me.TBoTasksName.Name = "TBoTasksName"
Me.TBoTasksName.Size = New System.Drawing.Size(115, 21)
Me.TBoTasksName.TabIndex = 37
'
'TBoTasksType
'
Me.TBoTasksType.Location = New System.Drawing.Point(79, 26)
Me.TBoTasksType.Name = "TBoTasksType"
Me.TBoTasksType.ReadOnly = True
Me.TBoTasksType.Size = New System.Drawing.Size(103, 21)
Me.TBoTasksType.TabIndex = 36
Me.TBoTasksType.Text = "Sync"
'
'TBoConnStringSync
'
Me.TBoConnStringSync.Location = New System.Drawing.Point(43, 125)
Me.TBoConnStringSync.Multiline = True
Me.TBoConnStringSync.Name = "TBoConnStringSync"
Me.TBoConnStringSync.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal
Me.TBoConnStringSync.Size = New System.Drawing.Size(331, 75)
Me.TBoConnStringSync.TabIndex = 35
'
'BtnRapidGenerating
'
Me.BtnRapidGenerating.Location = New System.Drawing.Point(302, 100)
Me.BtnRapidGenerating.Name = "BtnRapidGenerating"
Me.BtnRapidGenerating.Size = New System.Drawing.Size(72, 22)
Me.BtnRapidGenerating.TabIndex = 34
Me.BtnRapidGenerating.Text = "快速生成"
Me.BtnRapidGenerating.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(20, 105)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(65, 12)
Me.Label1.TabIndex = 33
Me.Label1.Text = "连接字符串"
'
'Label7
'
Me.Label7.AutoSize = True
Me.Label7.Location = New System.Drawing.Point(20, 65)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(53, 12)
Me.Label7.TabIndex = 32
Me.Label7.Text = "同步间隔"
'
'NudTasksInterval
'
Me.NudTasksInterval.Location = New System.Drawing.Point(79, 63)
Me.NudTasksInterval.Maximum = New Decimal(New Integer() {65535, 0, 0, 0})
Me.NudTasksInterval.Name = "NudTasksInterval"
Me.NudTasksInterval.Size = New System.Drawing.Size(71, 21)
Me.NudTasksInterval.TabIndex = 31
Me.NudTasksInterval.Value = New Decimal(New Integer() {100, 0, 0, 0})
'
'CboDbTypeName
'
Me.CboDbTypeName.FormattingEnabled = True
Me.CboDbTypeName.Location = New System.Drawing.Point(259, 62)
Me.CboDbTypeName.Name = "CboDbTypeName"
Me.CboDbTypeName.Size = New System.Drawing.Size(115, 20)
Me.CboDbTypeName.TabIndex = 30
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(200, 65)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(53, 12)
Me.Label6.TabIndex = 29
Me.Label6.Text = "数据类型"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(200, 29)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(53, 12)
Me.Label4.TabIndex = 26
Me.Label4.Text = "任务名称"
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(20, 29)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(53, 12)
Me.Label5.TabIndex = 25
Me.Label5.Text = "任务类型"
'
'OpenFileDialog1
'
Me.OpenFileDialog1.FileName = "OpenFileDialog1"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(154, 65)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(35, 12)
Me.Label2.TabIndex = 38
Me.Label2.Text = "(min)"
'
'FrmSyncTasks
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(394, 212)
Me.Controls.Add(Me.GroupBox1)
Me.Name = "FrmSyncTasks"
Me.Text = "FrmSyncTasks"
Me.GroupBox1.ResumeLayout(false)
Me.GroupBox1.PerformLayout
CType(Me.NudTasksInterval,System.ComponentModel.ISupportInitialize).EndInit
Me.ResumeLayout(false)
End Sub
Friend WithEvents GroupBox1 As GroupBox
Friend WithEvents Label7 As Label
Friend WithEvents NudTasksInterval As NumericUpDown
Friend WithEvents CboDbTypeName As ComboBox
Friend WithEvents Label6 As Label
Friend WithEvents Label4 As Label
Friend WithEvents Label1 As Label
Friend WithEvents Label5 As Label
Friend WithEvents TBoConnStringSync As TextBox
Friend WithEvents BtnRapidGenerating As Button
Friend WithEvents TBoTasksName As TextBox
Friend WithEvents TBoTasksType As TextBox
Friend WithEvents OpenFileDialog1 As OpenFileDialog
Friend WithEvents Label2 As Label
End Class

View File

@@ -0,0 +1,123 @@
<?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="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,97 @@
Imports System.Text
Imports UTS_Core.Database.DbExecutor
Imports UTS_Core.UTSModule.Service
Public Class FrmSyncTasks
Implements ITaskForm
Public Property DbType() As DbTypeEnum = DbTypeEnum.Sqlite
''' <summary>
''' 显示窗体
''' </summary>
''' <param name="parentControl">把本窗体打包放在其他容器内</param>
Public Sub ShowForm(parentControl As Control) Implements ITaskForm.ShowForm
FormBorderStyle = FormBorderStyle.None
TopLevel = False
Dock = DockStyle.Fill
Parent = parentControl
Show()
End Sub
Private Sub FrmSyncTasks_Load(sender As Object, e As EventArgs) Handles Me.Load
TBoTasksType.Text = ServiceTask.ServiceTaskTypeEnum.DbSync.ToString()
CboDbTypeName.DropDownStyle = ComboBoxStyle.DropDownList
CboDbTypeName.Items.Clear()
CboDbTypeName.Items.Add(DbTypeEnum.Mysql.ToString())
CboDbTypeName.Items.Add(DbTypeEnum.Sqlite.ToString())
If CboDbTypeName.Items.Count > DbType Then
CboDbTypeName.SelectedIndex = DbType
End If
End Sub
''' <summary>
''' 根据类型不同快速生成ConnJsonString
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnRapidGenerating_Click(sender As Object, e As EventArgs) Handles BtnRapidGenerating.Click
TBoConnStringSync.Text = RapidGenerating()
End Sub
''' <summary>
''' 快捷生成数据库连接字符串
''' </summary>
''' <returns></returns>
Private Function RapidGenerating() As String
Dim connStr As New StringBuilder
FrmTasksDbType.DbType = DbType
If FrmTasksDbType.ShowDialog = DialogResult.OK Then
connStr.Append(FrmTasksDbType.ConnectionParam.ToString())
connStr = connStr.Replace("\", "/")
End If
Return UTS_Core.Security.Aes128.EncryptStr(connStr.ToString, UTS_Core.Security.Aes128.ServerAesKey)
End Function
Public Sub SetParam(params As Dictionary(Of String, String)) Implements ITaskForm.SetParam
For Each param As KeyValuePair(Of String, String) In params
Select Case param.Key
Case "Name"
TBoTasksName.Text = param.Value
Case "Interval"
NudTasksInterval.Value = CInt(param.Value)
Case "LocalDbType"
CboDbTypeName.SelectedIndex = CInt([Enum].Parse(GetType(DbTypeEnum), param.Value))
Case "LocalConnString"
TBoConnStringSync.Text = param.Value
End Select
Next
End Sub
Public Function GetParams() As Dictionary(Of String, String) Implements ITaskForm.GetParams
Dim jsonParam As New Dictionary(Of String, String)
jsonParam.Clear()
jsonParam.Add("Type", TBoTasksType.Text)
jsonParam.Add("Name", TBoTasksName.Text)
jsonParam.Add("Interval", NudTasksInterval.Value.ToString)
jsonParam.Add("LocalDbType", CboDbTypeName.Text)
jsonParam.Add("LocalConnString", TBoConnStringSync.Text)
Return jsonParam
End Function
Private Sub CboDbTypeName_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CboDbTypeName.SelectedIndexChanged
DbType = CType([Enum].Parse(GetType(DbTypeEnum), CboDbTypeName.SelectedIndex.ToString()), DbTypeEnum)
TBoConnStringSync.Text = String.Empty
End Sub
End Class

View File

@@ -0,0 +1,351 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class FrmTasksDbType
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.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
Me.OK_Button = New System.Windows.Forms.Button()
Me.Cancel_Button = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.CboDbTypeName = New System.Windows.Forms.ComboBox()
Me.TabDbTasks = New System.Windows.Forms.TabControl()
Me.TabSqite = New System.Windows.Forms.TabPage()
Me.BtnOpenFile = New System.Windows.Forms.Button()
Me.TboPassWord = New System.Windows.Forms.TextBox()
Me.TboDataSourseName = New System.Windows.Forms.TextBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.TabMySQL = New System.Windows.Forms.TabPage()
Me.Button1 = New System.Windows.Forms.Button()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label8 = New System.Windows.Forms.Label()
Me.TextBox5 = New System.Windows.Forms.TextBox()
Me.Label7 = New System.Windows.Forms.Label()
Me.TextBox3 = New System.Windows.Forms.TextBox()
Me.TextBox4 = New System.Windows.Forms.TextBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.TableLayoutPanel1.SuspendLayout
Me.TabDbTasks.SuspendLayout
Me.TabSqite.SuspendLayout
Me.TabMySQL.SuspendLayout
Me.Panel1.SuspendLayout
Me.SuspendLayout
'
'TableLayoutPanel1
'
Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.TableLayoutPanel1.ColumnCount = 2
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0)
Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0)
Me.TableLayoutPanel1.Location = New System.Drawing.Point(176, 274)
Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
Me.TableLayoutPanel1.RowCount = 1
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 27)
Me.TableLayoutPanel1.TabIndex = 0
'
'OK_Button
'
Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None
Me.OK_Button.Location = New System.Drawing.Point(3, 3)
Me.OK_Button.Name = "OK_Button"
Me.OK_Button.Size = New System.Drawing.Size(67, 21)
Me.OK_Button.TabIndex = 0
Me.OK_Button.Text = "确定"
'
'Cancel_Button
'
Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None
Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Cancel_Button.Location = New System.Drawing.Point(76, 3)
Me.Cancel_Button.Name = "Cancel_Button"
Me.Cancel_Button.Size = New System.Drawing.Size(67, 21)
Me.Cancel_Button.TabIndex = 1
Me.Cancel_Button.Text = "取消"
'
'Label1
'
Me.Label1.AutoSize = true
Me.Label1.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134,Byte))
Me.Label1.Location = New System.Drawing.Point(10, 28)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(77, 14)
Me.Label1.TabIndex = 6
Me.Label1.Text = "数据库类型"
'
'CboDbTypeName
'
Me.CboDbTypeName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.CboDbTypeName.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134,Byte))
Me.CboDbTypeName.FormattingEnabled = true
Me.CboDbTypeName.Location = New System.Drawing.Point(93, 25)
Me.CboDbTypeName.Name = "CboDbTypeName"
Me.CboDbTypeName.Size = New System.Drawing.Size(185, 22)
Me.CboDbTypeName.TabIndex = 4
'
'TabDbTasks
'
Me.TabDbTasks.Appearance = System.Windows.Forms.TabAppearance.FlatButtons
Me.TabDbTasks.Controls.Add(Me.TabMySQL)
Me.TabDbTasks.Controls.Add(Me.TabSqite)
Me.TabDbTasks.Dock = System.Windows.Forms.DockStyle.Fill
Me.TabDbTasks.ItemSize = New System.Drawing.Size(0, 1)
Me.TabDbTasks.Location = New System.Drawing.Point(0, 0)
Me.TabDbTasks.Name = "TabDbTasks"
Me.TabDbTasks.SelectedIndex = 0
Me.TabDbTasks.Size = New System.Drawing.Size(310, 206)
Me.TabDbTasks.SizeMode = System.Windows.Forms.TabSizeMode.Fixed
Me.TabDbTasks.TabIndex = 7
'
'TabSqite
'
Me.TabSqite.Controls.Add(Me.BtnOpenFile)
Me.TabSqite.Controls.Add(Me.TboPassWord)
Me.TabSqite.Controls.Add(Me.TboDataSourseName)
Me.TabSqite.Controls.Add(Me.Label3)
Me.TabSqite.Controls.Add(Me.Label2)
Me.TabSqite.Location = New System.Drawing.Point(4, 5)
Me.TabSqite.Name = "TabSqite"
Me.TabSqite.Size = New System.Drawing.Size(302, 197)
Me.TabSqite.TabIndex = 0
Me.TabSqite.UseVisualStyleBackColor = true
'
'BtnOpenFile
'
Me.BtnOpenFile.Location = New System.Drawing.Point(236, 30)
Me.BtnOpenFile.Name = "BtnOpenFile"
Me.BtnOpenFile.Size = New System.Drawing.Size(26, 21)
Me.BtnOpenFile.TabIndex = 4
Me.BtnOpenFile.Text = "..."
Me.BtnOpenFile.UseVisualStyleBackColor = true
'
'TboPassWord
'
Me.TboPassWord.Location = New System.Drawing.Point(94, 79)
Me.TboPassWord.Name = "TboPassWord"
Me.TboPassWord.Size = New System.Drawing.Size(136, 21)
Me.TboPassWord.TabIndex = 3
'
'TboDataSourseName
'
Me.TboDataSourseName.Location = New System.Drawing.Point(94, 31)
Me.TboDataSourseName.Name = "TboDataSourseName"
Me.TboDataSourseName.Size = New System.Drawing.Size(136, 21)
Me.TboDataSourseName.TabIndex = 2
'
'Label3
'
Me.Label3.AutoSize = true
Me.Label3.Location = New System.Drawing.Point(35, 82)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(53, 12)
Me.Label3.TabIndex = 1
Me.Label3.Text = "密 码"
'
'Label2
'
Me.Label2.AutoSize = true
Me.Label2.Location = New System.Drawing.Point(35, 34)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(53, 12)
Me.Label2.TabIndex = 0
Me.Label2.Text = "数据库名"
'
'TabMySQL
'
Me.TabMySQL.Controls.Add(Me.Button1)
Me.TabMySQL.Controls.Add(Me.TextBox1)
Me.TabMySQL.Controls.Add(Me.TextBox2)
Me.TabMySQL.Controls.Add(Me.Label6)
Me.TabMySQL.Controls.Add(Me.Label8)
Me.TabMySQL.Controls.Add(Me.TextBox5)
Me.TabMySQL.Controls.Add(Me.Label7)
Me.TabMySQL.Controls.Add(Me.TextBox3)
Me.TabMySQL.Controls.Add(Me.TextBox4)
Me.TabMySQL.Controls.Add(Me.Label4)
Me.TabMySQL.Controls.Add(Me.Label5)
Me.TabMySQL.Location = New System.Drawing.Point(4, 5)
Me.TabMySQL.Name = "TabMySQL"
Me.TabMySQL.Size = New System.Drawing.Size(302, 197)
Me.TabMySQL.TabIndex = 1
Me.TabMySQL.Text = "TabPage2"
Me.TabMySQL.UseVisualStyleBackColor = true
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(238, 130)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(32, 27)
Me.Button1.TabIndex = 14
Me.Button1.Text = "..."
Me.Button1.UseVisualStyleBackColor = true
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(96, 103)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(136, 21)
Me.TextBox1.TabIndex = 13
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(96, 76)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(136, 21)
Me.TextBox2.TabIndex = 12
'
'Label6
'
Me.Label6.AutoSize = true
Me.Label6.Location = New System.Drawing.Point(37, 106)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(29, 12)
Me.Label6.TabIndex = 11
Me.Label6.Text = "端口"
'
'Label8
'
Me.Label8.AutoSize = true
Me.Label8.Location = New System.Drawing.Point(37, 79)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(29, 12)
Me.Label8.TabIndex = 10
Me.Label8.Text = "用户"
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(96, 130)
Me.TextBox5.Multiline = true
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(136, 38)
Me.TextBox5.TabIndex = 9
'
'Label7
'
Me.Label7.AutoSize = true
Me.Label7.Location = New System.Drawing.Point(37, 130)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(29, 12)
Me.Label7.TabIndex = 8
Me.Label7.Text = "Path"
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(96, 49)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(136, 21)
Me.TextBox3.TabIndex = 7
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(96, 22)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(136, 21)
Me.TextBox4.TabIndex = 6
'
'Label4
'
Me.Label4.AutoSize = true
Me.Label4.Location = New System.Drawing.Point(37, 52)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(29, 12)
Me.Label4.TabIndex = 5
Me.Label4.Text = "密码"
'
'Label5
'
Me.Label5.AutoSize = true
Me.Label5.Location = New System.Drawing.Point(37, 25)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(53, 12)
Me.Label5.TabIndex = 4
Me.Label5.Text = "数据库名"
'
'Panel1
'
Me.Panel1.Controls.Add(Me.TabDbTasks)
Me.Panel1.Location = New System.Drawing.Point(12, 62)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(310, 206)
Me.Panel1.TabIndex = 8
'
'FrmTasksDbType
'
Me.AcceptButton = Me.OK_Button
Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 12!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.Cancel_Button
Me.ClientSize = New System.Drawing.Size(334, 312)
Me.Controls.Add(Me.Panel1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.CboDbTypeName)
Me.Controls.Add(Me.TableLayoutPanel1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = false
Me.MinimizeBox = false
Me.Name = "FrmTasksDbType"
Me.ShowInTaskbar = false
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "FrmTasksDbType"
Me.TableLayoutPanel1.ResumeLayout(false)
Me.TabDbTasks.ResumeLayout(false)
Me.TabSqite.ResumeLayout(false)
Me.TabSqite.PerformLayout
Me.TabMySQL.ResumeLayout(false)
Me.TabMySQL.PerformLayout
Me.Panel1.ResumeLayout(false)
Me.ResumeLayout(false)
Me.PerformLayout
End Sub
Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
Friend WithEvents OK_Button As System.Windows.Forms.Button
Friend WithEvents Cancel_Button As System.Windows.Forms.Button
Friend WithEvents Label1 As Label
Friend WithEvents CboDbTypeName As ComboBox
Friend WithEvents TabDbTasks As TabControl
Friend WithEvents TabSqite As TabPage
Friend WithEvents TabMySQL As TabPage
Friend WithEvents TboPassWord As TextBox
Friend WithEvents TboDataSourseName As TextBox
Friend WithEvents Label3 As Label
Friend WithEvents Label2 As Label
Friend WithEvents TextBox5 As TextBox
Friend WithEvents Label7 As Label
Friend WithEvents TextBox3 As TextBox
Friend WithEvents TextBox4 As TextBox
Friend WithEvents Label4 As Label
Friend WithEvents Label5 As Label
Friend WithEvents Panel1 As Panel
Friend WithEvents BtnOpenFile As Button
Friend WithEvents Button1 As Button
Friend WithEvents TextBox1 As TextBox
Friend WithEvents TextBox2 As TextBox
Friend WithEvents Label6 As Label
Friend WithEvents Label8 As Label
End Class

View File

@@ -0,0 +1,120 @@
<?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>
</root>

View File

@@ -0,0 +1,105 @@
Imports System.Data.Common
Imports UTS_Core.Database.DbExecutor
Public Class FrmTasksDbType
''' <summary>存Json数据的键值对</summary>
Public ConnectionParam As DbConnectionStringBuilder
''' <summary>
''' 当前需要生成连接的数据库类型
''' </summary>
''' <returns></returns>
Public Property DbType() As DbTypeEnum = DbTypeEnum.Sqlite
''' <summary>
''' 窗体启动
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub FrmTasksDbType_Load(sender As Object, e As EventArgs) Handles Me.Load
ConnectionParam = New DbConnectionStringBuilder
InitTabPages()
CboDbTypeName.DropDownStyle = ComboBoxStyle.DropDownList
CboDbTypeName.Items.Clear()
CboDbTypeName.Items.Add(DbTypeEnum.Mysql.ToString())
CboDbTypeName.Items.Add(DbTypeEnum.Sqlite.ToString())
If CboDbTypeName.Items.Count > DbType Then
CboDbTypeName.SelectedIndex = DbType
End If
End Sub
''' <summary>
''' 隐藏Page表头
''' </summary>
Private Sub InitTabPages()
TabDbTasks.SizeMode = TabSizeMode.Fixed '隐藏TabControl的表头
TabDbTasks.ItemSize = New Size(0, 1)
End Sub
''' <summary>
''' 类型变化(SelectIndex),改变页面
''' 如无必要,不要使用文本改变(TextChanged)
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub CboDbTypeName_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CboDbTypeName.SelectedIndexChanged
TabDbTasks.SelectedIndex = CboDbTypeName.SelectedIndex
End Sub
''' <summary>
''' 打开文件,辅助输入
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnOpenFile_Click(sender As Object, e As EventArgs) Handles BtnOpenFile.Click
Using fileDialog As New OpenFileDialog
fileDialog.InitialDirectory = Application.StartupPath
If fileDialog.ShowDialog() = DialogResult.OK Then
TboDataSourseName.Text = fileDialog.FileName
End If
End Using
End Sub
''' <summary>
''' OK按键
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
Select Case CboDbTypeName.SelectedIndex
Case DbTypeEnum.Sqlite 'sqlite
ConnectionParam.Clear()
ConnectionParam.Add("Data Source", TboDataSourseName.Text)
ConnectionParam.Add("Password", TboPassWord.Text)
Case DbTypeEnum.Mysql 'mysql
ConnectionParam.Clear()
ConnectionParam.Add("Server", TboDataSourseName.Text)
ConnectionParam.Add("Port", TboPassWord.Text)
ConnectionParam.Add("User id", TboPassWord.Text)
ConnectionParam.Add("Password", TboPassWord.Text)
ConnectionParam.Add("Database", TboPassWord.Text)
Case Else
Throw New Exception($"Unknown DbType!")
End Select
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
End Class

View File

@@ -0,0 +1,379 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class FrmUpdateConfig
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.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.TBoRootPath = New System.Windows.Forms.TextBox()
Me.TBoLicnese = New System.Windows.Forms.TextBox()
Me.BtnLicense = New System.Windows.Forms.Button()
Me.BtnRootPath = New System.Windows.Forms.Button()
Me.BtnCancel = New System.Windows.Forms.Button()
Me.BtnStartUpdate = New System.Windows.Forms.Button()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.TsPrgInstall = New System.Windows.Forms.ToolStripProgressBar()
Me.TsLblInstallTip = New System.Windows.Forms.ToolStripStatusLabel()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.RtxTip = New System.Windows.Forms.RichTextBox()
Me.TxtAlias = New System.Windows.Forms.TextBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.TxtGroup = New System.Windows.Forms.TextBox()
Me.TxtRoles = New System.Windows.Forms.TextBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label7 = New System.Windows.Forms.Label()
Me.tb_SyncFolder_BySelected = New System.Windows.Forms.TextBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.同步目录 = New System.Windows.Forms.GroupBox()
Me.lab_SyncPath = New System.Windows.Forms.Label()
Me.rb_SyncFloder_FollowRootPath = New System.Windows.Forms.RadioButton()
Me.rb_SyncFloder_Spicfied = New System.Windows.Forms.RadioButton()
Me.StatusStrip1.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.同步目录.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
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(216, 19)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(186, 21)
Me.Label1.TabIndex = 0
Me.Label1.Text = "配置更新发布信息"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(28, 56)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(80, 16)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Root路径:"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label3.Location = New System.Drawing.Point(28, 87)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 16)
Me.Label3.TabIndex = 2
Me.Label3.Text = "License:"
'
'TBoRootPath
'
Me.TBoRootPath.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.TBoRootPath.Location = New System.Drawing.Point(130, 53)
Me.TBoRootPath.Name = "TBoRootPath"
Me.TBoRootPath.Size = New System.Drawing.Size(360, 26)
Me.TBoRootPath.TabIndex = 21
'
'TBoLicnese
'
Me.TBoLicnese.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.TBoLicnese.Location = New System.Drawing.Point(130, 84)
Me.TBoLicnese.Name = "TBoLicnese"
Me.TBoLicnese.Size = New System.Drawing.Size(360, 26)
Me.TBoLicnese.TabIndex = 16
'
'BtnLicense
'
Me.BtnLicense.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.BtnLicense.Location = New System.Drawing.Point(496, 85)
Me.BtnLicense.Name = "BtnLicense"
Me.BtnLicense.Size = New System.Drawing.Size(66, 25)
Me.BtnLicense.TabIndex = 18
Me.BtnLicense.Text = "自定义"
Me.BtnLicense.UseVisualStyleBackColor = True
'
'BtnRootPath
'
Me.BtnRootPath.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.BtnRootPath.Location = New System.Drawing.Point(496, 53)
Me.BtnRootPath.Name = "BtnRootPath"
Me.BtnRootPath.Size = New System.Drawing.Size(66, 26)
Me.BtnRootPath.TabIndex = 23
Me.BtnRootPath.Text = "自定义"
Me.BtnRootPath.UseVisualStyleBackColor = True
'
'BtnCancel
'
Me.BtnCancel.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.BtnCancel.Location = New System.Drawing.Point(469, 449)
Me.BtnCancel.Name = "BtnCancel"
Me.BtnCancel.Size = New System.Drawing.Size(90, 37)
Me.BtnCancel.TabIndex = 27
Me.BtnCancel.Text = "关闭"
Me.BtnCancel.UseVisualStyleBackColor = True
'
'BtnStartUpdate
'
Me.BtnStartUpdate.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.BtnStartUpdate.Location = New System.Drawing.Point(373, 449)
Me.BtnStartUpdate.Name = "BtnStartUpdate"
Me.BtnStartUpdate.Size = New System.Drawing.Size(90, 37)
Me.BtnStartUpdate.TabIndex = 26
Me.BtnStartUpdate.Text = "开始更新"
Me.BtnStartUpdate.UseVisualStyleBackColor = True
'
'StatusStrip1
'
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TsPrgInstall, Me.TsLblInstallTip})
Me.StatusStrip1.Location = New System.Drawing.Point(0, 489)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Size = New System.Drawing.Size(592, 22)
Me.StatusStrip1.TabIndex = 28
Me.StatusStrip1.Text = "StatusStrip1"
'
'TsPrgInstall
'
Me.TsPrgInstall.AutoSize = False
Me.TsPrgInstall.Name = "TsPrgInstall"
Me.TsPrgInstall.Size = New System.Drawing.Size(160, 16)
'
'TsLblInstallTip
'
Me.TsLblInstallTip.AutoSize = False
Me.TsLblInstallTip.Name = "TsLblInstallTip"
Me.TsLblInstallTip.Size = New System.Drawing.Size(300, 17)
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.RtxTip)
Me.GroupBox1.Location = New System.Drawing.Point(31, 267)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(531, 176)
Me.GroupBox1.TabIndex = 29
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Tip"
'
'RtxTip
'
Me.RtxTip.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.RtxTip.Dock = System.Windows.Forms.DockStyle.Fill
Me.RtxTip.Location = New System.Drawing.Point(3, 17)
Me.RtxTip.Name = "RtxTip"
Me.RtxTip.Size = New System.Drawing.Size(525, 156)
Me.RtxTip.TabIndex = 0
Me.RtxTip.Text = ""
'
'TxtAlias
'
Me.TxtAlias.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.TxtAlias.Location = New System.Drawing.Point(130, 115)
Me.TxtAlias.Name = "TxtAlias"
Me.TxtAlias.Size = New System.Drawing.Size(432, 26)
Me.TxtAlias.TabIndex = 31
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label4.Location = New System.Drawing.Point(28, 118)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(56, 16)
Me.Label4.TabIndex = 30
Me.Label4.Text = "Alias:"
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label5.Location = New System.Drawing.Point(28, 155)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(80, 16)
Me.Label5.TabIndex = 32
Me.Label5.Text = "子网名称:"
'
'TxtGroup
'
Me.TxtGroup.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.TxtGroup.Location = New System.Drawing.Point(130, 151)
Me.TxtGroup.Name = "TxtGroup"
Me.TxtGroup.Size = New System.Drawing.Size(105, 26)
Me.TxtGroup.TabIndex = 33
Me.TxtGroup.Text = "Group1"
'
'TxtRoles
'
Me.TxtRoles.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.TxtRoles.Location = New System.Drawing.Point(327, 152)
Me.TxtRoles.Name = "TxtRoles"
Me.TxtRoles.Size = New System.Drawing.Size(94, 26)
Me.TxtRoles.TabIndex = 35
Me.TxtRoles.Text = "0"
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label6.Location = New System.Drawing.Point(241, 155)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(80, 16)
Me.Label6.TabIndex = 34
Me.Label6.Text = "设备角色:"
'
'Label7
'
Me.Label7.AutoSize = True
Me.Label7.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label7.Location = New System.Drawing.Point(0, 450)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(80, 16)
Me.Label7.TabIndex = 36
Me.Label7.Text = "同步目录:"
'
'tb_SyncFolder_BySelected
'
Me.tb_SyncFolder_BySelected.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.tb_SyncFolder_BySelected.Location = New System.Drawing.Point(99, 14)
Me.tb_SyncFolder_BySelected.Name = "tb_SyncFolder_BySelected"
Me.tb_SyncFolder_BySelected.Size = New System.Drawing.Size(350, 26)
Me.tb_SyncFolder_BySelected.TabIndex = 37
Me.tb_SyncFolder_BySelected.Text = "d:\"
'
'Button1
'
Me.Button1.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Button1.Location = New System.Drawing.Point(455, 14)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(66, 26)
Me.Button1.TabIndex = 38
Me.Button1.Text = "自定义"
Me.Button1.UseVisualStyleBackColor = True
'
'同步目录
'
Me.同步目录.Controls.Add(Me.lab_SyncPath)
Me.同步目录.Controls.Add(Me.rb_SyncFloder_FollowRootPath)
Me.同步目录.Controls.Add(Me.rb_SyncFloder_Spicfied)
Me.同步目录.Controls.Add(Me.Button1)
Me.同步目录.Controls.Add(Me.tb_SyncFolder_BySelected)
Me.同步目录.Location = New System.Drawing.Point(31, 194)
Me.同步目录.Name = "同步目录"
Me.同步目录.Size = New System.Drawing.Size(527, 73)
Me.同步目录.TabIndex = 39
Me.同步目录.TabStop = False
Me.同步目录.Text = "同步目录"
'
'lab_SyncPath
'
Me.lab_SyncPath.AutoSize = True
Me.lab_SyncPath.Font = New System.Drawing.Font("Consolas", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lab_SyncPath.ForeColor = System.Drawing.Color.Blue
Me.lab_SyncPath.Location = New System.Drawing.Point(135, 47)
Me.lab_SyncPath.Name = "lab_SyncPath"
Me.lab_SyncPath.Size = New System.Drawing.Size(91, 14)
Me.lab_SyncPath.TabIndex = 40
Me.lab_SyncPath.Text = "d:\AUTS_Sync"
'
'rb_SyncFloder_FollowRootPath
'
Me.rb_SyncFloder_FollowRootPath.AutoSize = True
Me.rb_SyncFloder_FollowRootPath.Checked = True
Me.rb_SyncFloder_FollowRootPath.Location = New System.Drawing.Point(22, 46)
Me.rb_SyncFloder_FollowRootPath.Name = "rb_SyncFloder_FollowRootPath"
Me.rb_SyncFloder_FollowRootPath.Size = New System.Drawing.Size(107, 16)
Me.rb_SyncFloder_FollowRootPath.TabIndex = 39
Me.rb_SyncFloder_FollowRootPath.TabStop = True
Me.rb_SyncFloder_FollowRootPath.Text = "跟随 Root 路径"
Me.rb_SyncFloder_FollowRootPath.UseVisualStyleBackColor = True
'
'rb_SyncFloder_Spicfied
'
Me.rb_SyncFloder_Spicfied.AutoSize = True
Me.rb_SyncFloder_Spicfied.Location = New System.Drawing.Point(22, 20)
Me.rb_SyncFloder_Spicfied.Name = "rb_SyncFloder_Spicfied"
Me.rb_SyncFloder_Spicfied.Size = New System.Drawing.Size(71, 16)
Me.rb_SyncFloder_Spicfied.TabIndex = 0
Me.rb_SyncFloder_Spicfied.Text = "用户设定"
Me.rb_SyncFloder_Spicfied.UseVisualStyleBackColor = True
'
'FrmUpdateConfig
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(592, 511)
Me.Controls.Add(Me.同步目录)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.TxtRoles)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.TxtGroup)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.TxtAlias)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.StatusStrip1)
Me.Controls.Add(Me.BtnCancel)
Me.Controls.Add(Me.BtnStartUpdate)
Me.Controls.Add(Me.BtnRootPath)
Me.Controls.Add(Me.TBoRootPath)
Me.Controls.Add(Me.TBoLicnese)
Me.Controls.Add(Me.BtnLicense)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Name = "FrmUpdateConfig"
Me.Text = "FrmUpdateConfig"
Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout()
Me.GroupBox1.ResumeLayout(False)
Me.同步目录.ResumeLayout(False)
Me.同步目录.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Label1 As Label
Friend WithEvents Label2 As Label
Friend WithEvents Label3 As Label
Friend WithEvents TBoRootPath As TextBox
Friend WithEvents TBoLicnese As TextBox
Friend WithEvents BtnLicense As Button
Friend WithEvents BtnRootPath As Button
Friend WithEvents BtnCancel As Button
Friend WithEvents BtnStartUpdate As Button
Friend WithEvents StatusStrip1 As StatusStrip
Friend WithEvents TsLblInstallTip As ToolStripStatusLabel
Friend WithEvents TsPrgInstall As ToolStripProgressBar
Friend WithEvents GroupBox1 As GroupBox
Friend WithEvents RtxTip As RichTextBox
Friend WithEvents TxtAlias As TextBox
Friend WithEvents Label4 As Label
Friend WithEvents Label5 As Label
Friend WithEvents TxtGroup As TextBox
Friend WithEvents TxtRoles As TextBox
Friend WithEvents Label6 As Label
Friend WithEvents Label7 As Label
Friend WithEvents tb_SyncFolder_BySelected As TextBox
Friend WithEvents Button1 As Button
Friend WithEvents 同步目录 As GroupBox
Friend WithEvents rb_SyncFloder_FollowRootPath As RadioButton
Friend WithEvents rb_SyncFloder_Spicfied As RadioButton
Friend WithEvents lab_SyncPath As Label
End Class

View File

@@ -0,0 +1,123 @@
<?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="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,715 @@
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Imports FluentFTP
Imports UTS_Core.Database
Imports UTS_Core.Security
Imports UTS_Core.UTSModule
Imports UTS_Core.UTSModule.DbConnect
Imports UTS_Core.UTSModule.DbTableModel.Manage
Imports UTS_Core.UTSModule.License
Public Class FrmUpdateConfig
Public Property RootPath() As String
Public Property LicenseFileName() As String
Public Property DataServiceName() As String
Public Property UpdateServiceName() As String
Public Property DataServiceAlias() As String
Private _srcLicenseFilePath As String
Private _destLicenseFilePath As String
Private _serviceRegister As ServiceRegister
''' <summary>
''' 窗体加载
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub FrmUpdateConfig_Load(sender As Object, e As EventArgs) Handles MyBase.Load
InitConfig()
TBoRootPath.Text = RootPath
TBoLicnese.Text = _srcLicenseFilePath
TxtAlias.Text = DataServiceAlias
RtxTip.Text = String.Empty
If rb_SyncFloder_FollowRootPath.Checked Then lab_SyncPath.Text = TBoRootPath.Text & "\AUTS_Sync"
If rb_SyncFloder_Spicfied.Checked Then lab_SyncPath.Text = tb_SyncFolder_BySelected.Text & "\AUTS_Sync"
End Sub
''' <summary>
''' 初始化配置信息
''' </summary>
Private Sub InitConfig()
Try
UpdateInstallTip(0, "[Registry Value]")
RootPath = UtsRegistry.RootPath
LicenseFileName = UtsRegistry.LicenseFileName
DataServiceAlias = UtsRegistry.DataServiceAlias
_srcLicenseFilePath = UtsRegistry.LicenseFilePath
Catch ex As Exception
UpdateInstallTip(0, "[Default Value]")
RootPath = $"C:\AUTS"
DataServiceAlias = String.Empty
LicenseFileName = String.Empty
_srcLicenseFilePath = String.Empty
End Try
DataServiceName = $"AUTS_DataService"
UpdateServiceName = $"AUTS_UpdateService"
End Sub
''' <summary>
''' 选择所需要存放的根路径
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnRootPath_Click(sender As Object, e As EventArgs) Handles BtnRootPath.Click
TBoRootPath.Text = SelectFolderString()
If rb_SyncFloder_FollowRootPath.Checked Then lab_SyncPath.Text = TBoRootPath.Text & "\AUTS_Sync"
End Sub
''' <summary>
''' 选择同步文件夹
''' </summary>
''' <returns></returns>
Private Function SelectSyncFolderString() As String
Dim txtString As String = String.Empty
Using folder As New FolderBrowserDialog
If folder.ShowDialog() = DialogResult.OK Then
txtString = folder.SelectedPath
End If
End Using
If String.IsNullOrWhiteSpace(txtString) Then
txtString = TBoRootPath.Text & "\AUTS_Sync"
End If
Return txtString
End Function
''' <summary>
''' 自定义选择文件夹
''' </summary>
''' <returns></returns>
Private Function SelectFolderString() As String
Dim txtString As String = String.Empty
Using folder As New FolderBrowserDialog
If folder.ShowDialog() = DialogResult.OK Then
txtString = folder.SelectedPath
End If
End Using
If String.IsNullOrWhiteSpace(txtString) Then
txtString = "C:\AUTS"
Else
If txtString.EndsWith("AUTS") = False Then
If txtString.EndsWith("\") = False Then
txtString &= "\"
End If
txtString &= "AUTS"
End If
End If
Return txtString
End Function
''' <summary>
''' 选择所需要的License文件
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnLicense_Click(sender As Object, e As EventArgs) Handles BtnLicense.Click
TBoLicnese.Text = SelectFileString()
End Sub
''' <summary>
''' 自定义选择文件
''' </summary>
''' <returns></returns>
Private Function SelectFileString() As String
Dim txtString As String = String.Empty
Using folder As New OpenFileDialog
If folder.ShowDialog() = DialogResult.OK Then
'txtString = folder.SafeFileName
txtString = folder.FileName
End If
End Using
Return txtString
End Function
Private Sub UpdateProgressBar(value As Integer)
TsPrgInstall.Value = value
End Sub
Private Sub UpdateInstallLog(value As Integer, log As String)
If value = 0 Then RtxTip.Clear()
RtxTip.AppendText($"[{value,3}%]-{log}{vbCrLf}")
RtxTip.ScrollToCaret()
End Sub
Private Sub UpdateInstallTip(value As Integer, str As String)
UpdateProgressBar(value)
UpdateInstallLog(value, str)
End Sub
''' <summary>
''' 开始一键发布更新
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnStartUpdate_Click(sender As Object, e As EventArgs) Handles BtnStartUpdate.Click
UpdateInstallTip(0, "Begin Install...")
UpdateCacheValue()
Try
UpdateInstallTip(0, "Begin Check Input Info...")
CheckCacheValue()
UpdateInstallTip(5, "Check Input Info Success!")
Catch ex As Exception
UpdateInstallTip(100, $"Check Input Info Error:{ex.Message}")
Return
End Try
'创建所需文件夹
Try
UpdateInstallTip(10, "Begin CreateSystemFolder...")
CreateSystemFolder()
UpdateInstallTip(15, "CreateSystemFolder Success!")
Catch ex As Exception
UpdateInstallTip(100, $"CreateSystemFolder Error:{ex.Message}")
Return
End Try
'拷贝License文件至指定路径
Try
UpdateInstallTip(15, $"Begin Copy License {_srcLicenseFilePath} To {_destLicenseFilePath}...")
If String.Compare(_srcLicenseFilePath, _destLicenseFilePath, True) <> 0 Then
File.Copy(_srcLicenseFilePath, _destLicenseFilePath, True)
Else
UpdateInstallTip(20, "Don't Need Copy License !")
End If
UpdateInstallTip(20, "Copy License Success!")
Catch ex As Exception
UpdateInstallTip(100, $"Copy License Error:{ex.Message}")
Return
End Try
'下载安装
Try
UpdateInstallTip(20, "Begin InstallUpdateService...")
'Momo 2024-04-05 Service ID 由 ProcessorID + AlisaName 构成从Service Controller 传参传过来
'InstallUpdateService()
InstallUpdateService(DataServiceAlias)
UpdateInstallTip(100, "InstallUpdateService Success!")
Catch ex As Exception
UpdateInstallTip(100, $"InstallUpdateService Error:{ex.Message}")
Return
End Try
'创建同步目录
UpdateInstallTip(100, "Begin to create sync folder...")
If CreateSyncFolder() = True Then
UpdateInstallTip(100, "Success to Create sync folder!")
Else
UpdateInstallTip(100, "Fail to Create sync folder!")
End If
End Sub
Private Sub UpdateCacheValue()
RootPath = TBoRootPath.Text
LicenseFileName = Path.GetFileName(TBoLicnese.Text)
_srcLicenseFilePath = TBoLicnese.Text
DataServiceAlias = TxtAlias.Text
_serviceGroup = TxtGroup.Text
_serviceRoles = TxtRoles.Text
_dataServiceDirPath = $"{RootPath}\{DataServiceName}"
_updateServiceDirPath = $"{RootPath}\{UpdateServiceName}"
_dataServicePacketDirPath = $"{RootPath}\DataServiceDownload"
_licenseDirPath = $"{RootPath}\License"
_destLicenseFilePath = $"{_licenseDirPath}\{LicenseFileName}"
_localDbDirPath = $"{RootPath}\LocalDB"
End Sub
Private Sub CheckCacheValue()
If String.IsNullOrWhiteSpace(RootPath) Then
Throw New Exception($"Invalid RootPath:{RootPath}")
End If
If File.Exists(_srcLicenseFilePath) = False Then
Throw New Exception($"Invalid LicenseFilePath:{_srcLicenseFilePath}")
End If
If String.IsNullOrWhiteSpace(LicenseFileName) Then
Throw New Exception($"Invalid LicenseFileName:{LicenseFileName}")
End If
If String.IsNullOrWhiteSpace(DataServiceName) Then
Throw New Exception($"Invalid DataServiceName:{DataServiceName}")
End If
If String.IsNullOrWhiteSpace(UpdateServiceName) Then
Throw New Exception($"Invalid UpdateServiceName:{UpdateServiceName}")
End If
If String.IsNullOrWhiteSpace(_serviceGroup) Then
Throw New Exception($"子网名称不能为空,请重试")
End If
If String.IsNullOrWhiteSpace(_serviceRoles) Then
Throw New Exception($"设备角色不能为空 ,请重试")
End If
End Sub
#Region "发布更新"
''' <summary> License检测 </summary>
Private _license As License
''' <summary> 初始化FTP服务类 </summary>
Private _ftpClient As FtpService
''' <summary>数据服务的文件夹路径,不含版本</summary>
Private _dataServiceDirPath As String
''' <summary>更新服务的文件夹路径,不含版本</summary>
Private _updateServiceDirPath As String
''' <summary>数据服务升级时存放从FTP下载的最新包文件夹路径</summary>
Private _dataServicePacketDirPath As String
Private _licenseDirPath As String
Private _localDbDirPath As String
''' <summary> 服务子网名(组名) </summary>
Private _serviceGroup As String
''' <summary> 服务角色0为普通1为服务器 </summary>
Private _serviceRoles As String
''' <summary>Ftp远程升级文件夹路径</summary>
Private ReadOnly _ftpUpdateDirPath As String = $"/uts_Manager/AUTS/Service"
''' <summary>同步目录auts_public</summary>
Private _sync_auts_public_DirPath As String
''' <summary>同步目录auts_vendor</summary>
Private _sync_auts_vendor_DirPath As String
''' <summary>Appapp</summary>
Private _sync_auts_app_DirPath As String
''' <summary>
''' 创建运行时必要文件夹
''' </summary>
Private Sub CreateSystemFolder()
Directory.CreateDirectory(RootPath) '创建UTS根目录
Directory.CreateDirectory(_dataServiceDirPath) '数据服务文件夹路径
Directory.CreateDirectory(_updateServiceDirPath) '更新服务文件夹路径
Directory.CreateDirectory(_dataServicePacketDirPath) '数据服务下载文件夹路径
Directory.CreateDirectory(_licenseDirPath) 'License文件夹
Directory.CreateDirectory(_localDbDirPath) 'DB文件夹
End Sub
''' <summary>
''' 创建同步文件夹
''' </summary>
Private Function CreateSyncFolder() As Boolean
'同步目录
Dim syncRootPath As String = lab_SyncPath.Text
If String.IsNullOrEmpty(syncRootPath) = True Then
MsgBox("同步目录设置不正确!")
Return False
End If
_sync_auts_public_DirPath = $"{syncRootPath}\uts_Public"
_sync_auts_vendor_DirPath = $"{syncRootPath}\uts_{_license.VendorName}"
_sync_auts_app_DirPath = $"{RootPath}\App"
Directory.CreateDirectory(_sync_auts_public_DirPath) 'uts_Public
Directory.CreateDirectory(_sync_auts_vendor_DirPath) 'uts_VendorName
Directory.CreateDirectory(_sync_auts_app_DirPath) 'app
If System.IO.Directory.Exists(_sync_auts_public_DirPath) = False OrElse System.IO.Directory.Exists(_sync_auts_vendor_DirPath) = False Then
MsgBox("同步目录创建不成功!")
Return False
End If
Return True
End Function
''' <summary>
''' 获取更新服务的最新信息
''' </summary>
Private Function GetUpdateServiceInfo(serviceName As String) As UpdatePackageInfo
'MsgBox("DbConnector.CanConnectToRemote = " & DbConnector.CanConnectToRemote)
If DbConnector.CanConnectToRemote = False Then '判断网络连接状态
Throw New Exception($"无法连接到数据库!")
End If
Using db As New DbExecutor(UtsDb.RemoteDbType, UtsDb.RemoteConnString)
'MsgBox("DBOpen = " & UtsDb.RemoteDbType & " , " & UtsDb.RemoteConnString)
db.Open()
'sgBox("DBOpened")
Dim tableName As String = $"{SwUpdateTable.TableName}"
Dim colNames As New List(Of String) From {
$"{SwUpdateTable.ColNamesEnum.LastVersion}",
$"{SwUpdateTable.ColNamesEnum.BinPackageMd5}",
$"{SwUpdateTable.ColNamesEnum.PackageName}"
}
Dim condition As String = $"`{SwUpdateTable.ColNamesEnum.SoftwareName}` = '{serviceName}'"
'MsgBox("dtServiceInfo = " & condition)
Dim dtServiceInfo As DataTable = db.ExecuteDataTable(db.CmdHelper.DbSearch(UtsDb.RemotePublicDb, colNames, tableName, condition))
If dtServiceInfo.Rows.Count <= 0 Then
Throw New Exception($"从数据库获取不到{serviceName}的信息!")
End If
'MsgBox("Step369")
Dim packetInfo As New UpdatePackageInfo
packetInfo.BinPackageMd5 = CStr(dtServiceInfo(0)($"{SwUpdateTable.ColNamesEnum.BinPackageMd5}"))
packetInfo.LastVersion = CStr(dtServiceInfo(0)($"{SwUpdateTable.ColNamesEnum.LastVersion}"))
packetInfo.PackageName = CStr(dtServiceInfo(0)($"{SwUpdateTable.ColNamesEnum.PackageName}"))
'MsgBox("Step401")
db.Close()
Return packetInfo
End Using
End Function
Public Function GetUtsHost() As Boolean
Dim _udpClient As New UdpClient()
Dim _webPacker As New UtsWebPacket
UpdateInstallTip(20, $"Start Get Uts Host")
'获取webService目标地址
'Dim remoteIP As IPEndPoint = Nothing
'Try
' If remoteIP Is Nothing Then
' remoteIP = New IPEndPoint(Dns.GetHostAddresses("www.uts-data.com")(0), 5980)
' End If
'Catch ex As Exception
' UpdateInstallTip(20, $"Send Heartbeat Packet Fail:{ex.Message}")
' Return False
'End Try
'UpdateInstallTip(20, $"remoteIP:{remoteIP.Address }")
''发送获取主机地址命令
'Try
' Dim packet() As Byte = _webPacker.FillPacket(CByte(UtsWebPacket.Commands.Heartbeat), BitConverter.GetBytes(0))
' _udpClient.Send(packet, packet.Length, remoteIP)
'Catch ex As Exception
' UpdateInstallTip(20, $"Send Heartbeat Packet Fail:{ex.Message}")
' Return False
'End Try
'UpdateInstallTip(20, $"send")
''等待回复
'Dim timeout As Integer = 5 * 1000
'Dim lastTime As Date = Now
'Dim length As Integer
'Dim recvBuf() As Byte = Nothing
'Dim recviceIp As New IPEndPoint(IPAddress.Any, 0)
'While (Now - lastTime).TotalMilliseconds < timeout
' length = _udpClient.Available
' If length > 0 Then
' recvBuf = _udpClient.Receive(recviceIp)
' Exit While
' End If
' Threading.Thread.Sleep(1000)
'End While
'If recvBuf Is Nothing Then
' UpdateInstallTip(20, $"Get Host Fail!")
' Return False
'End If
'UpdateInstallTip(20, $"Rcvd")
''校验
'Try
' _webPacker.CheckPacket(recvBuf)
'Catch ex As Exception
' UpdateInstallTip(20, $"Check Packet Error:{ex.Message}")
' Return False
'End Try
'UpdateInstallTip(20, $"Verfied")
''处理回复
'Dim cmdByte As Byte = recvBuf(UtsWebPacket.PacketBits.Command)
''不是回复心跳包
'If cmdByte <> 1 Then Return False
'Dim type As Integer
'Dim ftpHost As String = ""
'Dim dbHost As String = ""
'For i As Integer = UtsWebPacket.PacketBits.Param + 4 To recvBuf.Count - 1
' type = recvBuf(i)
' length = recvBuf(i + 1)
' If length = 0 Then
' UpdateInstallTip(20, $"Invalid data length!")
' Return False
' End If
' Select Case type
' Case 1 'ftp服务器地址
' ftpHost = Encoding.UTF8.GetString(recvBuf, i + 2, length)
' Case 2 'db服务器地址
' dbHost = Encoding.UTF8.GetString(recvBuf, i + 2, length)
' End Select
' i += length + 1
'Next
'If String.IsNullOrEmpty(ftpHost) Then
' UpdateInstallTip(20, $"Get FtpHost Fail,Host is null.")
' Return False
'Else
' If String.Compare(UtsRegistry.FtpHost, ftpHost) <> 0 Then
' UtsRegistry.FtpHost = ftpHost '写入注册表
' End If
'End If
'If String.IsNullOrEmpty(dbHost) Then
' UpdateInstallTip(20, $"Get DbHost Fail,Host is null.")
' Return False
'Else
' If String.Compare(UtsRegistry.DbHost, dbHost) <> 0 Then
' UtsRegistry.DbHost = dbHost '写入注册表
' End If
'End If
'//'Momo 2025-09-09 目前先写死服务器地址,后续版本再改为动态获取
Dim ftpHost As String = "ftp.uts-data.com"
Dim dbHost As String = "db.uts-data.com"
UtsRegistry.DbHost = dbHost '写入注册表
UtsRegistry.FtpHost = ftpHost '写入注册表
UpdateInstallTip(20, $"Get Uts Host Success!")
Return True
End Function
''' <summary>
''' 一键更新
''' </summary>
Private Sub InstallUpdateService(Optional AlisaName As String = "")
'todo云端获取服务器地址写入注册表
'If GetUtsHost() = False Then Return '根据License信息,获取服务器地址
'校验License
UpdateInstallTip(20, "Begin CheckLicense...")
_license = New License(_destLicenseFilePath)
_license.CheckLicense()
UtsDb.InitConnectParams(_license) '根据License信息,初始化数据库连接信息
UpdateInstallTip(25, "CheckLicense Success!")
UtsRegistry.FtpHost = _license.FtpHost '写入注册表
UtsRegistry.DbHost = _license.MysqlServer '写入注册表
_ftpClient = New FtpService(_license.FtpHost, CInt(_license.FtpPort), _license.FtpUser, _license.FtpPwd)
'获取远程数据库内容
Dim packetInfo As UpdatePackageInfo = GetUpdateServiceInfo(UpdateServiceName)
'检测服务存在
If WinService.ServicesExists(UpdateServiceName) Then
'Dim updateSerVer As String = UtsRegistry.UpdateServiceVersion
'If NeedToUpdateService(updateSerVer, packetInfo.LastVersion) = False Then
' UpdateInstallTip(100, $"UpdateService is latest version:{updateSerVer}!")
' Return
'End If
'卸载当前服务
WinService.UnInstallService(UtsRegistry.UpdateServiceFilePath, Nothing)
End If
Try
'注册服务
_serviceRegister = New ServiceRegister()
_serviceRegister.LicenseID = _license.ID
_serviceRegister.VendorName = _license.VendorName
_serviceRegister.ExpirationDate = _license.ExpirationDate
_serviceRegister.UsVersion = packetInfo.LastVersion
_serviceRegister.TerminalAlias = DataServiceAlias
_serviceRegister.Roles = _serviceRoles
_serviceRegister.Group = _serviceGroup
' Momo 2024-04-05 Service ID 由 ProcessorID + AlisaName 构成从Service Controller 传参传过来
'_serviceRegister.RegisterService()
_serviceRegister.RegisterService(AlisaName)
Catch ex As Exception
UpdateInstallTip(30, $"Register Service Fail,{ex.Message}")
Return
End Try
UpdateInstallTip(30, "Register Service Success!")
'下载
UpdateInstallTip(40, $"Begin Download...")
DownloadServicePacket(packetInfo)
UpdateInstallTip(100, $"Download Success!")
End Sub
''' <summary>
''' 下载服务包,完成服务安装
''' </summary>
''' <param name="packetInfo">数据库中该程序包的信息</param>
''' <returns></returns>
Private Function DownloadServicePacket(packetInfo As UpdatePackageInfo) As Boolean
Dim localFilePath As String = $"{_dataServicePacketDirPath}\{packetInfo.PackageName}"
Dim ftpFilePath As String = $"{_ftpUpdateDirPath}\{packetInfo.PackageName}"
Dim updateSerDirVer As String = $"{_updateServiceDirPath}\{packetInfo.LastVersion}"
'检测本地包是否存在
If Directory.Exists(_dataServicePacketDirPath) = False Then Directory.CreateDirectory(_dataServicePacketDirPath)
If Directory.Exists(updateSerDirVer) = False Then Directory.CreateDirectory(updateSerDirVer)
'删除本地已有下载包
If File.Exists(localFilePath) Then
File.Delete(localFilePath)
End If
'下载FTP文件
UpdateInstallTip(40, $"Begin Download FtpFile {ftpFilePath} to {localFilePath}...")
_ftpClient.FtpDownload(ftpFilePath, localFilePath)
UpdateInstallTip(50, $"ftpPath:{ftpFilePath},localPath:{localFilePath},下载文件成功!")
Threading.Thread.Sleep(2000)
'更新包文件校验
UpdateInstallTip(50, $"开始校验服务包文件......")
CheckDataServicePacket(localFilePath, packetInfo)
UpdateInstallTip(60, $"校验服务包成功!")
Threading.Thread.Sleep(2000)
'解压,安装,启动服务
UpdateInstallTip(60, $"开始解压文件{localFilePath}到服务下版本文件夹{updateSerDirVer}......")
UTS_Core.Compress.Compress.LoadFromZip(updateSerDirVer, localFilePath)
UpdateInstallTip(70, $"解压成功!")
Threading.Thread.Sleep(2000)
UpdateInstallTip(70, $"Begin InstallService {updateSerDirVer}\{UpdateServiceName}...")
WinService.InstallService($"{updateSerDirVer}\{UpdateServiceName}.exe", Nothing)
UpdateInstallTip(80, $"InstallService Success!")
'更新注册表
UpdateInstallTip(80, $"Begin Update UtsRegistry.")
UtsRegistry.RootPath = RootPath
UtsRegistry.LicenseFileName = LicenseFileName
UtsRegistry.DataServiceName = DataServiceName
UtsRegistry.DataServiceAlias = DataServiceAlias
UtsRegistry.UpdateServiceName = UpdateServiceName
UtsRegistry.UpdateServiceVersion = packetInfo.LastVersion
UtsRegistry.Roles = _serviceRoles
UtsRegistry.BarnchNet = _serviceGroup
UpdateInstallTip(90, $"Update UtsRegistry Success.")
'启动服务
UpdateInstallTip(90, $"开始启动服务程序......")
WinService.StartService(UpdateServiceName)
UpdateInstallTip(95, $"启动服务程序{UpdateServiceName}成功!")
Return True
End Function
''' <summary>
''' 校验数据服务包
''' </summary>
''' <param name="localFilePath"></param>
''' <param name="packetInfo"></param>
Private Sub CheckDataServicePacket(localFilePath As String, packetInfo As UpdatePackageInfo)
Dim localMd5 As String = Md5.GetFileMd5(localFilePath)
Dim remoteMd5 As String = packetInfo.BinPackageMd5
If String.Compare(localMd5, remoteMd5, True) <> 0 Then
Throw New Exception($"Check Packet Fail!localMd5:{localMd5},remoteMd5:{remoteMd5}")
End If
End Sub
''' <summary>
''' 判断本地与云端版本号是否一致,不一致则代表需要更新数据服务
''' </summary>
''' <param name="localVer">本地数据服务版本号</param>
''' <param name="remoteVer">远端数据服务版本号</param>
''' <returns></returns>
Private Function NeedToUpdateService(localVer As String, remoteVer As String) As Boolean
If String.IsNullOrWhiteSpace(localVer) OrElse String.IsNullOrWhiteSpace(remoteVer) Then Return False
If String.Compare(localVer, remoteVer) = 0 Then Return False
Return True
End Function
#End Region
''' <summary>
''' 取消关闭窗体
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub BtnCancel_Click(sender As Object, e As EventArgs) Handles BtnCancel.Click
DialogResult = DialogResult.No
End Sub
Private Sub rb_SyncFloder_FollowRootPath_CheckedChanged(sender As Object, e As EventArgs) Handles rb_SyncFloder_FollowRootPath.CheckedChanged
If rb_SyncFloder_FollowRootPath.Checked Then lab_SyncPath.Text = TBoRootPath.Text & "\AUTS_Sync"
If rb_SyncFloder_Spicfied.Checked Then lab_SyncPath.Text = tb_SyncFolder_BySelected.Text & "\AUTS_Sync"
End Sub
Private Sub rb_SyncFloder_Spicfied_CheckedChanged(sender As Object, e As EventArgs) Handles rb_SyncFloder_Spicfied.CheckedChanged
If rb_SyncFloder_FollowRootPath.Checked Then lab_SyncPath.Text = TBoRootPath.Text & "\AUTS_Sync"
If rb_SyncFloder_Spicfied.Checked Then lab_SyncPath.Text = tb_SyncFolder_BySelected.Text & "\AUTS_Sync"
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
tb_SyncFolder_BySelected.Text = SelectSyncFolderString()
If rb_SyncFloder_FollowRootPath.Checked Then lab_SyncPath.Text = TBoRootPath.Text & "\AUTS_Sync"
If rb_SyncFloder_Spicfied.Checked Then lab_SyncPath.Text = tb_SyncFolder_BySelected.Text & "\AUTS_Sync"
End Sub
End Class

View File

@@ -0,0 +1,50 @@
Imports FluentFTP
Public Class FtpService
Private _ftpUser As String
Private _ftpPwd As String
Private _ftpPort As Integer
Private _ftpHost As String
Sub New(host As String, port As Integer, user As String, pwd As String)
_ftpHost = host
_ftpPort = port
_ftpUser = user
_ftpPwd = pwd
End Sub
Private Sub OnValidateCertificate(control As FtpClient, e As FtpSslValidationEventArgs)
e.Accept = True
End Sub
''' <summary>
''' 文件上传
''' 将本地指定路径压缩包上传到FTP服务器上manager文件夹下
''' </summary>
Public Sub FtpUpload(remotePath As String, loadPath As String)
Using ftpClient As FtpClient = New FtpClient(_ftpHost, _ftpPort, _ftpUser, _ftpPwd)
AddHandler ftpClient.ValidateCertificate, AddressOf OnValidateCertificate
ftpClient.EncryptionMode = FtpEncryptionMode.Auto
ftpClient.Connect()
ftpClient.UploadFile(loadPath, remotePath)
ftpClient.Disconnect()
End Using
End Sub
''' <summary>
''' 文件下载
''' 从FTP下载压缩包到本地指定路径
''' </summary>
Public Sub FtpDownload(remotePath As String, loadPath As String)
Using ftpClient As FtpClient = New FtpClient(_ftpHost, _ftpPort, _ftpUser, _ftpPwd)
AddHandler ftpClient.ValidateCertificate, AddressOf OnValidateCertificate
ftpClient.EncryptionMode = FtpEncryptionMode.Auto
ftpClient.Connect()
ftpClient.DownloadFile(loadPath, remotePath)
ftpClient.Disconnect()
End Using
End Sub
End Class

View File

@@ -0,0 +1,5 @@
Public Interface IDataPacket
Function FillPacket(cmd As Byte, param() As Byte) As Byte()
Function CheckPacket(packet() As Byte) As Boolean
End Interface

View File

@@ -0,0 +1,12 @@
Public Interface ITaskForm
''' <summary>设置窗体父容器,并显示</summary>
Sub ShowForm(parentControl As Control)
''' <summary> 获取参数 </summary>
Function GetParams() As Dictionary(Of String, String)
''' <summary> 设置参数 </summary>
Sub SetParam(params As Dictionary(Of String, String))
End Interface

View File

@@ -0,0 +1,406 @@
Imports System.IO
Imports UTS_Core.DebugLog
Imports UTS_Core.Security
Namespace UTSModule.License
Public Class License
''' <summary> License文件字段枚举 </summary>
Private Enum LicenseKeyEnum
''' <summary>客户名</summary>
VendorName
''' <summary>注册日期</summary>
AuthorizationDate
''' <summary>截止日期</summary>
ExpirationDate
''' <summary>管理员账号</summary>
DefaultUser
''' <summary>管理员密码</summary>
DefaultPassword
''' <summary>远程数据库URL或IP</summary>
MysqlServer
''' <summary>远程数据库连接端口</summary>
MysqlPort
''' <summary>远程数据库账号</summary>
MysqlUserID
''' <summary>远程数据库密码</summary>
MysqlPassword
''' <summary>远程数据库私有操作库</summary>
MysqlDatabase
''' <summary>远程数据库共有操作库</summary>
PublicDb
''' <summary>本地数据库存放文件夹</summary>
SqliteDir
''' <summary>本地数据库文件名</summary>
SqliteName
''' <summary>本地数据库密码</summary>
SqlitePassword
''' <summary>客户MAC地址,锁定|MAC时使用</summary>
MAC
''' <summary>备注</summary>
Remark
''' <summary>UTS版本号</summary>
UtsVersion
''' <summary>签名</summary>
Signature
End Enum
''' <summary> License文件校验返回枚举值</summary>
Public Enum LicenseCheckCodeEnum
''' <summary>未找到License</summary>
NoLicense
''' <summary>无法打开License</summary>
CantOpenLicense
''' <summary>无效的License</summary>
InvalidLicense
''' <summary>校验通过</summary>
CheckPass
End Enum
''' <summary>License校验结果</summary>
Public Enum EnLicenseCheckCode
''' <summary>校验通过</summary>
CheckPass
''' <summary>无效的客户</summary>
InvalidCustomer
''' <summary>无效的注册日期</summary>
InvalidAuthorizationDate
''' <summary>无效的截止日期</summary>
InvalidExpirationDate
''' <summary>无效的用户</summary>
InvalidDefaultUser
''' <summary>无效的用户密码</summary>
InvalidDefaultPassword
''' <summary>无效的MAC地址</summary>
InvalidMac
''' <summary>无效的UTS版本</summary>
InvalidUtsVersion
''' <summary>无效的签名</summary>
InvalidSignature
''' <summary>无效的数据库地址</summary>
InvalidDatabaseServer
''' <summary>无效的数据库名</summary>
InvalidDatabaseName
''' <summary>无效的数据库用户</summary>
InvalidDatabaseUserID
''' <summary>无效的数据库密码</summary>
InvalidDatabaseUserPassword
''' <summary>无效的数据库端口号</summary>
InvalidDatabaseUserPort
''' <summary>无效的数据库名(sqlite)</summary>
InvalidDatabaseFileName
''' <summary>无效的数据库文件夹名(sqlite)</summary>
InvalidDatabaseDirName
End Enum
''' <summary>存储License签名校验值</summary>
Private ReadOnly _standardSignature As String = "this is a valid license data"
''' <summary>License密钥</summary>
Private ReadOnly _licenseAesKey As String = "8h(*H&-987OygO8yg*yS$&G&aG9*&6g96*&7^RA65s76r*&&G(*(7(Gyg7#7Ff7F*&(*&&^5GHo96tr5ff&*Hphg7665^fyu&uOhj0j[0[(jOIhI&g77FgghO*hhHY"
Sub New(licensePath As String)
ReadLicenseFile(licensePath)
End Sub
''' <summary>
''' 获取客户名
''' </summary>
''' <returns>客户名</returns>
Public Property VendorName As String
''' <summary>
''' 获取注册日期
''' </summary>
''' <returns>注册日期</returns>
Public Property AuthorizationDate() As String
''' <summary>
''' 获取截止日期
''' </summary>
''' <returns>截止日期</returns>
Public Property ExpirationDate() As String
''' <summary>
''' 获取管理员账号
''' </summary>
''' <returns>管理员账号</returns>
Public Property DefaultUser() As String
''' <summary>
''' 获取管理员密码
''' </summary>
''' <returns>管理员密码</returns>
Public Property DefaultPassword() As String
''' <summary>
''' 远程数据库URL或IP
''' </summary>
''' <returns>远程数据库URL或IP</returns>
Public Property MysqlServer() As String
''' <summary>
''' 远程数据库连接端口
''' </summary>
''' <returns>远程数据库连接端口</returns>
Public Property MysqlPort() As String
''' <summary>
''' 远程数据库账号
''' </summary>
''' <returns>远程数据库账号</returns>
Public Property MysqlUserID() As String
''' <summary>
''' 远程数据库密码
''' </summary>
''' <returns>远程数据库密码</returns>
Public Property MysqlPassword() As String
''' <summary>
''' 远程数据库操作库
''' </summary>
''' <returns>远程数据库操作库</returns>
Public Property MysqlDatabase() As String
''' <summary>
''' 远程数据库公开库
''' </summary>
''' <returns></returns>
Public Property PublicDb() As String
''' <summary>
''' 本地数据库存放文件夹
''' </summary>
''' <returns>本地数据库存放文件夹</returns>
Public Property SqliteDir() As String
''' <summary>
''' 本地数据库文件名
''' </summary>
''' <returns>本地数据库文件名</returns>
Public Property SqliteName() As String
''' <summary>
''' 本地数据库密码
''' </summary>
''' <returns>本地数据库密码</returns>
Public Property SqlitePassword() As String
''' <summary>
''' 获取客户MAC地址
''' </summary>
''' <returns>客户MAC地址</returns>
Public Property Mac() As String
''' <summary>
''' 获取备注
''' </summary>
''' <returns>备注</returns>
Public Property Remark() As String
''' <summary>
''' 获取UTS版本号
''' </summary>
''' <returns>UTS版本号</returns>
Public Property UtsVersion() As String
''' <summary>
''' 获取签名
''' </summary>
''' <returns>签名</returns>
Public Property Signature() As String
Public Function DealLicenseString(strLicense As String) As Boolean
strLicense = strLicense.Replace(vbLf, String.Empty)
Dim lines() As String = strLicense.Split(Chr(13))
For Each line As String In lines
Dim keyValues As String() = line.Split("="c)
If keyValues.Length = 2 Then
keyValues(0) = keyValues(0).Trim()
keyValues(1) = keyValues(1).Trim()
InitLicenseField(keyValues(0), keyValues(1))
Else
Throw New Exception($"ReadLicense Error:{LicenseCheckCodeEnum.InvalidLicense}")
End If
Next
Return True
End Function
Private Sub InitLicenseField(key As String, value As String)
Dim field As LicenseKeyEnum
If [Enum].TryParse(key, field) = False Then
ApplicationLog.WriteLog(ApplicationLog.LogTypes.Error, $"Error LicenseField,Key:{key},Value:{value}")
Return
End If
Select Case field
Case LicenseKeyEnum.AuthorizationDate
AuthorizationDate = value
Case LicenseKeyEnum.DefaultPassword
DefaultPassword = value
Case LicenseKeyEnum.DefaultUser
DefaultUser = value
Case LicenseKeyEnum.ExpirationDate
ExpirationDate = value
Case LicenseKeyEnum.MAC
Mac = value
Case LicenseKeyEnum.Remark
Remark = value
Case LicenseKeyEnum.Signature
Signature = value
Case LicenseKeyEnum.UtsVersion
UtsVersion = value
Case LicenseKeyEnum.VendorName
VendorName = value
Case LicenseKeyEnum.MysqlServer
MysqlServer = value
Case LicenseKeyEnum.MysqlPort
MysqlPort = value
Case LicenseKeyEnum.MysqlUserID
MysqlUserID = value
Case LicenseKeyEnum.MysqlPassword
MysqlPassword = value
Case LicenseKeyEnum.MysqlDatabase
MysqlDatabase = value
Case LicenseKeyEnum.PublicDb
PublicDb = value
Case LicenseKeyEnum.SqliteDir
SqliteDir = value
Case LicenseKeyEnum.SqliteName
SqliteName = value
Case LicenseKeyEnum.SqlitePassword
SqlitePassword = value
Case Else
ApplicationLog.WriteLog(ApplicationLog.LogTypes.Warn, $"Untreated,Key:{key},Value:{value}")
End Select
End Sub
''' <summary>
''' 读取License文件所有内容并进行解密,将解密后的内容存入License字典中
''' </summary>
''' <param name="licensePath">License文件完整路径(含文件名)</param>
Public Sub ReadLicenseFile(licensePath As String)
If File.Exists(licensePath) = False Then
Throw New Exception($"ReadLicense Error:{LicenseCheckCodeEnum.NoLicense}")
End If
Dim strLicense As String = Aes128.DecryptStr(File.ReadAllText(licensePath), _licenseAesKey)
DealLicenseString(strLicense)
End Sub
Public Function CheckLicense() As Boolean
'校验注册日期
Dim nowDate As String = Format(Now.Date, "yyyy-MM-dd") & " " & Format(TimeOfDay, "HH:mm:ss")
If String.Compare(nowDate, AuthorizationDate, StringComparison.OrdinalIgnoreCase) < 0 Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidAuthorizationDate}")
End If
'校验截止日期
If String.Compare(nowDate, ExpirationDate, StringComparison.OrdinalIgnoreCase) > 0 Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidExpirationDate}")
End If
'默认用户
If String.IsNullOrWhiteSpace(DefaultUser) Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidDefaultUser}")
End If
'默认用户密码
If String.IsNullOrWhiteSpace(DefaultPassword) Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidDefaultPassword}")
End If
'校验签名
If String.Compare(Signature, _standardSignature, True) <> 0 Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidSignature}")
End If
'校验数据库URL或IP
If String.IsNullOrEmpty(MysqlServer) Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidDatabaseServer}")
End If
If String.IsNullOrEmpty(MysqlDatabase) Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidDatabaseName}")
End If
If String.IsNullOrEmpty(MysqlPort) Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidDatabaseUserPort}")
End If
If String.IsNullOrEmpty(MysqlUserID) Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidDatabaseUserID}")
End If
If String.IsNullOrEmpty(MysqlPassword) Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidDatabaseUserPassword}")
End If
If String.IsNullOrEmpty(SqliteDir) Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidDatabaseDirName}")
End If
If String.IsNullOrEmpty(SqliteName) Then
Throw New Exception($"CheckLicense Error:{EnLicenseCheckCode.InvalidDatabaseFileName}")
End If
Return True
End Function
End Class
End Namespace

View File

@@ -0,0 +1,38 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 此代码由工具生成。
' 运行时版本:4.0.30319.42000
'
' 对此文件的更改可能会导致不正确的行为,并且如果
' 重新生成代码,这些更改将会丢失。
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'注意:此文件是自动生成的;请勿直接进行修改。若要更改,
' 或者如果您在此文件中遇到生成错误,请转至项目设计器
' (转至“项目属性”或在解决方案资源管理器中双击“我的项目”节点)
' 然后在“应用程序”选项卡中进行更改。
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = true
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.AUTS_SeviceControler.FrmMain
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,10 @@
<?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>FrmMain</MainForm>
<SingleInstance>true</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@@ -0,0 +1,35 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' 有关程序集的一般信息由以下
' 控制。更改这些特性值可修改
' 与程序集关联的信息。
'查看程序集特性的值
<Assembly: AssemblyTitle("AUTS_SeviceControler")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Microsoft")>
<Assembly: AssemblyProduct("AUTS_SeviceControler")>
<Assembly: AssemblyCopyright("Copyright © Microsoft 2020")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID
<Assembly: Guid("016edf47-7d5b-46b2-a956-6b178745b001")>
' 程序集的版本信息由下列四个值组成:
'
' 主版本
' 次版本
' 生成号
' 修订号
'
'可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
'通过使用 "*",如下所示:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.1.0")>
<Assembly: AssemblyFileVersion("1.6.1.0")>

View File

@@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 此代码由工具生成。
' 运行时版本:4.0.30319.42000
'
' 对此文件的更改可能会导致不正确的行为,并且如果
' 重新生成代码,这些更改将会丢失。
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'此类是由 StronglyTypedResourceBuilder
'类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
'若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
'(以 /str 作为命令选项),或重新生成 VS 项目。
'''<summary>
''' 一个强类型的资源类,用于查找本地化的字符串等。
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.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>
''' 返回此类使用的缓存的 ResourceManager 实例。
'''</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("AUTS_SeviceControler.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' 重写当前线程的 CurrentUICulture 属性,对
''' 使用此强类型资源类的所有资源查找执行重写。
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace

View 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>

View File

@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <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.8.1.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
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.AUTS_SeviceControler.My.MySettings
Get
Return Global.AUTS_SeviceControler.My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可以感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@@ -0,0 +1,216 @@
Imports Microsoft.Win32.Registry
Public Class Registry
''' <summary>
''' 注册表存放根路径配置信息
''' </summary>
Public Shared ReadOnly AutsRootDirPath As String = $"software\AUTS"
Enum DirNameEnum
AUTS_DataService
AUTS_UpdateService
License
LocalDb
End Enum
''' <summary>
''' 获取注册表是否存在
''' </summary>
''' <returns></returns>
Public Shared Function RootDirExists() As Boolean
Return LocalMachine.OpenSubKey(AutsRootDirPath) IsNot Nothing
End Function
''' <summary>
''' 获取和设置Root根文件路径
''' </summary>
''' <returns></returns>
Public Shared Property RootPath() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}").GetValue("Path", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}").SetValue("Path", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置License路径
''' </summary>
''' <returns></returns>
Public Shared Property LicensePath() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.License}").GetValue("Path", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.License}").SetValue("Path", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置LocalDb路径
''' </summary>
''' <returns></returns>
Public Shared Property LocalDb() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.LocalDb}").GetValue("Path", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.LocalDb}").SetValue("Path", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置DataService名称
''' </summary>
''' <returns></returns>
Public Shared Property DataServiceName() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").GetValue("Name", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").SetValue("Name", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置DataService版本信息
''' </summary>
''' <returns></returns>
Public Shared Property DataServiceVersion() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").GetValue("Version", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").SetValue("Version", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置DataService文件路径
''' </summary>
''' <returns></returns>
Public Shared Property DataServiceDirPath() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").GetValue("DirPath", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").SetValue("DirPath", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
'''
''' </summary>
''' <returns></returns>
Public Shared Property DataServiceTcpPort() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").GetValue("Port", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").SetValue("Port", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置DataService启动程序名称
''' </summary>
''' <returns></returns>
Public Shared Property DataServiceExeName() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").GetValue("ExeName", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_DataService}").SetValue("ExeName", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置UpdateService名称
''' </summary>
''' <returns></returns>
Public Shared Property UpdateServiceName() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_UpdateService}").GetValue("Name", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_UpdateService}").SetValue("Name", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置UpdateService版本信息
''' </summary>
''' <returns></returns>
Public Shared Property UpdateServiceVersion() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_UpdateService}").GetValue("Version", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_UpdateService}").SetValue("Version", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置UpdateService文件路径
''' </summary>
''' <returns></returns>
Public Shared Property UpdateServiceDirPath() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_UpdateService}").GetValue("DirPath", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_UpdateService}").SetValue("DirPath", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
''' <summary>
''' 获取和设置UpdateService启动程序名称
''' </summary>
''' <returns></returns>
Public Shared Property UpdateServiceExeName() As String
Get
Return LocalMachine.OpenSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_UpdateService}").GetValue("ExeName", "").ToString()
End Get
Set(value As String)
LocalMachine.CreateSubKey($"{AutsRootDirPath}\{DirNameEnum.AUTS_UpdateService}").SetValue("ExeName", value, Microsoft.Win32.RegistryValueKind.String)
End Set
End Property
End Class

View File

@@ -0,0 +1,193 @@
Imports System.Management
Imports UTS_Core.Database
Imports UTS_Core.UTSModule
Imports UTS_Core.UTSModule.DbTableModel.Manage
Public Class ServiceRegister
Private _serviceID As Integer
Private _mac As String
Private _cpuId As String
Private _privateIP As String
Private _publicIP As String
Private _dsVersion As String
Private _usVersion As String
Sub New()
_dsVersion = UtsRegistry.DataServiceVersion
_usVersion = UtsRegistry.UpdateServiceVersion
InitServiceIndex()
InitMacAndLocalIP()
_cpuId = GetProcessorId()
If String.IsNullOrWhiteSpace(_cpuId) Then
Throw New Exception("无效的CPU序列号")
End If
End Sub
Public ReadOnly Property PrivateIP() As String
Get
Return _privateIP
End Get
End Property
Public ReadOnly Property DsVersion() As String
Get
Return _dsVersion
End Get
End Property
Public Property UsVersion() As String
Get
Return _usVersion
End Get
Set(value As String)
_usVersion = value
End Set
End Property
Public ReadOnly Property ServiceID() As Integer
Get
Return _serviceID
End Get
End Property
Public Property LicenseID As String
Public Property VendorName As String
Public Property ExpirationDate As String
Public Property TerminalAlias As String
Public Property Group As String
Public Property Roles As String
Private Function InitServiceIndex() As Boolean
Try
_serviceID = CInt(UtsRegistry.DataServiceIndex)
If _serviceID = -1 Then Return False
Catch ex As Exception
Throw New Exception($"RegisterService Error: {ex.Message}")
End Try
Return True
End Function
''' <summary>
''' 注册服务返回注册服务的索引
''' Momo 2024-04-05 Service ID 由 ProcessorID + AlisaName 构成从Service Controller 传参传过来
''' </summary>
Public Sub RegisterService(Optional AlisaName As String = "")
'增加服务记录
'Momo 2024-04-05 Service ID 由 ProcessorID + AlisaName 构成从Service Controller 传参传过来
_cpuId = _cpuId & "-" & AlisaName
Dim filed As New Dictionary(Of String, String) From {
{$"{DataServiceListTable.ColNames.LicenseID}", LicenseID},
{$"{DataServiceListTable.ColNames.CompanyName}", VendorName},
{$"{DataServiceListTable.ColNames.LicenseValidDateTime}", ExpirationDate},
{$"{DataServiceListTable.ColNames.TerminalType}", "Windows"},
{$"{DataServiceListTable.ColNames.TerminalName}", Environment.MachineName},
{$"{DataServiceListTable.ColNames.TerminalOS}", My.Computer.Info.OSFullName},
{$"{DataServiceListTable.ColNames.TerminalAlias}", TerminalAlias},
{$"{DataServiceListTable.ColNames.TerminalMAC}", _mac},
{$"{DataServiceListTable.ColNames.ProcessorId}", _cpuId},
{$"{DataServiceListTable.ColNames.ServiceVersion}", DsVersion},
{$"{DataServiceListTable.ColNames.USVer}", UsVersion},
{$"{DataServiceListTable.ColNames.BarnchNet}", Group},
{$"{DataServiceListTable.ColNames.Roles}", Roles},
{$"{DataServiceListTable.ColNames.ServiceRegisterDateTime}", Now.ToString("yyyy-MM-dd HH:mm:ss")},
{$"{DataServiceListTable.ColNames.ServiceLastActiveDateTime}", Now.ToString("yyyy-MM-dd HH:mm:ss")}
}
Dim tableName As String = DataServiceListTable.TableName
Dim colName As String = $"{DataServiceListTable.ColNames.ID}"
Dim condition As String = $"`{DataServiceListTable.ColNames.ProcessorId}` = '{_cpuId}'"
Dim sid As Integer
Using db As New DbExecutor(UtsDb.RemoteDbType, UtsDb.RemoteConnString)
db.Open()
'检测本机是否有注册信息
If _serviceID = -1 Then
'根据CPUID获取索引
Try
_serviceID = CInt(db.ExecuteScalar(db.CmdHelper.DbSearch(UtsDb.RemotePublicDb, colName, tableName, condition)))
Catch ex As Exception
Throw New Exception($"Don't Find Mac:{_mac} Register.")
End Try
If _serviceID > 0 Then '更新
'有索引则更新
condition = $"`{DataServiceListTable.ColNames.ID}` = {_serviceID}"
db.ExecuteNonQuery(db.CmdHelper.DbUpdate(UtsDb.RemotePublicDb, tableName, filed, condition))
Else
'无索引则注册
db.ExecuteNonQuery(db.CmdHelper.DbInsert(UtsDb.RemotePublicDb, tableName, filed))
_serviceID = CInt(db.ExecuteScalar(db.CmdHelper.DbSearch(UtsDb.RemotePublicDb, colName, tableName, condition)))
End If
Else
'根据CPUID获取索引
Try
sid = CInt(db.ExecuteScalar(db.CmdHelper.DbSearch(UtsDb.RemotePublicDb, colName, tableName, condition)))
Catch ex As Exception
Throw New Exception($"Search Service ID Error:{ex.Message}")
End Try
If _serviceID = sid Then
'索引相同则更新
condition = $"`{DataServiceListTable.ColNames.ID}` = {_serviceID}"
db.ExecuteNonQuery(db.CmdHelper.DbUpdate(UtsDb.RemotePublicDb, tableName, filed, condition))
ElseIf sid = 0 Then
'索引不相同但无CUPID则更新
condition = $"`{DataServiceListTable.ColNames.ID}` = {_serviceID}"
db.ExecuteNonQuery(db.CmdHelper.DbUpdate(UtsDb.RemotePublicDb, tableName, filed, condition))
Else
'索引不同则异常
Throw New Exception($"设备索引异常,请联系管理员解决问题")
End If
End If
db.Close()
End Using
UtsRegistry.DataServiceIndex = _serviceID.ToString
End Sub
Private Sub InitMacAndLocalIP()
Dim searcher As New ManagementObjectSearcher("select * from win32_NetworkAdapterConfiguration")
Dim moc2 As ManagementObjectCollection = searcher.Get()
For Each mo As ManagementObject In moc2
If CBool(mo("IPEnabled")) Then
_mac = mo("MACAddress").ToString().ToUpper
Dim a() As String = CType(mo("IpAddress"), String())
_privateIP = a(0)
Exit For
End If
Next
End Sub
Private Function GetProcessorId() As String
Dim Wmis As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_Processor")
Dim pid As String = ""
For Each WmiObj As ManagementObject In Wmis.Get
pid = CStr(WmiObj("ProcessorId")).ToUpper
Exit For
Next
Return pid
End Function
End Class

View File

@@ -0,0 +1,50 @@
Imports UTS_Core.UTSModule.Service
Public Class TaskForms
Private ReadOnly _taskForms As List(Of ITaskForm)
Private ReadOnly _status As List(Of ServiceTask.ServiceTaskStatusEnum)
Sub New()
_taskForms = New List(Of ITaskForm)()
_status = New List(Of ServiceTask.ServiceTaskStatusEnum)()
End Sub
Public Sub SetStatus(index As Integer, status As ServiceTask.ServiceTaskStatusEnum)
_status(index) = status
End Sub
Public Function GetStatus(index As Integer) As ServiceTask.ServiceTaskStatusEnum
Return _status(index)
End Function
Public Sub Add(taskForm As ITaskForm)
_taskForms.Add(taskForm)
_status.Add(ServiceTask.ServiceTaskStatusEnum.Stop)
End Sub
Public Sub RemoveAt(index As Integer)
_taskForms.RemoveAt(index)
_status.RemoveAt(index)
End Sub
Public Sub Clear()
_taskForms.Clear()
_status.Clear()
End Sub
Public Function GetParams(index As Integer) As Dictionary(Of String, String)
Return _taskForms(index).GetParams()
End Function
Public Sub SetParams(index As Integer, params As Dictionary(Of String, String))
_taskForms(index).SetParam(params)
End Sub
End Class

View File

@@ -0,0 +1,38 @@
Public Class UpdatePackageInfo
''' <summary>
''' 软件索引
''' </summary>
''' <returns></returns>
Property SoftwareID() As Integer
''' <summary>
''' 软件名称
''' </summary>
''' <returns></returns>
Property SoftwareName() As String
''' <summary>
''' 软件最新版本
''' </summary>
''' <returns></returns>
Property LastVersion() As String
''' <summary>
''' 软件包MD5
''' </summary>
''' <returns></returns>
Property BinPackageMd5() As String
''' <summary>
''' 软件包名,不含完整路径
''' </summary>
''' <returns></returns>
Property PackageName() As String
''' <summary>
''' 软件发布日期
''' </summary>
''' <returns></returns>
Property ReleaseDate() As DateTime
End Class

View File

@@ -0,0 +1,320 @@
Imports System.ComponentModel
Imports System.ServiceProcess
Imports System.Configuration.Install
Imports System.Reflection
Imports UTS_Core.UTSModule
Public Class UtsService
''' <summary>
''' 描述服务的状态
''' </summary>
Enum ServiceStatusEnum
<Description("未知")>
Unknown
<Description("不存在")>
Nonentity
<Description("已存在")>
Exists
<Description("停止中")>
StopPending
<Description("已停止")>
Stopped
<Description("启动中")>
StartPending
<Description("已启动")>
Started
End Enum
Private ReadOnly _rootDirPath As String
Private _name As String
Private _version As String
Private _versionDirPath As String
Private _serviceDirPath As String
Private _fileName As String
Private _filePath As String
''' <summary>
''' 服务名称,服务版本
''' </summary>
''' <param name="name">服务名称</param>
''' <param name="version">服务版本</param>
Sub New(name As String, version As String)
_rootDirPath = UtsRegistry.RootPath
_name = name
_version = version
_serviceDirPath = $"{_rootDirPath}\{_name}"
_versionDirPath = $"{_serviceDirPath}\{_version}"
_fileName = $"{_name}.exe"
_filePath = $"{_versionDirPath}\{_fileName}"
If String.IsNullOrWhiteSpace(_name) Then
Throw New Exception($"Service name is null or whitespace!")
End If
If String.IsNullOrWhiteSpace(_version) Then
Throw New Exception($"Service version is null or whitespace!")
End If
If IO.Directory.Exists(_rootDirPath) = False Then
Throw New Exception($"RootDirPath is not exists!")
End If
End Sub
Sub New(name As String, version As String, rootDirPath As String)
_name = name
_version = version
_rootDirPath = rootDirPath
_serviceDirPath = $"{_rootDirPath}\{_name}"
_versionDirPath = $"{_serviceDirPath}\{_version}"
_fileName = $"{_name}.exe"
_filePath = $"{_versionDirPath}\{_fileName}"
If String.IsNullOrWhiteSpace(_name) Then
Throw New Exception($"Service name is null or whitespace!")
End If
If String.IsNullOrWhiteSpace(_version) Then
Throw New Exception($"Service version is null or whitespace!")
End If
If IO.Directory.Exists(_rootDirPath) = False Then
Throw New Exception($"RootDirPath is not exists!")
End If
End Sub
Property Name() As String
Get
Return _name
End Get
Set
_name = Value
_serviceDirPath = $"{_rootDirPath}\{_name}"
_versionDirPath = $"{_serviceDirPath}\{_version}"
_fileName = $"{_name}.exe"
_filePath = $"{_versionDirPath}\{_fileName}"
End Set
End Property
Property Version() As String
Get
Return _version
End Get
Set(value As String)
_version = value
_versionDirPath = $"{_serviceDirPath}\{_version}"
_filePath = $"{_versionDirPath}\{_fileName}"
End Set
End Property
ReadOnly Property VersionDirPath() As String
Get
Return _versionDirPath
End Get
End Property
ReadOnly Property ServiceDirPath() As String
Get
Return _serviceDirPath
End Get
End Property
ReadOnly Property FileName() As String
Get
Return _fileName
End Get
End Property
ReadOnly Property FilePath() As String
Get
Return _filePath
End Get
End Property
''' <summary>
''' 获取枚举描述特性
''' </summary>
''' <param name="enumValue">需要获取特性的枚举值</param>
''' <returns>枚举描述特性</returns>
Public Shared Function GetEnumDescription(enumValue As [Enum]) As String
Dim fi As FieldInfo = enumValue.GetType().GetField(enumValue.ToString())
Dim attr() As DescriptionAttribute =
DirectCast(fi.GetCustomAttributes(GetType(DescriptionAttribute),
False), DescriptionAttribute())
If attr.Length > 0 Then
Return attr(0).Description
Else
Return enumValue.ToString()
End If
End Function
''' <summary>
''' 检测服务是否存在
''' </summary>
''' <returns>服务是否存在</returns>
Public Function ServicesExists() As Boolean
Dim services() As ServiceController = ServiceController.GetServices
For Each service As ServiceController In services
If service.ServiceName = _name Then
Return True
End If
Next
Return False
End Function
''' <summary>
''' 获取服务的状态
''' </summary>
''' <returns></returns>
Public Function ServicesStatus() As ServiceStatusEnum
Dim status As ServiceStatusEnum
Try
If ServicesExists() Then
status = ServiceStatusEnum.Exists
Try
Dim service As New ServiceController(_name)
If service.Status = ServiceControllerStatus.Running Then
status = ServiceStatusEnum.Started
ElseIf service.Status = ServiceControllerStatus.StartPending OrElse
service.Status = ServiceControllerStatus.ContinuePending Then
status = ServiceStatusEnum.StartPending
ElseIf service.Status = ServiceControllerStatus.StopPending OrElse
service.Status = ServiceControllerStatus.PausePending Then
status = ServiceStatusEnum.StopPending
Else
status = ServiceStatusEnum.Stopped
End If
Catch ex As Exception
Console.WriteLine($"ServicesStatus Error:{ex.Message}")
End Try
Else
status = ServiceStatusEnum.Nonentity
End If
Catch ex As Exception
status = ServiceStatusEnum.Unknown
Console.WriteLine($"Check ServicesStatus Error:{ex.Message}")
End Try
Return status
End Function
''' <summary>
''' 安装服务
''' </summary>
''' <param name="savedState">服务状态,未知字段</param>
Public Sub InstallService(Optional savedState As IDictionary = Nothing)
Dim app As AppDomain = AppDomain.CreateDomain("MyDomain")
Dim assName As String = GetType(AssemblyInstaller).Assembly.FullName
Dim fullName As String = GetType(AssemblyInstaller).FullName
Using installer As AssemblyInstaller = CType(app.CreateInstanceAndUnwrap(assName, fullName), AssemblyInstaller)
installer.UseNewContext = True
installer.Path = _filePath
installer.Install(savedState)
installer.Commit(savedState)
installer.Dispose()
End Using
AppDomain.Unload(app)
GC.Collect()
End Sub
''' <summary>
''' 卸载服务
''' </summary>
''' <param name="savedState">服务状态,未知字段</param>
Public Sub UnInstallService(Optional savedState As IDictionary = Nothing)
Dim app As AppDomain = AppDomain.CreateDomain("MyDomain")
Dim assName As String = GetType(AssemblyInstaller).Assembly.FullName
Dim fullName As String = GetType(AssemblyInstaller).FullName
Using installer As AssemblyInstaller = CType(app.CreateInstanceAndUnwrap(assName, fullName), AssemblyInstaller)
installer.UseNewContext = True
installer.Path = _filePath
installer.Uninstall(savedState)
End Using
AppDomain.Unload(app)
GC.Collect()
End Sub
''' <summary>
''' 开启服务
''' </summary>
Public Sub StartService()
Using service As ServiceController = New ServiceController(_name)
If service.Status <> ServiceControllerStatus.Running OrElse
service.Status <> ServiceControllerStatus.StartPending OrElse
service.Status <> ServiceControllerStatus.ContinuePending Then
service.Start()
End If
End Using
End Sub
''' <summary>
''' 关闭服务
''' </summary>
Public Sub StopService()
Using service As ServiceController = New ServiceController(_name)
If service.Status = ServiceControllerStatus.Running OrElse
service.Status = ServiceControllerStatus.StartPending OrElse
service.Status = ServiceControllerStatus.ContinuePending Then
service.Stop()
End If
End Using
End Sub
''' <summary>
''' 重启服务
''' </summary>
Public Sub RestartService()
Using service As ServiceController = New ServiceController(_name)
If service.Status = ServiceControllerStatus.Running OrElse
service.Status = ServiceControllerStatus.StartPending OrElse
service.Status = ServiceControllerStatus.ContinuePending Then
service.Stop()
While service.Status = ServiceControllerStatus.Running AndAlso
service.Status = ServiceControllerStatus.StopPending
service.Refresh()
Threading.Thread.Sleep(20)
End While
End If
Threading.Thread.Sleep(100)
service.Start()
End Using
End Sub
End Class

View File

@@ -0,0 +1,178 @@
Imports System.Net
Public Class UtsWebPacket
Implements IDataPacket
Private _packetSn As Integer
Sub New()
_packetSn = 0
End Sub
Public Function FillPacket(cmd As Byte) As Byte()
Dim packet(PacketBits.Command) As Byte
packet(PacketBits.Head) = &HAA
packet(PacketBits.SerialNumber) = CByte(_packetSn)
packet(PacketBits.ParamLength) = &H0
packet(PacketBits.ParamLength + 1) = &H0
packet(PacketBits.CheckValue) = &H0
packet(PacketBits.Command) = cmd
packet(PacketBits.CheckValue) = CheckSum.GetPacketCheck(packet)
_packetSn += 1
If _packetSn > &HFF Then _packetSn = 0
Return packet
End Function
''' <summary>
''' 用于填充发送包
''' </summary>
''' <param name="cmd">发送包命令</param>
''' <param name="param">发送包参数</param>
''' <returns></returns>
Public Function FillPacket(cmd As Byte, param() As Byte) As Byte() Implements IDataPacket.FillPacket
Dim packet(PacketBits.Command + param.Length) As Byte
packet(PacketBits.Head) = &HAA
packet(PacketBits.SerialNumber) = CByte(_packetSn)
Array.Copy(BitConverter.GetBytes(CShort(param.Length)), 0, packet, PacketBits.ParamLength, 2)
packet(PacketBits.CheckValue) = &H0
packet(PacketBits.Command) = cmd
Array.Copy(param, 0, packet, PacketBits.Param, param.Length)
packet(PacketBits.CheckValue) = CheckSum.GetPacketCheck(packet)
_packetSn += 1
If _packetSn > &HFF Then _packetSn = 0
Return packet
End Function
''' <summary>
''' 一般用于填充回复包
''' </summary>
''' <param name="sn">接收包序号</param>
''' <param name="cmd">接收包命令</param>
''' <param name="param">回复包参数</param>
''' <returns></returns>
Public Function FillPacket(sn As Byte, cmd As Byte, param() As Byte) As Byte()
Dim packet(PacketBits.Command + param.Length) As Byte
packet(PacketBits.Head) = &HAA
packet(PacketBits.SerialNumber) = sn
Array.Copy(BitConverter.GetBytes(CShort(param.Length)), 0, packet, PacketBits.ParamLength, 2)
packet(PacketBits.CheckValue) = &H0
packet(PacketBits.Command) = cmd
Array.Copy(param, 0, packet, PacketBits.Param, param.Length)
packet(PacketBits.CheckValue) = CheckSum.GetPacketCheck(packet)
Return packet
End Function
Public Function CheckPacket(packet() As Byte) As Boolean Implements IDataPacket.CheckPacket
If packet(PacketBits.Head) <> &HAA Then
Throw New Exception($"Invalid Packet Head!Src:{packet(PacketBits.Head)} Dest:{&HAA}")
End If
'If packet(PacketBits.SerialNumber) <> _packetSn Then
' Throw New Exception($"Invalid Packet Sn!Src: {packet(PacketBits.SerialNumber)} Dest:{_packetSn}")
'End If
Dim destLength As Integer = packet.Length - PacketBits.Param
If BitConverter.ToInt16(packet, PacketBits.ParamLength) <> destLength Then
Throw New Exception($"Invalid Packet Lengnt!Src:{packet(PacketBits.ParamLength)} Dest:{destLength}")
End If
If CheckSum.GetPacketCheck(packet) <> &H0 Then
Throw New Exception($"Invalid Packet CheckValue!Src:{BitConverter.ToString(packet)}")
End If
Return True
End Function
Enum PacketBits
''' <summary>包头</summary>
Head
''' <summary>序号</summary>
SerialNumber
''' <summary>包长,两位,小端模式</summary>
ParamLength
''' <summary>校验</summary>
CheckValue = ParamLength + 2
''' <summary>命令</summary>
Command
''' <summary>参数</summary>
Param
End Enum
<Flags>
Enum Commands
''' <summary>心跳包</summary>
Heartbeat = &H1
''' <summary>日志上报</summary>
SetLogType = &H2
''' <summary>日志上报</summary>
GetLogType = &H3
''' <summary>增加服务任务</summary>
AddServiceTask = &H11
''' <summary>删除服务任务</summary>
DelServiceTask = &H12
''' <summary>获取服务任务</summary>
GetServiceTask = &H13
''' <summary>设置服务任务</summary>
SetServiceTask = &H14
''' <summary>开启服务任务</summary>
StartServiceTask = &H15
''' <summary>停止服务任务</summary>
StopServiceTask = &H16
''' <summary>重启服务任务</summary>
RestartServiceTask = &H17
''' <summary>上传文件</summary>
UploadFile = &H21
''' <summary>读取指定文件大小</summary>
ReadFileSize = &H22
End Enum
Public Class PublicIpChangedEventArgs
Inherits EventArgs
Sub New(ip As IPAddress)
PublicIP = ip
End Sub
Public Property PublicIP As IPAddress
End Class
Public Class AddTaskEventArgs
Inherits EventArgs
Sub New(jsonString As String)
Me.JsonString = jsonString
End Sub
Public Property JsonString As String
End Class
End Class

View File

@@ -0,0 +1,256 @@
Imports System.ComponentModel
Imports System.ServiceProcess
Imports System.Configuration.Install
Imports System.Reflection
Public Class WinService
''' <summary>
''' 描述服务的状态
''' </summary>
Enum ServiceStatusEnum
<Description("未知")>
Unknown
<Description("不存在")>
Nonentity
<Description("已存在")>
Exists
<Description("停止中")>
StopPending
<Description("已停止")>
Stopped
<Description("启动中")>
StartPending
<Description("已启动")>
Started
End Enum
''' <summary>
''' 获取枚举描述特性
''' </summary>
''' <param name="enumValue">需要获取特性的枚举值</param>
''' <returns>枚举描述特性</returns>
Public Shared Function GetEnumDescription(enumValue As [Enum]) As String
Dim fi As FieldInfo = enumValue.GetType().GetField(enumValue.ToString())
Dim attr() As DescriptionAttribute =
DirectCast(fi.GetCustomAttributes(GetType(DescriptionAttribute),
False), DescriptionAttribute())
If attr.Length > 0 Then
Return attr(0).Description
Else
Return enumValue.ToString()
End If
End Function
''' <summary>
''' 检测服务是否存在
''' </summary>
''' <param name="serviceName">需要检测的服务名称</param>
''' <returns>服务是否存在</returns>
Public Shared Function ServicesExists(serviceName As String) As Boolean
Dim services() As ServiceController = ServiceController.GetServices
For Each service As ServiceController In services
If service.ServiceName = serviceName Then
Return True
End If
Next
Return False
End Function
''' <summary>
''' 获取服务的状态
''' </summary>
''' <param name="serviceName">服务名称</param>
''' <returns></returns>
Public Shared Function ServicesStatus(serviceName As String) As ServiceStatusEnum
Dim status As ServiceStatusEnum
Try
If ServicesExists(serviceName) Then
status = ServiceStatusEnum.Exists
Try
Dim service As New ServiceController(serviceName)
If service.Status = ServiceControllerStatus.Running Then
status = ServiceStatusEnum.Started
ElseIf service.Status = ServiceControllerStatus.StartPending OrElse
service.Status = ServiceControllerStatus.ContinuePending Then
status = ServiceStatusEnum.StartPending
ElseIf service.Status = ServiceControllerStatus.StopPending OrElse
service.Status = ServiceControllerStatus.PausePending Then
status = ServiceStatusEnum.StopPending
Else
status = ServiceStatusEnum.Stopped
End If
Catch ex As Exception
Console.WriteLine($"ServicesStatus Error:{ex.Message}")
End Try
Else
status = ServiceStatusEnum.Nonentity
End If
Catch ex As Exception
status = ServiceStatusEnum.Unknown
Console.WriteLine($"Check ServicesStatus Error:{ex.Message}")
End Try
Return status
End Function
''' <summary>
''' 安装服务
''' </summary>
''' <param name="filePath">服务程序所在路径</param>
''' <param name="savedState">服务状态,未知字段</param>
Public Shared Function InstallService(filePath As String, savedState As IDictionary) As Boolean
Try
Dim app As AppDomain = AppDomain.CreateDomain("MyDomain")
Dim assName As String = GetType(AssemblyInstaller).Assembly.FullName
Dim fullName As String = GetType(AssemblyInstaller).FullName
Using installer As AssemblyInstaller = CType(app.CreateInstanceAndUnwrap(assName, fullName), AssemblyInstaller)
installer.UseNewContext = True
installer.Path = filePath
installer.Install(savedState)
installer.Commit(savedState)
installer.Dispose()
End Using
AppDomain.Unload(app)
GC.Collect()
Catch ex As Exception
Console.WriteLine($"InstallService Error:{ex.Message}")
Return False
End Try
Return True
End Function
''' <summary>
''' 卸载服务
''' </summary>
''' <param name="filePath">服务程序所在路径</param>
''' <param name="savedState">服务状态,未知字段</param>
Public Shared Function UnInstallService(filePath As String, savedState As IDictionary) As Boolean
Try
Dim app As AppDomain = AppDomain.CreateDomain("MyDomain")
Dim assName As String = GetType(AssemblyInstaller).Assembly.FullName
Dim fullName As String = GetType(AssemblyInstaller).FullName
Using installer As AssemblyInstaller = CType(app.CreateInstanceAndUnwrap(assName, fullName), AssemblyInstaller)
installer.UseNewContext = True
installer.Path = filePath
installer.Uninstall(savedState)
installer.Dispose()
End Using
AppDomain.Unload(app)
GC.Collect()
Catch ex As Exception
Console.WriteLine($"UnInstallService Error:{ex.Message}")
Return False
End Try
Return True
End Function
'''' <summary>
'''' 安装服务
'''' </summary>
'''' <param name="filePath">服务程序所在路径</param>
'''' <param name="savedState">服务状态,未知字段</param>
'Public Shared Sub InstallService(filePath As String, savedState As IDictionary)
' Using installer As New AssemblyInstaller
' installer.UseNewContext = True
' installer.Path = filePath
' installer.Install(savedState)
' installer.Commit(savedState)
' installer.Dispose()
' End Using
'End Sub
'''' <summary>
'''' 卸载服务
'''' </summary>
'''' <param name="filePath">服务程序所在路径</param>
'''' <param name="savedState">服务状态,未知字段</param>
'Public Shared Function UnInstallService(filePath As String, savedState As IDictionary) As Boolean
' Try
' Using installer As New AssemblyInstaller
' installer.UseNewContext = True
' installer.Path = filePath
' installer.Uninstall(savedState)
' End Using
' Catch ex As Exception
' Console.WriteLine($"InstallService Error:{ex.Message}")
' Return False
' End Try
' Return True
'End Function
''' <summary>
''' 开启服务
''' </summary>
''' <param name="serviceName">服务名称</param>
Public Shared Sub StartService(serviceName As String)
Using service As ServiceController = New ServiceController(serviceName)
If service.Status <> ServiceControllerStatus.Running OrElse
service.Status <> ServiceControllerStatus.StartPending OrElse
service.Status <> ServiceControllerStatus.ContinuePending Then
service.Start()
End If
End Using
End Sub
''' <summary>
''' 关闭服务
''' </summary>
''' <param name="serviceName">服务名称</param>
''' <returns>关闭服务结果</returns>
Public Shared Function StopService(serviceName As String) As Boolean
Try
Using service As ServiceController = New ServiceController(serviceName)
If service.Status = ServiceControllerStatus.Running OrElse
service.Status = ServiceControllerStatus.StartPending OrElse
service.Status = ServiceControllerStatus.ContinuePending Then
service.Stop()
End If
End Using
Catch ex As Exception
Console.WriteLine($"StopService Error:{ex.Message}")
Return False
End Try
Return True
End Function
''' <summary>
''' 重启服务
''' </summary>
''' <param name="serviceName">服务名称</param>
''' <returns></returns>
Public Shared Function RestartService(serviceName As String) As Boolean
Try
Using service As ServiceController = New ServiceController(serviceName)
If service.Status = ServiceControllerStatus.Running OrElse
service.Status = ServiceControllerStatus.StartPending OrElse
service.Status = ServiceControllerStatus.ContinuePending Then
service.Stop()
While service.Status = ServiceControllerStatus.Running AndAlso
service.Status = ServiceControllerStatus.StopPending
service.Refresh()
Threading.Thread.Sleep(20)
End While
End If
Threading.Thread.Sleep(100)
service.Start()
End Using
Catch ex As Exception
Console.WriteLine($"RestartService:{ex.Message}")
Return False
End Try
Return True
End Function
End Class

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.CodeDom" version="6.0.0" targetFramework="net48" />
<package id="System.Management" version="6.0.0" targetFramework="net48" />
</packages>