Skip to content

Commit

Permalink
improve reading ini lines
Browse files Browse the repository at this point in the history
Read ini skip empty lines and lines without equals sign, close dialogs with ESC key
  • Loading branch information
BdR76 committed Jul 30, 2022
1 parent cd0d7ab commit 5aaf320
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
19 changes: 12 additions & 7 deletions CSVLintNppPlugin/CsvLint/CsvDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,19 @@ public CsvDefinition(string inilines)
List<string> dup = new List<string>();
foreach (string line in enstr)
{
string[] parts = line.Split('=');
if(result.ContainsKey(parts[0]))
// ignore empty lines and lines without equals sign '='
var nextline = line.Trim();
if ( (nextline != "") && (nextline.IndexOf('=') > 0) )
{
dup.Add(parts[0]);
}
else
{
result.Add(parts[0], parts[1]);
string[] parts = nextline.Split('=');
if (result.ContainsKey(parts[0]))
{
dup.Add(parts[0]);
}
else
{
result.Add(parts[0], parts[1]);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions CSVLintNppPlugin/Forms/AboutForm.Designer.cs

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

1 change: 1 addition & 0 deletions CSVLintNppPlugin/Forms/CsvEditFormBase.Designer.cs

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

0 comments on commit 5aaf320

Please sign in to comment.