//FIXME: private static string GetMessage(PdfError error) { switch (error) { case PdfError.Success: return("没有错误"); case PdfError.CannotOpenFile: return("文件未找到或无法打开"); case PdfError.InvalidFormat: return("文件不是PDF格式或损坏"); case PdfError.PasswordProtected: return("需要密码或不正确的密码"); case PdfError.UnsupportedSecurityScheme: return("不支持的安全方案"); case PdfError.PageNotFound: return("页面找不到或内容错误"); default: return("未知错误"); } }
private static string GetMessage(PdfError error) { switch (error) { case PdfError.Success: return("No error"); case PdfError.CannotOpenFile: return("File not found or could not be opened"); case PdfError.InvalidFormat: return("File not in PDF format or corrupted"); case PdfError.PasswordProtected: return("Password required or incorrect password"); case PdfError.UnsupportedSecurityScheme: return("Unsupported security scheme"); case PdfError.PageNotFound: return("Page not found or content error"); default: return("Unknown error"); } }
private static string GetMessage(PdfError error) { return(error switch { PdfError.Success => "No error", PdfError.CannotOpenFile => "File not found or could not be opened", PdfError.InvalidFormat => "File not in PDF format or corrupted", PdfError.PasswordProtected => "Password required or incorrect password", PdfError.UnsupportedSecurityScheme => "Unsupported security scheme", PdfError.PageNotFound => "Page not found or content error", _ => "Unknown error", });
public PdfException(PdfError error) : this(GetMessage(error)) { Error = error; }