com.alicizax.unity.tuyoogam.../Editor/AssetArtScanner/ScannerResult.cs

72 lines
1.8 KiB
C#
Raw Normal View History

2025-02-28 16:11:01 +08:00

namespace YooAsset.Editor
{
public class ScannerResult
{
/// <summary>
/// 报告对象
/// </summary>
public ScanReport Report { private set; get; }
/// <summary>
/// 错误信息
/// </summary>
public string ErrorInfo { private set; get; }
2025-09-23 12:03:44 +08:00
/// <summary>
/// 错误堆栈
/// </summary>
public string ErrorStack { private set; get; }
2025-02-28 16:11:01 +08:00
/// <summary>
/// 是否成功
/// </summary>
public bool Succeed
{
get
{
if (string.IsNullOrEmpty(ErrorInfo))
return true;
else
return false;
}
}
2025-09-23 12:03:44 +08:00
public ScannerResult(string error, string stack)
2025-02-28 16:11:01 +08:00
{
ErrorInfo = error;
2025-09-23 12:03:44 +08:00
ErrorStack = stack;
2025-02-28 16:11:01 +08:00
}
2025-11-05 19:31:46 +08:00
public ScannerResult(ScanReport report)
2025-02-28 16:11:01 +08:00
{
Report = report;
}
/// <summary>
/// 打开报告窗口
/// </summary>
public void OpenReportWindow()
{
if (Succeed)
{
var reproterWindow = AssetArtReporterWindow.OpenWindow();
2025-09-02 19:21:49 +08:00
reproterWindow.ImportSingleReprotFile(Report);
2025-02-28 16:11:01 +08:00
}
}
2025-11-05 19:31:46 +08:00
/// <summary>
/// 保存报告文件
/// </summary>
public void SaveReportFile(string saveDirectory)
{
if (Report == null)
throw new System.Exception("Scan report is invalid !");
if (string.IsNullOrEmpty(saveDirectory))
saveDirectory = "Assets/";
string filePath = $"{saveDirectory}/{Report.ReportName}_{Report.ReportDesc}.json";
ScanReportConfig.ExportJsonConfig(filePath, Report);
}
2025-02-28 16:11:01 +08:00
}
}