You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@601 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
1
components/onguard/examples/exnet/EXNET.NAF
Normal file
1
components/onguard/examples/exnet/EXNET.NAF
Normal file
@ -0,0 +1 @@
|
||||
�)�#���g�����4
|
2
components/onguard/examples/exnet/ONGUARD.INI
Normal file
2
components/onguard/examples/exnet/ONGUARD.INI
Normal file
@ -0,0 +1,2 @@
|
||||
[Codes]
|
||||
NetCode=241918EC8E3BABBB
|
114
components/onguard/examples/exnet/exnet.lpi
Normal file
114
components/onguard/examples/exnet/exnet.lpi
Normal file
@ -0,0 +1,114 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="/"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<AlwaysBuild Value="False"/>
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<ActiveEditorIndexAtStart Value="1"/>
|
||||
</General>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="tponguard"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="5">
|
||||
<Unit0>
|
||||
<Filename Value="exnet.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<CursorPos X="44" Y="7"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="exnetu.pas"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceFilename Value="exnetu.lrs"/>
|
||||
<UnitName Value="Exnetu"/>
|
||||
<CursorPos X="53" Y="159"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../../source/ognetwrk.pas"/>
|
||||
<UnitName Value="ognetwrk"/>
|
||||
<CursorPos X="68" Y="478"/>
|
||||
<TopLine Value="465"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../../source/ogutil.pas"/>
|
||||
<UnitName Value="ogutil"/>
|
||||
<CursorPos X="28" Y="1334"/>
|
||||
<TopLine Value="1330"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="../../source/onguard.pas"/>
|
||||
<UnitName Value="onguard"/>
|
||||
<CursorPos X="35" Y="1349"/>
|
||||
<TopLine Value="1344"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit4>
|
||||
</Units>
|
||||
<JumpHistory Count="0" HistoryIndex="-1"/>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<IncludeAssertionCode Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<UseHeaptrc Value="True"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="2">
|
||||
<Item1>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item2>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
14
components/onguard/examples/exnet/exnet.lpr
Normal file
14
components/onguard/examples/exnet/exnet.lpr
Normal file
@ -0,0 +1,14 @@
|
||||
program Exnet;
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Interfaces,
|
||||
Forms,
|
||||
Exnetu in 'EXNETU.PAS' {Form1}, tponguard;
|
||||
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
100
components/onguard/examples/exnet/exnetu.lfm
Normal file
100
components/onguard/examples/exnet/exnetu.lfm
Normal file
@ -0,0 +1,100 @@
|
||||
object Form1: TForm1
|
||||
Left = 258
|
||||
Height = 317
|
||||
Top = 146
|
||||
Width = 490
|
||||
HorzScrollBar.Page = 489
|
||||
VertScrollBar.Page = 316
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Network Code Example'
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Sans Serif'
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
object StatusLbl: TLabel
|
||||
Left = 8
|
||||
Height = 13
|
||||
Top = 262
|
||||
Width = 35
|
||||
Caption = 'Status'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 232
|
||||
Height = 13
|
||||
Top = 14
|
||||
Width = 77
|
||||
Caption = 'Current code:'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
end
|
||||
object CodeLbl: TLabel
|
||||
Left = 320
|
||||
Height = 13
|
||||
Top = 14
|
||||
Width = 113
|
||||
Caption = '0000000000000000'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
end
|
||||
object CodeBtn: TButton
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 89
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Caption = 'Enter Code'
|
||||
OnClick = CodeBtnClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object Memo1: TMemo
|
||||
Left = 8
|
||||
Height = 209
|
||||
Top = 40
|
||||
Width = 465
|
||||
Color = clBtnFace
|
||||
Lines.Strings = (
|
||||
'The label at the bottom of this form indicates the status of the code. An invalid code indicates that '
|
||||
'the code is either the incorrect type or that none has been entered. '
|
||||
''
|
||||
'If the proper code has not been entered or the ONGUARD.INI file was deleted, the message will '
|
||||
'say that the code is invalid.'
|
||||
''
|
||||
'Use the "Enter Code" button to enter a code (the CODEGEN program can be used to generate '
|
||||
'the proper "Usage" code). '
|
||||
''
|
||||
'The "Remove Code" button can be used to remove the entered code from the INI file. Doing so '
|
||||
'will cause the TOgNetCode component to report that the code is invalid.'
|
||||
)
|
||||
ReadOnly = True
|
||||
TabOrder = 1
|
||||
end
|
||||
object CloseBtn: TBitBtn
|
||||
Left = 400
|
||||
Height = 25
|
||||
Top = 256
|
||||
Width = 75
|
||||
Kind = bkClose
|
||||
NumGlyphs = 0
|
||||
TabOrder = 2
|
||||
end
|
||||
object RemoveBtn: TButton
|
||||
Left = 288
|
||||
Height = 25
|
||||
Top = 256
|
||||
Width = 97
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Caption = 'Remove Code'
|
||||
OnClick = RemoveBtnClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object OgNetCode1: TOgNetCode
|
||||
OnChecked = CodeChecked
|
||||
OnGetKey = GetKey
|
||||
OnGetCode = GetCode
|
||||
FileName = 'EXNET.NAF'
|
||||
left = 16
|
||||
top = 216
|
||||
end
|
||||
end
|
34
components/onguard/examples/exnet/exnetu.lrs
Normal file
34
components/onguard/examples/exnet/exnetu.lrs
Normal file
@ -0,0 +1,34 @@
|
||||
{ To jest automatycznie wygenerowany plik zasob�w lazarusa }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#2#1#6'Height'#3'='#1#3'Top'#3#146#0#5'Wid'
|
||||
+'th'#3#234#1#18'HorzScrollBar.Page'#3#233#1#18'VertScrollBar.Page'#3'<'#1#11
|
||||
+'BorderStyle'#7#8'bsDialog'#7'Caption'#6#20'Network Code Example'#11'Font.He'
|
||||
+'ight'#2#245#9'Font.Name'#6#13'MS Sans Serif'#8'OnCreate'#7#10'FormCreate'#8
|
||||
+'Position'#7#14'poScreenCenter'#0#6'TLabel'#9'StatusLbl'#4'Left'#2#8#6'Heigh'
|
||||
+'t'#2#13#3'Top'#3#6#1#5'Width'#2'#'#7'Caption'#6#6'Status'#5'Color'#7#6'clNo'
|
||||
+'ne'#11'ParentColor'#8#0#0#6'TLabel'#6'Label1'#4'Left'#3#232#0#6'Height'#2#13
|
||||
+#3'Top'#2#14#5'Width'#2'M'#7'Caption'#6#13'Current code:'#5'Color'#7#6'clNon'
|
||||
+'e'#11'ParentColor'#8#0#0#6'TLabel'#7'CodeLbl'#4'Left'#3'@'#1#6'Height'#2#13
|
||||
+#3'Top'#2#14#5'Width'#2'q'#7'Caption'#6#16'0000000000000000'#5'Color'#7#6'cl'
|
||||
+'None'#11'ParentColor'#8#0#0#7'TButton'#7'CodeBtn'#4'Left'#2#8#6'Height'#2#25
|
||||
+#3'Top'#2#8#5'Width'#2'Y'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#10
|
||||
+'Enter Code'#7'OnClick'#7#12'CodeBtnClick'#8'TabOrder'#2#0#0#0#5'TMemo'#5'Me'
|
||||
+'mo1'#4'Left'#2#8#6'Height'#3#209#0#3'Top'#2'('#5'Width'#3#209#1#5'Color'#7#9
|
||||
+'clBtnFace'#13'Lines.Strings'#1#6'fThe label at the bottom of this form indi'
|
||||
+'cates the status of the code. An invalid code indicates that '#6'Ethe code '
|
||||
+'is either the incorrect type or that none has been entered. '#6#0#6'^If the'
|
||||
+' proper code has not been entered or the ONGUARD.INI file was deleted, the '
|
||||
+'message will '#6#29'say that the code is invalid.'#6#0#6'YUse the "Enter Co'
|
||||
+'de" button to enter a code (the CODEGEN program can be used to generate '#6
|
||||
+#26'the proper "Usage" code). '#6#0#6'\The "Remove Code" button can be used '
|
||||
+'to remove the entered code from the INI file. Doing so '#6'Gwill cause the '
|
||||
+'TOgNetCode component to report that the code is invalid.'#0#8'ReadOnly'#9#8
|
||||
+'TabOrder'#2#1#0#0#7'TBitBtn'#8'CloseBtn'#4'Left'#3#144#1#6'Height'#2#25#3'T'
|
||||
+'op'#3#0#1#5'Width'#2'K'#4'Kind'#7#7'bkClose'#9'NumGlyphs'#2#0#8'TabOrder'#2
|
||||
+#2#0#0#7'TButton'#9'RemoveBtn'#4'Left'#3' '#1#6'Height'#2#25#3'Top'#3#0#1#5
|
||||
+'Width'#2'a'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#11'Remove Code'#7
|
||||
+'OnClick'#7#14'RemoveBtnClick'#8'TabOrder'#2#3#0#0#10'TOgNetCode'#10'OgNetCo'
|
||||
+'de1'#9'OnChecked'#7#11'CodeChecked'#8'OnGetKey'#7#6'GetKey'#9'OnGetCode'#7#7
|
||||
+'GetCode'#8'FileName'#6#9'EXNET.NAF'#4'left'#2#16#3'top'#3#216#0#0#0#0
|
||||
]);
|
165
components/onguard/examples/exnet/exnetu.pas
Normal file
165
components/onguard/examples/exnet/exnetu.pas
Normal file
@ -0,0 +1,165 @@
|
||||
unit Exnetu;
|
||||
{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes,Controls, Forms, Dialogs,
|
||||
StdCtrls, Buttons,LResources, OnGuard, IniFiles, OgUtil, OgNetWrk;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
CodeBtn: TButton;
|
||||
Memo1: TMemo;
|
||||
CloseBtn: TBitBtn;
|
||||
StatusLbl: TLabel;
|
||||
Label1: TLabel;
|
||||
CodeLbl: TLabel;
|
||||
RemoveBtn: TButton;
|
||||
OgNetCode1: TOgNetCode;
|
||||
procedure CodeChecked(Sender: TObject; Status: TCodeStatus);
|
||||
procedure GetKey(Sender: TObject; var Key: TKey);
|
||||
procedure GetCode(Sender: TObject; var Code: TCode);
|
||||
procedure CodeBtnClick(Sender: TObject);
|
||||
procedure RemoveBtnClick(Sender: TObject);
|
||||
procedure ChangeCode(Sender: TObject; Code: TCode);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
|
||||
procedure TForm1.CodeChecked(Sender: TObject; Status: TCodeStatus);
|
||||
var
|
||||
S : string;
|
||||
begin
|
||||
case Status of
|
||||
ogValidCode : S := 'Valid Code - Max Users: ' + IntToStr(OgNetCode1.MaxUsers);
|
||||
ogInvalidCode : S := 'Invalid release code';
|
||||
ogPastEndDate : S := 'Date has expired';
|
||||
ogDayCountUsed : S := 'Zero days of use remaining';
|
||||
ogRunCountUsed : S := 'Usage count has expired';
|
||||
ogNetCountUsed : S := 'Net usage count exceeded';
|
||||
ogCodeExpired : S := 'Code has expired';
|
||||
else
|
||||
S := 'Unknown error';
|
||||
end;
|
||||
StatusLbl.Caption := S;
|
||||
end;
|
||||
|
||||
procedure TForm1.GetKey(Sender: TObject; var Key: TKey);
|
||||
const
|
||||
{this applications' key}
|
||||
CKey : TKey = ($E5,$8F,$84,$D6,$92,$C9,$A4,$D8,$1A,$FA,$6F,$8D,$AB,$FC,$DF,$B4);
|
||||
begin
|
||||
Key := CKey;
|
||||
end;
|
||||
|
||||
procedure TForm1.GetCode(Sender: TObject; var Code: TCode);
|
||||
var
|
||||
Ini : TIniFile;
|
||||
S : string;
|
||||
begin
|
||||
Ini := TIniFile.Create('ONGUARD.INI');
|
||||
try
|
||||
{get the code from the ini file}
|
||||
S := Ini.ReadString('Codes', 'NetCode', '');
|
||||
{convert to proper form}
|
||||
HexToBuffer(S, Code, SizeOf(Code));
|
||||
{set code label caption}
|
||||
CodeLbl.Caption := S;
|
||||
finally
|
||||
Ini.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CodeBtnClick(Sender: TObject);
|
||||
var
|
||||
Ini : TIniFile;
|
||||
Work : TCode;
|
||||
S : string;
|
||||
begin
|
||||
S := '';
|
||||
{ask for code}
|
||||
if InputQuery('Net Code Entry', 'Enter the code', S) then begin
|
||||
Ini := TIniFile.Create('ONGUARD.INI');
|
||||
try
|
||||
{store the code in the ini file if it looks OK}
|
||||
if HexToBuffer(S, Work, SizeOf(Work)) then begin
|
||||
{save the value}
|
||||
Ini.WriteString('Codes', 'NetCode', S);
|
||||
CodeLbl.Caption := S;
|
||||
|
||||
{if a record in the NAF is already locked, this won't work - use NAFMGR}
|
||||
{when the NAF is not in use}
|
||||
DeleteFile(OgNetCode1.FileName);
|
||||
OgNetCode1.CreateAccessFile;
|
||||
|
||||
{tell the code component to test the new code, reporting the results}
|
||||
OgNetCode1.CheckCode(True);
|
||||
|
||||
ShowMessage('Exit and restart EXNET.EXE to use the new Network Access File and new settings');
|
||||
end;
|
||||
finally
|
||||
Ini.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.RemoveBtnClick(Sender: TObject);
|
||||
var
|
||||
IniFile : TIniFile;
|
||||
begin
|
||||
IniFile := TIniFile.Create('ONGUARD.INI');
|
||||
try
|
||||
IniFile.DeleteKey('Codes', 'NetCode');
|
||||
finally
|
||||
IniFile.Free;
|
||||
end;
|
||||
|
||||
{tell the code component to test the new code, reporting the results}
|
||||
OgNetCode1.CheckCode(True);
|
||||
end;
|
||||
|
||||
procedure TForm1.ChangeCode(Sender: TObject; Code: TCode);
|
||||
var
|
||||
Ini : TIniFile;
|
||||
S : string;
|
||||
begin
|
||||
Ini := TIniFile.Create('ONGUARD.INI');
|
||||
try
|
||||
{store the code in the ini file}
|
||||
S := BufferToHex(Code, SizeOf(Code));
|
||||
Ini.WriteString('Codes', 'NetCode', S);
|
||||
CodeLbl.Caption := S;
|
||||
|
||||
{tell the code component to test the new code, reporting the results}
|
||||
OgNetCode1.CheckCode(True);
|
||||
finally
|
||||
Ini.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
Code : TCode;
|
||||
begin
|
||||
{force code label to update}
|
||||
GetCode(Self, Code);
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$i exnetu.lrs}
|
||||
|
||||
end.
|
Reference in New Issue
Block a user