From a852a6a5c0af2ab899eb96d953a499269e1f3359 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 30 Jan 2024 11:43:31 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=9C=E7=A8=8Bsql=20?=
=?UTF-8?q?=E5=AE=89=E8=A3=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Main.Designer.cs | 30 +++++-----
Main.cs | 124 +++++++++++++++++++++--------------------
Main.resx | 2 +-
Resource/Data/data.sql | Bin 13084798 -> 13084806 bytes
4 files changed, 79 insertions(+), 77 deletions(-)
diff --git a/Main.Designer.cs b/Main.Designer.cs
index 3784033..468c833 100644
--- a/Main.Designer.cs
+++ b/Main.Designer.cs
@@ -84,14 +84,14 @@
groupBox1.Controls.Add(label1);
groupBox1.Location = new Point(11, 12);
groupBox1.Name = "groupBox1";
- groupBox1.Size = new Size(614, 205);
+ groupBox1.Size = new Size(614, 199);
groupBox1.TabIndex = 0;
groupBox1.TabStop = false;
groupBox1.Text = "Step 1: Validate Database";
//
// connectButton
//
- connectButton.Location = new Point(223, 145);
+ connectButton.Location = new Point(223, 142);
connectButton.Name = "connectButton";
connectButton.Size = new Size(149, 40);
connectButton.TabIndex = 6;
@@ -101,7 +101,7 @@
//
// passwordTextBox
//
- passwordTextBox.Location = new Point(178, 113);
+ passwordTextBox.Location = new Point(178, 108);
passwordTextBox.Name = "passwordTextBox";
passwordTextBox.PasswordChar = '*';
passwordTextBox.Size = new Size(303, 23);
@@ -109,7 +109,7 @@
//
// usernameTextBox
//
- usernameTextBox.Location = new Point(180, 73);
+ usernameTextBox.Location = new Point(180, 72);
usernameTextBox.Name = "usernameTextBox";
usernameTextBox.Size = new Size(303, 23);
usernameTextBox.TabIndex = 4;
@@ -117,7 +117,7 @@
//
// serverTextBox
//
- serverTextBox.Location = new Point(180, 33);
+ serverTextBox.Location = new Point(180, 32);
serverTextBox.Name = "serverTextBox";
serverTextBox.Size = new Size(303, 23);
serverTextBox.TabIndex = 3;
@@ -126,7 +126,7 @@
// label3
//
label3.AutoSize = true;
- label3.Location = new Point(76, 113);
+ label3.Location = new Point(76, 108);
label3.Name = "label3";
label3.Size = new Size(64, 17);
label3.TabIndex = 2;
@@ -135,7 +135,7 @@
// label2
//
label2.AutoSize = true;
- label2.Location = new Point(119, 73);
+ label2.Location = new Point(119, 72);
label2.Name = "label2";
label2.Size = new Size(21, 17);
label2.TabIndex = 1;
@@ -144,7 +144,7 @@
// label1
//
label1.AutoSize = true;
- label1.Location = new Point(56, 33);
+ label1.Location = new Point(56, 32);
label1.Name = "label1";
label1.Size = new Size(84, 17);
label1.TabIndex = 0;
@@ -170,7 +170,7 @@
groupBox2.Controls.Add(nginxPortTBox);
groupBox2.Controls.Add(label4);
groupBox2.Controls.Add(label5);
- groupBox2.Location = new Point(12, 223);
+ groupBox2.Location = new Point(12, 217);
groupBox2.Name = "groupBox2";
groupBox2.Size = new Size(613, 468);
groupBox2.TabIndex = 1;
@@ -344,9 +344,9 @@
groupBox3.Controls.Add(machineCodeLB);
groupBox3.Controls.Add(label6);
groupBox3.Controls.Add(label7);
- groupBox3.Location = new Point(11, 708);
+ groupBox3.Location = new Point(11, 688);
groupBox3.Name = "groupBox3";
- groupBox3.Size = new Size(614, 227);
+ groupBox3.Size = new Size(614, 198);
groupBox3.TabIndex = 2;
groupBox3.TabStop = false;
groupBox3.Text = "Step 3: Activate and Deploy";
@@ -364,7 +364,7 @@
// activeBtn
//
activeBtn.Enabled = false;
- activeBtn.Location = new Point(222, 149);
+ activeBtn.Location = new Point(222, 136);
activeBtn.Name = "activeBtn";
activeBtn.Size = new Size(149, 40);
activeBtn.TabIndex = 9;
@@ -418,7 +418,7 @@
groupBox4.Controls.Add(logTBox);
groupBox4.Location = new Point(631, 11);
groupBox4.Name = "groupBox4";
- groupBox4.Size = new Size(391, 924);
+ groupBox4.Size = new Size(391, 870);
groupBox4.TabIndex = 4;
groupBox4.TabStop = false;
groupBox4.Text = "Deployment Log";
@@ -427,7 +427,7 @@
//
logTBox.Location = new Point(6, 22);
logTBox.Name = "logTBox";
- logTBox.Size = new Size(359, 899);
+ logTBox.Size = new Size(359, 842);
logTBox.TabIndex = 0;
logTBox.Text = "";
//
@@ -435,7 +435,7 @@
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1034, 944);
+ ClientSize = new Size(1034, 889);
Controls.Add(groupBox4);
Controls.Add(groupBox3);
Controls.Add(groupBox2);
diff --git a/Main.cs b/Main.cs
index 16314dc..7ef0aef 100644
--- a/Main.cs
+++ b/Main.cs
@@ -78,7 +78,7 @@ namespace Start
connection.Open();
});
- WinformLog("Database connection test successful!", Color.Green);
+ WinformLog("Database connection test succeeded.", Color.Green);
isCanDBConfig = false;
serverTextBox.Enabled = isCanDBConfig;
@@ -115,26 +115,26 @@ namespace Start
if (int.TryParse(nginxPortTBox.Text, out vuePort) == false || int.TryParse(apiPortTBox.Text, out apiPort) == false)
{
- WinformLog($"Please enter a valid port", Color.Red);
+ WinformLog($"Please enter a valid port number!", Color.Red);
return;
}
if (IsPortInUse(vuePort))
{
- WinformLog($"The front-end port set by the service is occupied, please choose another port", Color.Red);
+ WinformLog($"The front-end port set by the service is already in use. Please choose another port!", Color.Red);
return;
}
if (IsPortInUse(apiPort))
{
- WinformLog($"The back-end port set by the service is occupied, please choose another port", Color.Red);
+ WinformLog($"The back-end port set by the service is already in use. Please choose another port!", Color.Red);
return;
}
- WinformLog("Port test successful!", Color.Green);
+ WinformLog("Port test succeeded.", Color.Green);
isPortTestOk = true;
@@ -148,20 +148,20 @@ namespace Start
{
if (ServiceController.GetServices().Any(t => t.ServiceName == serviceNameTBox.Text))
{
- WinformLog($"The set backend service name already exists, please replace it", Color.Red);
+ WinformLog($"Name of the backend service already exists. Please change it!", Color.Red);
return;
}
if (ServiceController.GetServices().Any(t => t.ServiceName == nginxServiceNameTbox.Text))
{
- WinformLog($"The nginx service name already exists. Please change it", Color.Red);
+ WinformLog($"Name of the nginx service already exists. Please change it!", Color.Red);
return;
}
- WinformLog($"Service name test successful", Color.Green);
+ WinformLog($"Service name test succeeded.", Color.Green);
isServiceTestOk = true;
}
@@ -216,7 +216,7 @@ namespace Start
{
// 执行逻辑,表示大于等于 6.0.0 的 .NET 运行时已安装
- WinformLog("Current system >= 6.0.0 NetCore runtime is installed", Color.Green);
+ WinformLog("Netcore Runtime 6.0.0 or newer has been installed.", Color.Green);
isRuntimeTestOk = true;
@@ -225,13 +225,13 @@ namespace Start
{
- WinformLog("The current system >= 6.0.0 NetCore runtime is not installed, please install it before running the program", Color.Red);
+ WinformLog("Netcore Runtime 6.0.0 or newer is not installed. Please install it before running the deployment software.", Color.Red);
connectButton.Enabled = false;
//await Task.Run(() =>
// {
- // WinformLog("Now start installing the Net core runtime for you...", Color.Orange);
+ // WinformLog("Installing Netcore Runtime….", Color.Orange);
// string runtimePath = Path.Combine(AppContext.BaseDirectory, "Resource/NetCoreRuntime/dotnet-hosting-6.0.0-win.exe");
@@ -247,7 +247,7 @@ namespace Start
// otherProcess.Start();
// otherProcess.WaitForExit();
- // WinformLog("Net core 6.0.0 runtime installation completed", Color.Green);
+ // WinformLog("Netcore 6.0.0 Runtime installation completed.", Color.Green);
// });
@@ -259,7 +259,7 @@ namespace Start
{
if (string.IsNullOrWhiteSpace(dbNameTBox.Text))
{
- WinformLog($"Please enter the deployed database name", Color.Red);
+ WinformLog($"Please enter the name of the deployed database!", Color.Red);
return;
}
@@ -281,14 +281,14 @@ namespace Start
if (rowCount > 0)
{
- WinformLog($"{dbNameTBox.Text.Trim()}The database already exists.", Color.Red);
+ WinformLog($"{dbNameTBox.Text.Trim()} This database already exists.", Color.Red);
return;
}
}
- WinformLog($"Database name test successful", Color.Green);
+ WinformLog($"Database name test succeeded. ", Color.Green);
isDBNameTestOK = true;
@@ -306,17 +306,17 @@ namespace Start
if (string.IsNullOrWhiteSpace(this.folderPathTbox.Text))
{
- WinformLog($"Confirmation can only be made after selecting the deployment path, test port, database name, and service name.", Color.Red);
+ WinformLog($"Please select the deployment path ( Confirmation can be made only after port, database name, and service name pass the test.).", Color.Red);
return;
}
if (isDBNameTestOK == false || isPortTestOk == false || isServiceTestOk == false)
{
- WinformLog($"Confirmation can only be made after the test port, database name, and service name are all test successful.", Color.Red);
+ WinformLog($"Confirmation can be made only after port, database name, and service name pass the test.", Color.Red);
return;
}
- WinformLog($"Deployment configuration confirmed successfully", Color.Green);
+ WinformLog($"Deployment configuration confirmed successfully.", Color.Green);
activeBtn.Enabled = true;
@@ -404,7 +404,7 @@ namespace Start
{
if (Md5($"{machineTextBox.Text}_XINGCANG") != KeySecreteTextBox.Text.Trim())
{
- WinformLog($"The secret key is incorrect, please contact the supplier", Color.Red);
+ WinformLog($"Secret key is not current. Please contact the vendor!", Color.Red);
return;
}
@@ -427,7 +427,9 @@ namespace Start
string dataExtraName = "EIMedViewerData";
- string nginxStartPath = Path.Combine(deployFoder, @$"{nginxExtractName}\");
+ string resouceFolder = "Resource";
+
+ string nginxStartPath = Path.Combine(deployFoder, @$"{nginxExtractName}");
var nginxConfigPath = Path.Combine(nginxStartPath, @$"conf\nginx.conf");
var nginxEXEPath = Path.Combine(nginxStartPath, "nginx.exe");
string nginxServiceEXEPath = Path.Combine(nginxStartPath, "nginxService.exe");
@@ -435,14 +437,14 @@ namespace Start
- var apiBinPath = Path.Combine(deployFoder, "EIMedViewerService/EI_Med_Viewer.exe");
- var apiJsonConfigPath = Path.Combine(deployFoder, "EIMedViewerService/appsettings.Test_510K.json");
+ var apiBinPath = Path.Combine(deployFoder, apiExtractName, "EI_Med_Viewer.exe");
+ var apiJsonConfigPath = Path.Combine(deployFoder, apiExtractName,"appsettings.Test_510K.json");
- string nginxRarFilePath = Path.Combine(AppContext.BaseDirectory, $@"Resource\EIMedViewerWeb.rar");
- string apiRarFilePath = Path.Combine(AppContext.BaseDirectory, "Resource/EIMedViewerService.rar");
+ string nginxRarFilePath = Path.Combine(AppContext.BaseDirectory, resouceFolder, "EIMedViewerWeb.rar");
+ string apiRarFilePath = Path.Combine(AppContext.BaseDirectory, resouceFolder, "EIMedViewerService.rar");
- string dataRarFilePath = Path.Combine(AppContext.BaseDirectory, "Resource/EIMedViewerData.rar");
+ string dataRarFilePath = Path.Combine(AppContext.BaseDirectory, resouceFolder, "EIMedViewerData.rar");
@@ -469,7 +471,7 @@ namespace Start
#region 解压nginx 和前端部署的文件
- WinformLog($"Start decompressing nginx and front-end deployment compressed files...", Color.Green);
+ WinformLog($"Start extracting Nginx and front-end deployment compressed files...", Color.Green);
string extractPath = Path.Combine(deployFoder, nginxExtractName);
if (!Directory.Exists(extractPath))
@@ -494,7 +496,7 @@ namespace Start
}
- WinformLog($"The nginx and front-end deployment compressed files have been successfully decompressed to: {extractPath}", Color.Green);
+ WinformLog($"Nginx and front-end deployment compressed files have been successfully extracted to: {extractPath}", Color.Green);
@@ -504,10 +506,10 @@ namespace Start
if (!File.Exists(nginxConfigPath))
{
- WinformLog("No nginx exist under the default path", Color.Red);
+ WinformLog("No nginx exists under the default path.", Color.Red);
}
- WinformLog("Prepare to write nginx configuration...", Color.Green);
+ WinformLog("Prepare to write in Nginx configuration...", Color.Green);
var nginxConfig = File.ReadAllText(nginxConfigPath);
@@ -516,12 +518,12 @@ namespace Start
File.WriteAllText(nginxConfigPath, nginxConfig);
- WinformLog("nginx deployment configuration writing completed", Color.Green);
+ WinformLog("Nginx deployment configuration write-in completed!", Color.Green);
#region nginxservice
- WinformLog("Prepare nginx self-starting service configuration file...", Color.Green);
+ WinformLog("Prepare Nginx self-starting service configuration file...", Color.Green);
var nginxServiceConfig = File.ReadAllText(nginxServiceXMLPath);
@@ -533,25 +535,25 @@ namespace Start
File.WriteAllText(nginxServiceXMLPath, nginxServiceConfig);
- WinformLog("nginx self-starting service configuration writing completed", Color.Green);
+ WinformLog("Nginx self-starting service configuration write-in completed", Color.Green);
#endregion
- WinformLog($"Prepare to create a self-starting nginx service...", Color.Green);
+ WinformLog($"Prepare to create self-starting nginx service...", Color.Green);
var nginxCreateStr = $@"{nginxServiceEXEPath} install ";
// 执行 sc create 命令来创建服务
await ProcessStandardInputAsync(process, nginxCreateStr);
- WinformLog($"The execution of creating service {nginxServiceName} ends", Color.Green);
+ WinformLog($"The execution of creating Service {nginxServiceName} ends", Color.Green);
await Task.Delay(2000);
#region nginx 服务
- WinformLog($"Start the deployed {nginxServiceName} service...", Color.Green);
+ WinformLog($"Start the deployed service {nginxServiceName}...", Color.Green);
await ProcessStandardInputAsync(process, $"sc start {nginxServiceName}");
@@ -570,11 +572,11 @@ namespace Start
if (scNginx.Status == ServiceControllerStatus.Running)
{
- WinformLog($"nginx service started successfully", Color.Green);
+ WinformLog($"Nginx service started successfully.", Color.Green);
}
else
{
- WinformLog($"nginx service failed to start", Color.Red);
+ WinformLog($"Nginx service failed to start.", Color.Red);
}
#endregion
@@ -616,7 +618,7 @@ namespace Start
{
#region 解压后端部署的文件
- WinformLog($"Start decompressing the backend deployment compressed file...", Color.Green);
+ WinformLog($"Start extracting the backend deployment compressed file...", Color.Green);
string apiExtractPath = Path.Combine(deployFoder, apiExtractName);
@@ -643,7 +645,7 @@ namespace Start
}
- WinformLog($"The backend deployment compressed file was successfully extracted to: {apiExtractPath}", Color.Green);
+ WinformLog($"The backend deployment compressed file has been successfully extracted to: {apiExtractPath}", Color.Green);
#endregion
});
@@ -651,7 +653,7 @@ namespace Start
await Task.Run(() =>
{
#region 解压模板文件
- WinformLog($"Start decompressing the deployment dependency template compressed file...", Color.Green);
+ WinformLog($"Start extracting template files…", Color.Green);
string extractPath = Path.Combine(deployFoder, dataExtraName);
if (!Directory.Exists(extractPath))
@@ -672,7 +674,7 @@ namespace Start
}
- WinformLog($"The dependency template compressed file was successfully extracted to: {extractPath}", Color.Green);
+ WinformLog($"Template files have been successfully extracted to: {extractPath}", Color.Green);
#endregion
@@ -705,7 +707,7 @@ namespace Start
}
}
}
- WinformLog($"Document resources released successfully", Color.Green);
+ WinformLog($"Document resources have been released successfully.", Color.Green);
#endregion
});
@@ -745,11 +747,11 @@ namespace Start
File.WriteAllText(Path.Combine(directoryPath, "config.json"), JsonConvert.SerializeObject(configObj));
- WinformLog("Writing the activation key is completed", Color.Green);
+ WinformLog("Activation key writing has been completed.", Color.Green);
}
catch (Exception ex)
{
- WinformLog("Failed to write the activation key. Please start the program in administrator mode to ensure that the program has sufficient permissions.", Color.Red);
+ WinformLog("Activation key writing failed. Please launch the application in administrator's mode, and make sure that the application has sufficient permissions.", Color.Red);
}
#endregion
@@ -774,7 +776,7 @@ namespace Start
// 执行 sc create 命令来创建服务
await ProcessStandardInputAsync(process, createStr);
- WinformLog($"The execution of creating service{serviceName}ends", Color.Green);
+ WinformLog($"Creating {serviceName} service has ended.", Color.Green);
#endregion
@@ -783,25 +785,25 @@ namespace Start
#region 初始化数据库脚本
- WinformLog($"Execute initialization database script...", Color.Green);
+ WinformLog($"Initialize database script...", Color.Green);
//执行数据库脚本
- await ProcessStandardInputAsync(process, $@" SQLCMD -v dbName = ""{dbNameTBox.Text}"" -i ""{AppContext.BaseDirectory}Resource\Data\dbo.sql"" ");
+ await ProcessStandardInputAsync(process, $@" SQLCMD -S {serverTextBox.Text} -U {usernameTextBox.Text} -P {passwordTextBox.Text} -v dbName = ""{dbNameTBox.Text}"" -i ""{AppContext.BaseDirectory}Resource\Data\dbo.sql"" ");
await Task.Delay(3000);
- await ProcessStandardInputAsync(process, $@" SQLCMD -v dbName = ""{dbNameTBox.Text}"" -i ""{AppContext.BaseDirectory}Resource\Data\data.sql"" ");
+ await ProcessStandardInputAsync(process, $@" SQLCMD -S {serverTextBox.Text} -U {usernameTextBox.Text} -P {passwordTextBox.Text} -v dbName = ""{dbNameTBox.Text}"" -i ""{AppContext.BaseDirectory}Resource\Data\data.sql"" ");
- WinformLog($"The execution of the initialization database script ends", Color.Green);
+ WinformLog($"Initializing database script has ended.", Color.Green);
#endregion
#region 部署网站配置文件写入
- WinformLog("Start writing the deployment website service configuration file...", Color.Green);
+ WinformLog("Start writing service configuration file…", Color.Green);
var appsettingsJson = File.ReadAllText(apiJsonConfigPath);
@@ -829,13 +831,13 @@ namespace Start
catch (SqlException ex)
{
- WinformLog($"Connection string error", Color.Red);
+ WinformLog($"Database connection string error", Color.Red);
return;
}
- WinformLog("Deploy the website service configuration file, write and test OK", Color.Green);
+ WinformLog("Service configuration file writing & testing has been done.", Color.Green);
#endregion
@@ -852,7 +854,7 @@ namespace Start
#region 启动后端服务
- WinformLog($"Start the deployed backend service...", Color.Green);
+ WinformLog($"Start the backend service.", Color.Green);
await ProcessStandardInputAsync(process, $"sc start {serviceName}");
@@ -878,14 +880,14 @@ namespace Start
if (sc.Status == ServiceControllerStatus.Running)
{
- WinformLog($"Backend service started successfully", Color.Green);
+ WinformLog($"Backend service started successfully.", Color.Green);
- WinformLog($"Deployment completed", Color.Green);
+ WinformLog($"Deployment has been completed.", Color.Green);
try
{
- WinformLog($"Now ready to open the browser...", Color.Green);
+ WinformLog($"Ready to open the browser…", Color.Green);
await Task.Delay(2000);
// Use ProcessStartInfo class
@@ -906,7 +908,7 @@ namespace Start
}
else
{
- WinformLog($"The backend service failed to start. You can try to start {serviceDisplayName}manually. If you still cannot start after trying manually, please contact technical personnel to confirm the deployment environment.", Color.Red);
+ WinformLog($"Backend service failed to start. Please try to start {serviceDisplayName} manually. If a manual start still fails, please contact tech support to confirm the deployment environment.", Color.Red);
}
#endregion
@@ -939,7 +941,7 @@ namespace Start
confimDeployBtn.Enabled = true;
- WinformLog($"Deployment path selected successfully", Color.Green);
+ WinformLog($"Deployment path selection was successful.", Color.Green);
}
@@ -949,7 +951,7 @@ namespace Start
{
Clipboard.SetText(machineTextBox.Text);
- WinformLog("The machine code was copied to the clipboard successfully!", Color.Green);
+ WinformLog("Machine code has been copied to the clipboard successfully. ", Color.Green);
}
private void Main_Load(object sender, EventArgs e)
@@ -981,13 +983,13 @@ namespace Start
{
foreach (var instanceName in key.GetValueNames())
{
- WinformLog($"The current system SQL Server installed instance: {instanceName}", Color.Green);
+ WinformLog($"An SQL Server instance already exists and its name is: {instanceName}", Color.Green);
}
}
}
else
{
- WinformLog("SQL Server is not installed, please install it before running the deployment program.", Color.Red);
+ WinformLog("SQL Server is not installed. Please install it before running the deployment program.", Color.Red);
}
diff --git a/Main.resx b/Main.resx
index 7e05461..4d01d1e 100644
--- a/Main.resx
+++ b/Main.resx
@@ -18,7 +18,7 @@
System.Resources.ResXResourceReader, System.Windows.Forms, ...
System.Resources.ResXResourceWriter, System.Windows.Forms, ...
this is my long stringthis is a comment
- Blue
+ Blue
[base64 mime encoded serialized .NET Framework object]
diff --git a/Resource/Data/data.sql b/Resource/Data/data.sql
index 74fb20f29c211430e9ac8889d01cdfbb36baa312..74b52845f1352c3dcfbd59354763ebc7cedad6c2 100644
GIT binary patch
delta 623
zcmWO0S3?Z|06^gs*OtAbK{75Kn~)})9
z86~4-jEt2e87Jdqf+WjCNs&}ZlXS_DOqnE;B}=BrRGB8(k|Wb4S7u0_%#>L&Tk>U&
z%$0dEUlzzhStN^Pi7b_6vRqckN?9eVWsR(rb+TSI$VS;Dn`Mh^m2I+J3S@`ulwGo0
z_Q+n@C;R1q9F#+HSPG>`ils!3h*BzLa#W7VaXBF;<&>P3GjdkS<(!qmkOzrklc`)a!YQ@9l0y_@8rFF
ekdIO$pX9TAk+1SizRM5!DZivvepmA+yXrrQK;-xU
delta 615
zcmWO0XIl*b06^hKawRilB+*dF$mWohC{meO$(EI^vct)ive&gjAv+;^e&r8^_ZPh7
ze}aLg-@!o0-=@kyN*U5jLZrEbN(%`{O9_)!5-zQ!jkJ|^(q1}9gmjcn(pe&?T8rAp4pdAT4L<&s>MD{@t?
z$#uCQLAfcn