Skip to content

Commit 1bf0083

Browse files
committed
Tried to provide more information in case lines are combined
1 parent c5e2b9e commit 1bf0083

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

Library/ClassLibraryCSV/CsvFileReader.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ private bool GetNextRecord()
703703
RecordNumber++;
704704
}
705705
}
706+
bool hasWarningCombinedWrning = false;
706707
Restart2:
707708
var rowLength = CurrentRowColumnText.Length;
708709

@@ -736,9 +737,6 @@ private bool GetNextRecord()
736737
HandleWarning(-1, $"Line {StartLineNumber}{cLessColumns}({rowLength}/{FieldCount}).");
737738
else
738739
{
739-
HandleWarning(-1,
740-
$"Line {StartLineNumber}{cLessColumns}. Trying to combine rows.");
741-
742740
var oldPos = m_BufferPos;
743741
var startLine = StartLineNumber;
744742
// get the next row
@@ -751,32 +749,35 @@ private bool GetNextRecord()
751749
var combined = new List<string>(CurrentRowColumnText);
752750

753751
// the first column belongs to the last column of the previous
754-
if (!string.IsNullOrEmpty(nextRow[0]))
755-
{
756-
// ignore NumWarningsLinefeed otherwise as this is important information
757-
m_NumWarningsLinefeed++;
758-
HandleWarning(rowLength - 1,
759-
$"Added first column from line {EndLineNumber}, assuming a linefeed has split the rows.");
760-
combined[rowLength - 1] += ' ' + nextRow[0];
761-
}
762-
else
763-
WarnLinefeed(rowLength - 1);
752+
// ignore NumWarningsLinefeed otherwise as this is important information
753+
m_NumWarningsLinefeed++;
754+
HandleWarning(rowLength - 1,
755+
$"Added first column from line {EndLineNumber}, assuming a linefeed has split the rows into an additional line.");
756+
combined[rowLength - 1] += ' ' + nextRow[0];
764757

765758
for (int col = 1; col < nextRow.Length; col++)
766759
combined.Add(nextRow[col]);
767760

761+
if (!hasWarningCombinedWrning)
762+
{
763+
HandleWarning(-1, $"Line {StartLineNumber}{cLessColumns}. Rows have been combined.");
764+
hasWarningCombinedWrning = true;
765+
}
766+
768767
CurrentRowColumnText = combined.ToArray();
769768
goto Restart2;
770769
}
771770
else
772771
{
773772
if (m_BufferPos < oldPos)
774773
// we have an issue we went into the next Buffer there is no way back.
775-
HandleError(-1,
776-
$"Lines have been read that is now lost as records, please turn off Row Combination");
774+
HandleError(-1, $"Line {StartLineNumber}{cLessColumns}\nAttempting to combined lines some line have been read that is now lost, please turn off Row Combination");
777775
else
778-
// return to the old position so reading the next row does not matter
776+
{
777+
// return to the old position so reading the next row did not matter
778+
HandleWarning(-1, $"Line {StartLineNumber}{cLessColumns}({rowLength}/{FieldCount}).");
779779
m_BufferPos = oldPos;
780+
}
780781
}
781782
}
782783
}

Library/SharedAssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
//
2323
// You can specify all the values or you can default the Build and Revision Numbers by using the '*'
2424
// as shown below: [assembly: AssemblyVersion("1.0.*")]
25-
[assembly: AssemblyVersion("1.5.3.289")]
26-
[assembly: AssemblyFileVersion("1.5.3.289")]
27-
[assembly: AssemblyInformationalVersion("1.5.3.289")] // a.k.a. "Product version"
25+
[assembly: AssemblyVersion("1.5.3.290")]
26+
[assembly: AssemblyFileVersion("1.5.3.290")]
27+
[assembly: AssemblyInformationalVersion("1.5.3.290")] // a.k.a. "Product version"

Library/WinFormControls/FormHirachyDisplay.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ private void HirachyDisplay_Load(object sender, EventArgs e)
383383
/// </summary>
384384
private void InitializeComponent()
385385
{
386+
this.components = new System.ComponentModel.Container();
386387
System.Windows.Forms.Label label1;
387388
System.Windows.Forms.Label label2;
388389
System.Windows.Forms.Label label3;
@@ -401,7 +402,7 @@ private void InitializeComponent()
401402
label1 = new System.Windows.Forms.Label();
402403
label2 = new System.Windows.Forms.Label();
403404
label3 = new System.Windows.Forms.Label();
404-
contextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
405+
contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
405406
expandAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
406407
closeAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
407408
label4 = new System.Windows.Forms.Label();

0 commit comments

Comments
 (0)