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

View file

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

View file

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

View file

@ -52,9 +52,9 @@ public class PipeTest
RemoteSyncServer.TempRootFile = "D:/FileSyncTest/dtemp";
RemoteSyncServerFactory.NamePwd = [new Tuple<string, string>("Test", "t123")];
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();

View file

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