Skip to content

Commit

Permalink
Merge pull request #86 from Smurf-IV/85-DefaultScrub
Browse files Browse the repository at this point in the history
- Change the to have "no default" option for Scrub
- Update nuget packages
- Switch to "canary" Krypton dlls to use the "No Close" button
- Fix fallout for Krypton Usage
- Ensure Dll Search paths" are locked down
- Add icon to the log view
- Correct some compiler warnings
- Update (c) year in altered files
  • Loading branch information
Smurf-IV authored Dec 20, 2022
2 parents da13321 + 5892c19 commit a82af6f
Show file tree
Hide file tree
Showing 21 changed files with 345 additions and 55 deletions.
4 changes: 2 additions & 2 deletions Elucidate/Elucidate/CmdLine/ScrubVerb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// ---------------------------------------------------------------------------------------------------------------
// <copyright file="ScrubVerb.cs" company="Smurf-IV">
//
// Copyright (C) 2018 Simon Coghlan (Aka Smurf-IV)
// Copyright (C) 2018-2022 Simon Coghlan (Aka Smurf-IV)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -30,7 +30,7 @@

namespace Elucidate.CmdLine
{
[Verb("scrub", HelpText = "Defaults to 100% (-p100) of all of blocks (older than 0 days = -o0).\r\nBlocks alre" +
[Verb("scrub", HelpText = "Defaults to 8% of all of blocks (oldest unchecked first).\r\nBlocks alre" +
"ady marked as bad are always checked.\r\nUse \"Additional Command\" to override the " +
"default of 100% of 0 days")]
internal class ScrubVerb : StdOptions
Expand Down
33 changes: 32 additions & 1 deletion Elucidate/Elucidate/Controls/DataGridViewTripleValueBarColumn.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
using System.ComponentModel;
#region Copyright (C)
// ---------------------------------------------------------------------------------------------------------------
// <copyright file="LogsViewerControl.cs" company="Smurf-IV">
//
// Copyright (C) 2019-2022 Simon Coghlan (Aka Smurf-IV)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
// <summary>
// Url: https://github.com/Smurf-IV/Elucidate
// Email: https://github.com/Smurf-IV
// </summary>
// --------------------------------------------------------------------------------------------------------------------
#endregion

using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

Expand Down Expand Up @@ -52,6 +78,11 @@ protected override void Paint(Graphics g, Rectangle clipBounds, Rectangle cellBo
float.TryParse(values[1], out var mid);
float.TryParse(values[2], out var max);

if (max <= 0)
{
return;
}

var lowPercent = low / max;
var midPercent = mid / max;
// Draws the cell grid
Expand Down
9 changes: 3 additions & 6 deletions Elucidate/Elucidate/Controls/LogsViewerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// ---------------------------------------------------------------------------------------------------------------
// <copyright file="LogsViewerControl.cs" company="Smurf-IV">
//
// Copyright (C) 2018-2021 Simon Coghlan (Aka Smurf-IV) & BlueBlock 2018
// Copyright (C) 2018-2022 Simon Coghlan (Aka Smurf-IV) & BlueBlock 2018
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -41,13 +41,9 @@ public partial class LogsViewerControl : UserControl
private static readonly Logger Log = LogManager.GetCurrentClassLogger();

public enum LexerNameEnum { ScanRaid, NLog }

public LexerNameEnum LexerToUse { get; set; } = LexerNameEnum.NLog;

private readonly FileSystemWatcher logFileWatcher = new();

private string selectedDirectoryTitle;

private readonly string snapraidErrorSearchTerm = @"error: ";
private readonly string snapraidWarningSearchTerm = @"WARNING";
private readonly string elucidateErrorSearchTerm = @"] ERROR ";
Expand Down Expand Up @@ -104,7 +100,8 @@ private void UpdateLogFileList(string selectedDirectoryTitle = null)
}
else
{
this.selectedDirectoryTitle = selectedDirectoryTitle;
// TODO:
//this.selectedDirectoryTitle = selectedDirectoryTitle;
}

string errorSearchTerm;
Expand Down
6 changes: 4 additions & 2 deletions Elucidate/Elucidate/Controls/RunControl.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#region Copyright (C)
// <copyright file="RunControl.cs" company="Smurf-IV">
//
// Copyright (C) 2018-2021 Smurf-IV & BlueBlock 2018
// Copyright (C) 2018-2022 Smurf-IV & BlueBlock 2018
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -168,7 +168,6 @@ internal void StartSnapRaidProcess(CommandType commandToRun, Stack<string> paths
break;
case CommandType.Scrub:
command.Append(@"scrub");
defaultOption = @" -p100 -o0";
break;
case CommandType.Fix:
command.Append(@"fix");
Expand Down Expand Up @@ -650,12 +649,15 @@ private enum ThreadAccess
}

[DllImport(@"kernel32.dll")]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
private static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId);

[DllImport(@"kernel32.dll")]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
private static extern uint SuspendThread(IntPtr hThread);

[DllImport("kernel32.dll")]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
private static extern int ResumeThread(IntPtr hThread);

public static void Suspend(this Process process)
Expand Down
18 changes: 7 additions & 11 deletions Elucidate/Elucidate/Elucidate.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!--<TargetFrameworks>net48;net5.0-windows;net6.0-windows</TargetFrameworks>-->
<!--<TargetFrameworks>net48;net6.0-windows</TargetFrameworks>-->
<TargetFramework>net48</TargetFramework>
<OutputType>WinExe</OutputType>
<RootNamespace>Elucidate</RootNamespace>
Expand Down Expand Up @@ -39,22 +39,18 @@
<Version>2.1.1</Version>
</PackageReference>
<PackageReference Include="CommandLineParser">
<Version>2.8.0</Version>
<Version>2.9.1</Version>
</PackageReference>
<PackageReference Include="Exceptionless.NLog">
<Version>4.6.2</Version>
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Exceptionless.Windows">
<Version>4.6.2</Version>
</PackageReference>
<PackageReference Include="Krypton.Navigator">
<Version>6.2111.312</Version>
</PackageReference>
<PackageReference Include="Krypton.Toolkit">
<Version>6.2111.312</Version>
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Krypton.Navigator.Canary" Version="80.22.11.325-beta" />
<PackageReference Include="Krypton.Toolkit.Canary" Version="80.22.11.325-beta" />
<PackageReference Include="NLog">
<Version>4.7.13</Version>
<Version>4.7.15</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Elucidate/Elucidate/Forms/CalculateBlockSize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// ---------------------------------------------------------------------------------------------------------------
// <copyright file="CalculateBlockSize.cs" company="Smurf-IV">
//
// Copyright (C) 2010-2021 Simon Coghlan (Aka Smurf-IV)
// Copyright (C) 2010-2022 Simon Coghlan (Aka Smurf-IV)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -109,7 +109,7 @@ private static string FindNextPow2(ulong val)
private static void FindAndAddDisplaySizes(string path, ref ulong min, ref ulong max)
{
// ReSharper disable once UnusedVariable
Util.SourcePathFreeBytesAvailable(path, out var freeBytesAvailable, out var pathUsedBytes, out var rootBytesNotCoveredByPath);
Util.SourcePathFreeBytesAvailable(path, out var freeBytesAvailable, out var pathUsedBytes, out var _);

min += pathUsedBytes;
max += pathUsedBytes;
Expand Down
6 changes: 3 additions & 3 deletions Elucidate/Elucidate/Forms/ElucidateForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// ---------------------------------------------------------------------------------------------------------------
// <copyright file="ElucidateForm.cs" company="Smurf-IV">
//
// Copyright (C) 2010-2021 Simon Coghlan (Aka Smurf-IV)
// Copyright (C) 2010-2022 Simon Coghlan (Aka Smurf-IV)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -117,7 +117,7 @@ private void ElucidateForm_Shown(object sender, EventArgs e)
$"There are warnings for the configuration file:{Environment.NewLine} - {string.Join(" - ", srConfig.ConfigWarnings)}",
"Configuration File Warnings",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
KryptonMessageBoxIcon.Warning);
}
else
{
Expand Down Expand Up @@ -208,7 +208,7 @@ private void deleteAllSnapRAIDRaidFilesToolStripMenuItem_Click(object sender, Ev
sb.ToString(),
@"Delete All SnapRAID Files",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Warning);
KryptonMessageBoxIcon.Warning);

if (result == DialogResult.Yes)
{
Expand Down
3 changes: 3 additions & 0 deletions Elucidate/Elucidate/Forms/LiveLog.Designer.cs

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

Loading

0 comments on commit a82af6f

Please sign in to comment.