[go: up one dir, main page]

Menu

[r19]: / source / onguard4.pas  Maximize  Restore  History

Download this file

170 lines (145 with data), 4.3 kB

  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
(* ***** 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):
*
* ***** END LICENSE BLOCK ***** *)
{*********************************************************}
{* ONGUARD4.PAS 1.15 *}
{* Copyright (c) 1996-02 TurboPower Software Co *}
{* All rights reserved. *}
{*********************************************************}
{$I onguard.inc}
unit onguard4;
{-Product description dialog}
interface
uses
{$IFDEF Win16} WinTypes, WinProcs, {$ENDIF}
{$IFDEF Win32} Windows, {$ENDIF}
{$IFDEF MSWINDOWS}
StdCtrls, Buttons, ExtCtrls, Controls, Classes, Forms,
{$ENDIF}
{$IFDEF UseOgFMX}
System.SysUtils, System.Types, System.UITypes, System.Classes,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Objects, FMX.ExtCtrls,
FMX.Layouts, FMX.Edit, FMX.Platform,
Fmx.StdCtrls, FMX.Header, FMX.Graphics,
{$ENDIF}
ogutil,
onguard,
onguard1;
type
TEditProductFrm = class(TForm)
OKBtn: TButton;
CancelBtn: TButton;
Panel1: TPanel;
Label1: TLabel;
ProductEd: TEdit;
Label2: TLabel;
KeyEd: TEdit;
GenerateKeySb: TSpeedButton;
KeyPasteSb: TSpeedButton;
procedure FormCreate(Sender: TObject);
procedure InfoChanged(Sender: TObject);
procedure KeyPasteSbClick(Sender: TObject);
procedure GenerateKeySbClick(Sender: TObject);
private
{ Private declarations }
FKey : TKey;
FKeyType : TKeyType;
function GetShowHints : Boolean;
procedure SetShowHints(Value : Boolean);
public
{ Public declarations }
procedure SetKey(Value : TKey); {!!.08}
procedure GetKey(var Value : TKey); {!!.08}
property KeyType : TKeyType
read FKeyType
write FKeyType;
property ShowHints : Boolean
read GetShowHints
write SetShowHints;
end;
implementation
{$IFDEF MSWINDOWS}{$R *.DFM}{$ENDIF}
{$IFDEF UseOgFMX}{$R *.FMX}{$ENDIF}
procedure TEditProductFrm.FormCreate(Sender: TObject);
begin
InfoChanged(Sender);
end;
procedure TEditProductFrm.InfoChanged(Sender: TObject);
var
Work : TKey;
begin
OKBtn.Enabled := (Length(ProductEd.Text) > 0) and
(HexToBuffer(KeyEd.Text, Work, SizeOf(Work)));
end;
procedure TEditProductFrm.KeyPasteSbClick(Sender: TObject);
begin
KeyEd.PasteFromClipboard;
end;
procedure TEditProductFrm.GenerateKeySbClick(Sender: TObject);
var
F : TKeyGenerateFrm;
begin
F := TKeyGenerateFrm.Create(Self);
try
F.SetKey(FKey);
F.KeyType := FKeyType;
{$IFDEF MSWINDOWS}
F.ShowHint := GetShowHints;
{$ENDIF}
if F.ShowModal = mrOK then begin
F.GetKey(FKey);
FKeyType := F.KeyType;
KeyEd.Text := BufferToHex(FKey, SizeOf(FKey));
if HexStringIsZero(KeyEd.Text)then begin
KeyEd.Text := '';
FillChar(FKey, SizeOf(FKey), 0);
end;
InfoChanged(Sender);
end;
finally
F.Free;
end;
end;
function TEditProductFrm.GetShowHints : Boolean;
begin
Result := False;
{$IFDEF MSWINDOWS}
Result := ShowHint;
{$ENDIF}
end;
procedure TEditProductFrm.SetShowHints(Value : Boolean);
begin
{$IFDEF MSWINDOWS}
ShowHint := Value;
{$ENDIF}
end;
procedure TEditProductFrm.GetKey(var Value : TKey);
begin
Value := FKey;
end;
procedure TEditProductFrm.SetKey(Value : TKey);
begin
FKey := Value;
end;
end.