Adopt Semi desktop theme and fix UTF-8 process logs for 0.2.3

This commit is contained in:
tongtong committed 2026-11-13 14:56:19 +08:00
1 parent 5b3022e1f3
commit dc8edf0df6
16 files changed
+161 -55

No files matched your search

@@ -136,7 +136,7 @@ public partial class AgentManagementViewModel : ObservableObject, IDisposable
private async Task<JsonElement> LocalRequestAsync(object request)
{
var executable=DesktopPaths.ResolveTool(DesktopPaths.FindTool("adsctl"),"adsctl");
var info=ProcessTools.CreateStartInfo(executable,["--json","--config",ConfigPath,"request"]);info.RedirectStandardInput=true;
var info=ProcessTools.CreateStartInfo(executable,["--json","--config",ConfigPath,"request"]);info.RedirectStandardInput=true;info.StandardInputEncoding=new System.Text.UTF8Encoding(false);
using var process=Process.Start(info) ?? throw new InvalidOperationException("adsctl 无法启动。");
var output=process.StandardOutput.ReadToEndAsync();var error=process.StandardError.ReadToEndAsync();
await process.StandardInput.WriteAsync(JsonSerializer.Serialize(request));process.StandardInput.Close();
@@ -219,7 +219,7 @@ public partial class AgentManagementViewModel : ObservableObject, IDisposable
if(!File.Exists(ConfigPath))throw new InvalidOperationException("请先导入 agent.env 并初始化本机配置,再启动 Agent。");
try { await LocalRequestAsync(new{op="status"});Notice="本机 Agent 已在运行。";return; } catch(InvalidOperationException){}
var info=ProcessTools.CreateStartInfo(DesktopPaths.ResolveTool(DesktopPaths.FindTool("ads-agent"),"ads-agent"),["--quiet","--supervise","--config",ConfigPath]);
info.RedirectStandardOutput=false;info.RedirectStandardError=false;
info.RedirectStandardOutput=false;info.RedirectStandardError=false;info.StandardOutputEncoding=null;info.StandardErrorEncoding=null;
using var process=Process.Start(info) ?? throw new InvalidOperationException("Agent 启动失败。");
await Task.Delay(700,lifetime.Token);await RefreshCoreAsync();Notice="后台 Agent 已启动,退出托盘不会停止它。";
});