forked from madorin/fibplus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
RegFIBPlusEditors.pas
540 lines (436 loc) · 15.1 KB
/
RegFIBPlusEditors.pas
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
unit RegFIBPlusEditors;
interface
{$I ..\FIBPlus.inc}
uses Windows,Classes,StdCtrls,Forms,ExtCtrls,Dialogs,SysUtils,pFIBInterfaces, TypInfo,
{$IFDEF D6+}
DesignEditors,DesignIntf, Variants//,Types
{$else}
DsgnIntf
{$ENDIF}
;
type
IFIBSQLTextEditor= interface
['{59B98703-4324-43AA-A656-5842806E35B2}']
function GetReadOnly:boolean;
procedure SetReadOnly(Value:boolean);
function GetLines:TStrings;
procedure SetLines(Value: TStrings);
function GetSelStart: Integer;
procedure SetSelStart(Value: Integer);
function GetSelLength: Integer;
procedure SetSelLength(Value: Integer);
function GetCaretX:integer;
function GetCaretY:integer;
procedure iSetCaretPos(X,Y:integer);
procedure ScreenPosToTextPos(const ScrX,ScrY:Integer; var DestX,DestY:Integer ); // äëÿ äðàã äðîïà
procedure SelectAll;
function GetModified: Boolean;
procedure SetModified(Value: Boolean);
procedure SetFocus;
property SelLength: Integer read GetSelLength write SetSelLength;
property SelStart: Integer read GetSelStart write SetSelStart;
property ReadOnly:boolean read GetReadOnly write SetReadOnly;
property Lines: TStrings read GetLines write SetLines;
property CaretX:integer read GetCaretX;
property CaretY:integer read GetCaretY;
end;
procedure RegisterFIBSQLTextEditor(Editor:TClass);
function GetSQLTextEditor:TClass;
procedure Register;
implementation
uses
pFIBComponentEditors,
{$ifndef internal}
aspr_api, Fibmodule5, Fibmodule6, FibHash2, Fibhash3,
fibAthlInstanceCounter, fibCheckSingleLicenseClass,
{$endif}
ToolsAPI, RegSynEditAlt, FIBSplash;
var
vSQLTextEditorClass: TClass;
LicensedTo: string;
k: AnsiString;
type TFIBSQLMemo=class(TMemo,IFIBSQLTextEditor)
private
function GetReadOnly:boolean;
procedure SetReadOnly(Value:boolean);
function GetLines:TStrings;
function GetCaretX:integer;
function GetCaretY:integer;
function GetModified: Boolean;
procedure SetModified(Value: Boolean);
procedure iSetCaretPos(X,Y:integer);
procedure ScreenPosToTextPos(const ScrX,ScrY:Integer; var DestX,DestY:Integer ); // äëÿ äðàã äðîïà
public
constructor Create(AOwner:TComponent);override;
end;
procedure RegisterFIBSQLTextEditor(Editor:TClass);
begin
if Assigned(Editor) then
vSQLTextEditorClass:=Editor
else
vSQLTextEditorClass:=TFIBSQLMemo
end;
function GetSQLTextEditor:TClass;
begin
if Assigned(vSQLTextEditorClass) then
Result:=vSQLTextEditorClass
else
Result:=TFIBSQLMemo
end;
{$ifndef internal}
type
TMenuIOTAFibPlus = class(TNotifierObject, IOTAWIzard, IOTAMenuWizard)
public
function GetMenuText: string;
function GetIDString: string;
function GetName: string;
function GetState: TWizardState;
procedure Execute;
end;
TIDEIOTAFibPlus = class(TNotifierObject, IOTANotifier, IOTAIDENotifier, IOTAIDENotifier50)
public
// IOTAIDENotifier
procedure FileNotification(NotifyCode: TOTAFileNotification;
const FileName: string; var Cancel: Boolean);
procedure BeforeCompile(const Project: IOTAProject; var Cancel: Boolean); overload;
procedure AfterCompile(Succeeded: Boolean); overload;
// IOTAIDENotifier50
procedure BeforeCompile(const Project: IOTAProject; IsCodeInsight: Boolean;
var Cancel: Boolean); overload;
procedure AfterCompile(Succeeded: Boolean; IsCodeInsight: Boolean); overload;
end;
type
TDemoTimer = class
end;
var
DemoTimer: TDemoTimer;
var
CheckLicense: TCheckLicense;
NotifierIndex: Integer;
{$endif}
type
IFIBClassesExporter = interface
['{AFC7CF1A-EAA5-4584-B47D-BDAD337B4EEC}']
(* {$IFNDEF FIBPLUS_TRIAL}
['{AFC7CF1A-EAA5-4584-B47D-BDAD337B4EEC}']
{$ELSE}
['{E79530A4-574C-4A94-80BC-73F689AA48A6}']
{$ENDIF}
*)
function iGetStringer:IFIBStringer;
function iGetMetaExtractor:IFIBMetaDataExtractor;
end;
procedure Register;
procedure RegisterEditors;
var
DatabaseClass:TClass;
QueryClass:TClass;
DatasetClass:TClass;
DeltaReceiver:TClass;
TransactionClass:TClass;
pi:PPropInfo;
auClass:TClass;
expCl:IFIBClassesExporter;
begin
Supports(FIBClassesExporter,IFIBClassesExporter,expCl);
try
expCl.iGetStringer; // AV åñëè òðèàë ïûòàþòñÿ èñïîëüçîâàòü ñ íå òðèàëîì
//database Properties
DatabaseClass:=expDatabaseClass;
TransactionClass:=expTransactionClass;
QueryClass:=expQueryClass;
DatasetClass:=expDatasetClass;
DeltaReceiver:=expDeltaReceiverClass;
RegisterPropertyEditor(TypeInfo(string), DatabaseClass, 'AliasName', TFIBAliasEdit);
RegisterPropertyEditor(TypeInfo(string), DatabaseClass, 'DBName', TFileNameProperty);
RegisterPropertyEditor(TypeInfo(string), DatabaseClass, 'LibraryName', TFileNameProperty);
RegisterPropertyEditor(TypeInfo(TNotifyEvent),DatabaseClass, 'OnConnect', nil );
pi:=GetPropInfo(DatabaseClass,'OnLogin');
if pi<>nil then
RegisterPropertyEditor(pi.PropType^,DatabaseClass, 'OnLogin', nil );
RegisterComponentEditor(TComponentClass(DatabaseClass), TpFIBDatabaseEditor);
RegisterComponentEditor(TComponentClass(TransactionClass), TpFIBTransactionEditor);
RegisterComponentEditor(TComponentClass(QueryClass), TpFIBQueryEditor);
RegisterComponentEditor(TComponentClass(DataSetClass), TFIBGenSQlEd);
pi:=GetPropInfo(QueryClass,'Conditions');
RegisterPropertyEditor(pi.PropType^,nil,'Conditions',TFIBConditionsEditor);
pi:=GetPropInfo(DatasetClass,'Options');
RegisterPropertyEditor(pi.PropType^, nil, 'Options', TpFIBDataSetOptionsEditor);
pi:=GetPropInfo(DatasetClass,'PrepareOptions');
RegisterPropertyEditor(pi.PropType^, nil, 'PrepareOptions', TpFIBDataSetOptionsEditor);
pi:=GetPropInfo(DatasetClass,'AutoUpdateOptions');
RegisterPropertyEditor(pi.PropType^, DatasetClass, 'AutoUpdateOptions', TpFIBAutoUpdateOptionsEditor);
auClass:=GetTypeData(Pi^.PropType^).ClassType;
RegisterPropertyEditor(TypeInfo(TStrings), auClass,
'ParamsToFieldsLinks', TEdParamToFields
);
RegisterPropertyEditor(TypeInfo(string), auClass,
'GeneratorName', TGeneratorNameEdit
);
RegisterPropertyEditor(TypeInfo(string), auClass,
'KeyFields', TKeyFieldNameEdit
);
RegisterPropertyEditor(TypeInfo(string), auClass,
'UpdateTableName', TTableNameEdit
);
RegisterPropertyEditor(TypeInfo(integer), DatasetClass,
'DataSet_ID', TDataSet_ID_Edit
);
RegisterPropertyEditor(TypeInfo(TStrings),DatasetClass,'SelectSQL',nil);
RegisterPropertyEditor(TypeInfo(TStrings),DatasetClass,'InsertSQL',nil);
RegisterPropertyEditor(TypeInfo(TStrings),DatasetClass,'UpdateSQL',nil);
RegisterPropertyEditor(TypeInfo(TStrings),DatasetClass,'DeleteSQL',nil);
RegisterPropertyEditor(TypeInfo(TStrings),DatasetClass,'RefreshSQL',nil);
RegisterPropertyEditor(TypeInfo(boolean),DatasetClass,'WaitEndMasterScroll',nil);
pi:=GetPropInfo(DatasetClass,'SQLs');
RegisterPropertyEditor(TypeInfo(TStrings),GetTypeData(Pi^.PropType^).ClassType,'',TFIBSQLsProperty);
RegisterPropertyEditor(pi.PropType^,DatasetClass,'',TFIBSQLsProperties);
RegisterPropertyEditor(TypeInfo(string), QueryClass, 'StoredProcName',
TpFIBStoredProcProperty
);
RegisterPropertyEditor(TypeInfo(TStrings), QueryClass, 'SQL',
TpFIBSQLPropEdit
);
RegisterPropertyEditor(TypeInfo(string),TransactionClass,
'UserKindTransaction', TFIBTrKindEdit
);
pi:=GetPropInfo(DatabaseClass,'GeneratorsCache');
auClass:=GetTypeData(Pi^.PropType^).ClassType;
RegisterPropertyEditor(TypeInfo(TOwnedCollection),auClass,
'GeneratorList', TpFIBGeneratorsProperty
);
RegisterPropertyEditor(TypeInfo(string),auClass,
'CacheFileName', TFileNameProperty
);
{ RegisterPropertyEditor(TypeInfo(TOwnedCollection),TGeneratorsCache,
'Generators', TpFIBGeneratorsProperty
);
{ RegisterPropertyEditor(TypeInfo(TCollection), TCustomDBGridEh, 'Columns', TDBGridEhColumnsProperty);
}
RegisterPropertyEditor(TypeInfo(TStrings), TransactionClass, 'TRParams',
TpFIBTRParamsEditor
);
if Assigned(expServicesClass) then
RegisterPropertyEditor(TypeInfo(string), expServicesClass, 'LibraryName', TFileNameProperty);
RegisterPropertyEditor(TypeInfo(string), DeltaReceiver,
'TableName', TTableNameEditDR
);
RegisterComponentEditor(TComponentClass(DeltaReceiver), TpFIBDeltaReceiverEditor);
{$IFDEF D6+}
RegisterPropertiesInCategory('Transactions',['*Transaction*'] );
{$ENDIF}
except
end;
end;
begin
RegisterSplashScreen;
{$ifdef internal}
{$IFDEF FIBPLUS_TRIAL}
RegisterEditors;
{$ELSE}
RegisterFIBUtils;
RegisterEditors;
{$ENDIF}
{$else}
{$IFDEF FIBPLUS_TRIAL}
{$I include\aspr_crypt_begin1.inc} // trial
RegisterEditors;
DemoTimer := TDemoTimer.Create;
{$I include\aspr_crypt_end1.inc}
{$ELSE}
RegisterFIBUtils;
{$I include\aspr_crypt_begin1.inc} // single user
RegisterEditors;
CheckLicense := TCheckLicense.Create(k);
NotifierIndex := (BorlandIDEServices as IOTAServices).AddNotifier(TIDEIOTAFibPlus.Create);
{$I include\aspr_crypt_end1.inc}
{$I include\aspr_crypt_begin2.inc} // multi user
RegisterEditors;
{$I include\aspr_crypt_end2.inc}
{$ENDIF}
RegisterPackageWizard(TMenuIOTAFibPlus.create as IOTAWizard);
{$endif}
end;
{ TFIBSQLMemo }
constructor TFIBSQLMemo.Create(AOwner: TComponent);
begin
inherited;
ScrollBars:=ssBoth;
end;
function TFIBSQLMemo.GetCaretX: integer;
begin
Result:=CaretPos.X
end;
function TFIBSQLMemo.GetCaretY: integer;
begin
Result:=CaretPos.Y
end;
function TFIBSQLMemo.GetLines: TStrings;
begin
Result:=Lines
end;
function TFIBSQLMemo.GetModified: Boolean;
begin
Result:=Modified
end;
function TFIBSQLMemo.GetReadOnly: boolean;
begin
Result:=ReadOnly
end;
procedure TFIBSQLMemo.ScreenPosToTextPos(const ScrX,ScrY:Integer; var DestX,DestY:Integer ); // äëÿ äðàã äðîïà
begin
DestX:=-1
end;
procedure TFIBSQLMemo.iSetCaretPos(X,Y:integer);
begin
end;
procedure TFIBSQLMemo.SetModified(Value: Boolean);
begin
Modified:=Value
end;
procedure TFIBSQLMemo.SetReadOnly(Value: boolean);
begin
inherited ReadOnly:=Value
end;
{$ifndef internal}
procedure RegisterModule;
const
RegKey = 'Devrace\FibPlus';
var
Crypt: TDev_class8; //Tea
Crypt2: TDev_class10; //Ice
tempkey: HKey;
keyClass: array[0..MAXCHAR] of AnsiChar;
KeySize: DWord;
work, Hardware: AnsiString;
I: Integer;
info, username, key: Ansistring;
t: AnsiChar;
begin
DemoTimer := nil;
CheckLicense := nil;
NotifierIndex := -MAXWORD;
LicensedTo := 'Craked version';
Crypt := TDev_class8.Create(nil);
Crypt2 := TDev_class10.Create(nil);
try
if RegOpenKeyEx(HKEY_CURRENT_USER, 'Software\' + RegKey, 0, KEY_QUERY_VALUE, tempkey) = ERROR_SUCCESS then
begin
KeySize := MAXCHAR;
RegQueryInfoKeyA(tempkey, keyClass, @KeySize, nil, nil, nil, nil, nil, nil, nil, nil, nil);
RegCloseKey(TempKey);
Hardware := GetHardwareID;
Hardware := Hardware + StringOfChar('\', Length(RegKey) - Length(Hardware));
work := '';
for I := 1 to Length(RegKey) do
work := work + AnsiChar(Byte(Ord(Hardware[i]) + Ord(RegKey[i])));
crypt.InitStr(work, TDev_hash2); //MD5
info := crypt.WorkDSt(keyclass);
username := Copy(info, 1, Pos(#1, Info) - 1);
LicensedTo := username;
key := copy(info, Pos(#1, Info) + 1, Length(info));
k := key;
crypt2.InitStr(username, TDev_hash3); //RipeMD-128
key := key + '==';
key := Crypt2.WorkDSt(key);
t := key[1]; key[1] := key[30]; key[30] := t;
t := key[3]; key[3] := key[32]; key[32] := t;
t := key[6]; key[6] := key[35]; key[35] := t;
t := key[8]; key[8] := key[37]; key[37] := t;
t := key[10]; key[10] := key[39]; key[39] := t;
t := key[12]; key[12] := key[41]; key[41] := t;
t := key[14]; key[14] := key[43]; key[43] := t;
CheckKeyAndDecrypt(PAnsiChar(key), PAnsiChar(username), False);
// k := key;
end;
finally
Crypt.Burn;
Crypt.Free;
Crypt2.Burn;
Crypt2.Free;
end;
end;
{$endif}
{$ifndef internal}
{ TMenuIOTACleverFilter }
procedure TMenuIOTAFibPlus.Execute;
var
Msg: string;
begin
{$I include\userpolybuffer.inc}
Msg := 'FibPlus version 7.0.'#13#10'Copyright (c) Devrace Ltd, S.A.'#13#10;
if Assigned(DemoTimer)
then Msg := Msg + 'Trial version'
else Msg := Msg + 'Registered on ' + LicensedTo;
if Assigned(CheckLicense) then
Msg := Msg + #13#10'Running instance: ' + IntToStr(CheckLicense.InstanceCount);
if BorlandIDEServices <> nil then
MessageDlg(Msg, mtInformation, [mbOk], 0{$IFDEF D2006+}, mbOK{$ENDIF});
end;
function TMenuIOTAFibPlus.GetIDString: string;
begin
Result := 'Devrace.FibPlus';
end;
function TMenuIOTAFibPlus.GetMenuText: string;
begin
Result := 'About Devrace FibPlus';
end;
function TMenuIOTAFibPlus.GetName: string;
begin
Result := 'AboutDevraceFibPlus';
end;
function TMenuIOTAFibPlus.GetState: TWizardState;
begin
Result := [wsEnabled];
end;
{ TIDEIOTACleverFilter }
procedure TIDEIOTAFibPlus.AfterCompile(Succeeded: Boolean);
begin
end;
procedure TIDEIOTAFibPlus.AfterCompile(Succeeded, IsCodeInsight: Boolean);
begin
end;
procedure TIDEIOTAFibPlus.BeforeCompile(const Project: IOTAProject;
IsCodeInsight: Boolean; var Cancel: Boolean);
begin
{$I include\userpolybuffer.inc}
Cancel := not (Assigned(CheckLicense) and CheckLicense.IsValid);
if Cancel then
(BorlandIDEServices as IOTAMessageServices).AddTitleMessage('The compilation of the project has been stopped because of the violation of the license agreement: the current registration key is being used on multiple computers simultaneously.');
end;
procedure TIDEIOTAFibPlus.BeforeCompile(const Project: IOTAProject;
var Cancel: Boolean);
begin
{$I include\userpolybuffer.inc}
Cancel := not (Assigned(CheckLicense) and CheckLicense.IsValid);
if Cancel then
(BorlandIDEServices as IOTAMessageServices).AddTitleMessage('The compilation of the project has been stopped because of the violation of the license agreement: the current registration key is being used on multiple computers simultaneously.');
end;
procedure TIDEIOTAFibPlus.FileNotification(
NotifyCode: TOTAFileNotification; const FileName: string;
var Cancel: Boolean);
begin
{$I include\userpolybuffer.inc}
Cancel := not (Assigned(CheckLicense) and CheckLicense.IsValid);
if Cancel then
(BorlandIDEServices as IOTAMessageServices).AddTitleMessage('The compilation of the project has been stopped because of the violation of the license agreement: the current registration key is being used on multiple computers simultaneously.');
end;
procedure ClenaupModule;
begin
{$I include\userpolybuffer.inc}
if Assigned(DemoTimer) then FreeAndNil(DemoTimer);
if Assigned(CheckLicense) then FreeAndNil(CheckLicense);
if NotifierIndex <> -MAXWORD then
(BorlandIDEServices as IOTAServices).RemoveNotifier(NotifierIndex);
end;
{$endif}
initialization
{$ifndef internal}
RegisterModule;
{$endif}
// RegisterFIBSQLTextEditor(TFIBSQLMemo)
finalization
{$ifndef internal}
ClenaupModule;
{$endif}
end.