コード例 #1
0
ファイル: Interchange.cs プロジェクト: mrmanicou/ediFabric
        /// <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 x12Lexer = new FromEdiLexer(ediStream.ToEdiString(), definitionsAssemblyName);

            x12Lexer.Analyze();

            // X12 headers are positional and the blank spaces need to be preserved
            x12Lexer.Result.Isa.D_745_2 = x12Lexer.Result.Isa.D_745_2.PadRight(10, ' ');
            x12Lexer.Result.Isa.D_747_4 = x12Lexer.Result.Isa.D_747_4.PadRight(10, ' ');

            return(x12Lexer.Result);
        }
コード例 #2
0
        /// <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 x12Lexer = new FromEdiLexer(ediStream.ToEdiString());
            x12Lexer.Analyze();

            // X12 headers are positional and the blank spaces need to be preserved
            x12Lexer.Result.Isa.D_745_2 = x12Lexer.Result.Isa.D_745_2.PadRight(10, ' ');
            x12Lexer.Result.Isa.D_747_4 = x12Lexer.Result.Isa.D_747_4.PadRight(10, ' ');

            return x12Lexer.Result;
        }