public CapDocument(string filePath) { var fileStream = File.OpenRead(filePath); XDocument xDocument = XDocument.Load(fileStream); capValidateResults = CapValidator.Validate(xDocument); //if (IsValid()) { //不論是否驗證成功都顯示結果 perform(xDocument); //} fileStream.Close(); }
/// <summary> /// 驗證Cap檔案 /// </summary> /// <returns>驗證結果</returns> public static List <CapValidateResult> Validate(string filePath) { // var fileStream = File.OpenRead(filePath); using (var fileStream = System.IO.File.OpenRead(filePath)) { XDocument xDocument = XDocument.Load(fileStream); return(CapValidator.Validate(xDocument)); } /* * var fileStream = File.OpenRead(filePath); * XDocument xDocument = XDocument.Load(fileStream); * return CapValidator.Validate(xDocument); */ }
/// <summary> /// 驗證CapDocument物件 /// </summary> /// <returns>驗證結果</returns> public List <CapValidateResult> Validate() { return(CapValidator.Validate(this)); }