/// <summary> /// Factory to initialize a new instance of the <see cref="Interchange"/> class. /// </summary> /// <param name="ediStream">The edi stream.</param> /// <returns> /// The interchange instance. /// </returns> public static Interchange LoadFrom(Stream ediStream) { if (ediStream == null) { throw new ArgumentNullException("ediStream"); } var edifactLexer = new FromEdiLexer(ediStream.ToEdiString()); edifactLexer.Analyze(); return(edifactLexer.Result); }
/// <summary> /// Factory to initialize a new instance of the <see cref="Interchange"/> class. /// </summary> /// <param name="ediStream">The EDI stream.</param> /// <param name="encoding">The encoding of the EDI stream.</param> /// <param name="definitionsAssemblyName">The assembly name of the project containing the classes.</param> /// <returns> /// The interchange instance. /// </returns> /// <example> /// Parse EDI with classes in a custom assembly MyAssembly.MyProject.dll. /// <code lang="C#"> /// var interchange = Interchange.LoadFrom(File.OpenRead(@"c:\test.edi"), Encoding.GetEncoding("iso-8859-1"), "MyAssembly.MyProject"); /// </code> /// </example> public static Interchange LoadFrom(Stream ediStream, System.Text.Encoding encoding, string definitionsAssemblyName = null) { if (ediStream == null) { throw new ArgumentNullException("ediStream"); } var edifactLexer = new FromEdiLexer(ediStream.ToEdiString(encoding), definitionsAssemblyName); edifactLexer.Analyze(); return(edifactLexer.Result); }
/// <summary> /// Factory to initialize a new instance of the <see cref="Interchange"/> class. /// </summary> /// <param name="ediStream">The edi stream.</param> /// <param name="definitionsAssemblyName">The assembly name of the project containing the classes and xsd.</param> /// <returns> /// The interchange instance. /// </returns> public static Interchange LoadFrom(Stream ediStream, string definitionsAssemblyName = null) { if (ediStream == null) throw new ArgumentNullException("ediStream"); var edifactLexer = new FromEdiLexer(ediStream.ToEdiString(), definitionsAssemblyName); edifactLexer.Analyze(); return edifactLexer.Result; }