Esempio n. 1
0
        public long Process(string filename, string outputLocation, int batchSize, string scheduleType,
                            BatchArgs args)
        {
            if (filename == null)
            {
                throw new ArgumentNullException(filename);
            }
            if (outputLocation == null)
            {
                throw new ArgumentNullException(outputLocation);
            }
            if (scheduleType == null)
            {
                throw new ArgumentNullException(scheduleType);
            }

            List <List <string> > buffer = new List <List <string> >();
            long batchCount  = 0;
            long recordCount = 0;

            ScheduleType scheduleTypeEnum = GetScheduleType(scheduleType);

            _outputWriter.Open(outputLocation, scheduleTypeEnum);
            _cifProcessor.Initialize(_fileSystem.FileOpen(filename, FileMode.Open));

            int bufferCount = 0;

            while ((bufferCount = _cifProcessor.ProcessBatch(buffer, batchSize, scheduleTypeEnum, args)) > 0)
            {
                batchCount++;
                recordCount += bufferCount;
                _outputWriter.Write(buffer);
                OnBatchProcessed(
                    new BatchProcessedEventArgs {
                    BatchNumber = batchCount, BatchSize = bufferCount
                });
            }

            _outputWriter.Close();
            return(recordCount);
        }
Esempio n. 2
0
 /// <summary>
 /// Closes the stream writer
 /// </summary>
 public override void OnStop()
 {
     owb.Close();
 }