Subversion Repositories userdetect2

Rev

Rev 71 | Rev 81 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71 Rev 80
Line 66... Line 66...
66
    property IniFileName: string read FIniFileName;
66
    property IniFileName: string read FIniFileName;
67
    property Errors: TStrings read FErrors;
67
    property Errors: TStrings read FErrors;
68
    property LoadedPlugins: TObjectList{<TUD2Plugin>} read FLoadedPlugins;
68
    property LoadedPlugins: TObjectList{<TUD2Plugin>} read FLoadedPlugins;
69
    property IniFile: TMemIniFile read FIniFile;
69
    property IniFile: TMemIniFile read FIniFile;
70
    procedure GetCommandList(ShortTaskName: string; outSL: TStrings);
70
    procedure GetCommandList(ShortTaskName: string; outSL: TStrings);
71
    procedure HandlePluginDir(APluginDir: string);
71
    procedure HandlePluginDir(APluginDir, AFileMask: string);
72
    procedure GetTaskListing(outSL: TStrings);
72
    procedure GetTaskListing(outSL: TStrings);
73
    constructor Create(AIniFileName: string);
73
    constructor Create(AIniFileName: string);
74
    destructor Destroy; override;
74
    destructor Destroy; override;
75
    function TaskExists(ShortTaskName: string): boolean;
75
    function TaskExists(ShortTaskName: string): boolean;
76
    function ReadMetatagString(ShortTaskName, MetatagName: string;
76
    function ReadMetatagString(ShortTaskName, MetatagName: string; DefaultVal: string): string;
77
      DefaultVal: string): string;
-
 
78
    function ReadMetatagBool(ShortTaskName, MetatagName: string;
77
    function ReadMetatagBool(ShortTaskName, MetatagName: string; DefaultVal: string): boolean;
79
      DefaultVal: string): boolean;
-
 
80
    function GetTaskName(AShortTaskName: string): string;
78
    function GetTaskName(AShortTaskName: string): string;
81
    class function GenericErrorLookup(grStatus: UD2_STATUS): string;
79
    class function GenericErrorLookup(grStatus: UD2_STATUS): string;
82
  end;
80
  end;
83
 
81
 
84
implementation
82
implementation
Line 100... Line 98...
100
    destructor Destroy; override;
98
    destructor Destroy; override;
101
  end;
99
  end;
102
 
100
 
103
class function TUD2.GenericErrorLookup(grStatus: UD2_STATUS): string;
101
class function TUD2.GenericErrorLookup(grStatus: UD2_STATUS): string;
104
resourcestring
102
resourcestring
105
  LNG_STATUS_OK_UNSPECIFIED               = 'Unspecified generic success';
103
  LNG_STATUS_OK_UNSPECIFIED               = 'Success (Unspecified)';
106
  LNG_STATUS_OK_SINGLELINE                = 'Operation successful; one identifier returned';
104
  LNG_STATUS_OK_SINGLELINE                = 'Success (One identifier returned)';
107
  LNG_STATUS_OK_MULTILINE                 = 'Operation successful; multiple identifiers returned';
105
  LNG_STATUS_OK_MULTILINE                 = 'Success (Multiple identifiers returned)';
-
 
106
  LNG_UNKNOWN_SUCCESS                     = 'Success (Unknown status code %s)';
108
 
107
 
109
  LNG_STATUS_NOTAVAIL_UNSPECIFIED         = 'Unspecified generic "not available" status';
108
  LNG_STATUS_NOTAVAIL_UNSPECIFIED         = 'Not available (Unspecified)';
110
  LNG_STATUS_NOTAVAIL_OS_NOT_SUPPORTED    = 'Operating system not supported';
109
  LNG_STATUS_NOTAVAIL_OS_NOT_SUPPORTED    = 'Not available (Operating system not supported)';
111
  LNG_STATUS_NOTAVAIL_HW_NOT_SUPPORTED    = 'Hardware not supported';
110
  LNG_STATUS_NOTAVAIL_HW_NOT_SUPPORTED    = 'Not available (Hardware not supported)';
112
  LNG_STATUS_NOTAVAIL_NO_ENTITIES         = 'No entities to identify';
111
  LNG_STATUS_NOTAVAIL_NO_ENTITIES         = 'Not available (No entities to identify)';
113
  LNG_STATUS_NOTAVAIL_WINAPI_CALL_FAILURE = 'A Windows API call failed. Message: %s';
112
  LNG_STATUS_NOTAVAIL_WINAPI_CALL_FAILURE = 'Not available (A Windows API call failed. Message: %s)';
-
 
113
  LNG_UNKNOWN_NOTAVAIL                    = 'Not available (Unknown status code %s)';
114
 
114
 
115
  LNG_STATUS_ERROR_UNSPECIFIED            = 'Unspecified generic error';
115
  LNG_STATUS_ERROR_UNSPECIFIED            = 'Error (Unspecified)';
116
  LNG_STATUS_ERROR_BUFFER_TOO_SMALL       = 'The provided buffer is too small!';
116
  LNG_STATUS_ERROR_BUFFER_TOO_SMALL       = 'Error (The provided buffer is too small!)';
117
  LNG_STATUS_ERROR_INVALID_ARGS           = 'The function received invalid arguments!';
117
  LNG_STATUS_ERROR_INVALID_ARGS           = 'Error (The function received invalid arguments!)';
118
  LNG_STATUS_ERROR_PLUGIN_NOT_LICENSED    = 'The plugin is not licensed';
118
  LNG_STATUS_ERROR_PLUGIN_NOT_LICENSED    = 'Error (The plugin is not licensed)';
-
 
119
  LNG_UNKNOWN_FAILED                      = 'Error (Unknown status code %s)';
119
 
120
 
120
  LNG_UNKNOWN_SUCCESS                     = 'Unknown "success" status code %s';
-
 
121
  LNG_UNKNOWN_NOTAVAIL                    = 'Unknown "not available" status code %s';
-
 
122
  LNG_UNKNOWN_FAILED                      = 'Unknown "failure" status code %s';
-
 
123
  LNG_UNKNOWN_STATUS                      = 'Unknown status code with unexpected category: %s';
121
  LNG_UNKNOWN_STATUS                      = 'Unknown status code with unexpected category: %s';
124
begin
122
begin
125
       if UD2_STATUS_Equal(grStatus, UD2_STATUS_OK_UNSPECIFIED, false)               then result := LNG_STATUS_OK_UNSPECIFIED
123
       if UD2_STATUS_Equal(grStatus, UD2_STATUS_OK_UNSPECIFIED, false)               then result := LNG_STATUS_OK_UNSPECIFIED
126
  else if UD2_STATUS_Equal(grStatus, UD2_STATUS_OK_SINGLELINE, false)                then result := LNG_STATUS_OK_SINGLELINE
124
  else if UD2_STATUS_Equal(grStatus, UD2_STATUS_OK_SINGLELINE, false)                then result := LNG_STATUS_OK_SINGLELINE
127
  else if UD2_STATUS_Equal(grStatus, UD2_STATUS_OK_MULTILINE, false)                 then result := LNG_STATUS_OK_MULTILINE
125
  else if UD2_STATUS_Equal(grStatus, UD2_STATUS_OK_MULTILINE, false)                 then result := LNG_STATUS_OK_MULTILINE
Line 191... Line 189...
191
  FPlugin := APlugin;
189
  FPlugin := APlugin;
192
end;
190
end;
193
 
191
 
194
{ TUD2 }
192
{ TUD2 }
195
 
193
 
196
procedure TUD2.HandlePluginDir(APluginDir: string);
194
procedure TUD2.HandlePluginDir(APluginDir, AFileMask: string);
197
Var
195
Var
198
  SR: TSearchRec;
196
  SR: TSearchRec;
199
  path: string;
197
  path: string;
200
  pluginLoader: TUD2PluginLoader;
198
  pluginLoader: TUD2PluginLoader;
201
  tob: TObjectList;
199
  tob: TObjectList;
202
  i: integer;
200
  i: integer;
203
  {$IFDEF CHECK_FOR_SAME_PLUGIN_GUID}
201
  {$IFDEF CHECK_FOR_SAME_PLUGIN_GUID}
204
  sPluginID, prevDLL: string;
202
  sPluginID, prevDLL: string;
205
  {$ENDIF}
203
  {$ENDIF}
206
  lngid: LANGID;
204
  lngid: LANGID;
-
 
205
  maskpath: string;
207
resourcestring
206
resourcestring
208
  LNG_PLUGINS_SAME_GUID = 'Attention: The plugin "%s" and the plugin "%s" have the same identification GUID. The latter will not be loaded.';
207
  LNG_PLUGINS_SAME_GUID = 'Attention: The plugin "%s" and the plugin "%s" have the same identification GUID. The latter will not be loaded.';
209
begin
208
begin
210
  tob := TObjectList.Create;
209
  tob := TObjectList.Create;
211
  try
210
  try
212
    tob.OwnsObjects := false;
211
    tob.OwnsObjects := false;
213
 
212
 
214
    lngID := GetSystemDefaultLangID;
213
    lngID := GetSystemDefaultLangID;
215
 
214
 
-
 
215
    path := APluginDir;
216
    path := IncludeTrailingPathDelimiter(APluginDir);
216
    if path <> '' then path := IncludeTrailingPathDelimiter(path);
-
 
217
 
217
    if FindFirst(path + '*.dll', 0, SR) = 0 then
218
    if FindFirst(path + AFileMask, 0, SR) = 0 then
218
    begin
219
    begin
219
      try
220
      try
220
        repeat
221
        repeat
221
          try
222
          try
222
            tob.Add(TUD2PluginLoader.Create(false, path+sr.Name, lngid));
223
            tob.Add(TUD2PluginLoader.Create(false, path + sr.Name, lngid));
Line 464... Line 465...
464
  end;
465
  end;
465
 
466
 
466
resourcestring
467
resourcestring
467
  LNG_DLL_NOT_LOADED = 'Plugin DLL "%s" could not be loaded.';
468
  LNG_DLL_NOT_LOADED = 'Plugin DLL "%s" could not be loaded.';
468
  LNG_METHOD_NOT_FOUND = 'Method "%s" not found in plugin "%s". The DLL is probably not a valid plugin DLL.';
469
  LNG_METHOD_NOT_FOUND = 'Method "%s" not found in plugin "%s". The DLL is probably not a valid plugin DLL.';
469
  LNG_INVALID_PLUGIN = 'The plugin "%s" is not a valid plugin for this program version.';
470
  LNG_INVALID_PLUGIN = 'The plugin "%s" is not a valid plugin for this application.';
470
  LNG_METHOD_FAILURE = 'Error "%s" at method "%s" of plugin "%s".';
471
  LNG_METHOD_FAILURE = 'Error "%s" at method "%s" of plugin "%s".';
471
begin
472
begin
472
  result := false;
473
  result := false;
473
  startTime := GetTickCount;
474
  startTime := GetTickCount;
474
 
475