Exemplo n.º 1
0
            public bool MoveNext()
            {
                if (mEngine.State == EngineState.Closed)
                {
                    return(false);
                }

                object res = mEngine.ReadNext();

                if (res == null)
                {
                    mEngine.Close();
                    return(false);
                }

                return(true);
            }
Exemplo n.º 2
0
        /// <summary>
        /// Transform a file that contains source records to an array of the destination type
        /// </summary>
        /// <param name="sourceFile">A file containing the source records.</param>
        /// <returns>The transformed records.</returns>

        public TDestination[] ReadAndTransformRecords(string sourceFile)
        {
            var engine = new FileHelperAsyncEngine <TSource>(mSourceEncoding);

            engine.ErrorMode         = this.ErrorMode;
            mSourceErrorManager      = engine.ErrorManager;
            mDestinationErrorManager = new ErrorManager(ErrorMode);

            var res = new List <TDestination>();

            engine.BeginReadFile(sourceFile);
            foreach (TSource record in engine)
            {
                res.Add(record.TransformTo());
            }
            engine.Close();

            return(res.ToArray());
        }