feat: 差不多搞完了,还有一个简单的脚本,还有一些测试,实际的正式测试,代码风格,文档等的修改

This commit is contained in:
zerlei 2024-10-11 16:32:36 +08:00
parent 35a0710ab5
commit 1e033e2ca3
6 changed files with 33 additions and 16 deletions

View file

@ -11,6 +11,9 @@ IConfiguration _configuration = configurationBuilder.Build();
LocalSyncServer.TempRootFile = _configuration["TempDir"] ?? "C:/TempPack"; LocalSyncServer.TempRootFile = _configuration["TempDir"] ?? "C:/TempPack";
LocalSyncServer.SqlPackageAbPath = LocalSyncServer.SqlPackageAbPath =
_configuration["SqlPackageAbPath"] ?? "C:\\Users\\ZHAOLEI\\.dotnet\\tools\\sqlpackage.exe"; _configuration["SqlPackageAbPath"] ?? "C:\\Users\\ZHAOLEI\\.dotnet\\tools\\sqlpackage.exe";
LocalSyncServer.MSBuildAbPath =
_configuration["MSBuildAbPath"]
?? "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe";
//LocalSyncServer.MsdeployAbPath = //LocalSyncServer.MsdeployAbPath =
// _configuration["MsdeployAbPath"] // _configuration["MsdeployAbPath"]

View file

@ -165,8 +165,8 @@ public class DeployHelper(LocalSyncServer context)
FileName = LocalSyncServer.MSBuildAbPath, // The command to execute (can be any command line tool) FileName = LocalSyncServer.MSBuildAbPath, // The command to execute (can be any command line tool)
Arguments = Arguments =
$" {Context.NotNullSyncConfig.LocalProjectAbsolutePath} /t:ResolveReferences" $" {Context.NotNullSyncConfig.LocalProjectAbsolutePath} /t:ResolveReferences"
+ $" /t:Compile /p:Configuration=Release /t:_CopyWebApplication /p:OutputPath={LocalSyncServer.TempRootFile}/bin" + $" /t:Compile /p:Configuration=Release /t:_CopyWebApplication /p:OutputPath={Context.NotNullSyncConfig.LocalRootPath}/bin"
+ $" /p:WebProjectOutputDir={LocalSyncServer.TempRootFile}", + $" /p:WebProjectOutputDir={Context.NotNullSyncConfig.LocalRootPath}",
// The arguments to pass to the command (e.g., list directory contents) // The arguments to pass to the command (e.g., list directory contents)
RedirectStandardOutput = true, // Redirect the standard output to a string RedirectStandardOutput = true, // Redirect the standard output to a string
RedirectStandardError = true, RedirectStandardError = true,
@ -187,6 +187,9 @@ public class DeployHelper(LocalSyncServer context)
if (bprocess.ExitCode == 0) if (bprocess.ExitCode == 0)
{ {
Context.LocalPipe.SendMsg(CreateMsg("本地编译成功!")).Wait(); Context.LocalPipe.SendMsg(CreateMsg("本地编译成功!")).Wait();
var h = new DiffFileAndPackHelper(Context);
Context.SetStateHelper(h);
h.DiffProcess();
} }
else else
{ {

View file

@ -165,7 +165,7 @@ public class SyncFilesController(RemoteSyncServerFactory factory, SqliteDbContex
} }
[HttpPost("/UploadFile")] [HttpPost("/UploadFile")]
public async Task<IActionResult> UploadFile(IFormFile file, [FromQuery] string Id) public async Task<IActionResult> UploadFile(IFormFile file)
{ {
try try
{ {
@ -173,15 +173,14 @@ public class SyncFilesController(RemoteSyncServerFactory factory, SqliteDbContex
{ {
throw new Exception("文件不存在!"); throw new Exception("文件不存在!");
} }
var uploadPath = Path.Combine(RemoteSyncServer.TempRootFile, Id); if (!Directory.Exists(RemoteSyncServer.TempRootFile))
if (!Directory.Exists(uploadPath)) Directory.CreateDirectory(RemoteSyncServer.TempRootFile);
Directory.CreateDirectory(uploadPath); var filePath = Path.Combine(RemoteSyncServer.TempRootFile, file.FileName);
var filePath = Path.Combine(uploadPath, file.FileName);
using (var stream = new FileStream(filePath, FileMode.Create)) using (var stream = new FileStream(filePath, FileMode.Create))
{ {
await file.CopyToAsync(stream); await file.CopyToAsync(stream);
} }
var server = Factory.GetServerById(Id); var server = Factory.GetServerById(file.FileName.Split('.').First());
if (server == null) if (server == null)
{ {
throw new Exception("不存在的Id"); throw new Exception("不存在的Id");

View file

@ -13,8 +13,8 @@ public class PipeSeed : IDisposable
Name = "Test", Name = "Test",
RemoteUrl = "D:/FileSyncTest/dtemp", RemoteUrl = "D:/FileSyncTest/dtemp",
RemotePwd = "t123", RemotePwd = "t123",
IsDeployDb = false, IsDeployDb = true,
IsDeployProject = false, IsDeployProject = true,
LocalProjectAbsolutePath = "D:/git/HMES-H7-HNFY/HMES-H7-HNFYMF/HMES-H7-HNFYMF.WEB", LocalProjectAbsolutePath = "D:/git/HMES-H7-HNFY/HMES-H7-HNFYMF/HMES-H7-HNFYMF.WEB",
LocalRootPath = "D:/FileSyncTest/src", LocalRootPath = "D:/FileSyncTest/src",

View file

@ -52,9 +52,9 @@ public class PipeTest
RemoteSyncServer.TempRootFile = "D:/FileSyncTest/dtemp"; RemoteSyncServer.TempRootFile = "D:/FileSyncTest/dtemp";
RemoteSyncServerFactory.NamePwd = [new Tuple<string, string>("Test", "t123")]; RemoteSyncServerFactory.NamePwd = [new Tuple<string, string>("Test", "t123")];
var lf = new LocalSyncServerFactory(); var lf = new LocalSyncServerFactory();
var task1 = Task.Run(() => var task1 = Task.Run(async () =>
{ {
lf.CreateLocalSyncServer(p2, "Test", p3).RunSynchronously(); await lf.CreateLocalSyncServer(p2, "Test", p3);
}); });
var rf = new RemoteSyncServerFactory(); var rf = new RemoteSyncServerFactory();

View file

@ -66,16 +66,15 @@ function publishCB(MsgIt) {
if (MsgIt.Body == "发布完成!") { if (MsgIt.Body == "发布完成!") {
CStatus.value = 'Success' CStatus.value = 'Success'
Pipe.ClosePipe() Pipe.ClosePipe()
window.alert("正确:发布完成!") dialogShow("正确:发布完成!")
} }
} }
if (MsgIt.Step == 8) { if (MsgIt.Step == 8) {
if (CStatus.value != "Success") { if (CStatus.value != "Success") {
window.alert("失败:请查看错误信息!") dialogShow("失败:请查看错误信息!")
} }
CStatus.value = "None" CStatus.value = "None"
} }
} }
function submit() { function submit() {
Msgs.value = [] Msgs.value = []
@ -93,7 +92,7 @@ function submit() {
} }
catch (e) { catch (e) {
window.alert(e) dialogShow(e)
} }
} }
function onLoad(name) { function onLoad(name) {
@ -123,6 +122,15 @@ onMounted(() => {
cacheConfig.value = JSON.parse(cacheConfigStr) cacheConfig.value = JSON.parse(cacheConfigStr)
} }
}) })
const dMsg = ref('')
function dialogClose() {
document.getElementById('dialog').close()
}
function dialogShow(msg) {
dMsg.value = msg
document.getElementById('dialog').showModal()
}
</script> </script>
<template> <template>
@ -144,6 +152,10 @@ onMounted(() => {
</p> </p>
</div> </div>
</div> </div>
<dialog id="dialog">
<p>{{ dMsg }}</p>
<button @click="dialogClose">关闭</button>
</dialog>
<button :disabled="CStatus != 'None'" style="margin-top: 20px;" @click="submit">发布</button> <button :disabled="CStatus != 'None'" style="margin-top: 20px;" @click="submit">发布</button>