} // !Load() /// <summary> /// Loads a ZUGFeRD invoice from a file. /// /// Please make sure that the file is exists, otherwise this call will raise a FileNotFoundException. /// </summary> /// <param name="filename">Name of the ZUGFeRD invoice file</param> /// <returns></returns> public static InvoiceDescriptor Load(string filename) { IInvoiceDescriptorReader reader = new InvoiceDescriptor1Reader(); if (reader.IsReadableByThisReaderVersion(filename)) { return(reader.Load(filename)); } reader = new InvoiceDescriptor20Reader(); if (reader.IsReadableByThisReaderVersion(filename)) { return(reader.Load(filename)); } reader = new InvoiceDescriptor21Reader(); if (reader.IsReadableByThisReaderVersion(filename)) { return(reader.Load(filename)); } throw new UnsupportedException("No ZUGFeRD invoice reader was able to parse this file '" + filename + "'!"); // return null; } // !Load()
} // !Load() public static InvoiceDescriptor Load(string filename) { IInvoiceDescriptorReader reader = new InvoiceDescriptor1Reader(); if (reader.IsReadableByThisReaderVersion(filename)) { return(reader.Load(filename)); } reader = new InvoiceDescriptor20Reader(); if (reader.IsReadableByThisReaderVersion(filename)) { return(reader.Load(filename)); } reader = new InvoiceDescriptor21Reader(); if (reader.IsReadableByThisReaderVersion(filename)) { return(reader.Load(filename)); } return(null); } // !Load()