public bool MoveNext()
            {
                object res = mEngine.ReadNext();

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

                return(true);
            }
Пример #2
0
        /// <summary>
        /// Process a file with the async engine
        /// </summary>
        /// <typeparam name="T">Type of record to parse</typeparam>
        /// <param name="engine">Engine to use</param>
        /// <returns>Array of data</returns>
        public T[] ReadWithAsyncEngine <T>(FileHelperAsyncEngine <T> engine) where T : class
        {
            var res = new List <T>();

            using (engine.BeginReadFile(Path)) {
                while (engine.ReadNext() != null)
                {
                    res.Add(engine.LastRecord);
                }
            }

            return(res.ToArray());
        }
Пример #3
0
            public bool MoveNext()
            {
                if (mEngine.State == EngineState.Closed)
                {
                    return(false);
                }

                object res = mEngine.ReadNext();

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

                return(true);
            }
Пример #4
0
        private int TransformAsync(string sourceFile, string destFile, Type sourceType, Type destType, MethodInfo method)
        {
            FileHelperAsyncEngine sourceEngine = new FileHelperAsyncEngine(sourceType);
            FileHelperAsyncEngine destEngine   = new FileHelperAsyncEngine(destType);

            sourceEngine.Encoding = mSourceEncoding;
            destEngine.Encoding   = mDestinationEncoding;

            sourceEngine.BeginReadFile(sourceFile);
            destEngine.BeginWriteFile(destFile);

            while (sourceEngine.ReadNext() != null)
            {
                destEngine.WriteNext(method.Invoke(sourceEngine.LastRecord, mEmptyArray));
            }

            sourceEngine.EndsRead();
            destEngine.EndsWrite();

            return(sourceEngine.TotalRecords);
        }