using AxiOmron.PcbCheck.Models;
using AxiOmron.PcbCheck.Options;
using AxiOmron.PcbCheck.Services.Interfaces;
namespace AxiOmron.PcbCheck.DesignTime;
///
/// 为设计器提供文件校验通道测试结果的设计时服务。
///
public sealed class DesignTimeSftpLookupService : IFileCheckService
{
///
/// 返回设计时文件校验结果。
///
/// 条码。
/// 取消令牌。
/// 固定设计时结果。
public Task CheckFileAsync(string barcode, CancellationToken cancellationToken)
{
return Task.FromResult(new FileCheckOutcome
{
Exists = true,
ConnectionSucceeded = true,
MatchedFilePath = $"/pcb/{barcode}.txt"
});
}
///
/// 返回设计时产品 ID 文件删除结果,不执行实际文件操作。
///
/// 设计时文件路径。
/// 取消令牌。
/// 固定成功结果。
public Task DeleteMatchedFileAsync(string filePath, CancellationToken cancellationToken)
{
return Task.FromResult(new FileDeleteOutcome
{
IsSuccess = true,
FilePath = filePath
});
}
///
/// 返回设计时文件校验通道测试结果。
///
/// 根配置。
/// 取消令牌。
/// 固定成功结果。
public Task TestConnectionAsync(AppConfig? config, CancellationToken cancellationToken)
{
return Task.FromResult(new FileCheckTestOutcome
{
IsSuccess = true,
ConnectionSucceeded = true,
RootPathAccessible = true,
StatusMessage = "设计时文件校验通道可用。"
});
}
}