コード例 #1
0
ファイル: HashExporter.cs プロジェクト: CPPlus/TheTool
        public void Extract(out TableData data)
        {
            data = new TableData();
            string[] record;

            // Skip records.
            for (int i = 0; i < idOffset - 1; i++)
            {
                reader.ReadNextRecord(out record);
            }

            int recordCounter = 0;

            while (reader.ReadNextRecord(out record))
            {
                // Skip header and record column count.
                if (recordCounter == 0)
                {
                    data.header = record;
                    recordCounter++;

                    int columnCount = record.Length;
                    writer.CreateFields(columnCount + ADDITIONAL_COLUMNS_COUNT);
                    data.columnCount = columnCount;

                    continue;
                }

                string[] hashedRecord = BuildHashedRecord(record);
                writer.Write(hashedRecord.ToArray());
                recordCounter++;
                if (recordCounter % 1000 == 0)
                {
                    Console.WriteLine("Extracted {0} rows.", recordCounter);
                }
            }
            reader.Close();

            data.recordCount = recordCounter;
        }