using WorkCameraExport.Services;
namespace WorkCameraExport.Models
{
///
/// 应用配置 - 用户可配置项
///
public class AppConfig
{
///
/// 默认保存路径
///
public string DefaultSavePath { get; set; } = "";
///
/// 图片下载并发数 (1-10)
///
public int ImageDownloadConcurrency { get; set; } = 5;
///
/// 图片压缩质量 (30-100)
///
public int ImageCompressQuality { get; set; } = 50;
///
/// 自动清理临时文件
///
public bool AutoCleanTempFiles { get; set; } = true;
///
/// 验证并修正配置值
///
public void Validate()
{
if (ImageDownloadConcurrency < 1) ImageDownloadConcurrency = 1;
if (ImageDownloadConcurrency > 10) ImageDownloadConcurrency = 10;
if (ImageCompressQuality < 30) ImageCompressQuality = 30;
if (ImageCompressQuality > 100) ImageCompressQuality = 100;
if (string.IsNullOrWhiteSpace(DefaultSavePath))
{
DefaultSavePath = PathService.ExportDirectory;
}
}
///
/// 创建默认配置
///
public static AppConfig CreateDefault()
{
return new AppConfig
{
DefaultSavePath = PathService.ExportDirectory,
ImageDownloadConcurrency = 5,
ImageCompressQuality = 50,
AutoCleanTempFiles = true
};
}
}
}