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:
2
components/onguard/examples/exdys30/Days30.INI
Normal file
2
components/onguard/examples/exdys30/Days30.INI
Normal file
@ -0,0 +1,2 @@
|
||||
[Codes]
|
||||
DaysCode=82FC3292E294CC3A
|
90
components/onguard/examples/exdys30/exdys30.lpi
Normal file
90
components/onguard/examples/exdys30/exdys30.lpi
Normal file
@ -0,0 +1,90 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="/"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<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="2">
|
||||
<Unit0>
|
||||
<Filename Value="exdys30.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<CursorPos X="10" Y="4"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="exdys30u.pas"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceFilename Value="exdys30u.lrs"/>
|
||||
<UnitName Value="Exdys30u"/>
|
||||
<CursorPos X="29" Y="69"/>
|
||||
<TopLine Value="50"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
</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/exdys30/exdys30.lpr
Normal file
14
components/onguard/examples/exdys30/exdys30.lpr
Normal file
@ -0,0 +1,14 @@
|
||||
program Exdys30;
|
||||
{$objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Interfaces,
|
||||
Forms,
|
||||
Exdys30u in 'EXDYS30U.PAS' {Form1}, tponguard;
|
||||
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
52
components/onguard/examples/exdys30/exdys30u.lfm
Normal file
52
components/onguard/examples/exdys30/exdys30u.lfm
Normal file
@ -0,0 +1,52 @@
|
||||
object Form1: TForm1
|
||||
Left = 324
|
||||
Height = 158
|
||||
Top = 260
|
||||
Width = 229
|
||||
HorzScrollBar.Page = 228
|
||||
VertScrollBar.Page = 157
|
||||
Caption = 'Form1'
|
||||
Font.Color = clBlack
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Position = poScreenCenter
|
||||
object Label1: TLabel
|
||||
Left = 64
|
||||
Height = 13
|
||||
Top = 74
|
||||
Width = 99
|
||||
Alignment = taCenter
|
||||
Caption = 'Days Remaining: '
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
end
|
||||
object Memo1: TMemo
|
||||
Left = 6
|
||||
Height = 45
|
||||
Top = 14
|
||||
Width = 213
|
||||
Lines.Strings = (
|
||||
'If you can edit this, then your program '
|
||||
'was allowed to run'
|
||||
)
|
||||
ScrollBars = ssVertical
|
||||
TabOrder = 0
|
||||
end
|
||||
object CloseBtn: TBitBtn
|
||||
Left = 64
|
||||
Height = 33
|
||||
Top = 92
|
||||
Width = 89
|
||||
Kind = bkClose
|
||||
NumGlyphs = 0
|
||||
TabOrder = 1
|
||||
end
|
||||
object OgDaysCode1: TOgDaysCode
|
||||
OnChecked = OgDaysCode1Checked
|
||||
OnGetKey = OgDaysCode1GetKey
|
||||
OnGetCode = OgDaysCode1GetCode
|
||||
OnChangeCode = OgDaysCode1ChangeCode
|
||||
left = 88
|
||||
top = 176
|
||||
end
|
||||
end
|
18
components/onguard/examples/exdys30/exdys30u.lrs
Normal file
18
components/onguard/examples/exdys30/exdys30u.lrs
Normal file
@ -0,0 +1,18 @@
|
||||
{ To jest automatycznie wygenerowany plik zasob�w lazarusa }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'D'#1#6'Height'#3#158#0#3'Top'#3#4#1#5'Wid'
|
||||
+'th'#3#229#0#18'HorzScrollBar.Page'#3#228#0#18'VertScrollBar.Page'#3#157#0#7
|
||||
+'Caption'#6#5'Form1'#10'Font.Color'#7#7'clBlack'#11'Font.Height'#2#245#9'Fon'
|
||||
+'t.Name'#6#13'MS Sans Serif'#8'Position'#7#14'poScreenCenter'#0#6'TLabel'#6
|
||||
+'Label1'#4'Left'#2'@'#6'Height'#2#13#3'Top'#2'J'#5'Width'#2'c'#9'Alignment'#7
|
||||
+#8'taCenter'#7'Caption'#6#16'Days Remaining: '#5'Color'#7#6'clNone'#11'Paren'
|
||||
+'tColor'#8#0#0#5'TMemo'#5'Memo1'#4'Left'#2#6#6'Height'#2'-'#3'Top'#2#14#5'Wi'
|
||||
+'dth'#3#213#0#13'Lines.Strings'#1#6'(If you can edit this, then your program'
|
||||
+' '#6#18'was allowed to run'#0#10'ScrollBars'#7#10'ssVertical'#8'TabOrder'#2
|
||||
+#0#0#0#7'TBitBtn'#8'CloseBtn'#4'Left'#2'@'#6'Height'#2'!'#3'Top'#2'\'#5'Widt'
|
||||
+'h'#2'Y'#4'Kind'#7#7'bkClose'#9'NumGlyphs'#2#0#8'TabOrder'#2#1#0#0#11'TOgDay'
|
||||
+'sCode'#11'OgDaysCode1'#9'OnChecked'#7#18'OgDaysCode1Checked'#8'OnGetKey'#7
|
||||
+#17'OgDaysCode1GetKey'#9'OnGetCode'#7#18'OgDaysCode1GetCode'#12'OnChangeCode'
|
||||
+#7#21'OgDaysCode1ChangeCode'#4'left'#2'X'#3'top'#3#176#0#0#0#0
|
||||
]);
|
138
components/onguard/examples/exdys30/exdys30u.pas
Normal file
138
components/onguard/examples/exdys30/exdys30u.pas
Normal file
@ -0,0 +1,138 @@
|
||||
(*
|
||||
This program uses the TOgDaysCode component. The first time the
|
||||
program is run, the necessary information is created and stored
|
||||
in an INI file. In addition, the program is given a "drop dead"
|
||||
date, i.e., regardless of how many days the program has been used,
|
||||
it cannont be used after that date (1999 December 31).
|
||||
*)
|
||||
unit Exdys30u;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Controls,
|
||||
Forms, Dialogs,LResources, StdCtrls, Buttons,
|
||||
OnGuard,OgUtil,IniFiles;
|
||||
|
||||
const
|
||||
CKey : TKey = ($E5,$8F,$84,$D6,$92,$C9,$A4,$D8,
|
||||
$1A,$FA,$6F,$8D,$AB,$FC,$DF,$B4);
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Memo1: TMemo;
|
||||
CloseBtn: TBitBtn;
|
||||
OgDaysCode1: TOgDaysCode;
|
||||
Label1: TLabel;
|
||||
procedure OgDaysCode1GetKey(Sender: TObject; var Key: TKey);
|
||||
procedure OgDaysCode1GetCode(Sender: TObject; var Code: TCode);
|
||||
procedure OgDaysCode1ChangeCode(Sender: TObject; Code: TCode);
|
||||
procedure OgDaysCode1Checked(Sender: TObject; Status: TCodeStatus);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
TheDir : string;
|
||||
IniFile : TIniFile;
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
|
||||
{==========================================================================}
|
||||
|
||||
procedure TForm1.OgDaysCode1GetKey(Sender: TObject; var Key: TKey);
|
||||
begin
|
||||
Key := CKey;
|
||||
end;
|
||||
|
||||
{==========================================================================}
|
||||
|
||||
procedure TForm1.OgDaysCode1GetCode(Sender: TObject; var Code: TCode);
|
||||
var
|
||||
S : string;
|
||||
Expires : TDateTime;
|
||||
L : integer;
|
||||
begin
|
||||
{force the INI file to be in the same directory as the application}
|
||||
TheDir := ExtractFilePath(ParamStr(0));
|
||||
{
|
||||
L := Length(TheDir);
|
||||
if (L > 3) and (TheDir[L] <> '\') then
|
||||
TheDir := TheDir + '\';}
|
||||
|
||||
{open Ini File}
|
||||
IniFile := TIniFile.Create(TheDir + 'Days30.INI');
|
||||
try
|
||||
{try to read release code}
|
||||
S := IniFile.ReadString('Codes', 'DaysCode', 'NoCode');
|
||||
|
||||
{If default string returned, create code on the fly}
|
||||
if (S = 'NoCode') then begin
|
||||
{force absolute ("drop dead") expiration date of 1999 Dec. 31}
|
||||
Expires := EncodeDate(1999, 12, 31);
|
||||
InitDaysCode(CKey, 30, Expires, Code);
|
||||
|
||||
{save string representation of release code to Ini File}
|
||||
S := BufferToHex(Code, SizeOf(Code));
|
||||
IniFile.WriteString('Codes', 'DaysCode', S);
|
||||
end else
|
||||
{convert retrieved string to a code}
|
||||
HexToBuffer(S, Code, SizeOf(Code));
|
||||
finally
|
||||
IniFile.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
{==========================================================================}
|
||||
|
||||
procedure TForm1.OgDaysCode1ChangeCode(Sender: TObject; Code: TCode);
|
||||
var
|
||||
S : string;
|
||||
begin
|
||||
IniFile := TIniFile.Create(TheDir + 'Days30.INI');
|
||||
try
|
||||
{convert Code to string for writing to INI file}
|
||||
S := BufferToHex(Code, SizeOf(Code));
|
||||
IniFile.WriteString('Codes', 'DaysCode', S);
|
||||
finally
|
||||
IniFile.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
{==========================================================================}
|
||||
|
||||
procedure TForm1.OgDaysCode1Checked(Sender: TObject; Status: TCodeStatus);
|
||||
var
|
||||
S : string;
|
||||
begin
|
||||
case Status of
|
||||
ogValidCode : begin
|
||||
Label1.Caption := 'Days Remaining: '
|
||||
+ IntToStr(OgDaysCode1.GetValue);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
ogInvalidCode : S := 'Invalid Code';
|
||||
|
||||
ogDayCountUsed : S := 'Program used more than 30 days' + #13 +
|
||||
'Please register NOW';
|
||||
|
||||
ogCodeExpired : S := 'Evaluation period expired' + #13 +
|
||||
'Please register NOW';
|
||||
end;
|
||||
ShowMessage(S);
|
||||
Application.Terminate;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$i exdys30u.lrs}
|
||||
|
||||
end.
|
Reference in New Issue
Block a user