Class TfrmMain (unit MainForm) |
Inherits from
TForm
for rapid checksum on the first 512 bytes of a file
procedure btnCloseClick(Sender: TObject);
just note that we are required to close
procedure btnExitClick(Sender: TObject);
handle a single-click, make the hint echo the file name or reset to default
procedure btnSearchClick(Sender: TObject);
procedure chkCheckFilesizeClick(Sender: TObject);
override event - we don't want the user sorting the data
procedure DiskListView1Change(Sender: TObject; Item: TListItem;
Change: TItemChange);
ShowMessage (VersionInfoResource1.
procedure edtRootDirExit(Sender: TObject);
this procedure updates the main form's caption to reflect the drives selected
procedure FileListView1Click(Sender: TObject);
only one file left? - then we delete the header, the file and any trailer
procedure FileListView1ColumnClick(Sender: TObject;
Column: TListColumn);
procedure FileListView1DblClick(Sender: TObject);
return the file name
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
this procedure updates the main form's caption to reflect the drives and folders selected
procedure FormCreate(Sender: TObject);
these are ones we ignore on this run
procedure FormDestroy(Sender: TObject);
master list - contains just the master sizes
procedure FormResize(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
fill the lower half of the form with the list of duplicates found
procedure TreeScanner1DirectoryDone(Sender: TObject);
only really affects visible comps
procedure TreeScanner1DirectoryFound(Sender: TObject);
clear out any messages from scanning
procedure TreeScanner1FileFound(Sender: TObject);
procedure GetMinMaxInfo (var info: TWMGetMinMaxInfo);
return the items we allocated in the Create method
procedure compare_files;
There's a chance that the total has hit -2147483648, which is not a valid integer when you use StrToInt.
function do_checksum (size: integer; const filename: String): TChecksum;
undo all the mapped I/O stuff
function files_match (size: integer; const name1, name2: String): boolean;
formatted update of duplicate bytes and files found
procedure find_files_to_compare;
and compare the contents of those files
function parse_list_view (lvw: TListView): string;
give back the memory
procedure update_caption;
procedure update_compare_display;
integer type-cast as pointer
btnExit : TButton;
btnSearch : TButton;
chkCheckFilename : TCheckBox;
chkCheckFilesize : TCheckBox;
chkCheckFileTimestamp : TCheckBox;
chkFloppyIsMaster : TCheckBox;
chkSkipEmptyFiles : TCheckBox;
chkSkipSysbckup : TCheckBox;
DiskListView1 : TDiskListView;
edtFileMask : TEdit;
edtRootDir : TEdit;
edtSkipFolder : TEdit;
FileListView1 : TFileListView;
GroupBox1 : TGroupBox;
GroupBox3 : TGroupBox;
Label1 : TLabel;
Label2 : TLabel;
Label7 : TLabel;
lblFileListCaption : TLabel;
lblVersion : TLabel;
StatusBar1 : TStatusBar;
Timer1 : TTimer;
TreeScanner1 : TTreeScanner;
VersionInfoResource1 : TVersionInfoResource;
check_filename : boolean;
false for proper checksum comparison
check_file_size : boolean;
true if file name is to be checked
check_file_timestamp : boolean;
true if not ingoring zero-length files
comparing : boolean;
index of current folder in its list
continue_compare : boolean;
true when a compare in progress
current_dir : integer;
dir_list : TStringList;
list of files, with pointer to folder
duplicate_bytes : integer;
user sets this false to stop a scan
duplicate_files : integer;
total number of bytes (excluding "master"
file_list : TStringList;
Private declarations
known_duplicates_filename : string;
master_list : TStringList;
list of folders
min_height : integer;
min_width : integer;
new_duplicates_filename : string;
will read existing duplicates from here
process_empty_files : boolean;
true if the current folder is to be skipped
progress_bar : TProgressBar;
true if file size matters
saved_duplicates_filename : string;
total number of duplicate files
scan_state : (all_files, master_scan, filtered_scan);
will save newly found duplicates here
skip_file_list : TStringList;
list of folders to skip
skip_folder_list : TStringList;
simple list of ASCII sizes
skip_sysbckup_folder : boolean;
skip_this_folder : boolean;
true if we ignore Win 95 backup files
procedure btnCloseClick(Sender: TObject);
just note that we are required to close
procedure btnExitClick(Sender: TObject);
handle a single-click, make the hint echo the file name or reset to default
procedure btnSearchClick(Sender: TObject);
procedure chkCheckFilesizeClick(Sender: TObject);
override event - we don't want the user sorting the data
procedure DiskListView1Change(Sender: TObject; Item: TListItem;
Change: TItemChange);
ShowMessage (VersionInfoResource1.FileVersion);
procedure edtRootDirExit(Sender: TObject);
this procedure updates the main form's caption to reflect the drives selected
procedure FileListView1Click(Sender: TObject);
only one file left? - then we delete the header, the file and any trailer
procedure FileListView1ColumnClick(Sender: TObject;
Column: TListColumn);
procedure FileListView1DblClick(Sender: TObject);
return the file name
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
this procedure updates the main form's caption to reflect the drives and folders selected
procedure FormCreate(Sender: TObject);
these are ones we ignore on this run
procedure FormDestroy(Sender: TObject);
master list - contains just the master sizes
procedure FormResize(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
fill the lower half of the form with the list of duplicates found
procedure TreeScanner1DirectoryDone(Sender: TObject);
only really affects visible comps
procedure TreeScanner1DirectoryFound(Sender: TObject);
clear out any messages from scanning
procedure TreeScanner1FileFound(Sender: TObject);
procedure GetMinMaxInfo (var info: TWMGetMinMaxInfo);
return the items we allocated in the Create method
procedure compare_files;
There's a chance that the total has hit -2147483648, which is not a valid integer when you use StrToInt. To avoid this, kill the top bit and return a 31-bit result. It doesn't matter that the value isn't a true sum, it _will_ be the same for each summation which is what matters.
function do_checksum (size: integer; const filename: String): TChecksum;
undo all the mapped I/O stuff
function files_match (size: integer; const name1, name2: String): boolean;
formatted update of duplicate bytes and files found
procedure find_files_to_compare;
and compare the contents of those files
function parse_list_view (lvw: TListView): string;
give back the memory
procedure update_caption;
procedure update_compare_display;
integer type-cast as pointer
btnExit : TButton;
btnSearch : TButton;
chkCheckFilename : TCheckBox;
chkCheckFilesize : TCheckBox;
chkCheckFileTimestamp : TCheckBox;
chkFloppyIsMaster : TCheckBox;
chkSkipEmptyFiles : TCheckBox;
chkSkipSysbckup : TCheckBox;
DiskListView1 : TDiskListView;
edtFileMask : TEdit;
edtRootDir : TEdit;
edtSkipFolder : TEdit;
FileListView1 : TFileListView;
GroupBox1 : TGroupBox;
GroupBox3 : TGroupBox;
Label1 : TLabel;
Label2 : TLabel;
Label7 : TLabel;
lblFileListCaption : TLabel;
lblVersion : TLabel;
StatusBar1 : TStatusBar;
Timer1 : TTimer;
TreeScanner1 : TTreeScanner;
VersionInfoResource1 : TVersionInfoResource;
check_filename : boolean;
false for proper checksum comparison
check_file_size : boolean;
true if file name is to be checked
check_file_timestamp : boolean;
true if not ingoring zero-length files
comparing : boolean;
index of current folder in its list
continue_compare : boolean;
true when a compare in progress
current_dir : integer;
dir_list : TStringList;
list of files, with pointer to folder
duplicate_bytes : integer;
user sets this false to stop a scan
duplicate_files : integer;
total number of bytes (excluding "master"
file_list : TStringList;
Private declarations
known_duplicates_filename : string;
master_list : TStringList;
list of folders
min_height : integer;
min_width : integer;
new_duplicates_filename : string;
will read existing duplicates from here
process_empty_files : boolean;
true if the current folder is to be skipped
progress_bar : TProgressBar;
true if file size matters
saved_duplicates_filename : string;
total number of duplicate files
scan_state : (all_files, master_scan, filtered_scan);
will save newly found duplicates here
skip_file_list : TStringList;
list of folders to skip
skip_folder_list : TStringList;
simple list of ASCII sizes
skip_sysbckup_folder : boolean;
skip_this_folder : boolean;
true if we ignore Win 95 backup files