Fix some warnings

This commit is contained in:
2023-08-18 02:48:31 +02:00
parent ddd49a0d80
commit fb6d8d76a1
6 changed files with 45 additions and 46 deletions

View File

@@ -25,7 +25,7 @@ namespace CsvLib
public List<long> Index { get { return _index; } }
private List<List<long>> _fieldIndex = new List<List<long>>();
public List<List<long>> FieldIndex { get { return _fieldIndex; } }
private void DummyParser(string line)
@@ -50,7 +50,6 @@ namespace CsvLib
if (c == _escapeChar && _insideString)
{
i++;
c = line[i];
}
}
}
@@ -84,7 +83,6 @@ namespace CsvLib
else if (c == _escapeChar && _insideString)
{
i++;
c = line[i];
}
else if ((c == '\n' || c == '\r') && _insideString == false)
{
@@ -116,7 +114,7 @@ namespace CsvLib
GenerateIndex(streamReader);
}
}
public void GenerateIndex(TextReader textReader)
{
_insideString = false;
@@ -130,14 +128,14 @@ namespace CsvLib
{
DummyParser(currentLine);
if (_insideString) { continue; }
string fullLine = reader.GetBuffer();
reader.CleanBuffer();
List<long> fieldIndexes = ParseLineIndex(fullLine, _index[idxRow]);
_fieldIndex.Add(fieldIndexes);
_index.Add(reader.Position);
idxRow++;
}
}
@@ -193,7 +191,7 @@ namespace CsvLib
DateTime dtNow = DateTime.UtcNow;
GenerateIndex(file);
TimeSpan tsGenIndex = DateTime.UtcNow - dtNow;
// Save Index if expensive generation
if (tsGenIndex.TotalSeconds > 2)
{

View File

@@ -46,7 +46,6 @@ namespace CsvLib
if (c == _escapeChar && _insideString)
{
i++;
c = line[i];
}
}
}
@@ -125,7 +124,7 @@ namespace CsvLib
DateTime dtNow = DateTime.UtcNow;
GenerateIndex(file);
TimeSpan tsGenIndex = DateTime.UtcNow - dtNow;
// Save Index if expensive generation
if (tsGenIndex.TotalSeconds > 2)
{

View File

@@ -104,6 +104,6 @@ namespace CsvLib
}
stream.Close();
}
}
}