using Entities.Contracts; // 假设这些实体合约仍然是必需的 using System.Text.RegularExpressions; using System.Text; namespace TechHelper.Client.Exam { public enum ParseErrorType { Validation = 1, DataParsing = 2, Structural = 3, RegexMatchIssue = 4, UnexpectedError = 5 } public class ParseError { public ParseErrorType Type { get; } public string Message { get; } public int? Index { get; } public string MatchedText { get; } public Exception InnerException { get; } public ParseError(ParseErrorType type, string message, int? index = null, string matchedText = null, Exception innerException = null) { Type = type; Message = message; Index = index; MatchedText = matchedText; InnerException = innerException; } public override string ToString() { var sb = new StringBuilder(); sb.Append($"[{Type}] {Message}"); if (Index.HasValue) sb.Append($" (Index: {Index.Value})"); if (!string.IsNullOrEmpty(MatchedText)) sb.Append($" (MatchedText: '{MatchedText}')"); if (InnerException != null) sb.Append($" InnerException: {InnerException.Message}"); return sb.ToString(); } } public class AssignmentEx { public string Title { get; set; } = "Title"; public string Description { get; set; } = "Description"; public SubjectAreaEnum SubjectArea { get; set; } = SubjectAreaEnum.Unknown; public AssignmentQuestionEx ExamStruct { get; set; } = new AssignmentQuestionEx(); public List Errors { get; set; } = new List(); } public class AssignmentQuestionEx { public string Title { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public byte Index { get; set; } = 0; public float Score { get; set; } public QuestionEx? Question { get; set; } public AssignmentStructType Type { get; set; } public List ChildrenAssignmentQuestion { get; set; } = new List(); public int Priority { get; set; } } public class QuestionEx { public string Title { get; set; } = string.Empty; public string Answer { get; set; } = string.Empty; public List