ADD: Show different colors for checksum verify result

This commit is contained in:
Alexander Koblov 2013-10-15 17:00:13 +00:00
commit d4a4151df6
3 changed files with 62 additions and 11 deletions

View file

@ -12,7 +12,7 @@ object frmCheckSumVerify: TfrmCheckSumVerify
Position = poScreenCenter
ShowInTaskBar = stAlways
LCLVersion = '1.0.1.3'
object mmCheckSumVerify: TMemo
inline seCheckSumVerify: TSynEdit
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
@ -22,20 +22,59 @@ object frmCheckSumVerify: TfrmCheckSumVerify
Height = 240
Top = 10
Width = 380
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 10
BorderSpacing.Top = 10
BorderSpacing.Right = 10
BorderSpacing.Bottom = 10
ReadOnly = True
Anchors = [akTop, akLeft, akRight, akBottom]
ParentColor = False
ParentFont = False
TabOrder = 0
Gutter.Visible = False
Gutter.Width = 0
Gutter.MouseActions = <>
RightGutter.Width = 0
RightGutter.MouseActions = <>
Keystrokes = <>
MouseActions = <>
MouseSelActions = <>
VisibleSpecialChars = [vscSpace, vscTabAtLast]
ReadOnly = True
ScrollBars = ssAutoBoth
SelectedColor.FrameEdges = sfeAround
SelectedColor.BackPriority = 50
SelectedColor.ForePriority = 50
SelectedColor.FramePriority = 50
SelectedColor.BoldPriority = 50
SelectedColor.ItalicPriority = 50
SelectedColor.UnderlinePriority = 50
SelectedColor.StrikeOutPriority = 50
IncrementColor.FrameEdges = sfeAround
HighlightAllColor.FrameEdges = sfeAround
BracketHighlightStyle = sbhsBoth
BracketMatchColor.Background = clNone
BracketMatchColor.Foreground = clNone
BracketMatchColor.FrameEdges = sfeAround
BracketMatchColor.Style = [fsBold]
FoldedCodeColor.Background = clNone
FoldedCodeColor.Foreground = clGray
FoldedCodeColor.FrameColor = clGray
FoldedCodeColor.FrameEdges = sfeAround
MouseLinkColor.Background = clNone
MouseLinkColor.Foreground = clBlue
MouseLinkColor.FrameEdges = sfeAround
LineHighlightColor.Background = clNone
LineHighlightColor.Foreground = clNone
LineHighlightColor.FrameEdges = sfeAround
OnSpecialLineColors = seCheckSumVerifySpecialLineColors
end
end
object btnClose: TBitBtn
AnchorSideLeft.Control = mmCheckSumVerify
AnchorSideLeft.Control = seCheckSumVerify
AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 163
Left = 150
Height = 30
Top = 260
Width = 100

View file

@ -28,7 +28,7 @@ unit fCheckSumVerify;
interface
uses
Classes, SysUtils, Forms, StdCtrls, Buttons, uOSForms;
Classes, SysUtils, Forms, Buttons, SynEdit, uOSForms, SynEditMarkupSpecialLine, Graphics;
type
@ -36,8 +36,10 @@ type
TfrmCheckSumVerify = class(TAloneForm)
btnClose: TBitBtn;
mmCheckSumVerify: TMemo;
seCheckSumVerify: TSynEdit;
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure seCheckSumVerifySpecialLineColors(Sender: TObject; Line: integer;
var Special: boolean; var FG, BG: TColor);
private
{ private declarations }
public
@ -54,7 +56,7 @@ procedure ShowVerifyCheckSum(const VerifyResult: TStringList);
begin
with TfrmCheckSumVerify.Create(Application) do
begin
mmCheckSumVerify.Lines.Assign(VerifyResult);
seCheckSumVerify.Lines.Assign(VerifyResult);
Show;
end;
end;
@ -66,5 +68,15 @@ begin
CloseAction:= caFree;
end;
procedure TfrmCheckSumVerify.seCheckSumVerifySpecialLineColors(Sender: TObject; Line: integer;
var Special: boolean; var FG, BG: TColor);
begin
Special:= True;
if Assigned(seCheckSumVerify.Lines.Objects[Line - 1]) then
FG:= clGreen
else
FG:= clRed;
end;
end.

View file

@ -292,9 +292,9 @@ begin
sCheckSum:= CheckSumCalc(aFile);
bResult:= (CompareText(sCheckSum, ExpectedChecksum) = 0);
FResult.Add(ExtractDirLevel(FFullFilesTree.Path, aFile.Path) +
aFile.Name + ': ' +
IfThen(bResult, 'True', 'False'));
FResult.AddObject(ExtractDirLevel(FFullFilesTree.Path, aFile.Path) +
aFile.Name + ': ' +
IfThen(bResult, 'True', 'False'), TObject(PtrInt(bResult)));
end;
function TFileSystemCalcChecksumOperation.CheckSumCalc(aFile: TFile): String;