Skip to content

Commit

Permalink
Ensure user-input minChunk and maxChunk are sane
Browse files Browse the repository at this point in the history
Add logic to Settings.cs rejecting changes to
minChunk and maxChunk if either would be <= 0
or if minChunk would be greater than maxChunk.
No validation if you edit the file to make
either one insane, because that's your own darn
fault.
  • Loading branch information
molsonkiko committed Sep 4, 2022
1 parent 86f8b38 commit f8bfab5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### To Be Fixed

- *Maybe fixed?* Sometimes `ChunkForm.NextChunk` method causes Notepad++ to freeze (infinite loop, maybe?) and you have to quit.
## [0.1.1] - 2022-09-03

### Bugfixes

Added logic to `Settings.cs` to ensure that minChunk is never greater than maxChunk, and also minChunk and maxChunk must be positive.

If the user enters a minChunk greater than maxChunk in the settings, the minChunk will be set equal to maxChunk instead.

## [0.1.0] - 2022-09-03

Expand Down
4 changes: 2 additions & 2 deletions HugeFiles/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
27 changes: 26 additions & 1 deletion HugeFiles/Utils/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,33 @@ public void ShowDialog(bool debug=false)
return;
}
changed = true;
if (copy.minChunk <= 0)
{
MessageBox.Show("minChunk and maxChunk must be positive numbers.",
"minChunk and maxChunk must be positive",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
copy.minChunk = minChunk;
}
if (copy.maxChunk <= 0)
{
MessageBox.Show("minChunk and maxChunk must be positive numbers.",
"minChunk and maxChunk must be positive",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
copy.maxChunk = maxChunk;
}
delimiter = copy.delimiter;
minChunk = copy.minChunk;
if (copy.minChunk > copy.maxChunk)
{
MessageBox.Show("minChunk cannot be greater than maxChunk! " +
"minChunk will instead be set equal to maxChunk.",
"minChunk cannot be greater than maxChunk",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
minChunk = copy.maxChunk;
}
else minChunk = copy.minChunk;
maxChunk = copy.maxChunk;
previewLength = copy.previewLength;
dialog.Close();
Expand Down
Binary file modified Release_x64.zip
Binary file not shown.
Binary file modified Release_x86.zip
Binary file not shown.

0 comments on commit f8bfab5

Please sign in to comment.