新增 OTA WatchDog 编排与车队健康/报警后端。
覆盖包库回传、任务下发、CDM 任务同步与报警采集,并为包/任务 ID 与上传文件名加上路径安全校验。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
namespace MiGu.Server.Ota;
|
||||
|
||||
/// <summary>MDC 组件文件映射(对齐参考工具 MDCPath.json)。</summary>
|
||||
public static class OtaPathMap
|
||||
{
|
||||
public static readonly IReadOnlyDictionary<string, string[]> Default = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["M"] = new[] { "Medulla.exe", "plugins\\CartActivator.dll", "plugins\\CartActivator.pdb" },
|
||||
["D"] = new[] { "Detour.exe" },
|
||||
["C"] = new[] { "ClumsyConsole.exe", "FG2305014_C.dll", "FG2305014_C.pdb" }
|
||||
};
|
||||
|
||||
public static readonly string[] ComponentKeys =
|
||||
{
|
||||
"M.exe", "M.dll", "M.pdb", "D.exe", "C.exe", "C.dll", "C.pdb"
|
||||
};
|
||||
|
||||
public static string? RelPathFor(string componentKey)
|
||||
{
|
||||
return componentKey switch
|
||||
{
|
||||
"M.exe" => "M/Medulla.exe",
|
||||
"M.dll" => "M/plugins/CartActivator.dll",
|
||||
"M.pdb" => "M/plugins/CartActivator.pdb",
|
||||
"D.exe" => "D/Detour.exe",
|
||||
"C.exe" => "C/ClumsyConsole.exe",
|
||||
"C.dll" => "C/FG2305014_C.dll",
|
||||
"C.pdb" => "C/FG2305014_C.pdb",
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
public static string? WatchDogUpdatePath(string componentKey) => componentKey switch
|
||||
{
|
||||
"M.exe" => "updateMedullaExecutable",
|
||||
"M.dll" => "updateMedullaDll",
|
||||
"M.pdb" => "UpdateMedullaPdb",
|
||||
"D.exe" => "updateDetourExecutable",
|
||||
"C.exe" => "updateClumsyExecutable",
|
||||
"C.dll" => "updateClumsyDll",
|
||||
"C.pdb" => "UpdateClumsyPdb",
|
||||
_ => null
|
||||
};
|
||||
|
||||
public static string AppFolder(string componentKey) => componentKey.StartsWith('M') ? "M"
|
||||
: componentKey.StartsWith('D') ? "D" : "C";
|
||||
|
||||
public static string ExtKey(string componentKey)
|
||||
{
|
||||
var i = componentKey.IndexOf('.');
|
||||
return i >= 0 ? componentKey[(i + 1)..] : componentKey;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user