public new static InvoiceDescriptor Load(string filename)
        {
            IInvoiceDescriptorReader reader = new InvoiceDescriptor1Reader();

            if (reader.IsReadableByThisReaderVersion(filename))
            {
                return(reader.Load(filename));
            }

            reader = new InvoiceDescriptor2Reader();
            if (reader.IsReadableByThisReaderVersion(filename))
            {
                return(reader.Load(filename));
            }

            reader = new InvoiceDescriptorXRechnungReader();
            if (reader.IsReadableByThisReaderVersion(filename))
            {
                return(reader.Load(filename));
            }

            reader = new InvoiceDescriptorFacturXReader();
            if (reader.IsReadableByThisReaderVersion(filename))
            {
                return(reader.Load(filename));
            }

            return(null);
        }
示例#2
0
        } // !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()
        public override InvoiceDescriptor Load(Stream stream)
        {
            IInvoiceDescriptorReader reader = new InvoiceDescriptor1Reader();

            if (reader.IsReadableByThisReaderVersion(stream))
            {
                return(reader.Load(stream));
            }

            reader = new InvoiceDescriptor2Reader();
            if (reader.IsReadableByThisReaderVersion(stream))
            {
                return(reader.Load(stream));
            }

            reader = new InvoiceDescriptorXRechnungReader();
            if (reader.IsReadableByThisReaderVersion(stream))
            {
                return(reader.Load(stream));
            }

            reader = new InvoiceDescriptorFacturXReader();
            if (reader.IsReadableByThisReaderVersion(stream))
            {
                return(reader.Load(stream));
            }

            return(null);
        }
示例#4
0
        public static InvoiceDescriptor Load(Stream stream)
        {
            IInvoiceDescriptorReader reader = new InvoiceDescriptor1Reader();

            if (reader.IsReadableByThisReaderVersion(stream))
            {
                return(reader.Load(stream));
            }

            reader = new InvoiceDescriptor2Reader();
            if (reader.IsReadableByThisReaderVersion(stream))
            {
                return(reader.Load(stream));
            }

            return(null);
        } // !Load()
示例#5
0
        } // !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()