diff --git a/IRaCIS.Core.API.sln b/IRaCIS.Core.API.sln
index 7a102e9a..a077bf2b 100644
--- a/IRaCIS.Core.API.sln
+++ b/IRaCIS.Core.API.sln
@@ -17,7 +17,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IRaCIS.Core.Infra.EFCore",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IRaCIS.Core.Infrastructure", "IRaCIS.Core.Infrastructure\IRaCIS.Core.Infrastructure.csproj", "{07EED0F8-08E6-46F3-ACBE-17BC1391BD4C}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Start", "Start\Start.csproj", "{D96F4B52-359C-43C9-8110-BAD1437F9280}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EI_Image_Viewer_Installer", "Start\EI_Image_Viewer_Installer.csproj", "{D96F4B52-359C-43C9-8110-BAD1437F9280}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Install", "Install\Install.csproj", "{F5820DF0-DE23-4F4A-8D49-7E22F67B784D}"
EndProject
diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj
index d2d91984..4fb17348 100644
--- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj
+++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj
@@ -6,11 +6,11 @@
354572d4-9e15-4099-807c-63a2d29ff9f2
default
Linux
- 上海展影医疗科技有限公司版权所有
+ 武汉行藏科技有限公司版权所有
- 1.0.1.0412
- IRC影像系统(EICS)
- 1.0.1.0412
+ 1.0.0.001
+ 医学影像处理软件
+ 1.0.0.001
favicon.ico
AnyCPU;x64
EI_Image_Viewer
diff --git a/Start/Start.csproj b/Start/EI_Image_Viewer_Installer.csproj
similarity index 72%
rename from Start/Start.csproj
rename to Start/EI_Image_Viewer_Installer.csproj
index 9c1ac98d..51264946 100644
--- a/Start/Start.csproj
+++ b/Start/EI_Image_Viewer_Installer.csproj
@@ -8,12 +8,19 @@
enable
AnyCPU;x64
favicon.ico
+
+ 1.0.0.001
+ 武汉行藏科技有限公司版权所有
+ 医学影像处理软件安装程序
+ 1.0.0.001
+
+
@@ -37,6 +44,12 @@
Always
+
+ Always
+
+
+ Always
+
@@ -47,4 +60,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/Start/Main.Designer.cs b/Start/Main.Designer.cs
index 47a569a6..96294a17 100644
--- a/Start/Main.Designer.cs
+++ b/Start/Main.Designer.cs
@@ -106,7 +106,6 @@
passwordTextBox.PasswordChar = '*';
passwordTextBox.Size = new Size(271, 23);
passwordTextBox.TabIndex = 5;
- passwordTextBox.Text = "123456";
//
// usernameTextBox
//
@@ -444,6 +443,7 @@
Icon = (Icon)resources.GetObject("$this.Icon");
Name = "Main";
Text = "安装 - EI Image Viewer V1";
+ TopMost = true;
Load += Main_Load;
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
diff --git a/Start/Main.cs b/Start/Main.cs
index 810c9826..28005986 100644
--- a/Start/Main.cs
+++ b/Start/Main.cs
@@ -44,6 +44,8 @@ namespace Start
private bool isDBNameTestOK = false;
+ private bool isRuntimeTestOk = false;
+
public Main()
{
InitializeComponent();
@@ -54,25 +56,26 @@ namespace Start
this.machineTextBox.Text = physicalAddressList.FirstOrDefault()?.ToString();
-
-
-
-
- this.KeySecreteTextBox.Text = Md5($"{this.machineTextBox.Text}_XINGCANG");
+ //this.KeySecreteTextBox.Text = Md5($"{this.machineTextBox.Text}_XINGCANG");
}
int apiPort = 7100;
int vuePort = 9527;
- private void connectButton_Click(object sender, EventArgs e)
+ private async void connectButton_Click(object sender, EventArgs e)
{
string connectionString = $"Server={serverTextBox.Text};User Id={usernameTextBox.Text};Password={passwordTextBox.Text};";
+
+
using (SqlConnection connection = new SqlConnection(connectionString))
{
try
{
- connection.Open();
+ await Task.Run(() =>
+ {
+ connection.Open();
+ });
WinformLog("数据库连接测试成功!", Color.Green);
@@ -100,6 +103,10 @@ namespace Start
+
+
+
+
}
private void portBtn_Click(object sender, EventArgs e)
@@ -157,6 +164,96 @@ namespace Start
isServiceTestOk = true;
}
+ private async void testNetcoreRuntime()
+ {
+
+ string runtimeListCommand = "dotnet --list-runtimes";
+ Process process = new Process();
+ process.StartInfo.FileName = "cmd.exe";
+ process.StartInfo.Arguments = "/c " + runtimeListCommand;
+ process.StartInfo.UseShellExecute = false;
+ process.StartInfo.RedirectStandardOutput = true;
+ process.Start();
+
+ string output = process.StandardOutput.ReadToEnd();
+ process.WaitForExit();
+
+ bool isAspNetCoreRuntimeInstalled = false;
+ bool isNETCoreRuntimeInstalled = false;
+
+ var lineList = output.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
+
+
+ foreach (string line in lineList)
+ {
+ if (line.Contains("Microsoft.AspNetCore.App") && !line.Contains("Preview"))
+ {
+ string versionString = line.Split(' ')[1];
+ Version version = new Version(versionString);
+ if (version.Major > 6 || (version.Major == 6 && version.Minor >= 0))
+ {
+ // 大于等于 6.0.0 的 .NET 运行时已安装
+ isAspNetCoreRuntimeInstalled = true;
+ continue;
+ }
+ }
+
+ if (line.Contains("Microsoft.NETCore.App") && !line.Contains("Preview"))
+ {
+ string versionString = line.Split(' ')[1];
+ Version version = new Version(versionString);
+ if (version.Major > 6 || (version.Major == 6 && version.Minor >= 0))
+ {
+ // 大于等于 6.0.0 的 .NET 运行时已安装
+ isNETCoreRuntimeInstalled = true;
+ continue;
+ }
+ }
+ }
+
+ if (isAspNetCoreRuntimeInstalled && isNETCoreRuntimeInstalled)
+ {
+ // 执行逻辑,表示大于等于 6.0.0 的 .NET 运行时已安装
+
+ WinformLog("当前系统>= 6.0.0 NetCore 运行时已安装", Color.Green);
+
+ isRuntimeTestOk = true;
+
+ }
+ else
+ {
+
+
+ WinformLog("当前系统>= 6.0.0 NetCore 运行时未安装,请安装后,再运行该程序", Color.Red);
+
+ connectButton.Enabled = false;
+
+ //await Task.Run(() =>
+ // {
+ // WinformLog("现在为您启动安装Net core 运行时...", Color.Orange);
+
+ // string runtimePath = Path.Combine(AppContext.BaseDirectory, "Resource/NetCoreRuntime/dotnet-hosting-6.0.0-win.exe");
+
+ // var processInfo = new ProcessStartInfo
+ // {
+ // FileName = runtimePath, // 安装程序的文件名
+ // Arguments = $"/S /v /qn REINSTALLMODE=vomus",
+
+ // UseShellExecute = false
+ // };
+
+ // var otherProcess = new Process { StartInfo = processInfo };
+ // otherProcess.Start();
+ // otherProcess.WaitForExit();
+
+ // WinformLog("Net core 6.0.0 运行时安装完成", Color.Green);
+ // });
+
+
+ }
+ }
+
+
private void testDBBtn_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(dbNameTBox.Text))
@@ -205,13 +302,14 @@ namespace Start
testServicebtn_Click(null, null);
testDBBtn_Click(null, null);
- if (string.IsNullOrWhiteSpace(this.folderPathTbox.Text) )
+
+ if (string.IsNullOrWhiteSpace(this.folderPathTbox.Text))
{
WinformLog($"请选择部署路径,测试的端口,数据库名,服务名都成功才可以进行确认", Color.Red);
return;
}
- if(isDBNameTestOK == false || isPortTestOk == false || isServiceTestOk == false)
+ if (isDBNameTestOK == false || isPortTestOk == false || isServiceTestOk == false)
{
WinformLog($"测试的端口,数据库名,服务名都成功才可以进行确认", Color.Red);
return;
@@ -269,7 +367,7 @@ namespace Start
{
if (InvokeRequired)
{
- Invoke(WinformLog, message, color);
+ Invoke(new Action(() => WinformLog(message, color)));
return;
}
@@ -318,7 +416,7 @@ namespace Start
var serviceDisplayName = serviceDisplayNameTBox.Text;
var nginxServiceName = nginxServiceNameTbox.Text;
- var nginxServiceDesName=nginxServiceDisplayNameTbox.Text;
+ var nginxServiceDesName = nginxServiceDisplayNameTbox.Text;
var deployFoder = this.folderPathTbox.Text;
@@ -339,8 +437,8 @@ namespace Start
var apiBinPath = Path.Combine(deployFoder, "EIImageViewerService/EI_Image_Viewer.exe");
var apiJsonConfigPath = Path.Combine(deployFoder, "EIImageViewerService/appsettings.CertificateApply.json");
- string nginxRarFilePath = Path.Combine(AppContext.BaseDirectory, $@"Resource\EIImageViewerWeb.rar");
- string apiRarFilePath = Path.Combine(AppContext.BaseDirectory, "Resource/EIImageViewerService.rar");
+ string nginxRarFilePath = Path.Combine(AppContext.BaseDirectory, $@"Resource\EIImageViewerWeb.rar");
+ string apiRarFilePath = Path.Combine(AppContext.BaseDirectory, "Resource/EIImageViewerService.rar");
string dataRarFilePath = Path.Combine(AppContext.BaseDirectory, "Resource/EIImageViewerData.rar");
@@ -641,7 +739,7 @@ namespace Start
nginxStartPath = nginxStartPath,
serviceName = serviceName,
nginxServiceName = nginxServiceName,
- nginxServiceEXEPath= nginxServiceEXEPath
+ nginxServiceEXEPath = nginxServiceEXEPath
};
File.WriteAllText(Path.Combine(directoryPath, "config.json"), JsonConvert.SerializeObject(configObj));
@@ -789,8 +887,9 @@ namespace Start
UseShellExecute = true,
Verb = "open"
};
- Process.Start(start);
+ var urlProcess= Process.Start(start);
+ urlProcess.WaitForExit(); // 等待进程结束
}
catch (Exception ex)
{
@@ -800,10 +899,14 @@ namespace Start
}
else
{
- WinformLog($"后端服务启动失败,可以手动启动{serviceDisplayName}尝试", Color.Red);
+ WinformLog($"后端服务启动失败,您可手动启动{serviceDisplayName}尝试,如若手动尝试还是无法启动,请联系技术人员确认部署环境", Color.Red);
}
#endregion
+
+ await Task.Delay(10000);
+ Application.Exit();
+
});
@@ -848,22 +951,65 @@ namespace Start
.WriteTo.File("logs\\log.txt", rollingInterval: RollingInterval.Day)
.CreateLogger();
+ // 检查是否安装了 SQL Server
+ bool isSqlServerInstalled = false;
+ RegistryKey key = null;
-
-
- // Check if any version of SQL Server is installed
- RegistryKey sqlServerKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Microsoft SQL Server");
-
- if (sqlServerKey != null)
+ try
{
- WinformLog("当前系统SQL Server 已安装", Color.Green);
+ key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server");
+ if (key != null)
+ isSqlServerInstalled = true;
+ }
+ finally
+ {
+ key?.Close();
+ }
+
+ if (isSqlServerInstalled)
+ {
+ // 获取 SQL Server 实例列表
+ key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL");
+ if (key != null)
+ {
+ foreach (var instanceName in key.GetValueNames())
+ {
+ WinformLog($"当前系统SQL Server 已安装实例: {instanceName}", Color.Green);
+ }
+ }
}
else
{
WinformLog("SQL Server 未安装,请安装后再运行该部署程序", Color.Red);
+
}
+ key?.Close();
+
+
+
+ //// Check if any version of SQL Server is installed
+ //RegistryKey sqlServerKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Microsoft SQL Server");
+
+ //if (sqlServerKey != null)
+ //{
+ // WinformLog("当前系统SQL Server 已安装", Color.Green);
+ //}
+ //else
+ //{
+ // WinformLog("SQL Server 未安装,请安装后再运行该部署程序", Color.Red);
+ //}
+
+
+
+ testNetcoreRuntime();
+
+ this.TopMost = true;
+ this.Activate();
+
}
+
+
}
}
diff --git a/Start/Properties/DataSources/Main.datasource b/Start/Properties/DataSources/Main.datasource
deleted file mode 100644
index 81a12c76..00000000
--- a/Start/Properties/DataSources/Main.datasource
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Start.Main, Start, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
-
\ No newline at end of file
diff --git a/Start/Resource/EIImageViewerData.rar b/Start/Resource/EIImageViewerData.rar
index f1fd20f1..77da95e4 100644
Binary files a/Start/Resource/EIImageViewerData.rar and b/Start/Resource/EIImageViewerData.rar differ
diff --git a/Start/Resource/EIImageViewerService.rar b/Start/Resource/EIImageViewerService.rar
index 1521c1e8..1e088962 100644
Binary files a/Start/Resource/EIImageViewerService.rar and b/Start/Resource/EIImageViewerService.rar differ
diff --git a/Start/Resource/UnInstall.exe b/Start/Resource/UnInstall.exe
new file mode 100644
index 00000000..d339e5b3
Binary files /dev/null and b/Start/Resource/UnInstall.exe differ
diff --git a/UnInstall/Program.cs b/UnInstall/Program.cs
index f6b43fb6..1b127d42 100644
--- a/UnInstall/Program.cs
+++ b/UnInstall/Program.cs
@@ -5,6 +5,7 @@ using Serilog;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Drawing;
+using static System.Net.Mime.MediaTypeNames;
async Task ProcessStandardInputAsync(Process process, string cmd, string workDirectory = "")
{
@@ -32,6 +33,10 @@ void DeleteFolderContents(string path)
foreach (FileInfo file in directory.GetFiles())
{
+ if (file.FullName.Contains("UnInstall"))
+ {
+ continue;
+ }
try
{
@@ -56,12 +61,12 @@ void DeleteFolderContents(string path)
MyLog($"File {file.FullName} cannot be deleted. {ex2.Message}");
}
-
+
}
-
-
+
+
}
foreach (DirectoryInfo subDirectory in directory.GetDirectories())
@@ -70,20 +75,21 @@ void DeleteFolderContents(string path)
}
}
- void MyLog(string message)
+
+void MyLog(string message)
{
Console.WriteLine(message);
- Serilog.Log.Information(message);
+ //Serilog.Log.Information(message);
}
-Serilog.Log.Logger = new LoggerConfiguration()
- .WriteTo.File("logs\\UninstallLog.txt", rollingInterval: RollingInterval.Day)
- .CreateLogger();
+//Serilog.Log.Logger = new LoggerConfiguration()
+// .WriteTo.File("logs\\UninstallLog.txt", rollingInterval: RollingInterval.Day)
+// .CreateLogger();
-var startProList = Process.GetProcesses().Where(t => t.ProcessName.Contains("Start")).ToList();
+var startProList = Process.GetProcesses().Where(t => t.ProcessName.Contains("EI_Image_Viewer_Installer")).ToList();
foreach (var item in startProList)
{
item.Kill();
@@ -92,7 +98,7 @@ foreach (var item in startProList)
var configFolder = $@"C:\ProgramData\.xingcang\";
-var configPath =Path.Combine(configFolder, "config.json") ;
+var configPath = Path.Combine(configFolder, "config.json");
if (!File.Exists(configPath))
{
MyLog("当前系统未部署影像系统,无须卸载");
@@ -132,8 +138,8 @@ else
nginxStartPath = jObject["nginxStartPath"].ToString(),
//apiPath = jObject["apiPath"].ToString(),
serviceName = jObject["serviceName"].ToString(),
- nginxServiceName= jObject["nginxServiceName"]?.ToString(),
- nginxServiceEXEPath= jObject["nginxServiceEXEPath"]?.ToString(),
+ nginxServiceName = jObject["nginxServiceName"]?.ToString(),
+ nginxServiceEXEPath = jObject["nginxServiceEXEPath"]?.ToString(),
};
MyLog("激活信息读取完毕,开始准备卸载...");
@@ -167,7 +173,7 @@ else
- MyLog("停止并卸载后端服务...");
+ MyLog("停止并卸载后端服务...");
await ProcessStandardInputAsync(process, $"sc stop {configObj.serviceName}");
await ProcessStandardInputAsync(process, $"sc delete {configObj.serviceName}");
@@ -181,27 +187,35 @@ else
process.StandardInput.Close();
process.WaitForExit();
- MyLog("删除部署文件夹下的所有内容...");
+ await Task.Delay(3000);
+
+ MyLog($"删除部署文件夹{configObj.deployFolder}下可删除的所有内容...");
DeleteFolderContents(configObj.deployFolder);
- DeleteFolderContents(configFolder);
-
MyLog("删除激活信息...");
-
+ DeleteFolderContents(configFolder);
MyLog("EI Image Viewer 服务卸载完成。");
-
+ MyLog("3s 后自动退出...");
+ await Task.Delay(3000);
+
+ string cmdArgs = $"/C ping 127.0.0.1 -n 5 & rmdir /s /q \"{configObj.deployFolder}\"";
+ ProcessStartInfo psi = new ProcessStartInfo("cmd.exe", cmdArgs);
+ psi.WindowStyle = ProcessWindowStyle.Hidden;
+ psi.CreateNoWindow = true;
+ Process.Start(psi);
+
+ Environment.Exit(0);
+
}
catch (Exception ex)
{
- MyLog("程序出错:" + ex.Message);
- }
- finally
- {
+ MyLog("错误:" + ex.Message);
Console.ReadLine();
}
+
}