namespace YooAsset.Editor { public class ScannerResult { /// /// 报告对象 /// public ScanReport Report { private set; get; } /// /// 错误信息 /// public string ErrorInfo { private set; get; } /// /// 错误堆栈 /// public string ErrorStack { private set; get; } /// /// 是否成功 /// public bool Succeed { get { if (string.IsNullOrEmpty(ErrorInfo)) return true; else return false; } } public ScannerResult(string error, string stack) { ErrorInfo = error; ErrorStack = stack; } public ScannerResult(ScanReport report) { Report = report; } /// /// 打开报告窗口 /// public void OpenReportWindow() { if (Succeed) { var reproterWindow = AssetArtReporterWindow.OpenWindow(); reproterWindow.ImportSingleReprotFile(Report); } } /// /// 保存报告文件 /// 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); } } }