You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8747 8e941d3f-bd1b-0410-a28a-d453659cc2b4
231 lines
6.8 KiB
ObjectPascal
231 lines
6.8 KiB
ObjectPascal
(* ***** BEGIN LICENSE BLOCK *****
|
|
* Version: MPL 1.1
|
|
*
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at
|
|
* http://www.mozilla.org/MPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
* for the specific language governing rights and limitations under the
|
|
* License.
|
|
*
|
|
* The Original Code is TurboPower OnGuard
|
|
*
|
|
* The Initial Developer of the Original Code is
|
|
* TurboPower Software
|
|
*
|
|
* Portions created by the Initial Developer are Copyright (C) 1996-2002
|
|
* the Initial Developer. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*
|
|
* Andrew Haines andrew@haines.name {AH.01}
|
|
* conversion to CLX {AH.01}
|
|
* December 30, 2003 {AH.01}
|
|
*
|
|
* ***** END LICENSE BLOCK ***** *)
|
|
{*********************************************************}
|
|
{* OGREG.PAS 1.13 *}
|
|
{* Copyright (c) 1996-02 TurboPower Software Co *}
|
|
{* All rights reserved. *}
|
|
{*********************************************************}
|
|
|
|
{$I ONGUARD.INC}
|
|
|
|
unit ogreg; {AH.01}
|
|
|
|
|
|
interface
|
|
|
|
procedure Register;
|
|
|
|
implementation
|
|
|
|
{$R ogreg.res}
|
|
|
|
uses
|
|
Classes, Controls, Forms,
|
|
qogabout0, ogconst,ognetwrk, ogproexe, {AH.01}
|
|
onguard, {AH.01}
|
|
qonguard2, {AH.01}
|
|
qonguard3, {AH.01}
|
|
qonguard5, {AH.01}
|
|
qonguard6, {AH.01}
|
|
qonguard7, {AH.01}
|
|
ogutil, {!!.12}
|
|
ComponentEditors,
|
|
PropEdits;
|
|
// LazarusPackageIntf;
|
|
//LResources;
|
|
|
|
{-------------------------------------------------------------------------------
|
|
TOgCodeGenEditor
|
|
component editor for TogCodeBase components
|
|
-------------------------------------------------------------------------------}
|
|
type
|
|
TOgCodeGenEditor = class({TDefaultEditor}TDefaultComponentEditor)
|
|
public
|
|
procedure ExecuteVerb(Index: Integer); override;
|
|
function GetVerb(Index: Integer): string; override;
|
|
function GetVerbCount: Integer; override;
|
|
end;
|
|
|
|
procedure TOgCodeGenEditor.ExecuteVerb(Index : Integer);
|
|
begin
|
|
if Index = 0 then begin
|
|
with TCodeGenerateFrm.Create(Application) do
|
|
try
|
|
ShowHint := True;
|
|
KeyFileName := OgKeyFile;
|
|
if Component is TOgDateCode then
|
|
CodeType := ctDate
|
|
else if Component is TOgDaysCode then
|
|
CodeType := ctDays
|
|
else if Component is TOgNetCode then
|
|
CodeType := ctNetwork
|
|
else if Component is TOgRegistrationCode then
|
|
CodeType := ctRegistration
|
|
else if Component is TOgSerialNumberCode then
|
|
CodeType := ctSerialNumber
|
|
else if Component is TOgSpecialCode then
|
|
CodeType := ctSpecial
|
|
else if Component is TOgUsageCode then
|
|
CodeType := ctUsage;
|
|
ShowModal;
|
|
finally
|
|
Free;
|
|
end;
|
|
end else if Index = 1 then begin
|
|
with TKeyMaintFrm.Create(Application) do
|
|
try
|
|
ShowHint := True;
|
|
KeyFileName := 'ONGUARD.INI';
|
|
KeyType := ktRandom;
|
|
ShowModal;
|
|
finally
|
|
Free;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
function TOgCodeGenEditor.GetVerb(Index : Integer) : string;
|
|
begin
|
|
case Index of
|
|
0 : Result := 'Generate Code';
|
|
1 : Result := 'Generate Key';
|
|
else
|
|
Result := '?';
|
|
end;
|
|
end;
|
|
|
|
function TOgCodeGenEditor.GetVerbCount : Integer;
|
|
begin
|
|
Result := 2;
|
|
end;
|
|
|
|
|
|
{-------------------------------------------------------------------------------
|
|
TOgModifierProperty
|
|
Property editor for ranges
|
|
-------------------------------------------------------------------------------}
|
|
type
|
|
TOgModifierProperty = class(TStringProperty)
|
|
public
|
|
function GetAttributes: TPropertyAttributes; override;
|
|
function GetValue: string; override;
|
|
procedure Edit; override;
|
|
end;
|
|
|
|
function TOgModifierProperty.GetAttributes: TPropertyAttributes;
|
|
begin
|
|
Result := [paDialog];
|
|
end;
|
|
|
|
function TOgModifierProperty.GetValue: string;
|
|
begin
|
|
Result := inherited GetValue;
|
|
end;
|
|
|
|
procedure TOgModifierProperty.Edit;
|
|
begin
|
|
with TModifierFrm.Create(Application) do
|
|
try
|
|
if ShowModal = mrOK then
|
|
SetValue(BufferToHex(Modifier, SizeOf(Modifier)));
|
|
finally
|
|
Free;
|
|
end;
|
|
end;
|
|
|
|
|
|
{-------------------------------------------------------------------------------
|
|
TOgAboutProperty
|
|
-------------------------------------------------------------------------------}
|
|
type
|
|
TOgAboutProperty = class(TStringProperty)
|
|
public
|
|
function GetAttributes: TPropertyAttributes; override;
|
|
procedure Edit; override;
|
|
end;
|
|
|
|
function TOgAboutProperty.GetAttributes: TPropertyAttributes;
|
|
begin
|
|
Result := [paDialog, paReadOnly];
|
|
end;
|
|
|
|
procedure TOgAboutProperty.Edit;
|
|
begin
|
|
with TOgAboutForm.Create(Application) do begin
|
|
try
|
|
ShowModal;
|
|
finally
|
|
Free;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
{-------------------------------------------------------------------------------
|
|
Component registration
|
|
-------------------------------------------------------------------------------}
|
|
|
|
procedure Register;
|
|
begin
|
|
RegisterComponentEditor(TOgCodeBase, TOgCodeGenEditor);
|
|
|
|
RegisterPropertyEditor(
|
|
TypeInfo(string), TOgMakeKeys, 'KeyFileName', TOgFileNameProperty);
|
|
RegisterPropertyEditor(
|
|
TypeInfo(string), TOgMakeCodes, 'KeyFileName', TOgFileNameProperty);
|
|
{ RegisterPropertyEditor( }
|
|
{ TypeInfo(string), TOgCodeBase, 'Expires', TOgExpiresProperty);}
|
|
RegisterPropertyEditor(
|
|
TypeInfo(string), TOgCodeBase, 'Code', TOgCodeProperty);
|
|
RegisterPropertyEditor(
|
|
TypeInfo(string), TOgCodeBase, 'Modifier', TOgModifierProperty);
|
|
RegisterPropertyEditor(
|
|
TypeInfo(string), TOgCodeBase, 'About', TOgAboutProperty);
|
|
RegisterPropertyEditor(
|
|
TypeInfo(string), TOgProtectExe, 'About', TOgAboutProperty);
|
|
RegisterPropertyEditor(
|
|
TypeInfo(string), TOgMakeCodes, 'About', TOgAboutProperty);
|
|
RegisterPropertyEditor(
|
|
TypeInfo(string), TOgMakeKeys, 'About', TOgAboutProperty);
|
|
|
|
RegisterComponents('OnGuard', [
|
|
TOgMakeKeys,
|
|
TOgMakeCodes,
|
|
TOgDateCode,
|
|
TOgDaysCode,
|
|
TOgNetCode,
|
|
TOgRegistrationCode,
|
|
TOgSerialNumberCode,
|
|
TOgSpecialCode,
|
|
TOgUsageCode,
|
|
TOgProtectExe]);
|
|
end;
|
|
|
|
end.
|