コード例 #1
0
        public FileObjectCollection FormatCounterFile(FileObject fileObject)
        {
            Log.Debug($"enter:{fileObject.FileUri}");
            string outputFile = fileObject.FileUri + Constants.PerfCsvExtension;
            bool   result;

            fileObject.Stream.SaveToFile();
            DeleteFile(outputFile);
            Log.Info($"Writing {outputFile}");

            if (_config.UseTx)
            {
                result = TxBlg(fileObject, outputFile);
            }
            else
            {
                result = RelogBlg(fileObject, outputFile);
            }

            if (result)
            {
                _instance.TotalFilesConverted++;

                if (!_config.UseTx)
                {
                    fileObject.Stream.ReadFromFile(outputFile);
                    fileObject.Stream.Write <CsvCounterRecord>(ExtractPerfRelogCsvData(fileObject));
                }
            }
            else
            {
                _instance.TotalErrors++;
            }

            DeleteFile(outputFile);

            if (_config.UseMemoryStream | !_config.IsCacheLocationPreConfigured())
            {
                DeleteFile(fileObject.FileUri);
            }

            return(PopulateCollection <CsvCounterRecord>(fileObject));
        }