Skip to content

Commit

Permalink
Moving AlternateQuoting and DuplicateQuotingToEscape to FileFormat; a…
Browse files Browse the repository at this point in the history
…dded support for visualizing DuplicateQuotingToEscape in control

Some controls in FormEditSettings have no with and where not usable
  • Loading branch information
RNoeldner committed Feb 17, 2020
1 parent 01eded6 commit 128f7ae
Show file tree
Hide file tree
Showing 16 changed files with 329 additions and 263 deletions.
36 changes: 24 additions & 12 deletions Application/FormEditSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions Application/FormEditSettings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,18 @@
<metadata name="fileFormatBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>202, 17</value>
</metadata>
<metadata name="fileFormatBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>202, 17</value>
</metadata>
<metadata name="fileSettingBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>12, 17</value>
</metadata>
<metadata name="fileSettingBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>12, 17</value>
</metadata>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>387, 17</value>
</metadata>
<data name="textBox1.ToolTip" xml:space="preserve">
<value>An escape character is used for escaping quotes and delimiters in the regular text.
Usage of this is often not well supported: It may lead to issues if the last character of a column matches the escape character, teh column end is not regognized.</value>
</data>
<metadata name="tableLayoutPanelAdvanced.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand All @@ -145,6 +147,9 @@ Usage of this is often not well supported: It may lead to issues if the last cha
<metadata name="tableLayoutPanelWarnings.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>387, 17</value>
</metadata>
<metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>477, 17</value>
</metadata>
Expand Down
79 changes: 37 additions & 42 deletions Application/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private void AttachPropertyChanged(ICsvFile fileSetting)
{
fileSystemWatcher.EnableRaisingEvents = m_ViewSettings.DetectFileChanges;
fileSetting.PropertyChanged += FileSetting_PropertyChanged;
fileSetting.FileFormat.PropertyChanged += FileFormat_PropertyChanged;
fileSetting.FileFormat.PropertyChanged += AnyPropertyChangedReload;
foreach (var col in fileSetting.ColumnCollection)
col.PropertyChanged += AnyPropertyChangedReload;
}
Expand Down Expand Up @@ -225,7 +225,7 @@ private void DetachPropertyChanged(ICsvFile fileSetting)
if (fileSetting != null)
{
fileSetting.PropertyChanged -= FileSetting_PropertyChanged;
fileSetting.FileFormat.PropertyChanged -= FileFormat_PropertyChanged;
fileSetting.FileFormat.PropertyChanged -= AnyPropertyChangedReload;
foreach (var col in fileSetting.ColumnCollection)
col.PropertyChanged -= AnyPropertyChangedReload;
}
Expand Down Expand Up @@ -277,7 +277,6 @@ private void Display_Activated(object sender, EventArgs e)
{
if (m_ConfigChanged)
{
m_ConfigChanged = false;
detailControl.MoveMenu();
if (_MessageBox.Show(
this,
Expand All @@ -286,20 +285,32 @@ private void Display_Activated(object sender, EventArgs e)
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
OpenDataReader(true);
}
else
{
m_ConfigChanged = false;
}
}

if (m_FileChanged)
{
m_FileChanged = false;
if (_MessageBox.Show(
this,
"The displayed file has changed do you want to reload the data?",
"File changed",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
OpenDataReader(true);
}
else
{
m_FileChanged = false;
}

}
}

Expand Down Expand Up @@ -361,51 +372,35 @@ private void Display_Shown(object sender, EventArgs e)
OpenDataReader(false);
}

private void FileFormat_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(FileFormat.FieldDelimiterChar)
|| e.PropertyName == nameof(FileFormat.EscapeCharacterChar)
|| e.PropertyName == nameof(FileFormat.CommentLine) || e.PropertyName == nameof(FileFormat.FieldQualifierChar)
|| e.PropertyName == nameof(FileFormat.QuotePlaceholder)
|| e.PropertyName == nameof(FileFormat.DelimiterPlaceholder)
|| e.PropertyName == nameof(FileFormat.NewLinePlaceholder))
m_ConfigChanged = true;
}

/// <summary>
/// Handles the PropertyChanged event of the FileSetting control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="PropertyChangedEventArgs" /> instance containing the event data.</param>
private void FileSetting_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(ICsvFile.AllowRowCombining) || e.PropertyName == nameof(ICsvFile.AlternateQuoting)
|| e.PropertyName == nameof(ICsvFile.ByteOrderMark)
|| e.PropertyName == nameof(ICsvFile.CodePageId)
|| e.PropertyName
== nameof(ICsvFile.ConsecutiveEmptyRows)
|| e.PropertyName == nameof(ICsvFile.DoubleDecode)
|| e.PropertyName == nameof(ICsvFile.HasFieldHeader)
|| e.PropertyName == nameof(ICsvFile.NumWarnings)
|| e.PropertyName == nameof(ICsvFile.SkipEmptyLines)
|| e.PropertyName == nameof(ICsvFile.SkipRows)
|| e.PropertyName == nameof(ICsvFile.TreatLFAsSpace)
|| e.PropertyName == nameof(ICsvFile.TreatNBSPAsSpace)
|| e.PropertyName == nameof(ICsvFile.TreatTextAsNull)
|| e.PropertyName
== nameof(ICsvFile.TreatUnknowCharaterAsSpace)
|| e.PropertyName
== nameof(ICsvFile.TryToSolveMoreColumns)
|| e.PropertyName
== nameof(ICsvFile.WarnDelimiterInValue)
|| e.PropertyName
== nameof(ICsvFile.WarnEmptyTailingColumns)
|| e.PropertyName == nameof(ICsvFile.WarnLineFeed)
|| e.PropertyName == nameof(ICsvFile.WarnNBSP)
|| e.PropertyName == nameof(ICsvFile.WarnQuotes)
|| e.PropertyName == nameof(ICsvFile.WarnQuotesInQuotes)
|| e.PropertyName == nameof(ICsvFile.WarnUnknowCharater)
|| e.PropertyName == nameof(ICsvFile.FileName))
if (e.PropertyName == nameof(ICsvFile.AllowRowCombining)
|| e.PropertyName == nameof(ICsvFile.ByteOrderMark)
|| e.PropertyName == nameof(ICsvFile.CodePageId)
|| e.PropertyName == nameof(ICsvFile.ConsecutiveEmptyRows)
|| e.PropertyName == nameof(ICsvFile.DoubleDecode)
|| e.PropertyName == nameof(ICsvFile.HasFieldHeader)
|| e.PropertyName == nameof(ICsvFile.NumWarnings)
|| e.PropertyName == nameof(ICsvFile.SkipEmptyLines)
|| e.PropertyName == nameof(ICsvFile.SkipRows)
|| e.PropertyName == nameof(ICsvFile.TreatLFAsSpace)
|| e.PropertyName == nameof(ICsvFile.TreatNBSPAsSpace)
|| e.PropertyName == nameof(ICsvFile.TreatTextAsNull)
|| e.PropertyName == nameof(ICsvFile.TreatUnknowCharaterAsSpace)
|| e.PropertyName == nameof(ICsvFile.TryToSolveMoreColumns)
|| e.PropertyName == nameof(ICsvFile.WarnDelimiterInValue)
|| e.PropertyName == nameof(ICsvFile.WarnEmptyTailingColumns)
|| e.PropertyName == nameof(ICsvFile.WarnLineFeed)
|| e.PropertyName == nameof(ICsvFile.WarnNBSP)
|| e.PropertyName == nameof(ICsvFile.WarnQuotes)
|| e.PropertyName == nameof(ICsvFile.WarnQuotesInQuotes)
|| e.PropertyName == nameof(ICsvFile.WarnUnknowCharater)
|| e.PropertyName == nameof(ICsvFile.FileName))
m_ConfigChanged = true;
}

Expand Down
Loading

0 comments on commit 128f7ae

Please sign in to comment.