-
Notifications
You must be signed in to change notification settings - Fork 1
/
Search64.dpr
97 lines (86 loc) · 2.81 KB
/
Search64.dpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
(**
This module defines the Search Win64 console application. This application is designed to provide
general file search and regular expression search capabilities for files on disk.
@version 1.2
@Author David Hoyle
@Date 03 Jun 2018
**)
Program Search64;
{$APPTYPE CONSOLE}
{$R *.RES}
{$R 'SearchVersionInfo.res' 'SearchVersionInfo.RC'}
uses
{$IFDEF EurekaLog}
EMemLeaks,
EResLeaks,
ESendMailMAPI,
ESendMailSMAPI,
EDialogConsole,
EDebugExports,
EDebugJCL,
EMapWin32,
EAppConsole,
ExceptionLog7,
{$ENDIF EurekaLog}
System.SysUtils,
System.RegularExpressionsCore,
Search.FilesCls in 'Source\Search.FilesCls.pas',
Search.Functions in 'Source\Search.Functions.pas',
Search.Engine in 'Source\Search.Engine.pas',
Search.Types in 'Source\Search.Types.pas',
Search.RegExMatches in 'Source\Search.RegExMatches.pas',
Search.FileCls in 'Source\Search.FileCls.pas',
Search.Interfaces in 'Source\Search.Interfaces.pas',
Search.StrUtils in 'Source\Search.StrUtils.pas',
Search.Constants in 'Source\Search.Constants.pas',
Search.ConvertDate in 'Source\Search.ConvertDate.pas',
Search.ResourceStrings in 'Source\Search.ResourceStrings.pas',
Search.Console in 'Source\Search.Console.pas',
Search.Help in 'Source\Search.Help.pas',
Search.DisplayCriteria in 'Source\Search.DisplayCriteria.pas',
Search.Options in 'Source\Search.Options.pas';
ResourceString
(** A resource string to define the Exception output format. **)
strException = 'ESearchException: %s';
(** A resource string for formatting information. **)
strPressEnterToFinish = 'Debug Mode: Press <Enter> to finish.';
Var
(** A variable to hold whether an exception has occurred. **)
boolException: Boolean;
(** An interface reference for calling the search engine. **)
SearchEngine : ISearchEngine;
Begin
{$IFDEF EUREKALOG}
SetEurekaLogState(DebugHook = 0);
{$ENDIF}
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
boolException := False;
SearchEngine := TSearch.Create;
Try
SearchEngine.Run;
Except
On E: EAbort Do
Begin
SearchEngine.Console.OutputToConsoleLn(coStd, strSearchAborted);
boolException := False;
End;
On E: ESearchException Do
Begin
SearchEngine.Console.OutputToConsoleLn(coErr, Format(strException, [E.Message]), scException);
boolException := True;
End;
On E : ERegularExpressionError Do
Begin
SearchEngine.Console.OutputToConsoleLn(coErr, Format(strException, [E.Message]), scException);
boolException := True;
End;
End;
If (clsDebug In CommandLineSwitches) Or (DebugHook <> 0) Then
Begin
SearchEngine.Console.OutputToConsoleLn(coStd);
SearchEngine.Console.OutputToConsole(coStd, strPressEnterToFinish);
Readln;
End;
If boolException Then
Halt(1);
End.