/// <summary> /// 两个 Opc 文件不匹配异常 /// </summary> /// <param name="exception"></param> /// <param name="xmlFileName"></param> /// <param name="opcFile1"></param> /// <param name="opcFile2"></param> /// <param name="xmlFile1"></param> /// <param name="xmlFile2"></param> public OpenPackageConventionFileNoMatchException(ElementNotMatchException exception, string xmlFileName, FileInfo opcFile1, FileInfo opcFile2, FileInfo xmlFile1, FileInfo xmlFile2) : base(ToString(xmlFileName, exception, opcFile1, opcFile2), exception) { Exception = exception; XmlFileName = xmlFileName; OpcFile1 = opcFile1; OpcFile2 = opcFile2; XmlFile1 = xmlFile1; XmlFile2 = xmlFile2; }
private static string ToString(string xmlFileName, ElementNotMatchException exception, FileInfo opcFile1, FileInfo opcFile2) { return($"{xmlFileName} 文件不匹配。不匹配的行是第 {exception.LineNumber} 行。不匹配的元素是 {exception.Element1.Name} ;内容分别是 {exception.Element1.Value} 和 {exception.Element2?.Value} ;\r\n文件1:{opcFile1.FullName} ;\r\n文件2:{opcFile2} ;"); }