text stringlengths 14 6.51M |
|---|
{
DBAExplorer - Oracle Admin Management Tool
Copyright (C) 2008 Alpaslan KILICKAYA
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
}
unit frmTableEvents;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, cxLookAndFeelPainters, cxPC, cxControls, StdCtrls,
cxButtons, ExtCtrls, cxTextEdit, cxMemo, cxRichEdit, cxCheckBox,
cxContainer, cxEdit, cxLabel, cxGroupBox, cxRadioGroup, cxGraphics,
cxMaskEdit, cxDropDownEdit, cxImageComboBox, Ora, OraStorage, GenelDM,
cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, cxSpinEdit;
type
TTableEventsFrm = class(TForm)
Panel1: TPanel;
btnOK: TcxButton;
btnCancel: TcxButton;
Panel2: TPanel;
imgToolBar: TImage;
imgObject: TImage;
lblObjectName: TcxLabel;
Shape1: TShape;
lblAction: TLabel;
pnlDropTable: TPanel;
cbDropTableCascadeConstraint: TcxCheckBox;
pnlTruncateTable: TPanel;
rgTruncateTableStorage: TcxRadioGroup;
pnlRenameTable: TPanel;
cxLabel3: TcxLabel;
edtRenameTable: TcxTextEdit;
pnlCopyTable: TPanel;
cxLabel4: TcxLabel;
cxLabel5: TcxLabel;
edtNewTableName: TcxTextEdit;
cbIncludeData: TcxCheckBox;
lcNewTableOwner: TcxLookupComboBox;
pnlLockTable: TPanel;
cxLabel6: TcxLabel;
cbNowait: TcxCheckBox;
icbLockMode: TcxImageComboBox;
pnlDropColumn: TPanel;
cbDropColumnCascade: TcxCheckBox;
pnlAnalyzeTable: TPanel;
rgAnalyzeTableFunction: TcxRadioGroup;
edtAnalyzeTableSampleSize: TcxSpinEdit;
cxLabel8: TcxLabel;
rgAnalyzeTableSampleType: TcxRadioGroup;
pnlAnalyzeIndex: TPanel;
rgAnalyzeIndexFunction: TcxRadioGroup;
edtAnalyzeIndexSampleSize: TcxSpinEdit;
rgAnalyzeIndexSampleType: TcxRadioGroup;
cxLabel12: TcxLabel;
pnlRenameConstraint: TPanel;
cxLabel16: TcxLabel;
edtNewConstraintName: TcxTextEdit;
pnlRenameView: TPanel;
edtRenameView: TcxTextEdit;
cxLabel1: TcxLabel;
procedure btnCancelClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure rgAnalyzeTableFunctionPropertiesEditValueChanged(
Sender: TObject);
procedure rgAnalyzeIndexFunctionPropertiesChange(Sender: TObject);
private
{ Private declarations }
FResult : boolean;
FObj: TObject;
FOraEvent: TOraEvent;
public
{ Public declarations }
function Init(obj: TObject; OEvent: TOraEvent): boolean;
end;
var
TableEventsFrm: TTableEventsFrm;
implementation
{$R *.dfm}
uses OraTable, OraIndex, OraConstraint, OraTriger, OraSynonym, OraView,
VisualOptions;
function TTableEventsFrm.Init(Obj: TObject; OEvent: TOraEvent): boolean;
var
objectID: integer;
begin
TableEventsFrm := TTableEventsFrm.Create(Application);
Self := TableEventsFrm;
DMGenel.ChangeLanguage(self);
ChangeVisualGUI(self);
FObj := Obj;
FOraEvent := OEvent;
FResult := false;
objectID := 0;
pnlDropTable.Visible := (FObj is TTable) and (FOraEvent = oeDrop);
pnlCopyTable.Visible := (FObj is TTable) and (FOraEvent = oeCopy);
pnlLockTable.Visible := (FObj is TTable) and (FOraEvent = oeLock);
pnlRenameTable.Visible := (FObj is TTable) and (FOraEvent = oeRename);
pnlTruncateTable.Visible := (FObj is TTable) and (FOraEvent = oeTruncate);
pnlAnalyzeTable.Visible := (FObj is TTable) and (FOraEvent = oeAnalyze);
pnlAnalyzeIndex.Visible := (FObj is TTableIndex) and (FOraEvent = oeAnalyze);
pnlRenameConstraint.Visible := (FObj is TConstraint) and (FOraEvent = oeRename);
pnlRenameView.Visible := (FObj is TView) and (FOraEvent = oeRename);
if (FObj is TTable) then
begin
lblObjectName.Caption := TTable(FObj).TABLE_NAME;
objectID := Integer(TDBFormType(dbTable));
end;
if (FObj is TTableIndex) then
begin
lblObjectName.Caption := TTableIndex(FObj).IndexName;
objectID := Integer(TDBFormType(dbIndexes));
end;
if (FObj is TConstraint) then
begin
lblObjectName.Caption := TConstraint(FObj).ConstraintName;
objectID := Integer(TDBFormType(dbConstraint));
end;
if (FObj is TView) then
begin
lblObjectName.Caption := TView(FObj).VIEW_NAME;
objectID := Integer(TDBFormType(dbView));
end;
dmGenel.ilSchemaBrowser.GetBitmap(objectID,imgObject.Picture.Bitmap);
Caption := OraEvent[FOraEvent]+' '+DBFormType[TDBFormType(objectID)];
lblAction.Caption := 'Are you sure you want to '+UpperCase(OraEvent[FOraEvent])+' selected '+DBFormType[TDBFormType(objectID)]+' ?';
ShowModal;
result := FResult;
Free;
end;
procedure TTableEventsFrm.btnCancelClick(Sender: TObject);
begin
close;
end;
procedure TTableEventsFrm.btnOKClick(Sender: TObject);
begin
btnOK.Enabled := False;
if (FObj is TTable) then
begin
if FOraEvent = oeDrop then FResult := TTable(FObj).DropTable(cbDropTableCascadeConstraint.Checked);
if FOraEvent = oeTruncate then FResult := TTable(FObj).TruncateTable(rgTruncateTableStorage.ItemIndex);
if FOraEvent = oeLock then FResult := TTable(FObj).LockTable(TLockMode(icbLockMode.ItemIndex),cbNowait.Checked);
if FOraEvent = oeCopy then FResult := TTable(FObj).CopyTable(edtNewTableName.Text, lcNewTableOwner.Text, cbIncludeData.Checked);
if FOraEvent = oeRename then FResult := TTable(FObj).RenameTable(edtRenameTable.Text);
if FOraEvent = oeAnalyze then FResult := TTable(FObj).AnalyzeTable(TAnalyzeFunction(rgAnalyzeTableFunction.ItemIndex), edtAnalyzeTableSampleSize.Value, rgAnalyzeTableSampleType.ItemIndex) ;
if FOraEvent = oeDisableConstraints then FResult := TTable(FObj).DisableALLConstraints;
if FOraEvent = oeEnableConstraints then FResult := TTable(FObj).EnableALLConstraints;
if FOraEvent = oeDisableTriggers then FResult := TTable(FObj).DisableALLTriggers;
if FOraEvent = oeEnableTriggers then FResult := TTable(FObj).EnableALLTriggers;
end;
if (FObj is TTableIndex) then
begin
if FOraEvent = oeAnalyze then FResult := TTableIndex(FObj).AnalyzeTable(TAnalyzeFunction(rgAnalyzeIndexFunction.ItemIndex), edtAnalyzeIndexSampleSize.Value, rgAnalyzeIndexSampleType.ItemIndex) ;
end;
if (FObj is TConstraint) then
begin
if FOraEvent = oeRename then FResult := TConstraint(FObj).RenameConstraint(edtNewConstraintName.Text);
end;
if (FObj is TView) then
begin
if FOraEvent = oeRename then FResult := TView(FObj).RenameView(edtRenameView.Text);
end;
if FResult then close;
end; //btnOKClick
procedure TTableEventsFrm.rgAnalyzeTableFunctionPropertiesEditValueChanged(
Sender: TObject);
begin
edtAnalyzeTableSampleSize.Enabled := rgAnalyzeTableFunction.ItemIndex = 1;
rgAnalyzeTableSampleType.Enabled := rgAnalyzeTableFunction.ItemIndex = 1;
end;
procedure TTableEventsFrm.rgAnalyzeIndexFunctionPropertiesChange(
Sender: TObject);
begin
edtAnalyzeIndexSampleSize.Enabled := rgAnalyzeIndexFunction.ItemIndex = 1;
rgAnalyzeIndexSampleType.Enabled := rgAnalyzeIndexFunction.ItemIndex = 1;
end;
end.
|
unit main;
{$mode objfpc}{$H+}
{$hints off}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, ComCtrls, ShellCtrls, Buttons, Lclintf,
Windows, ShellApi;
type
{ TMainForm }
TMainForm = class(TForm)
Images: TImageList;
Panel1: TPanel;
Panel2: TPanel;
ShellListView: TShellListView;
ShellTreeView: TShellTreeView;
ShellSplitter: TSplitter;
StatusBar: TStatusBar;
procedure FormShow(Sender: TObject);
procedure ShellListViewChange(Sender: TObject; Item: TListItem;
Change: TItemChange);
procedure ShellListViewClick(Sender: TObject);
procedure ShellListViewColumnClick(Sender: TObject; Column: TListColumn);
procedure ShellListViewDblClick(Sender: TObject);
procedure ShellListViewFileAdded(Sender: TObject; Item: TListItem);
procedure ShellTreeViewChanging(Sender: TObject; Node: TTreeNode;
var AllowChange: Boolean);
procedure ShellTreeViewGetImageIndex(Sender: TObject; Node: TTreeNode);
procedure ShellTreeViewGetSelectedIndex(Sender: TObject; Node: TTreeNode);
procedure ShellTreeViewSelectionChanged(Sender: TObject);
private
function GetFileIcon(const aFilename: string): TIcon;
public
InitialImageCount: integer;
end;
var
MainForm: TMainForm;
implementation
{$R *.lfm}
{ TMainForm }
procedure TMainForm.FormShow(Sender: TObject);
var
i: integer;
begin
{hide any drives that are empty - have to restart if insert CD for example}
for i := 0 to ShellTreeView.Items.Count-1 do begin
if not DirectoryExists(ShellTreeView.Items[i].Text) then
ShellTreeView.Items[i].Visible := false;
end;
InitialImageCount:=Images.Count;
end;
procedure TMainForm.ShellListViewChange(Sender: TObject; Item: TListItem;
Change: TItemChange);
const
LM = ' ';
var
aStatus: string;
begin
ShellListView.SortColumn := 0;
aStatus := LM + ShellListView.Items.Count.ToString + ' items';
if ShellListView.SelCount >0 then
aStatus := aStatus + LM + LM + ShellListView.SelCount.ToString + ' selected';
StatusBar.SimpleText:= aStatus;
end;
procedure TMainForm.ShellListViewClick(Sender: TObject);
var
fn: String;
begin
if ShellListView.ItemFocused <> nil then begin
fn := ShellListView.GetPathFromItem(ShellListView.ItemFocused);
end;
end;
procedure TMainForm.ShellListViewColumnClick(Sender: TObject;
Column: TListColumn);
begin
ShellListView.SortColumn := Column.Index;
end;
procedure TMainForm.ShellListViewDblClick(Sender: TObject);
begin
OpenDocument(ShellListView.GetPathFromItem(ShellListView.ItemFocused));
end;
procedure TMainForm.ShellListViewFileAdded(Sender: TObject; Item: TListItem);
var
fn: string;
begin
fn := ShellListView.GetPathFromItem(ShellLIstView.Items[Item.Index]);
Images.AddIcon(GetFileIcon(fn));
Item.ImageIndex := Images.Count-1;
end;
procedure TMainForm.ShellTreeViewChanging(Sender: TObject; Node: TTreeNode;
var AllowChange: Boolean);
var
i: integer;
begin
for i := Images.Count-1 downto InitialImageCount do begin
Images.Delete(i);
end;
end;
procedure TMainForm.ShellTreeViewGetImageIndex(Sender: TObject; Node: TTreeNode);
begin
if Node.Level = 0 then
Node.ImageIndex := 0
else if Node.Selected then
Node.ImageIndex := 2
else
Node.ImageIndex := 1;
end;
procedure TMainForm.ShellTreeViewGetSelectedIndex(Sender: TObject; Node: TTreeNode);
begin
if Node.Level = 0 then
Node.SelectedIndex := 0
else if Node.Selected then
Node.SelectedIndex := 2
else
Node.SelectedIndex := 1;
end;
procedure TMainForm.ShellTreeViewSelectionChanged(Sender: TObject);
begin
if Assigned(ShellTreeView.Selected) and not DirectoryExists(ShellTreeView.Path) then
ShellTreeView.Selected := nil;
end;
function TMainForm.GetFileIcon(const aFilename: string): TIcon;
var
aBmp : graphics.TBitmap;
myIconInfo: TIconInfo;
SFI: SHFileInfo;
begin
Result := TIcon.Create;
if SHGetFileInfo(PChar(aFilename), FILE_ATTRIBUTE_NORMAL, SFI, SizeOf(SHFileInfo),
SHGFI_SMALLICON or SHGFI_ICON)<>0 then begin
if (sfi.hIcon <> 0) and (GetIconInfo(sfi.hIcon, myIconInfo)) then begin
aBmp := graphics.TBitmap.Create;
aBmp.LoadFromBitmapHandles(myIconInfo.hbmColor, myIconInfo.hbmMask, nil);
Result.Assign(aBMP);
aBmp.Free;
end;
end;
end;
end.
|
unit fStatistics;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, ValEdit, cMegaROM, cConfiguration;
type
TfrmStatistics = class(TForm)
vleStatistics: TValueListEditor;
cmdOK: TButton;
cmdCancel: TButton;
procedure FormShow(Sender: TObject);
procedure cmdOKClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
_ROMData : TMegamanROM;
_EditorConfig : TRRConfig;
{ Private declarations }
procedure PopulateStatistics;
procedure SaveStatistics;
procedure ClearItemProps;
public
{ Public declarations }
end;
var
frmStatistics: TfrmStatistics;
implementation
{$R *.dfm}
uses uGlobal;
procedure TfrmStatistics.PopulateStatistics;
var
i : Integer;
TempStringList : TStringList;
begin
if _ROMData.Statistics.Count = 0 then exit;
for i := 0 to _ROMData.Statistics.Count -1 do
begin
if _ROMData.Statistics[i].List = '' then
vleStatistics.InsertRow(_ROMData.Statistics[i].Name,IntToHex(_ROMData.Statistics[i].Value,2),True)
else
begin
TempStringList := TStringList.Create;
TempStringList.LoadFromFile(ExtractFileDir(Application.EXEname) + '\Data\' + _ROMData.Statistics[i].List);
vleStatistics.InsertRow(_ROMData.Statistics[i].Name,TempStringList[_ROMData.Statistics[i].Value],True);
FreeAndNil(TempStringList);
vleStatistics.ItemProps[i].EditStyle := esPickList;
vleStatistics.ItemProps[i].PickList.LoadFromFile(ExtractFileDir(Application.EXEname) + '\Data\' + _ROMData.Statistics[i].List);
vleStatistics.ItemProps[i].ReadOnly := True;
end;
end;
end;
procedure TfrmStatistics.SaveStatistics;
var
i : integer;
TempStringList : TStringList;
begin
for i := 1 to _ROMData.Statistics.Count do
begin
if _ROMData.Statistics[i - 1].List = '' then
begin
if StrToInt('$' + vleStatistics.Values[vleStatistics.Keys[i]]) > _ROMData.Statistics[i-1].MaximumValue then
_ROMData.Statistics[i-1].Value := _ROMData.Statistics[i-1].MaximumValue
else
_ROMData.Statistics[i -1].Value := StrToInt('$' + vleStatistics.Values[vleStatistics.Keys[i]]);
end
else
begin
TempStringList := TStringList.Create;
TempStringList.LoadFromFile(ExtractFileDir(Application.EXEname) + '\Data\' + _ROMData.Statistics[i -1].List);
_ROMData.Statistics[i - 1].Value := TempStringList.IndexOf(vleStatistics.Values[vleStatistics.Keys[i]]);
FreeAndNil(TempStringList);
end;
end;
end;
procedure TfrmStatistics.cmdOKClick(Sender: TObject);
begin
SaveStatistics;
end;
procedure TfrmStatistics.ClearItemProps;
var
i : Integer;
begin
for i := 0 to _ROMData.Statistics.Count -1 do
begin
vleStatistics.ItemProps[i].Destroy;
end;
end;
procedure TfrmStatistics.FormDestroy(Sender: TObject);
begin
ClearItemProps;
end;
procedure TfrmStatistics.FormShow(Sender: TObject);
begin
PopulateStatistics;
end;
end.
|
{ Subroutine SST_W_C_DECL_SYM_DTYPE (DTYPE)
*
* Make sure that any symbols referenced by the data type descriptor DTYPE
* are declared.
}
module sst_w_c_DECL_SYM_DTYPE;
define sst_w_c_decl_sym_dtype;
%include 'sst_w_c.ins.pas';
procedure sst_w_c_decl_sym_dtype ( {declare symbols reference by a data type}
in dtype: sst_dtype_t); {data type descriptor that may reference syms}
const
max_msg_parms = 1; {max parameters we can pass to a message}
var
sym_p: sst_symbol_p_t; {scratch symbol pointer}
dt_p, dt2_p: sst_dtype_p_t; {scratch pointers to data type descriptor}
msg_parm: {references to paramters for messages}
array[1..max_msg_parms] of sys_parm_msg_t;
label
loop_pnt;
begin
if dtype.symbol_p <> nil then begin {symbol exists for this data type ?}
if {already completely declared ?}
sst_symflag_written_k in dtype.symbol_p^.flags then return;
if {already working on this data type ?}
sst_symflag_writing_dt_k in dtype.symbol_p^.flags then return;
if {not already working on this symbol ?}
not (sst_symflag_writing_k in dtype.symbol_p^.flags)
then begin
sst_w_c_symbol (dtype.symbol_p^); {declare data type's parent symbol}
return;
end;
dtype.symbol_p^.flags := {flag that we are now working on this dtype}
dtype.symbol_p^.flags + [sst_symflag_writing_dt_k];
end;
case dtype.dtype of {what kind of data type is this ?}
{
* Data type is an enumerated type.
}
sst_dtype_enum_k: begin
sym_p := dtype.enum_first_p; {init current enumerated name to first name}
while sym_p <> nil do begin {once for each enumerated name}
sst_w_c_symbol (sym_p^); {set up enumerated name symbol for output}
sym_p := sym_p^.enum_next_p; {advance to next enumerated name in dtype}
end; {back and process this new enumerated name}
end;
{
* Data type is a record.
}
sst_dtype_rec_k: begin
sym_p := dtype.rec_first_p; {init curr symbol to first field name}
while sym_p <> nil do begin {once for each field in record}
sst_w_c_symbol (sym_p^); {process field name symbol}
sym_p := sym_p^.field_next_p; {advance to next field in record}
end;
end;
{
* Data type is an array.
}
sst_dtype_array_k: begin
sst_w_c_decl_sym_exp (dtype.ar_ind_first_p^); {process exp for subscript range start}
if dtype.ar_ind_last_p <> nil then begin {fixed subscript ending exp exists ?}
sst_w_c_decl_sym_exp (dtype.ar_ind_last_p^); {process exp for subscript range end}
end;
if dtype.ar_dtype_rem_p = nil
then begin {this is a one-dimensional array}
sst_w_c_decl_sym_dtype (dtype.ar_dtype_ele_p^); {process elements data type}
end
else begin {there is more than one subscript}
sst_w_c_decl_sym_dtype (dtype.ar_dtype_rem_p^); {process "rest" of array}
end
;
end;
{
* Data type is a set.
}
sst_dtype_set_k: begin
sst_w_c_decl_sym_dtype (dtype.set_dtype_p^); {declare base data type of set}
end;
{
* Data type is a subrange of another data type.
}
sst_dtype_range_k: begin
sst_w_c_decl_sym_dtype (dtype.range_dtype_p^); {declare base data type of range}
sst_w_c_decl_sym_exp (dtype.range_first_p^); {declare symbols for min expression}
sst_w_c_decl_sym_exp (dtype.range_last_p^); {declare symbols for max expression}
end;
{
* Data type is a procedure.
}
sst_dtype_proc_k: begin
sst_w_c_decl_sym_rout (dtype.proc_p^); {declare symbols of this procedure}
end;
{
* Data type is a pointer.
}
sst_dtype_pnt_k: begin
dt_p := dtype.pnt_dtype_p; {init pointer to raw target data type}
loop_pnt:
if dt_p = nil then return; {NIL pointer ?}
if dt_p^.symbol_p <> nil then begin {this copy level has a symbol ?}
dt2_p := dt_p; {resolve base pointed-to data type}
while dt2_p^.dtype = sst_dtype_copy_k do dt2_p := dt2_p^.copy_dtype_p;
if dt2_p^.dtype = sst_dtype_undef_k {DTYPE is pointer to undefined data type ?}
then return;
if dt2_p^.dtype = sst_dtype_rec_k
then begin {pointer ultimately points to a record}
sst_w.name_sym^ (dt_p^.symbol_p^); {make sure symbol has an output name}
end
else begin {this is not a pointer to a record}
sst_w_c_symbol (dt_p^.symbol_p^); {write full nested symbol declaration}
end
;
return;
end;
if dt_p^.dtype = sst_dtype_copy_k then begin {curr dtype is copy of another ?}
dt_p := dt_p^.copy_dtype_p; {resolve one level of copy}
goto loop_pnt; {back to try at this new copy level}
end;
sst_w_c_decl_sym_dtype (dt_p^); {declare nested symbols in procedure template}
end;
{
* Data type is a copy of another data type.
}
sst_dtype_copy_k: begin
if dtype.copy_symbol_p <> nil then begin {there is a copied symbol ?}
sst_w_c_symbol (dtype.copy_symbol_p^); {declare copied data type symbol}
end;
sst_w_c_decl_sym_dtype (dtype.copy_dtype_p^); {declare copied data type}
end;
{
* All the data types that require no special processing.
}
sst_dtype_int_k: ;
sst_dtype_float_k: ;
sst_dtype_bool_k: ;
sst_dtype_char_k: ;
sst_dtype_undef_k: ;
otherwise
sys_msg_parm_int (msg_parm[1], ord(dtype.dtype));
sys_message_bomb ('sst', 'dtype_unexpected_exp', msg_parm, 1);
end; {end of data type cases}
end;
|
{
DBAExplorer - Oracle Admin Management Tool
Copyright (C) 2008 Alpaslan KILICKAYA
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
}
unit OraConstraint;
interface
uses Classes, SysUtils, Ora, DB, OraStorage,DBQuery, Forms, Dialogs;
type
TConstraint = class(TObject)
private
FConstraintName,
FOwner: String;
FConstraintType: TConstraintType;
FTableName,
FSearchCondidion,
FROwner,
FRConstraintName,
FStatus,
FDeleteRule,
FDeferrable,
FDeferred,
FValidated,
FGenerated,
FBad,
FRely: string;
FLastChange: TDateTime;
FIndexOwner,
FIndexName,
FInvalid,
FViewRelated: string;
FUsingIndexAttributes: boolean;
FExceptionSchema,
FExceptionTable: string;
FConstraitColumns: TColumnList;
FReferencedColumns: TColumnList;
FPhsicalAttributes : TPhsicalAttributes;
FOraSession: TOraSession;
public
property ConstraintName: String read FConstraintName write FConstraintName;
property Owner: String read FOwner write FOwner;
property ConstraintType: TConstraintType read FConstraintType write FConstraintType;
property TableName : String read FTableName write FTableName;
property SearchCondidion : String read FSearchCondidion write FSearchCondidion;
property ROwner : String read FROwner write FROwner;
property RConstraintName : String read FRConstraintName write FRConstraintName;
property Status : String read FStatus write FStatus;
property DeleteRule : String read FDeleteRule write FDeleteRule;
property Deferrable : String read FDeferrable write FDeferrable;
property Deferred : String read FDeferred write FDeferred;
property Validated : String read FValidated write FValidated;
property Generated : String read FGenerated write FGenerated;
property Bad : String read FBad write FBad;
property Rely: string read FRely write FRely;
property LastChange: TDateTime read FLastChange write FLastChange;
property IndexOwner : String read FIndexOwner write FIndexOwner;
property IndexName : String read FIndexName write FIndexName;
property Invalid : String read FInvalid write FInvalid;
property ViewRelated: string read FViewRelated write FViewRelated;
property UsingIndexAttributes: boolean read FUsingIndexAttributes write FUsingIndexAttributes;
property ExceptionSchema: string read FExceptionSchema write FExceptionSchema;
property ExceptionTable: string read FExceptionTable write FExceptionTable;
property ConstraitColumns: TColumnList read FConstraitColumns write FConstraitColumns;
property ReferencedColumns: TColumnList read FReferencedColumns write FReferencedColumns;
property PhsicalAttributes : TPhsicalAttributes read FPhsicalAttributes write FPhsicalAttributes;
property OraSession: TOraSession read FOraSession write FOraSession;
constructor Create;
destructor Destroy; override;
function GetConstaintDetail: string;
function GetConstaintColumns: string;
procedure SetDDL;
function GetDDL: string;
function CreateConstraint(ConstraintScript: string) : boolean;
function DropConstraint: boolean;
function EnableConstraint: boolean;
function DisableConstraint: boolean;
function RenameConstraint(NewConstraintName: string): boolean;
end;
TConstraintList = class(TObject)
private
FInnerList: TList;
FOraSession: TOraSession;
FTableName: string;
FOwner: string;
function GetItem(Index: Integer): TConstraint;
procedure SetItem(Index: Integer; Constraint: TConstraint);
function GetCount: Integer;
function GetTableConstraints: string;
public
property OraSession: TOraSession read FOraSession write FOraSession;
property TableName: string read FTableName write FTableName;
property Owner: string read FOwner write FOwner;
constructor Create;
destructor Destroy; override;
procedure Add(Constraint: TConstraint);
procedure Delete(Index: Integer);
property Count: Integer read GetCount;
property Items[Index: Integer]: TConstraint read GetItem write SetItem;
procedure SetDDL;
function GetDDL: string;
end;
function GetConstaints(ConstraintType: string): string;
implementation
uses Util, frmSchemaBrowser, Languages;
resourcestring
strConstraintRenamed = 'Constraint %s has been renamed.';
strConstraintDisabled = 'Constraint %s has been disabled.';
strConstraintEnabled = 'Constraint %s has been enabled.';
strConstraintDropped = 'Constraint %s has been dropped.';
strConstraintCreated = 'Constraint %s has been created.';
function GetConstaints(ConstraintType: string): string;
begin
result :=
' Select * from all_constraints '
+' where table_name = :pTable'
+' and CONSTRAINT_TYPE in ( '+ConstraintType+' ) '
+' and OWNER = :pOwner '
+' order by CONSTRAINT_NAME ';
end;
{**************************** TConstraintList **************************************}
constructor TConstraintList.Create;
begin
FInnerList := TList.Create;
end;
destructor TConstraintList.Destroy;
var
i : Integer;
begin
try
if FInnerList.Count > 0 then
begin
for i := FInnerList.Count - 1 downto 0 do
begin
TObject(FInnerList.Items[i]).Free;
end;
end;
finally
FInnerList.Free;
end;
inherited;
end;
procedure TConstraintList.Add(Constraint: TConstraint);
begin
FInnerList.Add(Constraint);
end;
procedure TConstraintList.Delete(Index: Integer);
begin
TObject(FInnerList.Items[Index]).Free;
FinnerList.Delete(Index);
end;
function TConstraintList.GetItem(Index: Integer): TConstraint;
begin
Result := FInnerList.Items[Index];
end;
procedure TConstraintList.SetItem(Index: Integer; Constraint: TConstraint);
begin
if Assigned(Constraint) then
FInnerList.Items[Index] := Constraint
end;
function TConstraintList.GetCount: Integer;
begin
Result := FInnerList.Count;
end;
function TConstraintList.GetTableConstraints: string;
begin
Result :=
' Select * from USER_constraints '
+' WHERE TABLE_NAME = :pTable '
+' AND OWNER = :pOwner '
+' AND CONSTRAINT_NAME NOT LIKE ''SYS_C%'' ';
end;
procedure TConstraintList.SetDDL;
var
q1: TOraQuery;
FConstraint: TConstraint;
begin
if FTableName = '' then exit;
q1 := TOraQuery.Create(nil);
q1.Session := OraSession;
q1.SQL.Text := GetTableConstraints;
q1.ParamByName('pTable').AsString := FTableName;
q1.ParamByName('pOwner').AsString := FOwner;
q1.Open;
while Not q1.Eof do
begin
FConstraint := TConstraint.Create;
FConstraint.TableName := FTableName;
FConstraint.Owner := FOwner;
FConstraint.OraSession := OraSession;
FConstraint.ConstraintName := q1.FieldByName('CONSTRAINT_NAME').AsString;
FConstraint.SetDDL;
Add(FConstraint);
FConstraint.NewInstance;
NewInstance;
q1.Next;
end;
q1.close;
end;
function TConstraintList.GetDDL: string;
var
i: integer;
begin
result := '';
if Count > 0 then
begin
for i := 0 to Count -1 do
begin
result := result + Items[i].GetDDL+ln+ln;
end;
end;
end;
{**************************** TConstraint **************************************}
constructor TConstraint.Create;
begin
inherited;
FConstraitColumns := TColumnList.Create;
FReferencedColumns := TColumnList.Create;
end;
destructor TConstraint.destroy;
begin
FConstraitColumns.Free;
FReferencedColumns.Free;
inherited;
end;
function TConstraint.GetConstaintDetail: string;
begin
Result :=
' Select * from all_constraints '
+' where CONSTRAINT_NAME = :pName '
+' and OWNER = :pOwner ';
end;
function TConstraint.GetConstaintColumns: string;
begin
Result :=
' Select * from ALL_CONS_COLUMNS '
+' where constraint_name = :pName '
+' and owner = :pOwner '
+' order by position ';
end;
procedure TConstraint.SetDDL;
var
q1: TOraQuery;
FColumn: TColumn;
FConstaintColumnList : TColumnList;
FReferencedColumnList : TColumnList;
begin
if FConstraintName = '' then exit;
q1 := TOraQuery.Create(nil);
q1.Session := OraSession;
q1.SQL.Text := GetConstaintDetail();
q1.ParamByName('pName').AsString := FConstraintName;
q1.ParamByName('pOwner').AsString := FOwner;
q1.Open;
if q1.FieldByName('CONSTRAINT_TYPE').AsString = 'P' then FConstraintType := ctPrimary;
if q1.FieldByName('CONSTRAINT_TYPE').AsString = 'U' then FConstraintType := ctUniqe;
if q1.FieldByName('CONSTRAINT_TYPE').AsString = 'C' then FConstraintType := ctCheck;
if q1.FieldByName('CONSTRAINT_TYPE').AsString = 'R' then FConstraintType := ctForeignKey;
FTableName := q1.FieldByName('TABLE_NAME').AsString;
FSearchCondidion := q1.FieldByName('SEARCH_CONDITION').AsString;
FROwner := q1.FieldByName('R_OWNER').AsString;
FRConstraintName := q1.FieldByName('R_CONSTRAINT_NAME').AsString;
FStatus := q1.FieldByName('STATUS').AsString;
FDeleteRule := q1.FieldByName('DELETE_RULE').AsString;
FDeferrable := q1.FieldByName('DEFERRABLE').AsString;
FDeferred := q1.FieldByName('DEFERRED').AsString;
if q1.FieldByName('VALIDATED').AsString = 'NOT VALIDATED' then
FValidated := 'NOVALIDATE'
else
FValidated := '';
FGenerated := q1.FieldByName('GENERATED').AsString;
FBad := q1.FieldByName('BAD').AsString;
FRely := q1.FieldByName('RELY').AsString;
FLastChange := q1.FieldByName('LAST_CHANGE').AsDateTime;
FIndexOwner := q1.FieldByName('INDEX_OWNER').AsString;
FIndexName := q1.FieldByName('INDEX_NAME').AsString;
FInvalid := q1.FieldByName('INVALID').AsString;
FViewRelated := q1.FieldByName('VIEW_RELATED').AsString;
FUsingIndexAttributes := q1.FieldByName('INDEX_NAME').AsString <> '';
if FConstraintType <> ctCheck then
begin
FConstaintColumnList := TColumnList.Create;
q1.close;
q1.SQL.Text := GetConstaintColumns();
q1.ParamByName('pName').AsString := FConstraintName;
q1.ParamByName('pOwner').AsString := FOwner;
q1.Open;
while not q1.Eof do
begin
FColumn := TColumn.Create;
FColumn.ColumnName := q1.FieldByName('COLUMN_NAME').AsString;
FColumn.DataType := '';
FConstaintColumnList.Add(FColumn);
FColumn.NewInstance;
FConstaintColumnList.NewInstance;
q1.Next;
end;
FConstraitColumns := FConstaintColumnList;
end;
if FConstraintType = ctForeignKey then
begin
{q1.Close;
q1.SQL.Text := GetConstaintDetail(FRConstraintName, FROwner);
q1.Open;
FROwner := q1.FieldByName('OWNER').AsString;
FRConstraintName := q1.FieldByName('TABLE_NAME').AsString;
}
FReferencedColumnList := TColumnList.Create;
q1.close;
q1.SQL.Text := GetConstaintColumns; //('', FOwner , FRConstraintName);
q1.ParamByName('pName').AsString := FRConstraintName;
q1.ParamByName('pOwner').AsString := FOwner;
q1.Open;
while not q1.Eof do
begin
FROwner := q1.FieldByName('OWNER').AsString;
FRConstraintName := q1.FieldByName('TABLE_NAME').AsString;
FColumn := TColumn.Create;
FColumn.ColumnName := q1.FieldByName('COLUMN_NAME').AsString;
FColumn.DataType := '';
FReferencedColumnList.Add(FColumn);
FColumn.NewInstance;
FReferencedColumnList.NewInstance;
q1.Next;
end;
FReferencedColumns := FReferencedColumnList;
end;
Q1.Close;
end;
function TConstraint.GetDDL: string;
var
strHeader: string;
i: integer;
begin
with self do
begin
strHeader := 'ALTER TABLE '+Owner+'.'+TableName+' ADD '+ln ;
if Generated = 'USER NAME' then strHeader := strHeader +' CONSTRAINT '+ConstraintName+ln;
strHeader := strHeader+' '+DBConstraintType[ConstraintType];
if ConstraintType = ctCheck then
strHeader := strHeader +' ('
+SearchCondidion
+')'+ln;
if ConstraintType <> ctCheck then
begin
if ConstraitColumns.Count > 0 then
begin
strHeader := strHeader +' (';
for i := 0 to ConstraitColumns.Count -1 do
begin
strHeader := strHeader + ConstraitColumns.Items[I].ColumnName;
if i <> ConstraitColumns.Count-1 then strHeader := strHeader +',';
end;
strHeader := strHeader +')'+ln;
end;
end;
if ConstraintType = ctForeignKey then
begin
strHeader := strHeader +' REFERENCES '+ROwner +'.'+ RConstraintName +'(' ;
if ReferencedColumns.Count > 0 then
begin
for i := 0 to ReferencedColumns.Count -1 do
begin
strHeader := strHeader + ReferencedColumns.Items[I].ColumnName;
if i <> ReferencedColumns.Count-1 then strHeader := strHeader +',';
end;
strHeader := strHeader +')'+ln;
end;
if DeleteRule <> 'NO ACTION' then
strHeader := strHeader +' ON DELETE '+DeleteRule+ln;
end;
if Deferrable = 'DEFERRABLE' then strHeader := strHeader +' '+Deferred+ln;
if UsingIndexAttributes then
begin
strHeader := strHeader +' USING INDEX';
strHeader := strHeader + GenerateStorage(PhsicalAttributes)+ln
end;
if (Status <> 'ENABLE') or (Status <> 'ENABLED') then
strHeader := strHeader +' '+ Status+ln;
strHeader := strHeader +' '+ Validated+ln;
if ((Validated = 'VALIDATE') or (Validated = 'VALIDATED')) and (ExceptionTable <> '') then
strHeader := strHeader +' EXCEPTIONS INTO '+ExceptionSchema+'.'+ExceptionTable+ln;
strHeader := strHeader +';'+ln;
if Rely = 'RELY' then
strHeader := strHeader +' ALTER TABLE '+TableName+' MODIFY CONSTRAINT '+ConstraintName+' RELY;'+ln;
end; //with PConstraint
Result := strHeader ;
end;
function TConstraint.CreateConstraint(ConstraintScript: string) : boolean;
begin
result := false;
if FConstraintName = '' then exit;
result := ExecSQL(ConstraintScript, Format(ChangeSentence('strConstraintCreated',strConstraintCreated),[FConstraintName]), FOraSession);
end;
function TConstraint.DropConstraint: boolean;
var
FSQL: string;
begin
result := false;
if FConstraintName = '' then exit;
FSQL := 'alter table '+FOwner+'.'+FTableName+' drop constraint '+FConstraintName;
result := ExecSQL(FSQL, Format(ChangeSentence('strConstraintDropped',strConstraintDropped),[FConstraintName]), FOraSession);
end;
function TConstraint.EnableConstraint: boolean;
var
FSQL: string;
begin
result := false;
if FConstraintName = '' then exit;
FSQL := 'alter table '+FOwner+'.'+FTableName+' enable constraint '+FConstraintName;
result := ExecSQL(FSQL, Format(ChangeSentence('strConstraintEnabled',strConstraintEnabled),[FConstraintName]), FOraSession);
end;
function TConstraint.DisableConstraint: boolean;
var
FSQL: string;
begin
result := false;
if FConstraintName = '' then exit;
FSQL := 'alter table '+FOwner+'.'+FTableName+' disable constraint '+FConstraintName;
result := ExecSQL(FSQL, Format(ChangeSentence('strConstraintDisabled',strConstraintDisabled),[FConstraintName]), FOraSession);
end;
function TConstraint.RenameConstraint(NewConstraintName: string): boolean;
var
FSQL: string;
begin
result := false;
if FConstraintName = '' then exit;
FSQL := 'alter table '+FOwner+'.'+FTableName+' rename constraint '+FConstraintName+' to '+NewConstraintName;
result := ExecSQL(FSQL, Format(ChangeSentence('strConstraintRenamed',strConstraintRenamed),[FConstraintName]), FOraSession);
end;
end.
|
unit SpellRes;
interface
resourcestring
spsVariants = 'Варианты';
spsDelete = '&Удалить';
spsChange = '&Заменить';
spsChangeAll = 'Заменить в&се';
spsSkip = '&Пропустить';
spsSkipAll = 'Пропустить &все';
spsAdd = '&Добавить';
spsCancel = '&Отмена';
spsCancelEdit = 'Отменить правку';
spsNotFound = 'Слово не найдено в словаре';
spsHyphen = 'Неверно расставлены переносы';
spsCaps = 'Неверные заглавные буквы';
spsAbbrev = 'Преположительно, аббревиатура';
spsNoSentenceCap = 'Строчная буква в начале предложения';
spsExtraSpaces = 'Лишние пробелы';
spsMissingSpace = 'Отсутствует пробел';
spsInitialNumeral = 'Слово начинается с цифр';
spsRepeatedWord = 'Повторяющееся слово';
spsFinish = 'Проверка орфографии закончена';
spsFinishCaption= 'Сообщение';
spsCaption = 'Проверка орфографии — %s';
spsError = 'Ошибка проверки № %d';
spsErrorLoad = 'Ошибка загрузки Spell DLL %s';
spsErrorUnload = 'Ошибка выгрузки Spell DLL %s';
implementation
end. |
{ *************************************************************************** }
{ }
{ This file is part of the XPde project }
{ }
{ Copyright (c) 2002 Jose Leon Serna <ttm@xpde.com> }
{ }
{ This program is free software; you can redistribute it and/or }
{ modify it under the terms of the GNU General Public }
{ License as published by the Free Software Foundation; either }
{ version 2 of the License, or (at your option) any later version. }
{ }
{ This program is distributed in the hope that it will be useful, }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU }
{ General Public License for more details. }
{ }
{ You should have received a copy of the GNU General Public License }
{ along with this program; see the file COPYING. If not, write to }
{ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, }
{ Boston, MA 02111-1307, USA. }
{ }
{ *************************************************************************** }
unit uXPStartMenu;
interface
uses
SysUtils, Types, Classes,
Variants, QTypes, QGraphics,
QControls, QForms, QDialogs,
QStdCtrls, QExtCtrls, uXPPNG,
uXPImageList, uCommon, Qt,
uXPMenu, uGraphics;
type
TXPTransPanel=class(TPanel)
private
procedure updateBackground; virtual;
procedure SetParent(const Value: TWidgetControl); override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
public
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
end;
TXPStartMenuOption=class(TXPTransPanel)
private
FImageList: TXPImageList;
FImageIndex: integer;
FCaption: string;
FOverImageIndex: integer;
FOver:boolean;
FAutoSize: boolean;
FImageAlignment: TAlignment;
FChildMenu: TXPMenu;
procedure SetImageList(const Value: TXPImageList);
procedure SetImageIndex(const Value: integer);
procedure updateBackground; override;
procedure SetCaption(const Value: string);
procedure SetOverImageIndex(const Value: integer);
procedure SetAutoSize(const Value: boolean);
procedure SetImageAlignment(const Value: TAlignment);
procedure SetChildMenu(const Value: TXPMenu);
public
procedure mouseenter(AControl:TControl);override;
procedure mouseleave(AControl:TControl);override;
procedure showMenu(const inmediate:boolean);
procedure click;override;
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
published
property ImageList: TXPImageList read FImageList write SetImageList;
property ImageIndex: integer read FImageIndex write SetImageIndex;
property OverImageIndex: integer read FOverImageIndex write SetOverImageIndex;
property Caption: string read FCaption write SetCaption;
property AutoSize: boolean read FAutoSize write SetAutoSize;
property ImageAlignment: TAlignment read FImageAlignment write SetImageAlignment;
property ChildMenu: TXPMenu read FChildMenu write SetChildMenu;
end;
TStartMenu = class(TForm)
startMenuContainer: TPanel;
userPane: TPanel;
logoffPane: TPanel;
leftPanel: TPanel;
placesList: TPanel;
moreProg: TPanel;
progList: TPanel;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
FProgramsMenu: TXPMenu;
FInit: boolean;
FUserPaneBackground: TBitmap;
FPlacesListBackground: TBitmap;
FLogoffBackground: TBitmap;
FMFU: TBitmap;
FMorePrograms: TBitmap;
FSeparator: TBitmap;
FImageList: TXPImageList;
FShutDown: TXPStartMenuOption;
FMyDocuments: TXPStartMenuOption;
FMyRecentDocuments: TXPStartMenuOption;
FMyPictures: TXPStartMenuOption;
FMyMusic: TXPStartMenuOption;
FMyComputer: TXPStartMenuOption;
FMyHome: TXPStartMenuOption;
FControlPanel: TXPStartMenuOption;
FPrinters: TXPStartMenuOption;
FHelp: TXPStartMenuOption;
FSearch: TXPStartMenuOption;
FRun: TXPStartMenuOption;
FInternet: TXPStartMenuOption;
FEmail: TXPStartMenuOption;
FMFU1: TXPStartMenuOption;
FMFU2: TXPStartMenuOption;
FMFU3: TXPStartMenuOption;
FMFU4: TXPStartMenuOption;
FMFU5: TXPStartMenuOption;
FAllPrograms: TXPStartMenuOption;
FOpenedMenu: TXPMenu;
procedure createBitmaps;
procedure createProgramsMenu;
procedure destroyProgramsMenu;
procedure destroyBitmaps;
procedure init;
public
FLogOff: TXPStartMenuOption;
{ Public declarations }
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
procedure shutdownclick(sender:TObject);
procedure logoffclick(sender:TObject);
procedure addSeparator(AParent:TWidgetControl);
procedure commonClick(sender:TObject);
end;
var
StartMenu: TStartMenu=nil;
iUserTile: integer;
iShutDown: integer;
iShutDown_over: integer;
iLogoff: integer;
iLogoff_over: integer;
iMyDocuments: integer;
iMyRecentDocuments: integer;
iMyPictures: integer;
iMyMusic: integer;
iMyComputer: integer;
iMyHome: integer;
iControlPanel: integer;
iPrinters: integer;
iHelp: integer;
iSearch: integer;
iRun: integer;
iInternet: integer;
iEmail: integer;
iMFU1: integer;
iMFU2: integer;
iMFU3: integer;
iMFU4: integer;
iMFU5: integer;
iAllProgs: integer;
resourcestring
sLogOff='Log Off';
sShutDown='Shut Down';
sMyDocuments='My Documents';
sMyRecentDocuments='My Recent Documents';
sMyPictures='My Pictures';
sMyMusic='My Music';
sMyComputer='My Computer';
sMyHome='My Home';
sControlPanel='Control Panel';
sPrinters='Printers and Faxes';
sHelp='Help and Support';
sSearch='Search';
sRun='Run...';
sInternet='Internet';
sEmail='E-mail';
sMFU1='Gimp';
sMFU2='AIM';
sMFU3='Command Line';
sMFU4='Calculator';
sMFU5='Notepad';
sAllProgs='All programs';
function getStartMenu:TStartMenu;
implementation
uses main, uWindowManager, uWMConsts, uTaskbar;
{$R *.xfm}
function getStartMenu:TStartMenu;
begin
if (assigned(startMenu)) then result:=startmenu
else begin
startMenu:=TStartMenu.create(application);
result:=startMenu;
end;
end;
{ TStartMenu }
constructor TStartMenu.Create(AOwner: TComponent);
var
st: string;
begin
inherited;
XPWindowManager.bypasswindow(QWidget_winId(self.handle));
FOpenedMenu:=nil;
FInit:=false;
FShutDown:=TXPStartMenuOption.create(nil);
FMyDocuments:=TXPStartMenuOption.create(nil);
FMyRecentDocuments:=TXPStartMenuOption.create(nil);
FMyPictures:=TXPStartMenuOption.create(nil);
FMyMusic:=TXPStartMenuOption.create(nil);
FMyComputer:=TXPStartMenuOption.create(nil);
FMyHome:=TXPStartMenuOption.create(nil);
FControlPanel:=TXPStartMenuOption.create(nil);
FPrinters:=TXPStartMenuOption.create(nil);
FHelp:=TXPStartMenuOption.create(nil);
FSearch:=TXPStartMenuOption.create(nil);
FRun:=TXPStartMenuOption.create(nil);
FLogOff:=TXPStartMenuOption.create(nil);
FInternet:=TXPStartMenuOption.create(nil);
FEmail:=TXPStartMenuOption.create(nil);
FMFU1:=TXPStartMenuOption.create(nil);
FMFU2:=TXPStartMenuOption.create(nil);
FMFU3:=TXPStartMenuOption.create(nil);
FMFU4:=TXPStartMenuOption.create(nil);
FMFU5:=TXPStartMenuOption.create(nil);
FAllPrograms:=TXPStartMenuOption.create(nil);
createBitmaps;
createProgramsMenu;
st:=getSystemInfo(XP_START_MENU_THEME_DIR);
FUserPaneBackground.LoadFromFile(st+'/startmenu_user_panel.png');
FPlacesListBackground.LoadFromFile(st+'/startmenu_places.png');
FLogoffBackground.LoadFromFile(st+'/startmenu_logoff.png');
FMFU.LoadFromFile(st+'/startmenu_mfu.png');
FMorePrograms.LoadFromFile(st+'/startmenu_programs.png');
FSeparator.LoadFromFile(st+'/startmenu_separator.png');
iUserTile:=FImageList.add(st+'/user_tile.png');
iShutDown:=FImageList.add(st+'/startmenu_turnoff_normal.png');
iShutDown_over:=FImageList.add(st+'/startmenu_turnoff_over.png');
iLogoff:=FImageList.add(st+'/startmenu_logoff_normal.png');
iLogoff_over:=FImageList.add(st+'/startmenu_logoff_over.png');
iMyDocuments:=FImageList.add('mydocuments.png');
iMyRecentDocuments:=FImageList.add('myrecentdocuments.png');
iMyPictures:=FImageList.add('mypictures.png');
iMyMusic:=FImageList.add('mymusic.png');
iMyComputer:=FImageList.add('mycomputer.png');
iMyHome:=FImageList.add('myhome.png');
iControlPanel:=FImageList.add('controlpanel.png');
iPrinters:=FImageList.add('printers.png');
iHelp:=FImageList.add('help.png');
iSearch:=FImageList.add('search.png');
iRun:=FImageList.add('run.png');
iAllProgs:=FImageList.add('menu_right.png');
FImageList.DefaultSystemDir:=XP_NORMAL_SIZE_ICON_DIR;
iInternet:=FImageList.add('browser.png');
iEmail:=FImageList.add('email.png');
iMFU1:=FImageList.add('gimp.png');
iMFU2:=FImageList.add('aim.png');
iMFU3:=FImageList.add('command_line.png');
iMFU4:=FImageList.add('calc.png');
iMFU5:=FImageList.add('notepad.png');
end;
procedure TStartMenu.createBitmaps;
begin
FUserPaneBackground:=TBitmap.create;
FPlacesListBackground:=TBitmap.create;
FLogoffBackground:=TBitmap.create;
FMFU:=TBitmap.create;
FMorePrograms:=TBitmap.create;
FSeparator:=TBitmap.create;
FImageList:=TXPImageList.create(nil);
FImageList.DefaultSystemDir:=XP_MEDIUM_SIZE_ICON_DIR;
end;
destructor TStartMenu.Destroy;
begin
FShutDown.free;
FMyDocuments.free;
FMyRecentDocuments.free;
FMyPictures.free;
FMyMusic.free;
FMyComputer.free;
FMyHome.free;
FControlPanel.free;
FPrinters.free;
FHelp.free;
FSearch.free;
FRun.free;
FInternet.free;
FEmail.free;
FMFU1.free;
FMFU2.free;
FMFU3.free;
FMFU4.free;
FMFU5.free;
FAllPrograms.free;
FLogOff.free;
destroyProgramsMenu;
destroyBitmaps;
inherited;
end;
procedure TStartMenu.destroyBitmaps;
begin
FImageList.free;
FSeparator.free;
FMFU.free;
FMorePrograms.free;
FLogoffBackground.free;
FPlacesListBackground.free;
FUserPaneBackground.free;
end;
procedure TStartMenu.FormShow(Sender: TObject);
begin
if not FInit then init;
end;
procedure TStartMenu.init;
const
u_x=64;
u_y=20;
f_size=16;
f_style=[fsBold];
m_size=11;
m_height=32;
p_height=44;
var
ax: integer;
begin
FInit:=true;
userPane.Height:=64;
leftPanel.Width:=191;
placesList.width:=189;
logoffPane.height:=38;
ResizeBitmap(FUserPaneBackground,userPane.Bitmap,userPane.Width,userPane.height);
FImageList.Background:=userPane.bitmap;
FImageList.Draw(userPane.Bitmap.Canvas,3,3,iUserTile);
userPane.Bitmap.canvas.Font.Size:=f_size;
userPane.Bitmap.canvas.Font.style:=f_style;
userPane.Bitmap.canvas.Font.color:=clGray;
userPane.Bitmap.Canvas.TextOut(u_x+1,u_y+1,getSystemInfo(XP_CURRENT_USER_REAL_NAME));
userPane.Bitmap.canvas.Font.color:=clWhite;
userPane.Bitmap.Canvas.TextOut(u_x,u_y,getSystemInfo(XP_CURRENT_USER_REAL_NAME));
ResizeBitmap(FPlacesListBackground,placesList.Bitmap,placesList.Width,placesList.height,2);
ResizeBitmap(FLogoffBackground,logoffpane.Bitmap,logoffpane.Width,logoffpane.height,2);
FShutDown.Align:=alRight;
FShutDown.ImageList:=FImageList;
FShutDown.ImageIndex:=iShutDown;
FShutDown.OverImageIndex:=iShutDown_over;
FShutDown.Caption:=sShutDown;
FShutDown.parent:=logoffPane;
FShutDown.OnClick:=shutdownclick;
FLogOff.Align:=alRight;
FLogOff.ImageList:=FImageList;
FLogOff.ImageIndex:=iLogoff;
FLogOff.OverImageIndex:=iLogoff_over;
FLogOff.Caption:=sLogoff;
FLogOff.parent:=logoffPane;
FLogOff.width:=5;
FLogOff.OnClick:=logoffclick;
FRun.Align:=alTop;
FRun.AutoSize:=False;
FRun.height:=m_height;
FRun.ImageList:=FImageList;
FRun.ImageIndex:=iRun;
FRun.OverImageIndex:=iRun;
FRun.Font.size:=m_size;
FRun.OnClick:=commonClick;
FRun.Caption:=sRun;
FRun.parent:=placesList;
FSearch.Align:=alTop;
FSearch.AutoSize:=False;
FSearch.height:=m_height;
FSearch.ImageList:=FImageList;
FSearch.ImageIndex:=iSearch;
FSearch.OverImageIndex:=iSearch;
FSearch.Font.size:=m_size;
FSearch.OnClick:=commonClick;
FSearch.Caption:=sSearch;
FSearch.parent:=placesList;
FHelp.Align:=alTop;
FHelp.AutoSize:=False;
FHelp.height:=m_height;
FHelp.ImageList:=FImageList;
FHelp.ImageIndex:=iHelp;
FHelp.OverImageIndex:=iHelp;
FHelp.OnClick:=commonClick;
FHelp.Font.size:=m_size;
FHelp.Caption:=sHelp;
FHelp.parent:=placesList;
addSeparator(placesList);
FPrinters.Align:=alTop;
FPrinters.AutoSize:=False;
FPrinters.height:=m_height;
FPrinters.ImageList:=FImageList;
FPrinters.ImageIndex:=iPrinters;
FPrinters.OverImageIndex:=iPrinters;
FPrinters.Font.size:=m_size;
FPrinters.Caption:=sPrinters;
FPrinters.OnClick:=commonClick;
FPrinters.parent:=placesList;
FControlPanel.Align:=alTop;
FControlPanel.AutoSize:=False;
FControlPanel.height:=m_height;
FControlPanel.ImageList:=FImageList;
FControlPanel.ImageIndex:=iControlPanel;
FControlPanel.OverImageIndex:=iControlPanel;
FControlPanel.Font.size:=m_size;
FControlPanel.OnClick:=commonClick;
FControlPanel.Caption:=sControlPanel;
FControlPanel.parent:=placesList;
addSeparator(placesList);
FMyHome.Align:=alTop;
FMyHome.AutoSize:=False;
FMyHome.height:=m_height;
FMyHome.ImageList:=FImageList;
FMyHome.ImageIndex:=iMyHome;
FMyHome.OverImageIndex:=iMyHome;
FMyHome.Font.Style:=f_style;
FMyHome.Font.size:=m_size;
FMyHome.OnClick:=commonClick;
FMyHome.Caption:=sMyHome;
FMyHome.parent:=placesList;
FMyComputer.Align:=alTop;
FMyComputer.AutoSize:=False;
FMyComputer.height:=m_height;
FMyComputer.ImageList:=FImageList;
FMyComputer.ImageIndex:=iMyComputer;
FMyComputer.OverImageIndex:=iMyComputer;
FMyComputer.Font.Style:=f_style;
FMyComputer.Font.size:=m_size;
FMyComputer.OnClick:=commonClick;
FMyComputer.Caption:=sMyComputer;
FMyComputer.parent:=placesList;
FMyMusic.Align:=alTop;
FMyMusic.AutoSize:=False;
FMyMusic.height:=m_height;
FMyMusic.ImageList:=FImageList;
FMyMusic.ImageIndex:=iMyMusic;
FMyMusic.OverImageIndex:=iMyMusic;
FMyMusic.Font.Style:=f_style;
FMyMusic.Font.size:=m_size;
FMyMusic.OnClick:=commonClick;
FMyMusic.Caption:=sMyMusic;
FMyMusic.parent:=placesList;
FMyPictures.Align:=alTop;
FMyPictures.AutoSize:=False;
FMyPictures.height:=m_height;
FMyPictures.ImageList:=FImageList;
FMyPictures.ImageIndex:=iMyPictures;
FMyPictures.OverImageIndex:=iMyPictures;
FMyPictures.Font.Style:=f_style;
FMyPictures.Font.size:=m_size;
FMyPictures.OnClick:=commonClick;
FMyPictures.Caption:=sMyPictures;
FMyPictures.parent:=placesList;
FMyRecentDocuments.Align:=alTop;
FMyRecentDocuments.AutoSize:=False;
FMyRecentDocuments.height:=m_height;
FMyRecentDocuments.ImageList:=FImageList;
FMyRecentDocuments.ImageIndex:=iMyRecentDocuments;
FMyRecentDocuments.OverImageIndex:=iMyRecentDocuments;
FMyRecentDocuments.Font.Style:=f_style;
FMyRecentDocuments.Font.size:=m_size;
FMyRecentDocuments.OnClick:=commonClick;
FMyRecentDocuments.Caption:=sMyRecentDocuments;
FMyRecentDocuments.parent:=placesList;
FMyDocuments.Align:=alTop;
FMyDocuments.AutoSize:=False;
FMyDocuments.height:=m_height;
FMyDocuments.ImageList:=FImageList;
FMyDocuments.ImageIndex:=iMyDocuments;
FMyDocuments.OverImageIndex:=iMyDocuments;
FMyDocuments.Font.Style:=f_style;
FMyDocuments.Font.size:=m_size;
FMyDocuments.OnClick:=commonClick;
FMyDocuments.Caption:=sMyDocuments;
FMyDocuments.parent:=placesList;
ResizeBitmap(FMFU,progList.Bitmap,progList.Width,progList.height,2);
ResizeBitmap(FMorePrograms,moreProg.Bitmap,moreProg.Width,moreProg.height,2);
FMFU5.Align:=alTop;
FMFU5.AutoSize:=False;
FMFU5.height:=p_height;
FMFU5.ImageList:=FImageList;
FMFU5.ImageIndex:=iMFU5;
FMFU5.OverImageIndex:=iMFU5;
FMFU5.Font.size:=m_size;
FMFU5.Caption:=sMFU5;
FMFU5.OnClick:=commonClick;
FMFU5.parent:=progList;
FMFU4.Align:=alTop;
FMFU4.AutoSize:=False;
FMFU4.height:=p_height;
FMFU4.ImageList:=FImageList;
FMFU4.ImageIndex:=iMFU4;
FMFU4.OverImageIndex:=iMFU4;
FMFU4.Font.size:=m_size;
FMFU4.Caption:=sMFU4;
FMFU4.OnClick:=commonClick;
FMFU4.parent:=progList;
FMFU3.Align:=alTop;
FMFU3.AutoSize:=False;
FMFU3.height:=p_height;
FMFU3.ImageList:=FImageList;
FMFU3.ImageIndex:=iMFU3;
FMFU3.OverImageIndex:=iMFU3;
FMFU3.Font.size:=m_size;
FMFU3.Caption:=sMFU3;
FMFU3.OnClick:=commonClick;
FMFU3.parent:=progList;
FMFU2.Align:=alTop;
FMFU2.AutoSize:=False;
FMFU2.height:=p_height;
FMFU2.ImageList:=FImageList;
FMFU2.ImageIndex:=iMFU2;
FMFU2.OverImageIndex:=iMFU2;
FMFU2.Font.size:=m_size;
FMFU2.Caption:=sMFU2;
FMFU2.OnClick:=commonClick;
FMFU2.parent:=progList;
FMFU1.Align:=alTop;
FMFU1.AutoSize:=False;
FMFU1.height:=p_height;
FMFU1.ImageList:=FImageList;
FMFU1.ImageIndex:=iMFU1;
FMFU1.OverImageIndex:=iMFU1;
FMFU1.Font.size:=m_size;
FMFU1.Caption:=sMFU1;
FMFU1.OnClick:=commonClick;
FMFU1.parent:=progList;
addSeparator(proglist);
FEmail.Align:=alTop;
FEmail.AutoSize:=False;
FEmail.height:=p_height;
FEmail.ImageList:=FImageList;
FEmail.ImageIndex:=iEmail;
FEmail.OverImageIndex:=iEmail;
FEmail.Font.size:=m_size;
FEmail.Font.style:=f_style;
FEmail.Caption:=sEmail;
FEmail.OnClick:=commonClick;
FEmail.parent:=progList;
FInternet.Align:=alTop;
FInternet.AutoSize:=False;
FInternet.height:=p_height;
FInternet.ImageList:=FImageList;
FInternet.ImageIndex:=iInternet;
FInternet.OverImageIndex:=iInternet;
FInternet.Font.size:=m_size;
FInternet.Font.style:=f_style;
FInternet.Caption:=sInternet;
FInternet.OnClick:=commonClick;
FInternet.parent:=progList;
FAllPrograms.Align:=alTop;
FAllPrograms.AutoSize:=False;
FAllPrograms.height:=p_height;
FAllPrograms.ImageList:=FImageList;
FAllPrograms.ImageAlignment:=taRightJustify;
FAllPrograms.Alignment:=taCenter;
FAllPrograms.ImageIndex:=iAllProgs;
FAllPrograms.OverImageIndex:=iAllProgs;
FAllPrograms.Font.size:=m_size;
FAllPrograms.Font.style:=f_style;
FAllPrograms.Caption:=sAllProgs;
FAllPrograms.OnClick:=commonClick;
FAllPrograms.ChildMenu:=FProgramsMenu;
FAllPrograms.parent:=moreProg;
addSeparator(moreProg);
end;
procedure TStartMenu.FormClose(Sender: TObject; var Action: TCloseAction);
begin
taskbar.ataskbar.startButton.release;
if assigned(fopenedmenu) then fopenedmenu.closepopup(true);
end;
procedure TStartMenu.logoffclick(sender: TObject);
begin
application.terminate;
end;
procedure TStartMenu.shutdownclick(sender: TObject);
begin
application.terminate;
end;
procedure TStartMenu.addSeparator(AParent: TWidgetControl);
var
sep: TPanel;
begin
sep:=TPanel.create(self);
sep.BevelOuter:=bvNone;
sep.Align:=alTop;
sep.Bitmap.assign(FSeparator);
sep.height:=sep.bitmap.height;
sep.parent:=AParent;
ResizeBitmap(FSeparator,sep.Bitmap,sep.Width,sep.height,0);
end;
procedure TStartMenu.commonClick(sender: TObject);
begin
close;
end;
procedure TStartMenu.createProgramsMenu;
begin
FProgramsMenu:=TXPMenu.create(nil);
FProgramsMenu.Directory:=getSystemInfo(XP_START_MENU_PROGRAMS_DIR);
end;
procedure TStartMenu.destroyProgramsMenu;
begin
FProgramsMenu.free;
end;
{ TXPTransPanel }
constructor TXPTransPanel.Create(AOwner: TComponent);
begin
inherited;
Alignment:=taLeftJustify;
BevelOuter:=bvNone;
end;
destructor TXPTransPanel.Destroy;
begin
inherited;
end;
procedure TXPTransPanel.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
begin
inherited;
updatebackground;
end;
procedure TXPTransPanel.SetParent(const Value: TWidgetControl);
begin
inherited;
updatebackground;
if (not (csDestroying in ComponentState)) then begin
XPWindowManager.bypasswindow(QWidget_winId(self.handle));
end;
end;
procedure TXPTransPanel.updateBackground;
var
sourcecanvas: TCanvas;
begin
if (not (csDestroying in componentstate)) then begin
if assigned(parent) then begin
if (parent is TPanel) then begin
bitmap.Width:=self.width;
bitmap.height:=self.height;
sourcecanvas:=(parent as TPanel).bitmap.canvas;
bitmap.Canvas.CopyRect(clientrect,sourcecanvas,boundsrect);
end;
end;
end;
end;
{ TXPStartMenuOption }
procedure TXPStartMenuOption.click;
begin
if (assigned(FChildMenu)) then begin
showmenu(true);
end
else inherited;
end;
constructor TXPStartMenuOption.Create(AOwner: TComponent);
begin
inherited;
FChildMenu:=nil;
FImageAlignment:=taLeftJustify;
FAutosize:=true;
FCaption:='';
FImageList:=nil;
FImageIndex:=-1;
FOverImageIndex:=-1;
end;
destructor TXPStartMenuOption.Destroy;
begin
inherited;
end;
procedure TXPStartMenuOption.mouseenter(AControl: TControl);
begin
inherited;
if assigned(getStartMenu.FOpenedMenu) then begin
getStartMenu.FOpenedMenu.closepopup(false);
end;
fover:=true;
updatebackground;
showMenu(false);
end;
procedure TXPStartMenuOption.mouseleave(AControl: TControl);
begin
inherited;
fover:=false;
updatebackground;
if assigned(FChildMenu) then FChildMenu.closepopup(false);
end;
procedure TXPStartMenuOption.SetAutoSize(const Value: boolean);
begin
if (FAutosize<>Value) then begin
FAutoSize := Value;
updateBackground;
end;
end;
procedure TXPStartMenuOption.SetCaption(const Value: string);
begin
if (Value<>FCaption) then begin
FCaption := Value;
updateBackground;
end;
end;
procedure TXPStartMenuOption.SetChildMenu(const Value: TXPMenu);
begin
FChildMenu := Value;
end;
procedure TXPStartMenuOption.SetImageAlignment(const Value: TAlignment);
begin
if (Value<>FImageAlignment) then begin
FImageAlignment := Value;
end;
end;
procedure TXPStartMenuOption.SetImageIndex(const Value: integer);
begin
if (value<>FImageIndex) then begin
FImageIndex := Value;
updateBackground;
end;
end;
procedure TXPStartMenuOption.SetImageList(const Value: TXPImageList);
begin
if (value<>FImageList) then begin
FImageList := Value;
updateBackground;
end;
end;
procedure TXPStartMenuOption.SetOverImageIndex(const Value: integer);
begin
if Value<>FOverImageIndex then begin
FOverImageIndex := Value;
end;
end;
procedure TXPStartMenuOption.showMenu(const inmediate: boolean);
var
p: TPoint;
begin
if (assigned(FChildMenu)) then begin
p.x:=BoundsRect.right;
p.y:=boundsrect.bottom;
p:=parent.ClientToScreen(p);
{ TODO : add a property to choose the popupmenu orientation }
p.y:=p.y-FChildMenu.height-6;
p.x:=p.x-6;
FChildMenu.popup(p.x,p.y, inmediate);
getStartMenu.FOpenedMenu:=FChildMenu;
end;
end;
procedure TXPStartMenuOption.updateBackground;
var
sRect: TRect;
oldBack: TBitmap;
tx, ty: integer;
ix: integer;
gy: integer;
begin
if (FAutoSize) then begin
if (not (csDestroying in componentstate)) then begin
if assigned(parent) then begin
if (parent is TPanel) then begin
if (assigned(FImageList)) then begin
if (FImageIndex<>-1) and (FOverImageIndex<>-1) then begin
width:=canvas.TextWidth(FCaption)+40;
end;
end;
end;
end;
end;
end;
inherited;
if (not (csDestroying in componentstate)) then begin
if assigned(parent) then begin
if (parent is TPanel) then begin
tx:=0;
if (assigned(FImageList)) then begin
if (FImageIndex<>-1) and (FOverImageIndex<>-1) then begin
oldBack:=FImageList.Background;
try
FImageList.Background:=self.bitmap;
if fover then begin
if (FImageAlignment=taLeftJustify) then ix:=4
else if (FImageAlignment=taRightJustify) then begin
ix:=width-FImageList.getbitmapwidth(FOverImageIndex)-4;
end;
sRect:=clientRect;
sRect.left:=sRect.left+1;
sRect.top:=sRect.top+4;
sRect.bottom:=sRect.bottom-4;
sRect.right:=sRect.right-2;
bitmap.Canvas.brush.color:=clHighLight;
bitmap.Canvas.pen.color:=clHighLight;
bitmap.Canvas.Rectangle(sRect);
gy:=(height-FImageList.getbitmapheight(FOverImageIndex)) div 2;
FImageList.Draw(bitmap.canvas,ix,gy,FOverImageIndex,false,0,false);
tx:=FImageList.getbitmapwidth(FOverImageIndex)+8;
end
else begin
if (FImageAlignment=taLeftJustify) then ix:=4
else if (FImageAlignment=taRightJustify) then begin
ix:=width-FImageList.getbitmapwidth(FImageIndex)-4;
end;
gy:=(height-FImageList.getbitmapheight(FImageIndex)) div 2;
FImageList.Draw(bitmap.canvas,ix,gy,FImageIndex,false,0,false);
tx:=FImageList.getbitmapwidth(FImageIndex)+8;
end;
finally
FImageList.Background:=oldBack;
end;
end
else tx:=32;
end;
if (Alignment=taCenter) then begin
tx:=(width-bitmap.canvas.TextWidth(FCaption)) div 2;
end;
ty:=(height - bitmap.canvas.textheight(FCaption)) div 2;
bitmap.canvas.Font.assign(self.font);
bitmap.Canvas.Font.Color:=clWhite;
bitmap.canvas.TextOut(tx,ty,FCaption);
end;
end;
end;
end;
end.
|
unit SQLAccess;
interface
Uses SchObject, ZClasses, ZDbcIntfs, ZCompatibility, ZDbcMySql,
Windows, SysUtils, TransferFields, Classes, GenUtils;
Type
TConnectSpec = record
sHost : String;
wPort : Word;
sUser : String;
sPassword : String;
sDBName : String;
end;
TSchSQLAccess = class( TSchObject )
private
fConnection : IZConnection;
fBusy : Boolean;
fError : Boolean;
fAccBy : Integer;
public
constructor Create();
{ Connection related methods }
function Connect( Conn : TConnectSpec ) : Boolean;
procedure Disconnect();
procedure Accquire( iBy : Integer );
procedure Release();
function AccquiredBy() : Integer;
procedure ExecuteUpdate( cList : TSchGenericEntry; sTable, sWhere : String );
function ExecuteSQLQuery ( sQuery : String; bIsUpdate : Boolean ) : TSchGenericEntryList;
procedure ExecuteSQLModify ( TableName, ValueName : String; EqualsTo : Integer; Entry : TSchGenericEntry );
function WasError() : Boolean;
end;
Var
SQL : TSchSQLAccess;
Locks : TStrings;
implementation
{ TSchSQLAccess }
procedure TSchSQLAccess.Accquire( iBy : Integer );
begin
while fBusy do Sleep( 10 );
fBusy := True;
fAccBy := iBy;
end;
function TSchSQLAccess.AccquiredBy: Integer;
begin
Result := fAccBy;
end;
function TSchSQLAccess.Connect( Conn : TConnectSpec ) : Boolean;
var
Url: string;
begin
// Generating connection URL from the ConnectionSpec received from outside
// and start the connection.
Result := True;
if Conn.wPort <> 0 then
Url := Format( 'zdbc:%s://%s:%d/%s?UID=%s;PWD=%s',
[ 'mysql', Conn.sHost, Conn.wPort, Conn.sDBName, Conn.sUser, Conn.sPassword ] ) else
Url := Format('zdbc:%s://%s/%s?UID=%s;PWD=%s',
[ 'mysql', Conn.sHost, Conn.sDBName, Conn.sUser, Conn.sPassword]);
try
fConnection := DriverManager.GetConnectionWithParams( Url, nil );
fConnection.SetAutoCommit(True);
fConnection.SetTransactionIsolation( tiReadCommitted );
fConnection.Open;
except
on Exception do Result := False;
end;
end;
constructor TSchSQLAccess.Create;
begin
fConnection := nil;
fBusy := False;
fError := False;
fAccBy := 0;
end;
procedure TSchSQLAccess.Disconnect;
begin
if not fConnection.IsClosed then
fConnection.Close;
end;
procedure TSchSQLAccess.ExecuteSQLModify(TableName, ValueName : String;
EqualsTo: Integer; Entry: TSchGenericEntry);
var
Statement : IZStatement;
i, u : Integer;
StrUp : WideString;
Str : String;
Bytes : TByteDynArray;
ResultSet : IZResultSet;
begin
if not Assigned( fConnection ) then
begin
fError := True;
Exit;
end;
if fConnection.IsClosed then
begin
fError := True;
Exit;
end;
Statement := fConnection.CreateStatement;
Statement.SetResultSetConcurrency( rcUpdatable );
if EqualsTo = 0 then
ResultSet := Statement.ExecuteQuery( 'SELECT * FROM ' + TableName ) else
ResultSet := Statement.ExecuteQuery( 'SELECT * FROM ' + TableName + ' WHERE ' + ValueName + ' = ' + IntToStr( EqualsTo ) );
if ResultSet = nil then Exit; // Exit for NIL
if (EqualsTo = 0) then
ResultSet.InsertRow() else // Add a Line !
ResultSet.Last;
for i := 0 to Entry.Count - 1 do
begin
if Entry.Items[i].isString then
ResultSet.UpdateStringByName( Entry.Items[i].FieldName, Entry.Items[i].asString );
if Entry.Items[i].isInteger then
ResultSet.UpdateIntByName( Entry.Items[i].FieldName, Entry.Items[i].asInteger );
if Entry.Items[i].isDate then
if Entry.Items[i].asDate = 0 then
ResultSet.UpdateNullByName( Entry.Items[i].FieldName ) else
ResultSet.UpdateDateByName( Entry.Items[i].FieldName, Entry.Items[i].asDate );
end;
ResultSet.UpdateRow();
if Assigned( Statement ) then Statement.Close();
if Assigned( ResultSet ) then ResultSet.Close();
end;
function TSchSQLAccess.ExecuteSQLQuery(sQuery: String;bIsUpdate: Boolean): TSchGenericEntryList;
Var
Statement : IZStatement;
i : Integer;
ResultSet : IZResultSet;
Ent : TSchGenericEntry;
Fld : TSchGenericField;
begin
Result := nil;
if (not Assigned( fConnection )) then
begin
fError := True;
Exit;
end;
if fConnection.IsClosed then
begin
fError := True;
Exit;
end;
Statement := fConnection.CreateStatement;
Statement.SetResultSetConcurrency( rcReadOnly );
if bIsUpdate then
begin
Statement.ExecuteUpdate( sQuery );
Statement.Close();
Exit;
end;
ResultSet := Statement.ExecuteQuery( sQuery );
if ResultSet <> nil then
begin
Result := TSchGenericEntryList.Create();
while ResultSet.Next do
begin
Ent := TSchGenericEntry.Create();
for I := 1 to ResultSet.GetMetadata.GetColumnCount do
begin
Fld := TSchGenericField.Create();
Fld.FieldName := ResultSet.GetMetadata.GetColumnName( I );
case ResultSet.GetMetadata.GetColumnType(I) of
stBoolean : Fld.asInteger := Integer( ResultSet.GetBoolean(I) );
stByte, stShort, stInteger, stLong
: Fld.asInteger := ResultSet.GetInt(I);
stDate : Fld.asDate := ResultSet.GetDate(I);
stTimeStamp : Fld.asDate := ResultSet.GetTimeStamp(I);
stAsciiStream,
stUnicodeStream :
Fld.asString := ResultSet.GetBlob(I).GetString();
else
Fld.asString := ResultSet.GetString(I);
end;
if ( ResultSet.IsNull(I) ) and
(( ResultSet.GetMetadata.GetColumnType(I) = stDate ) or
( ResultSet.GetMetadata.GetColumnType(I) = stTimeStamp ))
then Fld.asDate := 0;
Ent.Add( Fld );
end;
Result.Add( Ent );
end;
end;
if Assigned( Statement ) then Statement.Close();
if Assigned( ResultSet ) then ResultSet.Close();
end;
procedure TSchSQLAccess.ExecuteUpdate(cList: TSchGenericEntry; sTable, sWhere: String);
begin
if cList.Count <> 1 then Exit;
if cList.Items[0].isInteger then
ExecuteSQLQuery( 'UPDATE '+sTable+' SET '+cList.Items[0].FieldName+' = '+IntToStr( cList.Items[0].asInteger )+
' WHERE '+ sWhere, True);
end;
procedure TSchSQLAccess.Release;
begin
fBusy := False;
end;
function TSchSQLAccess.WasError: Boolean;
begin
Result := fError;
fError := False;
end;
initialization
SQL := TSchSQLAccess.Create();
Locks := TStringList.Create;
finalization
Locks.Destroy();
end.
|
{
Chess Engine licensed under public domain obtained from:
http://www.csbruce.com/~csbruce/chess/
}
unit mod_kcchess;
{$mode objfpc}
interface
uses
Classes, SysUtils,
StdCtrls, Forms, Controls, Spin,
chessgame, chessmodules, chessdrawer;
const HIGH = 52; WIDE = 52; SINGLE_IMAGE_SIZE = 1500;
BOARD_SIZE = 8; ROW_NAMES = '12345678'; COL_NAMES = 'ABCDEFGH';
BOARD_X1 = 19; BOARD_Y1 = 4; BOARD_X2 = 434; BOARD_Y2 = 419;
INSTR_LINE = 450; MESSAGE_X = 460;
NULL_MOVE = -1; STALE_SCORE = -1000;
MOVE_LIST_LEN = 300; GAME_MOVE_LEN = 500;
MAX_LOOKAHEAD = 9; PLUNGE_DEPTH = -1; NON_DEV_MOVE_LIMIT = 50;
{*** pixel rows to print various messages in the conversation area ***}
MSG_MOVE = 399; MSG_BOXX1 = 464; MSG_BOXX2 = 635; MSG_MIDX = 550;
MSG_WHITE = 165; MSG_BLACK = 54; MSG_MOVENUM = 358; MSG_PLHI = 90;
MSG_TURN = 375; MSG_SCAN = 416; MSG_CHI = 17; MSG_HINT = 416;
MSG_CONV = 40; MSG_WARN50 = 277; MSG_TIME_LIMIT = 258;
MSG_SCORE = 318; MSG_POS_EVAL = 344; MSG_ENEMY_SCORE = 331;
type PieceImageType = (BLANK, PAWN, BISHOP, KNIGHT, ROOK, QUEEN, KING);
PieceColorType = (C_WHITE, C_BLACK);
{*** the color of the actual square ***}
SquareColorType = (S_LIGHT, S_DARK, S_CURSOR);
{*** which instructions to print at bottom of screen ***}
InstructionType = (INS_MAIN, INS_GAME, INS_SETUP, INS_PLAYER, INS_SETUP_COLOR,
INS_SETUP_MOVED, INS_SETUP_MOVENUM, INS_FILE, INS_FILE_INPUT,
INS_WATCH, INS_GOTO, INS_OPTIONS, INS_PAWN_PROMOTE);
{*** there is a two-thick border of 'dead squares' around the main board ***}
RowColType = -1..10;
{*** Turbo Pascal requires that parameter string be declared like this ***}
string2 = string[2];
string10 = string[10];
string80 = string[80];
{*** memory for a 52*52 pixel image ***}
SingleImageType = array [1..SINGLE_IMAGE_SIZE] of byte;
{*** images must be allocated on the heap because the stack is not large enough ***}
ImageTypePt = ^ImageType;
ImageType = array [PieceImageType, PieceColorType, SquareColorType] of SingleImageType;
{*** text file records for help mode ***}
HelpPageType = array [1..22] of string80;
{*** directions to scan when looking for all possible moves of a piece ***}
PossibleMovesType = array [PieceImageType] of record
NumDirections : 1..8;
MaxDistance : 1..7;
UnitMove : array [1..8] of record
DirRow, DirCol: -2..2;
end;
end;
{*** attributes for a piece or board square ***}
PieceType = record
image : PieceImageType;
color : PieceColorType;
HasMoved : boolean;
ValidSquare : boolean;
end;
BoardType = array [RowColType, RowColType] of PieceType;
{*** representation of the movement of a piece, or 'ply' ***}
MoveType = record
FromRow, FromCol, ToRow, ToCol : RowColType;
PieceMoved : PieceType;
PieceTaken : PieceType;
{*** image after movement - used for pawn promotion ***}
MovedImage : PieceImageType;
end;
{*** string of moves - used to store list of all possible moves ***}
MoveListType = record
NumMoves : 0..MOVE_LIST_LEN;
Move : array [1..MOVE_LIST_LEN] of MoveType;
end;
{*** attributes of both players ***}
PlayerType = array [PieceColorType] of record
Name : string[20];
IsHuman : boolean;
LookAhead : 0..MAX_LOOKAHEAD;
PosEval : boolean; {*** Position Evaluation On / Off ***}
ElapsedTime : LongInt;
LastMove : MoveType;
InCheck : boolean;
KingRow, KingCol : RowColType;
CursorRow, CursorCol : RowColType;
end;
{*** attributes to represent an entire game ***}
GameType = record
MovesStored : 0..GAME_MOVE_LEN; {*** number of moves stored ***}
MovesPointer : 0..GAME_MOVE_LEN; {*** move currently displayed - for Takeback, UnTakeback ***}
MoveNum : 1..GAME_MOVE_LEN; {*** current move or 'ply' number ***}
Player : PlayerType;
Move : array [1..GAME_MOVE_LEN] of MoveType;
InCheck : array [0..GAME_MOVE_LEN] of boolean; {*** if player to move is in check ***}
FinalBoard : BoardType;
GameFinished : boolean;
TimeOutWhite, TimeOutBlack : boolean; {*** reasons for a game... ***}
Stalemate, NoStorage : boolean; {*** being finished ***}
NonDevMoveCount : array [0..GAME_MOVE_LEN] of byte; {*** since pawn push or take - Stalemate-50 ***}
EnPassentAllowed : boolean;
SoundFlag : boolean;
FlashCount : integer;
WatchDelay : integer;
TimeLimit : longint;
end;
{*** global variables ***}
var Game : GameType;
Board : BoardType; {*** current board setup ***}
Player : PlayerType; {*** current player attributes ***}
CapturePoints : array [PieceImageType] of integer; {*** for taking enemy piece ***}
EnemyColor : array [PieceColorType] of PieceColorType; {*** opposite of given color ***}
PossibleMoves : PossibleMovesType;
LastTime : longint; {*** last read system time-of-day clock value ***}
DefaultFileName : string80; {*** for loading and saving games ***}
ImageStore : ImageTypePt;
GraphDriver, GraphMode : integer; {*** for Turbo Pascal graphics ***}
type
TKCChessThread = class;
{ TKCChessModule }
TKCChessModule = class(TChessModule)
private
textDifficulty: TStaticText;
spinDifficulty: TSpinEdit;
PlayerColor, ComputerColor: PieceColorType;
KCChessThread: TKCChessThread;
class function FPChessPieceToKCChessImage(APos: TPoint): PieceImageType;
class function FPChessPieceToKCChessColor(APos: TPoint): PieceColorType;
public
constructor Create(); override;
procedure CreateUserInterface(); override;
procedure ShowUserInterface(AParent: TWinControl); override;
procedure HideUserInterface(); override;
procedure FreeUserInterface(); override;
procedure PrepareForGame(); override;
function GetSecondPlayerName(): ansistring; override;
procedure HandleOnMove(AFrom, ATo: TPoint); override;
end;
{ TKCChessThread }
TKCChessThread = class(TThread)
protected
procedure Execute; override;
public
AFrom, ATo: TPoint;
PlayerColor, ComputerColor: PieceColorType;
end;
{ INIT.PAS }
procedure InitPossibleMoves;
procedure StartupInitialize;
{ MOVES.PAS }
procedure AttackedBy (row, col : RowColType; var Attacked, _Protected : integer);
procedure GenMoveList (Turn : PieceColorType; var Movelist : MoveListType);
procedure MakeMove (Movement : MoveType; PermanentMove : boolean; var Score : integer);
procedure UnMakeMove (var Movement: Movetype);
procedure TrimChecks (Turn : PieceColorType; var MoveList : MoveListType);
procedure RandomizeMoveList (var MoveList : MoveListType);
procedure GotoMove (GivenMoveTo : integer);
{ SETUP.PAS }
procedure DefaultBoardSetPieces;
procedure DefaultBoard;
//procedure SetupBoard;
{ PLAY.PAS }
procedure GetComputerMove (Turn : PieceColorType; Display : boolean;
var HiMovement : MoveType; var Escape : boolean);
// procedure GetHumanMove (Turn : PieceColorType; var Movement : MoveType;
// var Escape : boolean);
// procedure GetPlayerMove (var Movement : MoveType; var Escape : boolean);
// procedure PlayGame;
// procedure CheckFinishStatus;
// procedure CheckHumanPawnPromotion (var Movement : MoveType);
implementation
{.$define KCCHESS_VERBOSE}
{*** include files ***}
//{$I MISC.PAS} {*** miscellaneous functions ***}
{$I INIT.PAS} {*** initialization of global variables ***}
//{$I DISPLAY.PAS} {*** display-oriented routines ***}
//{$I INPUT.PAS} {*** keyboard input routines ***}
{$I MOVES.PAS} {*** move generation and making routines ***}
{$I SETUP.PAS} {*** default board and custom setup routines ***}
{$I PLAY.PAS} {*** computer thinking and player input routines ***}
//{$I MENU.PAS} {*** main menu routines ***}
{ TKCChessThread }
procedure TKCChessThread.Execute;
var
UserMovement, AIMovement: MoveType;
Escape: boolean;
Score: Integer;
lMoved: Boolean;
lAnimation: TChessMoveAnimation;
begin
// initialization
Escape := False;
Score := 0;
{ First write the movement of the user }
UserMovement.FromRow := AFrom.Y;
UserMovement.FromCol := AFrom.X;
UserMovement.ToRow := ATo.Y;
UserMovement.ToCol := ATo.X;
UserMovement.PieceMoved.image := TKCChessModule.FPChessPieceToKCChessImage(ATo);
UserMovement.PieceMoved.color := PlayerColor;
// HasMoved : boolean;
// ValidSquare : boolean;
UserMovement.PieceTaken.image := BLANK;
UserMovement.PieceTaken.color := ComputerColor;
// HasMoved : boolean;
// ValidSquare : boolean;
UserMovement.MovedImage := BLANK;
MakeMove(UserMovement, True, Score);
{ Now get the computer move }
GetComputerMove(ComputerColor, False, AIMovement, Escape);
MakeMove(AIMovement, True, Score);
{ And write it to our board }
lAnimation := TChessMoveAnimation.Create;
lAnimation.AFrom := Point(AIMovement.FromCol, AIMovement.FromRow);
lAnimation.ATo := Point(AIMovement.ToCol, AIMovement.ToRow);
vChessDrawer.AddAnimation(lAnimation);
{ lMoved := vChessGame.MovePiece(
Point(AIMovement.FromCol, AIMovement.FromRow),
Point(AIMovement.ToCol, AIMovement.ToRow));
if not lMoved then raise Exception.Create(Format('Moving failed from %s to %s',
[vChessGame.BoardPosToChessCoords(AFrom), vChessGame.BoardPosToChessCoords(ATo)]));}
end;
{ TKCChessModule }
class function TKCChessModule.FPChessPieceToKCChessImage(APos: TPoint): PieceImageType;
begin
case vChessGame.Board[APos.X][APos.Y] of
ctEmpty: Result := BLANK;
ctWPawn, ctBPawn: Result := PAWN;
ctWKnight, ctBKnight: Result := KNIGHT;
ctWBishop, ctBBishop: Result := BISHOP;
ctWRook, ctBRook: Result := ROOK;
ctWQueen, ctBQueen: Result := QUEEN;
ctWKing, ctBKing: Result := KING;
end;
end;
class function TKCChessModule.FPChessPieceToKCChessColor(APos: TPoint): PieceColorType;
begin
case vChessGame.Board[APos.X][APos.Y] of
ctEmpty, ctWPawn, ctWKnight, ctWBishop, ctWRook, ctWQueen, ctWKing: Result := C_WHITE;
ctBPawn, ctBKnight, ctBBishop, ctBRook, ctBQueen, ctBKing: Result := C_BLACK;
end;
end;
constructor TKCChessModule.Create;
begin
inherited Create;
Name := 'mod_kcchess.pas';
SelectionDescription := 'Play against the computer - KCChess Engine';
PlayingDescription := 'Playing against the computer - KCChess Engine';
Kind := cmkAgainstComputer;
end;
procedure TKCChessModule.CreateUserInterface;
begin
textDifficulty := TStaticText.Create(nil);
textDifficulty.SetBounds(10, 10, 180, 50);
textDifficulty.Caption := 'Difficulty (3=easiest, 9=hardest and slowest)';
spinDifficulty := TSpinEdit.Create(nil);
spinDifficulty.SetBounds(200, 20, 50, 50);
spinDifficulty.Value := 6;
spinDifficulty.MinValue := 3;
spinDifficulty.MaxValue := 9;
end;
procedure TKCChessModule.ShowUserInterface(AParent: TWinControl);
begin
textDifficulty.Parent := AParent;
spinDifficulty.Parent := AParent;
end;
procedure TKCChessModule.HideUserInterface();
begin
textDifficulty.Parent := nil;
spinDifficulty.Parent := nil;
end;
procedure TKCChessModule.FreeUserInterface();
begin
textDifficulty.Free;
spinDifficulty.Free;
end;
procedure TKCChessModule.PrepareForGame;
begin
StartupInitialize();
DefaultBoard();
Game.GameFinished := false;
if vChessGame.FirstPlayerIsWhite then
begin
ComputerColor := C_BLACK;
PlayerColor := C_WHITE;
end
else
begin
ComputerColor := C_WHITE;
PlayerColor := C_BLACK;
end;
Player[ComputerColor].LookAhead := spinDifficulty.Value;
if ComputerColor = C_WHITE then
begin
KCChessThread := TKCChessThread.Create(True);
KCChessThread.FreeOnTerminate := True;
KCChessThread.PlayerColor := PlayerColor;
KCChessThread.ComputerColor := ComputerColor;
KCChessThread.Resume();
end;
end;
function TKCChessModule.GetSecondPlayerName: ansistring;
begin
Result := 'KCChess Engine';
end;
procedure TKCChessModule.HandleOnMove(AFrom, ATo: TPoint);
begin
KCChessThread := TKCChessThread.Create(True);
KCChessThread.FreeOnTerminate := True;
KCChessThread.AFrom := AFrom;
KCChessThread.ATo := ATo;
KCChessThread.PlayerColor := PlayerColor;
KCChessThread.ComputerColor := ComputerColor;
KCChessThread.Resume();
end;
initialization
RegisterChessModule(TKCChessModule.Create);
end.
|
unit SettingsUnit;
interface
type
TEndPoints = record
const Main = 'https://www.route4me.com';
const ShowRoute = Main + '/route4me.php';
const Optimization = Main + '/api.v4/optimization_problem.php';
const Route = Main + '/api.v4/route.php';
const ResequenceRoute = Main + '/api.v3/route/reoptimize_2.php';
const ShareRoute = Main + '/actions/route/share_route.php';
const MergeRouteEndPoint = Main + '/actions/merge_routes.php';
const SetGps = Main + '/track/set.php';
const Authenticate = Main + '/actions/authenticate.php';
const GetUsers = Main + '/api/member/view_users.php';
const UserLicense = Main + '/api/member/user_license.php';
const RegisterAccount = Main + '/actions/register_action.php';
const Users = Main + '/api.v4/user.php';
const Vehicles = Main + '/api/vehicles/view_vehicles.php';
const VerifyDeviceLicense = Main + '/api/device/verify_device_license.php';
const RegisterWebinar = Main + '/actions/webinar_register.php';
const ValidateSession = Main + '/datafeed/session/validate_session.php';
const AddRouteNotes = Main + '/actions/addRouteNotes.php';
const ActivityFeed = Main + '/api.v4/activity_feed.php';
const GetActivities = Main + '/api/get_activities.php';
const Geocoding = Main + '/api/geocoder.php';
const BulkGeocoding = Main + '/actions/upload/json-geocode.php';
const GetAddress = Main + '/api.v4/address.php';
const DuplicateRoute = Main + '/actions/duplicate_route.php';
const MoveRouteDestination = Main + '/actions/route/move_route_destination.php';
const AddressBook = Main + '/api.v4/address_book.php';
const Address = Main + '/api.v4/address.php';
const MarkAddressAsVisited = Main + '/actions/address/update_address_visited.php';
const MarkAddressAsDeparted = Main + '/api/route/mark_address_departed.php';
const Avoidance = Main + '/api.v4/avoidance.php';
const Order = Main + '/api.v4/order.php';
const Territory = Main + '/api.v4/territory.php';
const GetDeviceLocation = Main + '/api/track/get_device_location.php';
const TrackingStatus = Main + '/api.v4/status.php';
const ConfigurationSettings = Main + '/api.v4/configuration-settings.php';
const FileUploading = Main + '/actions/upload/upload.php';
const CsvXlsGeocode = Main + '/actions/upload/csv-xls-geocode.php';
const CsvXlsPreview = Main + '/actions/upload/csv-xls-preview.php';
const RapidAddressSearch = 'https://rapid.route4me.com/street_data';
const TelematicsGateway = 'https://telematics.route4me.com/api/vendors.php';
end;
/// <summary>
/// Route4Me infrastructure settings
/// Api version 4 hosts constants
/// </summary>
TSettings = record
public
const ApiVersion = '4';
/// <summary>
/// Default timeout - 30 minutes
/// </summary>
const DefaultTimeOutMinutes = 30;
class var EndPoints: TEndPoints;
end;
implementation
end.
|
{******************************************************************************}
{ }
{ Library: Fundamentals TLS }
{ File name: flcTLSTests.pas }
{ File version: 5.05 }
{ Description: TLS tests }
{ }
{ Copyright: Copyright (c) 2008-2020, David J Butler }
{ All rights reserved. }
{ Redistribution and use in source and binary forms, with }
{ or without modification, are permitted provided that }
{ the following conditions are met: }
{ Redistributions of source code must retain the above }
{ copyright notice, this list of conditions and the }
{ following disclaimer. }
{ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND }
{ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED }
{ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED }
{ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A }
{ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL }
{ THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, }
{ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR }
{ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, }
{ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF }
{ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) }
{ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER }
{ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING }
{ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE }
{ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE }
{ POSSIBILITY OF SUCH DAMAGE. }
{ }
{ Github: https://github.com/fundamentalslib }
{ E-mail: fundamentals.library at gmail.com }
{ }
{ Revision history: }
{ }
{ 2008/01/18 0.01 Initial development. }
{ 2010/12/15 0.02 Client/Server test case. }
{ 2010/12/17 0.03 Client/Server test cases for TLS 1.0, 1.1 and 1.2. }
{ 2018/07/17 5.04 Revised for Fundamentals 5. }
{ 2020/05/11 5.05 Use client options. }
{ }
{ References: }
{ }
{ SSL 3 - www.mozilla.org/projects/security/pki/nss/ssl/draft302.txt }
{ RFC 2246 - The TLS Protocol Version 1.0 }
{ RFC 4346 - The TLS Protocol Version 1.1 }
{ RFC 5246 - The TLS Protocol Version 1.2 }
{ RFC 4366 - Transport Layer Security (TLS) Extensions }
{ www.mozilla.org/projects/security/pki/nss/ssl/traces/trc-clnt-ex.html }
{ RFC 4492 - Elliptic Curve Cryptography (ECC) Cipher Suites }
{ }
{ See TLS 1.3: }
{ http://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art080 }
{******************************************************************************}
// ----------------------------------------------------- -------------------------------------------
// CIPHER SUITE ClientServer Test
// ----------------------------------------------------- -------------------------------------------
// RSA_WITH_RC4_128_MD5 TESTED OK
// RSA_WITH_RC4_128_SHA TESTED OK
// RSA_WITH_DES_CBC_SHA TESTED OK
// RSA_WITH_AES_128_CBC_SHA TESTED OK
// RSA_WITH_AES_256_CBC_SHA TESTED OK
// RSA_WITH_AES_128_CBC_SHA256 TESTED OK TLS 1.2 only
// RSA_WITH_AES_256_CBC_SHA256 TESTED OK TLS 1.2 only
// NULL_WITH_NULL_NULL UNTESTED
// RSA_WITH_NULL_MD5 UNTESTED
// RSA_WITH_NULL_SHA UNTESTED
// RSA_WITH_IDEA_CBC_SHA UNTESTED
// RSA_WITH_3DES_EDE_CBC_SHA ERROR: SERVER DECRYPTION FAILED
// RSA_WITH_NULL_SHA256 ERROR
// DHE_RSA_WITH_AES_256_CBC_SHA TESTED OK TLS 1.2
// ----------------------------------------------------- -------------------------------------------
{$INCLUDE flcTLS.inc}
{$DEFINE TLS_TEST_LOG_TO_CONSOLE}
{.DEFINE Cipher_SupportEC}
unit flcTLSTests;
interface
{ }
{ Test }
{ }
{$IFDEF TLS_TEST}
procedure Test;
{$ENDIF}
implementation
uses
{ System }
SysUtils,
SyncObjs,
{ Utils }
flcStdTypes,
flcBase64,
flcStrings,
flcCertificatePEM,
flcTestEncodingASN1,
flcCertificateX509,
flcHugeInt,
{ Cipher }
flcCipherAES,
flcCipherRSA,
flcCipherDH,
{$IFDEF Cipher_SupportEC}
flcCipherEllipticCurve,
{$ENDIF}
{ TLS }
flcTLSConsts,
flcTLSProtocolVersion,
flcTLSRecord,
flcTLSAlert,
flcTLSAlgorithmTypes,
flcTLSRandom,
flcTLSCertificate,
flcTLSHandshake,
flcTLSCipher,
flcTLSPRF,
flcTLSKeys,
flcTLSTransportTypes,
flcTLSTransportConnection,
flcTLSTransportClient,
flcTLSTransportServer,
flcTLSTestCertificates;
{ }
{ Test }
{ }
{$IFDEF TLS_TEST}
type
TTLSClientServerTester = class
Lock : TCriticalSection;
Sr : TTLSServer;
Cl : TTLSClient;
SCl : TTLSServerClient;
constructor Create;
destructor Destroy; override;
procedure ServerTLSendProc(Server: TTLSServer; Client: TTLSServerClient; const Buffer; const Size: Integer);
procedure ClientTLSendProc(const Sender: TTLSConnection; const Buffer; const Size: Integer);
procedure Log(Msg: String);
procedure ClientLog(Sender: TTLSConnection; LogType: TTLSLogType; LogMsg: String; LogLevel: Integer);
procedure ServerLog(Sender: TTLSServer; LogType: TTLSLogType; LogMsg: String; LogLevel: Integer);
end;
constructor TTLSClientServerTester.Create;
begin
inherited Create;
Lock := TCriticalSection.Create;
Sr := TTLSServer.Create(ServerTLSendProc);
Sr.OnLog := ServerLog;
Cl := TTLSClient.Create(ClientTLSendProc);
Cl.OnLog := ClientLog;
end;
destructor TTLSClientServerTester.Destroy;
begin
FreeAndNil(Cl);
FreeAndNil(Sr);
FreeAndNil(Lock);
inherited Destroy;
end;
procedure TTLSClientServerTester.ServerTLSendProc(Server: TTLSServer; Client: TTLSServerClient; const Buffer; const Size: Integer);
begin
Assert(Assigned(Cl));
Cl.ProcessTransportLayerReceivedData(Buffer, Size);
end;
procedure TTLSClientServerTester.ClientTLSendProc(const Sender: TTLSConnection; const Buffer; const Size: Integer);
begin
Assert(Assigned(SCl));
SCl.ProcessTransportLayerReceivedData(Buffer, Size);
end;
{$IFDEF TLS_TEST_LOG_TO_CONSOLE}
procedure TTLSClientServerTester.Log(Msg: String);
var S : String;
begin
S := FormatDateTime('hh:nn:ss.zzz', Now) + ' ' + Msg;
Lock.Acquire;
try
Writeln(S);
finally
Lock.Release;
end;
end;
{$ELSE}
procedure TTLSClientServerTester.Log(Msg: String);
begin
end;
{$ENDIF}
procedure TTLSClientServerTester.ClientLog(Sender: TTLSConnection; LogType: TTLSLogType; LogMsg: String; LogLevel: Integer);
begin
Log(IntToStr(LogLevel) + ' C:' + LogMsg);
end;
procedure TTLSClientServerTester.ServerLog(Sender: TTLSServer; LogType: TTLSLogType; LogMsg: String; LogLevel: Integer);
begin
Log(IntToStr(LogLevel) + ' S:' + LogMsg);
end;
procedure TestClientServer(
const ClientOptions : TTLSClientOptions = [];
const VersionOptions : TTLSVersionOptions = DefaultTLSClientVersionOptions;
const KeyExchangeOptions : TTLSKeyExchangeOptions = DefaultTLSClientKeyExchangeOptions;
const CipherOptions : TTLSCipherOptions = DefaultTLSClientCipherOptions;
const HashOptions : TTLSHashOptions = DefaultTLSClientHashOptions
);
const
LargeBlockSize = TLS_PLAINTEXT_FRAGMENT_MAXSIZE * 8;
var CS : TTLSClientServerTester;
CtL : TTLSCertificateList;
S : RawByteString;
I, L : Integer;
begin
CS := TTLSClientServerTester.Create;
try
// initialise client
CS.Cl.ClientOptions := ClientOptions;
// initialise server
CS.Sr.PrivateKeyRSAPEM := RSA_STunnel_PrivateKeyRSAPEM;
TLSCertificateListAppend(CtL,
MIMEBase64Decode(RSA_STunnel_CertificatePEM));
CS.Sr.CertificateList := CtL;
CS.Sr.DHKeySize := 512;
// start server
CS.Sr.Start;
Assert(CS.Sr.State = tlssActive);
// start connection
CS.SCl := CS.Sr.AddClient(nil);
CS.SCl.Start;
CS.Cl.Start;
// negotiated
Assert(CS.Cl.IsReadyState);
Assert(CS.SCl.IsReadyState);
// application data (small block)
S := 'Fundamentals';
CS.Cl.Write(S[1], Length(S));
Assert(CS.SCl.AvailableToRead = 12);
S := '1234567890';
Assert(CS.SCl.Read(S[1], 3) = 3);
Assert(CS.SCl.AvailableToRead = 9);
Assert(S = 'Fun4567890');
Assert(CS.SCl.Read(S[1], 9) = 9);
Assert(CS.SCl.AvailableToRead = 0);
Assert(S = 'damentals0');
S := 'Fundamentals';
CS.SCl.Write(S[1], Length(S));
Assert(CS.Cl.AvailableToRead = 12);
S := '123456789012';
Assert(CS.Cl.Read(S[1], 12) = 12);
Assert(CS.Cl.AvailableToRead = 0);
Assert(S = 'Fundamentals');
// application data (large blocks)
for L := LargeBlockSize - 1 to LargeBlockSize + 1 do
begin
SetLength(S, L);
FillChar(S[1], L, #1);
CS.Cl.Write(S[1], L);
Assert(CS.SCl.AvailableToRead = L);
FillChar(S[1], L, #0);
CS.SCl.Read(S[1], L);
for I := 1 to L do
Assert(S[I] = #1);
Assert(CS.SCl.AvailableToRead = 0);
CS.SCl.Write(S[1], L);
Assert(CS.Cl.AvailableToRead = L);
FillChar(S[1], L, #0);
Assert(CS.Cl.Read(S[1], L) = L);
for I := 1 to L do
Assert(S[I] = #1);
Assert(CS.Cl.AvailableToRead = 0);
end;
// close
CS.Cl.Close;
Assert(CS.Cl.IsFinishedState);
Assert(CS.SCl.IsFinishedState);
// stop
CS.Sr.RemoveClient(CS.SCl);
CS.Sr.Stop;
finally
FreeAndNil(CS);
end;
end;
procedure Test_Units_Dependencies;
begin
flcTestEncodingASN1.Test;
flcHugeInt.Test;
flcCipherAES.Test;
flcCipherRSA.Test;
flcCipherDH.Test;
{$IFDEF Cipher_SupportEC}
flcCipherEllipticCurve.Test;
{$ENDIF}
end;
procedure Test_Units_TLS;
begin
flcTLSAlert.Test;
flcTLSAlgorithmTypes.Test;
flcTLSRandom.Test;
flcTLSCipher.Test;
flcTLSHandshake.Test;
flcTLSKeys.Test;
flcTLSProtocolVersion.Test;
flcTLSPRF.Test;
flcTLSRecord.Test;
end;
procedure Test_ClientServer_TLSVersions;
begin
// TLS 1.2
TestClientServer([], [tlsvoTLS12]);
// TLS 1.1
TestClientServer([], [tlsvoTLS11]);
// TLS 1.0
TestClientServer([], [tlsvoTLS10]);
Sleep(100);
// SSL 3
// Fails with invalid parameter
//SelfTestClientServer([], [tlsvoSSL3]);
end;
procedure Test_ClientServer_KeyExchangeAlgos;
begin
// TLS 1.2 RSA
TestClientServer([], [tlsvoTLS12], [tlskeoRSA]);
// TLS 1.2 DHE_RSA
TestClientServer([], [tlsvoTLS12], [tlskeoDHE_RSA]);
// TLS 1.2 DH_anon
// Under development/testing
//SelfTestClientServer([], [tlsvoTLS12], [tlskeoDH_Anon]);
end;
procedure Test_ClientServer_CipherAlgos;
begin
// TLS 1.2 RC4
TestClientServer([], [tlsvoTLS12], DefaultTLSClientKeyExchangeOptions,
[tlscoRC4]);
// TLS 1.2 AES128
TestClientServer([], [tlsvoTLS12], DefaultTLSClientKeyExchangeOptions,
[tlscoAES128]);
// TLS 1.2 AES256
TestClientServer([], [tlsvoTLS12], DefaultTLSClientKeyExchangeOptions,
[tlscoAES256]);
// TLS 1.2 DES
TestClientServer([], [tlsvoTLS12], DefaultTLSClientKeyExchangeOptions,
[tlscoDES]);
// TLS 1.2 3DES
// No Cipher Suite
{SelfTestClientServer([], [tlsvoTLS12], DefaultTLSClientKeyExchangeOptions,
[tlsco3DES]);}
end;
procedure Test_ClientServer_HashAlgos;
begin
// TLS 1.2 SHA256
TestClientServer(
[], [tlsvoTLS12], DefaultTLSClientKeyExchangeOptions, DefaultTLSClientCipherOptions,
[tlshoSHA256]);
// TLS 1.2 SHA1
TestClientServer(
[], [tlsvoTLS12], DefaultTLSClientKeyExchangeOptions, DefaultTLSClientCipherOptions,
[tlshoSHA1]);
// TLS 1.2 MD5
TestClientServer(
[], [tlsvoTLS12], DefaultTLSClientKeyExchangeOptions, DefaultTLSClientCipherOptions,
[tlshoMD5]);
end;
procedure Test_ClientServer;
begin
Test_ClientServer_TLSVersions;
Test_ClientServer_KeyExchangeAlgos;
Test_ClientServer_CipherAlgos;
Test_ClientServer_HashAlgos;
end;
procedure Test;
begin
Test_Units_Dependencies;
Test_Units_TLS;
Test_ClientServer;
end;
{$ENDIF}
end.
|
unit SpeedBmp;
interface
// Copyright (c) 1996-97 Jorge Romero Gomez, Merchise
// Notes & Tips:
//
// - When using a SpeedBitmap's BufferPalette to perform animations remember to follow these steps:
// 1.- Call SetCanvasPalette( Form.Handle, Buffer.BufferPalette ), saving the returned HPALETTE
// 2.- Call SelectPalette( OldPalette ) to restore the saved palette
// 3.- Before painting the bitmap, be sure to update the color table with
// Buffer.ChangePaletteEntries
uses
Classes, Consts, Windows, Graphics, SysUtils,
MemUtils, Dibs, Gdi, GdiExt, Rects, BitBlt, Palettes, Buffer, CanvasBmp;
// TSpeedBitmap ====================================================================================
type
TSpeedBitmap =
class( TCanvasedBitmap )
private
fMaskHandle : HBITMAP;
fSourceMasked : boolean;
fHandle : HBITMAP;
procedure SetHandle( Value : HBITMAP );
function GetHandle : HBITMAP;
function FreeHandle( NeedHandle : boolean ) : HBITMAP;
function GetMaskHandle : HBITMAP;
function GetPalette : HPALETTE;
procedure SetPalette( Value : HPALETTE );
function GetHandleType: TBitmapHandleType;
protected
procedure HandleNeeded;
procedure MaskHandleNeeded;
procedure CreateBitmap( aWidth, aHeight : integer; aBitCount : integer; aRgbEntries : pointer ); override;
procedure AssignBitmap( Source : TBuffer ); override;
procedure ReleaseImage( aReleasePalette : boolean ); override;
procedure SetNewDib( newHandle : HBITMAP; newHeader : PDib; newDibPixels : pointer;
newPalette : TBufferPalette; ChangeMask : integer ); virtual;
procedure GetRgbEntries( Indx, Count : integer; RgbQuads : pointer ); override;
procedure SetRgbEntries( Indx, Count : integer; RgbQuads : pointer ); override;
public
procedure NewSize( NewWidth, NewHeight : integer; NewBitCount : integer ); override;
procedure Assign( Source : TPersistent ); override;
procedure LoadFromDib( DibHeader : PDib; DibPixels : pointer ); override;
procedure LoadFromStream( Stream : TStream ); override;
procedure Dormant; virtual;
function ReleasePalette : HPALETTE; virtual;
function ReleaseHandle : HBITMAP; virtual;
function GetCanvas : TBufferCanvas; override;
procedure SetTransparent( Value : boolean ); override;
procedure SetTransparentColor( Value : TColor ); override;
function CreateMask( aMaskSource : boolean ) : HBITMAP; virtual;
procedure RestoreSource; virtual;
function ReleaseMaskHandle : HBITMAP; virtual;
procedure ReleaseMask; virtual;
procedure AssignDibSection( DibHandle : HBITMAP; DibHeader : PDib; DibPixels : pointer ); virtual;
procedure Flush; override;
procedure SnapshotDC( dc : HDC; x, y : integer; UseColors : boolean ); override;
procedure StretchSnapshotDC( dc : HDC; const Rect : TRect; UseColors : boolean ); override;
procedure ClipSnapshotDC( dc : HDC; x, y : integer; const ClippingRect : TRect; UseColors : boolean ); override;
procedure ClipStretchSnapshotDC( dc : HDC; const Rect, ClippingRect : TRect; UseColors : boolean ); override;
procedure TileOnDC( dc : HDC; x, y : integer; const ClippingRect : TRect; aCopyMode : dword ); override;
procedure DrawOnDC( dc : HDC; x, y : integer; aCopyMode : dword ); override;
procedure StretchDrawOnDC( dc : HDC; const Rect : TRect; aCopyMode : dword ); override;
procedure ClipDrawOnDC( dc : HDC; x, y : integer; const ClippingRect : TRect; aCopyMode : dword ); override;
procedure ClipStretchDrawOnDC( dc : HDC; const Rect, ClippingRect : TRect; aCopyMode : dword ); override;
procedure DrawTransparent(const dc : HDC; const x, y: integer; const color: TColor); overload;
procedure DrawTransparent(const dc : HDC; const x, y: integer; const ClippingRect: TRect; const color: TColor); overload;
public
property Handle : HBITMAP read GetHandle write SetHandle;
property MaskHandle : HBITMAP read GetMaskHandle;
property HandleType : TBitmapHandleType read GetHandleType;
property Palette : HPALETTE read GetPalette write SetPalette;
end;
type
TSpeedCanvas =
class( TBufferCanvas )
private
fOldBitmap : HBITMAP;
protected
procedure CreateHandle; override;
procedure FreeContext; override;
end;
// Helper Functions --------------------------------------------------
function LoadBitmapFromDib( DibHeader : PDib; DibPixels : pointer ) : TSpeedBitmap;
function LoadBitmapFile( const Filename : string ) : TSpeedBitmap;
function LoadBitmapFromStream( const Stream : TStream ) : TSpeedBitmap;
function LoadBitmapFromResource( Instance : THandle; const ResourceName : string ) : TSpeedBitmap;
function LoadBitmapFromResourceID( Instance : THandle; ResourceId : Integer ) : TSpeedBitmap;
// Buffer Drawing
procedure DrawPieceOnDC( Source : TSpeedBitmap; DestDC : HDC; x, y : integer; ClippingRect : TRect; aCopyMode : dword );
procedure DrawPiece( Source : TSpeedBitmap; DestCanvas : TCanvas; x, y : integer; ClippingRect : TRect );
procedure DrawOnBuffer( Source, Dest : TSpeedBitmap; x, y : integer );
procedure StretchDrawOnBuffer( Source, Dest : TSpeedBitmap; const Rect : TRect );
procedure ClipDrawOnBuffer( Source, Dest : TSpeedBitmap; x, y : integer; const ClippingRect : TRect );
procedure ClipStretchDrawOnBuffer( Source, Dest : TSpeedBitmap; const Rect, ClippingRect : TRect );
// !! function MixTableBitmap( Source : TBufferPalette ) : TSpeedBitmap;
implementation
// TSpeedBitmap
// ============================================================================
procedure TSpeedBitmap.Flush;
begin
GdiFlush;
end;
procedure TSpeedBitmap.ReleaseImage( aReleasePalette : boolean );
begin
fSourceMasked := false;
inherited;
if fHandle <> 0
then
begin
if Shared
then fShared := false // Leave handle alone
else DeleteObject( fHandle ); // Dispose bitmap handle
fHandle := 0;
fDibPixels := nil;
end;
ReleaseMask;
end;
procedure TSpeedBitmap.GetRgbEntries( Indx, Count : integer; RgbQuads : pointer );
var
Entries : PRgbPalette absolute RgbQuads;
begin
GetDibColorTable( Canvas.Handle, Indx, Count, Entries^ );
end;
procedure TSpeedBitmap.SetRgbEntries( Indx, Count : integer; RgbQuads : pointer );
var
Entries : PRgbPalette absolute RgbQuads;
begin
with Canvas do
begin
RequiredState( [csHandleValid] );
SetDibColorTable( CanvasHandle, Indx, Count, Entries^ );
end;
end;
procedure TSpeedBitmap.SetNewDib( newHandle : HBITMAP; newHeader : PDib; newDibPixels : pointer; newPalette : TBufferPalette;
ChangeMask : integer );
begin
ReleaseImage( (ChangeMask and pcmPaletteNotChanged) = 0 );
if newHandle <> 0
then
begin
fHandle := newHandle;
fDibHeader := newHeader;
fDibPixels := newDibPixels;
if ChangeMask and pcmPaletteFromSource <> 0
then fBufferPalette := newPalette;
ParamsChanged( ChangeMask );
if ChangeMask and ( pcmPaletteFromDib or pcmPaletteNotChanged ) = 0
then SyncPalette;
end;
Changed( Self );
end;
procedure TSpeedBitmap.CreateBitmap( aWidth, aHeight : integer; aBitCount : integer; aRgbEntries : pointer );
var
newHandle : HBITMAP;
newHeader : PDib;
newDibPixels : pointer;
pcmask : integer;
begin
if ( RgbEntries <> aRgbEntries )
then pcmask := pcmUseDibPalette // We're changing the palette
else pcmask := pcmPaletteNotChanged; // Source already has the correct palette
if aRgbEntries = nil
then aRgbEntries := dsUseDefaultPalette;
newHandle := DibSectionCreate( aWidth, aHeight, aBitCount, aRgbEntries, newHeader, newDibPixels );
SetNewDib( newHandle, newHeader, newDibPixels, nil, pcmask or pcmSizeChanged );
end;
procedure TSpeedBitmap.AssignBitmap( Source : TBuffer );
begin
with Source do
begin
Self.SetNewDib( fHandle, fDibHeader, fDibPixels, nil, pcmUseDibPalette );
fShared := true;
end;
end;
procedure TSpeedBitmap.Assign( Source : TPersistent );
var
newHandle : HBITMAP;
newHeader : PDib;
newDibPixels : pointer;
begin
if Source is TSpeedBitmap
then
with TSpeedBitmap( Source ) do
try
newHandle := DibSectionFromDib( fDibHeader, fDibPixels, newHeader, newDibPixels );
Self.SetNewDib( newHandle, newHeader, newDibPixels, nil, pcmUseDibPalette );
Self.fTransparentColor := fTransparentColor;
Self.fTransparentIndx := fTransparentIndx;
Self.fTransparentMode := fTransparentMode;
if Assigned( fCanvas )
then Self.Canvas.Assign( Canvas );
if UsesPalette
then Self.BufferPalette.Assign( BufferPalette );
finally
Changed( Self );
end
else
if Source is TBitmap
then
with TBitmap( Source ) do
try
DibSectionFromHandle( Handle, newHeader, newDibPixels );
newHandle := 0; // !!!
Self.SetNewDib( newHandle, newHeader, newDibPixels, nil, pcmUseDibPalette );
Self.TransparentColor := fTransparentColor;
Self.fTransparentMode := fTransparentMode;
if Assigned( fCanvas )
then Self.Canvas.Assign( Canvas );
finally
Changed( Self );
end
else
if Source is TBufferPalette
then
try
SetBufferPalette( TBufferPalette( Source ) )
finally
Changed( Self );
end
else
inherited;
end;
procedure TSpeedBitmap.Dormant;
begin
FreeHandle( false );
end;
procedure TSpeedBitmap.SetTransparentColor( Value : TColor );
begin
if Value <> fTransparentColor
then
begin
ReleaseMask;
inherited;
end;
end;
procedure TSpeedBitmap.SetTransparent( Value : boolean );
begin
if Value <> Transparent
then
begin
ReleaseMask;
inherited;
end;
end;
function TSpeedBitmap.GetMaskHandle : HBITMAP;
begin
if fMaskHandle = 0
then fMaskHandle := CreateMask( false );
Result := fMaskHandle;
end;
procedure TSpeedBitmap.ReleaseMask;
begin
if fMaskHandle <> 0
then
begin
DeleteObject( fMaskHandle );
fMaskHandle := 0;
end;
end;
function TSpeedBitmap.ReleaseMaskHandle : HBITMAP;
begin
Result := MaskHandle;
fMaskHandle := 0;
end;
// Creates a mask bitmap, if MaskSource is true also sets transparent pixels to black
function TSpeedBitmap.CreateMask( aMaskSource : boolean ) : HBITMAP;
var
MaskDC : HDC;
SrcDC : HDC;
SrcBmp : HBITMAP;
OldSrcBmp : HBITMAP;
OldMaskBmp : HBITMAP;
OldBackColor : integer;
begin
Result := Windows.CreateBitmap( Width, Height, 1, 1, nil );
SrcDC := GetDC( 0 );
try
SrcBmp := Windows.CreateCompatibleBitmap( SrcDC, Width, Height );
finally
ReleaseDC( 0, SrcDC );
end;
try
MaskDC := GetBitmapDC( Result, OldMaskBmp );
SrcDC := GetBitmapDC( SrcBmp, OldSrcBmp );
try
with Canvas do // Copy DibSection to a temporal DDB
begin
RequiredState( [csHandleValid] );
Windows.BitBlt( SrcDC, 0, 0, Width, Height, fHandle, 0, 0, SRCCOPY );
SetGdiColors( SrcDC, clWhite, TransparentColor );
Windows.BitBlt( MaskDC, 0, 0, Width, Height, SrcDC, 0, 0, SRCCOPY );
if aMaskSource
then // Make all transparent pixels black
begin
OldBackColor := SetBkColor( fHandle, clBlack );
Windows.BitBlt( fHandle, 0, 0, Width, Height, MaskDC, 0, 0, SRCAND );
SetBkColor( fHandle, OldBackColor );
end;
end;
finally
ReleaseBitmapDC( SrcDC, OldSrcBmp );
ReleaseBitmapDC( MaskDC, OldMaskBmp );
end;
finally
DeleteObject( SrcBmp );
end;
end;
// Restores the blacked pixels to TransparentColor
procedure TSpeedBitmap.RestoreSource;
var
MaskDC : HDC;
OldBitmap : HBITMAP;
OldForeColor : integer;
OldBackColor : integer;
begin
if fMaskHandle <> 0
then
begin
MaskDC := GetBitmapDC( fMaskHandle, OldBitmap );
try
with Canvas do
begin
RequiredState( [csHandleValid] );
SetGdiColorsEx( fHandle, clBlack, TransparentColor, OldForeColor, OldBackColor );
try
Windows.BitBlt( fHandle, 0, 0, Width, Height, MaskDC, 0, 0, SRCPAINT );
finally
SetGdiColors( fHandle, OldForeColor, OldBackColor );
end;
end;
finally
ReleaseBitmapDC( MaskDC, OldBitmap );
end;
end;
end;
procedure TSpeedBitmap.HandleNeeded;
begin
if fHandle <> 0
then GetHandle;
end;
procedure TSpeedBitmap.MaskHandleNeeded;
begin
if fMaskHandle <> 0
then GetMaskHandle;
end;
function TSpeedBitmap.GetHandle : HBITMAP;
begin
if fHandle = 0
then
begin
assert( Assigned( DibHeader ), 'NULL bitmap in Buffer.TSpeedBitmap.GetHandle!!' );
LoadFromDib( DibHeader, ScanLines );
end;
Result := fHandle;
end;
function TSpeedBitmap.FreeHandle( NeedHandle : boolean ) : HBITMAP;
var
Dib : PDib;
begin
if NeedHandle
then Result := GetHandle // Make sure a valid handle is returned
else Result := 0;
assert( ( not NeedHandle ) or ( fHandle <> 0 ), 'Bitmap handle could not be created in Buffer.TSpeedBitmap.FreeHandle!!' );
if fHandle <> 0
then
begin
Dib := DibCopy( DibHeader, ScanLines );
if NeedHandle
then fHandle := 0; // This way fHandle is not freed in ReleaseImage
ReleaseImage( false );
fDibHeader := Dib;
fDibPixels := DibPtr( Dib );
end;
end;
function TSpeedBitmap.ReleaseHandle : HBITMAP;
begin
if Shared // Create a copy of the shared DibSection
then LoadFromDib( DibHeader, ScanLines );
Result := FreeHandle( true );
end;
function TSpeedBitmap.ReleasePalette : HPALETTE;
begin
if UsesPalette
then Result := BufferPalette.ReleaseHandle
else Result := 0;
end;
procedure TSpeedBitmap.NewSize( NewWidth, NewHeight : integer; NewBitCount : integer );
var
BitCountChanged : boolean;
newHandle : HBITMAP;
newHeader : PDib;
newDibPixels : pointer;
tmpDC : HDC;
oldBitmap : HBITMAP;
begin
if (NewWidth > 0) and (NewHeight <> 0) and (NewBitCount > 0)
then
if Empty
then CreateBitmap( NewWidth, NewHeight, NewBitCount, nil )
else
begin
BitCountChanged := NewBitCount <> BitCount;
if BitCountChanged or ( NewWidth <> Width ) or ( NewHeight <> OriginalHeight )
then
begin
if NewBitCount = 1
then fRgbEntries := @rgbMonochromePalette;
newHandle := DibSectionCreate( NewWidth, NewHeight, NewBitCount, fRgbEntries, newHeader, newDibPixels );
// Copy original pixels
tmpDC := CreateCompatibleDC( 0 );
oldBitmap := SelectObject( tmpDC, newHandle );
with Canvas do
if (NewBitCount < BitCount) and (NewBitCount <= 8)
then
begin
SetStretchBltMode( tmpDC, STRETCH_HALFTONE );
SetBrushOrgEx( tmpDC, 0, 0, nil );
Windows.StretchBlt( tmpDC, 0, 0, Width, Height, Handle, 0, 0, Width, Height, CopyMode );
end
else
Windows.BitBlt( tmpDC, 0, 0, Width, Height, Handle, 0, 0, CopyMode );
SelectObject( tmpDC, oldBitmap );
DeleteDC( tmpDC );
if BitCountChanged
then SetNewDib( newHandle, newHeader, newDibPixels, nil, pcmUseDibPalette )
else SetNewDib( newHandle, newHeader, newDibPixels, nil, pcmUseCurrentPalette );
end;
end
else
begin
ReleaseImage( true );
fBitCount := NewBitCount;
fWidth := NewWidth;
fOriginalHeight := NewHeight;
fHeight := abs( fOriginalHeight );
end;
end;
// SnapshotDC methods --------------------
procedure TSpeedBitmap.SnapshotDC( dc : HDC; x, y : integer; UseColors : boolean );
var
hpal : HPALETTE;
begin
assert( Assigned(Canvas) and (not Empty), 'Null HBITMAP in Buffer.TSpeedBitmap.SnapshotDC' );
with Canvas do
begin
RequiredState( [csHandleValid] );
if UseColors and UsesPalette
then
with fDibHeader^ do
begin
hpal := GetPaletteHandle( dc );
try
GetRgbPalette( hpal, 0, biClrUsed, fRgbEntries^ );
finally
DeleteObject( hpal );
end;
ChangePaletteEntries( 0, biClrUsed, fRgbEntries^ );
end;
Windows.BitBlt( CanvasHandle, 0, 0, Width, Height, dc, x, y, CopyMode );
end;
end;
procedure TSpeedBitmap.StretchSnapshotDC( dc : HDC; const Rect : TRect; UseColors : boolean );
var
hpal : HPALETTE;
begin
assert( fHandle <> 0, 'Null HBITMAP in Buffer.TSpeedBitmap.StretchSnapshotDC' );
with Rect, Canvas do
begin
RequiredState( [csHandleValid] );
SetStretchBltMode( dc, StretchBltMode );
if StretchBltMode = STRETCH_HALFTONE
then SetBrushOrgEx( dc, 0, 0, nil );
if UseColors and UsesPalette
then
with fDibHeader^ do
begin
hpal := GetPaletteHandle( dc );
try
GetRgbPalette( hpal, 0, biClrUsed, fRgbEntries^ );
finally
DeleteObject( hpal );
end;
ChangePaletteEntries( 0, biClrUsed, fRgbEntries^ );
end;
Windows.StretchBlt( CanvasHandle, 0, 0, Self.Width, Self.Height,
dc, Left, Top, Right - Left, Bottom - Top, CopyMode );
end;
end;
procedure TSpeedBitmap.ClipSnapshotDC( dc : HDC; x, y : integer; const ClippingRect : TRect; UseColors : boolean );
var
SrcOfs : TPoint;
DstRect : TRect;
DstSize : TPoint;
hpal : HPALETTE;
begin
assert( Assigned(Canvas) and (not Empty), 'Null HBITMAP in Buffer.TSpeedBitmap.SnapshotDC' );
with Canvas do
begin
RequiredState( [csHandleValid] );
if UseColors and UsesPalette
then
with fDibHeader^ do
begin
hpal := GetPaletteHandle( dc );
try
GetRgbPalette( hpal, 0, biClrUsed, fRgbEntries^ );
finally
DeleteObject( hpal );
end;
ChangePaletteEntries( 0, biClrUsed, fRgbEntries^ );
end;
DstRect := RectFromBounds( x, y, Width, Height );
if IntersectRect( DstRect, DstRect, ClippingRect )
then
begin
DstSize := RectSize( DstRect );
if x < DstRect.Left
then SrcOfs.x := DstRect.Left - x
else SrcOfs.x := 0;
if y < DstRect.Top
then SrcOfs.y := DstRect.Top - y
else SrcOfs.y := 0;
Windows.BitBlt( CanvasHandle, SrcOfs.x, SrcOfs.y, DstSize.x, DstSize.y,
dc, DstRect.Left, DstRect.Top, CopyMode );
end;
end;
end;
procedure TSpeedBitmap.ClipStretchSnapshotDC( dc : HDC; const Rect, ClippingRect : TRect; UseColors : boolean );
var
SrcOfs : TPoint;
SrcSize : TPoint;
DstRect : TRect;
DstSize : TPoint;
hpal : HPALETTE;
begin
assert( Assigned(Canvas) and (not Empty), 'Null HBITMAP in Buffer.TSpeedBitmap.StretchSnapshotDC' );
with Rect, Canvas do
begin
RequiredState( [csHandleValid] );
if StretchBltMode = STRETCH_HALFTONE
then SetBrushOrgEx( dc, 0, 0, nil );
SetStretchBltMode( dc, StretchBltMode );
if UseColors and UsesPalette
then
with fDibHeader^ do
begin
hpal := GetPaletteHandle( dc );
try
GetRgbPalette( hpal, 0, biClrUsed, fRgbEntries^ );
finally
DeleteObject( hpal );
end;
ChangePaletteEntries( 0, biClrUsed, fRgbEntries^ );
end;
if IntersectRect( DstRect, ClippingRect, Rect )
then
begin
DstSize := RectSize( DstRect );
if Rect.Left < DstRect.Left
then SrcOfs.x := (DstRect.Left - Rect.Left) * (Rect.Right - Rect.Left) div Width
else SrcOfs.x := 0;
SrcSize.x := DstSize.x * (Rect.Right - Rect.Left) div Width;
if Rect.Top < DstRect.Top
then SrcOfs.y := (DstRect.Top - Rect.Top) * (Rect.Bottom - Rect.Top) div Height
else SrcOfs.y := 0;
SrcSize.y := DstSize.y * (Rect.Bottom - Rect.Top) div Width;
StretchBlt( CanvasHandle, SrcOfs.x, SrcOfs.y, SrcSize.x, SrcSize.y,
dc, DstRect.Left, DstRect.Top, DstSize.x, DstSize.y, CopyMode );
end;
end;
end;
// DrawOnDC methods --------------------
{$WARNINGS OFF}
procedure TSpeedBitmap.DrawOnDC( dc : HDC; x, y : integer; aCopyMode : dword );
var
OldPalette : HPALETTE;
ChgPalette : boolean;
begin
assert( Assigned(Canvas) and (not Empty), 'Null HBITMAP in Buffer.TSpeedBitmap.Draw' );
with Canvas do
begin
ChgPalette := (not IgnorePalette) and UsesPalette;
if ChgPalette
then
begin
OldPalette := SelectPalette( dc, Palette, false );
RealizePalette( dc );
end;
try
RequiredState( [csHandleValid] );
if Transparent
then
if GdiExtAvailable
then TransparentBlt( dc, x, y, Width, Height, CanvasHandle, 0, 0, Width, Height, TransparentColor )
else TransparentStretchBlt( dc, x, y, Width, Height, CanvasHandle, 0, 0, Width, Height, MaskHandle, fSourceMasked )
else Windows.BitBlt( dc, x, y, Width, Height, CanvasHandle, 0, 0, aCopyMode );
finally
if ChgPalette
then SelectPalette( dc, OldPalette, false );
end;
end;
end;
procedure TSpeedBitmap.StretchDrawOnDC( dc : HDC; const Rect : TRect; aCopyMode : dword );
var
OldPalette : HPALETTE;
ChgPalette : boolean;
begin
assert( Assigned(Canvas) and (not Empty), 'Null HBITMAP in Buffer.TSpeedBitmap.StretchDraw' );
with Rect, Canvas do
begin
if StretchBltMode = STRETCH_HALFTONE
then SetBrushOrgEx( dc, 0, 0, nil );
SetStretchBltMode( dc, StretchBltMode );
ChgPalette := (not IgnorePalette) and UsesPalette;
if ChgPalette
then
begin
OldPalette := SelectPalette( dc, Palette, false );
RealizePalette( dc );
end;
try
RequiredState( [csHandleValid] );
if Transparent
then
if GdiExtAvailable
then TransparentBlt( dc, Left, Top, Right - Left, Bottom - Top, CanvasHandle, 0, 0, Width, Height, TransparentColor )
else TransparentStretchBlt( dc, Left, Top, Right - Left, Bottom - Top, CanvasHandle, 0, 0, Width, Height, MaskHandle, fSourceMasked )
else StretchBlt( dc, Left, Top, Right - Left, Bottom - Top, CanvasHandle, 0, 0, Width, Height, aCopyMode );
finally
if ChgPalette
then SelectPalette( dc, OldPalette, false );
end;
end;
end;
procedure TSpeedBitmap.TileOnDC( dc : HDC; x, y : integer; const ClippingRect : TRect; aCopyMode : dword );
var
OldPalette : HPALETTE;
SrcOfs : TPoint;
DstSize : TPoint;
Origin : TPoint;
SaveX : integer;
DstRect : TRect;
ChgPalette : boolean;
begin
assert( Assigned(Canvas) and (not Empty), 'Null HBITMAP in Buffer.TSpeedBitmap.TileOnDC' );
with DstRect, Canvas do
begin
ChgPalette := (not IgnorePalette) and UsesPalette;
if ChgPalette
then
begin
OldPalette := SelectPalette( dc, Palette, false );
RealizePalette( dc );
end;
try
RequiredState( [csHandleValid] );
if x < 0
then SaveX := -( ClippingRect.Left - x mod Width )
else SaveX := ( (x - ClippingRect.Left) div Width ) * Width;
if y < 0
then Origin.y := -( ClippingRect.Top - y mod Height )
else Origin.y := ( (y - ClippingRect.Top) div Height ) * Height;
repeat // Loop rows
Origin.x := SaveX;
repeat // Loop columns
x := Origin.x;
y := Origin.y;
DstRect := RectFromBounds( x, y, Width, Height );
if IntersectRect( DstRect, DstRect, ClippingRect )
then
begin
DstSize := RectSize( DstRect );
if x < DstRect.Left
then
begin
SrcOfs.x := DstRect.Left - x;
x := DstRect.Left;
end
else SrcOfs.x := 0;
if y < DstRect.Top
then
begin
SrcOfs.y := DstRect.Top - y;
y := DstRect.Top;
end
else SrcOfs.y := 0;
Windows.BitBlt( dc, x, y, DstSize.x, DstSize.y, CanvasHandle, SrcOfs.x, SrcOfs.y, aCopyMode );
end;
inc( Origin.x, Width );
until Origin.x > ClippingRect.Right;
inc( Origin.y, Height );
until Origin.y > ClippingRect.Bottom;
finally
if ChgPalette
then SelectPalette( dc, OldPalette, false );
end;
end;
end;
procedure TSpeedBitmap.ClipDrawOnDC( dc : HDC; x, y : integer; const ClippingRect : TRect; aCopyMode : dword );
var
OldPalette : HPALETTE;
SrcOfs : TPoint;
DstSize : TPoint;
DstRect : TRect;
ChgPalette : boolean;
begin
assert( Assigned(Canvas) and (not Empty), 'Null HBITMAP in Buffer.TSpeedBitmap.ClipDrawOnDC' );
with DstRect, Canvas do
begin
ChgPalette := (not IgnorePalette) and UsesPalette;
if ChgPalette
then
begin
OldPalette := SelectPalette( dc, Palette, false );
RealizePalette( dc );
end;
try
DstRect := RectFromBounds( x, y, Width, Height );
if IntersectRect( DstRect, DstRect, ClippingRect )
then
begin
DstSize := RectSize( DstRect );
if x < DstRect.Left
then
begin
SrcOfs.x := DstRect.Left - x;
x := DstRect.Left;
end
else SrcOfs.x := 0;
if y < DstRect.Top
then
begin
SrcOfs.y := DstRect.Top - y;
y := DstRect.Top;
end
else SrcOfs.y := 0;
RequiredState( [csHandleValid] );
if Transparent
then
if GdiExtAvailable
then TransparentBlt( dc, x, y, DstSize.x, DstSize.y, CanvasHandle, SrcOfs.x, SrcOfs.y, DstSize.x, DstSize.y, TransparentColor )
else TransparentStretchBlt( dc, x, y, DstSize.x, DstSize.y, CanvasHandle, SrcOfs.x, SrcOfs.y, DstSize.x, DstSize.y, MaskHandle, fSourceMasked )
else Windows.BitBlt( dc, x, y, DstSize.x, DstSize.y, CanvasHandle, SrcOfs.x, SrcOfs.y, aCopyMode );
end;
finally
if ChgPalette
then SelectPalette( dc, OldPalette, false );
end;
end;
end;
procedure TSpeedBitmap.ClipStretchDrawOnDC( dc : HDC; const Rect, ClippingRect : TRect; aCopyMode : dword );
var
OldPalette : HPALETTE;
ChgPalette : boolean;
SrcOfs : TPoint;
SrcSize : TPoint;
DstRect : TRect;
DstSize : TPoint;
begin
assert( Assigned(Canvas) and (not Empty), 'Null HBITMAP in Buffer.TSpeedBitmap.ClipStretchDrawOnDC' );
with Canvas do
begin
if StretchBltMode = STRETCH_HALFTONE
then SetBrushOrgEx( dc, 0, 0, nil );
SetStretchBltMode( dc, StretchBltMode );
ChgPalette := (not IgnorePalette) and UsesPalette;
if ChgPalette
then
begin
OldPalette := SelectPalette( dc, Palette, false );
RealizePalette( dc );
end;
try
RequiredState( [csHandleValid] );
if IntersectRect( DstRect, ClippingRect, Rect )
then
begin
DstSize := RectSize( DstRect );
if Rect.Left < DstRect.Left
then SrcOfs.x := (DstRect.Left - Rect.Left) * Width div (Rect.Right - Rect.Left)
else SrcOfs.x := 0;
SrcSize.x := DstSize.x * Width div (Rect.Right - Rect.Left);
if Rect.Top < DstRect.Top
then SrcOfs.y := (DstRect.Top - Rect.Top) * Height div (Rect.Bottom - Rect.Top)
else SrcOfs.y := 0;
SrcSize.y := DstSize.y * Height div (Rect.Bottom - Rect.Top);
if Transparent
then
if GdiExtAvailable
then TransparentBlt( dc, DstRect.Left, DstRect.Top, DstSize.x, DstSize.y, CanvasHandle, SrcOfs.x, SrcOfs.y, SrcSize.x, SrcSize.y, TransparentColor )
else TransparentStretchBlt( dc, DstRect.Left, DstRect.Top, DstSize.x, DstSize.y, CanvasHandle, SrcOfs.x, SrcOfs.y, SrcSize.x, SrcSize.y, MaskHandle, fSourceMasked )
else StretchBlt( dc, DstRect.Left, DstRect.Top, DstSize.x, DstSize.y, CanvasHandle, SrcOfs.x, SrcOfs.y, SrcSize.x, SrcSize.y, aCopyMode );
end;
finally
if ChgPalette
then SelectPalette( dc, OldPalette, false );
end;
end;
end;
{$WARNINGS ON}
// Bitmap loading methods -----
procedure TSpeedBitmap.AssignDibSection( DibHandle : HBITMAP; DibHeader : PDib; DibPixels : pointer );
begin
if DibHandle = 0
then ReleaseImage( true )
else
begin
if (DibHeader = nil) or (DibPixels = nil)
then
begin
if Assigned( DibHeader )
then DibFree( DibHeader );
DibSectionFromHandle( DibHandle, DibHeader, DibPixels );
end;
SetNewDib( DibHandle, DibHeader, DibPixels, nil, pcmUseDibPalette );
end;
end;
procedure TSpeedBitmap.LoadFromDib( DibHeader : PDib; DibPixels : pointer );
var
newHandle : HBITMAP;
newHeader : PDib;
newDibPixels : pointer;
begin
if DibPixels = nil
then DibPixels := DibPtr( DibHeader );
newHandle := DibSectionFromDib( DibHeader, DibPixels, newHeader, newDibPixels );
SetNewDib( newHandle, newHeader, newDibPixels, nil, pcmUseDibPalette );
end;
procedure TSpeedBitmap.LoadFromStream( Stream : TStream );
var
newHandle : HBITMAP;
newHeader : PDib;
newDibPixels : pointer;
begin
try
newHandle := DibSectionLoadFromStream( Stream, newHeader, newDibPixels, false );
if newHandle <> 0
then SetNewDib( newHandle, newHeader, newDibPixels, nil, pcmUseDibPalette )
else raise EInvalidGraphic( SInvalidBitmap );
except
ReleaseImage( true );
raise;
end;
end;
// TSpeedBitmap continues...
procedure TSpeedBitmap.SetPalette( Value : HPALETTE );
begin
if not UsesPalette
then fBufferPalette := PaletteClass.CreateFromHandle( Value )
else BufferPalette.Handle := Value;
SyncPalette;
end;
procedure TSpeedBitmap.SetHandle( Value : HBITMAP );
begin
AssignDibSection( Value, nil, nil );
fShared := true;
end;
function TSpeedBitmap.GetPalette : HPALETTE;
begin
if UsesPalette
then Result := BufferPalette.Handle
else Result := 0;
end;
function TSpeedBitmap.GetCanvas : TBufferCanvas;
begin
if not Assigned( fCanvas )
then fCanvas := TSpeedCanvas.Create( Self ); // !!
Result := fCanvas;
end;
// TSpeedCanvas =====================================================================
procedure TSpeedCanvas.FreeContext;
begin
if fHandle <> 0
then
begin
if fOldBitmap <> 0
then SelectObject( fHandle, fOldBitmap );
inherited;
end;
end;
procedure TSpeedCanvas.CreateHandle;
var
dc : HDC;
begin
assert( Assigned( fBitmap ), 'Null fBitmap in Buffer.TSpeedCanvas.CreateHandle!!' );
FreeContext;
dc := CreateCompatibleDC( 0 );
fOldBitmap := SelectObject( dc, TSpeedBitmap( fBitmap ).Handle );
Handle := dc;
BitmapCanvasList.Add( Self );
end;
// Bitmap helper functions ==========================================================
(* // !!
function MixTableBitmap( Source : TBufferPalette ) : TSpeedBitmap;
var
x, y : integer;
c : byte;
begin
Result := TSpeedBitmap.CreateSized( 256, 256, 8 );
Result.Assign( Source );
with Result, Source do
begin
for x := 0 to 255 do
begin
PixelAddr[x, x]^ := MixTable[x, x];
for y := x + 1 to 255 do
begin
c := MixTable[x, y];
with Result do
begin
PixelAddr[x, y]^ := c;
PixelAddr[y, x]^ := c;
end;
end;
end;
end;
end;
*)
// DrawPiece methods --------------------
procedure DrawPieceOnDC( Source : TSpeedBitmap; DestDC : HDC; x, y : integer; ClippingRect : TRect; aCopyMode : dword );
var
NewX, NewY : integer;
begin
with ClippingRect do
begin
NewX := x - Left;
NewY := y - Top;
OffsetRect( ClippingRect, NewX, NewY );
Source.ClipDrawOnDC( DestDC, NewX, NewY, ClippingRect, aCopyMode );
end;
end;
procedure DrawPiece( Source : TSpeedBitmap; DestCanvas : TCanvas; x, y : integer; ClippingRect : TRect );
begin
DrawPieceOnDC( Source, DestCanvas.Handle, x, y, ClippingRect, DestCanvas.CopyMode );
end;
// DrawOnBuffer methods --------------------
procedure DrawOnBuffer( Source, Dest : TSpeedBitmap; x, y : integer );
begin
assert( Assigned(Source.Canvas) and Assigned(Dest.Canvas) and
not (Source.Empty or Dest.Empty), 'Null HBITMAP in Buffer.DrawOnBuffer' );
with Dest.Canvas do
Source.DrawOnDC( Handle, x, y, CopyMode );
end;
procedure StretchDrawOnBuffer( Source, Dest : TSpeedBitmap; const Rect : TRect );
begin
assert( Assigned(Source.Canvas) and Assigned(Dest.Canvas) and
not (Source.Empty or Dest.Empty), 'Null HBITMAP in Buffer.StretchDrawOnBuffer' );
with Dest.Canvas do
Source.StretchDrawOnDC( Handle, Rect, CopyMode );
end;
procedure ClipDrawOnBuffer( Source, Dest : TSpeedBitmap; x, y : integer; const ClippingRect : TRect );
begin
assert( Assigned(Source.Canvas) and Assigned(Dest.Canvas) and
not (Source.Empty or Dest.Empty), 'Null HBITMAP in Buffer.ClipDrawOnBuffer' );
with Dest.Canvas do
Source.ClipDrawOnDC( Handle, x, y, ClippingRect, CopyMode );
end;
procedure ClipStretchDrawOnBuffer( Source, Dest : TSpeedBitmap; const Rect, ClippingRect : TRect );
begin
assert( Assigned(Source.Canvas) and Assigned(Dest.Canvas) and
not (Source.Empty or Dest.Empty), 'Null HBITMAP in Buffer.ClipStretchDrawOnBuffer' );
with Dest.Canvas do
Source.ClipStretchDrawOnDC( Handle, Rect, ClippingRect, CopyMode );
end;
// Loading helper functions
function LoadBitmapFromDib( DibHeader : PDib; DibPixels : pointer ) : TSpeedBitmap;
begin
try
Result := TSpeedBitmap.Create;
Result.LoadFromDib( DibHeader, DibPixels );
except
FreeObject( Result );
end;
end;
function LoadBitmapFromStream( const Stream : TStream ) : TSpeedBitmap;
begin
try
Result := TSpeedBitmap.Create;
Result.LoadFromStream( Stream );
except
FreeObject( Result );
end;
end;
function LoadBitmapFromResource( Instance : THandle; const ResourceName : string ) : TSpeedBitmap;
begin
try
Result := TSpeedBitmap.Create;
Result.LoadFromResourceName( Instance, ResourceName );
except
FreeObject( Result );
end;
end;
function LoadBitmapFromResourceID( Instance : THandle; ResourceId : Integer ) : TSpeedBitmap;
begin
try
Result := TSpeedBitmap.Create;
Result.LoadFromResourceId( Instance, ResourceId );
except
FreeObject( Result );
end;
end;
function LoadBitmapFile( const Filename : string ) : TSpeedBitmap;
begin
try
Result := TSpeedBitmap.Create;
Result.LoadFromFile( Filename );
except
FreeObject( Result );
end;
end;
procedure TSpeedBitmap.DrawTransparent(const dc: HDC; const x, y: integer; const color: TColor);
var
crBack : TColor;
dcImage, dcTrans : HDC;
bitmapTrans, pOldBitmapTrans : HBitmap;
crOldBack, crOldText : TColor;
begin
crOldBack := windows.SetBkColor(dc, clWhite);
crOldText := windows.SetTextColor(dc, clBlack);
// Create two memory dcs for the image and the mask
dcTrans := windows.CreateCompatibleDC(dc);
// Create the mask bitmap
bitmapTrans := windows.CreateBitmap(fWidth, fHeight, 1, 1, nil);
// Select the mask bitmap into the appropriate dc
windows.SelectObject(dcTrans, bitmapTrans);
// Build mask based on transparent colour
windows.SetBkColor(Canvas.Handle, color);
windows.BitBlt(dcTrans, 0, 0, fWidth, fHeight, Canvas.Handle, 0, 0, SRCCOPY);
// Do the work - True Mask method - cool if not actual display
windows.BitBlt(dc, x, y, fWidth, fHeight, Canvas.Handle, 0, 0, SRCINVERT);
windows.BitBlt(dc, x, y, fWidth, fHeight, dcTrans, 0, 0, SRCAND);
windows.BitBlt(dc, x, y, fWidth, fHeight, Canvas.Handle, 0, 0, SRCINVERT);
// Restore settings
windows.SetBkColor(dc, crOldBack);
windows.SetTextColor(dc, crOldText);
windows.DeleteDc(dcTrans);
windows.DeleteObject(bitmapTrans);
end;
procedure TSpeedBitmap.DrawTransparent(const dc: HDC; const x, y: integer; const ClippingRect: TRect; const color: TColor);
var
dcImage, dcTrans : HDC;
bitmapTrans: HBitmap;
Transx,Transy : integer;
crOldBack, crOldText : TColor;
begin
// Create two memory dcs for the image and the mask
dcTrans := windows.CreateCompatibleDC(dc);
crOldBack := windows.SetBkColor(dc, clWhite);
crOldText := windows.SetTextColor(dc, clBlack);
with ClippingRect do
begin
// Create the mask bitmap
Transx := right-left;
Transy := bottom-top;
bitmapTrans := windows.CreateBitmap(Transx, Transy, 1, 1, nil);
// Select the mask bitmap into the appropriate dc
windows.SelectObject(dcTrans, bitmapTrans);
// Build mask based on transparent colour
windows.SetBkColor(Canvas.Handle, color);
windows.BitBlt(dcTrans, 0, 0, Transx, Transy, Canvas.Handle, left, top, SRCCOPY);
// Do the work - True Mask method - cool if not actual display
windows.BitBlt(dc, x, y, Transx, Transy, Canvas.Handle, left, top, SRCINVERT);
windows.BitBlt(dc, x, y, Transx, Transy, dcTrans, 0, 0, SRCAND);
windows.BitBlt(dc, x, y, Transx, Transy, Canvas.Handle, left, top, SRCINVERT);
end;
// Restore settings
windows.SetBkColor(dc, crOldBack);
windows.SetTextColor(dc, crOldText);
windows.DeleteDc(dcTrans);
windows.DeleteObject(bitmapTrans);
end;
function TSpeedBitmap.GetHandleType: TBitmapHandleType;
begin
end;
end.
|
unit K395662507;
{* [Requestlink:395662507] }
// Модуль: "w:\archi\source\projects\Archi\Tests\K395662507.pas"
// Стереотип: "TestCase"
// Элемент модели: "TK395662507" MUID: (505C667503B3)
{$Include w:\archi\source\projects\Archi\arDefine.inc}
interface
{$If Defined(nsTest) AND Defined(InsiderTest)}
uses
l3IntfUses
{$If NOT Defined(NoScripts)}
, ArchiInsiderTest
{$IfEnd} // NOT Defined(NoScripts)
;
type
TK395662507 = class({$If NOT Defined(NoScripts)}
TArchiInsiderTest
{$IfEnd} // NOT Defined(NoScripts)
)
{* [Requestlink:395662507] }
protected
function GetFolder: AnsiString; override;
{* Папка в которую входит тест }
function GetModelElementGUID: AnsiString; override;
{* Идентификатор элемента модели, который описывает тест }
end;//TK395662507
{$IfEnd} // Defined(nsTest) AND Defined(InsiderTest)
implementation
{$If Defined(nsTest) AND Defined(InsiderTest)}
uses
l3ImplUses
, TestFrameWork
//#UC START# *505C667503B3impl_uses*
//#UC END# *505C667503B3impl_uses*
;
{$If NOT Defined(NoScripts)}
function TK395662507.GetFolder: AnsiString;
{* Папка в которую входит тест }
begin
Result := 'SelectionTests';
end;//TK395662507.GetFolder
function TK395662507.GetModelElementGUID: AnsiString;
{* Идентификатор элемента модели, который описывает тест }
begin
Result := '505C667503B3';
end;//TK395662507.GetModelElementGUID
initialization
TestFramework.RegisterTest(TK395662507.Suite);
{$IfEnd} // NOT Defined(NoScripts)
{$IfEnd} // Defined(nsTest) AND Defined(InsiderTest)
end.
|
{
This file is part of the AF UDF library for Firebird 1.0 or high.
Copyright (c) 2007-2009 by Arteev Alexei, OAO Pharmacy Tyumen.
See the file COPYING.TXT, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
email: alarteev@yandex.ru, arteev@pharm-tmn.ru, support@pharm-tmn.ru
**********************************************************************
Library management of objects created in other modules AFUDF
**********************************************************************}
library afcommon;
{$MODE Delphi}
uses
smudfstatic,
{$IfDef DEBUG}
heaptrc,
{$EndIf}
SysUtils,
Classes,
uafudfs in '../common/uafudfs.pas',
ib_util,
ufbblob in '../cmnunits/ufbblob.pas';
{IFDEF WINDOWS}{R afcommon.rc}{ENDIF}
const
sVersion = {$I verafudf.inc};
sVersionEx = {$I verexafudf.inc};
{ Returns the last error code of the operating system for an object }
function GetLastErrorObj(var Handle:PtrUdf):integer;cdecl;
begin
result := 0;
try
Result := TAFObj.FindObj(Handle,taoUnknow).LastError;
except
end;
end;
{ Returns the last error text object }
function MsgLastErrorObj(var Handle:PtrUdf):Pchar;cdecl;
var
s : string;
begin
try
s:=TAFObj.FindObj(Handle,taoUnknow).MessageLastError;
result := ib_util_malloc(Length(s)+1);
strcopy(result,Pchar(s));
except
end;
end;
{ Returns whether there was a mistake at the last operation with the object }
function WasErrorObj(var Handle:PtrUdf):integer;cdecl;
begin
try
result := Integer(TAFObj.FindObj(Handle,taoUnknow).WasError);
except
result := FalseInt;
end;
end;
{ Returns whether an error exception if the last operation with the object }
function WasErrorIsExceptionObj(var Handle:PtrUdf):integer;cdecl;
begin
result := FalseInt;
try
result := Integer(TAFObj.FindObj(Handle,taoUnknow).LastErrorIsException);
except
end;
end;
{ Sets the text of the error object }
function SetMsgErrorExceptionObj(var Handle:PtrUdf;Msg:Pchar):integer;cdecl;
var obj:TAFObj;
begin
result := TrueInt;
try
try
raise exception.Create(string(Msg));
except
on e:Exception do
begin
obj := TAFObj.FindObj(Handle,taoUnknow);
if Assigned(obj) then obj.FixedError(e);
end;
end;
except
end;
end;
{ It frees the memory occupied by objects created by another module }
function FreeAFObject(var Handle:PtrUdf):integer;cdecl;
var
obj:TObject;
vmt:PVmt;
curclass: String;
begin
result := FalseInt;
try
obj := HandleToObj(Handle);
if not Assigned(obj) then exit(FalseInt);
{check class}
Vmt := PVmt(Obj.ClassType);
curclass := vmt^.vClassName^;
if SameText(curclass,'TAFObj') or
SameText(curclass,'TXPathNodeSetVariable') then
begin
Obj.Free;
result := TrueInt;
end
else
result := FalseInt;
except
result := FalseInt;
end;
end;
{ Returns the version of the libraries in the short format 1.0.0 }
function VersionAFUDF():Pchar;cdecl;
begin
result := ib_util_malloc(Length(sVersionEx)+1);
strcopy(result,Pchar(sVersion));
end;
{ Returns the version of the libraries in the long format 1.0.0.build release }
function VersionExAFUDF():PChar;cdecl;
begin
result := ib_util_malloc(Length(sVersionEx)+1);
strcopy(result,Pchar(sVersionEx));
end;
function Version():Pchar;cdecl;
begin
Result := VersionAFUDF();
end;
function VersionEx():PChar;cdecl;
begin
Result := VersionAFUDF;
end;
{ Returns the type of operating system windows / linux and CPU architecture}
function GetTypeOS():Pchar;cdecl;
var
s : string;
begin
s:=
{$IFDEF linux}
'linux'
{$IFDEF CPUX86_64}
+'-x86_64'
{$ELSE}
+'-i386'
{$ENDIF}
{$ENDIF}
{$IFDEF windows}
'win'
{$IFDEF CPUX86_64}
+'64'
{$ELSE}
+'32'
{$ENDIF}
{$ENDIF};
result := ib_util_malloc(Length(s)+1);
StrPCopy(result,s);
end;
exports
GetLastErrorObj,
MsgLastErrorObj,
WasErrorObj,
WasErrorIsExceptionObj,
SetMsgErrorExceptionObj,
FreeAFObject,
VersionAFUDF,
VersionExAFUDF,
GetTypeOS,
{aliases}
Version,
VersionEx;
{$R afcommon.res}
begin
{$IfDef DEBUG}
SetHeapTraceOutput(GetEnvironmentVariable('TEMP')+DirectorySeparator+'afudf.'+{$I %FILE%}+'.heap.trc');
{$EndIf}
end.
|
// *****************************************************************************
// Démineur avec Firemonkey / Minesweeper with Firemonkey
// Robin VALTOT
// 10/12/2016
// Contact > r.valtot@gmail.com
// Website > http://r.valtot.free.fr
// *****************************************************************************
unit ClassDemineur;
interface
uses
FMX.Layouts, FMX.StdCtrls, System.Generics.Collections, FMX.Forms, FMX.ImgList,
System.UITypes, System.Classes, FMX.Types, FMX.Objects, FMX.Styles.Objects;
type
TGameAction = (gaWin, gaLose, gaNewParty);
TLevel = (lvEasy, lvMiddle, lvHard);
TOnGetValue = procedure (iValue : integer) of object;
TOnGameAction = procedure (GameAction : TGameAction) of object;
TMineButton = class(TButton)
strict private
FbMine : boolean;
FbFlag : boolean;
FiNombre : integer;
FiCol : integer;
FiRow : integer;
/// <summary>affiche le drapeau sur le bouton</summary>
procedure SetFlag(const Value : boolean);
public
/// <summary>animation lors du clic</summary>
procedure Animate;
property bMine : boolean read FbMine write FbMine;
property bFlag : boolean read FbFlag write SetFlag;
property iNombre : integer read FiNombre write FiNombre;
property iCol : integer read FiCol write FiCol;
property iRow : integer read FiRow write FiRow;
end;
TDemineur = class
const
CST_WIDTH_BUTTON = 35;
strict private
FGridLayout : TGridLayout;
FLevel : TLevel;
FListMineButton : TObjectList<TMineButton>;
FiWidth : integer;
FiHeight : integer;
FiMines : integer;
FOwner : TForm;
FListColors : TList<Cardinal>;
FTimer : TTimer;
FiTimerExec : integer;
FbLongTap : boolean;
FOnGameAction : TOnGameAction;
FOnGetMine : TOnGetValue;
FOnGetTimer : TOnGetValue;
/// <summary>permet de créer les boutons</summary>
procedure CreateButtons;
/// <summary>redimensionne la fenêtre principale en fonction du mode de jeu</summary>
procedure AdjustFormSize;
/// <summary>quand on relâche un bouton</summary>
procedure OnMineButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
/// <summary>lors du clic sur un bouton vide, il faut afficher les boutons adjacents</summary>
procedure OnEmptyButtonClick(mbEmpty : TMineButton);
/// <summary>le clic gauche permet de dévoiler le bouton (chiffre ou mine)</summary>
procedure OnLeftMouseButtonClick(Sender : TObject; bAnimate : boolean = True);
/// <summary>le clic droit permet d'ajouter un drapeau</summary>
procedure OnRightMouseButtonClick(Sender : TObject);
/// <summary>chronomètre lancé toutes les secondes</summary>
procedure OnTimer(Sender : TObject);
/// <summary>pour ajouter des drapeaux pas clique long sur mobile</summary>
procedure OnMineButtonGesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean);
/// <summary>chargement des couleurs disponible pour les chiffres</summary>
procedure LoadListColors;
/// <summary>place des mines aléatoirement</summary>
procedure AddMines;
/// <summary>permet de connaitre le nombre de drapeaux posé sur le jeu</summary>
function GetNumberFlags : integer;
/// <summary>récupération des index des boutons adjacents d'après bouton précis</summary>
function GetButtonsAroundMyCurrentButton(iCurrentButton : integer; bOnlyEnabled : boolean = False): TList<integer>;
/// <summary>permet de savoir si la partie est gagnée</summary>
function IsWinner : boolean;
public
constructor Create(AOwner : TForm; GridLayout : TGridLayout);
destructor Destroy; override;
procedure Play;
procedure Stop(GameAction : TGameAction);
property Level : TLevel read FLevel write FLevel;
property OnGameAction : TOnGameAction read FOnGameAction write FOnGameAction;
property OnGetMine : TOnGetValue read FOnGetMine write FOnGetMine;
property OnGetTimer : TOnGetValue read FOnGetTimer write FOnGetTimer;
property iMines : integer read FiMines;
end;
implementation
uses
System.SysUtils, FMX.Dialogs, System.Types, FMX.Ani;
{ TMineButton }
procedure TMineButton.Animate;
begin
TAnimator.AnimateFloat(Self, 'Font.Size', 25);
TAnimator.AnimateFloat(Self, 'Font.Size', 15);
TAnimator.AnimateFloat(Self, 'Margins.Top', -10);
TAnimator.AnimateFloat(Self, 'Margins.Bottom', -10);
TAnimator.AnimateFloat(Self, 'Margins.Left', -10);
TAnimator.AnimateFloat(Self, 'Margins.Right', -10);
TAnimator.AnimateFloat(Self, 'Margins.Top', 0);
TAnimator.AnimateFloat(Self, 'Margins.Bottom', 0);
TAnimator.AnimateFloat(Self, 'Margins.Left', 0);
TAnimator.AnimateFloat(Self, 'Margins.Right', 0);
end;
procedure TMineButton.SetFlag(const Value : boolean);
begin
if FbFlag <> Value then
begin
{$IF Defined(ANDROID) or Defined(IOS)}
if Value then
Self.Text := 'F'
else
Self.StyleLookup := '';
{$ELSE}
if Value then
Self.StyleLookup := 'StyleFlagButton'
else
Self.StyleLookup := '';
{$ENDIF}
FbFlag := Value;
end;
end;
{ TDemineur }
function TDemineur.IsWinner : boolean;
var
iCount, iDisabled : integer;
begin
iDisabled := 0;
// récupération des boutons disabled, donc découvert
for iCount := 0 to FListMineButton.Count - 1 do
begin
if not FListMineButton[iCount].Enabled then
Inc(iDisabled);
end;
// si le nombre de bouton découvert + les mines = le nombre total alors on a gagné
Result := (iDisabled + FiMines) = FListMineButton.Count;
end;
function TDemineur.GetNumberFlags : integer;
var
i : integer;
begin
Result := 0;
for i := 0 to FListMineButton.Count - 1 do
begin
if FListMineButton[i].bFlag then
Inc(Result);
end;
end;
procedure TDemineur.OnTimer(Sender : TObject);
begin
Inc(FiTimerExec);
if Assigned(FOnGetTimer) then
FOnGetTimer(FiTimerExec);
end;
function TDemineur.GetButtonsAroundMyCurrentButton(iCurrentButton : integer; bOnlyEnabled : boolean = False): TList<integer>;
var
ListIndex : TList<integer>;
i : integer;
begin
ListIndex := TList<integer>.Create;
// récupération des positions possible tout autour de notre mine
ListIndex.Add(iCurrentButton - 1); // gauche
ListIndex.Add(iCurrentButton + 1); // droit
ListIndex.Add(iCurrentButton - FiWidth); // haut
ListIndex.Add(iCurrentButton - FiWidth + 1); // haut-droit
ListIndex.Add(iCurrentButton - FiWidth - 1); // haut-gauche
ListIndex.Add(iCurrentButton + FiWidth); // bas
ListIndex.Add(iCurrentButton + FiWidth + 1); // bas-droit
ListIndex.Add(iCurrentButton + FiWidth - 1); // bas-gauche
for i := ListIndex.Count - 1 downto 0 do
begin
// la valeur doit correspondre à l'index d'un bouton, il ne faut pas qu'il soit en dehors de la liste
// il est possible de prendre que les boutons "Enabled=True"
// et la différence entre les colonnes doit etre de 0 ou 1
// car si je prends un bouton en colonne 0 (tout à gauche) cela va me renvoyer le bouton
// précédent qui lui est tout à droite ..
if not ((ListIndex[i] <= FListMineButton.Count - 1) and (ListIndex[i] >= 0) and Assigned(FListMineButton[ListIndex[i]]) and (FListMineButton[ListIndex[i]] <> nil) and
((not bOnlyEnabled) or (bOnlyEnabled and FListMineButton[ListIndex[i]].Enabled)) and
((FListMineButton[ListIndex[i]].iCol - FListMineButton[iCurrentButton].iCol = 0) or (Abs(FListMineButton[ListIndex[i]].iCol - FListMineButton[iCurrentButton].iCol) = 1))
) then
ListIndex.Delete(i);
end;
Result := ListIndex;
end;
procedure TDemineur.AdjustFormSize;
begin
FOwner.Visible := False;
try
// resize de la fenêtre pour afficher correctement les boutons
FOwner.ClientWidth := (FiWidth * CST_WIDTH_BUTTON);
FOwner.ClientHeight := (FiHeight * CST_WIDTH_BUTTON) + 40;
// on remet la fenêtre au milieu de l'écran
FOwner.Left := (Screen.Width - FOwner.Width) div 2;
FOwner.Top := (Screen.Height - FOwner.Height) div 2;
finally
FOwner.Visible := True;
end;
end;
constructor TDemineur.Create(AOwner : TForm; GridLayout: TGridLayout);
begin
// lien vers la form principale, cela nous permettra de la redimensionner
FOwner := AOwner;
// initialisation de la grille
FGridLayout := GridLayout;
FGridLayout.ItemWidth := CST_WIDTH_BUTTON;
FGridLayout.ItemHeight := CST_WIDTH_BUTTON;
// par défaut le jeu est en mode "facile"
FLevel := lvEasy;
// liste contenant l'ensemble des boutons
FListMineButton := TObjectList<TMineButton>.Create;
// chargement des couleurs pour les chiffres sur les boutons
FListColors := TList<Cardinal>.Create;
LoadListColors;
// création du timer
FTimer := TTimer.Create(nil);
FTimer.Enabled := False;
FTimer.Interval := 1000;
FTimer.OnTimer := OnTimer;
FOnGameAction := nil;
FOnGetMine := nil;
FOnGetTimer := nil;
FbLongTap := False;
end;
procedure TDemineur.LoadListColors;
begin
// un bouton peux être à côté de 0 à 8 mines
// le chiffre 0 n'est pas affiché sur les boutons
// il faut donc 7 couleurs différentes
FListColors.Add(TAlphaColorRec.Blue);
FListColors.Add(TAlphaColorRec.Red);
FListColors.Add(TAlphaColorRec.Green);
FListColors.Add(TAlphaColorRec.Purple);
FListColors.Add(TAlphaColorRec.Coral);
FListColors.Add(TAlphaColorRec.Darkslateblue);
FListColors.Add(TAlphaColorRec.Chocolate);
end;
procedure TDemineur.CreateButtons;
var
iHeight : integer;
iWidth : integer;
mbButton : TMineButton;
begin
FListMineButton.Clear;
// sur téléphone l'écran est rempli de bouton
{$IF Defined(ANDROID) or Defined(IOS)}
FiHeight := Trunc((FOwner.ClientHeight - 40) div CST_WIDTH_BUTTON);
FiWidth := Trunc(FOwner.ClientWidth div CST_WIDTH_BUTTON);
// pour avoir la même marge à gauche et à droite
FGridLayout.Margins.Left := Trunc((FOwner.ClientWidth - (FiWidth * CST_WIDTH_BUTTON)) div 2);
{$ENDIF}
// création des boutons
for iHeight := 0 to FiHeight - 1 do
begin
for iWidth := 0 to FiWidth - 1 do
begin
mbButton := TMineButton.Create(FGridLayout);
mbButton.Parent := FGridLayout;
mbButton.iNombre := 0;
mbButton.OnMouseUp := OnMineButtonMouseUp;
mbButton.ImageIndex := -1;
mbButton.bFlag := False;
mbButton.Font.Size := 15;
// toujours sur téléphone on remplace le clique droit
// par un appui prolongé sur le bouton
{$IF Defined(ANDROID) or Defined(IOS)}
mbButton.Touch.InteractiveGestures := [TInteractiveGesture.LongTap];
mbButton.OnGesture := OnMineButtonGesture;
{$ENDIF}
mbButton.iCol := iWidth;
mbButton.iRow := iHeight;
mbButton.StyledSettings := [TStyledSetting.Family];
mbButton.TextSettings.Font.Style := mbButton.TextSettings.Font.Style + [TFontStyle.fsBold];
FGridLayout.AddObject(mbButton);
FListMineButton.Add(mbButton);
end;
end;
// initialisation des mines
AddMines;
{$IF Defined(MSWINDOWS) or Defined(MACOS)}
// on ajuste la taille de la fenêtre au nombre de boutons
AdjustFormSize;
{$ENDIF}
FTimer.Enabled := True;
end;
destructor TDemineur.Destroy;
begin
FTimer := nil;
FreeAndNil(FTimer);
FreeAndNil(FListColors);
FreeAndNil(FListMineButton);
inherited;
end;
procedure TDemineur.Play;
begin
// parametre des différents niveaux
case FLevel of
lvEasy:
begin
FiWidth := 8;
FiHeight := 10;
FiMines := 14;
end;
lvMiddle:
begin
FiWidth := 12;
FiHeight := 16;
FiMines := 25;
end;
lvHard:
begin
FiWidth := 16;
FiHeight := 20;
FiMines := 45;
end;
end;
// remise à zéro du chrono
FiTimerExec := 0;
if Assigned(FOnGetMine) then FOnGetMine(FiMines);
if Assigned(FOnGetTimer) then FOnGetTimer(FiTimerExec);
CreateButtons;
end;
procedure TDemineur.OnRightMouseButtonClick(Sender : TObject);
begin
TMineButton(Sender).bFlag := not TMineButton(Sender).bFlag;
if Assigned(FOnGetMine) then
FOnGetMine(FiMines - GetNumberFlags);
end;
procedure TDemineur.OnLeftMouseButtonClick(Sender : TObject; bAnimate : boolean = True);
var
curMineButton : TMineButton;
begin
curMineButton := TMineButton(Sender);
if not curMineButton.bMine then
begin
curMineButton.Enabled := False;
curMineButton.bFlag := False;
// si il vaut 0 on affiche les boutons adjacents
if curMineButton.iNombre = 0 then
begin
OnEmptyButtonClick(curMineButton)
end
else
begin
curMineButton.TextSettings.FontColor := FListColors[curMineButton.iNombre - 1];
curMineButton.Text := IntToStr(curMineButton.iNombre);
end;
// pour gagner en fluidité lors du clique sur une case vide
if bAnimate then
curMineButton.Animate;
if IsWinner then
begin
FOnGameAction(gaWin);
FTimer.Enabled := False;
end;
end
else
begin
Stop(gaLose);
end;
end;
procedure TDemineur.OnMineButtonGesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
if EventInfo.GestureID = igiLongTap then
begin
FbLongTap := True;
OnRightMouseButtonClick(Sender);
end;
end;
procedure TDemineur.OnMineButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
if not FbLongTap then
begin
if Button = TMouseButton.mbLeft then
OnLeftMouseButtonClick(Sender)
else if Button = TMouseButton.mbRight then
OnRightMouseButtonClick(Sender);
end;
FbLongTap := False;
end;
procedure TDemineur.OnEmptyButtonClick(mbEmpty : TMineButton);
var
i, iIndex : integer;
ListIndex : TList<integer>;
begin
// je viens de cliquer sur un bouton vide
iIndex := FListMineButton.IndexOf(mbEmpty);
try
// recuperation des boutons adjacents
ListIndex := GetButtonsAroundMyCurrentButton(iIndex, True);
for i := 0 to ListIndex.Count - 1 do
OnLeftMouseButtonClick(FListMineButton[ListIndex[i]], False);
finally
FreeAndNil(ListIndex);
end;
end;
procedure TDemineur.AddMines;
var
iRandom : integer;
mnButton : TMineButton;
ListIndex : TList<integer>;
iMine : integer;
iIndex : integer;
bTrouve : boolean;
begin
for iMine := 0 to FiMines - 1 do
begin
// permet de placer aléatoirement les mines
bTrouve := False;
while not bTrouve do
begin
// récupération d'un chiffre sur notre interval de boutons
iRandom := Random(FListMineButton.Count);
// récupération du bouton
mnButton := FListMineButton[iRandom];
// si ce n'est pas déjà une mine
if not mnButton.bMine then
begin
// on indique que ce bouton est une mine
mnButton.bMine := True;
try
// on incrémente le nombre des cases adjacentes
ListIndex := GetButtonsAroundMyCurrentButton(iRandom);
for iIndex := 0 to ListIndex.Count - 1 do
FListMineButton[ListIndex[iIndex]].iNombre := FListMineButton[ListIndex[iIndex]].iNombre + 1;
finally
FreeAndNil(ListIndex);
end;
bTrouve := True;
end;
end;
end;
end;
procedure TDemineur.Stop(GameAction : TGameAction);
var
iCount : integer;
begin
// affichage de toutes les mines de la partie
for iCount := 0 to FListMineButton.Count - 1 do
if FListMineButton[iCount].bMine then
begin
{$IF Defined(ANDROID) or Defined(IOS)}
FListMineButton[iCount].Text := 'M';
{$ELSE}
FListMineButton[iCount].StyleLookup := 'StyleMineButton';
{$ENDIF}
end;
// arrêt du chronomètre
FTimer.Enabled := False;
FiTimerExec := 0;
// notification à la fenêtre comme quoi la partie est perdue
if Assigned(FOnGameAction) then
FOnGameAction(GameAction);
end;
end.
|
unit uTela;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, uDM, Vcl.Buttons,
Vcl.ExtCtrls, uFormProcesso, System.Generics.Collections, ULicencaVO, uLicencaItensVO,
Data.DBXJSON, DBXJSONReflect;
type
TfrmTela = class(TForm)
lblMensagem: TLabel;
Panel1: TPanel;
btnImportar: TBitBtn;
btnSair: TBitBtn;
rgTipo: TRadioGroup;
rgUtilizacao: TRadioGroup;
procedure btnSairClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure btnImportarClick(Sender: TObject);
private
{ Private declarations }
procedure ImportarFireBird(AUtilizadas: Integer);
procedure ImportarClientes(AUtilizadas: Integer);
procedure ImportarLicencas(AUtilizadas: Integer);
public
{ Public declarations }
end;
var
frmTela: TfrmTela;
implementation
uses
uLicencaController;
{$R *.dfm}
{ TfrmTela }
procedure TfrmTela.btnImportarClick(Sender: TObject);
begin
try
dm.AbrirConexao();
except
On E: Exception do
begin
raise Exception.Create('Abrir conexão: ' + E.Message);
end;
end;
btnImportar.Enabled := False;
Screen.Cursor := crHourGlass;
lblMensagem.Caption := 'Aguarde o término da importação...';
Application.ProcessMessages;
try
try
if rgTipo.ItemIndex = 0 then
ImportarClientes(rgUtilizacao.ItemIndex);
if rgTipo.ItemIndex = 1 then
ImportarLicencas(rgUtilizacao.ItemIndex);
if rgTipo.ItemIndex = 2 then
ImportarFireBird(rgUtilizacao.ItemIndex);
except
on E: Exception do
begin
raise Exception.Create(E.Message);
end;
end;
Application.Terminate;
finally
Screen.Cursor := crDefault;
btnImportar.Enabled := True;
end;
end;
procedure TfrmTela.btnSairClick(Sender: TObject);
begin
Application.Terminate;
end;
procedure TfrmTela.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_ESCAPE then
Application.Terminate;
end;
procedure TfrmTela.ImportarClientes(AUtilizadas: Integer);
var
obj: TLicencaController;
FormularioProcesso: TfrmProcesso;
listaItens :TObjectList<TLicencaItensVO>;
listaCliente: TObjectList<TLicencaVO>;
oLicencaJSON : TJSONValue;
oLicencaItensJSON : TJSONValue;
Marshal : TJSONMarshal;
sResultado: string;
begin
obj := TLicencaController.Create;
FormularioProcesso := TfrmProcesso.Create(nil);
Marshal := TJSONMarshal.Create;
listaItens := TObjectList<TLicencaItensVO>.Create();
try
try
listaCliente := obj.ImportarLicencaClientes(FormularioProcesso, AUtilizadas);
oLicencaJSON := Marshal.Marshal(listaCliente);
oLicencaItensJSON := Marshal.Marshal(listaItens);
sResultado := obj.SalvarDados(oLicencaJSON, oLicencaItensJSON, FormularioProcesso);
if sResultado <> '' then
raise Exception.Create(sResultado);
except
On E: Exception do
begin
raise Exception.Create(E.Message);
end;
end;
finally
FreeAndNil(obj);
FreeAndNil(listaCliente);
FreeAndNil(listaItens);
FreeAndNil(Marshal);
FreeAndNil(FormularioProcesso);
end;
end;
procedure TfrmTela.ImportarFireBird(AUtilizadas: Integer);
var
obj: TLicencaController;
FormularioProcesso: TfrmProcesso;
listaItens :TObjectList<TLicencaItensVO>;
listaCliente: TObjectList<TLicencaVO>;
oLicencaJSON : TJSONValue;
oLicencaItensJSON : TJSONValue;
Marshal : TJSONMarshal;
sResultado: string;
begin
obj := TLicencaController.Create;
FormularioProcesso := TfrmProcesso.Create(nil);
Marshal := TJSONMarshal.Create;
try
try
listaItens := obj.ImportarLicencaItens(FormularioProcesso, AUtilizadas);
listaCliente := obj.ImportarLicencaClientes(FormularioProcesso, AUtilizadas);
oLicencaJSON := Marshal.Marshal(listaCliente);
oLicencaItensJSON := Marshal.Marshal(listaItens);
sResultado := obj.SalvarDados(oLicencaJSON, oLicencaItensJSON, FormularioProcesso);
if sResultado <> '' then
raise Exception.Create(sResultado);
// obj.Importar();
except
On E: Exception do
begin
raise Exception.Create(E.Message);
end;
end;
finally
FreeAndNil(obj);
FreeAndNil(listaCliente);
FreeAndNil(listaItens);
FreeAndNil(Marshal);
end;
end;
procedure TfrmTela.ImportarLicencas(AUtilizadas: Integer);
var
obj: TLicencaController;
FormularioProcesso: TfrmProcesso;
listaItens :TObjectList<TLicencaItensVO>;
listaCliente: TObjectList<TLicencaVO>;
oLicencaJSON : TJSONValue;
oLicencaItensJSON : TJSONValue;
Marshal : TJSONMarshal;
sResultado: string;
begin
listaCliente := TObjectList<TLicencaVO>.Create();
obj := TLicencaController.Create;
FormularioProcesso := TfrmProcesso.Create(nil);
Marshal := TJSONMarshal.Create;
try
try
listaItens := obj.ImportarLicencaItens(FormularioProcesso, AUtilizadas);
oLicencaJSON := Marshal.Marshal(listaCliente);
oLicencaItensJSON := Marshal.Marshal(listaItens);
sResultado := obj.SalvarDados(oLicencaJSON, oLicencaItensJSON, FormularioProcesso);
if sResultado <> '' then
raise Exception.Create(sResultado);
except
On E: Exception do
begin
raise Exception.Create(E.Message);
end;
end;
finally
FreeAndNil(obj);
FreeAndNil(listaCliente);
FreeAndNil(listaItens);
FreeAndNil(Marshal);
FreeAndNil(FormularioProcesso);
end;
end;
end.
|
inherited dmPlanoContas: TdmPlanoContas
OldCreateOrder = True
inherited qryManutencao: TIBCQuery
SQLInsert.Strings = (
'INSERT INTO STWCPGTPCON'
' (CODIGO, DESCRICAO, DC, GRUPO, SUB_GRUPO, CONTA, SUB_CONTA, AN' +
'ALITICO, DT_ALTERACAO, OPERADOR, CODIGO_EXT, COD_ACESSO)'
'VALUES'
' (:CODIGO, :DESCRICAO, :DC, :GRUPO, :SUB_GRUPO, :CONTA, :SUB_CO' +
'NTA, :ANALITICO, :DT_ALTERACAO, :OPERADOR, :CODIGO_EXT, :COD_ACE' +
'SSO)')
SQLDelete.Strings = (
'DELETE FROM STWCPGTPCON'
'WHERE'
' CODIGO = :Old_CODIGO')
SQLUpdate.Strings = (
'UPDATE STWCPGTPCON'
'SET'
' CODIGO = :CODIGO, DESCRICAO = :DESCRICAO, DC = :DC, GRUPO = :G' +
'RUPO, SUB_GRUPO = :SUB_GRUPO, CONTA = :CONTA, SUB_CONTA = :SUB_C' +
'ONTA, ANALITICO = :ANALITICO, DT_ALTERACAO = :DT_ALTERACAO, OPER' +
'ADOR = :OPERADOR, CODIGO_EXT = :CODIGO_EXT, COD_ACESSO = :COD_AC' +
'ESSO'
'WHERE'
' CODIGO = :Old_CODIGO')
SQLRefresh.Strings = (
'SELECT CODIGO, DESCRICAO, DC, GRUPO, SUB_GRUPO, CONTA, SUB_CONTA' +
', ANALITICO, DT_ALTERACAO, OPERADOR, CODIGO_EXT, COD_ACESSO FROM' +
' STWCPGTPCON'
'WHERE'
' CODIGO = :Old_CODIGO')
SQLLock.Strings = (
'SELECT NULL FROM STWCPGTPCON'
'WHERE'
'CODIGO = :Old_CODIGO'
'FOR UPDATE WITH LOCK')
SQL.Strings = (
'SELECT * FROM STWCPGTPCON')
object qryManutencaoCODIGO: TStringField
FieldName = 'CODIGO'
Required = True
Size = 30
end
object qryManutencaoDESCRICAO: TStringField
FieldName = 'DESCRICAO'
Size = 40
end
object qryManutencaoDC: TStringField
FieldName = 'DC'
Size = 1
end
object qryManutencaoGRUPO: TStringField
FieldName = 'GRUPO'
Size = 5
end
object qryManutencaoSUB_GRUPO: TStringField
FieldName = 'SUB_GRUPO'
Size = 5
end
object qryManutencaoCONTA: TStringField
FieldName = 'CONTA'
Size = 5
end
object qryManutencaoSUB_CONTA: TStringField
FieldName = 'SUB_CONTA'
Size = 5
end
object qryManutencaoANALITICO: TStringField
FieldName = 'ANALITICO'
Size = 5
end
object qryManutencaoDT_ALTERACAO: TDateTimeField
FieldName = 'DT_ALTERACAO'
end
object qryManutencaoOPERADOR: TStringField
FieldName = 'OPERADOR'
end
object qryManutencaoCODIGO_EXT: TFloatField
FieldName = 'CODIGO_EXT'
end
object qryManutencaoCOD_ACESSO: TFloatField
FieldName = 'COD_ACESSO'
end
end
inherited qryLocalizacao: TIBCQuery
SQL.Strings = (
'SELECT * FROM STWCPGTPCON')
object qryLocalizacaoCODIGO: TStringField
FieldName = 'CODIGO'
Required = True
Size = 30
end
object qryLocalizacaoDESCRICAO: TStringField
FieldName = 'DESCRICAO'
Size = 40
end
object qryLocalizacaoDC: TStringField
FieldName = 'DC'
Size = 1
end
object qryLocalizacaoGRUPO: TStringField
FieldName = 'GRUPO'
Size = 5
end
object qryLocalizacaoSUB_GRUPO: TStringField
FieldName = 'SUB_GRUPO'
Size = 5
end
object qryLocalizacaoCONTA: TStringField
FieldName = 'CONTA'
Size = 5
end
object qryLocalizacaoSUB_CONTA: TStringField
FieldName = 'SUB_CONTA'
Size = 5
end
object qryLocalizacaoANALITICO: TStringField
FieldName = 'ANALITICO'
Size = 5
end
object qryLocalizacaoDT_ALTERACAO: TDateTimeField
FieldName = 'DT_ALTERACAO'
end
object qryLocalizacaoOPERADOR: TStringField
FieldName = 'OPERADOR'
end
object qryLocalizacaoCODIGO_EXT: TFloatField
FieldName = 'CODIGO_EXT'
end
object qryLocalizacaoCOD_ACESSO: TFloatField
FieldName = 'COD_ACESSO'
end
end
end
|
{ behavior3delphi - a Behavior3 client library (Behavior Trees) for Delphi
by Dennis D. Spreen <dennis@spreendigital.de>
see Behavior3.pas header for full license information }
unit Behavior3.Actions.Error;
interface
uses
Behavior3, Behavior3.Core.Action, Behavior3.Core.BaseNode, Behavior3.Core.Tick;
type
(**
* This action node returns `ERROR` always.
*
* @module b3
* @class Error
* @extends Action
**)
TB3Error = class(TB3Action)
public
constructor Create; override;
(**
* Tick method.
* @method tick
* @param {Tick} tick A tick instance.
* @return {Constant} Always return `b3.ERROR`.
**)
function Tick(Tick: TB3Tick): TB3Status; override;
end;
implementation
{ TB3Error }
constructor TB3Error.Create;
begin
inherited;
(**
* Node name. Default to `Error`.
* @property {String} name
* @readonly
**)
Name := 'Error';
end;
function TB3Error.Tick(Tick: TB3Tick): TB3Status;
begin
Result := Behavior3.Error;
end;
end.
|
{$REGION 'Copyright (C) CMC Development Team'}
{ **************************************************************************
Copyright (C) 2015 CMC Development Team
CMC is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
CMC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CMC. If not, see <http://www.gnu.org/licenses/>.
************************************************************************** }
{ **************************************************************************
Additional Copyright (C) for this modul:
Chromaprint: Audio fingerprinting toolkit
Copyright (C) 2010-2012 Lukas Lalinsky <lalinsky@gmail.com>
Lomont FFT: Fast Fourier Transformation
Original code by Chris Lomont, 2010-2012, http://www.lomont.org/Software/
************************************************************************** }
{$ENDREGION}
{$REGION 'Notes'}
{ **************************************************************************
See CP.Chromaprint.pas for more information
************************************************************************** }
unit CP.TestUtils;
interface
uses
Windows, Classes, SysUtils,
CP.Def;
const
StartPath = '.\'; // adjust this to your configuration
function LoadAudioFile(filename: string): TSmallIntArray;
procedure CheckFingerprints(List: TStrings; actual, expected: TUINT32Array; expected_size: integer); inline;
implementation
function LoadAudioFile(filename: string): TSmallIntArray;
var
lPath: string;
data: TSmallIntArray;
lLength: integer;
fs: integer;
lError, i, n: integer;
lBuffer: PByte;
begin
lPath := StartPath + filename;
fs := FileOpen(lPath, fmOpenRead);
lLength := SysUtils.FileSeek(fs, 0, 2);
FileSeek(fs, 0, 0);
lBuffer := System.AllocMem(lLength + 1);
lError := FileRead(fs, lBuffer^, lLength);
if lError = -1 then
OutputDebugString('shit');
FileClose(fs);
n := lLength div 2;
SetLength(data, n);
for i := 0 to n - 1 do
begin
data[i] := lBuffer[i * 2] + lBuffer[i * 2 + 1] * 256;
end;
FreeMem(lBuffer);
result := data;
end;
procedure CheckFingerprints(List: TStrings; actual, expected: TUINT32Array; expected_size: integer); inline;
var
i: integer;
error: boolean;
begin
if expected_size = Length(actual) then
begin
List.Add('Length: OK');
error := FALSE;
for i := 0 to expected_size - 1 do
begin
if expected[i] <> expected[i] then
begin
List.Add('Different at index :' + IntToStr(i));
error := TRUE;
end;
end;
if not error then
begin
List.Add('All Values ok');
end;
end
else
begin
List.Add('Length: NOT OK');
end;
end;
end.
|
{ *********************************************************************************** }
{ * CryptoLib Library * }
{ * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * }
{ * Github Repository <https://github.com/Xor-el> * }
{ * Distributed under the MIT software license, see the accompanying file LICENSE * }
{ * or visit http://www.opensource.org/licenses/mit-license.php. * }
{ * Acknowledgements: * }
{ * * }
{ * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * }
{ * development of this library * }
{ * ******************************************************************************* * }
(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
unit ClpIDerObjectIdentifier;
{$I ..\Include\CryptoLib.inc}
interface
uses
Classes,
ClpBigInteger,
ClpIProxiedInterface,
ClpCryptoLibTypes;
type
IDerObjectIdentifier = interface(IAsn1Object)
['{8626051F-828D-419B-94E8-65CC0752CCA1}']
function GetID: String;
property ID: String read GetID;
procedure WriteField(const outputStream: TStream;
fieldValue: Int64); overload;
procedure WriteField(const outputStream: TStream;
const fieldValue: TBigInteger); overload;
procedure DoOutput(const bOut: TMemoryStream); overload;
function GetBody(): TCryptoLibByteArray;
function Branch(const branchID: String): IDerObjectIdentifier;
function &On(const stem: IDerObjectIdentifier): Boolean;
function ToString(): String;
end;
implementation
end.
|
unit FResolucion;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TResolucion_Form = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Num_Exp_Edit: TEdit;
Fecha_Edit: TEdit;
Folios_Edit: TEdit;
Ref_Memo: TMemo;
Obs_Memo: TMemo;
Estado_ComboBox: TComboBox;
Button1: TButton;
Button2: TButton;
procedure Estado_ComboBoxSelect(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Resolucion (R : String; Estado_, Exp : Integer);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Estado : Integer;
end;
var
Resolucion_Form: TResolucion_Form;
implementation
{$R *.dfm}
uses MDatos, FExpedientes;
procedure TResolucion_Form.Button1Click(Sender: TObject);
begin
if (Estado <> 0) and (Obs_Memo.Lines.Text <> '') then
begin
Resolucion(Obs_Memo.Lines.Text,Estado,Expedientes_Form.ID_Expediente);
if ModuloDatos.UniQueryUpdateResolucion.RowsAffected <> 0 then
begin
ShowMessage('La Resolución Fue Guardada Correctamente.');
end;
end
else
begin
ShowMessage('Asegurese De Elejir Un Estado o Completar Las Observaciones.');
end;
end;
procedure TResolucion_Form.Button2Click(Sender: TObject);
begin
Resolucion_Form.Close;
end;
procedure TResolucion_Form.Estado_ComboBoxSelect(Sender: TObject);
begin
case Estado_ComboBox.ItemIndex of
0:
begin
Estado := 2;
end;
1:
begin
Estado := 3;
end;
end;
end;
procedure TResolucion_Form.Resolucion(R : String; Estado_, Exp: Integer);
begin
with ModuloDatos.UniQueryUpdateResolucion do
begin
SQL.Clear;
SQL.Add('UPDATE expediente SET estado_exp = :EST, observaciones_exp = :RESOLUCION WHERE id_exp = :ID');
ParamByName('EST').AsInteger := Estado_;
ParamByName('RESOLUCION').AsString := R;
ParamByName('ID').AsInteger := Exp;
ExecSQL;
end;
end;
end.
|
unit Androidapi.JNI.baidu.mapapi.navi;
// ====================================================
// Android Baidu Map SDK interface
// Package:com.baidu.mapapi.navi
// author:Xubzhlin
// email:371889755@qq.com
//
// date:2017.5.10
// version:4.3.0
// ====================================================
interface
uses
Androidapi.JNIBridge,
Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.JavaTypes,
Androidapi.JNI.baidu.mapapi.model;
type
// ===== Forward declarations =====
JBaiduMapAppNotSupportNaviException = interface;
// com.baidu.mapapi.navi.BaiduMapAppNotSupportNaviException
JBaiduMapNavigation = interface; // com.baidu.mapapi.navi.BaiduMapNavigation
JIllegalNaviArgumentException = interface;
// com.baidu.mapapi.navi.IllegalNaviArgumentException
JNaviParaOption = interface; // com.baidu.mapapi.navi.NaviParaOption
// ===== Interface declarations =====
JBaiduMapAppNotSupportNaviExceptionClass = interface(JRuntimeExceptionClass)
// or JObjectClass // SuperSignature: java/lang/RuntimeException
['{4D4B436F-5E09-4151-B03B-89C622775139}']
{ static Property Methods }
{ static Methods }
{ class } function init: JBaiduMapAppNotSupportNaviException; cdecl;
overload; // ()V
{ class } function init(P1: JString): JBaiduMapAppNotSupportNaviException;
cdecl; overload; // (Ljava/lang/String;)V
{ static Property }
end;
[JavaSignature('com/baidu/mapapi/navi/BaiduMapAppNotSupportNaviException')]
JBaiduMapAppNotSupportNaviException = interface(JRuntimeException)
// or JObject // SuperSignature: java/lang/RuntimeException
['{2BB8FA48-D2E4-4F0E-B948-86399AC77919}']
{ Property Methods }
{ methods }
{ Property }
end;
TJBaiduMapAppNotSupportNaviException = class
(TJavaGenericImport<JBaiduMapAppNotSupportNaviExceptionClass,
JBaiduMapAppNotSupportNaviException>)
end;
JBaiduMapNavigationClass = interface(JObjectClass)
['{FDBC02D1-448F-4BE2-86B0-1BDD0DE3735F}']
{ static Property Methods }
{ static Methods }
{ class } function init: JBaiduMapNavigation; cdecl; // ()V
{ class } procedure setSupportWebNavi(P1: Boolean); cdecl; // (Z)V
{ class } function openBaiduMapNavi(P1: JNaviParaOption; P2: JContext)
: Boolean; cdecl;
// (Lcom/baidu/mapapi/navi/NaviParaOption;Landroid/content/Context;)Z
{ class } function openBaiduMapWalkNavi(P1: JNaviParaOption; P2: JContext)
: Boolean; cdecl;
// (Lcom/baidu/mapapi/navi/NaviParaOption;Landroid/content/Context;)Z
{ class } function openBaiduMapWalkNaviAR(P1: JNaviParaOption; P2: JContext)
: Boolean; cdecl;
// (Lcom/baidu/mapapi/navi/NaviParaOption;Landroid/content/Context;)Z
{ class } function openBaiduMapBikeNavi(P1: JNaviParaOption; P2: JContext)
: Boolean; cdecl;
// (Lcom/baidu/mapapi/navi/NaviParaOption;Landroid/content/Context;)Z
{ class } procedure openWebBaiduMapNavi(P1: JNaviParaOption; P2: JContext);
cdecl; // Deprecated //(Lcom/baidu/mapapi/navi/NaviParaOption;Landroid/content/Context;)V
{ class } procedure finish(P1: JContext); cdecl;
// (Landroid/content/Context;)V
{ static Property }
end;
[JavaSignature('com/baidu/mapapi/navi/BaiduMapNavigation')]
JBaiduMapNavigation = interface(JObject)
['{7DED77E8-455E-41E3-9EE7-BD95723E5AD0}']
{ Property Methods }
{ methods }
{ Property }
end;
TJBaiduMapNavigation = class(TJavaGenericImport<JBaiduMapNavigationClass,
JBaiduMapNavigation>)
end;
JIllegalNaviArgumentExceptionClass = interface(JRuntimeExceptionClass)
// or JObjectClass // SuperSignature: java/lang/RuntimeException
['{371253B2-DC86-4614-8DDA-06239709DC87}']
{ static Property Methods }
{ static Methods }
{ class } function init: JIllegalNaviArgumentException; cdecl; overload;
// ()V
{ class } function init(P1: JString): JIllegalNaviArgumentException; cdecl;
overload; // (Ljava/lang/String;)V
{ static Property }
end;
[JavaSignature('com/baidu/mapapi/navi/IllegalNaviArgumentException')]
JIllegalNaviArgumentException = interface(JRuntimeException)
// or JObject // SuperSignature: java/lang/RuntimeException
['{ACCF4A5B-29CA-4506-9CCC-8E50F1A272E2}']
{ Property Methods }
{ methods }
{ Property }
end;
TJIllegalNaviArgumentException = class
(TJavaGenericImport<JIllegalNaviArgumentExceptionClass,
JIllegalNaviArgumentException>)
end;
JNaviParaOptionClass = interface(JObjectClass)
['{A331635B-7074-4F26-A25B-6C84F3FACAA1}']
{ static Property Methods }
{ static Methods }
{ class } function init: JNaviParaOption; cdecl; // ()V
{ static Property }
end;
[JavaSignature('com/baidu/mapapi/navi/NaviParaOption')]
JNaviParaOption = interface(JObject)
['{AAD88A83-FDF1-484A-8BA1-599235650ECC}']
{ Property Methods }
{ methods }
function startPoint(P1: JLatLng): JNaviParaOption; cdecl;
// (Lcom/baidu/mapapi/model/LatLng;)Lcom/baidu/mapapi/navi/NaviParaOption;
function startName(P1: JString): JNaviParaOption; cdecl;
// (Ljava/lang/String;)Lcom/baidu/mapapi/navi/NaviParaOption;
function endPoint(P1: JLatLng): JNaviParaOption; cdecl;
// (Lcom/baidu/mapapi/model/LatLng;)Lcom/baidu/mapapi/navi/NaviParaOption;
function endName(P1: JString): JNaviParaOption; cdecl;
// (Ljava/lang/String;)Lcom/baidu/mapapi/navi/NaviParaOption;
function getStartPoint: JLatLng; cdecl; // ()Lcom/baidu/mapapi/model/LatLng;
function getEndPoint: JLatLng; cdecl; // ()Lcom/baidu/mapapi/model/LatLng;
function getStartName: JString; cdecl; // ()Ljava/lang/String;
function getEndName: JString; cdecl; // ()Ljava/lang/String;
{ Property }
end;
TJNaviParaOption = class(TJavaGenericImport<JNaviParaOptionClass,
JNaviParaOption>)
end;
implementation
procedure RegisterTypes;
begin
TRegTypes.RegisterType
('Androidapi.JNI.baidu.mapapi.navi.BaiduMapAppNotSupportNaviException',
TypeInfo(Androidapi.JNI.baidu.mapapi.navi.
JBaiduMapAppNotSupportNaviException));
TRegTypes.RegisterType('Androidapi.JNI.baidu.mapapi.navi.BaiduMapNavigation',
TypeInfo(Androidapi.JNI.baidu.mapapi.navi.JBaiduMapNavigation));
TRegTypes.RegisterType
('Androidapi.JNI.baidu.mapapi.navi.IllegalNaviArgumentException',
TypeInfo(Androidapi.JNI.baidu.mapapi.navi.JIllegalNaviArgumentException));
TRegTypes.RegisterType('Androidapi.JNI.baidu.mapapi.navi.NaviParaOption',
TypeInfo(Androidapi.JNI.baidu.mapapi.navi.JNaviParaOption));
end;
initialization
RegisterTypes;
end.
|
unit Model.OcorrenciasJornal;
interface
type
TOcorrenciasJornal = class
private
var
FNumero: Integer;
FDataOcorrencia: TDate;
FCodigoAssinstura: String;
FNome: String;
FRoteiro: String;
FEntregador: integer;
FProduto: String;
FCodigoOcorrencia: Integer;
FReincidente: String;
FDescricao: String;
FEndereco: String;
FRetorno: String;
FResultado: Integer;
FOrigem: Integer;
FObs: String;
FStatus: Integer;
FApuracao: String;
FProcessado: String;
FQtde: Integer;
FValor: Double;
FDataDesconto: TDate;
FImpressao: String;
FAnexo: String;
FLog: String;
public
property Numero: Integer read FNumero write FNumero;
property DataOcorrencia: TDate read FDataOcorrencia write FDataOcorrencia;
property CodigoAssinstura: String read FCodigoAssinstura write FCodigoAssinstura;
property Nome: String read FNome write FNome;
property Roteiro: String read FRoteiro write FRoteiro;
property Entregador: integer read FEntregador write FEntregador;
property Produto: String read FProduto write FProduto;
property CodigoOcorrencia: Integer read FCodigoOcorrencia write FCodigoOcorrencia;
property Reincidente: String read FReincidente write FReincidente;
property Descricao: String read FDescricao write FDescricao;
property Endereco: String read FEndereco write FEndereco;
property Retorno: String read FRetorno write FRetorno;
property Resultado: Integer read FResultado write FResultado;
property Origem: Integer read FOrigem write FOrigem;
property Obs: String read FObs write FObs;
property Status: Integer read FStatus write FStatus;
property Apuracao: String read FApuracao write FApuracao;
property Processado: String read FProcessado write FProcessado;
property Qtde: Integer read FQtde write FQtde;
property Valor: Double read FValor write FValor;
property DataDesconto: TDate read FDataDesconto write FDataDesconto;
property Impressao: String read FImpressao write FImpressao;
property Anexo: String read FAnexo write FAnexo;
property Log: String read FLog write FLog;
constructor Create; overload;
constructor Create(pFNumero: Integer; pFDataOcorrencia: TDate; pFCodigoAssinstura: String; pFNome: String; pFRoteiro: String;
pFEntregador: integer; pFProduto: String; pFCodigoOcorrencia: Integer; pFReincidente: String;
pFDescricao: String; pFEndereco: String; pFRetorno: String; pFResultado: Integer; pFOrigem: Integer;
pFObs: String; pFStatus: Integer; pFApuracao: String; pFProcessado: String; pFQtde: Integer;
pFValor: Double; pFDataDesconto: TDate; pFImpressao: String; pFAnexo: String; pFLog: String) overload;
end;
implementation
constructor TOcorrenciasJornal.Create;
begin
inherited Create;
end;
constructor TOcorrenciasJornal.Create(pFNumero: Integer; pFDataOcorrencia: TDate; pFCodigoAssinstura: string; pFNome: string;
pFRoteiro: string; pFEntregador: Integer; pFProduto: string; pFCodigoOcorrencia: Integer;
pFReincidente: string; pFDescricao: string; pFEndereco: string; pFRetorno: string;
pFResultado: Integer; pFOrigem: Integer; pFObs: string; pFStatus: Integer;
pFApuracao: string; pFProcessado: string; pFQtde: Integer; pFValor: Double;
pFDataDesconto: TDate; pFImpressao: string; pFAnexo: string; pFLog: string);
begin
FNumero := pFNumero;
FDataOcorrencia := pFDataOcorrencia;
FCodigoAssinstura := pFCodigoAssinstura;
FNome := pFNome;
FRoteiro := pFRoteiro;
FEntregador := pFEntregador;
FProduto := pFProduto;
FCodigoOcorrencia := pFCodigoOcorrencia;
FReincidente := pFReincidente;
FDescricao := pFDescricao;
FEndereco := pFEndereco;
FRetorno := pFRetorno;
FResultado := pFResultado;
FOrigem := pFOrigem;
FObs := pFObs;
FStatus := pFStatus;
FApuracao := pFApuracao;
FProcessado := pFProcessado;
FQtde := pFQtde;
FValor := pFValor;
FDataDesconto := pFDataDesconto;
FImpressao := pFImpressao;
FAnexo := pFAnexo;
FLog := pFLog;
end;
end.
|
unit vcmMessagesCollection;
{ Библиотека "vcm" }
{ Автор: Люлин А.В. © }
{ Модуль: vcmMessagesCollection - }
{ Начат: 21.02.2003 16:19 }
{ $Id: vcmMessagesCollection.pas,v 1.16 2014/02/18 10:01:27 lulin Exp $ }
// $Log: vcmMessagesCollection.pas,v $
// Revision 1.16 2014/02/18 10:01:27 lulin
// - для несортируемых списков убираем возможность поставить флаг сортировки.
//
// Revision 1.15 2011/12/08 16:30:03 lulin
// {RequestLink:273590436}
// - чистка кода.
//
// Revision 1.14 2011/06/27 16:50:19 lulin
// {RequestLink:254944102}.
// - чистим мусорок.
//
// Revision 1.13 2009/02/20 12:29:37 lulin
// - <K>: 136941122.
//
// Revision 1.12 2007/01/24 15:47:14 lulin
// - убрана ненужная сортировка.
//
// Revision 1.11 2006/03/23 14:06:51 lulin
// - добавлена коллекция строковых констант.
//
// Revision 1.10 2006/03/23 13:33:45 lulin
// - cleanup.
//
// Revision 1.9 2006/03/23 13:31:00 lulin
// - cleanup.
//
// Revision 1.8 2004/09/17 14:57:06 lulin
// - clenaup.
//
// Revision 1.7 2004/09/15 13:57:59 lulin
// - new unit: vcmStringList.
//
// Revision 1.6 2004/09/15 12:54:58 mmorozov
// new behaviour: в RunTime сортировка сообщений отключена по умолчанию, сообщения сортируются после загрузки в vcmBaseMenuManager;
//
// Revision 1.5 2004/09/11 11:55:47 lulin
// - cleanup: избавляемся от прямого использования деструкторов.
//
// Revision 1.4 2004/07/06 16:18:08 mmorozov
// new: включена сортировка;
//
// Revision 1.3 2004/06/10 14:23:35 mmorozov
// new: property TvcmMessagesCollection.Categories;
//
// Revision 1.2 2004/05/12 13:02:14 am
// new method: FindByKeyName - поиск итема в коллекции по ключу.
//
// Revision 1.1 2004/01/27 16:52:57 law
// - new units: vcmMessagesCollection, vcmMessagesCollectionItem.
//
{$Include vcmDefine.inc }
interface
uses
Classes,
vcmExternalInterfaces,
vcmInterfaces,
vcmBase,
vcmStringList,
vcmBaseCollection,
vcmBaseStringCollection,
vcmMessagesCollectionItem
;
type
TvcmMessagesCollection = class(TvcmBaseStringCollection)
(* {$IfDef DesignTimeLibrary}
private
// private fields
f_Categories : _IvcmStrings;
protected
// protected methods
function pm_GetCategories : _IvcmStrings;
{-}
procedure Cleanup;
override;
{-}
{$EndIf DesignTimeLibrary}*)
public
// public methods
class function GetItemClass: TCollectionItemClass;
override;
{-}
(* {$IfDef DesignTimeLibrary}
public
// public properties
property Categories : _IvcmStrings
read pm_GetCategories;
{* - список категорий сообщений. }
{$EndIf DesignTimeLibrary}*)
end;//TvcmMessagesCollection
implementation
uses
SysUtils
;
// start class TvcmMessagesCollection
(*{$IfDef DesignTimeLibrary}
procedure TvcmMessagesCollection.Cleanup;
begin
f_Categories := nil;
inherited;
end;
{$EndIf DesignTimeLibrary}*)
class function TvcmMessagesCollection.GetItemClass: TCollectionItemClass;
//override;
{-}
begin
Result := TvcmMessagesCollectionItem;
end;
(*{$IfDef DesignTimeLibrary}
function TvcmMessagesCollection.pm_GetCategories: _IvcmStrings;
{-}
var
lIndex : Integer;
begin
// создадим если список не был построен
if not Assigned(f_Categories) then
f_Categories := TvcmStringList.Make;
// очистим
f_Categories.Clear;
for lIndex := 0 to Pred(Count) do
with TvcmMessagesCollectionItem(Items[lIndex]) do
// добавим если ещё не добавили
if f_Categories.IndexOf(_Category) = -1 then
f_Categories.Add(_Category);
// отсортируем
(f_Categories.Items As TStringList).Sort;
Result := f_Categories;
end;
{$EndIf DesignTimeLibrary}*)
end.
|
{ *********************************************************************************** }
{ * CryptoLib Library * }
{ * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * }
{ * Github Repository <https://github.com/Xor-el> * }
{ * Distributed under the MIT software license, see the accompanying file LICENSE * }
{ * or visit http://www.opensource.org/licenses/mit-license.php. * }
{ * Acknowledgements: * }
{ * * }
{ * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * }
{ * development of this library * }
{ * ******************************************************************************* * }
(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
unit ClpAsn1StreamParser;
{$I ..\Include\CryptoLib.inc}
interface
uses
Classes,
ClpCryptoLibTypes,
ClpIProxiedInterface,
ClpAsn1Tags,
ClpIndefiniteLengthInputStream,
ClpDerExternalParser,
ClpBerOctetStringParser,
ClpBerSequenceParser,
ClpBerSetParser,
ClpBerSequence,
ClpBerApplicationSpecificParser,
ClpDerSetParser,
ClpDerSequenceParser,
ClpDerOctetStringParser,
ClpDerOctetString,
ClpBerTaggedObject,
ClpBerTaggedObjectParser,
ClpDefiniteLengthInputStream,
ClpDerTaggedObject,
ClpDerSequence,
ClpDerApplicationSpecific,
ClpAsn1EncodableVector,
ClpIAsn1EncodableVector,
ClpIAsn1StreamParser;
resourcestring
SUnknownObject = 'Unknown BER Object Encountered: $%x';
SIndefiniteLength = 'Indefinite Length Primitive Encoding Encountered';
SImplicitTagging = 'Implicit Tagging not Implemented';
SUnConstructedEncoding =
'Sequences Must Use Constructed Encoding (see X.690 8.9.1/8.10.1)';
SUnConstructedEncoding2 =
'Sets Must Use Constructed Encoding (see X.690 8.11.1/8.12.1)';
SUnknownTag = 'Unknown Tag " %d " Encountered';
SCorruptedStream = 'Corrupted Stream Detected: %s';
type
TAsn1StreamParser = class(TInterfacedObject, IAsn1StreamParser)
strict private
var
F_in: TStream;
F_limit: Int32;
FtmpBuffers: TCryptoLibMatrixByteArray;
procedure Set00Check(enabled: Boolean); inline;
public
constructor Create(const inStream: TStream); overload;
constructor Create(const inStream: TStream; limit: Int32); overload;
constructor Create(const encoding: TCryptoLibByteArray); overload;
destructor Destroy; override;
function ReadIndef(tagValue: Int32): IAsn1Convertible;
function ReadImplicit(constructed: Boolean; tag: Int32): IAsn1Convertible;
function ReadTaggedObject(constructed: Boolean; tag: Int32): IAsn1Object;
function ReadObject(): IAsn1Convertible; virtual;
function ReadVector(): IAsn1EncodableVector; inline;
end;
implementation
uses
ClpStreamSorter,
ClpAsn1InputStream; // included here to avoid circular dependency :)
{ TAsn1StreamParser }
procedure TAsn1StreamParser.Set00Check(enabled: Boolean);
var
indefiniteLengthInputStream: TIndefiniteLengthInputStream;
begin
if (F_in is TIndefiniteLengthInputStream) then
begin
indefiniteLengthInputStream := F_in as TIndefiniteLengthInputStream;
indefiniteLengthInputStream.SetEofOn00(enabled);
end;
end;
constructor TAsn1StreamParser.Create(const inStream: TStream);
begin
Create(inStream, TAsn1InputStream.FindLimit(inStream));
end;
constructor TAsn1StreamParser.Create(const inStream: TStream; limit: Int32);
begin
Inherited Create();
F_in := inStream;
F_limit := limit;
System.SetLength(FtmpBuffers, 16);
end;
constructor TAsn1StreamParser.Create(const encoding: TCryptoLibByteArray);
begin
// used TBytesStream here for one pass creation and population with byte array :)
Create(TBytesStream.Create(encoding), System.Length(encoding));
end;
destructor TAsn1StreamParser.Destroy;
begin
F_in.Free;
inherited Destroy;
end;
function TAsn1StreamParser.ReadVector: IAsn1EncodableVector;
var
v: IAsn1EncodableVector;
obj: IAsn1Convertible;
begin
v := TAsn1EncodableVector.Create();
obj := ReadObject();
while (obj <> Nil) do
begin
v.Add([obj.ToAsn1Object()]);
obj := ReadObject();
end;
result := v;
end;
function TAsn1StreamParser.ReadImplicit(constructed: Boolean; tag: Int32)
: IAsn1Convertible;
begin
if (F_in is TIndefiniteLengthInputStream) then
begin
if (not constructed) then
begin
raise EIOCryptoLibException.CreateRes(@SIndefiniteLength);
end;
result := ReadIndef(tag);
Exit;
end;
if (constructed) then
begin
case tag of
TAsn1Tags.&Set:
begin
result := TDerSetParser.Create(Self as IAsn1StreamParser);
Exit;
end;
TAsn1Tags.Sequence:
begin
result := TDerSequenceParser.Create(Self as IAsn1StreamParser);
Exit;
end;
TAsn1Tags.OctetString:
begin
result := TBerOctetStringParser.Create(Self as IAsn1StreamParser);
Exit;
end;
end;
end
else
begin
case tag of
TAsn1Tags.&Set:
begin
raise EAsn1CryptoLibException.CreateRes(@SUnConstructedEncoding);
end;
TAsn1Tags.Sequence:
begin
raise EAsn1CryptoLibException.CreateRes(@SUnConstructedEncoding2);
end;
TAsn1Tags.OctetString:
begin
result := TDerOctetStringParser.Create
(F_in as TDefiniteLengthInputStream);
Exit;
end;
end;
end;
raise EAsn1CryptoLibException.CreateRes(@SImplicitTagging);
end;
function TAsn1StreamParser.ReadIndef(tagValue: Int32): IAsn1Convertible;
begin
// Note: INDEF => CONSTRUCTED
// TODO There are other tags that may be constructed (e.g. BIT_STRING)
case tagValue of
TAsn1Tags.External:
begin
result := TDerExternalParser.Create(Self as IAsn1StreamParser);
Exit;
end;
TAsn1Tags.OctetString:
begin
result := TBerOctetStringParser.Create(Self as IAsn1StreamParser);
Exit;
end;
TAsn1Tags.Sequence:
begin
result := TBerSequenceParser.Create(Self as IAsn1StreamParser);
Exit;
end;
TAsn1Tags.&Set:
begin
result := TBerSetParser.Create(Self as IAsn1StreamParser);
Exit;
end;
else
begin
raise EAsn1CryptoLibException.CreateResFmt(@SUnknownObject, [tagValue]);
end;
end;
end;
function TAsn1StreamParser.ReadObject: IAsn1Convertible;
var
tag, tagNo, &length: Int32;
isConstructed: Boolean;
indIn: TIndefiniteLengthInputStream;
sp: IAsn1StreamParser;
defIn: TDefiniteLengthInputStream;
begin
tag := TStreamSorter.ReadByte(F_in);
if (tag = -1) then
begin
result := Nil;
Exit;
end;
// turn off looking for "00" while we resolve the tag
Set00Check(false);
//
// calculate tag number
//
tagNo := TAsn1InputStream.ReadTagNumber(F_in, tag);
isConstructed := (tag and TAsn1Tags.constructed) <> 0;
//
// calculate length
//
Length := TAsn1InputStream.ReadLength(F_in, F_limit);
if (Length < 0) then // indefinite length method
begin
if (not isConstructed) then
begin
raise EIOCryptoLibException.CreateRes(@SIndefiniteLength);
end;
indIn := TIndefiniteLengthInputStream.Create(F_in, F_limit);
sp := TAsn1StreamParser.Create(indIn, F_limit);
if ((tag and TAsn1Tags.Application) <> 0) then
begin
result := TBerApplicationSpecificParser.Create(tagNo, sp);
Exit;
end;
if ((tag and TAsn1Tags.Tagged) <> 0) then
begin
result := TBerTaggedObjectParser.Create(true, tagNo, sp);
Exit;
end;
result := sp.ReadIndef(tagNo);
Exit;
end;
defIn := TDefiniteLengthInputStream.Create(F_in, Length);
if ((tag and TAsn1Tags.Application) <> 0) then
begin
try
result := TDerApplicationSpecific.Create(isConstructed, tagNo,
defIn.ToArray());
Exit;
finally
defIn.Free;
end;
end;
if ((tag and TAsn1Tags.Tagged) <> 0) then
begin
result := TBerTaggedObjectParser.Create(isConstructed, tagNo,
TAsn1StreamParser.Create(defIn) as IAsn1StreamParser);
Exit;
end;
if (isConstructed) then
begin
// TODO There are other tags that may be constructed (e.g. BitString)
case tagNo of
TAsn1Tags.OctetString:
begin
//
// yes, people actually do this...
//
result := TBerOctetStringParser.Create(TAsn1StreamParser.Create(defIn)
as IAsn1StreamParser);
Exit;
end;
TAsn1Tags.Sequence:
begin
result := TDerSequenceParser.Create(TAsn1StreamParser.Create(defIn)
as IAsn1StreamParser);
Exit;
end;
TAsn1Tags.&Set:
begin
result := TDerSetParser.Create(TAsn1StreamParser.Create(defIn)
as IAsn1StreamParser);
Exit;
end;
TAsn1Tags.External:
begin
result := TDerExternalParser.Create(TAsn1StreamParser.Create(defIn)
as IAsn1StreamParser);
Exit;
end;
else
begin
defIn.Free; // free the stream incase an unsupported tag is encountered.
raise EIOCryptoLibException.CreateResFmt(@SUnknownTag, [tagNo]);
end;
end;
end;
// Some primitive encodings can be handled by parsers too...
case tagNo of
TAsn1Tags.OctetString:
begin
result := TDerOctetStringParser.Create(defIn);
Exit;
end;
end;
try
try
result := TAsn1InputStream.CreatePrimitiveDerObject(tagNo, defIn,
FtmpBuffers);
Exit;
except
on e: EArgumentCryptoLibException do
begin
raise EAsn1CryptoLibException.CreateResFmt(@SCorruptedStream,
[e.Message]);
end;
end;
finally
defIn.Free;
end;
end;
function TAsn1StreamParser.ReadTaggedObject(constructed: Boolean; tag: Int32)
: IAsn1Object;
var
defIn: TDefiniteLengthInputStream;
v: IAsn1EncodableVector;
begin
if (not constructed) then
begin
// Note: !CONSTRUCTED => IMPLICIT
defIn := F_in as TDefiniteLengthInputStream;
result := TDerTaggedObject.Create(false, tag,
TDerOctetString.Create(defIn.ToArray()));
Exit;
end;
v := ReadVector();
if (F_in is TIndefiniteLengthInputStream) then
begin
if v.Count = 1 then
begin
result := TBerTaggedObject.Create(true, tag, v[0]);
Exit;
end
else
begin
result := TBerTaggedObject.Create(false, tag, TBerSequence.FromVector(v));
Exit;
end;
end;
if v.Count = 1 then
begin
result := TDerTaggedObject.Create(true, tag, v[0]);
Exit;
end
else
begin
result := TDerTaggedObject.Create(false, tag, TDerSequence.FromVector(v));
Exit;
end;
end;
end.
|
unit ActorPool;
interface
uses
StateEngine, DistributedStates, ActorTypes, Classes, Collection, SyncObjs, Windows;
type
TActorPoolId = integer;
type
TServerActorData =
class
public
constructor Create( anActor : IServerActor );
destructor Destroy; override;
private
fActor : IServerActor;
fViewers : TLockableCollection;
end;
type
TServerViewerData =
class
public
constructor Create( aViewer : IViewer );
destructor Destroy; override;
private
fViewer : IViewer;
fTickData : TStream;
public
procedure ClearTickData;
end;
type
TScopeChange =
class
public
constructor Create( aChangeType : TDataType; aViewer : TServerViewerData; anActorId : TActorId; anActor : IServerActor );
private
fChangeType : TDataType;
fViewer : TServerViewerData;
fActorId : TActorId;
fActor : IServerActor;
public
property ChangeType : TDataType read fChangeType;
property Viewer : TServerViewerData read fViewer;
property ActorId : TActorId read fActorId;
property Actor : IServerActor read fActor;
end;
type
TActorPool =
class
public
constructor Create( anId : TActorPoolId );
destructor Destroy; override;
private
fId : TActorPoolId;
fActors : TLockableCollection;
fLock : TCriticalSection;
fTickCount : cardinal;
public
property Id : TActorPoolId read fId;
public
property TickCount : cardinal read fTickCount;
public
procedure Lock;
procedure Unlock;
end;
TOnSendTickData = procedure( PoolId : TActorPoolId; ViewerId : TViewerId; TickCount : cardinal; TickData : TStream ) of object; //>> puesto por mi el of object
TServerActorPool =
class( TActorPool )
public
constructor Create( anId : TActorPoolId; aDistProc : TOnDistributedData );
destructor Destroy; override;
private
fDistProc : TOnDistributedData;
public
procedure Act; virtual;
private
fViewers : TLockableCollection;
fNewMeat : TLockableCollection;
public
procedure AddActor ( Actor : IServerActor );
procedure DelActor ( Actor : IServerActor );
procedure AddViewer( Viewer : IViewer );
procedure DelViewer( Viewer : IViewer );
private
fScopeChanges : TLockableCollection;
protected
function CheckScopes : TCollection; virtual;
procedure SerializeData( DataType : TDataType; Source : IServerActor; const Data; TickData : TStream ); virtual;
private
fSendTickData : TOnSendTickData;
public
property SendTickData : TOnSendTickData read fSendTickData write fSendTickData;
protected
procedure ProcessTickData( ViewerId : TViewerId; TickCount : cardinal; const TickData : TStream ); virtual;
private
procedure PoolDistProc( DataType : TDataType; Sender : TStatePool; const DataInfo );
private
function GetActorData( Actor : IServerActor ) : TServerActorData;
function GetViewerData( Viewer : IViewer ) : TServerViewerData;
function GetActorFromPool( Pool : TStatePool ) : TServerActorData;
end;
type
TClientActorFactory = function( ActorKind : TActorKind; ActorId : TActorId ) : IClientActor of object;
TMetaPoolLocator = function( MetaPoolId : TMetaPoolId ) : TMetaStatePool;
TClientActorData =
class
public
constructor Create( anActor : IClientActor );
private
fActor : IClientActor;
end;
TClientActorPool =
class( TActorPool )
public
procedure Act( TickData : TStream ); virtual;
procedure HighResAct; virtual;
protected
procedure ParseServerData( DataType : TDataType; TickData : TStream );
private
fClientActorFactory : TClientActorFactory;
fMetaPoolLocator : TMetaPoolLocator;
public
property ClientActorFactory : TClientActorFactory read fClientActorFactory write fClientActorFactory;
property MetaPoolLocator : TMetaPoolLocator read fMetaPoolLocator write fMetaPoolLocator;
private
function GetActorFromId( Id : TActorId ) : TClientActorData;
end;
const
dtActorPoolTick = 210;
dtActorEntersScope = 211;
dtActorLeavesScope = 212;
type
TActorScopeInfo =
record
ScopeChange : TScopeChange;
end;
implementation
uses
LogFile, SysUtils;
// TServerActorData
constructor TServerActorData.Create( anActor : IServerActor );
begin
inherited Create;
fActor := anActor;
fViewers := TLockableCollection.Create( 0, rkUse );
end;
destructor TServerActorData.Destroy;
begin
fViewers.Free;
inherited;
end;
// TScopeChange
constructor TScopeChange.Create( aChangeType : TDataType; aViewer : TServerViewerData; anActorId : TActorId; anActor : IServerActor );
begin
inherited Create;
fChangeType := aChangeType;
fViewer := aViewer;
fActorId := anActorId;
fActor := anActor;
end;
// TServerViewerData
constructor TServerViewerData.Create( aViewer : IViewer );
begin
inherited Create;
fViewer := aViewer;
fTickData := TMemoryStream.Create;
end;
destructor TServerViewerData.Destroy;
begin
fTickData.Free;
inherited;
end;
procedure TServerViewerData.ClearTickData;
begin
fTickData.Size := 0;
fTickData.Position := 0;
end;
// TActorPool
constructor TActorPool.Create( anId : TActorPoolId );
begin
inherited Create;
fId := anId;
fActors := TLockableCollection.Create( 0, rkBelonguer );
fLock := TCriticalSection.Create;
end;
destructor TActorPool.Destroy;
begin
fLock.Free;
fActors.Free;
inherited;
end;
procedure TActorPool.Lock;
begin
fLock.Enter;
end;
procedure TActorPool.Unlock;
begin
fLock.Leave;
end;
// TServerActorPool
constructor TServerActorPool.Create( anId : TActorPoolId; aDistProc : TOnDistributedData );
begin
inherited Create( anId );
fDistProc := aDistProc;
fViewers := TLockableCollection.Create( 0, rkBelonguer );
fNewMeat := TLockableCollection.Create( 0, rkBelonguer );
fScopeChanges := TLockableCollection.Create( 0, rkBelonguer );
end;
destructor TServerActorPool.Destroy;
begin
fViewers.Free;
fNewMeat.Free;
fScopeChanges.Free;
inherited;
end;
procedure TServerActorPool.Act;
procedure IncludeNewMeat;
var
i : integer;
Data : TServerActorData;
begin
fNewMeat.Lock;
try
for i := 0 to pred(fNewMeat.Count) do
begin
Data := TServerActorData.Create( IServerActor(pointer(fNewMeat[i])) );
Data.fActor.getStatePool.OnDistributedData := PoolDistProc;
fActors.Insert( Data );
end;
fNewMeat.ExtractAll;
finally
fNewMeat.Unlock;
end;
end;
procedure InitTickData;
var
i : integer;
begin
for i := 0 to pred(fViewers.Count) do
with TServerViewerData(fViewers[i]) do
try
SerializeData( dtActorPoolTick, nil, fTickCount, fTickData );
except
end;
end;
procedure PackScopeChanges;
var
NewChanges : TCollection;
i : integer;
SC : TScopeChange;
VD : TServerViewerData;
Info : TActorScopeInfo;
begin
NewChanges := CheckScopes;
try
fScopeChanges.InsertColl( NewChanges );
NewChanges.ExtractAll;
finally
NewChanges.Free;
end;
for i := 0 to pred(fScopeChanges.Count) do
begin
SC := TScopeChange(fScopeChanges[i]);
VD := SC.Viewer;
if VD <> nil
then
begin
Info.ScopeChange := SC;
SerializeData( SC.ChangeType, nil, Info, VD.fTickData )
end;
end;
fScopeChanges.DeleteAll;
end;
procedure ExecutePools;
var
i : integer;
begin
for i := 0 to pred(fActors.Count) do
with TServerActorData(fActors[i]) do
try
fActor.getStatePool.PreAct( amdSynchronized );
fActor.getStatePool.Act( amdSynchronized );
fActor.getStatePool.PostAct( amdSynchronized );
except
end;
end;
procedure FlushTickData;
var
i : integer;
begin
for i := 0 to pred(fViewers.Count) do
with TServerViewerData(fViewers[i]) do
try
ProcessTickData( fViewer.getId, fTickCount, fTickData );
ClearTickData;
except
end;
end;
begin
inherited;
Lock;
try
inc( fTickCount );
IncludeNewMeat;
InitTickData;
PackScopeChanges;
ExecutePools;
FlushTickData;
finally
Unlock
end;
end;
procedure TServerActorPool.AddActor( Actor : IServerActor );
begin
Lock;
try
fNewMeat.Insert( TObject(Actor) );
finally
Unlock;
end
end;
procedure TServerActorPool.DelActor( Actor : IServerActor );
var
AD : TServerActorData;
VD : TServerViewerData;
i : integer;
SC : TScopeChange;
begin
Lock;
try
if fNewMeat.IndexOf( TObject(Actor) ) = NoIndex
then
begin
AD := GetActorData( Actor );
if AD <> nil
then
begin
for i := 0 to pred(AD.fViewers.Count) do
begin
VD := TServerViewerData(AD.fViewers[i]);
SC := TScopeChange.Create( dtActorLeavesScope, VD, Actor.getId, nil );
fScopeChanges.Insert( SC );
end;
fActors.Delete( AD );
end;
end
else fNewMeat.Delete( TObject(Actor) );
finally
Unlock;
end
end;
procedure TServerActorPool.AddViewer( Viewer : IViewer );
var
VD : TServerViewerData;
begin
Lock;
try
VD := GetViewerData( Viewer );
if VD = nil
then
begin
VD := TServerViewerData.Create( Viewer );
fViewers.Insert( VD );
end;
finally
Unlock;
end;
end;
procedure TServerActorPool.DelViewer( Viewer : IViewer );
var
VD : TServerViewerData;
i : integer;
begin
Lock;
try
VD := GetViewerData( Viewer );
if VD <> nil
then
begin
for i := 0 to pred(fActors.Count) do
TServerActorData(fActors[i]).fViewers.Delete( VD );
fViewers.Delete( VD );
end;
finally
Unlock;
end;
end;
function TServerActorPool.CheckScopes : TCollection;
var
i, j : integer;
AD : TServerActorData;
VD : TServerViewerData;
SC : TScopeChange;
begin
result := TCollection.Create( 0, rkUse );
for i := 0 to pred(fActors.Count) do
begin
AD := TServerActorData(fActors[i]);
for j := 0 to pred(fViewers.Count) do
try
VD := TServerViewerData(fViewers[j]); //>> aqui decia i
if VD.fViewer.IsAwareOf( AD.fActor )
then
begin
if AD.fViewers.IndexOf( VD ) = NoIndex
then
begin
// The actor just entered viewer's area
SC := TScopeChange.Create( dtActorEntersScope, VD, AD.fActor.getId, AD.fActor );
result.Insert( SC );
AD.fViewers.Insert( VD ); //>> puesto por mi
end;
end
else
begin
if AD.fViewers.IndexOf( VD ) <> NoIndex
then
begin
// The actor just leaved viewer's area
SC := TScopeChange.Create( dtActorLeavesScope, VD, AD.fActor.getId, AD.fActor );
result.Insert( SC );
AD.fViewers.Delete( VD ); //>> puesto por mi
end;
end
except
end;
end;
end;
procedure TServerActorPool.SerializeData( DataType : TDataType; Source : IServerActor; const Data; TickData : TStream );
var
ActorScope : TActorScopeInfo absolute Data;
StateTransition : TStateTransitionInfo absolute Data;
EventInfo : TEventInfo absolute Data;
ActorKind : TActorKind;
AD : TServerActorData;
ActorId : TActorId;
begin
TickData.Write( DataType, sizeof(DataType) );
case DataType of
dtActorPoolTick :
begin
TickData.Write( fTickCount, sizeof(fTickCount) );
end;
dtActorEntersScope :
begin
TickData.Write( ActorScope.ScopeChange.fActorId, sizeof(ActorScope.ScopeChange.fActorId) );
ActorKind := ActorScope.ScopeChange.Actor.getKind;
TickData.Write( ActorKind, sizeof(ActorKind) );
ActorScope.ScopeChange.Actor.Store( TickData );
TickData.Write( ActorScope.ScopeChange.Actor.getStatePool.MetaStatePool.Id, sizeof(ActorScope.ScopeChange.Actor.getStatePool.MetaStatePool.Id) );
ActorScope.ScopeChange.Actor.getStatePool.ClientSerialize( TickData );
LogThis( 'Server Actor entry: ' + IntToStr(ActorScope.ScopeChange.fActorId) );
end;
dtActorLeavesScope :
begin
TickData.Write( ActorScope.ScopeChange.fActorId, sizeof(ActorScope.ScopeChange.fActorId) );
LogThis( 'Server Actor exit: ' + IntToStr(ActorScope.ScopeChange.fActorId) );
end;
dtStateTransition :
begin
AD := GetActorFromPool( StateTransition.StatePool );
ActorId := AD.fActor.getId;
TickData.Write( ActorId, sizeof(ActorId) ); //>> to esto es mio
Source.getStatePool.SerializeTransition( TickData, StateTransition.LauncherId, StateTransition.State, StateTransition.Behaviour );
end;
dtEvent :
begin
AD := GetActorFromPool( EventInfo.StatePool );
ActorId := AD.fActor.getId;
TickData.Write( ActorId, sizeof(ActorId) ); //>> to esto es mio
EventInfo.Event.Store( TickData );
end;
end;
end;
procedure TServerActorPool.ProcessTickData( ViewerId : TViewerId; TickCount : cardinal; const TickData : TStream );
begin
if assigned(SendTickData)
then SendTickData( Id, ViewerId, TickCount, TickData );
end;
procedure TServerActorPool.PoolDistProc( DataType : TDataType; Sender : TStatePool; const DataInfo );
var
AD : TServerActorData;
i : integer;
begin
AD := GetActorFromPool( Sender );
if AD <> nil
then
for i := 0 to pred(AD.fViewers.Count) do
SerializeData( DataType, AD.fActor, DataInfo, TServerViewerData(AD.fViewers[i]).fTickData );
end;
function TServerActorPool.GetActorData( Actor : IServerActor ) : TServerActorData;
var
i : integer;
begin
i := 0;
while (i < fActors.Count) and (TServerActorData(fActors[i]).fActor <> Actor) do
inc( i );
if i < fActors.Count
then result := TServerActorData(fActors[i])
else result := nil;
end;
function TServerActorPool.GetViewerData( Viewer : IViewer ) : TServerViewerData;
var
i : integer;
begin
i := 0;
while (i < fViewers.Count) and (TServerViewerData(fViewers[i]).fViewer <> Viewer) do
inc( i );
if i < fViewers.Count
then result := TServerViewerData(fViewers[i])
else result := nil;
end;
function TServerActorPool.GetActorFromPool( Pool : TStatePool ) : TServerActorData;
var
i : integer;
begin
i := 0;
while (i < fActors.Count) and (TServerActorData(fActors[i]).fActor.getStatePool <> Pool) do
inc( i );
if i < fActors.Count
then result := TServerActorData(fActors[i])
else result := nil;
end;
// TClientActorData
constructor TClientActorData.Create( anActor : IClientActor );
begin
inherited Create;
fActor := anActor;
end;
// TClientActorPool
procedure TClientActorPool.Act( TickData : TStream );
procedure ExecutePools;
var
i : integer;
begin
for i := 0 to pred(fActors.Count) do
try
TClientActorData(fActors[i]).fActor.getStatePool.PreAct( amdSynchronized );
TClientActorData(fActors[i]).fActor.getStatePool.Act( amdSynchronized );
TClientActorData(fActors[i]).fActor.getStatePool.PostAct( amdSynchronized );
except
end;
end;
var
DataType : TDataType;
begin
Lock;
try
while (TickData.Position < TickData.Size) do
begin
TickData.Read( DataType, sizeof(DataType) );
ParseServerData( DataType, TickData );
end;
ExecutePools;
finally
Unlock;
end;
end;
procedure TClientActorPool.HighResAct;
var
i : integer;
begin
Lock;
try
for i := 0 to pred(fActors.Count) do
try
TClientActorData(fActors[i]).fActor.getStatePool.PreAct( amdHighRes );
TClientActorData(fActors[i]).fActor.getStatePool.Act( amdHighRes );
TClientActorData(fActors[i]).fActor.getStatePool.PostAct( amdHighRes );
except
end;
finally
Unlock;
end;
end;
procedure TClientActorPool.ParseServerData( DataType : TDataType; TickData : TStream );
var
ActorId : TActorId;
ActorKind : TActorKind;
AD : TClientActorData;
NewActor : IClientActor;
MetaPoolId : TMetaPoolId;
MetaPool : TMetaStatePool;
NewPool : TClientStatePool;
Event : TDistributedEvent;
begin
case DataType of
dtActorPoolTick :
begin
TickData.Read( fTickCount, sizeof(fTickCount) );
LogThis( 'Client TickCount: ' + IntToStr(fTickCount) );
end;
dtActorEntersScope :
begin
TickData.Read( ActorId, sizeof(ActorId) );
TickData.Read( ActorKind, sizeof(ActorKind) );
NewActor := ClientActorFactory( ActorKind, ActorId );
NewActor.Load( TickData );
TickData.Read( MetaPoolId, sizeof(MetaPoolId) );
MetaPool := MetaPoolLocator( MetaPoolId );
NewPool := TClientStatePool.LoadFromServer( TickData, MetaPool, 1 );
NewActor.setStatePool( NewPool );
fActors.Insert( TClientActorData.Create( NewActor ) );
NewActor.Inserted;
LogThis( 'Client Actor entry: ' + IntToStr(ActorId) );
end;
dtActorLeavesScope :
begin
TickData.Read( ActorId, sizeof(ActorId) );
AD := GetActorFromId( ActorId );
if AD <> nil
then
begin
AD.fActor.Deleted;
fActors.Delete( AD );
end;
LogThis( 'Client Actor exit: ' + IntToStr(ActorId) );
end;
dtStateTransition :
begin
TickData.Read( ActorId, sizeof(ActorId) );
AD := GetActorFromId( ActorId );
AD.fActor.getStatePool.LoadTransition( TickData );
end;
dtEvent :
begin
TickData.Read( ActorId, sizeof(ActorId) );
AD := GetActorFromId( ActorId );
Event := TDistributedEvent.Load( TickData );
AD.fActor.getStatePool.ThrowEvent( nil, Event );
end;
end;
end;
function TClientActorPool.GetActorFromId( Id : TActorId ) : TClientActorData;
var
i : integer;
begin
i := 0;
while (i < fActors.Count) and (TClientActorData(fActors[i]).fActor.getId <> Id) do
inc( i );
if i < fActors.Count
then result := TClientActorData(fActors[i])
else result := nil;
end;
end.
|
{ *********************************************************************************** }
{ * CryptoLib Library * }
{ * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * }
{ * Github Repository <https://github.com/Xor-el> * }
{ * Distributed under the MIT software license, see the accompanying file LICENSE * }
{ * or visit http://www.opensource.org/licenses/mit-license.php. * }
{ * Acknowledgements: * }
{ * * }
{ * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * }
{ * development of this library * }
{ * ******************************************************************************* * }
(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
unit ClpStreamHelper;
{$I ..\..\Include\CryptoLib.inc}
interface
uses
Classes,
ClpCryptoLibTypes;
type
TStreamHelper = class helper for TStream
public
function ReadByte(): Int32;
procedure WriteByte(b: Byte); inline;
end;
implementation
uses
ClpStreamSorter; // included here to avoid circular dependency :)
{ TStreamHelper }
function TStreamHelper.ReadByte: Int32;
var
Buffer: TCryptoLibByteArray;
begin
System.SetLength(Buffer, 1);
if (TStreamSorter.Read(Self, Buffer, 0, 1) = 0) then
begin
result := -1;
end
else
begin
result := Int32(Buffer[0]);
end;
end;
procedure TStreamHelper.WriteByte(b: Byte);
var
oneByteArray: TCryptoLibByteArray;
begin
System.SetLength(oneByteArray, 1);
oneByteArray[0] := b;
// Self.Write(oneByteArray, 0, 1);
Self.Write(oneByteArray[0], 1);
end;
end.
|
unit K296094711;
{* [Requestlink:296094711] }
// Модуль: "w:\archi\source\projects\Archi\Tests\K296094711.pas"
// Стереотип: "TestCase"
// Элемент модели: "K296094711" MUID: (4EA95209036F)
// Имя типа: "TK296094711"
{$Include w:\archi\source\projects\Archi\arDefine.inc}
interface
{$If Defined(nsTest) AND Defined(InsiderTest)}
uses
l3IntfUses
{$If NOT Defined(NoScripts)}
, ArchiInsiderTest
{$IfEnd} // NOT Defined(NoScripts)
;
type
TK296094711 = class({$If NOT Defined(NoScripts)}
TArchiInsiderTest
{$IfEnd} // NOT Defined(NoScripts)
)
{* [Requestlink:296094711] }
protected
function GetFolder: AnsiString; override;
{* Папка в которую входит тест }
function GetModelElementGUID: AnsiString; override;
{* Идентификатор элемента модели, который описывает тест }
end;//TK296094711
{$IfEnd} // Defined(nsTest) AND Defined(InsiderTest)
implementation
{$If Defined(nsTest) AND Defined(InsiderTest)}
uses
l3ImplUses
, TestFrameWork
//#UC START# *4EA95209036Fimpl_uses*
//#UC END# *4EA95209036Fimpl_uses*
;
{$If NOT Defined(NoScripts)}
function TK296094711.GetFolder: AnsiString;
{* Папка в которую входит тест }
begin
Result := 'EditorTests';
end;//TK296094711.GetFolder
function TK296094711.GetModelElementGUID: AnsiString;
{* Идентификатор элемента модели, который описывает тест }
begin
Result := '4EA95209036F';
end;//TK296094711.GetModelElementGUID
initialization
TestFramework.RegisterTest(TK296094711.Suite);
{$IfEnd} // NOT Defined(NoScripts)
{$IfEnd} // Defined(nsTest) AND Defined(InsiderTest)
end.
|
unit uChamadoDetalhes2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls, uEnumerador,
uChamadoController, Data.DB, Datasnap.DBClient, uChamadoColaboradorVO, uChamadoVO,
System.Generics.Collections, Vcl.ExtCtrls;
const
COR_ABERTURA: Integer = clRed;
COR_OCORR_GERAL: Integer = clPurple;
COR_STATUS: Integer = clOlive;
COR_PADRAO: Integer = clBlack;
COR_TITULO: Integer = clRed;
TAMANHO_DIVISAO: Integer = 164;
TRACO: Char = '_';
type
TfrmChamadoDetalhes2 = class(TForm)
mmoGeral: TRichEdit;
cdsDados: TClientDataSet;
cdsDadosDocumento: TStringField;
cdsDadosData: TDateField;
cdsDadosHoraInicial: TStringField;
cdsDadosHoraFinal: TStringField;
cdsDadosUsuario: TStringField;
cdsDadosColaborador1: TStringField;
cdsDadosColaborador2: TStringField;
cdsDadosColaborador3: TStringField;
cdsDadosDescricaoProblema: TStringField;
cdsDadosDescricaoSolucao: TStringField;
cdsDadosAnexo: TStringField;
cdsDadosNomeStatus: TStringField;
cdsDadosTipo: TIntegerField;
cdsDadosIdOcorrencia: TIntegerField;
cdsStatus: TClientDataSet;
cdsStatusData: TDateField;
cdsStatusHora: TTimeField;
cdsStatusNomeStatus: TStringField;
cdsStatusNomeUsuario: TStringField;
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
FIdChamado: Integer;
FTipoMovimento: TEnumChamadoAtividade;
FStatus: string;
FListaColaboradores: TObjectList<TChamadoColaboradorVO>;
procedure FormatarLinha(var AMemo: TRichEdit; ACor: Integer; ATexto: string; ANegrito: Boolean = False); overload;
procedure ListarDados;
procedure PreecherAbertura(AObj: TChamadoController);
procedure PreecherOcorrencia(AObj: TChamadoController);
procedure PreecherColaborador(AObj: TChamadoController);
procedure PreencherStatus(AObj: TChamadoController);
procedure ListarOcorrencia(AObj: TChamadoController);
procedure ListarStatus(AObj: TChamadoController);
procedure TracoDivisao();
procedure DadosTempo();
public
{ Public declarations }
constructor create(AIdChamado: integer; ATipo: TEnumChamadoAtividade = caChamado);
end;
var
frmChamadoDetalhes2: TfrmChamadoDetalhes2;
implementation
{$R *.dfm}
uses uClienteController, uDM;
{ TfrmChamadoDetalhes2 }
constructor TfrmChamadoDetalhes2.create(AIdChamado: integer;
ATipo: TEnumChamadoAtividade);
begin
inherited create(nil);
dm.ConexaoBanco;
FIdChamado := AIdChamado;
FTipoMovimento := ATipo;
cdsStatus.CreateDataSet;
cdsDados.CreateDataSet;
cdsStatus.IndexFieldNames := 'Data;Hora';
cdsDados.IndexFieldNames := 'Data';
FListaColaboradores := TObjectList<TChamadoColaboradorVO>.Create;
ListarDados();
end;
procedure TfrmChamadoDetalhes2.DadosTempo;
var
obj: TChamadoController;
sTempo: string;
begin
obj := TChamadoController.Create;
try
sTempo := obj.BuscarTotalHorasDoChamado(FIdChamado);
FormatarLinha(mmoGeral, COR_TITULO, 'TEMPO TOTAL: ' + sTempo, True);
FormatarLinha(mmoGeral, COR_PADRAO, StringOfChar(TRACO, TAMANHO_DIVISAO));
mmoGeral.Lines.Add('');
finally
FreeAndNil(obj);
end;
end;
procedure TfrmChamadoDetalhes2.FormatarLinha(var AMemo: TRichEdit;
ACor: Integer; ATexto: string; ANegrito: Boolean);
begin
AMemo.SelAttributes.Color := ACor;
if ANegrito then
AMemo.SelAttributes.Style:=[fsBold];
AMemo.Lines.Add(ATexto);
AMemo.SelAttributes.Color:=Color;
end;
procedure TfrmChamadoDetalhes2.FormDestroy(Sender: TObject);
begin
FreeAndNil(FListaColaboradores);
end;
procedure TfrmChamadoDetalhes2.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_ESCAPE then
Close;
end;
procedure TfrmChamadoDetalhes2.ListarDados;
var
Obj: TChamadoController;
begin
Obj := TChamadoController.Create;
try
Obj.Editar(FIdChamado, Self, FTipoMovimento);
PreecherAbertura(Obj);
PreecherOcorrencia(Obj);
PreencherStatus(Obj);
ListarOcorrencia(Obj);
DadosTempo();
ListarStatus(Obj);
finally
FreeAndNil(Obj);
end;
end;
procedure TfrmChamadoDetalhes2.ListarOcorrencia(AObj: TChamadoController);
var
Item: TChamadoColaboradorVO;
iColaborador: Integer;
begin
cdsDados.First;
while not cdsDados.Eof do
begin
if cdsDadosHoraInicial.AsString <> '' then
begin
FormatarLinha(mmoGeral,COR_TITULO, 'OCORRÊNCIA', True);
FormatarLinha(mmoGeral,COR_PADRAO, 'Documento: ' + cdsDadosDocumento.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Data: ' + cdsDadosData.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Hora Inicial: ' + cdsDadosHoraInicial.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Hora Final: ' + cdsDadosHoraFinal.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Usuário: ' + cdsDadosUsuario.AsString);
// buscar colaboradores
iColaborador := 1;
if cdsDadosIdOcorrencia.AsInteger > 0 then
begin
for Item in FListaColaboradores do
begin
if Item.IdOcorrencia = cdsDadosIdOcorrencia.AsInteger then
begin
FormatarLinha(mmoGeral,COR_PADRAO, 'Colaborador : ' + IntToStr(iColaborador) + ' - ' + Item.UsuarioVO.Nome);
Inc(iColaborador);
end;
// AObj.LocalizarChamadoColaborador(cdsDadosIdOcorrencia.AsInteger);
// while not AObj.Model.CDSChamadoOcorrColaborador.Eof do
// begin
// AObj.Model.CDSChamadoOcorrColaboradorUsu_Nome.AsString;
// FormatarLinha(mmoGeral,COR_PADRAO, 'Colaborador ' + IntToStr(iColaborador) + ': ' + AObj.Model.CDSChamadoOcorrColaboradorUsu_Nome.AsString);
// AObj.Model.CDSChamadoOcorrColaborador.Next;
// Inc(iColaborador);
// end;
end;
end;
FormatarLinha(mmoGeral,COR_PADRAO, 'Anexo: ' + cdsDadosAnexo.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Descrição Problema: ' + cdsDadosDescricaoProblema.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Descrição Solução: ' + cdsDadosDescricaoSolucao.AsString);
mmoGeral.Lines.Add('');
TracoDivisao();
mmoGeral.Lines.Add('');
end;
cdsDados.Next;
end;
end;
procedure TfrmChamadoDetalhes2.ListarStatus(AObj: TChamadoController);
begin
cdsStatus.First;
while not cdsStatus.Eof do
begin
if cdsStatusNomeStatus.AsString <> '' then
begin
FormatarLinha(mmoGeral,COR_TITULO, 'STATUS', True);
FormatarLinha(mmoGeral,COR_PADRAO, 'Data: ' + cdsStatusData.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Hora: ' + cdsStatusHora.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Status: ' + cdsStatusNomeStatus.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Usuário: ' + cdsStatusNomeUsuario.AsString);
mmoGeral.Lines.Add('');
TracoDivisao();
mmoGeral.Lines.Add('');
end;
cdsStatus.Next;
end;
FormatarLinha(mmoGeral,COR_TITULO, FStatus, True);
mmoGeral.SelStart := Perform(EM_LINEINDEX, 0, 0);
end;
procedure TfrmChamadoDetalhes2.PreecherAbertura(AObj: TChamadoController);
var
sNivel: string;
Cliente: TClienteController;
sRevenda: string;
sConsultor: string;
begin
if AObj.PermissaoChamadoAbertura(dm.IdUsuario) = False then
Exit;
Cliente := TClienteController.Create;
try
Cliente.LocalizarId(AObj.Model.CDSCadastroCha_Cliente.AsInteger);
sRevenda := Cliente.Model.CDSCadastroRev_Nome.AsString;
sConsultor := Cliente.Model.CDSCadastroUsu_Nome.AsString;
finally
FreeAndNil(Cliente);
end;
if AObj.Model.CDSCadastroCha_Nivel.AsInteger = 1 then
sNivel := 'Baixo'
else if AObj.Model.CDSCadastroCha_Nivel.AsInteger = 2 then
sNivel := 'Normal'
else if AObj.Model.CDSCadastroCha_Nivel.AsInteger = 3 then
sNivel := 'Alto'
else if AObj.Model.CDSCadastroCha_Nivel.AsInteger = 4 then
sNivel := 'Crítico';
mmoGeral.Lines.Add('');
FormatarLinha(mmoGeral,COR_TITULO, 'ABERTURA', True);
FormatarLinha(mmoGeral,COR_PADRAO, 'Id: ' + FormatFloat('000000',AObj.Model.CDSCadastroCha_Id.AsFloat) +
' - Data Abertura: ' + AObj.Model.CDSCadastroCha_DataAbertura.AsString +
' - Hora: ' + FormatDateTime('hh:mm',AObj.Model.CDSCadastroCha_HoraAbertura.AsDateTime) +
' - Usuário Abertura: ' + AObj.Model.CDSCadastroUsu_Nome.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Cliente: ' + AObj.Model.CDSCadastroCli_Nome.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Contato: ' + AObj.Model.CDSCadastroCha_Contato.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Nivel: ' + sNivel);
FormatarLinha(mmoGeral,COR_PADRAO, 'Módulo: ' + AObj.Model.CDSCadastroMod_Nome.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Produto: ' + AObj.Model.CDSCadastroProd_Nome.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Tipo: ' + AObj.Model.CDSCadastroTip_Nome.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Status: ' + AObj.Model.CDSCadastroSta_Nome.AsString);
FormatarLinha(mmoGeral,COR_PADRAO, 'Revenda: ' + sRevenda);
FormatarLinha(mmoGeral,COR_PADRAO, 'Consultor: ' + sConsultor);
FormatarLinha(mmoGeral,COR_PADRAO, 'Descrição: ' + AObj.Model.CDSCadastroCha_Descricao.AsString);
mmoGeral.Lines.Add('');
TracoDivisao();
mmoGeral.Lines.Add('');
FStatus := 'Status Atual: ' + AObj.Model.CDSCadastroSta_Nome.AsString;
PreecherColaborador(AObj);
end;
procedure TfrmChamadoDetalhes2.PreecherColaborador(AObj: TChamadoController);
var
VO: TChamadoColaboradorVO;
begin
AObj.LocalizarChamadoColaborador(AObj.Model.CDSCadastroCha_Id.AsInteger);
while not AObj.Model.CDSChamadoOcorrColaborador.Eof do
begin
VO := TChamadoColaboradorVO.Create;
VO.UsuarioVO.Nome := AObj.Model.CDSChamadoOcorrColaboradorUsu_Nome.AsString;
VO.IdOcorrencia := AObj.Model.CDSChamadoOcorrColaboradorChaOCol_ChamadoOcorrencia.AsInteger;
FListaColaboradores.Add(VO);
AObj.Model.CDSChamadoOcorrColaborador.Next;
end;
end;
procedure TfrmChamadoDetalhes2.PreecherOcorrencia(AObj: TChamadoController);
begin
if AObj.PermissaoChamadoOcorrencia(dm.IdUsuario) = False then
Exit;
while not AObj.Model.CDSChamadoOcorrenciaCons.Eof do
begin
cdsDados.Append;
cdsDadosTipo.AsInteger := 1;
cdsDadosDocumento.AsString := AObj.Model.CDSChamadoOcorrenciaConsChOco_Docto.AsString;
cdsDadosData.AsDateTime := AObj.Model.CDSChamadoOcorrenciaConsChOco_Data.AsDateTime;
cdsDadosHoraInicial.AsString := FormatDateTime('hh:mm', AObj.Model.CDSChamadoOcorrenciaConsChOco_HoraInicio.AsDateTime);
cdsDadosHoraFinal.AsString := FormatDateTime('hh:mm', AObj.Model.CDSChamadoOcorrenciaConsChOco_HoraFim.AsDateTime);
cdsDadosUsuario.AsString := AObj.Model.CDSChamadoOcorrenciaConsUsu_Nome.AsString;
cdsDadosDescricaoProblema.AsString := AObj.Model.CDSChamadoOcorrenciaConsChOco_DescricaoTecnica.AsString;
cdsDadosDescricaoSolucao.AsString := AObj.Model.CDSChamadoOcorrenciaConsChOco_DescricaoSolucao.AsString;
cdsDadosAnexo.AsString := AObj.Model.CDSChamadoOcorrenciaConsChOco_Anexo.AsString;
cdsDadosIdOcorrencia.AsInteger := AObj.Model.CDSChamadoOcorrenciaConsChOco_Id.AsInteger;
cdsDados.Post;
AObj.Model.CDSChamadoOcorrenciaCons.Next;
end;
end;
procedure TfrmChamadoDetalhes2.PreencherStatus(AObj: TChamadoController);
begin
if AObj.PermissaoChamadoStatus(dm.IdUsuario) = False then
Exit;
while not AObj.Model.CDSChamadoStatus.Eof do
begin
cdsStatus.Append;
cdsStatusData.AsDateTime := AObj.Model.CDSChamadoStatusChSta_Data.AsDateTime;
cdsStatusHora.AsDateTime := AObj.Model.CDSChamadoStatusChSta_Hora.AsDateTime;
cdsStatusNomeStatus.AsString := AObj.Model.CDSChamadoStatusSta_Nome.AsString;
cdsStatusNomeUsuario.AsString := AObj.Model.CDSChamadoStatusUsu_Nome.AsString;
cdsStatus.Post;
AObj.Model.CDSChamadoStatus.Next;
end;
end;
procedure TfrmChamadoDetalhes2.TracoDivisao;
begin
FormatarLinha(mmoGeral, COR_PADRAO, StringOfChar(TRACO, TAMANHO_DIVISAO));
end;
end.
|
namespace Sugar.Test;
interface
uses
Sugar,
Sugar.IO,
RemObjects.Elements.EUnit;
type
FolderUtilsTest = public class (Test)
private
FolderName: String;
SubFolder: String;
public
method Setup; override;
method TearDown; override;
method &Create;
method Delete;
method Exists;
method GetFiles;
method GetFolders;
end;
implementation
method FolderUtilsTest.Setup;
begin
var lFolder := Folder.UserLocal.CreateFolder("SugarTest", false);
FolderName := lFolder.Path;
SubFolder := Path.Combine(lFolder.Path, "SubFolder");
end;
method FolderUtilsTest.TearDown;
begin
if FolderUtils.Exists(FolderName) then
FolderUtils.Delete(FolderName);
end;
method FolderUtilsTest.Create;
begin
Assert.IsFalse(FolderUtils.Exists(SubFolder));
FolderUtils.Create(SubFolder);
Assert.IsTrue(FolderUtils.Exists(SubFolder));
Assert.Throws(->FolderUtils.Create(SubFolder));
Assert.Throws(->FolderUtils.Create(nil));
end;
method FolderUtilsTest.Delete;
begin
Assert.IsFalse(FolderUtils.Exists(SubFolder));
FolderUtils.Create(SubFolder);
Assert.IsTrue(FolderUtils.Exists(SubFolder));
FolderUtils.Delete(SubFolder);
Assert.IsFalse(FolderUtils.Exists(SubFolder));
Assert.Throws(->FolderUtils.Delete(SubFolder));
Assert.Throws(->FolderUtils.Delete(nil));
FolderUtils.Create(SubFolder);
FileUtils.Create(Path.Combine(SubFolder, "1"));
FileUtils.Create(Path.Combine(SubFolder, "2"));
FolderUtils.Delete(FolderName);
Assert.IsFalse(FolderUtils.Exists(FolderName));
end;
method FolderUtilsTest.Exists;
begin
Assert.IsFalse(FolderUtils.Exists(SubFolder));
FolderUtils.Create(SubFolder);
Assert.IsTrue(FolderUtils.Exists(SubFolder));
FolderUtils.Delete(SubFolder);
Assert.IsFalse(FolderUtils.Exists(SubFolder));
Assert.Throws(->FolderUtils.Exists(nil));
end;
method FolderUtilsTest.GetFiles;
begin
FileUtils.Create(Path.Combine(FolderName, "1"));
FileUtils.Create(Path.Combine(FolderName, "2"));
FolderUtils.Create(SubFolder);
FileUtils.Create(Path.Combine(SubFolder, "3"));
FileUtils.Create(Path.Combine(SubFolder, "4"));
var Actual := FolderUtils.GetFiles(FolderName, false);
var Expected := new Sugar.Collections.List<String>;
Expected.Add(Path.Combine(FolderName, "1"));
Expected.Add(Path.Combine(FolderName, "2"));
Assert.AreEqual(Actual, Expected, true);
Actual := FolderUtils.GetFiles(FolderName, true);
Expected.Clear;
Expected.Add(Path.Combine(FolderName, "1"));
Expected.Add(Path.Combine(FolderName, "2"));
Expected.Add(Path.Combine(SubFolder, "3"));
Expected.Add(Path.Combine(SubFolder, "4"));
Assert.AreEqual(Actual, Expected, true);
end;
method FolderUtilsTest.GetFolders;
begin
FolderUtils.Create(SubFolder);
FileUtils.Create(Path.Combine(SubFolder, "1"));
FolderUtils.Create(Path.Combine(SubFolder, "NewFolder"));
var Actual := FolderUtils.GetFolders(FolderName, false);
Assert.AreEqual(length(Actual), 1);
Assert.AreEqual(Actual[0], SubFolder);
Actual := FolderUtils.GetFolders(FolderName, true);
var Expected := new Sugar.Collections.List<String>;
Expected.Add(SubFolder);
Expected.Add(Path.Combine(SubFolder, "NewFolder"));
Assert.AreEqual(Actual, Expected, true);
end;
end. |
unit GX_ProcedureList;
{$I GX_CondDefine.inc}
interface
uses
SysUtils, Classes, ActnList, Dialogs, ComCtrls, ToolWin, StdCtrls,
Controls, ExtCtrls, Messages, Forms, GX_EnhancedEditor,
GX_ProcedureListOptions, GX_FileScanner, GX_EditReader, GX_BaseForm;
const
UM_RESIZECOLS = WM_USER + 523;
type
TfmProcedureList = class(TfmBaseForm)
pnlFuncHolder: TPanel;
pnHolder: TPanel;
lvProcs: TListView;
StatusBar: TStatusBar;
pnlHeader: TPanel;
dlgProcFont: TFontDialog;
pnlHeaderLeft: TPanel;
lblMethods: TLabel;
edtMethods: TEdit;
pnlHeaderRight: TPanel;
cbxObjects: TComboBox;
lblObjects: TLabel;
Actions: TActionList;
ToolBar: TToolBar;
tbnCopy: TToolButton;
tbnSep1: TToolButton;
tbnStart: TToolButton;
tbnAny: TToolButton;
tbnSep3: TToolButton;
tbnGoto: TToolButton;
tbnSep4: TToolButton;
tbnHelp: TToolButton;
actEditCopy: TAction;
actOptionsFont: TAction;
actViewStart: TAction;
actViewAny: TAction;
actViewGoto: TAction;
actHelpHelp: TAction;
tbnShowFunctionCode: TToolButton;
pnlFunctionBody: TPanel;
splSeparator: TSplitter;
tbnOptions: TToolButton;
actOptions: TAction;
tbnSep5: TToolButton;
tbnSep6: TToolButton;
tmrFilter: TTimer;
tbnMatchClass: TToolButton;
tbnSep2: TToolButton;
tbnMatchProc: TToolButton;
actMatchClass: TAction;
actMatchMethod: TAction;
procedure actMatchMethodExecute(Sender: TObject);
procedure actMatchClassExecute(Sender: TObject);
procedure tmrFilterTimer(Sender: TObject);
procedure lvProcsChange(Sender: TObject; Item: TListItem; Change: TItemChange);
procedure FormResize(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure lvProcsColumnClick(Sender: TObject; Column: TListColumn);
procedure edtMethodsChange(Sender: TObject);
procedure edtMethodsKeyPress(Sender: TObject; var Key: Char);
procedure edtMethodsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure cbxObjectsChange(Sender: TObject);
procedure pnlHeaderResize(Sender: TObject);
procedure actEditCopyExecute(Sender: TObject);
procedure actHelpHelpExecute(Sender: TObject);
procedure actOptionsFontExecute(Sender: TObject);
procedure actViewStartExecute(Sender: TObject);
procedure actViewAnyExecute(Sender: TObject);
procedure actViewGotoExecute(Sender: TObject);
procedure ActionsUpdate(Action: TBasicAction; var Handled: Boolean);
procedure tbnShowFunctionCodeClick(Sender: TObject);
procedure actOptionsExecute(Sender: TObject);
procedure lvProcsCompare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer);
procedure splSeparatorMoved(Sender: TObject);
private
FFileScanner: TFileScanner;
FEditReader: TEditReader;
FFileName: string;
FObjectStrings: TStringList;
FLanguage: TSourceLanguage;
FUnitText: string;
FCodeText: TGXEnhancedEditor;
FOptions: TProcedureListOptions;
FLastProcLineNo: Integer;
function GetImageIndex(const ProcName, ProcClass: string): Integer;
procedure LoadProcs;
procedure FillListBox;
procedure ResizeCols;
procedure GotoCurrentlySelectedProcedure;
procedure UMResizeCols(var Msg: TMessage); message UM_RESIZECOLS;
procedure ClearObjectStrings;
procedure LoadObjectCombobox;
procedure InitializeForm;
function ConfigurationKey: string;
procedure LoadSettings;
procedure SaveSettings;
procedure SetupSyntaxHighlightingControl;
procedure ApplyOptions(const bLoading: Boolean);
procedure UpdateCodeView(ProcInfo: TProcedure);
function CurrentProcInfo: TProcedure;
public
constructor CreateWithFileName(AOwner: TComponent; const FileName: string);
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Language: TSourceLanguage read FLanguage write FLanguage;
end;
implementation
{$R *.dfm}
uses
{$IFOPT D+} GX_DbugIntf, {$ENDIF}
Windows, Clipbrd, Menus,
GX_GxUtils, GX_GenericUtils, GX_OtaUtils, GX_IdeUtils,
GX_SharedImages, GX_Experts, Math;
resourcestring
SAllString = '<All>';
SNoneString = '<None>';
type
TProcedureExpert = class(TGX_Expert)
public
constructor Create; override;
function GetActionCaption: string; override;
function GetDefaultShortCut: TShortCut; override;
class function GetName: string; override;
procedure Execute(Sender: TObject); override;
function HasConfigOptions: Boolean; override;
function HasMenuItem: Boolean; override;
procedure Configure; override;
procedure UpdateAction(Action: TCustomAction); override;
end;
constructor TfmProcedureList.CreateWithFileName(AOwner: TComponent; const FileName: string);
resourcestring
SParseStatistics = 'Procedures processed in %g seconds';
var
LoadTime: DWORD;
begin
inherited Create(AOwner);
SetNonModalFormPopupMode(Self);
FFileName := FileName;
FFileScanner := TFileScanner.CreateWithFileName(Self, FileName);
FLastProcLineNo := -1;
LoadTime := GetTickCount;
InitializeForm;
LoadTime := GetTickCount - LoadTime;
StatusBar.Panels[0].Text := Format(SParseStatistics, [LoadTime / 1000]);
end;
procedure TfmProcedureList.LoadProcs;
var
edt: TEditReader;
begin
// Since this edit reader is destroyed almost
// immediately, do not call FreeFileData
edt := TEditReader.Create(FFileName);
try
FUnitText := edt.GetText;
FFileScanner.UnitText := FUnitText;
finally
edt.Free;
end;
Caption := Caption + ' - ' + ExtractFileName(FFileName);
ClearObjectStrings;
try
FFileScanner.Execute;
finally
LoadObjectCombobox;
end;
StatusBar.Panels[1].Text := Trim(IntToStr(lvProcs.Items.Count));
end;
function TfmProcedureList.GetImageIndex(const ProcName, ProcClass: string): Integer;
begin
if StrContains('constructor', ProcName, False) then // Do not localize.
Result := ImageIndexNew
else if StrContains('destructor', ProcName, False) then // Do not localize.
Result := ImageIndexTrash
else if StrBeginsWith('class proc', ProcName, False) or StrContains('class func', ProcName, False) or (ProcClass <> '') then // Do not localize
Result := ImageIndexGear
else
Result := ImageIndexFunction;
end;
procedure TfmProcedureList.lvProcsChange(Sender: TObject; Item: TListItem; Change: TItemChange);
var
ProcInfo: TProcedure;
begin
ProcInfo := nil;
if lvProcs.Selected <> nil then
ProcInfo := lvProcs.Selected.Data;
if ProcInfo <> nil then
begin
StatusBar.Panels[0].Text := ProcInfo.ProcLine;
StatusBar.Panels[1].Text := Format('%d/%d', [lvProcs.Selected.Index + 1, lvProcs.Items.Count]);
actViewGoto.Enabled := (lvProcs.Selected <> nil);
end;
if (Item <> nil) and Item.Selected then
UpdateCodeView(ProcInfo);
end;
procedure TfmProcedureList.FillListBox;
var
i: Integer;
ProcInfo: TProcedure;
IsObject: Boolean;
procedure AddListItem(ProcInfo: TProcedure);
var
ListItem: TListItem;
begin
ListItem := lvProcs.Items.Add;
ListItem.Caption := '';
if FOptions.ObjectNameVisible then
begin
if ProcInfo.ProcClass <> '' then
ListItem.SubItems.Add(ProcInfo.ProcClass + ProcInfo.ObjectSeparator + ProcInfo.ProcName)
else
ListItem.SubItems.Add(ProcInfo.ProcName)
end
else
ListItem.SubItems.Add(ProcInfo.ProcName);
ListItem.SubItems.Add(ProcInfo.ProcedureType);
ListItem.SubItems.Add(IntToStr(ProcInfo.LineNo));
ListItem.ImageIndex := GetImageIndex(ProcInfo.ProcedureType, ProcInfo.ProcClass);
ListItem.Data := ProcInfo;
end;
procedure FocusAndSelectFirstItem;
begin
if lvProcs.Items.Count > 0 then
begin
lvProcs.Selected := lvProcs.Items[0];
lvProcs.ItemFocused := lvProcs.Selected;
end;
end;
begin
lvProcs.Items.BeginUpdate;
try
lvProcs.Items.Clear;
if (Length(edtMethods.Text) = 0) and (cbxObjects.Text = SAllString) then
begin
for i := 0 to FFileScanner.Procedures.Count - 1 do
AddListItem(FFileScanner.Procedures.Items[i]);
Exit;
end;
for i := 0 to FFileScanner.Procedures.Count - 1 do
begin
ProcInfo := FFileScanner.Procedures.Items[i];
IsObject := Length(ProcInfo.ProcClass) > 0;
// Is it the object we want?
if (cbxObjects.Text = SNoneString) then
begin
if IsObject then
Continue
end
else if (cbxObjects.Text <> SAllString) and
(not SameText(cbxObjects.Text, ProcInfo.ProcClass)) then
Continue;
if Length(edtMethods.Text) = 0 then
AddListItem(ProcInfo)
else if not FOptions.SearchAll and StrBeginsWith(edtMethods.Text, ProcInfo.ProcName, False) then
AddListItem(ProcInfo)
else if not FOptions.SearchAll and FOptions.SearchClassName and StrBeginsWith(edtMethods.Text, ProcInfo.ProcClass, False) then
AddListItem(ProcInfo)
else if FOptions.SearchAll and StrContains(edtMethods.Text, ProcInfo.ProcName, False) then
AddListItem(ProcInfo)
else if FOptions.SearchAll and FOptions.SearchClassName and SameText(cbxObjects.Text, SAllString) and StrContains(edtMethods.Text, ProcInfo.ProcClass, False) then
AddListItem(ProcInfo);
end;
if lvProcs.Items.Count = 0 then
UpdateCodeView(nil);
finally
if RunningRS2009OrGreater then
lvProcs.AlphaSort; // This no longer happens automatically?
lvProcs.Items.EndUpdate;
FocusAndSelectFirstItem;
end;
ResizeCols;
end;
procedure TfmProcedureList.FormResize(Sender: TObject);
begin
with StatusBar do
begin
if Width > 80 then
begin
Panels[1].Width := 80;
Panels[0].Width := Width - 80;
end;
end;
ResizeCols;
end;
// This is just a nasty hack to be sure the scroll bar is set right
// before playing with the column widths. We should fix this somehow.
procedure TfmProcedureList.ResizeCols;
begin
PostMessage(Self.Handle, UM_RESIZECOLS, 0, 0);
end;
procedure TfmProcedureList.UMResizeCols(var Msg: TMessage);
begin
Application.ProcessMessages;
lvProcs.Columns[1].Width := Max(0, lvProcs.ClientWidth - lvProcs.Columns[2].Width
- lvProcs.Columns[3].Width - lvProcs.Columns[0].Width);
end;
procedure TfmProcedureList.SaveSettings;
begin
// Things that might have changed on the procedure list dialog box
FOptions.BoundsRect := BoundsRect;
FOptions.CodeViewWidth := pnlFunctionBody.Width;
FOptions.CodeViewHeight := pnlFunctionBody.Height;
FOptions.DialogFont.Assign(lvProcs.Font);
FOptions.SaveSettings(ConfigurationKey);
end;
procedure TfmProcedureList.LoadSettings;
begin
FOptions.LoadSettings(ConfigurationKey);
BoundsRect := FOptions.BoundsRect;
ApplyOptions(True);
EnsureFormVisible(Self);
ResizeCols;
end;
procedure TfmProcedureList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
SaveSettings;
end;
procedure TfmProcedureList.lvProcsColumnClick(Sender: TObject; Column: TListColumn);
var
i: Integer;
Cursor: IInterface;
begin
i := Column.Index;
if i <> 0 then
begin
Cursor := TempHourGlassCursor;
FOptions.SortOnColumn := i;
FillListBox;
end;
end;
procedure TfmProcedureList.edtMethodsChange(Sender: TObject);
begin
tmrFilter.Enabled := False;
tmrFilter.Enabled := True; //FI:W508 - stop and restart timer on key press
end;
procedure TfmProcedureList.tmrFilterTimer(Sender: TObject);
begin
FillListBox;
tmrFilter.Enabled := False;
end;
procedure TfmProcedureList.edtMethodsKeyPress(Sender: TObject; var Key: Char);
begin
case Key of
#13:
begin
GotoCurrentlySelectedProcedure;
Key := #0;
end;
#27:
begin
Close;
Key := #0;
end;
end;
end;
procedure TfmProcedureList.edtMethodsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if not (((Key = VK_F4) and (ssAlt in Shift)) or
(Key in [VK_DELETE, VK_LEFT, VK_RIGHT]) or
((Key in [VK_INSERT]) and ((ssShift in Shift) or (ssCtrl in Shift))) or
((Key in [VK_HOME, VK_END]) and (ssShift in Shift))) then
begin
SendMessage(lvProcs.Handle, WM_KEYDOWN, Key, 0);
Key := 0;
end;
end;
procedure TfmProcedureList.cbxObjectsChange(Sender: TObject);
begin
FillListBox;
ResizeCols;
end;
procedure TfmProcedureList.pnlHeaderResize(Sender: TObject);
begin
pnlHeaderLeft.Width := (pnlHeader.ClientWidth div 2);
edtMethods.Width := pnlHeaderLeft.ClientWidth - edtMethods.Left - 8;
cbxObjects.Width := pnlHeaderRight.ClientWidth - cbxObjects.Left - 8;
end;
procedure TfmProcedureList.ClearObjectStrings;
begin
FObjectStrings.Clear;
FObjectStrings.Add(SAllString);
end;
procedure TfmProcedureList.LoadObjectCombobox;
var
i: Integer;
begin
for i := 0 to FFileScanner.Procedures.Count - 1 do
begin
if FFileScanner.Procedures.Items[i].ProcClass = '' then
FObjectStrings.Add(SNoneString)
else
FObjectStrings.Add(FFileScanner.Procedures.Items[i].ProcClass);
end;
cbxObjects.Items.Assign(FObjectStrings);
cbxObjects.ItemIndex := cbxObjects.Items.IndexOf(SAllString);
end;
function TfmProcedureList.ConfigurationKey: string;
begin
Result := TProcedureExpert.ConfigurationKey;
end;
constructor TProcedureExpert.Create;
begin
inherited;
end;
function TProcedureExpert.GetActionCaption: string;
resourcestring
SMenuCaption = '&Procedure List...';
begin
Result := SMenuCaption;
end;
function TProcedureExpert.GetDefaultShortCut: TShortCut;
begin
Result := Menus.ShortCut(Word('G'), [ssCtrl]);
end;
procedure TProcedureExpert.Execute(Sender: TObject);
var
FileName: string;
TempFileName: string;
Dlg: TfmProcedureList;
Cursor: IInterface;
resourcestring
SPasOrDprOrCPPOnly = 'This expert is for use in .pas, .dpr, .inc, .cpp, .c, and .h files only';
begin
Cursor := TempHourGlassCursor;
FileName := GxOtaGetCurrentSourceFile;
if IsForm(FileName) then
begin
TempFileName := ChangeFileExt(FileName, '.pas');
if GxOtaIsFileOpen(TempFileName) then
FileName := TempFileName
else
begin
TempFileName := ChangeFileExt(FileName, '.cpp');
if GxOtaIsFileOpen(TempFileName) then
FileName := TempFileName;
end;
end;
if not (IsDprOrPas(FileName) or IsTypeLibrary(FileName) or IsInc(FileName) or
IsCpp(FileName) or IsC(FileName) or IsH(FileName)) then
MessageDlg(SPasOrDprOrCPPOnly, mtError, [mbOK], 0)
else
begin
{$IFOPT D+} SendDebug('Procedure List: Expert activated'); {$ENDIF}
Dlg := TfmProcedureList.CreateWithFileName(nil, FileName);
try
SetFormIcon(Dlg);
if Dlg.ShowModal <> mrCancel then
GxOtaMakeSourceVisible(FileName);
finally
FreeAndNil(Dlg);
end;
end;
end;
function TProcedureExpert.HasConfigOptions: Boolean;
begin
Result := True;
end;
function TProcedureExpert.HasMenuItem: Boolean;
begin
Result := True;
end;
procedure TfmProcedureList.actEditCopyExecute(Sender: TObject);
var
i: Integer;
Procs: TStringList;
ProcInfo: TProcedure;
begin
if FCodeText.Focused then
begin
if Trim(FCodeText.SelText) <> '' then
Clipboard.AsText := FCodeText.SelText
else
Clipboard.AsText := FCodeText.AsString;
end
else
begin
Procs := TStringList.Create;
try
for i := 0 to lvProcs.Items.Count - 1 do
begin
ProcInfo := TProcedure(lvProcs.Items[i].Data);
if ProcInfo <> nil then
Procs.Add(ProcInfo.ProcName);
end;
finally
if Procs.Count > 0 then
Clipboard.AsText := Procs.Text;
FreeAndNil(Procs);
end;
end;
end;
procedure TfmProcedureList.actHelpHelpExecute(Sender: TObject);
begin
GxContextHelp(Self, 4);
end;
procedure TfmProcedureList.actOptionsFontExecute(Sender: TObject);
begin
dlgProcFont.Font.Assign(lvProcs.Font);
if dlgProcFont.Execute then
lvProcs.Font.Assign(dlgProcFont.Font);
end;
procedure TfmProcedureList.actViewStartExecute(Sender: TObject);
begin
FOptions.SearchAll := False;
FillListBox;
end;
procedure TfmProcedureList.actViewAnyExecute(Sender: TObject);
begin
FOptions.SearchAll := True;
FillListBox;
end;
procedure TfmProcedureList.actMatchClassExecute(Sender: TObject);
begin
FOptions.SearchClassName := True;
FillListBox;
end;
procedure TfmProcedureList.actMatchMethodExecute(Sender: TObject);
begin
FOptions.SearchClassName := False;
FillListBox;
end;
procedure TfmProcedureList.actViewGotoExecute(Sender: TObject);
begin
GotoCurrentlySelectedProcedure;
end;
procedure TfmProcedureList.GotoCurrentlySelectedProcedure;
var
ProcInfo: TProcedure;
begin
if lvProcs.Selected <> nil then
begin
ProcInfo := lvProcs.Selected.Data;
if ProcInfo <> nil then
begin
Assert(FEditReader <> nil);
if FOptions.CodeViewVisible and (FCodeText.LineCount > 1) then
FEditReader.GotoLine(ProcInfo.LineNo + FCodeText.TopLine - 1)
else
FEditReader.GotoLine(ProcInfo.LineNo);
FEditReader.ShowSource;
FEditReader.FreeFileData;
ModalResult := mrOk;
end;
end;
end;
constructor TfmProcedureList.Create(AOwner: TComponent);
begin
inherited;
SetToolbarGradient(ToolBar);
lvProcs.DoubleBuffered := True;
InitializeForm;
end;
destructor TfmProcedureList.Destroy;
begin
FreeAndNil(FCodeText);
FreeAndNil(FObjectStrings);
FreeAndNil(FOptions);
FreeAndNil(FEditReader);
inherited;
end;
procedure TfmProcedureList.InitializeForm;
begin
SetupSyntaxHighlightingControl;
FObjectStrings := TStringList.Create;
FObjectStrings.Sorted := True;
FObjectStrings.Duplicates := dupIgnore;
ClearObjectStrings;
FOptions := TProcedureListOptions.Create;
FOptions.SortOnColumn := 1;
FEditReader := TEditReader.Create(FFileName);
FEditReader.FreeFileData;
CenterForm(Self);
LoadSettings;
LoadProcs;
FillListBox;
end;
procedure TfmProcedureList.ActionsUpdate(Action: TBasicAction; var Handled: Boolean);
begin
actViewGoto.Enabled := (lvProcs.Selected <> nil);
actViewStart.Checked := not FOptions.SearchAll;
actViewAny.Checked := FOptions.SearchAll;
actMatchClass.Checked := FOptions.SearchClassName;
actMatchMethod.Checked := not FOptions.SearchClassName;
end;
procedure TfmProcedureList.tbnShowFunctionCodeClick(Sender: TObject);
begin
FOptions.CodeViewVisible := not (pnlFunctionBody.Visible);
ApplyOptions(False);
UpdateCodeView(CurrentProcInfo);
end;
procedure TfmProcedureList.SetupSyntaxHighlightingControl;
begin
FCodeText := TGXEnhancedEditor.Create(Self);
if FFileScanner.Language = ltPas then
FCodeText.HighLighter := gxpPas
else if FFileScanner.Language = ltCpp then
FCodeText.HighLighter := gxpCpp
else
FCodeText.Highlighter := gxpNone;
FCodeText.Align := alClient;
FCodeText.Font.Name := 'Courier New';
FCodeText.Font.Size := 10;
FCodeText.Parent := pnlFunctionBody;
FCodeText.ReadOnly := True;
end;
class function TProcedureExpert.GetName: string;
begin
Result := 'ProcedureList'; // Do not localize.
end;
procedure TProcedureExpert.Configure;
var
lclOptions: TProcedureListOptions;
begin
lclOptions := TProcedureListOptions.Create;
lclOptions.LoadSettings(ConfigurationKey);
with TfmProcedureListOptions.Create(nil) do
try
Options := lclOptions;
if ShowModal = mrOK then
lclOptions.SaveSettings(ConfigurationKey);
finally
Free;
FreeAndNil(lclOptions);
end;
end;
procedure TProcedureExpert.UpdateAction(Action: TCustomAction);
const
SAllowableFileExtensions =
'.pas;.dpr;.inc;.dfm;.xfm;.nfm;.tlb;.ocx;.olb;.dll;.exe;.cpp;.c;.h'; // Do not localize.
begin
Action.Enabled := FileMatchesExtensions(GxOtaGetCurrentSourceFile, SAllowableFileExtensions);
end;
procedure TfmProcedureList.actOptionsExecute(Sender: TObject);
begin
with TfmProcedureListOptions.Create(nil) do
try
// These are adjustable in window, so update settings
FOptions.DialogFont.Assign(lvProcs.Font);
FOptions.CodeViewVisible := pnlFunctionBody.Visible;
// Assign and show modal dialog, then adjust options if necessary
Options := FOptions;
if ShowModal = mrOK then
begin
ApplyOptions(False);
ResizeCols;
FillListBox;
end;
finally
Free;
end;
end;
procedure TfmProcedureList.ApplyOptions(const bLoading: Boolean);
procedure SetCodeViewVisibility(const bVisible: Boolean);
begin
pnlFunctionBody.Visible := bVisible;
splSeparator.Visible := bVisible;
tbnShowFunctionCode.Down := bVisible;
ResizeCols;
end;
begin
SetCodeViewVisibility(FOptions.CodeViewVisible);
FCodeText.Font.Assign(FOptions.CodeViewFont);
lvProcs.Font.Assign(FOptions.DialogFont);
if FOptions.AlignmentChanged or bLoading then
begin
pnlFunctionBody.Align := FOptions.CodeViewAlignment;
splSeparator.Align := FOptions.CodeViewAlignment;
if FOptions.AlignmentChanged then
begin
case pnlFunctionBody.Align of
alTop, alBottom: pnlFunctionBody.Height := Round(Self.Height / 2);
alLeft, alRight: pnlFunctionBody.Width := Round(Self.Width / 2);
end;
FOptions.AlignmentChanged := False;
end
else
case pnlFunctionBody.Align of
alTop, alBottom: pnlFunctionBody.Height := FOptions.CodeViewHeight;
alLeft, alRight: pnlFunctionBody.Width := FOptions.CodeViewWidth;
end;
end;
end;
procedure TfmProcedureList.lvProcsCompare(Sender: TObject; Item1,
Item2: TListItem; Data: Integer; var Compare: Integer);
function PadNumber(const Value: string): string;
var
i: Integer;
begin
Result := Value;
for i := Length(Value) to 5 do //FI:W528
Result := ' ' + Result;
end;
var
Item1Value, Item2Value: string;
begin
if FOptions.SortOnColumn = 3 then
begin
Item1Value := PadNumber(Item1.SubItems[FOptions.SortOnColumn - 1]);
Item2Value := PadNumber(Item2.SubItems[FOptions.SortOnColumn - 1]);
end
else
begin
Item1Value := Item1.SubItems[FOptions.SortOnColumn - 1];
Item2Value := Item2.SubItems[FOptions.SortOnColumn - 1];
end;
Compare := AnsiCompareText(Item1Value, Item2Value);
end;
procedure TfmProcedureList.splSeparatorMoved(Sender: TObject);
begin
ResizeCols;
end;
procedure TfmProcedureList.UpdateCodeView(ProcInfo: TProcedure);
begin
if not Assigned(FCodeText) then
Exit;
FCodeText.BeginUpdate;
try
if Assigned(ProcInfo) and (FLastProcLineNo = ProcInfo.LineNo) then
Exit;
FCodeText.Clear;
if (not Assigned(ProcInfo)) or (not FOptions.CodeViewVisible) then
Exit;
if ProcInfo.Body <> '' then
FCodeText.AsString := ProcInfo.Body
else begin
FCodeText.AsString := Copy(FUnitText, ProcInfo.BeginIndex + 1, ProcInfo.EndIndex + ProcInfo.BeginIndex);
end;
FLastProcLineNo := ProcInfo.LineNo;
finally
FCodeText.EndUpdate;
end;
end;
function TfmProcedureList.CurrentProcInfo: TProcedure;
begin
Result := nil;
if Assigned(lvProcs.Selected) then
Result := lvProcs.Selected.Data;
end;
initialization
RegisterGX_Expert(TProcedureExpert);
end.
|
unit DelphiTwain_VCL;
{$I DelphiTwain.inc}
{$IFDEF FPC}
{$MODE delphi}
{$ENDIF}
interface
uses
Windows, SysUtils, Classes, Forms, ExtCtrls, Messages, Graphics,
{$IFDEF FPC}interfacebase,{$ENDIF}
DelphiTwain, Twain;
type
TOnTwainAcquire = procedure(Sender: TObject; const Index: Integer; Image:
TBitmap; var Cancel: Boolean) of object;
TOnAcquireProgress = procedure(Sender: TObject; const Index: Integer;
const Image: HBitmap; const Current, Total: Integer) of object;
TDelphiTwain = class(TCustomDelphiTwain)
private
fMessagesTimer: TTimer;
procedure DoMessagesTimer(Sender: TObject);
procedure WndProc(var Message: TMessage);
function WndFunc(var Message: TMessage): Boolean;
private
fOnTwainAcquire: TOnTwainAcquire;
fOnAcquireProgress: TOnAcquireProgress;
protected
procedure DoCreate; override;
procedure DoDestroy; override;
procedure MessageTimer_Enable; override;
procedure MessageTimer_Disable; override;
function CustomSelectSource: Integer; override;
function CustomGetParentWindow: TW_HANDLE; override;
procedure DoTwainAcquire(Sender: TObject; const Index: Integer; Image:
HBitmap; var Cancel: Boolean); override;
procedure DoAcquireProgress(Sender: TObject; const Index: Integer;
const Image: HBitmap; const Current, Total: Integer); override;
public
constructor Create; override;
destructor Destroy; override;
public
{Image acquired}
property OnTwainAcquire: TOnTwainAcquire read fOnTwainAcquire
write fOnTwainAcquire;
{Acquire progress, for memory transfers}
property OnAcquireProgress: TOnAcquireProgress read fOnAcquireProgress
write fOnAcquireProgress;
end;
implementation
uses uFormSelectSource_VCL, Controls;
{$IFDEF FPC}
var
xTwainList: TList = nil;
xAppWndCallback: WNDPROC = nil;//WNDPROC = nil;
function AppWndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam; lParam: LParam): LRESULT; stdcall;
var
I: Integer;
xMess: TMessage;
begin
if Assigned(xTwainList) and (xTwainList.Count > 0) then begin
xMess.msg := uMsg;
xMess.lParam := lParam;
xMess.wParam := wParam;
xMess.Result := 0;
for I := 0 to xTwainList.Count-1 do
TDelphiTwain(xTwainList[I]).WndProc(xMess);
end;
Result := CallWindowProc(xAppWndCallback,Ahwnd, uMsg, WParam, LParam);
end;
{$ENDIF}
{ TDelphiTwain }
constructor TDelphiTwain.Create;
begin
inherited Create;
fMessagesTimer := TTimer.Create(nil);
fMessagesTimer.Enabled := False;
fMessagesTimer.Interval := 100;
fMessagesTimer.OnTimer := DoMessagesTimer;
end;
function TDelphiTwain.CustomGetParentWindow: TW_HANDLE;
begin
if IsConsoleApplication then
Result := 0
else if not IsLibrary then
Result := {$IF DEFINED(FPC) OR DEFINED(DELPHI_7_DOWN)}GetActiveWindow{$ELSE}Application.ActiveFormHandle{$IFEND}
else
Result := GetActiveWindow;//GetForegroundWindow;
end;
function TDelphiTwain.CustomSelectSource: Integer;
var
xForm: TFormSelectSource;
I: Integer;
begin
Result := -1;
if SourceCount = 0 then begin
Exit;
end;
xForm := TFormSelectSource.CreateNew(nil);
try
for I := 0 to SourceCount-1 do
xForm.LBSources.Items.Add(Source[I].ProductName);
xForm.LBSources.ItemIndex := 0;
if (SelectedSourceIndex >= 0) and (SelectedSourceIndex < xForm.LBSources.Items.Count) then
xForm.LBSources.ItemIndex := SelectedSourceIndex;
{$IFDEF DELPHI_2006_UP}
xForm.PopupMode := pmAuto;
{$ENDIF}
if xForm.ShowModal = mrOK then begin
Result := xForm.LBSources.ItemIndex;
end else begin
Result := -1;
end;
finally
xForm.Free;
end;
end;
destructor TDelphiTwain.Destroy;
begin
FreeAndNil(fMessagesTimer);
inherited;
end;
procedure TDelphiTwain.DoAcquireProgress(Sender: TObject; const Index: Integer;
const Image: HBitmap; const Current, Total: Integer);
begin
if Assigned(fOnAcquireProgress) then
fOnAcquireProgress(Self, Index, Image, Current, Total);
end;
procedure TDelphiTwain.DoMessagesTimer(Sender: TObject);
begin
//MUST BE HERE SO THAT TWAIN RECEIVES MESSAGES
if VirtualWindow > 0 then begin
SendMessage(VirtualWindow, WM_USER, 0, 0);
end;
end;
procedure TDelphiTwain.DoTwainAcquire(Sender: TObject; const Index: Integer;
Image: HBitmap; var Cancel: Boolean);
var BitmapObj: TBitmap;
begin
if Assigned(OnTwainAcquire) then
begin
BitmapObj := TBitmap.Create;
try
BitmapObj.Handle := Image;
OnTwainAcquire(Sender, Index, BitmapObj, Cancel);
finally
BitmapObj.Free;
end;
end;
end;
procedure TDelphiTwain.MessageTimer_Disable;
begin
if Assigned(fMessagesTimer) then
fMessagesTimer.Enabled := False;
end;
procedure TDelphiTwain.MessageTimer_Enable;
begin
if Assigned(fMessagesTimer) then
fMessagesTimer.Enabled := True;
end;
procedure TDelphiTwain.DoCreate;
begin
inherited;
if IsLibrary then begin
fVirtualWindow := Classes.AllocateHWnd(WndProc);
end else begin
{$IFDEF FPC}
if Assigned(Application.MainForm) and (Application.MainForm.Visible) then
fVirtualWindow := Application.MainFormHandle
else
fVirtualWindow := WidgetSet.AppHandle;
if not Assigned(xTwainList) then
xTwainList := TList.Create;
xTwainList.Add(Self);
if not Assigned(xAppWndCallback) then begin
xAppWndCallback := {%H-}{Windows.WNDPROC}Pointer(SetWindowLongPtr(fVirtualWindow,GWL_WNDPROC,{%H-}NativeInt(@AppWndCallback)));
end;
{$ELSE}
fVirtualWindow := Application.Handle;//Application.Handle;
Application.HookMainWindow(WndFunc);
{$ENDIF}
end;
end;
procedure TDelphiTwain.DoDestroy;
begin
if IsLibrary then begin
DestroyWindow(VirtualWindow);
end else begin
{$IFDEF FPC}
xTwainList.Remove(Self);
if xTwainList.Count = 0 then begin
FreeAndNil(xTwainList);
end;
{$ELSE}
Application.UnhookMainWindow(WndFunc);
{$ENDIF}
end;
inherited;
end;
function TDelphiTwain.WndFunc(var Message: TMessage): Boolean;
var
i : Integer;
xMsg : TMsg;
begin
Result := False;
with Message do begin
{Tests for the message}
{Try to obtain the current object pointer}
if Assigned(Self) then
{If there are sources loaded, we need to verify}
{this message}
if (Self.SourcesLoaded > 0) then
begin
{Convert parameters to a TMsg}
xMsg := MakeMsg(Handle, Msg, wParam, lParam);//MakeMsg(Handle, Msg, wParam, lParam);
{Tell about this message}
FOR i := 0 TO Self.SourceCount - 1 DO
if ((Self.Source[i].Loaded) and (Self.Source[i].Enabled)) then
if Self.Source[i].ProcessMessage(xMsg) then
begin
{Case this was a message from the source, there is}
{no need for the default procedure to process}
Result := 0;
WndFunc := True;
Exit;
end;
end; {if (Twain.SourcesLoaded > 0)}
end;
end;
procedure TDelphiTwain.WndProc(var Message: TMessage);
var
i : Integer;
xMsg : TMsg;
begin
//WndProc := False;
with Message do begin
{Tests for the message}
{Try to obtain the current object pointer}
if Assigned(Self) then
{If there are sources loaded, we need to verify}
{this message}
if (Self.SourcesLoaded > 0) then
begin
{Convert parameters to a TMsg}
xMsg := MakeMsg(Handle, Msg, wParam, lParam);//MakeMsg(Handle, Msg, wParam, lParam);
{Tell about this message}
FOR i := 0 TO Self.SourceCount - 1 DO
if ((Self.Source[i].Loaded) and (Self.Source[i].Enabled)) then
if Self.Source[i].ProcessMessage(xMsg) then
begin
{Case this was a message from the source, there is}
{no need for the default procedure to process}
//Result := 0;
//WndProc := True;
Exit;
end;
end; {if (Twain.SourcesLoaded > 0)}
end;
end;
end.
|
unit uGUI;
interface
uses
glr_gui;
type
{ TArenaGUIManager }
TArenaGUIManager = class
GlrGuiManager: TglrGuiManager;
DebugText: TglrGuiLabel;
procedure Init();
procedure DeInit();
procedure Update(const dt: Double);
procedure Render();
end;
implementation
uses
glr_core,
glr_math,
uAssets;
{ TArenaGUIManager }
procedure TArenaGUIManager.Init();
begin
GlrGuiManager := TglrGuiManager.Create(Assets.GuiMaterial, Default.Font);
DebugText := TglrGuiLabel.Create();
DebugText.TextLabel.Text := 'Debug';
DebugText.Position := Vec3f(10, 10, 10);
GlrGuiManager.Add(DebugText);
end;
procedure TArenaGUIManager.DeInit();
begin
GlrGuiManager.Free(True);
end;
procedure TArenaGUIManager.Update(const dt: Double);
begin
GlrGuiManager.Update(dt);
end;
procedure TArenaGUIManager.Render();
begin
Assets.GuiCamera.Update();
GlrGuiManager.Render();
end;
end.
|
unit nsListExceptions;
// Модуль: "w:\garant6x\implementation\Garant\GbaNemesis\Business\Document\nsListExceptions.pas"
// Стереотип: "UtilityPack"
// Элемент модели: "nsListExceptions" MUID: (55E438930369)
{$Include w:\garant6x\implementation\Garant\nsDefine.inc}
interface
{$If NOT Defined(Admin) AND NOT Defined(Monitorings)}
uses
l3IntfUses
, SysUtils
, l3MessageID
;
const
{* Локализуемые строки EListIsTooLong local }
str_ListIsTooLong: Tl3MessageID = (rS : -1; rLocalized : false; rKey : 'ListIsTooLong'; rValue : 'Список содержит большое количество документов, он не может быть отфильтрован. Пожалуйста, уточните запрос.');
{* 'Список содержит большое количество документов, он не может быть отфильтрован. Пожалуйста, уточните запрос.' }
type
EListIsTooLong = class(Exception)
end;//EListIsTooLong
{$IfEnd} // NOT Defined(Admin) AND NOT Defined(Monitorings)
implementation
{$If NOT Defined(Admin) AND NOT Defined(Monitorings)}
uses
l3ImplUses
{$If NOT Defined(NoVCL)}
, Dialogs
{$IfEnd} // NOT Defined(NoVCL)
{$If NOT Defined(NoScripts)}
, TtfwTypeRegistrator_Proxy
{$IfEnd} // NOT Defined(NoScripts)
//#UC START# *55E438930369impl_uses*
//#UC END# *55E438930369impl_uses*
;
initialization
str_ListIsTooLong.Init;
str_ListIsTooLong.SetDlgType(mtWarning);
{* Инициализация str_ListIsTooLong }
{$If NOT Defined(NoScripts)}
TtfwTypeRegistrator.RegisterType(TypeInfo(EListIsTooLong));
{* Регистрация типа EListIsTooLong }
{$IfEnd} // NOT Defined(NoScripts)
{$IfEnd} // NOT Defined(Admin) AND NOT Defined(Monitorings)
end.
|
unit DailyAutoTest;
{* Автотест с поддержкой создаваемых форм. }
// Модуль: "w:\common\components\rtl\Garant\DUnit_Script_Support\DailyAutoTest.pas"
// Стереотип: "SimpleClass"
// Элемент модели: "TDailyAutoTest" MUID: (4E297BC401BE)
{$Include w:\common\components\rtl\Garant\DUnit_Script_Support\dsDefine.inc}
interface
{$If Defined(nsTest) AND NOT Defined(NoScripts)}
uses
l3IntfUses
, AutoTest
;
type
TDailyAutoTest = {abstract} class(TAutoTest)
{* Автотест с поддержкой создаваемых форм. }
protected
function GetFolder: AnsiString; override;
{* Папка в которую входит тест }
function ResolveScriptFilePath(const aFileName: AnsiString): AnsiString; override;
class function IsScript: Boolean; override;
{* Хак для конструктора - из-за хитрой иерархии и кучи конструкторов в TTestSuite. }
public
constructor Create(const aMethodName: AnsiString;
const aFolder: AnsiString); override;
end;//TDailyAutoTest
{$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts)
implementation
{$If Defined(nsTest) AND NOT Defined(NoScripts)}
uses
l3ImplUses
, SysUtils
//#UC START# *4E297BC401BEimpl_uses*
//#UC END# *4E297BC401BEimpl_uses*
;
function TDailyAutoTest.GetFolder: AnsiString;
{* Папка в которую входит тест }
//#UC START# *4C937013031D_4E297BC401BE_var*
//#UC END# *4C937013031D_4E297BC401BE_var*
begin
//#UC START# *4C937013031D_4E297BC401BE_impl*
Result := 'Scripts';
//#UC END# *4C937013031D_4E297BC401BE_impl*
end;//TDailyAutoTest.GetFolder
function TDailyAutoTest.ResolveScriptFilePath(const aFileName: AnsiString): AnsiString;
//#UC START# *4DB03121022B_4E297BC401BE_var*
//#UC END# *4DB03121022B_4E297BC401BE_var*
begin
//#UC START# *4DB03121022B_4E297BC401BE_impl*
if (ExtractFilePath(aFileName) <> '') then
Result := aFileName
else
Result := FileFromCurrent('Auto') + '\'+ aFileName;
//#UC END# *4DB03121022B_4E297BC401BE_impl*
end;//TDailyAutoTest.ResolveScriptFilePath
class function TDailyAutoTest.IsScript: Boolean;
{* Хак для конструктора - из-за хитрой иерархии и кучи конструкторов в TTestSuite. }
//#UC START# *4DC395670274_4E297BC401BE_var*
//#UC END# *4DC395670274_4E297BC401BE_var*
begin
//#UC START# *4DC395670274_4E297BC401BE_impl*
Result := True;
//#UC END# *4DC395670274_4E297BC401BE_impl*
end;//TDailyAutoTest.IsScript
constructor TDailyAutoTest.Create(const aMethodName: AnsiString;
const aFolder: AnsiString);
//#UC START# *4DC399CA00BC_4E297BC401BE_var*
//#UC END# *4DC399CA00BC_4E297BC401BE_var*
begin
//#UC START# *4DC399CA00BC_4E297BC401BE_impl*
inherited Create(aMethodName, aFolder);
FMethod := Self.DoIt;
//#UC END# *4DC399CA00BC_4E297BC401BE_impl*
end;//TDailyAutoTest.Create
{$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts)
end.
|
unit RemoveTerritoryUnit;
interface
uses SysUtils, BaseExampleUnit;
type
TRemoveTerritory = class(TBaseExample)
public
procedure Execute(TerritoryId: String);
end;
implementation
procedure TRemoveTerritory.Execute(TerritoryId: String);
var
ErrorString: String;
begin
Route4MeManager.Territory.Remove(TerritoryId, ErrorString);
WriteLn('');
if (ErrorString = EmptyStr) then
begin
WriteLn('RemoveTerritory executed successfully');
WriteLn(Format('Territory ID: %s', [TerritoryId]));
end
else
WriteLn(Format('RemoveTerritory error: "%s"', [ErrorString]));
end;
end.
|
unit FileFolders;
interface
uses
Classes, SysUtils, Windows, MappedFiles;
// Internal structure
type
PFileFolderHeader = ^TFileFolderHeader;
TFileFolderHeader =
record
Count : integer;
Offset : integer;
end;
type
PFileOffsetList = ^TFileOffsetList;
TFileOffsetList = array[0..0] of integer;
// TFileFolder
type
TFileFolder =
class
protected
fMappedFile : TMemoryMappedFile;
fData : PFileFolderHeader;
function GetFileCount : integer;
function GetFileAddr( Value : integer ) : pointer;
function GetFileSize( Value : integer ) : integer;
public
constructor Create( const aFilename : string );
destructor Destroy; override;
property FileAddr[ Indx : integer ] : pointer read GetFileAddr; default;
property FileSize[ Indx : integer ] : integer read GetFileSize;
property FileCount : integer read GetFileCount;
end;
// TFileFolderCreator
type
TFileFolderCreator =
class
protected
fFilename : string;
fList : TStringList;
public
constructor Create( const aFilename : string );
destructor Destroy; override;
function AddFile( const aFilename : string ) : integer; virtual;
procedure Save; virtual;
property List : TStringList read fList;
end;
implementation
// TFileFolder
constructor TFileFolder.Create( const aFilename : string );
begin
inherited Create;
fMappedFile := TMemoryMappedFile.Create( aFilename, usgReadOnly );
fData := fMappedFile.Address;
end;
destructor TFileFolder.Destroy;
begin
fMappedFile.Free;
inherited;
end;
function TFileFolder.GetFileCount : integer;
begin
Result := fData.Count;
end;
function TFileFolder.GetFileSize( Value : integer ) : integer;
begin
with fData^ do
if Value = FileCount - 1
then Result := Offset - PFileOffsetList( pchar(fData) + Offset )[Value]
else Result := PFileOffsetList( pchar(fData) + Offset )[Value + 1] - PFileOffsetList( pchar(fData) + Offset )[Value];
end;
function TFileFolder.GetFileAddr( Value : integer ) : pointer;
begin
Result := pchar(fData) + PFileOffsetList( pchar(fData) + fData.Offset )[Value];
end;
// TFileFolderCreator
constructor TFileFolderCreator.Create( const aFilename : string );
begin
inherited Create;
fFilename := aFilename;
fList := TStringList.Create;
end;
destructor TFileFolderCreator.Destroy;
begin
fList.Free;
inherited;
end;
function TFileFolderCreator.AddFile( const aFilename : string ) : integer;
begin
Result := List.Add( aFilename );
end;
procedure TFileFolderCreator.Save;
var
Stream : TStream;
FileStream : TStream;
i : integer;
FileOfs : integer;
PadCount : integer;
Header : TFileFolderHeader;
begin
Stream := TFileStream.Create( fFilename, fmCreate or fmShareExclusive );
with List, Stream do
try
// Reserve space for header
Seek( sizeof( Header ), soFromBeginning );
// Now save all files, aligning them to a dword boundary
for i := 0 to Count - 1 do
begin
FileStream := TFileStream.Create( List[i], fmOpenRead or fmShareDenyWrite );
try
PadCount := 4 - ( Stream.Position mod 4 );
if PadCount <> 4 // Padding needed?
then Seek( PadCount, soFromCurrent );
List.Objects[i] := TObject( Stream.Position );
CopyFrom( FileStream, FileStream.Size );
finally
FileStream.Free;
end;
end;
with Header do
begin
Count := List.Count;
Offset := Stream.Position;
end;
// Now save indexes
for i := 0 to List.Count - 1 do
begin
FileOfs := integer( Objects[i] );
WriteBuffer( FileOfs, sizeof( FileOfs ) );
Objects[i] := nil;
end;
// Now save header
Seek( 0, soFromBeginning ); // Go back
WriteBuffer( Header, sizeof( Header ) );
finally
Stream.Free;
end;
end;
end.
|
unit homepage_dm;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp, WebModu, HTTPProd, ReqMulti,
WebAdapt, WebForm, WebComp, MidItems, WebSess, WebDisp, CompProd,
PagItems, SiteProd;
type
TSessionDemo = class(TWebAppPageModule)
WebAppComponents: TWebAppComponents;
ApplicationAdapter: TApplicationAdapter;
PageDispatcher: TPageDispatcher;
AdapterDispatcher: TAdapterDispatcher;
SessionsService: TSessionsService;
PageProducer1: TPageProducer;
Hits: TAdapterField;
SessionHits: TAdapterField;
procedure PageProducerHTMLTag(Sender: TObject; Tag: TTag;
const TagString: String; TagParams: TStrings;
var ReplaceText: String);
procedure WebAppPageModuleBeforeDispatchPage(Sender: TObject;
const PageName: String; var Handled: Boolean);
procedure HitsGetValue(Sender: TObject; var Value: Variant);
procedure SessionHitsGetValue(Sender: TObject; var Value: Variant);
private
nHits: Integer;
public
{ Public declarations }
end;
function SessionDemo: TSessionDemo;
implementation
{$R *.dfm} {*.html}
uses WebReq, WebCntxt, WebFact, Variants;
function SessionDemo: TSessionDemo;
begin
Result := TSessionDemo(WebContext.FindModuleClass(TSessionDemo));
end;
procedure TSessionDemo.PageProducerHTMLTag(Sender: TObject;
Tag: TTag; const TagString: String; TagParams: TStrings;
var ReplaceText: String);
begin
if TagString = 'SessionID' then
ReplaceText := WebContext.Session.SessionID
else if TagString = 'SessionHits' then
ReplaceText := WebContext.Session.Values ['SessionHits']
end;
procedure TSessionDemo.WebAppPageModuleBeforeDispatchPage(
Sender: TObject; const PageName: String; var Handled: Boolean);
begin
// increase application and session hits
Inc (nHits);
WebContext.Session.Values ['SessionHits'] :=
Integer (WebContext.Session.Values ['SessionHits']) + 1;
end;
procedure TSessionDemo.HitsGetValue(Sender: TObject; var Value: Variant);
begin
Value := nHits;
end;
procedure TSessionDemo.SessionHitsGetValue(Sender: TObject;
var Value: Variant);
begin
Value := Integer (WebContext.Session.Values ['SessionHits']);
end;
initialization
if WebRequestHandler <> nil then
WebRequestHandler.AddWebModuleFactory(TWebAppPageModuleFactory.Create(TSessionDemo, TWebPageInfo.Create([wpPublished {, wpLoginRequired}], '.html'), caCache));
end.
|
unit text_input_unstable_v1_protocol;
{$mode objfpc} {$H+}
{$interfaces corba}
interface
uses
Classes, Sysutils, ctypes, wayland_util, wayland_client_core, wayland_protocol;
type
Pzwp_text_input_v1 = Pointer;
Pzwp_text_input_manager_v1 = Pointer;
const
ZWP_TEXT_INPUT_V1_CONTENT_HINT_NONE = $0; // no special behaviour
ZWP_TEXT_INPUT_V1_CONTENT_HINT_DEFAULT = $7; // auto completion, correction and capitalization
ZWP_TEXT_INPUT_V1_CONTENT_HINT_PASSWORD = $c0; // hidden and sensitive text
ZWP_TEXT_INPUT_V1_CONTENT_HINT_AUTO_COMPLETION = $1; // suggest word completions
ZWP_TEXT_INPUT_V1_CONTENT_HINT_AUTO_CORRECTION = $2; // suggest word corrections
ZWP_TEXT_INPUT_V1_CONTENT_HINT_AUTO_CAPITALIZATION = $4; // switch to uppercase letters at the start of a sentence
ZWP_TEXT_INPUT_V1_CONTENT_HINT_LOWERCASE = $8; // prefer lowercase letters
ZWP_TEXT_INPUT_V1_CONTENT_HINT_UPPERCASE = $10; // prefer uppercase letters
ZWP_TEXT_INPUT_V1_CONTENT_HINT_TITLECASE = $20; // prefer casing for titles and headings (can be language dependent)
ZWP_TEXT_INPUT_V1_CONTENT_HINT_HIDDEN_TEXT = $40; // characters should be hidden
ZWP_TEXT_INPUT_V1_CONTENT_HINT_SENSITIVE_DATA = $80; // typed text should not be stored
ZWP_TEXT_INPUT_V1_CONTENT_HINT_LATIN = $100; // just latin characters should be entered
ZWP_TEXT_INPUT_V1_CONTENT_HINT_MULTILINE = $200; // the text input is multiline
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_NORMAL = 0; // default input, allowing all characters
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_ALPHA = 1; // allow only alphabetic characters
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_DIGITS = 2; // allow only digits
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_NUMBER = 3; // input a number (including decimal separator and sign)
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_PHONE = 4; // input a phone number
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_URL = 5; // input an URL
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_EMAIL = 6; // input an email address
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_NAME = 7; // input a name of a person
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_PASSWORD = 8; // input a password (combine with password or sensitive_data hint)
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_DATE = 9; // input a date
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_TIME = 10; // input a time
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_DATETIME = 11; // input a date and time
ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_TERMINAL = 12; // input for a terminal
ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_DEFAULT = 0; // default style for composing text
ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_NONE = 1; // style should be the same as in non-composing text
ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_ACTIVE = 2; //
ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_INACTIVE = 3; //
ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT = 4; //
ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_UNDERLINE = 5; //
ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_SELECTION = 6; //
ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_INCORRECT = 7; //
ZWP_TEXT_INPUT_V1_TEXT_DIRECTION_AUTO = 0; // automatic text direction based on text and language
ZWP_TEXT_INPUT_V1_TEXT_DIRECTION_LTR = 1; // left-to-right
ZWP_TEXT_INPUT_V1_TEXT_DIRECTION_RTL = 2; // right-to-left
type
Pzwp_text_input_v1_listener = ^Tzwp_text_input_v1_listener;
Tzwp_text_input_v1_listener = record
enter : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; ASurface: Pwl_surface); cdecl;
leave : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1); cdecl;
modifiers_map : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; AMap: Pwl_array); cdecl;
input_panel_state : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; AState: DWord); cdecl;
preedit_string : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; ASerial: DWord; AText: Pchar; ACommit: Pchar); cdecl;
preedit_styling : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; AIndex: DWord; ALength: DWord; AStyle: DWord); cdecl;
preedit_cursor : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; AIndex: LongInt); cdecl;
commit_string : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; ASerial: DWord; AText: Pchar); cdecl;
cursor_position : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; AIndex: LongInt; AAnchor: LongInt); cdecl;
delete_surrounding_text : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; AIndex: LongInt; ALength: DWord); cdecl;
keysym : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; ASerial: DWord; ATime: DWord; ASym: DWord; AState: DWord; AModifiers: DWord); cdecl;
language : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; ASerial: DWord; ALanguage: Pchar); cdecl;
text_direction : procedure(data: Pointer; AZwpTextInputV1: Pzwp_text_input_v1; ASerial: DWord; ADirection: DWord); cdecl;
end;
Pzwp_text_input_manager_v1_listener = ^Tzwp_text_input_manager_v1_listener;
Tzwp_text_input_manager_v1_listener = record
end;
TZwpTextInputV1 = class;
TZwpTextInputManagerV1 = class;
IZwpTextInputV1Listener = interface
['IZwpTextInputV1Listener']
procedure zwp_text_input_v1_enter(AZwpTextInputV1: TZwpTextInputV1; ASurface: TWlSurface);
procedure zwp_text_input_v1_leave(AZwpTextInputV1: TZwpTextInputV1);
procedure zwp_text_input_v1_modifiers_map(AZwpTextInputV1: TZwpTextInputV1; AMap: Pwl_array);
procedure zwp_text_input_v1_input_panel_state(AZwpTextInputV1: TZwpTextInputV1; AState: DWord);
procedure zwp_text_input_v1_preedit_string(AZwpTextInputV1: TZwpTextInputV1; ASerial: DWord; AText: String; ACommit: String);
procedure zwp_text_input_v1_preedit_styling(AZwpTextInputV1: TZwpTextInputV1; AIndex: DWord; ALength: DWord; AStyle: DWord);
procedure zwp_text_input_v1_preedit_cursor(AZwpTextInputV1: TZwpTextInputV1; AIndex: LongInt);
procedure zwp_text_input_v1_commit_string(AZwpTextInputV1: TZwpTextInputV1; ASerial: DWord; AText: String);
procedure zwp_text_input_v1_cursor_position(AZwpTextInputV1: TZwpTextInputV1; AIndex: LongInt; AAnchor: LongInt);
procedure zwp_text_input_v1_delete_surrounding_text(AZwpTextInputV1: TZwpTextInputV1; AIndex: LongInt; ALength: DWord);
procedure zwp_text_input_v1_keysym(AZwpTextInputV1: TZwpTextInputV1; ASerial: DWord; ATime: DWord; ASym: DWord; AState: DWord; AModifiers: DWord);
procedure zwp_text_input_v1_language(AZwpTextInputV1: TZwpTextInputV1; ASerial: DWord; ALanguage: String);
procedure zwp_text_input_v1_text_direction(AZwpTextInputV1: TZwpTextInputV1; ASerial: DWord; ADirection: DWord);
end;
IZwpTextInputManagerV1Listener = interface
['IZwpTextInputManagerV1Listener']
end;
TZwpTextInputV1 = class(TWLProxyObject)
private
const _ACTIVATE = 0;
const _DEACTIVATE = 1;
const _SHOW_INPUT_PANEL = 2;
const _HIDE_INPUT_PANEL = 3;
const _RESET = 4;
const _SET_SURROUNDING_TEXT = 5;
const _SET_CONTENT_TYPE = 6;
const _SET_CURSOR_RECTANGLE = 7;
const _SET_PREFERRED_LANGUAGE = 8;
const _COMMIT_STATE = 9;
const _INVOKE_ACTION = 10;
public
procedure Activate(ASeat: TWlSeat; ASurface: TWlSurface);
procedure Deactivate(ASeat: TWlSeat);
procedure ShowInputPanel;
procedure HideInputPanel;
procedure Reset;
procedure SetSurroundingText(AText: String; ACursor: DWord; AAnchor: DWord);
procedure SetContentType(AHint: DWord; APurpose: DWord);
procedure SetCursorRectangle(AX: LongInt; AY: LongInt; AWidth: LongInt; AHeight: LongInt);
procedure SetPreferredLanguage(ALanguage: String);
procedure CommitState(ASerial: DWord);
procedure InvokeAction(AButton: DWord; AIndex: DWord);
function AddListener(AIntf: IZwpTextInputV1Listener): LongInt;
end;
TZwpTextInputManagerV1 = class(TWLProxyObject)
private
const _CREATE_TEXT_INPUT = 0;
public
function CreateTextInput(AProxyClass: TWLProxyObjectClass = nil {TZwpTextInputV1}): TZwpTextInputV1;
function AddListener(AIntf: IZwpTextInputManagerV1Listener): LongInt;
end;
var
zwp_text_input_v1_interface: Twl_interface;
zwp_text_input_manager_v1_interface: Twl_interface;
implementation
var
vIntf_zwp_text_input_v1_Listener: Tzwp_text_input_v1_listener;
vIntf_zwp_text_input_manager_v1_Listener: Tzwp_text_input_manager_v1_listener;
procedure TZwpTextInputV1.Activate(ASeat: TWlSeat; ASurface: TWlSurface);
begin
wl_proxy_marshal(FProxy, _ACTIVATE, ASeat.Proxy, ASurface.Proxy);
end;
procedure TZwpTextInputV1.Deactivate(ASeat: TWlSeat);
begin
wl_proxy_marshal(FProxy, _DEACTIVATE, ASeat.Proxy);
end;
procedure TZwpTextInputV1.ShowInputPanel;
begin
wl_proxy_marshal(FProxy, _SHOW_INPUT_PANEL);
end;
procedure TZwpTextInputV1.HideInputPanel;
begin
wl_proxy_marshal(FProxy, _HIDE_INPUT_PANEL);
end;
procedure TZwpTextInputV1.Reset;
begin
wl_proxy_marshal(FProxy, _RESET);
end;
procedure TZwpTextInputV1.SetSurroundingText(AText: String; ACursor: DWord; AAnchor: DWord);
begin
wl_proxy_marshal(FProxy, _SET_SURROUNDING_TEXT, PChar(AText), ACursor, AAnchor);
end;
procedure TZwpTextInputV1.SetContentType(AHint: DWord; APurpose: DWord);
begin
wl_proxy_marshal(FProxy, _SET_CONTENT_TYPE, AHint, APurpose);
end;
procedure TZwpTextInputV1.SetCursorRectangle(AX: LongInt; AY: LongInt; AWidth: LongInt; AHeight: LongInt);
begin
wl_proxy_marshal(FProxy, _SET_CURSOR_RECTANGLE, AX, AY, AWidth, AHeight);
end;
procedure TZwpTextInputV1.SetPreferredLanguage(ALanguage: String);
begin
wl_proxy_marshal(FProxy, _SET_PREFERRED_LANGUAGE, PChar(ALanguage));
end;
procedure TZwpTextInputV1.CommitState(ASerial: DWord);
begin
wl_proxy_marshal(FProxy, _COMMIT_STATE, ASerial);
end;
procedure TZwpTextInputV1.InvokeAction(AButton: DWord; AIndex: DWord);
begin
wl_proxy_marshal(FProxy, _INVOKE_ACTION, AButton, AIndex);
end;
function TZwpTextInputV1.AddListener(AIntf: IZwpTextInputV1Listener): LongInt;
begin
FUserDataRec.ListenerUserData := Pointer(AIntf);
Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_text_input_v1_Listener, @FUserDataRec);
end;
function TZwpTextInputManagerV1.CreateTextInput(AProxyClass: TWLProxyObjectClass = nil {TZwpTextInputV1}): TZwpTextInputV1;
var
id: Pwl_proxy;
begin
id := wl_proxy_marshal_constructor(FProxy,
_CREATE_TEXT_INPUT, @zwp_text_input_v1_interface, nil);
if AProxyClass = nil then
AProxyClass := TZwpTextInputV1;
Result := TZwpTextInputV1(AProxyClass.Create(id));
if not AProxyClass.InheritsFrom(TZwpTextInputV1) then
Raise Exception.CreateFmt('%s does not inherit from %s', [AProxyClass.ClassName, TZwpTextInputV1]);
end;
function TZwpTextInputManagerV1.AddListener(AIntf: IZwpTextInputManagerV1Listener): LongInt;
begin
FUserDataRec.ListenerUserData := Pointer(AIntf);
Result := wl_proxy_add_listener(FProxy, @vIntf_zwp_text_input_manager_v1_Listener, @FUserDataRec);
end;
procedure zwp_text_input_v1_enter_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; ASurface: Pwl_surface); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_enter(TZwpTextInputV1(AData^.PascalObject), TWlSurface(TWLProxyObject.WLToObj(ASurface)));
end;
procedure zwp_text_input_v1_leave_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_leave(TZwpTextInputV1(AData^.PascalObject));
end;
procedure zwp_text_input_v1_modifiers_map_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; AMap: Pwl_array); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_modifiers_map(TZwpTextInputV1(AData^.PascalObject), AMap);
end;
procedure zwp_text_input_v1_input_panel_state_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; AState: DWord); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_input_panel_state(TZwpTextInputV1(AData^.PascalObject), AState);
end;
procedure zwp_text_input_v1_preedit_string_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; ASerial: DWord; AText: Pchar; ACommit: Pchar); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_preedit_string(TZwpTextInputV1(AData^.PascalObject), ASerial, AText, ACommit);
end;
procedure zwp_text_input_v1_preedit_styling_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; AIndex: DWord; ALength: DWord; AStyle: DWord); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_preedit_styling(TZwpTextInputV1(AData^.PascalObject), AIndex, ALength, AStyle);
end;
procedure zwp_text_input_v1_preedit_cursor_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; AIndex: LongInt); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_preedit_cursor(TZwpTextInputV1(AData^.PascalObject), AIndex);
end;
procedure zwp_text_input_v1_commit_string_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; ASerial: DWord; AText: Pchar); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_commit_string(TZwpTextInputV1(AData^.PascalObject), ASerial, AText);
end;
procedure zwp_text_input_v1_cursor_position_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; AIndex: LongInt; AAnchor: LongInt); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_cursor_position(TZwpTextInputV1(AData^.PascalObject), AIndex, AAnchor);
end;
procedure zwp_text_input_v1_delete_surrounding_text_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; AIndex: LongInt; ALength: DWord); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_delete_surrounding_text(TZwpTextInputV1(AData^.PascalObject), AIndex, ALength);
end;
procedure zwp_text_input_v1_keysym_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; ASerial: DWord; ATime: DWord; ASym: DWord; AState: DWord; AModifiers: DWord); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_keysym(TZwpTextInputV1(AData^.PascalObject), ASerial, ATime, ASym, AState, AModifiers);
end;
procedure zwp_text_input_v1_language_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; ASerial: DWord; ALanguage: Pchar); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_language(TZwpTextInputV1(AData^.PascalObject), ASerial, ALanguage);
end;
procedure zwp_text_input_v1_text_direction_Intf(AData: PWLUserData; Azwp_text_input_v1: Pzwp_text_input_v1; ASerial: DWord; ADirection: DWord); cdecl;
var
AIntf: IZwpTextInputV1Listener;
begin
if AData = nil then Exit;
AIntf := IZwpTextInputV1Listener(AData^.ListenerUserData);
AIntf.zwp_text_input_v1_text_direction(TZwpTextInputV1(AData^.PascalObject), ASerial, ADirection);
end;
const
pInterfaces: array[0..12] of Pwl_interface = (
(nil),
(nil),
(nil),
(nil),
(nil),
(nil),
(nil),
(nil),
(@wl_seat_interface),
(@wl_surface_interface),
(@wl_seat_interface),
(@wl_surface_interface),
(@zwp_text_input_v1_interface)
);
zwp_text_input_v1_requests: array[0..10] of Twl_message = (
(name: 'activate'; signature: 'oo'; types: @pInterfaces[8]),
(name: 'deactivate'; signature: 'o'; types: @pInterfaces[10]),
(name: 'show_input_panel'; signature: ''; types: @pInterfaces[0]),
(name: 'hide_input_panel'; signature: ''; types: @pInterfaces[0]),
(name: 'reset'; signature: ''; types: @pInterfaces[0]),
(name: 'set_surrounding_text'; signature: 'suu'; types: @pInterfaces[0]),
(name: 'set_content_type'; signature: 'uu'; types: @pInterfaces[0]),
(name: 'set_cursor_rectangle'; signature: 'iiii'; types: @pInterfaces[0]),
(name: 'set_preferred_language'; signature: 's'; types: @pInterfaces[0]),
(name: 'commit_state'; signature: 'u'; types: @pInterfaces[0]),
(name: 'invoke_action'; signature: 'uu'; types: @pInterfaces[0])
);
zwp_text_input_v1_events: array[0..12] of Twl_message = (
(name: 'enter'; signature: 'o'; types: @pInterfaces[11]),
(name: 'leave'; signature: ''; types: @pInterfaces[0]),
(name: 'modifiers_map'; signature: 'a'; types: @pInterfaces[0]),
(name: 'input_panel_state'; signature: 'u'; types: @pInterfaces[0]),
(name: 'preedit_string'; signature: 'uss'; types: @pInterfaces[0]),
(name: 'preedit_styling'; signature: 'uuu'; types: @pInterfaces[0]),
(name: 'preedit_cursor'; signature: 'i'; types: @pInterfaces[0]),
(name: 'commit_string'; signature: 'us'; types: @pInterfaces[0]),
(name: 'cursor_position'; signature: 'ii'; types: @pInterfaces[0]),
(name: 'delete_surrounding_text'; signature: 'iu'; types: @pInterfaces[0]),
(name: 'keysym'; signature: 'uuuuu'; types: @pInterfaces[0]),
(name: 'language'; signature: 'us'; types: @pInterfaces[0]),
(name: 'text_direction'; signature: 'uu'; types: @pInterfaces[0])
);
zwp_text_input_manager_v1_requests: array[0..0] of Twl_message = (
(name: 'create_text_input'; signature: 'n'; types: @pInterfaces[12])
);
initialization
Pointer(vIntf_zwp_text_input_v1_Listener.enter) := @zwp_text_input_v1_enter_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.leave) := @zwp_text_input_v1_leave_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.modifiers_map) := @zwp_text_input_v1_modifiers_map_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.input_panel_state) := @zwp_text_input_v1_input_panel_state_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.preedit_string) := @zwp_text_input_v1_preedit_string_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.preedit_styling) := @zwp_text_input_v1_preedit_styling_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.preedit_cursor) := @zwp_text_input_v1_preedit_cursor_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.commit_string) := @zwp_text_input_v1_commit_string_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.cursor_position) := @zwp_text_input_v1_cursor_position_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.delete_surrounding_text) := @zwp_text_input_v1_delete_surrounding_text_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.keysym) := @zwp_text_input_v1_keysym_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.language) := @zwp_text_input_v1_language_Intf;
Pointer(vIntf_zwp_text_input_v1_Listener.text_direction) := @zwp_text_input_v1_text_direction_Intf;
zwp_text_input_v1_interface.name := 'zwp_text_input_v1';
zwp_text_input_v1_interface.version := 1;
zwp_text_input_v1_interface.method_count := 11;
zwp_text_input_v1_interface.methods := @zwp_text_input_v1_requests;
zwp_text_input_v1_interface.event_count := 13;
zwp_text_input_v1_interface.events := @zwp_text_input_v1_events;
zwp_text_input_manager_v1_interface.name := 'zwp_text_input_manager_v1';
zwp_text_input_manager_v1_interface.version := 1;
zwp_text_input_manager_v1_interface.method_count := 1;
zwp_text_input_manager_v1_interface.methods := @zwp_text_input_manager_v1_requests;
zwp_text_input_manager_v1_interface.event_count := 0;
zwp_text_input_manager_v1_interface.events := nil;
end.
|
unit Persistent;
interface
uses
BackupInterfaces;
{$M+}
type
TPersistent =
class
protected
procedure LoadFromBackup( Reader : IBackupReader ); virtual;
procedure StoreToBackup ( Writer : IBackupWriter ); virtual;
end;
{$M-}
procedure RegisterBackup;
implementation
// TPersistent
procedure TPersistent.LoadFromBackup( Reader : IBackupReader );
begin
end;
procedure TPersistent.StoreToBackup( Writer : IBackupWriter );
begin
end;
// Backup Agent
type
TPersistentBackupAgent =
class(TBackupAgent)
protected
class procedure Write(Stream : IBackupWriter; Obj : TObject); override;
class procedure Read (Stream : IBackupReader; Obj : TObject); override;
end;
class procedure TPersistentBackupAgent.Write(Stream : IBackupWriter; Obj : TObject);
begin
//try
TPersistent(Obj).StoreToBackup(Stream);
//except
//end;
end;
class procedure TPersistentBackupAgent.Read(Stream : IBackupReader; Obj : TObject);
begin
try
TPersistent(Obj).LoadFromBackup(Stream);
except
end;
end;
// RegisterBackup
procedure RegisterBackup;
begin
TPersistentBackupAgent.Register([TPersistent]);
end;
end.
|
unit Logger;
interface
uses
LoggerInterface, System.SyncObjs, System.Classes, SettingsInterface,
System.Generics.Collections;
type
TLogger = class(TComponent, ILogger)
strict private
procedure Add(AMessage: string; AMessageStatus: TMessageStatus);
function GetAddMessageEvent: TEvent;
procedure TruncateLog;
procedure WaitLogTruncateTime;
private
FCancellationEvent: TEvent;
FCS: TCriticalSection;
FAddMessageEvent: TEvent;
FDataLifeTime: Cardinal;
FFileName: string;
FMessageStatus: TDictionary<TMessageStatus, String>;
FStringList: TStrings;
FTruncateFileInterval: Cardinal;
FTruncateThread: TThread;
procedure CreateTruncateLogThread;
procedure TerminateTruncateLogThread;
public
constructor Create(AOwner: TComponent;
const ALoggerSettingsI: ILoggerSettings); reintroduce;
destructor Destroy; override;
function GetLastMessages: TArray<String>;
end;
implementation
uses
System.IOUtils, System.SysUtils, Winapi.Windows, System.DateUtils;
constructor TLogger.Create(AOwner: TComponent;
const ALoggerSettingsI: ILoggerSettings);
begin
if not Assigned(ALoggerSettingsI) then
raise Exception.Create('Logger settings interface is not assigned');
inherited Create(AOwner);
FMessageStatus := TDictionary<TMessageStatus, String>.Create;
FMessageStatus.Add(msCritical, 'Critical');
FMessageStatus.Add(msWarning, 'Warning');
FMessageStatus.Add(msInfo, 'Info');
FCS := TCriticalSection.Create;
FStringList := TStringList.Create;
// Запоминаем свои настройки
FFileName := ALoggerSettingsI.FileName;
FDataLifeTime := ALoggerSettingsI.DataLifeTime;
FTruncateFileInterval := ALoggerSettingsI.TruncateFileInterval;
TFile.WriteAllText(ALoggerSettingsI.FileName, '');
// Автосбрасываемое событие
// Логгер будет устанавливать это событие после добавления сообщения
FAddMessageEvent := TEvent.Create(nil, False, False, '');
// Запускаем поток, который будет обрезать файл
CreateTruncateLogThread;
end;
destructor TLogger.Destroy;
begin
TerminateTruncateLogThread;
if FCS <> nil then
FreeAndNil(FCS);
if FStringList <> nil then
FreeAndNil(FStringList);
if FMessageStatus <> nil then
FreeAndNil(FMessageStatus);
if FAddMessageEvent <> nil then
FreeAndNil(FAddMessageEvent);
inherited;
end;
procedure TLogger.Add(AMessage: string; AMessageStatus: TMessageStatus);
var
AStatus: String;
AText: string;
ATreadID: Cardinal;
begin
if not FMessageStatus.TryGetValue(AMessageStatus, AStatus) then
raise Exception.Create('Undefined message status');
ATreadID := GetCurrentThreadId;
AText := Format('%s %s %s %s%s', [AMessage.PadRight(30), AStatus.PadRight(9),
ATreadID.ToString.PadRight(10), DateTimeToStr(Now), sLineBreak]);
FCS.Enter;
try
TFile.AppendAllText(FFileName, AText);
FStringList.Append(AText);
if FStringList.Count > 10 then
FStringList.Delete(0);
FAddMessageEvent.SetEvent;
finally
FCS.Leave;
end;
end;
procedure TLogger.CreateTruncateLogThread;
begin
// Событие, которого будет ждать поток
FCancellationEvent := TEvent.Create();
FCancellationEvent.ResetEvent;
FTruncateThread := TThread.CreateAnonymousThread(
procedure
begin
WaitLogTruncateTime;
end);
FTruncateThread.FreeOnTerminate := False;
FTruncateThread.Start;
end;
function TLogger.GetAddMessageEvent: TEvent;
begin
Result := FAddMessageEvent;
end;
function TLogger.GetLastMessages: TArray<String>;
begin
FCS.Enter;
try
Result := FStringList.ToStringArray;
finally
FCS.Leave;
end;
end;
procedure TLogger.WaitLogTruncateTime;
var
AWaitResult: TWaitResult;
begin
while True do
begin
// Ждём события завершения
AWaitResult := FCancellationEvent.WaitFor(FTruncateFileInterval);
// Если события завершения не дождались
if AWaitResult = wrTimeout then
begin
TruncateLog;
end
else
break;
end;
end;
procedure TLogger.TerminateTruncateLogThread;
begin
if FCancellationEvent <> nil then
begin
FCancellationEvent.SetEvent;
FTruncateThread.WaitFor; // Ждём завершения потока
FreeAndNil(FTruncateThread);
FreeAndNil(FCancellationEvent);
end;
end;
procedure TLogger.TruncateLog;
var
ADateTime: TDateTime;
ADateTimeStr: string;
ALine: string;
AMinDateTime: TDateTime;
ANowStr: string;
AStreamReader: TStreamReader;
AFoundOldRecord: Boolean;
ANewFileContents: string;
begin
try
ANewFileContents := '';
AMinDateTime := IncMinute(Now, -1 * FDataLifeTime);
ANowStr := DateTimeToStr(AMinDateTime);
FCS.Enter;
try
AStreamReader := TFile.OpenText(FFileName);
try
AFoundOldRecord := False;
while not AStreamReader.EndOfStream do
begin
ALine := AStreamReader.ReadLine;
ADateTimeStr := ALine.Substring(ALine.Length - ANowStr.Length);
ADateTime := StrToDateTime(ADateTimeStr);
// если запись в логе старая
if ADateTime < AMinDateTime then
begin
AFoundOldRecord := True;
continue;
end
else
begin
if not AFoundOldRecord then
break; // Похоже все записи в логе свежие
ANewFileContents := ALine + sLineBreak + AStreamReader.ReadToEnd;
end;
end;
finally
AStreamReader.Close;
end;
// Если лог нужно перезаписать
if ANewFileContents <> '' then
TFile.WriteAllText(FFileName, ANewFileContents);
finally
FCS.Release;
end;
except
; // Не получилось обновить файл. Может быть получится в следующий раз.
end;
end;
end.
|
unit DW.Firebase.InstanceId.Android;
{*******************************************************}
{ }
{ Kastri Free }
{ }
{ DelphiWorlds Cross-Platform Library }
{ }
{*******************************************************}
{$I DW.GlobalDefines.inc}
interface
uses
// Android
Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Embarcadero,
// DW
DW.Firebase.InstanceId;
type
TPlatformFirebaseInstanceId = class;
TFirebaseInstanceIdReceiverListener = class(TJavaLocal, JFMXBroadcastReceiverListener)
private
FFirebaseInstanceId: TPlatformFirebaseInstanceId;
public
{ JFMXBroadcastReceiverListener }
procedure onReceive(context: JContext; intent: JIntent); cdecl;
public
constructor Create(const AFirebaseInstanceId: TPlatformFirebaseInstanceId);
end;
TPlatformFirebaseInstanceId = class(TCustomPlatformFirebaseInstanceId)
private
FFirebaseInstanceIdBroadcastReceiver: JFMXBroadcastReceiver;
FFirebaseInstanceIdReceiverListener: TFirebaseInstanceIdReceiverListener;
protected
function GetToken: string; override;
procedure HandleTokenRefresh(const AToken: string);
public
constructor Create(const AFirebaseInstanceId: TFirebaseInstanceId); override;
destructor Destroy; override;
end;
implementation
uses
// RTL
System.Classes,
// Android
Androidapi.Helpers,
// DW
DW.Androidapi.JNI.Firebase, DW.FirebaseApp.Android, DW.Androidapi.JNI.FirebaseServiceHelpers, DW.Androidapi.JNI.LocalBroadcastManager,
DW.OSLog;
{ TFirebaseInstanceIdReceiverListener }
constructor TFirebaseInstanceIdReceiverListener.Create(const AFirebaseInstanceId: TPlatformFirebaseInstanceId);
begin
inherited Create;
FFirebaseInstanceId := AFirebaseInstanceId;
end;
procedure TFirebaseInstanceIdReceiverListener.onReceive(context: JContext; intent: JIntent);
begin
if (intent <> nil) and (intent.getAction.compareTo(TJDWFirebaseInstanceIdService.JavaClass.ACTION_TOKEN_REFRESHED) = 0) then
FFirebaseInstanceId.HandleTokenRefresh(JStringToString(intent.getStringExtra(StringToJString('token'))));
end;
{ TPlatformFirebaseInstanceId }
constructor TPlatformFirebaseInstanceId.Create(const AFirebaseInstanceId: TFirebaseInstanceId);
var
LIntentFilter: JIntentFilter;
begin
inherited;
TPlatformFirebaseApp.Start;
FFirebaseInstanceIdReceiverListener := TFirebaseInstanceIdReceiverListener.Create(Self);
FFirebaseInstanceIdBroadcastReceiver := TJFMXBroadcastReceiver.JavaClass.init(FFirebaseInstanceIdReceiverListener);
LIntentFilter := TJIntentFilter.JavaClass.init(TJDWFirebaseInstanceIdService.JavaClass.ACTION_TOKEN_REFRESHED);
TJLocalBroadcastManager.JavaClass.getInstance(TAndroidHelper.Context).registerReceiver(FFirebaseInstanceIdBroadcastReceiver, LIntentFilter);
end;
destructor TPlatformFirebaseInstanceId.Destroy;
begin
FFirebaseInstanceIdReceiverListener.Free;
FFirebaseInstanceIdBroadcastReceiver := nil;
inherited;
end;
function TPlatformFirebaseInstanceId.GetToken: string;
begin
Result := JStringToString(TJFirebaseInstanceId.JavaClass.getInstance().getToken());
end;
procedure TPlatformFirebaseInstanceId.HandleTokenRefresh(const AToken: string);
begin
TThread.Queue(nil,
procedure
begin
DoTokenRefresh(AToken);
end
);
end;
end.
|
{
$Project$
$Workfile$
$Revision$
$DateUTC$
$Id$
This file is part of the Indy (Internet Direct) project, and is offered
under the dual-licensing agreement described on the Indy website.
(http://www.indyproject.org/)
Copyright:
(c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
}
{
$Log$
}
{
Rev 1.9 10/26/2004 10:10:58 PM JPMugaas
Updated refs.
Rev 1.8 3/6/2004 2:53:30 PM JPMugaas
Cleaned up an if as per Bug #79.
Rev 1.7 2004.02.03 5:43:42 PM czhower
Name changes
Rev 1.6 2004.01.27 1:39:26 AM czhower
CharIsInSet bug fix
Rev 1.5 1/22/2004 3:50:04 PM SPerry
fixed set problems (with CharIsInSet)
Rev 1.4 1/22/2004 7:10:06 AM JPMugaas
Tried to fix AnsiSameText depreciation.
Rev 1.3 10/5/2003 11:43:50 PM GGrieve
Use IsLeadChar
Rev 1.2 10/4/2003 9:15:14 PM GGrieve
DotNet changes
Rev 1.1 2/25/2003 12:56:20 PM JPMugaas
Updated with Hadi's fix for a bug . If complete boolean expression i on, you
may get an Index out of range error.
Rev 1.0 11/13/2002 07:53:52 AM JPMugaas
2002-Jan-27 Don Siders
- Modified FoldLine to include Comma in break character set.
2000-May-31 J. Peter Mugaas
- started this class to facilitate some work on Indy so we don't have to
convert '=' to ":" and vice-versa just to use the Values property.
}
unit IdHeaderList;
{
NOTE: This is a modification of Borland's TStrings definition in a
TStringList descendant. I had to conceal the original Values to do
this since most of low level property setting routines aren't virtual
and are private.
}
interface
{$i IdCompilerDefines.inc}
uses
Classes, IdGlobalProtocols;
type
TIdHeaderList = class(TStringList)
protected
FNameValueSeparator : String;
FUnfoldLines : Boolean;
FFoldLines : Boolean;
FFoldLinesLength : Integer;
FQuoteType: TIdHeaderQuotingType;
//
procedure AssignTo(Dest: TPersistent); override;
{This deletes lines which were folded}
Procedure DeleteFoldedLines(Index : Integer);
{This folds one line into several lines}
function FoldLine(AString : string): TStrings; {$IFDEF HAS_DEPRECATED}deprecated{$IFDEF HAS_DEPRECATED_MSG} 'Use FoldLineToList()'{$ENDIF};{$ENDIF}
procedure FoldLineToList(AString : string; ALines: TStrings);
{Folds lines and inserts them into a position, Index}
procedure FoldAndInsert(AString : String; Index : Integer);
{Name property get method}
function GetName(Index: Integer): string;
{Value property get method}
function GetValue(const AName: string): string;
{Value property get method}
function GetParam(const AName, AParam: string): string;
function GetAllParams(const AName: string): string;
{Value property set method}
procedure SetValue(const AName, AValue: string);
{Value property set method}
procedure SetParam(const AName, AParam, AValue: string);
procedure SetAllParams(const AName, AValue: string);
{Gets a value from a string}
function GetValueFromLine(var VLine : Integer) : String;
procedure SkipValueAtLine(var VLine : Integer);
public
procedure AddStrings(Strings: TStrings); override;
{ This method extracts "name=value" strings from the ASrc TStrings and adds
them to this list using our delimiter defined in NameValueSeparator. }
procedure AddStdValues(ASrc: TStrings);
{ This method adds a single name/value pair to this list using our delimiter
defined in NameValueSeparator. }
procedure AddValue(const AName, AValue: string); // allows duplicates
{ This method extracts all of the values from this list and puts them in the
ADest TStrings as "name=value" strings.}
procedure ConvertToStdValues(ADest: TStrings);
constructor Create(AQuoteType: TIdHeaderQuotingType);
{ This method, given a name specified by AName, extracts all of the values
for that name and puts them in a new string list (just the values) one
per line in the ADest TIdStrings.}
procedure Extract(const AName: string; ADest: TStrings);
{ This property works almost exactly as Borland's IndexOfName except it
uses our delimiter defined in NameValueSeparator }
function IndexOfName(const AName: string): Integer; reintroduce;
{ This property works almost exactly as Borland's Names except it uses
our delimiter defined in NameValueSeparator }
property Names[Index: Integer]: string read GetName;
{ This property works almost exactly as Borland's Values except it uses
our delimiter defined in NameValueSeparator }
property Values[const Name: string]: string read GetValue write SetValue;
property Params[const Name, Param: string]: string read GetParam write SetParam;
property AllParams[const Name: string]: string read GetAllParams write SetAllParams;
{ This is the separator we need to separate the name from the value }
property NameValueSeparator : String read FNameValueSeparator
write FNameValueSeparator;
{ Should we unfold lines so that continuation header data is returned as
well}
property UnfoldLines : Boolean read FUnfoldLines write FUnfoldLines;
{ Should we fold lines we the Values(x) property is set with an
assignment }
property FoldLines : Boolean read FFoldLines write FFoldLines;
{ The Wrap position for our folded lines }
property FoldLength : Integer read FFoldLinesLength write FFoldLinesLength;
end;
implementation
uses
IdException,
IdGlobal,
SysUtils;
{ TIdHeaderList }
procedure TIdHeaderList.AddStdValues(ASrc: TStrings);
var
i: integer;
LValue: string;
{$IFNDEF HAS_TStrings_ValueFromIndex}
LTmp: string;
{$ENDIF}
begin
BeginUpdate;
try
for i := 0 to ASrc.Count - 1 do begin
{$IFDEF HAS_TStrings_ValueFromIndex}
LValue := ASrc.ValueFromIndex[i];
{$ELSE}
LTmp := ASrc.Strings[i];
LValue := Copy(LTmp, Pos('=', LTmp)+1, MaxInt); {do not localize}
{$ENDIF}
AddValue(ASrc.Names[i], LValue);
end;
finally
EndUpdate;
end;
end;
procedure TIdHeaderList.AddValue(const AName, AValue: string);
var
I: Integer;
begin
if (AName <> '') and (AValue <> '') then begin {Do not Localize}
I := Add(''); {Do not Localize}
if FFoldLines then begin
FoldAndInsert(AName + FNameValueSeparator + AValue, I);
end else begin
Put(I, AName + FNameValueSeparator + AValue);
end;
end;
end;
procedure TIdHeaderList.AddStrings(Strings: TStrings);
begin
if Strings is TIdHeaderList then begin
inherited AddStrings(Strings);
end else begin
AddStdValues(Strings);
end;
end;
procedure TIdHeaderList.AssignTo(Dest: TPersistent);
begin
if (Dest is TStrings) and not (Dest is TIdHeaderList) then begin
ConvertToStdValues(TStrings(Dest));
end else begin
inherited AssignTo(Dest);
end;
end;
procedure TIdHeaderList.ConvertToStdValues(ADest: TStrings);
var
idx: Integer;
LName, LValue: string;
begin
ADest.BeginUpdate;
try
idx := 0;
while idx < Count do
begin
LName := GetName(idx);
LValue := GetValueFromLine(idx);
ADest.Add(LName + '=' + LValue); {do not localize}
end;
finally
ADest.EndUpdate;
end;
end;
constructor TIdHeaderList.Create(AQuoteType: TIdHeaderQuotingType);
begin
inherited Create;
FNameValueSeparator := ': '; {Do not Localize}
FUnfoldLines := True;
FFoldLines := True;
{ 78 was specified by a message draft available at
http://www.imc.org/draft-ietf-drums-msg-fmt }
FFoldLinesLength := 78;
FQuoteType := AQuoteType;
end;
procedure TIdHeaderList.DeleteFoldedLines(Index: Integer);
begin
Inc(Index); {skip the current line}
if Index < Count then begin
while (Index < Count) and CharIsInSet(Get(Index), 1, LWS) do begin {Do not Localize}
Delete(Index);
end;
end;
end;
procedure TIdHeaderList.Extract(const AName: string; ADest: TStrings);
var
idx : Integer;
begin
if Assigned(ADest) then begin
ADest.BeginUpdate;
try
idx := 0;
while idx < Count do
begin
if TextIsSame(AName, GetName(idx)) then begin
ADest.Add(GetValueFromLine(idx));
end else begin
SkipValueAtLine(idx);
end;
end;
finally
ADest.EndUpdate;
end;
end;
end;
procedure TIdHeaderList.FoldAndInsert(AString : String; Index: Integer);
var
LStrs : TStrings;
idx : Integer;
begin
LStrs := TStringList.Create;
try
FoldLineToList(AString, LStrs);
idx := LStrs.Count - 1;
Put(Index, LStrs[idx]);
{We decrement by one because we put the last string into the HeaderList}
Dec(idx);
while idx > -1 do
begin
Insert(Index, LStrs[idx]);
Dec(idx);
end;
finally
FreeAndNil(LStrs);
end; //finally
end;
function TIdHeaderList.FoldLine(AString : string): TStrings;
begin
Result := TStringList.Create;
try
FoldLineToList(AString, Result);
except
FreeAndNil(Result);
raise;
end;
end;
procedure TIdHeaderList.FoldLineToList(AString : string; ALines: TStrings);
var
s : String;
begin
{we specify a space so that starts a folded line}
s := IndyWrapText(AString, EOL+' ', LWS+',', FFoldLinesLength); {Do not Localize}
if s <> '' then begin
ALines.BeginUpdate;
try
repeat
ALines.Add(TrimRight(Fetch(s, EOL)));
until s = ''; {Do not Localize};
finally
ALines.EndUpdate;
end;
end;
end;
function TIdHeaderList.GetName(Index: Integer): string;
var
I : Integer;
begin
Result := Get(Index);
{We trim right to remove space to accomodate header errors such as
Message-ID:<asdf@fdfs
}
I := IndyPos(TrimRight(FNameValueSeparator), Result);
if I <> 0 then begin
SetLength(Result, I - 1);
end else begin
SetLength(Result, 0);
end;
end;
function TIdHeaderList.GetValue(const AName: string): string;
var
idx: Integer;
begin
idx := IndexOfName(AName);
Result := GetValueFromLine(idx);
end;
function TIdHeaderList.GetValueFromLine(var VLine: Integer): String;
var
LLine, LSep: string;
P: Integer;
begin
if (VLine >= 0) and (VLine < Count) then begin
LLine := Get(VLine);
Inc(VLine);
{We trim right to remove space to accomodate header errors such as
Message-ID:<asdf@fdfs
}
LSep := TrimRight(FNameValueSeparator);
P := IndyPos(LSep, LLine);
Result := TrimLeft(Copy(LLine, P + Length(LSep), MaxInt));
if FUnfoldLines then begin
while VLine < Count do begin
LLine := Get(VLine);
// s[1] is safe since header lines cannot be empty as that causes then end of the header block
if not CharIsInSet(LLine, 1, LWS) then begin
Break;
end;
Result := Trim(Result) + ' ' + Trim(LLine); {Do not Localize}
Inc(VLine);
end;
end;
// User may be fetching a folded line directly.
Result := Trim(Result);
end else begin
Result := ''; {Do not Localize}
end;
end;
procedure TIdHeaderList.SkipValueAtLine(var VLine: Integer);
begin
if (VLine >= 0) and (VLine < Count) then begin
Inc(VLine);
if FUnfoldLines then begin
while VLine < Count do begin
// s[1] is safe since header lines cannot be empty as that causes then end of the header block
if not CharIsInSet(Get(VLine), 1, LWS) then begin
Break;
end;
Inc(VLine);
end;
end;
end;
end;
function TIdHeaderList.GetParam(const AName, AParam: string): string;
var
s: string;
LQuoteType: TIdHeaderQuotingType;
begin
s := Values[AName];
if s <> '' then begin
LQuoteType := FQuoteType;
case LQuoteType of
QuoteRFC822: begin
if PosInStrArray(AName, ['Content-Type', 'Content-Disposition'], False) <> -1 then begin {Do not Localize}
LQuoteType := QuoteMIME;
end;
end;
QuoteMIME: begin
if PosInStrArray(AName, ['Content-Type', 'Content-Disposition'], False) = -1 then begin {Do not Localize}
LQuoteType := QuoteRFC822;
end;
end;
end;
Result := ExtractHeaderSubItem(s, AParam, LQuoteType);
end else begin
Result := '';
end;
end;
function TIdHeaderList.GetAllParams(const AName: string): string;
var
s: string;
begin
s := Values[AName];
if s <> '' then begin
Fetch(s, ';'); {do not localize}
Result := Trim(s);
end else begin
Result := '';
end;
end;
function TIdHeaderList.IndexOfName(const AName: string): Integer;
var
i: LongInt;
begin
Result := -1;
for i := 0 to Count - 1 do begin
if TextIsSame(GetName(i), AName) then begin
Result := i;
Exit;
end;
end;
end;
procedure TIdHeaderList.SetValue(const AName, AValue: string);
var
I: Integer;
begin
I := IndexOfName(AName);
if AValue <> '' then begin {Do not Localize}
if I < 0 then begin
I := Add(''); {Do not Localize}
end;
if FFoldLines then begin
DeleteFoldedLines(I);
FoldAndInsert(AName + FNameValueSeparator + AValue, I);
end else begin
Put(I, AName + FNameValueSeparator + AValue);
end;
end
else if I >= 0 then begin
if FFoldLines then begin
DeleteFoldedLines(I);
end;
Delete(I);
end;
end;
procedure TIdHeaderList.SetParam(const AName, AParam, AValue: string);
var
LQuoteType: TIdHeaderQuotingType;
begin
LQuoteType := FQuoteType;
case LQuoteType of
QuoteRFC822: begin
if PosInStrArray(AName, ['Content-Type', 'Content-Disposition'], False) <> -1 then begin {Do not Localize}
LQuoteType := QuoteMIME;
end;
end;
QuoteMIME: begin
if PosInStrArray(AName, ['Content-Type', 'Content-Disposition'], False) = -1 then begin {Do not Localize}
LQuoteType := QuoteRFC822;
end;
end;
end;
Values[AName] := ReplaceHeaderSubItem(Values[AName], AParam, AValue, LQuoteType);
end;
procedure TIdHeaderList.SetAllParams(const AName, AValue: string);
var
LValue: string;
begin
LValue := Values[AName];
if LValue <> '' then
begin
LValue := ExtractHeaderItem(LValue);
if AValue <> '' then begin
LValue := LValue + '; ' + AValue; {do not localize}
end;
Values[AName] := LValue;
end;
end;
end.
|
unit HorizProgressBar;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls;
type
THorizProgressBar = class(TImage)
private
fbackpic:tpicture;
fthumbpic:tpicture;
fposition:integer;
fmin,
fmax:integer;
fdown:boolean;
FOnChange: TNotifyEvent;
procedure setbackround(Value: tpicture);
procedure setposition(Value: integer);
procedure setthumb(Value: tpicture);
protected
public
constructor Create(AOwner: TComponent); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
Procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
destructor Destroy; override;
procedure Paint; override;
published
Property Background:tpicture read fbackpic write setbackround;
Property Foreground:tpicture read fthumbpic write setthumb;
Property Position:integer read fposition write setposition default 0;
Property Maximum:integer read fmax write fmax default 100;
Property Minimum:integer read fmin write fmin default 0;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Touch',[THorizProgressBar]);
end;
{ TButtonSlider }
procedure THorizProgressBar.setbackround(Value: tpicture);
begin
fbackpic.assign(value);
picture.assign(value);
if assigned(fbackpic) then begin
width:=fbackpic.Width;
height:=fbackpic.Height;
end;
end;
procedure THorizProgressBar.setposition(Value: integer);
begin
fposition:=value;
if fposition<fmin then fposition:=fmin;
if fposition>fmax then fposition:=fmax;
invalidate;
end;
procedure THorizProgressBar.setthumb(Value: tpicture);
begin
fthumbpic.assign(value);
end;
constructor THorizProgressBar.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Fbackpic:= TPicture.Create;
fthumbpic:= TPicture.Create;
fposition:=0;
fmin:=0;
fmax:=100;
fdown:=false;
end;
procedure THorizProgressBar.MouseMove(Shift: TShiftState; X, Y: Integer);
begin
if (X<0)or(X>Width)or(Y<0)or(Y>Height) then fdown:=false;
if fdown=false then exit;
fposition:=(x*fmax) div width;
inherited MouseMove(Shift, X, Y);
invalidate;
if assigned(fonchange) then fonchange(nil);
end;
procedure THorizProgressBar.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
if (Button=mbLeft) then fdown:=false;
inherited MouseUp(Button, Shift, X, Y);
invalidate;
end;
procedure THorizProgressBar.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
if (Button=mbLeft) then fdown:=true;
inherited MouseDown(Button, Shift, X, Y);
end;
destructor THorizProgressBar.Destroy;
begin
fthumbpic.free;
fbackpic.free;
inherited Destroy;
end;
procedure THorizProgressBar.Paint;
var
tw,th,tx,ty,
startx,endx:integer;
begin
inherited Paint;
tw:=fthumbpic.Width;
th:=fthumbpic.height;
tx:=(fposition * tw) div fmax;
if assigned(fbackpic) then canvas.Draw(0,0,fbackpic.graphic);
if assigned(fthumbpic) then
canvas.CopyRect(rect(0,0,tx,th),fthumbpic.Bitmap.Canvas,rect(0,0,tx,th));
end;
end.
|
unit mcRemoteControlTypes;
interface
uses
Classes, SysUtils;
//RttiClasses;
type
{$TYPEINFO ON}
TBaseRemoteObject = class //(TRttiEnabled)
private
FName: string;
FOwner: TBaseRemoteObject;
protected
procedure AutoCreateRTTIStuff;
published
constructor Create(aOwner: TBaseRemoteObject; const aName: string);overload;
procedure AfterConstruction;override;
function Enabled : Boolean;
function Visible : Boolean;
function CanFocus: Boolean;
function Exists: Boolean;
procedure CheckEnabled(aTimeOut: Integer = 5 * 1000);
procedure CheckVisible(aTimeOut: Integer = 5 * 1000);
procedure CheckCanFocus(aTimeOut: Integer = 5 * 1000);
procedure CheckExists(aTimeOut: Integer = 5 * 1000);
//Parent: TBaseRemoteObject;
property Owner: TBaseRemoteObject read FOwner;
property Name : string read FName write FName;
//
function FullPath: string;
end;
TBaseRemoteObjectClass = class of TBaseRemoteObject;
TForm = class(TBaseRemoteObject)
public
procedure Close;
end;
TAction = class(TBaseRemoteObject)
published
function Execute: Boolean;
end;
TRBKAction = class(TAction)
end;
TButton = class(TBaseRemoteObject)
private
function GetCaption: string;
procedure SetCaption(const Value: string);
public
procedure Click;
property Caption: string read GetCaption write SetCaption;
end;
TEdit = class(TBaseRemoteObject)
private
function GetText: string;
procedure SetText(const Value: string);
public
property Text : string read GetText write SetText;
end;
TGridPanel = class(TBaseRemoteObject)
end;
TAdvGlowButton = class(TBaseRemoteObject)
public
function Click: Boolean;
end;
TAdvSpeedButton = class(TBaseRemoteObject)
public
function Click: Boolean;
end;
TAdvEdit = class(TBaseRemoteObject)
end;
TAdvSmoothTabPager = class(TBaseRemoteObject)
private
function GetActivePageIndex: Integer;
procedure SetActivePageIndex(const Value: Integer);
public
property ActivePageIndex: Integer read GetActivePageIndex write SetActivePageIndex;
end;
TAdvSmoothListBox = class(TBaseRemoteObject)
private
function GetSelectedItemIndex: integer;
procedure SetSelectedItemIndex(const Value: integer);
public
procedure Click;
property SelectedItemIndex: integer read GetSelectedItemIndex write SetSelectedItemIndex;
end;
TEditButton = class(TBaseRemoteObject)
published
AdvSpeedButton : TAdvSpeedButton;
end;
TRBKTouchEditBtn = class(TBaseRemoteObject)
private
function GetText: string;
function GetValue: Variant;
procedure SetText(const Value: string);
procedure SetValue(const Value: Variant);
public
function ClickBtn: Boolean;
property Value: Variant read GetValue write SetValue;
property Text : string read GetText write SetText;
published
EditButton : TEditButton;
end;
TAdvSmoothCalendar = class(TBaseRemoteObject)
public
procedure SetDate(aNewDate: TDate);
end;
TAdvSmoothTouchKeyBoard = class(TBaseRemoteObject)
end;
TAdvColumnGrid = class(TBaseRemoteObject)
private
function GetRowCount: Integer;
public
property RowCount: Integer read GetRowCount;
end;
TBaseRemoteFrame = class(TBaseRemoteObject)
end;
TFrame = class(TBaseRemoteFrame)
end;
TBaseRemoteTouchMain = class(TBaseRemoteObject)
private
FactMelding: TAction;
FactBack: TAction;
FactHome: TAction;
FactExit: TAction;
FactNext: TAction;
published
property actHome : TAction read FactHome write FactHome;
property actBack : TAction read FactBack write FactBack;
property actNext : TAction read FactNext write FactNext;
property actMelding : TAction read FactMelding write FactMelding;
property actExit : TAction read FactExit write FactExit;
end;
implementation
uses
mcRemoteControlExecuter, Rtti, TypInfo, Messages;
var
RttiCache: TRttiContext;
{ TAction }
function TAction.Execute: Boolean;
begin
Result := TRemoteControlExecutor.Execute(Self, 'Enabled', []).AsBoolean;
TRemoteControlExecutor.Execute_Async(Self, 'Execute', []); //async, because can do showmodal
end;
{ TRBKTouchEditBtn }
function TRBKTouchEditBtn.ClickBtn: Boolean;
begin
Result := TRemoteControlExecutor.Execute(Self, 'Enabled', []).AsBoolean;
TRemoteControlExecutor.Execute_Async(Self, 'ClickBtn', []); //async, because can do showmodal
//TRemoteControlExecutor.PostMessage(Self, WM_LBUTTONDOWN, 0, 0); //async, because can do showmodal
//Result := Result and
// Self.EditButton.AdvSpeedButton.Click;
end;
{ TBaseRemoteTouchFrame }
//function TBaseRemoteTouchFrame.GoNext: Boolean;
//begin
// Result := TRemoteControlExecutor.Execute(Self, 'GoNext',[]).AsBoolean;
//end;
function TRBKTouchEditBtn.GetText: string;
begin
Result := TRemoteControlExecutor.Execute(Self, 'Text', []).AsString;
end;
function TRBKTouchEditBtn.GetValue: Variant;
begin
Result := TRemoteControlExecutor.Execute(Self, 'Value', []).AsVariant;
end;
procedure TRBKTouchEditBtn.SetText(const Value: string);
begin
TRemoteControlExecutor.Execute(Self, 'Text', [Value]);
end;
procedure TRBKTouchEditBtn.SetValue(const Value: Variant);
begin
TRemoteControlExecutor.Execute(Self, 'Value', [TValue.FromVariant(Value)]);
end;
{ TAdvSmoothCalendar }
procedure TAdvSmoothCalendar.SetDate(aNewDate: TDate);
begin
TRemoteControlExecutor.Execute(Self, 'SelectedDate',[aNewDate]);
end;
{ TBaseRemoteObject }
procedure TBaseRemoteObject.AfterConstruction;
begin
inherited;
AutoCreateRTTIStuff;
end;
procedure TBaseRemoteObject.AutoCreateRTTIStuff;
var
rttitype: TRttiType;
rttiprop: TRttiProperty;
rttifield: TRttiField;
begin
rttitype := RttiCache.GetType(Self.ClassType);
for rttiprop in rttitype.GetProperties do
begin
rttiprop.Name;
if rttiprop.PropertyType.IsInstance and
rttiprop.IsWritable and
(rttiprop.Visibility in [mvPublished]) and
(rttiprop.GetValue(Self).AsObject = nil) and
rttiprop.PropertyType.AsInstance.MetaclassType.InheritsFrom(TBaseRemoteObject) then
begin
rttiprop.SetValue( Self,
TBaseRemoteObjectClass(rttiprop.PropertyType.AsInstance.MetaclassType)
.Create( Self, rttiprop.Name )
);
end;
end;
for rttifield in rttitype.GetFields do
begin
rttifield.Name;
if rttifield.FieldType.IsInstance and
(rttifield.Visibility in [mvPublished]) and
(rttifield.GetValue(Self).AsObject = nil) and
rttifield.FieldType.AsInstance.MetaclassType.InheritsFrom(TBaseRemoteObject) then
begin
rttifield.SetValue( Self,
TBaseRemoteObjectClass(rttifield.FieldType.AsInstance.MetaclassType)
.Create( Self, rttifield.Name )
);
end;
end;
end;
function TBaseRemoteObject.CanFocus: Boolean;
begin
Result := TRemoteControlExecutor.Execute(Self, 'CanFocus', []).AsBoolean;
end;
procedure TBaseRemoteObject.CheckCanFocus(aTimeOut: Integer);
begin
if not TRemoteControlExecutor.Execute(Self, 'CanFocus', [], aTimeOut).AsBoolean then
raise Exception.CreateFmt('Cannot focus "%s"', [Self.FullPath]);
end;
procedure TBaseRemoteObject.CheckEnabled(aTimeOut: Integer);
begin
if not TRemoteControlExecutor.Execute(Self, 'Enabled', [], aTimeOut).AsBoolean then
raise Exception.CreateFmt('Object not enabled: "%s"', [Self.FullPath]);
end;
procedure TBaseRemoteObject.CheckExists(aTimeOut: Integer);
begin
if not TRemoteControlExecutor.Exists(Self, aTimeOut) then
raise Exception.CreateFmt('Object does not exist: "%s"', [Self.FullPath]);
end;
procedure TBaseRemoteObject.CheckVisible(aTimeOut: Integer);
begin
if not TRemoteControlExecutor.Execute(Self, 'Visible', [], aTimeOut).AsBoolean then
raise Exception.CreateFmt('Object not visible: "%s"', [Self.FullPath]);
end;
constructor TBaseRemoteObject.Create(aOwner: TBaseRemoteObject; const aName: string);
begin
Create;
FName := aName;
FOwner := aOwner;
end;
function TBaseRemoteObject.Enabled: Boolean;
begin
Result := TRemoteControlExecutor.Execute(Self, 'Enabled', []).AsBoolean;
end;
function TBaseRemoteObject.Exists: Boolean;
begin
Result := TRemoteControlExecutor.Exists(Self);
end;
function TBaseRemoteObject.FullPath: string;
var
o: TBaseRemoteObject;
begin
Result := Self.Name;
o := Self.Owner;
while o <> nil do
begin
Result := o.Name + '.' + Result;
o := o.Owner;
end;
end;
function TBaseRemoteObject.Visible: Boolean;
begin
Result := TRemoteControlExecutor.Execute(Self, 'Visible', []).AsBoolean;
end;
{ TAdvGlowButton }
function TAdvGlowButton.Click: Boolean;
begin
Result := //TRemoteControlExecutor.Execute(Self, 'Enabled', []).AsBoolean and
//TRemoteControlExecutor.Execute(Self, 'Visible', []).AsBoolean and
TRemoteControlExecutor.Execute(Self, 'CanFocus', []).AsBoolean;
if Result then
TRemoteControlExecutor.Execute_Async(Self, 'Click', []);
//TRemoteControlExecutor.PostMessage(Self, WM_LBUTTONDOWN, 0, 0); //async, because can do showmodal
end;
{ TAdvSpeedButton }
function TAdvSpeedButton.Click: Boolean;
begin
Result := TRemoteControlExecutor.Execute(Self, 'Enabled', []).AsBoolean;
TRemoteControlExecutor.PostMessage(Self, WM_LBUTTONDOWN, 0, 0); //async, because can do showmodal
end;
{ TAdvSmoothTabPager }
function TAdvSmoothTabPager.GetActivePageIndex: Integer;
begin
Result := TRemoteControlExecutor.Execute(Self, 'ActivePageIndex', []).AsInteger;
end;
procedure TAdvSmoothTabPager.SetActivePageIndex(const Value: Integer);
begin
TRemoteControlExecutor.Execute(Self, 'ActivePageIndex', [Value]);
end;
{ TAdvColumnGrid }
function TAdvColumnGrid.GetRowCount: Integer;
begin
Result := TRemoteControlExecutor.Execute(Self, 'RowCount', []).AsInteger;
end;
{ TAdvSmoothListBox }
procedure TAdvSmoothListBox.Click;
begin
TRemoteControlExecutor.PostMessage(Self, WM_LBUTTONDOWN, 0, 0);
end;
function TAdvSmoothListBox.GetSelectedItemIndex: integer;
begin
Result := TRemoteControlExecutor.Execute(Self, 'SelectedItemIndex', []).AsInteger;
end;
procedure TAdvSmoothListBox.SetSelectedItemIndex(const Value: integer);
begin
TRemoteControlExecutor.Execute(Self, 'SelectedItemIndex', [Value]);
end;
{ TEdit }
function TEdit.GetText: string;
begin
Result := TRemoteControlExecutor.Execute(Self, 'Text', []).AsString;
end;
procedure TEdit.SetText(const Value: string);
begin
TRemoteControlExecutor.Execute(Self, 'Text', [Value]);
end;
{ TButton }
procedure TButton.Click;
begin
TRemoteControlExecutor.PostMessage(Self, WM_LBUTTONDOWN, 0, 0);
TRemoteControlExecutor.PostMessage(Self, WM_LBUTTONUP, 0, 0);
end;
function TButton.GetCaption: string;
begin
Result := TRemoteControlExecutor.Execute(Self, 'Caption', []).AsString;
end;
procedure TButton.SetCaption(const Value: string);
begin
TRemoteControlExecutor.Execute(Self, 'Caption', [Value]);
end;
{ TForm }
procedure TForm.Close;
begin
TRemoteControlExecutor.Execute(Self, 'Close', []);
end;
initialization
RttiCache := TRttiContext.Create;
finalization
RttiCache.Free;
end.
|
unit NullStream;
interface
uses
System.Classes,
System.SysUtils;
type
TNullStream = class(TStream)
private
FPosition: int64;
FSize: int64;
protected
procedure SetSize(NewSize: Integer); override;
public
function Seek(const Offset: int64; Origin: TSeekOrigin): int64; override;
function Read(var Buffer; Count: Longint): Longint; override;
function Write(const Buffer; Count: Longint): Longint; override;
end;
implementation
{ TNullStream }
procedure TNullStream.SetSize(NewSize: Integer);
begin
FSize := NewSize;
end;
function TNullStream.Seek(const Offset: int64; Origin: TSeekOrigin): int64;
begin
case Origin of
soBeginning:
FPosition := Offset;
soCurrent:
Inc(FPosition, Offset);
soEnd:
FPosition := FSize + Offset;
end;
Result := FPosition;
end;
function TNullStream.Read(var Buffer; Count: Integer): Longint;
begin
raise Exception.Create('Null stream cannot read');
end;
function TNullStream.Write(const Buffer; Count: Integer): Longint;
var
pos: int64;
begin
if (FPosition >= 0) and (Count >= 0) then
begin
pos := FPosition + Count;
if pos > FSize then
FSize := pos;
FPosition := pos;
exit(Count);
end;
exit(0);
end;
end.
|
unit uPlanoBackupVO;
interface
uses
System.Generics.Collections;
type
TPlanoBackupItensVO = class
private
FHora: TTime;
FId: Integer;
FStatus: Boolean;
FPlanoBackup: Integer;
procedure SetHora(const Value: TTime);
procedure SetId(const Value: Integer);
procedure SetPlanoBackup(const Value: Integer);
procedure SetStatus(const Value: Boolean);
public
property Id: Integer read FId write SetId;
property PlanoBackup: Integer read FPlanoBackup write SetPlanoBackup;
property Hora: TTime read FHora write SetHora;
property Status: Boolean read FStatus write SetStatus;
end;
TPlanoBackupVO = class
private
FQuarta: Boolean;
FSabado: Boolean;
FQuinta: Boolean;
FAtivo: Boolean;
FSegunda: Boolean;
FDomingo: Boolean;
FId: Integer;
FTerca: Boolean;
FDestino: string;
FDataUltimoBackup: TDate;
FSexta: Boolean;
procedure SetAtivo(const Value: Boolean);
procedure SetDataUltimoBackup(const Value: TDate);
procedure SetDestino(const Value: string);
procedure SetDomingo(const Value: Boolean);
procedure SetId(const Value: Integer);
procedure SetQuarta(const Value: Boolean);
procedure SetQuinta(const Value: Boolean);
procedure SetSabado(const Value: Boolean);
procedure SetSegunda(const Value: Boolean);
procedure SetSexta(const Value: Boolean);
procedure SetTerca(const Value: Boolean);
public
property Id: Integer read FId write SetId;
property Destino: string read FDestino write SetDestino;
property Domingo: Boolean read FDomingo write SetDomingo;
property Segunda: Boolean read FSegunda write SetSegunda;
property Terca: Boolean read FTerca write SetTerca;
property Quarta: Boolean read FQuarta write SetQuarta;
property Quinta: Boolean read FQuinta write SetQuinta;
property Sexta: Boolean read FSexta write SetSexta;
property Sabado: Boolean read FSabado write SetSabado;
property Ativo: Boolean read FAtivo write SetAtivo;
property DataUltimoBackup: TDate read FDataUltimoBackup write SetDataUltimoBackup;
end;
TListaHoras = TObjectList<TPlanoBackupItensVO>;
implementation
{ TPlanoBackupVO }
procedure TPlanoBackupVO.SetAtivo(const Value: Boolean);
begin
FAtivo := Value;
end;
procedure TPlanoBackupVO.SetDataUltimoBackup(const Value: TDate);
begin
FDataUltimoBackup := Value;
end;
procedure TPlanoBackupVO.SetDestino(const Value: string);
begin
FDestino := Value;
end;
procedure TPlanoBackupVO.SetDomingo(const Value: Boolean);
begin
FDomingo := Value;
end;
procedure TPlanoBackupVO.SetId(const Value: Integer);
begin
FId := Value;
end;
procedure TPlanoBackupVO.SetQuarta(const Value: Boolean);
begin
FQuarta := Value;
end;
procedure TPlanoBackupVO.SetQuinta(const Value: Boolean);
begin
FQuinta := Value;
end;
procedure TPlanoBackupVO.SetSabado(const Value: Boolean);
begin
FSabado := Value;
end;
procedure TPlanoBackupVO.SetSegunda(const Value: Boolean);
begin
FSegunda := Value;
end;
procedure TPlanoBackupVO.SetSexta(const Value: Boolean);
begin
FSexta := Value;
end;
procedure TPlanoBackupVO.SetTerca(const Value: Boolean);
begin
FTerca := Value;
end;
{ TPlanoBackupItensVO }
procedure TPlanoBackupItensVO.SetHora(const Value: TTime);
begin
FHora := Value;
end;
procedure TPlanoBackupItensVO.SetId(const Value: Integer);
begin
FId := Value;
end;
procedure TPlanoBackupItensVO.SetPlanoBackup(const Value: Integer);
begin
FPlanoBackup := Value;
end;
procedure TPlanoBackupItensVO.SetStatus(const Value: Boolean);
begin
FStatus := Value;
end;
end.
|
unit F1_Application_Template_InternalOperations_Controls;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Библиотека "View"
// Модуль: "w:/garant6x/implementation/Garant/GbaNemesis/View/F1_Application_Template_InternalOperations_Controls.pas"
// Родные Delphi интерфейсы (.pas)
// Generated from UML model, root element: <<VCMControls::Category>> F1 Базовые определения предметной области::F1 Application Template::View::InternalOperations
//
// Внутренние операции. Кандидаты на превращение в фасеты
//
//
// Все права принадлежат ООО НПП "Гарант-Сервис".
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ! Полностью генерируется с модели. Править руками - нельзя. !
{$Include w:\garant6x\implementation\Garant\nsDefine.inc}
interface
uses
l3Interfaces
{$If not defined(NoVCM)}
,
vcmInterfaces
{$IfEnd} //not NoVCM
,
l3CProtoObject,
vcmExternalInterfaces {a}
;
(* System = operations
{* Система }
['{780A81CE-0B59-4482-940E-E67B7F1CED5E}']
query InitShutdown(aShotdown: Boolean;
aCloseInterval: Integer);
{* Начать процесс завершения работы }
end;//System*)
(* Help = operations
['{24A611DF-722D-4B06-A67B-BEDF5A1B77C3}']
operation HelpTopics;
end;//Help*)
type
ISystem_InitShutdown_Params = interface(IUnknown)
{* Параметры для операции System.InitShutdown }
['{DB584516-0B73-41CF-9721-9C57CAF90FDE}']
function Get_Shotdown: Boolean;
function Get_CloseInterval: Integer;
property Shotdown: Boolean
read Get_Shotdown;
{* undefined }
property CloseInterval: Integer
read Get_CloseInterval;
{* undefined }
end;//ISystem_InitShutdown_Params
Op_System_InitShutdown = class
{* Класс для вызова операции System.InitShutdown }
public
// public methods
class function Call(const aTarget: IvcmEntity;
aShotdown: Boolean;
aCloseInterval: Integer): Boolean; overload;
{* Вызов операции System.InitShutdown у сущности }
class function Call(const aTarget: IvcmAggregate;
aShotdown: Boolean;
aCloseInterval: Integer): Boolean; overload;
{* Вызов операции System.InitShutdown у агрегации }
class function Call(const aTarget: IvcmEntityForm;
aShotdown: Boolean;
aCloseInterval: Integer): Boolean; overload;
{* Вызов операции System.InitShutdown у формы }
class function Call(const aTarget: IvcmContainer;
aShotdown: Boolean;
aCloseInterval: Integer): Boolean; overload;
{* Вызов операции System.InitShutdown у контейнера }
end;//Op_System_InitShutdown
const
en_System = 'System';
en_capSystem = 'Система';
op_InitShutdown = 'InitShutdown';
op_capInitShutdown = 'Начать процесс завершения работы';
en_Help = 'Help';
en_capHelp = '';
op_HelpTopics = 'HelpTopics';
op_capHelpTopics = '';
implementation
uses
l3Base {a},
vcmBase {a},
StdRes {a}
;
type
TSystem_InitShutdown_Params = class(Tl3CProtoObject, ISystem_InitShutdown_Params)
{* Реализация ISystem_InitShutdown_Params }
private
// private fields
f_Shotdown : Boolean;
f_CloseInterval : Integer;
protected
// realized methods
function Get_Shotdown: Boolean;
function Get_CloseInterval: Integer;
public
// public methods
constructor Create(aShotdown: Boolean;
aCloseInterval: Integer); reintroduce;
{* Конструктор TSystem_InitShutdown_Params }
class function Make(aShotdown: Boolean;
aCloseInterval: Integer): ISystem_InitShutdown_Params; reintroduce;
{* Фабрика TSystem_InitShutdown_Params }
end;//TSystem_InitShutdown_Params
// start class TSystem_InitShutdown_Params
constructor TSystem_InitShutdown_Params.Create(aShotdown: Boolean;
aCloseInterval: Integer);
{-}
begin
inherited Create;
f_Shotdown := aShotdown;
f_CloseInterval := aCloseInterval;
end;//TSystem_InitShutdown_Params.Create
class function TSystem_InitShutdown_Params.Make(aShotdown: Boolean;
aCloseInterval: Integer): ISystem_InitShutdown_Params;
var
l_Inst : TSystem_InitShutdown_Params;
begin
l_Inst := Create(aShotdown, aCloseInterval);
try
Result := l_Inst;
finally
l_Inst.Free;
end;//try..finally
end;
function TSystem_InitShutdown_Params.Get_Shotdown: Boolean;
{-}
begin
Result := f_Shotdown;
end;//TSystem_InitShutdown_Params.Get_Shotdown
function TSystem_InitShutdown_Params.Get_CloseInterval: Integer;
{-}
begin
Result := f_CloseInterval;
end;//TSystem_InitShutdown_Params.Get_CloseInterval
// start class Op_System_InitShutdown
class function Op_System_InitShutdown.Call(const aTarget: IvcmEntity;
aShotdown: Boolean;
aCloseInterval: Integer): Boolean;
var
l_Params : IvcmExecuteParams;
begin
l3FillChar(Result, SizeOf(Result));
if (aTarget <> nil) then
begin
l_Params := TvcmExecuteParams.MakeForInternal(TSystem_InitShutdown_Params.Make(aShotdown,aCloseInterval));
aTarget.Operation(TdmStdRes.opcode_System_InitShutdown, l_Params);
with l_Params do
begin
if Done then
begin
Result := true;
end;//Done
end;//with l_Params
end;//aTarget <> nil
end;//Op_System_InitShutdown.Call
class function Op_System_InitShutdown.Call(const aTarget: IvcmAggregate;
aShotdown: Boolean;
aCloseInterval: Integer): Boolean;
var
l_Params : IvcmExecuteParams;
begin
l3FillChar(Result, SizeOf(Result));
if (aTarget <> nil) then
begin
l_Params := TvcmExecuteParams.MakeForInternal(TSystem_InitShutdown_Params.Make(aShotdown,aCloseInterval));
aTarget.Operation(TdmStdRes.opcode_System_InitShutdown, l_Params);
with l_Params do
begin
if Done then
begin
Result := true;
end;//Done
end;//with l_Params
end;//aTarget <> nil
end;//Op_System_InitShutdown.Call
class function Op_System_InitShutdown.Call(const aTarget: IvcmEntityForm;
aShotdown: Boolean;
aCloseInterval: Integer): Boolean;
{-}
begin
l3FillChar(Result, SizeOf(Result));
if (aTarget <> nil) then
Result := Call(aTarget.Entity, aShotdown, aCloseInterval);
end;//Op_System_InitShutdown.Call
class function Op_System_InitShutdown.Call(const aTarget: IvcmContainer;
aShotdown: Boolean;
aCloseInterval: Integer): Boolean;
{-}
begin
l3FillChar(Result, SizeOf(Result));
if (aTarget <> nil) then
Result := Call(aTarget.AsForm, aShotdown, aCloseInterval);
end;//Op_System_InitShutdown.Call
end. |
unit arArchiTestsAdapter;
{* Обертки для вызова функциональности из Арчи }
// Модуль: "w:\archi\source\projects\Archi\Archi_Insider_Test_Support\arArchiTestsAdapter.pas"
// Стереотип: "UtilityPack"
// Элемент модели: "arArchiTestsAdapter" MUID: (4DE60853015A)
{$Include w:\archi\source\projects\Archi\arDefine.inc}
interface
{$If Defined(nsTest) AND Defined(InsiderTest) AND NOT Defined(NoScripts)}
uses
l3IntfUses
, evCustomEditorWindow
, dt_Types
{$If Defined(AppClientSide)}
, Main
{$IfEnd} // Defined(AppClientSide)
, SysUtils
, l3ProtoObject
;
type
TarSkipDialog = (
ar_AsUsual
{* Показывать диалог и проверять его результат. }
, ar_OpenDocument
{* Если есть залоченный - все равно открывать. }
, ar_NotOpen
{* Если есть залоченный - не открывать. }
);//TarSkipDialog
TarTestConfig = class(Tl3ProtoObject)
{* Хранилище всяких флагов, настроек и т.п. чтобы в одном месте было. }
private
f_SkipLockDialog: TarSkipDialog;
protected
procedure pm_SetSkipLockDialog(aValue: TarSkipDialog);
procedure InitFields; override;
procedure ClearFields; override;
public
class function Instance: TarTestConfig;
{* Метод получения экземпляра синглетона TarTestConfig }
class function Exists: Boolean;
{* Проверяет создан экземпляр синглетона или нет }
public
property SkipLockDialog: TarSkipDialog
read f_SkipLockDialog
write pm_SetSkipLockDialog;
end;//TarTestConfig
function arOpenDocumentByNumber(aDocID: TDocID;
aSubID: TDocID;
aRenum: Boolean): Boolean;
{* Открыть документ по номеру. }
function arGetDocumentEditor: TevCustomEditorWindow;
{* Получить редактор для текста документа. }
function arOpenByNumberAsString(const aDocID: AnsiString;
aRenum: Boolean): Boolean;
{* Открыть документ по номеру }
function arCloseActiveDocument: Boolean;
procedure arSubNameEdit(aSubID: TSubID);
{* Редакторование саба. }
procedure arDeleteSub(aSubID: TSubID);
procedure arCreateNewDocument(const aParams: TNewDocParams);
procedure arCreateNewDocumentByFileName(const aFileName: TFileName;
aDocType: TDocType);
procedure acOpenInsDWin;
procedure acDeInitDB;
procedure acInitDB;
procedure arAddBlock;
procedure acSetActivePage(anIndex: Integer);
procedure acCreateStructure;
procedure arSetContentsSub(aBlockID: Integer);
procedure arGotoSub(aIndex: Integer);
{$IfEnd} // Defined(nsTest) AND Defined(InsiderTest) AND NOT Defined(NoScripts)
implementation
{$If Defined(nsTest) AND Defined(InsiderTest) AND NOT Defined(NoScripts)}
uses
l3ImplUses
{$If Defined(AppClientSide)}
, Editwin
{$IfEnd} // Defined(AppClientSide)
{$If NOT Defined(NoVCL)}
, Menus
{$IfEnd} // NOT Defined(NoVCL)
, daTypes
{$If NOT Defined(Nemesis)}
, DictsSup
{$IfEnd} // NOT Defined(Nemesis)
{$If Defined(AppClientSide) AND NOT Defined(Nemesis)}
, ddClientBaseEngine
{$IfEnd} // Defined(AppClientSide) AND NOT Defined(Nemesis)
, m3StorageHolderList
{$If Defined(AppClientSide)}
, archiHTInit
{$IfEnd} // Defined(AppClientSide)
{$If NOT Defined(Nemesis)}
, dt_Mail
{$IfEnd} // NOT Defined(Nemesis)
, l3Base
//#UC START# *4DE60853015Aimpl_uses*
//#UC END# *4DE60853015Aimpl_uses*
;
var g_TarTestConfig: TarTestConfig = nil;
{* Экземпляр синглетона TarTestConfig }
procedure TarTestConfigFree;
{* Метод освобождения экземпляра синглетона TarTestConfig }
begin
l3Free(g_TarTestConfig);
end;//TarTestConfigFree
function arOpenDocumentByNumber(aDocID: TDocID;
aSubID: TDocID;
aRenum: Boolean): Boolean;
{* Открыть документ по номеру. }
//#UC START# *4DE608AF027D_4DE60853015A_var*
//#UC END# *4DE608AF027D_4DE60853015A_var*
begin
//#UC START# *4DE608AF027D_4DE60853015A_impl*
Assert(MainForm <> nil);
MainForm.OpenDocByNumber(aDocID, aSubID, aRenum);
Result := True;
//#UC END# *4DE608AF027D_4DE60853015A_impl*
end;//arOpenDocumentByNumber
function arGetDocumentEditor: TevCustomEditorWindow;
{* Получить редактор для текста документа. }
//#UC START# *4DE608E101E0_4DE60853015A_var*
//#UC END# *4DE608E101E0_4DE60853015A_var*
begin
//#UC START# *4DE608E101E0_4DE60853015A_impl*
Assert(MainForm <> nil);
Assert(MainForm.ActiveMDIChild <> nil);
Result := (MainForm.ActiveMDIChild as TDocEditorWindow).DocTextEditor.DocEditor;
//#UC END# *4DE608E101E0_4DE60853015A_impl*
end;//arGetDocumentEditor
function arOpenByNumberAsString(const aDocID: AnsiString;
aRenum: Boolean): Boolean;
{* Открыть документ по номеру }
//#UC START# *4DE62CD4032D_4DE60853015A_var*
//#UC END# *4DE62CD4032D_4DE60853015A_var*
begin
//#UC START# *4DE62CD4032D_4DE60853015A_impl*
Result := arOpenDocumentByNumber(StrToInt(aDocID), 0, aRenum);
//#UC END# *4DE62CD4032D_4DE60853015A_impl*
end;//arOpenByNumberAsString
function arCloseActiveDocument: Boolean;
//#UC START# *4DE6331E00DA_4DE60853015A_var*
//#UC END# *4DE6331E00DA_4DE60853015A_var*
begin
//#UC START# *4DE6331E00DA_4DE60853015A_impl*
Assert(MainForm <> nil);
Assert(MainForm.ActiveMDIChild <> nil);
MainForm.ActiveMDIChild.Close;
Result := True;
//#UC END# *4DE6331E00DA_4DE60853015A_impl*
end;//arCloseActiveDocument
procedure arSubNameEdit(aSubID: TSubID);
{* Редакторование саба. }
//#UC START# *4DFB4F0401D6_4DE60853015A_var*
//#UC END# *4DFB4F0401D6_4DE60853015A_var*
begin
//#UC START# *4DFB4F0401D6_4DE60853015A_impl*
Assert(MainForm <> nil);
Assert(MainForm.ActiveMDIChild <> nil);
(MainForm.ActiveMDIChild as TDocEditorWindow).SubNameEdit(aSubID);
//#UC END# *4DFB4F0401D6_4DE60853015A_impl*
end;//arSubNameEdit
procedure arDeleteSub(aSubID: TSubID);
//#UC START# *4E01AD6F0280_4DE60853015A_var*
//#UC END# *4E01AD6F0280_4DE60853015A_var*
begin
//#UC START# *4E01AD6F0280_4DE60853015A_impl*
Assert(MainForm <> nil);
Assert(MainForm.ActiveMDIChild <> nil);
(MainForm.ActiveMDIChild as TDocEditorWindow).RemoveSub(aSubID, -1);
//#UC END# *4E01AD6F0280_4DE60853015A_impl*
end;//arDeleteSub
procedure arCreateNewDocument(const aParams: TNewDocParams);
//#UC START# *4E0AD0AD00CD_4DE60853015A_var*
//#UC END# *4E0AD0AD00CD_4DE60853015A_var*
begin
//#UC START# *4E0AD0AD00CD_4DE60853015A_impl*
MainForm.CreateNewDocumentFromFile(aParams);
//#UC END# *4E0AD0AD00CD_4DE60853015A_impl*
end;//arCreateNewDocument
procedure arCreateNewDocumentByFileName(const aFileName: TFileName;
aDocType: TDocType);
//#UC START# *4E0AE1A90285_4DE60853015A_var*
var
l_Param: TNewDocParams;
//#UC END# *4E0AE1A90285_4DE60853015A_var*
begin
//#UC START# *4E0AE1A90285_4DE60853015A_impl*
l_Param.rDocKind := 0;
l_Param.rDocName := '';
l_Param.rAnalyseFile := aFileName;
l_Param.rDocType := aDocType;
l_Param.rDocAddr.DocID := 0;
l_Param.rAnalyseLog := False;
ArCreateNewDocument(l_Param);
//#UC END# *4E0AE1A90285_4DE60853015A_impl*
end;//arCreateNewDocumentByFileName
procedure acOpenInsDWin;
//#UC START# *4E2447BF0259_4DE60853015A_var*
var
l_Menu: TMenuItem;
//#UC END# *4E2447BF0259_4DE60853015A_var*
begin
//#UC START# *4E2447BF0259_4DE60853015A_impl*
l_Menu := MainForm.menuDicts.Find(GetDictName(da_dlTextInsert));
if l_Menu <> nil then
l_Menu.Action.Execute;
//#UC END# *4E2447BF0259_4DE60853015A_impl*
end;//acOpenInsDWin
procedure acDeInitDB;
//#UC START# *4E4B5CDC03DF_4DE60853015A_var*
//#UC END# *4E4B5CDC03DF_4DE60853015A_var*
begin
//#UC START# *4E4B5CDC03DF_4DE60853015A_impl*
MainForm.ShowExplorer(False);
DoneClientBaseEngine;
Tm3StorageHolderList.DropAll;
//#UC END# *4E4B5CDC03DF_4DE60853015A_impl*
end;//acDeInitDB
procedure acInitDB;
//#UC START# *4E4B5D350252_4DE60853015A_var*
//#UC END# *4E4B5D350252_4DE60853015A_var*
begin
//#UC START# *4E4B5D350252_4DE60853015A_impl*
InitArchiBaseEngine(PromptUserPassword, True);
MailServer.LoadMailList;
// MainForm.OEWin.LoadStruct;
//#UC END# *4E4B5D350252_4DE60853015A_impl*
end;//acInitDB
procedure arAddBlock;
//#UC START# *4EA94FCA02CD_4DE60853015A_var*
//#UC END# *4EA94FCA02CD_4DE60853015A_var*
begin
//#UC START# *4EA94FCA02CD_4DE60853015A_impl*
Assert(MainForm <> nil);
Assert(MainForm.ActiveMDIChild <> nil);
(MainForm.ActiveMDIChild as TDocEditorWindow).acSetBlock.Execute;
//#UC END# *4EA94FCA02CD_4DE60853015A_impl*
end;//arAddBlock
procedure acSetActivePage(anIndex: Integer);
//#UC START# *4EAFC7CC0065_4DE60853015A_var*
//#UC END# *4EAFC7CC0065_4DE60853015A_var*
begin
//#UC START# *4EAFC7CC0065_4DE60853015A_impl*
Assert(MainForm <> nil);
Assert(MainForm.ActiveMDIChild <> nil);
if (MainForm.ActiveMDIChild is TDocEditorWindow) then
with (MainForm.ActiveMDIChild as TDocEditorWindow) do
case anIndex of
piName : acPageName.Execute;
piAttr : acPageAttr.Execute;
piText : acPageText.Execute;
piPicture : nbkDocPages.PageIndex := anIndex;
piSprv : acPageSprv.Execute;
piAnno : nbkDocPages.PageIndex := anIndex;
piClass : acPageClass.Execute;
piSrcImage : nbkDocPages.PageIndex := anIndex;
piSub : acPageAnno.Execute;
piResp : acPageResp.Execute;
piCoresp : acPageCoresp.Execute;
piVersion : acPageVersions.Execute;
piJourn : acPageJourn.Execute;
else
Assert(False, 'Не поддерживаются другие номера вкладок!')
end // case anIndex of
//#UC END# *4EAFC7CC0065_4DE60853015A_impl*
end;//acSetActivePage
procedure acCreateStructure;
//#UC START# *4ECB5AFB0277_4DE60853015A_var*
//#UC END# *4ECB5AFB0277_4DE60853015A_var*
begin
//#UC START# *4ECB5AFB0277_4DE60853015A_impl*
Assert(MainForm <> nil);
Assert(MainForm.ActiveMDIChild <> nil);
(MainForm.ActiveMDIChild as TDocEditorWindow).acInsCreateStructure.Execute;
//#UC END# *4ECB5AFB0277_4DE60853015A_impl*
end;//acCreateStructure
procedure arSetContentsSub(aBlockID: Integer);
//#UC START# *4ECB5F560065_4DE60853015A_var*
//#UC END# *4ECB5F560065_4DE60853015A_var*
begin
//#UC START# *4ECB5F560065_4DE60853015A_impl*
(MainForm.ActiveMDIChild as TDocEditorWindow).SetContentsSub(aBlockID);
//#UC END# *4ECB5F560065_4DE60853015A_impl*
end;//arSetContentsSub
procedure arGotoSub(aIndex: Integer);
//#UC START# *4EEF085B0345_4DE60853015A_var*
//#UC END# *4EEF085B0345_4DE60853015A_var*
begin
//#UC START# *4EEF085B0345_4DE60853015A_impl*
Assert(MainForm <> nil);
Assert(MainForm.ActiveMDIChild <> nil);
(MainForm.ActiveMDIChild as TDocEditorWindow).GoToSub(aIndex);
//#UC END# *4EEF085B0345_4DE60853015A_impl*
end;//arGotoSub
procedure TarTestConfig.pm_SetSkipLockDialog(aValue: TarSkipDialog);
//#UC START# *5425578502BE_5425548D01DDset_var*
//#UC END# *5425578502BE_5425548D01DDset_var*
begin
//#UC START# *5425578502BE_5425548D01DDset_impl*
f_SkipLockDialog := aValue;
//#UC END# *5425578502BE_5425548D01DDset_impl*
end;//TarTestConfig.pm_SetSkipLockDialog
class function TarTestConfig.Instance: TarTestConfig;
{* Метод получения экземпляра синглетона TarTestConfig }
begin
if (g_TarTestConfig = nil) then
begin
l3System.AddExitProc(TarTestConfigFree);
g_TarTestConfig := Create;
end;
Result := g_TarTestConfig;
end;//TarTestConfig.Instance
class function TarTestConfig.Exists: Boolean;
{* Проверяет создан экземпляр синглетона или нет }
begin
Result := g_TarTestConfig <> nil;
end;//TarTestConfig.Exists
procedure TarTestConfig.InitFields;
//#UC START# *47A042E100E2_5425548D01DD_var*
//#UC END# *47A042E100E2_5425548D01DD_var*
begin
//#UC START# *47A042E100E2_5425548D01DD_impl*
f_SkipLockDialog := ar_AsUsual;
inherited;
//#UC END# *47A042E100E2_5425548D01DD_impl*
end;//TarTestConfig.InitFields
procedure TarTestConfig.ClearFields;
//#UC START# *5000565C019C_5425548D01DD_var*
//#UC END# *5000565C019C_5425548D01DD_var*
begin
//#UC START# *5000565C019C_5425548D01DD_impl*
inherited;
f_SkipLockDialog := ar_AsUsual;
//#UC END# *5000565C019C_5425548D01DD_impl*
end;//TarTestConfig.ClearFields
{$IfEnd} // Defined(nsTest) AND Defined(InsiderTest) AND NOT Defined(NoScripts)
end.
|
{******************************************************************************}
{ }
{ Delphi FB4D Library }
{ Copyright (c) 2018-2023 Christoph Schneider }
{ Schneider Infosystems AG, Switzerland }
{ https://github.com/SchneiderInfosystems/FB4D }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit CameraCaptureFra;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
System.Threading, System.SyncObjs, System.Permissions,
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
FMX.Objects, FMX.Controls.Presentation, FMX.Media;
type
TOnPhotoCaptured = procedure(Image: TBitmap; const FileName: string) of object;
TfraCameraCapture = class(TFrame)
imgCameraPreview: TImage;
CameraComponent: TCameraComponent;
rctBackgroundImg: TRectangle;
btnTakePhotoFromCamera: TButton;
btnTake: TButton;
btnRestart: TButton;
OpenDialogPictures: TOpenDialog;
SaveDialogPictures: TSaveDialog;
procedure CameraComponentSampleBufferReady(Sender: TObject;
const ATime: TMediaTime);
procedure btnTakePhotoFromCameraClick(Sender: TObject);
procedure btnRestartClick(Sender: TObject);
procedure btnTakeClick(Sender: TObject);
private
fCSForCamAccess: TCriticalSection;
fBitmapFromCam: TBitmap;
fOnPhotoCaptured: TOnPhotoCaptured;
procedure DisplayCameraPreviewFrame;
procedure StopCapture;
procedure SetInitialDir(const Dir: string);
function GetInitialDir: string;
private
{$REGION 'Platform specific stuff'}
{$IFDEF ANDROID}
fAppPermissions: TArray<string>;
procedure RequestPermissionsResultEvent(Sender: TObject;
const APermissions: TClassicStringDynArray;
const AGrantResults: TClassicPermissionStatusDynArray);
procedure DoDidFinishTakePhotoOnAndroid(Image: TBitmap);
procedure StartCaptureOnAndroid;
procedure StartTakePhotoFromLibOnAndroid;
{$ENDIF}
{$IFDEF MSWINDOWS}
procedure StartCaptureOnWindows;
procedure StartTakePhotoFromLibOnWindows;
procedure SaveImageToFileOnWindows(Img: TStream; const ContentType: string);
{$ENDIF}
{$ENDREGION}
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure StartCapture(OnPhotoCaptured: TOnPhotoCaptured = nil);
procedure StartTakePhotoFromLib(OnPhotoCaptured: TOnPhotoCaptured);
procedure SaveImageToFile(Image: TStream; const ContentType: string);
function Bitmap: TBitmap;
procedure ToastMsg(const Msg: string);
property InitialDir: string read GetInitialDir write SetInitialDir;
function GetFileName: string;
end;
implementation
{$R *.fmx}
uses
{$IFDEF ANDROID}
Androidapi.Helpers, Androidapi.JNI.Os, Androidapi.JNI.JavaTypes,
Androidapi.JNI.Toast,
FMX.MediaLibrary, FMX.Platform,
{$ENDIF}
FB4D.Helpers,
PhotoBoxMainFmx;
resourcestring
rsWaitForCam = 'Wait for Camera';
rsFileName = 'Photo from %s';
rsImgFilter = 'Image file (*%s)|*%s';
rsDeviceDoesNotSupportCam = 'This device does not support the camera service';
rsNotSupportedOnThisPlatform = 'Not supported on this platform';
{ TfraCameraCapture }
constructor TfraCameraCapture.Create(AOwner: TComponent);
begin
inherited;
fCSForCamAccess := TCriticalSection.Create;
fBitmapFromCam := nil;
{$IFDEF ANDROID}
fAppPermissions := [JStringToString(TJManifest_permission.JavaClass.CAMERA),
JStringToString(TJManifest_permission.JavaClass.READ_EXTERNAL_STORAGE),
JStringToString(TJManifest_permission.JavaClass.WRITE_EXTERNAL_STORAGE)];
{$ENDIF}
end;
destructor TfraCameraCapture.Destroy;
begin
CameraComponent.Active := false;
FreeAndNil(fBitmapFromCam);
fCSForCamAccess.Free;
inherited;
end;
procedure TfraCameraCapture.SetInitialDir(const Dir: string);
begin
OpenDialogPictures.InitialDir := Dir;
SaveDialogPictures.InitialDir := Dir;
end;
function TfraCameraCapture.GetInitialDir: string;
begin
result := OpenDialogPictures.InitialDir;
end;
procedure TfraCameraCapture.StartCapture(OnPhotoCaptured: TOnPhotoCaptured);
begin
if assigned(OnPhotoCaptured) then
fOnPhotoCaptured := OnPhotoCaptured;
{$IFDEF MSWINDOWS}
StartCaptureOnWindows;
{$ENDIF}
{$IFDEF ANDROID}
StartCaptureOnAndroid;
{$ENDIF}
end;
{$IFDEF MSWINDOWS}
procedure TfraCameraCapture.StartCaptureOnWindows;
begin
fmxMain.WipeToTab(fmxMain.tabCaptureImg);
fCSForCamAccess.Acquire;
try
if not assigned(fBitmapFromCam) then
fBitmapFromCam := TBitmap.Create(640, 480)
else begin
fBitmapFromCam.Width := 640;
fBitmapFromCam.Height := 480;
end;
fBitmapFromCam.Canvas.BeginScene;
fBitmapFromCam.Clear(TAlphaColors.White);
fBitmapFromCam.Canvas.Fill.Kind := TBrushKind.Solid;
fBitmapFromCam.Canvas.Fill.Color := TAlphaColorRec.Red;
fBitmapFromCam.Canvas.Font.Size := 20;
fBitmapFromCam.Canvas.FillText(
RectF(10, 10, fBitmapFromCam.Width - 10, fBitmapFromCam.Height - 10),
rsWaitForCam, false, 1, [], TTextAlign.Center, TTextAlign.Center);
fBitmapFromCam.Canvas.EndScene;
imgCameraPreview.Bitmap.Assign(fBitmapFromCam);
finally
fCSForCamAccess.Release;
end;
btnTake.Visible := false;
btnRestart.Visible := false;
btnTakePhotoFromCamera.Visible := true;
TThread.Queue(nil,
procedure
begin
Application.ProcessMessages;
CameraComponent.Active := true;
end);
end;
{$ENDIF}
procedure TfraCameraCapture.StopCapture;
begin
CameraComponent.Active := false;
btnTake.Visible := true;
btnRestart.Visible := true;
btnTakePhotoFromCamera.Visible := false;
end;
function TfraCameraCapture.Bitmap: TBitmap;
begin
fCSForCamAccess.Acquire;
try
result := fBitmapFromCam;
finally
fCSForCamAccess.Release;
end;
end;
procedure TfraCameraCapture.btnRestartClick(Sender: TObject);
begin
StartCapture;
end;
procedure TfraCameraCapture.btnTakeClick(Sender: TObject);
begin
if assigned(fOnPhotoCaptured) then
fOnPhotoCaptured(Bitmap, GetFileName);
end;
procedure TfraCameraCapture.btnTakePhotoFromCameraClick(Sender: TObject);
begin
StopCapture;
end;
procedure TfraCameraCapture.CameraComponentSampleBufferReady(Sender: TObject;
const ATime: TMediaTime);
begin
if Application.Terminated then
exit;
Assert(assigned(fCSForCamAccess), 'Critical section missing');
fCSForCamAccess.Acquire;
try
if not assigned(fBitmapFromCam) then
fBitmapFromCam := TBitmap.Create(CameraComponent.GetCaptureSetting.Width,
CameraComponent.GetCaptureSetting.Height);
CameraComponent.SampleBufferToBitmap(fBitmapFromCam, true);
finally
fCSForCamAccess.Release;
end;
TThread.Queue(nil, DisplayCameraPreviewFrame);
end;
procedure TfraCameraCapture.DisplayCameraPreviewFrame;
begin
fCSForCamAccess.Acquire;
try
imgCameraPreview.Bitmap.Assign(fBitmapFromCam);
finally
fCSForCamAccess.Release;
end;
end;
procedure TfraCameraCapture.StartTakePhotoFromLib(
OnPhotoCaptured: TOnPhotoCaptured);
begin
fOnPhotoCaptured := OnPhotoCaptured;
{$IFDEF MSWINDOWS}
StartTakePhotoFromLibOnWindows;
{$ENDIF}
{$IFDEF ANDROID}
StartTakePhotoFromLibOnAndroid;
{$ENDIF}
end;
procedure TfraCameraCapture.SaveImageToFile(Image: TStream;
const ContentType: string);
begin
{$IFDEF MSWINDOWS}
SaveImageToFileOnWindows(Image, ContentType);
{$ENDIF}
{$IFDEF ANDROID}
ToastMsg(rsNotSupportedOnThisPlatform);
{$ENDIF}
end;
function TfraCameraCapture.GetFileName: string;
var
dt: string;
begin
DateTimeToString(dt, 'dd/mm/yyyy HH:MM', now);
result := Format(rsFileName, [dt]);
end;
{$REGION 'Platform specific stuff'}
procedure TfraCameraCapture.ToastMsg(const Msg: string);
begin
{$IFDEF MSWINDOWS}
fmxMain.lblStatus.Text := Msg;
{$ENDIF}
{$IFDEF ANDROID}
Toast(Msg);
{$ENDIF}
end;
{$IFDEF ANDROID}
procedure TfraCameraCapture.StartCaptureOnAndroid;
var
Service: IFMXCameraService;
Params: TParamsPhotoQuery;
begin
PermissionsService.RequestPermissions(fAppPermissions,
RequestPermissionsResultEvent);
if TPlatformServices.Current.SupportsPlatformService(IFMXCameraService,
Service) then
begin
Params.Editable := false;
Params.NeedSaveToAlbum := false;
Params.RequiredResolution := TSize.Create(1920, 1080);
Params.OnDidFinishTaking := DoDidFinishTakePhotoOnAndroid;
Service.TakePhoto(fmxMain.btnCaptureImg, Params);
end else
Toast(rsDeviceDoesNotSupportCam, LongToast);
end;
procedure TfraCameraCapture.RequestPermissionsResultEvent(Sender: TObject;
const APermissions: TClassicStringDynArray;
const AGrantResults: TClassicPermissionStatusDynArray);
begin
// nothing to do
end;
procedure TfraCameraCapture.StartTakePhotoFromLibOnAndroid;
var
Service: IFMXTakenImageService;
Params: TParamsPhotoQuery;
begin
PermissionsService.RequestPermissions(fAppPermissions,
RequestPermissionsResultEvent);
if TPlatformServices.Current.SupportsPlatformService(IFMXTakenImageService,
Service) then
begin
Params.Editable := true;
Params.RequiredResolution := TSize.Create(1920, 1080);
Params.OnDidFinishTaking := DoDidFinishTakePhotoOnAndroid;
Service.TakeImageFromLibrary(fmxMain.btnPhotoLib, Params);
end else
Toast(rsDeviceDoesNotSupportCam, LongToast);
end;
procedure TfraCameraCapture.DoDidFinishTakePhotoOnAndroid(Image: TBitmap);
begin
if assigned(fOnPhotoCaptured) then
fOnPhotoCaptured(Image, GetFileName);
end;
{$ENDIF}
{$IFDEF MSWINDOWS}
procedure TfraCameraCapture.StartTakePhotoFromLibOnWindows;
var
Bitmap: TBitmap;
begin
OpenDialogPictures.Filter := TBitmapCodecManager.GetFilterString;
if OpenDialogPictures.Execute then
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile(OpenDialogPictures.FileName);
if assigned(fOnPhotoCaptured) then
fOnPhotoCaptured(Bitmap, ExtractFileName(OpenDialogPictures.FileName));
OpenDialogPictures.InitialDir :=
ExtractFilePath(OpenDialogPictures.FileName);
finally
Bitmap.Free;
end;
end;
end;
procedure TfraCameraCapture.SaveImageToFileOnWindows(Img: TStream;
const ContentType: string);
var
Ext: string;
FileStream: TFileStream;
begin
Ext := TFirebaseHelpers.ContentTypeToFileExt(ContentType);
SaveDialogPictures.DefaultExt := Ext;
SaveDialogPictures.Filter := Format(rsImgFilter,
[SaveDialogPictures.DefaultExt, SaveDialogPictures.DefaultExt]);
if SaveDialogPictures.Execute then
begin
FileStream := TFileStream.Create(SaveDialogPictures.FileName, fmCreate);
try
FileStream.CopyFrom(Img {$IF CompilerVersion < 34}, 0 {$ENDIF}); // Delphi 10.3 and before
finally
FileStream.Free;
end;
end;
end;
{$ENDIF}
{$ENDREGION}
end.
|
unit uCliente;
interface
type
TCliente = class(TObject)
private
FCLI_ENDERECO: String;
FCLI_ESTADO: String;
FCLI_TELEFONE: String;
FCLI_RAZAO: String;
FCLI_PDV: Integer;
FCLI_TIPOPESSOA: String;
FCLI_BAIRRO: String;
FCLI_EMAIL: String;
FCLI_REVENDA: Integer;
FCLI_CODIGO: Integer;
FCLI_TIPOLICENCA: String;
FCLI_RETAGUARDA: Integer;
FCLI_CEP: String;
FCLI_CNPJCPF: String;
FCLI_IE: String;
FCLI_NUMERO: String;
FCLI_DATACADASTRO: TDateTime;
FCLI_CIDADE: Integer;
procedure SetCLI_BAIRRO(const Value: String);
procedure SetCLI_CEP(const Value: String);
procedure SetCLI_CIDADE(const Value: Integer);
procedure SetCLI_CNPJCPF(const Value: String);
procedure SetCLI_CODIGO(const Value: Integer);
procedure SetCLI_DATACADASTRO(const Value: TDateTime);
procedure SetCLI_EMAIL(const Value: String);
procedure SetCLI_ENDERECO(const Value: String);
procedure SetCLI_ESTADO(const Value: String);
procedure SetCLI_IE(const Value: String);
procedure SetCLI_NUMERO(const Value: String);
procedure SetCLI_PDV(const Value: Integer);
procedure SetCLI_RAZAO(const Value: String);
procedure SetCLI_RETAGUARDA(const Value: Integer);
procedure SetCLI_REVENDA(const Value: Integer);
procedure SetCLI_TELEFONE(const Value: String);
procedure SetCLI_TIPOLICENCA(const Value: String);
procedure SetCLI_TIPOPESSOA(const Value: String);
public
constructor Create(); virtual;
destructor Destroy(); override;
published
property CLI_CODIGO : Integer read FCLI_CODIGO write SetCLI_CODIGO;
property CLI_RAZAO : String read FCLI_RAZAO write SetCLI_RAZAO;
property CLI_TELEFONE : String read FCLI_TELEFONE write SetCLI_TELEFONE;
property CLI_TIPOPESSOA : String read FCLI_TIPOPESSOA write SetCLI_TIPOPESSOA;
property CLI_CNPJCPF : String read FCLI_CNPJCPF write SetCLI_CNPJCPF;
property CLI_RETAGUARDA : Integer read FCLI_RETAGUARDA write SetCLI_RETAGUARDA;
property CLI_PDV : Integer read FCLI_PDV write SetCLI_PDV;
property CLI_EMAIL : String read FCLI_EMAIL write SetCLI_EMAIL;
property CLI_ENDERECO : String read FCLI_ENDERECO write SetCLI_ENDERECO;
property CLI_NUMERO : String read FCLI_NUMERO write SetCLI_NUMERO;
property CLI_BAIRRO : String read FCLI_BAIRRO write SetCLI_BAIRRO;
property CLI_CIDADE : Integer read FCLI_CIDADE write SetCLI_CIDADE;
property CLI_ESTADO : String read FCLI_ESTADO write SetCLI_ESTADO;
property CLI_CEP : String read FCLI_CEP write SetCLI_CEP;
property CLI_IE : String read FCLI_IE write SetCLI_IE;
property CLI_REVENDA : Integer read FCLI_REVENDA write SetCLI_REVENDA;
property CLI_DATACADASTRO : TDateTime read FCLI_DATACADASTRO write SetCLI_DATACADASTRO;
property CLI_TIPOLICENCA : String read FCLI_TIPOLICENCA write SetCLI_TIPOLICENCA;
end;
implementation
{ TCliente }
constructor TCliente.Create;
begin
FCLI_ENDERECO := '';
FCLI_ESTADO := '';
FCLI_TELEFONE := '';
FCLI_RAZAO := '';
FCLI_PDV := 0;
FCLI_TIPOPESSOA := '';
FCLI_BAIRRO := '';
FCLI_EMAIL := '';
FCLI_REVENDA := 0;
FCLI_CODIGO := 0;
FCLI_TIPOLICENCA := '';
FCLI_RETAGUARDA := 0;
FCLI_CEP := '';
FCLI_CNPJCPF := '';
FCLI_IE := '';
FCLI_NUMERO := '';
FCLI_DATACADASTRO := 0;
FCLI_CIDADE := 1;
end;
destructor TCliente.Destroy;
begin
inherited;
end;
procedure TCliente.SetCLI_BAIRRO(const Value: String);
begin
FCLI_BAIRRO := Value;
end;
procedure TCliente.SetCLI_CEP(const Value: String);
begin
FCLI_CEP := Value;
end;
procedure TCliente.SetCLI_CIDADE(const Value: Integer);
begin
FCLI_CIDADE := Value;
end;
procedure TCliente.SetCLI_CNPJCPF(const Value: String);
begin
FCLI_CNPJCPF := Value;
end;
procedure TCliente.SetCLI_CODIGO(const Value: Integer);
begin
FCLI_CODIGO := Value;
end;
procedure TCliente.SetCLI_DATACADASTRO(const Value: TDateTime);
begin
FCLI_DATACADASTRO := Value;
end;
procedure TCliente.SetCLI_EMAIL(const Value: String);
begin
FCLI_EMAIL := Value;
end;
procedure TCliente.SetCLI_ENDERECO(const Value: String);
begin
FCLI_ENDERECO := Value;
end;
procedure TCliente.SetCLI_ESTADO(const Value: String);
begin
FCLI_ESTADO := Value;
end;
procedure TCliente.SetCLI_IE(const Value: String);
begin
FCLI_IE := Value;
end;
procedure TCliente.SetCLI_NUMERO(const Value: String);
begin
FCLI_NUMERO := Value;
end;
procedure TCliente.SetCLI_PDV(const Value: Integer);
begin
FCLI_PDV := Value;
end;
procedure TCliente.SetCLI_RAZAO(const Value: String);
begin
FCLI_RAZAO := Value;
end;
procedure TCliente.SetCLI_RETAGUARDA(const Value: Integer);
begin
FCLI_RETAGUARDA := Value;
end;
procedure TCliente.SetCLI_REVENDA(const Value: Integer);
begin
FCLI_REVENDA := Value;
end;
procedure TCliente.SetCLI_TELEFONE(const Value: String);
begin
FCLI_TELEFONE := Value;
end;
procedure TCliente.SetCLI_TIPOLICENCA(const Value: String);
begin
FCLI_TIPOLICENCA := Value;
end;
procedure TCliente.SetCLI_TIPOPESSOA(const Value: String);
begin
FCLI_TIPOPESSOA := Value;
end;
end.
|
unit uPrincipal;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Menus;
type
TfrmPrincipal = class(TForm)
MainMenu1: TMainMenu;
Cadastro1: TMenuItem;
Alunos1: TMenuItem;
Professores1: TMenuItem;
Disciplinas1: TMenuItem;
Pedaggico1: TMenuItem;
Relatrios1: TMenuItem;
Matriculas1: TMenuItem;
urmas1: TMenuItem;
LanamentodeNotas1: TMenuItem;
Alunos3: TMenuItem;
AlunoseProfessores1: TMenuItem;
Sair1: TMenuItem;
procedure Alunos1Click(Sender: TObject);
procedure Professores1Click(Sender: TObject);
procedure Disciplinas1Click(Sender: TObject);
procedure urmas1Click(Sender: TObject);
procedure Matriculas1Click(Sender: TObject);
procedure LanamentodeNotas1Click(Sender: TObject);
procedure Alunos3Click(Sender: TObject);
procedure AlunoseProfessores1Click(Sender: TObject);
procedure Sair1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmPrincipal: TfrmPrincipal;
implementation
{$R *.dfm}
uses uCadastroAluno, uCadastroProfessores, uDisciplina, uProfessor_Disciplina,
uMatricula, uNotas, uRelAlunos, uAlunosProfessores, uFiltroRelatorio;
procedure TfrmPrincipal.Alunos1Click(Sender: TObject);
begin
if frmCadastroAluno = nil then
frmCadastroAluno := TfrmCadastroAluno.Create(Self);
frmCadastroAluno.Show;
end;
procedure TfrmPrincipal.Alunos3Click(Sender: TObject);
begin
if frmFiltroRelatorio = nil then
frmFiltroRelatorio := TfrmFiltroRelatorio.Create(Self);
frmFiltroRelatorio.Show;
end;
procedure TfrmPrincipal.AlunoseProfessores1Click(Sender: TObject);
begin
if frmAlunosProfessores = nil then
frmAlunosProfessores := TfrmAlunosProfessores.Create(Self);
frmAlunosProfessores.rlAlunosProfessores.Preview();
end;
procedure TfrmPrincipal.Disciplinas1Click(Sender: TObject);
begin
if frmCadastroDisciplina = nil then
frmCadastroDisciplina := TfrmCadastroDisciplina.Create(Self);
frmCadastroDisciplina.Show;
end;
procedure TfrmPrincipal.LanamentodeNotas1Click(Sender: TObject);
begin
if frmLancamentoNotas = nil then
frmLancamentoNotas := TfrmLancamentoNotas.Create(Self);
frmLancamentoNotas.Show;
end;
procedure TfrmPrincipal.Matriculas1Click(Sender: TObject);
begin
if frmCadastroAlunoDisciplina = nil then
frmCadastroAlunoDisciplina := TfrmCadastroAlunoDisciplina.Create(Self);
frmCadastroAlunoDisciplina.Show;
end;
procedure TfrmPrincipal.Professores1Click(Sender: TObject);
begin
if frmCadastroProfessores = nil then
frmCadastroProfessores := TfrmCadastroProfessores.Create(Self);
frmCadastroProfessores.Show;
end;
procedure TfrmPrincipal.Sair1Click(Sender: TObject);
begin
Close;
end;
procedure TfrmPrincipal.urmas1Click(Sender: TObject);
begin
if frmCadastroProf_Disciplina = nil then
frmCadastroProf_Disciplina := TfrmCadastroProf_Disciplina.Create(Self);
frmCadastroProf_Disciplina.Show;
end;
end.
|
unit uPenjualan;
interface
uses
uModel, System.Generics.Collections, uSupplier;
type
TPenjualan = class;
TPenjualanItem = class(TAppObjectItem)
private
FBarang: TBarang;
FBarangSatuangItemID: string;
FDiskon: Double;
FHarga: Double;
FJenisHarga: string;
FKonversi: Double;
FPenjualan: TPenjualan;
FPPN: Double;
FQty: Double;
FUOM: TUOM;
function GetHargaSetelahDiskon: Double;
public
function GetHeaderField: string; override;
procedure SetHeaderProperty(AHeaderProperty : TAppObject); override;
property BarangSatuangItemID: string read FBarangSatuangItemID write
FBarangSatuangItemID;
published
property Barang: TBarang read FBarang write FBarang;
property Diskon: Double read FDiskon write FDiskon;
property Harga: Double read FHarga write FHarga;
property HargaSetelahDiskon: Double read GetHargaSetelahDiskon;
property JenisHarga: string read FJenisHarga write FJenisHarga;
property Konversi: Double read FKonversi write FKonversi;
property Penjualan: TPenjualan read FPenjualan write FPenjualan;
property PPN: Double read FPPN write FPPN;
property Qty: Double read FQty write FQty;
property UOM: TUOM read FUOM write FUOM;
end;
TPenjualan = class(TAppObject)
private
FCabang: TCabang;
FDiskon: Double;
FFee: string;
FGudang: TGudang;
FJatuhTempo: TDatetime;
FJenisPembayaran: string;
FJenisPenjualan: string;
FKasir: string;
FKeterangan: string;
FNoBukti: string;
FPembeli: TSupplier;
FSalesman: TSupplier;
FPenjualanItems: TObjectList<TPenjualanItem>;
FPPN: Double;
FSubTotal: Double;
FTglBukti: TDatetime;
FTermOfPayment: Integer;
FTotal: Double;
function GetDiskon: Double;
function GetPenjualanItems: TObjectList<TPenjualanItem>;
function GetPPN: Double;
function GetSubTotal: Double;
function GetTotal: Double;
public
published
property Cabang: TCabang read FCabang write FCabang;
property Diskon: Double read GetDiskon write FDiskon;
property Fee: string read FFee write FFee;
property Gudang: TGudang read FGudang write FGudang;
property JatuhTempo: TDatetime read FJatuhTempo write FJatuhTempo;
property JenisPembayaran: string read FJenisPembayaran write FJenisPembayaran;
property JenisPenjualan: string read FJenisPenjualan write FJenisPenjualan;
property Kasir: string read FKasir write FKasir;
property Keterangan: string read FKeterangan write FKeterangan;
property NoBukti: string read FNoBukti write FNoBukti;
property Pembeli: TSupplier read FPembeli write FPembeli;
property Salesman: TSupplier read FSalesman write FSalesman;
property PenjualanItems: TObjectList<TPenjualanItem> read GetPenjualanItems
write FPenjualanItems;
property PPN: Double read GetPPN write FPPN;
property SubTotal: Double read GetSubTotal write FSubTotal;
property TglBukti: TDatetime read FTglBukti write FTglBukti;
property TermOfPayment: Integer read FTermOfPayment write FTermOfPayment;
property Total: Double read GetTotal write FTotal;
end;
implementation
function TPenjualan.GetDiskon: Double;
var
dLineDisc: Double;
I: Integer;
begin
FDiskon := 0;
for I := 0 to PenjualanItems.Count - 1 do
begin
dLineDisc := PenjualanItems[i].Qty *
PenjualanItems[i].Harga *
PenjualanItems[i].Diskon / 100;
FDiskon := FDiskon + dLineDisc;
end;
Result := FDiskon;
end;
function TPenjualan.GetPenjualanItems: TObjectList<TPenjualanItem>;
begin
if FPenjualanItems = nil then
FPenjualanItems := TObjectList<TPenjualanItem>.Create(False);
Result := FPenjualanItems;
end;
function TPenjualan.GetPPN: Double;
var
dLinePPN: Double;
I: Integer;
begin
FPPN := 0;
for I := 0 to PenjualanItems.Count - 1 do
begin
dLinePPN := PenjualanItems[i].Qty *
PenjualanItems[i].HargaSetelahDiskon *
PenjualanItems[i].PPN / 100;
FPPN := FPPN + dLinePPN;
end;
Result := FPPN;
end;
function TPenjualan.GetSubTotal: Double;
var
dLinePrice: Double;
I: Integer;
begin
FSubTotal := 0;
for I := 0 to PenjualanItems.Count - 1 do
begin
dLinePrice := PenjualanItems[i].Qty *
PenjualanItems[i].Harga;
FSubTotal := FSubTotal + dLinePrice;
end;
Result := FSubTotal;
end;
function TPenjualan.GetTotal: Double;
begin
FTotal := SubTotal - Diskon + PPN;
Result := FTotal;
end;
function TPenjualanItem.GetHargaSetelahDiskon: Double;
begin
Result := Harga * (100 - Diskon) / 100;
end;
function TPenjualanItem.GetHeaderField: string;
begin
Result := 'Penjualan';
end;
procedure TPenjualanItem.SetHeaderProperty(AHeaderProperty : TAppObject);
begin
Self.Penjualan := TPenjualan(AHeaderProperty);
end;
end.
|
unit UXdrzClasses;
interface
uses
ExtCtrls, SysUtils, Forms, Controls, dialogs;
type
TTabuleiro = class(TOBject)
private
tTabGeral: array [1..8,1..8] of integer; // 0 - vazio; 1 - ocupado
tTabPeca: array[1..8,1..8] of integer; //armazena o codigo da peca em sua posicao
public
procedure SetTabGeral(x,y:integer;Vazio:boolean); //vazio = true p/vazio, seta 0 p/posicao vazia e 1 para ocupada
function GetTabGeral(x,y:integer):boolean; //retorna true p/vazio
procedure SetTabPeca(x,y,codPeca:integer); //seta a peca a sua posicao
function GetTabPeca(x,y:integer):integer; //retorna o codigo da peca na posicao
end;
TTipoPeca = (tpPeao, tpTorre, tpCavalo, tpBispo, tpRainha, tpRei);
TCorPeca = (cpBranca, cpPreta);
TPeca = class(TObject)
private
pCodPeca: integer;
pPosXY: array [1..2] of integer;
pTipo: TTipoPeca;
pCor: TCorPeca;
procedure SetPosicaoImagem(x,y:integer);
public
pImagem:TImage;
constructor Create(ImagemParent:TWinControl; CodigoPeca:integer);
destructor Destroy;
procedure SetCodPeca(codigo:integer);
function GetCodPeca(peca:TPeca):integer;
procedure SetPosPeca(x,y, codPeca:integer; Vtabuleiro:TTabuleiro);
function GetPosXPeca():integer;
function GetPosYPeca():integer;
procedure SetTipo(tipo:TTipoPeca);
function GetTipo:TTipoPeca;
procedure SetCor(cor:TCorPeca);
function GetCor:TCorPeca;
procedure SetImagem(caminho:string);
procedure MovimentaPeca(Sender:TObject);
procedure MovimentaFrente(qtdCasas:integer);
procedure MovimentaDiagonal(codDiag,qtdCasas:integer);
end;
TCavalo = class(TPeca)
private
public
function MovimentaCavalo(codMovimento:integer):Boolean; //retorna false caso não seja possível; (talvez não precise ser function)
end;
TMovimento = class
private
mCodigo:integer;
mDisponivel: array [1..8,1..8] of integer; //armazena posicoes [x],[y] disponiveis.
mImagem: TImage;
mPosXY: array [1..2] of integer;
mGerador: TPeca;
mDistanciaX, mDistanciaY: integer; //distancia da peca que gerou o movimento
public
constructor Create(ImagemParent:TWinControl; CodigoMovimento:integer);
procedure SetCodigo(codMovimento:integer);
function GetCodigo(Vmovimento:TMovimento):integer;
procedure SetMovDisponivel(peca:TPeca); // identifica o tipo de peca para entao identificar a qtd d movimentos e direcoes
procedure GetMovDisponivel(peca:TPeca); // cria imagens nas posicoes disponiveis
procedure SetImagemMov(caminho:string);
procedure SetPosXY(x,y:integer);
function GetPosX(Vmovimento:TMovimento):integer;
function GetPosY(Vmoviemnto:TMovimento):integer;
end;
implementation
{ TTabuleiro }
function TTabuleiro.GetTabGeral(x, y: integer): boolean;
//0 = vazio = true
begin
result := tTabGeral[x,y] = 0;
end;
function TTabuleiro.GetTabPeca(x, y: integer): integer;
//retorna o codigo da peca
begin
result := tTabPeca[x,y];
end;
procedure TTabuleiro.SetTabGeral(x, y: integer; Vazio: boolean);
begin
if vazio then
tTabGeral[x,y] := 0
else
tTabGeral[x,y] := 1;
end;
procedure TTabuleiro.SetTabPeca(x, y, codPeca: integer);
begin
tTabPeca[x,y] := codPeca;
end;
{ TPeca }
constructor TPeca.Create(ImagemParent:TWinControl; CodigoPeca:integer);
begin
pImagem := TImage.Create(nil);
pImagem.Parent := ImagemParent;
pImagem.Visible := True;
pImagem.AutoSize := True;
pImagem.BringToFront;
pImagem.Transparent := True;
pImagem.Tag := codigoPeca;
end;
destructor TPeca.Destroy;
begin
FreeAndNil(pImagem);
end;
function TPeca.GetCodPeca(peca: TPeca): integer;
begin
result := peca.pCodPeca;
end;
function TPeca.GetCor: TCorPeca;
begin
result := pCor;
end;
function TPeca.GetPosXPeca(): integer;
begin
result := pPosXY[1];
end;
function TPeca.GetPosYPeca(): integer;
begin
result := pPosXY[2];
end;
function TPeca.GetTipo: TTipoPeca;
begin
result := pTipo;
end;
procedure TPeca.MovimentaDiagonal(codDiag, qtdCasas: integer);
begin
//
end;
procedure TPeca.MovimentaFrente(qtdCasas: integer);
begin
//
end;
procedure TPeca.MovimentaPeca(Sender:TObject);
begin
ShowMessage('posX: ' + IntToStr((Sender as TPeca).GetPosXPeca) + 'posY: ' + IntToStr((Sender as TPeca).GetPosYPeca));
end;
procedure TPeca.SetCodPeca(codigo: integer);
begin
pCodPeca := codigo;
end;
procedure TPeca.SetCor(cor: TCorPeca);
begin
pCor := cor;
end;
procedure TPeca.SetImagem(caminho: string);
begin
pImagem.Picture.LoadFromFile(caminho);
end;
procedure TPeca.SetPosicaoImagem(x, y: integer);
{quadro = 49x45 margem de 7 em cada lado, 3,5 por quadro
meio quadro = 24,5x22,5, pois quero a imagem centralizada}
var
i:integer;
begin
if x = 1 then
pImagem.Left := 24
else
pImagem.Left := (56 * (x-1))+24; //56 = 28 * 2 = (24,5 + 3,5) * 2
if y = 1 then
pImagem.Top := 0
else
pImagem.Top := (52 *(y-1)); // 52 = 26 * 2 = (22,5 + 3,5) * 2
end;
procedure TPeca.SetPosPeca(x, y, codPeca: integer; Vtabuleiro:TTabuleiro);
begin
pPosXY[1] := x;
pPosXY[2] := y;
Vtabuleiro.tTabGeral[x,y] := 1;
Vtabuleiro.tTabPeca[x,y] := codPeca;
SetPosicaoImagem(x,y);
end;
procedure TPeca.SetTipo(tipo: TTipoPeca);
begin
pTipo := tipo;
end;
{ TCavalo }
function TCavalo.MovimentaCavalo(codMovimento:integer): Boolean;
begin
//
end;
{ TMovimento }
constructor TMovimento.Create(ImagemParent: TWinControl;
CodigoMovimento: integer);
begin
mImagem := TImage.Create(nil);
mImagem.Parent := ImagemParent;
mImagem.Visible := True;
mImagem.AutoSize := True;
mImagem.BringToFront;
// mImagem.Transparent := True;
mImagem.Tag := codigoMovimento;
mImagem.left := 3;
mImagem.top := 4;
end;
function TMovimento.GetCodigo(Vmovimento: TMovimento): integer;
begin
result := Vmovimento.mCodigo;
end;
procedure TMovimento.GetMovDisponivel;
//posiciona as imagens de movimento em locais disponiveis
var
i,j:integer;
begin
for i := 1 to 8 do
begin
for j := 1 to 8 do
begin
if mDisponivel[i,j] = 9 then
begin
{
mImagem.Left := mImagem.Left + (28 * (i-1));
mImagem.Top := mImagem.Top + (52 * (j-1));
mImagem.Left := mImagem.Left + (peca.pImagem.Left -23);
mImagem.Top := mImagem.Top + (peca.pImagem.Top);
}
mImagem.Left := mImagem.Left + ((i-1)*28);
mImagem.Top := mImagem.Top + ((j-1)*31);
end;
end;
end;
end;
function TMovimento.GetPosX(Vmovimento: TMovimento): integer;
begin
result := mPosXY[1];
end;
function TMovimento.GetPosY(Vmoviemnto: TMovimento): integer;
begin
result := mPosXY[2];
end;
procedure TMovimento.SetCodigo(codMovimento: integer);
begin
mCodigo := codMovimento;
end;
procedure TMovimento.SetImagemMov(caminho: string);
begin
mImagem.Picture.LoadFromFile(caminho);
end;
procedure TMovimento.SetMovDisponivel(peca: TPeca);
begin
case peca.GetTipo of
tpPeao:
begin
if peca.GetCor = cpBranca then
begin
if peca.GetPosYPeca = 2 then //primeiro movimento peao branco
begin
mDisponivel[peca.GetPosXPeca,peca.GetPosYPeca+1] := 9;
mDisponivel[peca.GetPosXPeca,peca.GetPosYPeca+2] := 9;
end else
begin
mDisponivel[peca.GetPosXPeca,peca.GetPosYPeca+1] := 9;
end;
end else
begin
if peca.GetPosYPeca = 7 then //primeiro movimento peao preto
begin
mDisponivel[peca.GetPosXPeca,peca.GetPosYPeca-1] := 9;
mDisponivel[peca.GetPosXPeca,peca.GetPosYPeca-2] := 9;
end else
begin
mDisponivel[peca.GetPosXPeca,peca.GetPosYPeca-1] := 9;
end;
end;
end;
tpTorre:
begin
end;
tpCavalo:
begin
end;
tpBispo:
begin
end;
tpRainha:
begin
end;
tpRei:
begin
end;
end;
end;
procedure TMovimento.SetPosXY(x, y: integer);
begin
mPosXY[1] := x;
mPosXY[2] := y;
end;
end.
|
unit Solid.Samples.ISP.Office.Ok;
interface
type
{ IFaxDevice }
IFaxDevice = interface
['{344C94E0-8962-409C-AC88-FCE9B4068073}']
procedure Fax(Document: TObject; const ANumber: string);
end;
{ IPrinterDevice }
IPrinterDevice = interface
['{FE0FC77A-1A22-452B-9813-3C5D7F01485D}']
procedure Print(Document: TObject; APages: TArray<Integer>);
end;
{ IScannerDevice }
IScannerDevice = interface
['{8FA35D73-9FED-4F83-B27C-4F133427B905}']
procedure Scan(Document: TObject; MultiplePages: Boolean);
end;
{ TModemFax }
TModemFax = class(TInterfacedObject, IFaxDevice)
public
procedure Fax(Document: TObject; const ANumber: string);
end;
{ TSimplePrinter }
TSimplePrinter = class(TInterfacedObject, IPrinterDevice)
public
procedure Print(Document: TObject; APages: System.TArray<System.Integer>);
end;
{ THighDpiScanner }
THighDpiScanner = class(TInterfacedObject, IScannerDevice)
public
procedure Scan(Document: TObject; MultiplePages: Boolean);
end;
{ TMultifunctionalPrinter }
TMultifunctionalPrinter = class(TInterfacedObject,
IFaxDevice, IPrinterDevice, IScannerDevice)
public
procedure Fax(Document: TObject; const ANumber: string);
procedure Print(Document: TObject; APages: System.TArray<System.Integer>);
procedure Scan(Document: TObject; MultiplePages: Boolean);
end;
implementation
{ TModemFax }
procedure TModemFax.Fax(Document: TObject; const ANumber: string);
begin
// TODO
end;
{ TSimplePrinter }
procedure TSimplePrinter.Print(Document: TObject;
APages: System.TArray<System.Integer>);
begin
// TODO
end;
{ THighDpiScanner }
procedure THighDpiScanner.Scan(Document: TObject; MultiplePages: Boolean);
begin
// TODO
end;
{ TMultifunctionalPrinter }
procedure TMultifunctionalPrinter.Fax(Document: TObject; const ANumber: string);
begin
// TODO
end;
procedure TMultifunctionalPrinter.Print(Document: TObject;
APages: System.TArray<System.Integer>);
begin
// TODO
end;
procedure TMultifunctionalPrinter.Scan(Document: TObject;
MultiplePages: Boolean);
begin
// TODO
end;
end.
|
unit GX_IdeInstallPackagesEnhancer;
interface
uses
SysUtils;
type
TGxIdeInstallPackagesEnhancer = class
public
class function GetEnabled: Boolean; // static;
class procedure SetEnabled(const Value: Boolean); //static;
end;
implementation
uses
GX_IdeFormEnhancer,
GX_OtaUtils,
StrUtils,
Forms,
ExtCtrls,
Controls,
StdCtrls,
CheckLst,
Dialogs,
ShellApi,
Windows,
Registry,
GX_GenericUtils,
Classes,
GX_IdeUtils;
type
TInstallPackagesEnhancer = class
private
FFormCallbackHandle: TFormChangeHandle;
FPkgListBox: TCheckListBox;
FPkgNameLabel: TLabel;
///<summary>
/// frm can be nil </summary>
procedure HandleFormChanged(_Sender: TObject; _Form: TCustomForm);
function IsProjectOptionsForm(_Form: TCustomForm): Boolean;
function IsPackageChecklistForm(_Form: TCustomForm): Boolean;
procedure EnhancePackageChecklistForm(_Form: TCustomForm);
procedure EnhanceProjectOptionsForm(_Form: TCustomForm);
function TryGetPackageInstallControlsOnProjectOptions(_Form: TCustomForm;
out _grp: TGroupBox; out _AddBtn: TButton; out _ChkLst: TCheckListBox;
out _NamePnl: TPanel; out _NameLabel: TLabel): Boolean;
// procedure b_RenameClick(_Sender: TObject);
procedure b_SelectClick(_Sender: TObject);
function TryGetPackageInstallControlsOnPackageChecklist(_Form: TCustomForm;
out _BtnPanel: TPanel; out _AddBtn: TButton; out _ChkLst: TCheckListBox;
out _NamePnl: TPanel;
out _NameLabel: TLabel): Boolean;
procedure EnhanceForm(_Form: TCustomForm; _BtnParent: TWinControl;
_AddBtn: TButton; _FilenamePanel: TPanel);
public
constructor Create;
destructor Destroy; override;
end;
var
TheInstallPackagesEnhancer: TInstallPackagesEnhancer = nil;
{ TGxIdeInstallPackagesEnhancer }
class function TGxIdeInstallPackagesEnhancer.GetEnabled: Boolean;
begin
Result := Assigned(TheInstallPackagesEnhancer);
end;
class procedure TGxIdeInstallPackagesEnhancer.SetEnabled(const Value: Boolean);
begin
if Value then begin
if not Assigned(TheInstallPackagesEnhancer) then
TheInstallPackagesEnhancer := TInstallPackagesEnhancer.Create
end else
FreeAndNil(TheInstallPackagesEnhancer);
end;
{ TInstallPackagesEnhancer }
constructor TInstallPackagesEnhancer.Create;
begin
inherited Create;
FFormCallbackHandle := TIDEFormEnhancements.RegisterFormChangeCallback(HandleFormChanged)
end;
destructor TInstallPackagesEnhancer.Destroy;
begin
TIDEFormEnhancements.UnregisterFormChangeCallback(FFormCallbackHandle);
inherited;
end;
procedure TInstallPackagesEnhancer.HandleFormChanged(_Sender: TObject; _Form: TCustomForm);
begin
if IsProjectOptionsForm(_Form) then begin
EnhanceProjectOptionsForm(_Form);
end else if IsPackageChecklistForm(_Form) then begin
EnhancePackageChecklistForm(_Form);
end;
end;
function TInstallPackagesEnhancer.IsPackageChecklistForm(_Form: TCustomForm): Boolean;
begin
Result := (_Form.ClassName = 'TDlgPackageCheckList') and (_Form.Name = 'DlgPackageCheckList');
end;
function TInstallPackagesEnhancer.IsProjectOptionsForm(_Form: TCustomForm): Boolean;
begin
Result := (_Form.ClassName = 'TDelphiProjectOptionsDialog') and (_Form.Name = 'DelphiProjectOptionsDialog')
or (_Form.ClassName = 'TProjectOptionsDialog') and (_Form.Name = 'ProjectOptionsDialog');
end;
function TInstallPackagesEnhancer.TryGetPackageInstallControlsOnProjectOptions(_Form: TCustomForm;
out _grp: TGroupBox; out _AddBtn: TButton; out _ChkLst: TCheckListBox;
out _NamePnl: TPanel; out _NameLabel: TLabel): Boolean;
var
ctrl: TControl;
wctrl: TWinControl;
i: Integer;
PackageInstall: TWinControl;
begin
Result := False;
wctrl := nil;
for i := 0 to _Form.ControlCount - 1 do begin
ctrl := _Form.Controls[i];
if (ctrl.ClassName = 'TPanel') and (ctrl.Name = 'Panel2') then begin
wctrl := TWinControl(ctrl);
Break;
end;
end;
if not Assigned(wctrl) then
Exit;
if (wctrl.ControlCount > 0) and (wctrl.Controls[0].ClassName = 'TPropertySheetControl') then
ctrl := wctrl.Controls[0]
else if (wctrl.ControlCount > 1) and (wctrl.Controls[1].ClassName = 'TPropertySheetControl') then
ctrl := wctrl.Controls[1]
else
exit;
wctrl := TWinControl(ctrl);
PackageInstall := nil;
for i := 0 to wctrl.ControlCount - 1 do begin
ctrl := wctrl.Controls[i];
if ctrl.ClassName = 'TPackageInstall' then begin
PackageInstall := TWinControl(ctrl);
break;
end;
end;
if (PackageInstall = nil) or (PackageInstall.ControlCount < 1) then
Exit;
ctrl := PackageInstall.Controls[0];
if ctrl.ClassName <> 'TGroupBox' then
Exit;
_grp := TGroupBox(ctrl);
if _grp.ControlCount <> 6 then
Exit;
ctrl := _grp.Controls[0];
if (ctrl.ClassName <> 'TCheckListBox') or (ctrl.Name <> 'DesignPackageList') then
Exit;
_ChkLst := TCheckListBox(ctrl);
ctrl := _grp.Controls[2];
if (ctrl.ClassName <> 'TButton') or (ctrl.Name <> 'AddButton') then
Exit;
_AddBtn := TButton(ctrl);
ctrl := _grp.Controls[1];
if (ctrl.ClassName <> 'TPanel') or (ctrl.Name <> 'Panel1') then
Exit;
_NamePnl := TPanel(ctrl);
if _NamePnl.ControlCount < 1 then
Exit;
ctrl := _NamePnl.Controls[0];
if (ctrl.ClassName <> 'TLabel') or (ctrl.Name <> 'LabelPackageFile') then
Exit;
_NameLabel := TLabel(ctrl);
Result := True;
end;
// when called via Component -> Install Packages and a project is loaded
// or via Project -> Options:
// DelphiProjectOptionsDialog !or! ProjectOptionsDialog: TDelphiProjectOptionsDialog !or! TProjectOptionsDialog
// -> [1, 2 or 3] Panel2: TPanel
// -> [0 or 1] PropertySheetControl1 !or! PropSheetControl: TpropertySheetControl
// -> [??] '': TPackageInstall
// -> [0] GroupBox1: TGroupBox !or! [0] gbDesignPackages: TGroupBox
// -> [0] DesignPackageList: TCheckListBox
// -> [1] Panel1: TPanel
// -> [0] LabelPackageFile: TLabel
// -> [2] AddButton: TButton
// -> [3] RemoveButton: TButton
// -> [4] ButtonComponents: TButton
// -> [5] EditButton: TButton
procedure TInstallPackagesEnhancer.EnhanceForm(_Form: TCustomForm; _BtnParent: TWinControl;
_AddBtn: TButton; _FilenamePanel: TPanel);
resourcestring
rcSelectAModule = 'Open an explorer window with this package selected.';
const
ExplorerButtonName = 'GXExplorerButton';
var
// RenameBtn: TButton;
SelectBtn: TButton;
cmp: TComponent;
begin
// Unfortunately renaming packages (see b_RenameClick method) does not work.
// So we don't add the Rename button.
// RenameBtn := TButton.Create(_BtnParent);
// RenameBtn.Name := '';
// RenameBtn.Parent := _BtnParent;
// RenameBtn.Left := _AddBtn.Left - RenameBtn.Width - 8;
// RenameBtn.Top := _AddBtn.Top;
// RenameBtn.Caption := 'Rename';
// RenameBtn.Anchors := _AddBtn.Anchors;
// RenameBtn.TabOrder := _AddBtn.TabOrder;
// RenameBtn.OnClick := b_RenameClick;
cmp := _FilenamePanel.FindComponent(ExplorerButtonName);
if Assigned(cmp) then
exit; // the button already exists
SelectBtn := TButton.Create(_FilenamePanel);
SelectBtn.Name := ExplorerButtonName;
SelectBtn.Parent := _FilenamePanel;
SelectBtn.Width := _FilenamePanel.ClientHeight;
SelectBtn.Caption := '...';
SelectBtn.Align := alRight;
SelectBtn.OnClick := b_SelectClick;
SelectBtn.Hint := rcSelectAModule;
SelectBtn.ShowHint := True;
end;
procedure TInstallPackagesEnhancer.EnhanceProjectOptionsForm(_Form: TCustomForm);
var
grp: TGroupBox;
pnl: TPanel;
AddBtn: TButton;
begin
if not TryGetPackageInstallControlsOnProjectOptions(_Form, grp, AddBtn, FPkgListBox, pnl, FPkgNameLabel) then
Exit;
EnhanceForm(_Form, grp, AddBtn, pnl);
end;
procedure TInstallPackagesEnhancer.b_SelectClick(_Sender: TObject);
begin
// open an explrer window and select the package file there
ShellExecute(0, nil, 'explorer.exe', PChar('/select,' + FPkgNameLabel.Caption), nil, SW_SHOWNORMAL)
end;
//procedure TInstallPackagesEnhancer.b_RenameClick(_Sender: TObject);
//var
// Description: string;
// fn: string;
// idx: Integer;
// Reg: TRegistry;
// BDS: string;
// fno: string;
// Desc: string;
//begin
// // Unfortunately the IDE seems to ignore the string that is used in the registry.
// // Maybe it reads the description directly from the package? So this doesn't work as expected.
// idx := FPkgListBox.ItemIndex;
// if idx = -1 then
// Exit;
// fn := FPkgNameLabel.Caption;
// Description := FPkgListBox.Items[idx];
// Reg := TRegistry.Create;
// try
// Reg.RootKey := HKEY_CURRENT_USER;
// if not Reg.OpenKey(GxOtaGetIdeBaseRegistryKey + '\Known Packages', True) then
// Exit;
// try
// if not Reg.ValueExists(fn) then begin
// BDS := RemoveSlash(GetIdeRootDirectory);
//
// fno := ExtractFileName(fn);
// if not SameText(fn, BDS + '\bin\' + fno) then
// Exit;
// fn := '$(BDS)\bin\' + fno;
// if not Reg.ValueExists(fn) then
// Exit;
// end;
// Desc := Reg.ReadString(fn);
// if not TfmIdxPackageRenameDlg.Execute(GetParentForm(TControl(_Sender)), fn, Desc) then
// Exit;
// Reg.WriteString(fn, Desc);
// finally
// Reg.CloseKey;
// end;
// finally
// Reg.Free;
// end;
//end;
procedure TInstallPackagesEnhancer.EnhancePackageChecklistForm(_Form: TCustomForm);
var
BtnParent: TPanel;
FilenamePanel: TPanel;
AddBtn: TButton;
begin
if not TryGetPackageInstallControlsOnPackageChecklist(_Form, BtnParent, AddBtn, FPkgListBox, FilenamePanel, FPkgNameLabel) then
Exit;
EnhanceForm(_Form, BtnParent, AddBtn, FilenamePanel);
end;
function TInstallPackagesEnhancer.TryGetPackageInstallControlsOnPackageChecklist(_Form: TCustomForm;
out _BtnPanel: TPanel; out _AddBtn: TButton; out _ChkLst: TCheckListBox;
out _NamePnl: TPanel; out _NameLabel: TLabel): Boolean;
var
ctrl: TControl;
wctrl: TWinControl;
begin
Result := False;
if _Form.ControlCount < 4 then
Exit;
ctrl := _Form.Controls[3];
if ctrl.ClassName <> 'TGroupBox' then
Exit;
wctrl := TGroupBox(ctrl);
if wctrl.ControlCount < 1 then
Exit;
ctrl := wctrl.Controls[0];
if (ctrl.ClassName <> 'TFramePackageCheckList') or (ctrl.Name <> 'FramePackageCheckList1') then
Exit;
wctrl := TWinControl(ctrl);
if wctrl.ControlCount < 1 then
Exit;
ctrl := wctrl.Controls[0];
if (ctrl.ClassName <> 'TPanel') and (ctrl.Name <> 'Panel2') then
Exit;
wctrl := TWinControl(ctrl);
_BtnPanel := TPanel(wctrl);
if wctrl.ControlCount < 6 then
Exit;
ctrl := wctrl.Controls[1];
if (ctrl.ClassName <> 'TCheckListBox') or (ctrl.Name <> 'DesignPackageList') then
Exit;
_ChkLst := TCheckListBox(ctrl);
ctrl := wctrl.Controls[2];
if (ctrl.ClassName <> 'TButton') or (ctrl.Name <> 'AddButton') then
Exit;
_AddBtn := TButton(ctrl);
ctrl := wctrl.Controls[0];
if (ctrl.ClassName <> 'TPanel') or (ctrl.Name <> 'Panel1') then
Exit;
_NamePnl := TPanel(ctrl);
if _NamePnl.ControlCount < 1 then
Exit;
ctrl := _NamePnl.Controls[0];
if (ctrl.ClassName <> 'TLabel') or (ctrl.Name <> 'LabelPackageFile') then
Exit;
_NameLabel := TLabel(ctrl);
Result := True;
end;
// when called via Component -> Install Packages and no project is loaded:
// DlgPackageCheckList: TDlgPackageCheckList
// -> [3] GroupBox1: TGroupBox
// -> [0] FramePackageCheckList1: TFramePackageCheckList
// -> [0] Panel2: TPanel
// -> [0] Panel1: TPanel
// -> [0] LabelPackageFile: TLabel
// -> [1] DesignPackageList: TCheckListBox
// -> [2] AddButton: TButton
// -> [3] RemoveButton: TButton
// -> [4] ButtonComponents: TButton
// -> [5] EditButton: TButton
end.
|
unit TTSDIVITable;
interface
uses
Classes, DB, DBISAMTb, SysUtils, DBISAMTableAU, DataBuf;
type
TTTSDIVIRecord = record
PLenderNum: String[4];
PDivisionNum: String[8];
PModCount: Integer;
PDivisionName: String[25];
End;
TTTSDIVIBuffer = class(TDataBuf)
protected
function PtrIndex(Index:integer):Pointer;override;
public
Data: TTTSDIVIRecord;
function FieldNameToIndex(s:string):integer;override;
function FieldType(index:integer):TFieldType;override;
end;
TEITTSDIVI = (TTSDIVIPrimaryKey);
TTTSDIVITable = class( TDBISAMTableAU )
private
FDFLenderNum: TStringField;
FDFDivisionNum: TStringField;
FDFModCount: TIntegerField;
FDFDivisionName: TStringField;
procedure SetPLenderNum(const Value: String);
function GetPLenderNum:String;
procedure SetPDivisionNum(const Value: String);
function GetPDivisionNum:String;
procedure SetPModCount(const Value: Integer);
function GetPModCount:Integer;
procedure SetPDivisionName(const Value: String);
function GetPDivisionName:String;
function GenerateNewFieldName( AOwner: TComponent; const DatasetName: string; const FieldName: string ): string;
procedure SetEnumIndex(Value: TEITTSDIVI);
function GetEnumIndex: TEITTSDIVI;
protected
function CreateField( const FieldName : string ): TField;
procedure CreateFields; reintroduce;
procedure SetActive(Value: Boolean); override;
procedure LoadFieldDefs(AStringList:TStringList);override;
procedure LoadIndexDefs(AStringList:TStringList);override;
public
function GetDataBuffer:TTTSDIVIRecord;
procedure StoreDataBuffer(ABuffer:TTTSDIVIRecord);
property DFLenderNum: TStringField read FDFLenderNum;
property DFDivisionNum: TStringField read FDFDivisionNum;
property DFModCount: TIntegerField read FDFModCount;
property DFDivisionName: TStringField read FDFDivisionName;
property PLenderNum: String read GetPLenderNum write SetPLenderNum;
property PDivisionNum: String read GetPDivisionNum write SetPDivisionNum;
property PModCount: Integer read GetPModCount write SetPModCount;
property PDivisionName: String read GetPDivisionName write SetPDivisionName;
published
property Active write SetActive;
property EnumIndex: TEITTSDIVI read GetEnumIndex write SetEnumIndex;
end; { TTTSDIVITable }
procedure Register;
implementation
function TTTSDIVITable.GenerateNewFieldName( AOwner: TComponent; const DatasetName: string; const FieldName: string ): string;
var
I: Integer;
NewName: string;
Done: Boolean;
function ComponentExists( AOwner: TComponent; const CompName: string ): Boolean;
var
I: Integer;
begin
Result := False;
for I := 0 To AOwner.ComponentCount - 1 do
begin
if AnsiCompareText( CompName, AOwner.Components[ I ].Name ) = 0 then
begin
Result := True;
Break;
end;
end;
end; { ComponentExists }
begin { TTTSDIVITable.GenerateNewFieldName }
NewName := DatasetName;
for I := 1 to Length( FieldName ) do
begin
if FieldName[ I ] in [ '0'..'9', '_', 'A'..'Z', 'a'..'z' ] then
NewName := NewName + FieldName[ I ];
end;
if ComponentExists( Owner, NewName ) then
begin
I := 1;
Done := False;
repeat
Inc( I );
if not ComponentExists( AOwner, NewName + IntToStr( I ) ) then
begin
Result := NewName + IntToStr( I );
Done := True;
end;
until Done;
end
else
Result := NewName;
end; { TTTSDIVITable.GenerateNewFieldName }
function TTTSDIVITable.CreateField( const FieldName : string ): TField;
begin
{ First, try to find an existing field object. FindField is the same }
{ as FieldByName, but does not raise an exception if the field object }
{ cannot be found. }
Result := FindField( FieldName );
if Result = nil then
begin
{ If an existing field object cannot be found... }
{ Instruct the FieldDefs object to create a new field object }
Result := FieldDefs.Find( FieldName ).CreateField( Owner );
{ The new field object must be given a name so that it may appear in }
{ the Object Inspector. The Delphi default naming convention is used.}
Result.Name := GenerateNewFieldName( Owner, Name, FieldName);
end;
end; { TTTSDIVITable.CreateField }
procedure TTTSDIVITable.CreateFields;
begin
FDFLenderNum := CreateField( 'LenderNum' ) as TStringField;
FDFDivisionNum := CreateField( 'DivisionNum' ) as TStringField;
FDFModCount := CreateField( 'ModCount' ) as TIntegerField;
FDFDivisionName := CreateField( 'DivisionName' ) as TStringField;
end; { TTTSDIVITable.CreateFields }
procedure TTTSDIVITable.SetActive(Value: Boolean);
begin
inherited SetActive(Value);
if Active then
CreateFields;
end; { TTTSDIVITable.SetActive }
procedure TTTSDIVITable.SetPLenderNum(const Value: String);
begin
DFLenderNum.Value := Value;
end;
function TTTSDIVITable.GetPLenderNum:String;
begin
result := DFLenderNum.Value;
end;
procedure TTTSDIVITable.SetPDivisionNum(const Value: String);
begin
DFDivisionNum.Value := Value;
end;
function TTTSDIVITable.GetPDivisionNum:String;
begin
result := DFDivisionNum.Value;
end;
procedure TTTSDIVITable.SetPModCount(const Value: Integer);
begin
DFModCount.Value := Value;
end;
function TTTSDIVITable.GetPModCount:Integer;
begin
result := DFModCount.Value;
end;
procedure TTTSDIVITable.SetPDivisionName(const Value: String);
begin
DFDivisionName.Value := Value;
end;
function TTTSDIVITable.GetPDivisionName:String;
begin
result := DFDivisionName.Value;
end;
procedure TTTSDIVITable.LoadFieldDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('LenderNum, String, 4, N');
Add('DivisionNum, String, 8, N');
Add('ModCount, Integer, 0, N');
Add('DivisionName, String, 25, N');
end;
end;
procedure TTTSDIVITable.LoadIndexDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('PrimaryKey, LenderNum;DivisionNum, Y, Y, N, N');
end;
end;
procedure TTTSDIVITable.SetEnumIndex(Value: TEITTSDIVI);
begin
case Value of
TTSDIVIPrimaryKey : IndexName := '';
end;
end;
function TTTSDIVITable.GetDataBuffer:TTTSDIVIRecord;
var buf: TTTSDIVIRecord;
begin
fillchar(buf, sizeof(buf), 0);
buf.PLenderNum := DFLenderNum.Value;
buf.PDivisionNum := DFDivisionNum.Value;
buf.PModCount := DFModCount.Value;
buf.PDivisionName := DFDivisionName.Value;
result := buf;
end;
procedure TTTSDIVITable.StoreDataBuffer(ABuffer:TTTSDIVIRecord);
begin
DFLenderNum.Value := ABuffer.PLenderNum;
DFDivisionNum.Value := ABuffer.PDivisionNum;
DFModCount.Value := ABuffer.PModCount;
DFDivisionName.Value := ABuffer.PDivisionName;
end;
function TTTSDIVITable.GetEnumIndex: TEITTSDIVI;
var iname : string;
begin
result := TTSDIVIPrimaryKey;
iname := uppercase(indexname);
if iname = '' then result := TTSDIVIPrimaryKey;
end;
(********************************************)
(************ Register Component ************)
(********************************************)
procedure Register;
begin
RegisterComponents( 'TTS Tables', [ TTTSDIVITable, TTTSDIVIBuffer ] );
end; { Register }
function TTTSDIVIBuffer.FieldNameToIndex(s:string):integer;
const flist:array[1..4] of string = ('LENDERNUM','DIVISIONNUM','MODCOUNT','DIVISIONNAME' );
var x : integer;
begin
s := uppercase(s);
x := 1;
while (x <= 4) and (flist[x] <> s) do inc(x);
if x <= 4 then result := x else result := 0;
end;
function TTTSDIVIBuffer.FieldType(index:integer):TFieldType;
begin
result := ftUnknown;
case index of
1 : result := ftString;
2 : result := ftString;
3 : result := ftInteger;
4 : result := ftString;
end;
end;
function TTTSDIVIBuffer.PtrIndex(index:integer):Pointer;
begin
result := nil;
case index of
1 : result := @Data.PLenderNum;
2 : result := @Data.PDivisionNum;
3 : result := @Data.PModCount;
4 : result := @Data.PDivisionName;
end;
end;
end.
|
unit ADC.ComputerEdit;
interface
uses
System.SysUtils, System.StrUtils, Winapi.ActiveX, JwaActiveDS, ActiveDS_TLB,
Winapi.Windows, System.Variants, ADC.Types, ADC.LDAP, ADC.AD, ADC.Common,
System.RegularExpressions;
type
TMACAddrFormat = (gfSixOfTwo, gfThreeOfFour);
TMACAddrSeparator = (gsDot, gsColon, gsHyphen);
type
TMACAddr = type string;
type
TComputerEdit = record
dNSHostName: string;
employeeID: string;
IPv4: string;
DHCP_Server: string;
MAC_Address: TMACAddr;
operatingSystem: string;
operatingSystemHotfix: string;
operatingSystemServicePack: string;
operatingSystemVersion: string;
procedure Clear;
end;
TMACAddrHelper = record helper for TMACAddr
private
function GetGroupLength(AValue: TMACAddrFormat): Integer;
function GetSeparator(AValue: TMACAddrSeparator): string;
public
function Format(AFormat: TMACAddrFormat; ASeparator: TMACAddrSeparator;
AUpperCase: Boolean = False): string;
end;
TComputerEditHelper = record helper for TComputerEdit
private
function GetAttrStrValue(AObj: IADs; AAttrName: string): string;
procedure GenerateDSMod(AAttr: PChar; AValues: Pointer;
ANumValues: Cardinal; AMod: PADS_ATTR_INFO);
procedure GenerateLDAPStrMod(AAttr: PAnsiChar;
AStrVals: Pointer; var AMod: PLDAPMod);
function GetDomainDN(ALDAP: PLDAP): AnsiString;
function GetDistinguishedNameByName(ARootDSE: IADS; AName: string): string; overload;
function GetDistinguishedNameByName(ALDAP: PLDAP; AName: string): string; overload;
public
procedure GetExtendedInfo;
procedure GetInfoDS(ARootDSE: IADS; ADN: string);
procedure GetInfo(ARootDSE: IADS; ADN: string); overload;
procedure GetInfo(ALDAP: PLDAP; ADN: string); overload;
procedure GetInfoByNameDS(ARootDSE: IADS; AName: string);
procedure GetInfoByName(ARootDSE: IADS; AName: string); overload;
procedure GetInfoByName(ALDAP: PLDAP; AName: string); overload;
procedure SetInfoDS(ARootDSE: IADS; ADN: string);
procedure SetInfo(ARootDSE: IADS; ADN: string); overload;
procedure SetInfo(ALDAP: PLDAP; ADN: string); overload;
end;
implementation
{ TADComputerHelper }
procedure TComputerEditHelper.GetInfo(ARootDSE: IADS; ADN: string);
var
dn: string;
objComputer: IADs;
hr: HRESULT;
v: OleVariant;
hostName: string;
begin
Self.Clear;
if ADN.IsEmpty
then Exit;
CoInitialize(nil);
try
v := ARootDSE.Get('dnsHostName');
hostName := VariantToStringWithDefault(v, '');
VariantClear(v);
dn := ReplaceStr(ADN, '/', '\/');
hr := ADsOpenObject(
PChar(Format('LDAP://%s/%s', [hostName, dn])),
nil,
nil,
ADS_SECURE_AUTHENTICATION or ADS_SERVER_BIND,
IID_IADs,
@objComputer
);
if Succeeded(hr) then
begin
employeeID := GetAttrStrValue(objComputer, 'employeeID');
operatingSystem := GetAttrStrValue(objComputer, 'operatingSystem');
operatingSystemHotfix := GetAttrStrValue(objComputer, 'operatingSystemHotfix');
operatingSystemServicePack := GetAttrStrValue(objComputer, 'operatingSystemServicePack');
operatingSystemVersion := GetAttrStrValue(objComputer, 'operatingSystemVersion');
dNSHostName := GetAttrStrValue(objComputer, 'dNSHostName');
end else raise Exception.Create(ADSIErrorToString);
finally
CoUninitialize;
end;
end;
procedure TComputerEditHelper.GenerateDSMod(AAttr: PChar; AValues: Pointer;
ANumValues: Cardinal; AMod: PADS_ATTR_INFO);
begin
with AMod^ do
begin
pszAttrName := AAttr;
case ANumValues of
0: begin
dwControlCode := ADS_ATTR_CLEAR;
dwADsType := ADSTYPE_INVALID;
pADsValues := nil;
end;
else begin
dwControlCode := ADS_ATTR_UPDATE;
dwADsType := PADSVALUE(AValues)^.dwType;
pADsValues := AValues;
end;
end;
dwNumValues := ANumValues;
end;
end;
procedure TComputerEditHelper.GenerateLDAPStrMod(AAttr: PAnsiChar;
AStrVals: Pointer; var AMod: PLDAPMod);
begin
New(AMod);
with AMod^ do
begin
mod_type := AAttr;
mod_op := LDAP_MOD_REPLACE;
modv_strvals := AStrVals;
end;
end;
function TComputerEditHelper.GetAttrStrValue(AObj: IADs;
AAttrName: string): string;
var
v: OleVariant;
begin
Result := '';
try
v := AObj.Get(AAttrName);
if not VarIsNull(v)
then Result := VarToStr(v)
except
end;
VariantClear(v);
end;
function TComputerEditHelper.GetDistinguishedNameByName(ALDAP: PLDAP;
AName: string): string;
const
Attributes: array of PAnsiChar = [PAnsiChar('distinguishedName'), nil];
var
DomainDN: AnsiString;
DomainHostName: AnsiString;
returnCode: ULONG;
errorCode: ULONG;
ldapSearchResult: PLDAPMessage;
ldapBase: AnsiString;
ldapFilter: AnsiString;
ldapCookie: PLDAPBerVal;
ldapPage: PLDAPControl;
ldapControls: array[0..1] of PLDAPControl;
ldapServerControls: PPLDAPControl;
ldapCount: ULONG;
ldapEntry: PLDAPMessage;
morePages: Boolean;
dn: PAnsiChar;
i: Integer;
begin
try
ldapBase := GetDomainDN(ALDAP);
{ Формируем фильтр объектов AD }
ldapFilter := Format(
'(&(objectCategory=computer)(cn=%s))',
[AName]
);
ldapCookie := nil;
{ Постраничный поиск объектов AD }
repeat
returnCode := ldap_create_page_control(
ALDAP,
ADC_SEARCH_PAGESIZE,
ldapCookie,
1,
ldapPage
);
if returnCode <> LDAP_SUCCESS
then raise Exception.Create('Failure during ldap_create_page_control: ' + ldap_err2string(returnCode));
ldapControls[0] := ldapPage;
ldapControls[1] := nil;
returnCode := ldap_search_ext_s(
ALDAP,
PAnsiChar(ldapBase),
LDAP_SCOPE_SUBTREE,
PAnsiChar(ldapFilter),
PAnsiChar(@Attributes[0]),
0,
@ldapControls,
nil,
nil,
0,
ldapSearchResult
);
if not (returnCode in [LDAP_SUCCESS, LDAP_PARTIAL_RESULTS])
then raise Exception.Create('Failure during ldap_search_ext_s: ' + ldap_err2string(returnCode));
returnCode := ldap_parse_result(
ALDAP^,
ldapSearchResult,
@errorCode,
nil,
nil,
nil,
ldapServerControls,
False
);
if ldapCookie <> nil then
begin
ber_bvfree(ldapCookie);
ldapCookie := nil;
end;
returnCode := ldap_parse_page_control(
ALDAP,
ldapServerControls,
ldapCount,
ldapCookie
);
if (ldapCookie <> nil) and (ldapCookie.bv_val <> nil) and (System.SysUtils.StrLen(ldapCookie.bv_val) > 0)
then morePages := True
else morePages := False;
if ldapServerControls <> nil then
begin
ldap_controls_free(ldapServerControls);
ldapServerControls := nil;
end;
ldapControls[0]:= nil;
ldap_control_free(ldapPage);
ldapPage := nil;
{ Обработка объекта }
ldapEntry := ldap_first_entry(ALDAP, ldapSearchResult);
while ldapEntry <> nil do
begin
dn := ldap_get_dn(ALDAP, ldapEntry);
if dn <> nil
then Result := dn;
ldap_memfree(dn);
ldapEntry := ldap_next_entry(ALDAP, ldapEntry);
end;
ldap_msgfree(ldapSearchResult);
ldapSearchResult := nil;
until (morePages = False);
ber_bvfree(ldapCookie);
ldapCookie := nil;
except
end;
if ldapSearchResult <> nil
then ldap_msgfree(ldapSearchResult);
end;
function TComputerEditHelper.GetDomainDN(ALDAP: PLDAP): AnsiString;
var
attr: PAnsiChar;
attrArray: array of PAnsiChar;
returnCode: ULONG;
searchResult: PLDAPMessage;
ldapEntry: PLDAPMessage;
ldapValue: PPAnsiChar;
begin
SetLength(attrArray, 2);
attrArray[0] := PAnsiChar('defaultNamingContext');
attrArray[1] := nil;
returnCode := ldap_search_ext_s(
ALDAP,
nil,
LDAP_SCOPE_BASE,
PAnsiChar('(objectclass=*)'),
PAnsiChar(@attrArray[0]),
0,
nil,
nil,
nil,
0,
searchResult
);
if (returnCode = LDAP_SUCCESS) and (ldap_count_entries(ALDAP, searchResult) > 0 ) then
begin
ldapEntry := ldap_first_entry(ALDAP, searchResult);
ldapValue := ldap_get_values(ALDAP, ldapEntry, attrArray[0]);
if ldapValue <> nil
then Result := ldapValue^;
ldap_value_free(ldapValue);
end;
if searchResult <> nil
then ldap_msgfree(searchResult);
end;
procedure TComputerEditHelper.GetExtendedInfo;
var
infoIP: PIPAddr;
infoDHCP: PDHCPInfo;
sFormat: string;
sSrvName: string;
begin
New(infoIP);
New(infoDHCP);
if not Self.dNSHostName.IsEmpty then
begin
GetIPAddress(Self.dNSHostName, infoIP);
// GetDHCPInfo(Self.dNSHostName, infoDHCP);
GetDHCPInfoEx(Self.dNSHostName, infoDHCP);
end;
IPv4 := IfThen(
infoIP^.v4.IsEmpty,
infoDHCP^.IPAddress.v4,
infoIP^.v4
);
sSrvName := IfThen(
infoDHCP^.ServerName.IsEmpty,
infoDHCP^.ServerNetBIOSName,
infoDHCP^.ServerName
);
sFormat := IfThen(sSrvName.IsEmpty, '%s', '%s ( %s )');
MAC_Address := infoDHCP^.HardwareAddress;
DHCP_Server := Format(
sFormat,
[infoDHCP^.ServerAddress, sSrvName]
);
Dispose(infoIP);
Dispose(infoDHCP);
end;
function TComputerEditHelper.GetDistinguishedNameByName(ARootDSE: IADS;
AName: string): string;
const
Attributes: array of WideString = ['distinguishedName'];
var
v: OleVariant;
DomainDN: string;
DomainHostName: string;
SearchRes: IDirectorySearch;
SearchHandle: PHandle;
objFilter: string;
hRes: HRESULT;
SearchPrefs: array of ADS_SEARCHPREF_INFO;
col: ADS_SEARCH_COLUMN;
dn: string;
begin
if (ARootDSE = nil) or AName.IsEmpty
then Exit;
CoInitialize(nil);
v := ARootDSE.Get('defaultNamingContext');
DomainDN := VariantToStringWithDefault(v, '');
VariantClear(v);
v := ARootDSE.Get('dnsHostName');
DomainHostName := VariantToStringWithDefault(v, '');
VariantClear(v);
try
{ Осуществляем поиск в домене атрибутов и их значений }
hRes := ADsOpenObject(
PChar('LDAP://' + DomainHostName + '/' + DomainDN),
nil,
nil,
ADS_SECURE_AUTHENTICATION or ADS_SERVER_BIND,
IID_IDirectorySearch,
@SearchRes
);
if Succeeded(hRes) then
begin
SetLength(SearchPrefs, 3);
with SearchPrefs[0] do
begin
dwSearchPref := ADS_SEARCHPREF_PAGESIZE;
vValue.dwType := ADSTYPE_INTEGER;
vValue.__MIDL____MIDL_itf_ads_0000_00000000.Integer := ADC_SEARCH_PAGESIZE;
end;
with SearchPrefs[1] do
begin
dwSearchPref := ADS_SEARCHPREF_PAGED_TIME_LIMIT;
vValue.dwType := ADSTYPE_INTEGER;
vValue.__MIDL____MIDL_itf_ads_0000_00000000.Integer := 60;
end;
with SearchPrefs[2] do
begin
dwSearchPref := ADS_SEARCHPREF_SEARCH_SCOPE;
vValue.dwType := ADSTYPE_INTEGER;
vValue.__MIDL____MIDL_itf_ads_0000_00000000.Integer := ADS_SCOPE_SUBTREE;
end;
hRes := SearchRes.SetSearchPreference(SearchPrefs[0], Length(SearchPrefs));
objFilter := Format(
'(&(objectCategory=computer)(cn=%s))',
[AName]
);
SearchRes.ExecuteSearch(
PWideChar(objFilter),
PWideChar(@Attributes[0]),
Length(Attributes),
Pointer(SearchHandle)
);
{ Обработка объекта }
hRes := SearchRes.GetNextRow(SearchHandle);
while (hRes <> S_ADS_NOMORE_ROWS) do
begin
hRes := SearchRes.GetColumn(SearchHandle, PWideChar(Attributes[0]), col);
if Succeeded(hRes)
then Result := col.pADsValues^.__MIDL____MIDL_itf_ads_0000_00000000.CaseIgnoreString;
SearchRes.FreeColumn(col);
hRes := SearchRes.GetNextRow(Pointer(SearchHandle));
end;
end;
except
end;
SearchRes.CloseSearchHandle(Pointer(SearchHandle));
end;
procedure TComputerEditHelper.GetInfo(ALDAP: PLDAP; ADN: string);
var
i: Integer;
attr: PAnsiChar;
attrArray: array of PAnsiChar;
returnCode: ULONG;
searchResult: PLDAPMessage;
ldapEntry: PLDAPMessage;
ldapValues: PPAnsiChar;
ldapBerValues: PPLDAPBerVal;
d: TDateTime;
begin
Self.Clear;
if (ALDAP = nil) or ADN.IsEmpty
then Exit;
SetLength(attrArray, 7);
attrArray[0] := PAnsiChar('employeeID');
attrArray[1] := PAnsiChar('operatingSystem');
attrArray[2] := PAnsiChar('operatingSystemHotfix');
attrArray[3] := PAnsiChar('operatingSystemServicePack');
attrArray[4] := PAnsiChar('operatingSystemVersion');
attrArray[5] := PAnsiChar('dNSHostName');
returnCode := ldap_search_ext_s(
ALDAP,
PAnsiChar(AnsiString(ADN)),
LDAP_SCOPE_BASE,
nil,
PAnsiChar(@attrArray[0]),
0,
nil,
nil,
nil,
0,
searchResult
);
if (returnCode = LDAP_SUCCESS) and (ldap_count_entries(ALDAP, searchResult) > 0 ) then
begin
ldapEntry := ldap_first_entry(ALDAP, searchResult);
if ldapEntry <> nil then
for i := Low(attrArray) to High(attrArray) do
begin
case IndexText(attrArray[i], [
'employeeID',
'operatingSystem',
'operatingSystemHotfix',
'operatingSystemServicePack',
'operatingSystemVersion',
'dNSHostName']
) of
0: begin
ldapValues := ldap_get_values(ALDAP, ldapEntry, attrArray[i]);
if ldap_count_values(ldapValues) > 0
then Self.employeeID := string(AnsiString(ldapValues^));
ldap_value_free(ldapValues);
end;
1: begin
ldapValues := ldap_get_values(ALDAP, ldapEntry, attrArray[i]);
if ldap_count_values(ldapValues) > 0
then Self.operatingSystem := string(AnsiString(ldapValues^));
ldap_value_free(ldapValues);
end;
2: begin
ldapValues := ldap_get_values(ALDAP, ldapEntry, attrArray[i]);
if ldap_count_values(ldapValues) > 0
then Self.operatingSystemHotfix := string(AnsiString(ldapValues^));
ldap_value_free(ldapValues);
end;
3: begin
ldapValues := ldap_get_values(ALDAP, ldapEntry, attrArray[i]);
if ldap_count_values(ldapValues) > 0
then Self.operatingSystemServicePack := string(AnsiString(ldapValues^));
ldap_value_free(ldapValues);
end;
4: begin
ldapValues := ldap_get_values(ALDAP, ldapEntry, attrArray[i]);
if ldap_count_values(ldapValues) > 0
then Self.operatingSystemVersion := string(AnsiString(ldapValues^));
ldap_value_free(ldapValues);
end;
5: begin
ldapValues := ldap_get_values(ALDAP, ldapEntry, attrArray[i]);
if ldap_count_values(ldapValues) > 0
then Self.dNSHostName := LowerCase(string(AnsiString(ldapValues^)));
ldap_value_free(ldapValues);
end;
end;
end;
ldap_msgfree(searchResult);
searchResult := nil;
end;
if searchResult <> nil
then ldap_msgfree(searchResult);
end;
procedure TComputerEditHelper.GetInfoByName(ARootDSE: IADS; AName: string);
var
dn: string;
begin
dn := GetDistinguishedNameByName(ARootDSE, AName);
GetInfo(ARootDSE, dn);
end;
procedure TComputerEditHelper.GetInfoByName(ALDAP: PLDAP; AName: string);
var
dn: string;
begin
dn := GetDistinguishedNameByName(ALDAP, AName);
GetInfo(ALDAP, dn);
end;
procedure TComputerEditHelper.GetInfoByNameDS(ARootDSE: IADS; AName: string);
var
dn: string;
begin
dn := GetDistinguishedNameByName(ARootDSE, AName);
GetInfoDS(ARootDSE, dn);
end;
procedure TComputerEditHelper.GetInfoDS(ARootDSE: IADS; ADN: string);
var
v: OleVariant;
hostName: string;
dn: string;
IDir: IDirectoryObject;
hr: HRESULT;
attrArray: array of PWideChar;
attrEntries: PADS_ATTR_INFO;
attrCount: LongWord;
i: Integer;
j: Integer;
begin
Self.Clear;
if ADN.IsEmpty
then Exit;
IDir := nil;
attrEntries := nil;
CoInitialize(nil);
try
v := ARootDSE.Get('dnsHostName');
hostName := VariantToStringWithDefault(v, '');
VariantClear(v);
dn := ReplaceStr(ADN, '/', '\/');
hr := ADsOpenObject(
PChar(Format('LDAP://%s/%s', [hostName, dn])),
nil,
nil,
ADS_SECURE_AUTHENTICATION or ADS_SERVER_BIND,
IID_IDirectoryObject,
@IDir
);
if not Succeeded(hr)
then raise Exception.Create(ADSIErrorToString);
SetLength(attrArray, 6);
attrArray[0] := PChar('employeeID');
attrArray[1] := PChar('operatingSystem');
attrArray[2] := PChar('operatingSystemHotfix');
attrArray[3] := PChar('operatingSystemServicePack');
attrArray[4] := PChar('operatingSystemVersion');
attrArray[5] := PChar('dNSHostName');
hr := IDir.GetObjectAttributes(
@attrArray[0],
Length(attrArray),
@attrEntries,
@attrCount
);
if not Succeeded(hr)
then raise Exception.Create(ADSIErrorToString);
i := 0;
while i < attrCount do
begin
case IndexText(attrEntries^.pszAttrName, [
'employeeID',
'operatingSystem',
'operatingSystemHotfix',
'operatingSystemServicePack',
'operatingSystemVersion',
'dNSHostName']
) of
0: Self.employeeID := attrEntries^.pADsValues.__MIDL____MIDL_itf_ads_0000_00000000.CaseIgnoreString;
1: Self.operatingSystem := attrEntries^.pADsValues.__MIDL____MIDL_itf_ads_0000_00000000.CaseIgnoreString;
2: Self.operatingSystemHotfix := attrEntries^.pADsValues.__MIDL____MIDL_itf_ads_0000_00000000.CaseIgnoreString;
3: Self.operatingSystemServicePack := attrEntries^.pADsValues.__MIDL____MIDL_itf_ads_0000_00000000.CaseIgnoreString;
4: Self.operatingSystemVersion := attrEntries^.pADsValues.__MIDL____MIDL_itf_ads_0000_00000000.CaseIgnoreString;
5: Self.dNSHostName := attrEntries^.pADsValues.__MIDL____MIDL_itf_ads_0000_00000000.CaseIgnoreString;
end;
Inc(i);
Inc(attrEntries);
end;
Dec(attrEntries, i);
FreeADsMem(attrEntries);
finally
CoUninitialize;
end;
end;
procedure TComputerEditHelper.SetInfo(ARootDSE: IADS; ADN: string);
var
v: OleVariant;
hostName: string;
dn: string;
hr: HRESULT;
IComputer: IADsComputer;
begin
IComputer := nil;
CoInitialize(nil);
try
v := ARootDSE.Get('dnsHostName');
hostName := VariantToStringWithDefault(v, '');
VariantClear(v);
dn := ReplaceStr(ADN, '/', '\/');
hr := ADsOpenObject(
PChar(Format('LDAP://%s/%s', [hostName, dn])),
nil,
nil,
ADS_SECURE_AUTHENTICATION or ADS_SERVER_BIND,
IID_IADsComputer,
@IComputer
);
if Succeeded(hr) then
begin
if Self.employeeID <> ''
then IComputer.Put('employeeID', Self.employeeID)
else IComputer.PutEx(ADS_PROPERTY_CLEAR, 'employeeID', Null);
IComputer.SetInfo;
end else raise Exception.Create(ADSIErrorToString);
finally
CoUninitialize;
end;
end;
procedure TComputerEditHelper.SetInfo(ALDAP: PLDAP; ADN: string);
var
ldapBase: AnsiString;
modArray: array of PLDAPMod;
valEmployeeID: array of PAnsiChar;
returnCode: ULONG;
i: Integer;
begin
ldapBase := ADN;
SetLength(modArray, 1);
{ employeeID }
SetLength(modArray, Length(modArray) + 1);
i := High(modArray) - 1;
SetLength(valEmployeeID, 2);
valEmployeeID[0] := PAnsiChar(AnsiString(Self.employeeID));
if Self.employeeID <> ''
then GenerateLDAPStrMod(PAnsiChar('employeeID'), @valEmployeeID[0], modArray[i])
else GenerateLDAPStrMod(PAnsiChar('employeeID'), nil, modArray[i]);
try
returnCode := ldap_modify_ext_s(
ALDAP,
PAnsiChar(ldapBase),
@modArray[0],
nil,
nil
);
if returnCode <> LDAP_SUCCESS
then raise Exception.Create(ldap_err2stringW(returnCode));
finally
for i := Low(modArray) to High(modArray) do
if Assigned(modArray[i])
then Dispose(modArray[i]);
end;
end;
procedure TComputerEditHelper.SetInfoDS(ARootDSE: IADS; ADN: string);
var
v: OleVariant;
hostName: string;
dn: string;
IDir: IDirectoryObject;
hr: HRESULT;
modArray: array of ADS_ATTR_INFO;
i: Integer;
valLength: Integer;
valEmployeeID: array of ADSVALUE;
modCount: LongWord;
begin
IDir := nil;
CoInitialize(nil);
try
v := ARootDSE.Get('dnsHostName');
hostName := VariantToStringWithDefault(v, '');
VariantClear(v);
dn := ReplaceStr(ADN, '/', '\/');
hr := ADsOpenObject(
PChar(Format('LDAP://%s/%s', [hostName, dn])),
nil,
nil,
ADS_SECURE_AUTHENTICATION or ADS_SERVER_BIND,
IID_IDirectoryObject,
@IDir
);
if Succeeded(hr) then
begin
{ employeeID }
if not Self.employeeID.IsEmpty then
begin
SetLength(modArray, Length(modArray) + 1);
i := High(modArray);
SetLength(valEmployeeID, 1);
valEmployeeID[0].dwType := ADSTYPE_CASE_IGNORE_STRING;
valEmployeeID[0].__MIDL____MIDL_itf_ads_0000_00000000.CaseIgnoreString := PChar(Self.employeeID);
GenerateDSMod(
PChar('employeeID'),
@valEmployeeID[0],
Length(valEmployeeID),
@modArray[i]
);
end;
hr := IDir.SetObjectAttributes(
@modArray[0],
Length(modArray),
modCount
);
if not Succeeded(hr)
then raise Exception.Create(ADSIErrorToString);
end else raise Exception.Create(ADSIErrorToString);
finally
CoUninitialize;
end;
end;
{ TADComputer }
procedure TComputerEdit.Clear;
begin
// dNSHostName := '';
// employeeID := '';
// IPv4 := '';
// DHCP_Server := '';
// MAC_Address := '';
// operatingSystem := '';
// operatingSystemHotfix := '';
// operatingSystemServicePack := '';
// operatingSystemVersion := '';
FillChar(Self, SizeOf(TComputerEdit), #0);
end;
{ TMACAddrHelper }
function TMACAddrHelper.Format(AFormat: TMACAddrFormat;
ASeparator: TMACAddrSeparator; AUpperCase: Boolean): string;
var
s: string;
regEx: TRegEx;
begin
s := StringReplace(Self, '-', '', [rfReplaceAll]);
regEx := TRegEx.Create('(.{' + IntToStr(GetGroupLength(AFormat)) + '})(?!$)');
if AUpperCase
then Result := UpperCase(regEx.Replace(s, '$1' + GetSeparator(ASeparator)))
else Result := LowerCase(regEx.Replace(s, '$1' + GetSeparator(ASeparator)));
end;
function TMACAddrHelper.GetGroupLength(AValue: TMACAddrFormat): Integer;
begin
case Avalue of
gfSixOfTwo: Result := 2;
gfThreeOfFour: Result := 4;
else Result := 2;
end;
end;
function TMACAddrHelper.GetSeparator(AValue: TMACAddrSeparator): string;
begin
case Avalue of
gsDot : Result := '.';
gsColon : Result := ':';
gsHyphen: Result := '-';
else Result := '-'
end;
end;
end.
|
{
$Project$
$Workfile$
$Revision$
$DateUTC$
$Id$
This file is part of the Indy (Internet Direct) project, and is offered
under the dual-licensing agreement described on the Indy website.
(http://www.indyproject.org/)
Copyright:
(c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
}
{
$Log$
}
{
{ Rev 1.4 5/12/2003 12:30:58 AM GGrieve
{ Get compiling again with DotNet Changes
}
{
{ Rev 1.3 10/12/2003 1:49:26 PM BGooijen
{ Changed comment of last checkin
}
{
{ Rev 1.2 10/12/2003 1:43:24 PM BGooijen
{ Changed IdCompilerDefines.inc to Core\IdCompilerDefines.inc
}
{
{ Rev 1.0 11/14/2002 02:13:56 PM JPMugaas
}
unit IdBlockCipherIntercept;
{-----------------------------------------------------------------------------
UnitName: IdBlockCipherIntercept
Author: Andrew P.Rybin [magicode@mail.ru]
Creation: 27.02.2002
Version: 0.9.0b
Purpose: Secure communications
History:
-----------------------------------------------------------------------------}
interface
uses
Classes,
IdGlobal,
IdException,
IdResourceStringsProtocols,
IdIntercept;
const
IdBlockCipherBlockSizeDefault = 16;
IdBlockCipherBlockSizeMax = 256;
// why 256? not any block ciphers that can - or should - be used beyond this
// length. You can extend this if you like. But the longer it is, the
// more network traffic is wasted
//256, as currently the last byte of the block is used to store the block size
type
TIdBlockCipherIntercept = class;
// OnSend and OnRecieve Events will always be called with a blockSize Data
TIdBlockCipherIntercept = class(TIdConnectionIntercept)
protected
FBlockSize: Integer;
FIncoming : TIdBytes;
procedure Decrypt (var VData : TIdBytes); virtual;
procedure Encrypt (var VData : TIdBytes); virtual;
procedure SetBlockSize(const Value: Integer);
procedure InitComponent; override;
public
procedure Receive(var VBuffer: TIdBytes); override; //Decrypt
procedure Send(var VBuffer: TIdBytes); override; //Encrypt
procedure CopySettingsFrom (ASrcBlockCipherIntercept: TIdBlockCipherIntercept); // warning: copies Data too
published
property BlockSize: Integer read FBlockSize write SetBlockSize default IdBlockCipherBlockSizeDefault;
end;
EIdBlockCipherInterceptException = EIdException; {block length}
implementation
uses
IdResourceStrings,
IdSys;
const
bitLongTail = $80; //future: for IdBlockCipherBlockSizeMax>256
procedure TIdBlockCipherIntercept.Encrypt(var VData : TIdBytes);
Begin
if Assigned(FOnSend) then begin
FOnSend(Self, VData);
end;//ex: EncryptAES(LTempIn, ExpandedKey, LTempOut);
end;
procedure TIdBlockCipherIntercept.Decrypt(var VData : TIdBytes);
Begin
if Assigned(FOnReceive) then begin
FOnReceive(self, VData);
end;//ex: DecryptAES(LTempIn, ExpandedKey, LTempOut);
end;
procedure TIdBlockCipherIntercept.Send(var VBuffer: TIdBytes);
var
LSrc : TIdBytes;
LTemp : TIdBytes;
LCount : Integer;
Begin
if Length(VBuffer) = 0 then
exit;
LSrc := VBuffer;
SetLength(VBuffer, ((Length(LSrc) + FBlockSize - 2) div (FBlockSize - 1)) * FBLockSize);
SetLength(LTemp, FBlockSize);
//process all complete blocks
for LCount := 0 to Length(LSrc) div (FBlockSize - 1)-1 do
begin
CopyTIdBytes(LSrc, lCount * (FBlockSize - 1), LTemp, 0, FBlockSize - 1);
LTemp[FBlockSize - 1] := FBlockSize - 1;
Encrypt(LTemp);
CopyTIdBytes(LTemp, 0, VBuffer, LCount * FBlockSize, FBLockSize);
end;
//process the possible remaining bytes, ie less than a full block
if Length(LSrc) Mod (FBlockSize - 1) > 0 then
begin
CopyTIdBytes(LSrc, length(LSrc) - (Length(LSrc) Mod (FBlockSize - 1)), LTemp, 0, Length(LSrc) Mod (FBlockSize - 1));
LTemp[FBlockSize - 1] := Length(LSrc) Mod (FBlockSize - 1);
Encrypt(LTemp);
CopyTIdBytes(LTemp, 0, VBuffer, Length(VBuffer) - FBlockSize, FBLockSize);
end;
end;
procedure TIdBlockCipherIntercept.Receive(var VBuffer: TIdBytes);
var
LCount : integer;
LTemp : TIdBytes;
LPos : Integer;
Begin
LCount := Length(FIncoming);
SetLength(FIncoming, Length(FIncoming) + Length(VBuffer));
CopyTIdBytes(VBuffer, 0, FIncoming, LCount, length(VBuffer));
SetLength(LTemp, FBlockSize);
if Length(FIncoming) < FBlockSize then
begin
SetLength(VBuffer, 0)
end
else
begin
// the length of ABuffer when we have finished is currently unknown, but must be less than
// the length of FIncoming. We will reserve this much, then reallocate at the end
SetLength(VBuffer, Length(FIncoming));
LPos := 0;
for LCount := 0 to (Length(FIncoming) div FBLockSize)-1 do
begin
CopyTIdBytes(FIncoming, LCount * FBlockSize, LTemp, 0, FBlockSize);
Decrypt(LTemp);
if (LTemp[FBlocksize-1] = 0) or (LTemp[FBlocksize-1] >= FBlockSize) then
raise EIdBlockCipherInterceptException.Create(RSBlockIncorrectLength+' ('+Sys.IntToStr(LTemp[FBlocksize-1])+')');
CopyTIdBytes(LTemp, 0, VBuffer, LPos, LTemp[FBlocksize-1]);
inc(LPos, LTemp[FBlocksize-1]);
end;
if Length(FIncoming) mod FBlockSize > 0 then
begin
CopyTIdBytes(FIncoming, Length(FIncoming) - (Length(FIncoming) mod FBlockSize), FIncoming, 0, Length(FIncoming) mod FBlockSize);
SetLength(FIncoming, Length(FIncoming) mod FBlockSize);
end
else
begin
SetLength(FIncoming, 0);
end;
SetLength(VBuffer, LPos);
end;
end;
procedure TIdBlockCipherIntercept.CopySettingsFrom(ASrcBlockCipherIntercept: TIdBlockCipherIntercept);
Begin
Self.FBlockSize := ASrcBlockCipherIntercept.FBlockSize;
Self.FData:= ASrcBlockCipherIntercept.FData; // not sure that this is actually safe
Self.FOnConnect := ASrcBlockCipherIntercept.FOnConnect;
Self.FOnDisconnect:= ASrcBlockCipherIntercept.FOnDisconnect;
Self.FOnReceive := ASrcBlockCipherIntercept.FOnReceive;
Self.FOnSend := ASrcBlockCipherIntercept.FOnSend;
end;
procedure TIdBlockCipherIntercept.SetBlockSize(const Value: Integer);
Begin
if (Value>0) and (Value<=IdBlockCipherBlockSizeMax) then begin
FBlockSize := Value;
end;
end;
procedure TIdBlockCipherIntercept.InitComponent;
begin
inherited InitComponent;
FBlockSize := IdBlockCipherBlockSizeDefault;
SetLength(FIncoming, 0);
end;
end.
|
{
A generic library for playing sound with modular backends
In the future it might be extended to be able to modify and save sound files in
multiple formats too.
Copyright: Felipe Monteiro de Carvalho 2010-2011
}
unit fpsound;
{$mode objfpc}
interface
uses
Classes, SysUtils;
type
TSoundDocument = class;
TSoundFormat = (sfWav, sfMP3, sfOGG, sfMID, sfAMR, sf3GP, sfMP4);
{ TSoundReader }
TSoundReader = class
public
constructor Create; virtual;
procedure ReadFromStream(AStream: TStream; ADest: TSoundDocument); virtual; abstract;
end;
TSoundPlayerKind = (spNone, spOpenAL, spMPlayer, spFMod, spExtra1, spExtra2);
{ TSoundPlayer }
TSoundPlayer = class
protected
FInitialized: Boolean;
public
constructor Create; virtual;
procedure Initialize; virtual; abstract;
procedure Finalize; virtual; abstract;
procedure Play(ASound: TSoundDocument); virtual; abstract;
procedure Pause(ASound: TSoundDocument); virtual; abstract;
procedure Stop(ASound: TSoundDocument); virtual; abstract;
end;
// Sound data representation
TSoundElement = class
end;
// A Key element sets the basic information of the music for the following samples,
// such as sample rate. It has no sample data in itself
TSoundKeyElement = class(TSoundElement)
public
SampleRate: Cardinal; // example values: 8000, 44100, etc.
BitsPerSample: Byte; // Tipical values: 8 and 16
Channels: Byte; // Number of channels
end;
TSoundSample8 = class(TSoundElement)
public
ChannelValues: array of Byte;
end;
TSoundSample16 = class(TSoundElement)
public
ChannelValues: array of SmallInt;
end;
{ TSoundThread }
TSoundThread = class(TThread)
protected
procedure Execute; override;
end;
{ TSoundDocument }
TSoundDocument = class
private
FPlayer: TSoundPlayer;
FPlayerKind: TSoundPlayerKind;
FCurElementIndex: Integer;
FSoundData: TFPList; // of TSoundElement
public
SoundDocStream: TMemoryStream;
constructor Create; virtual;
destructor Destroy; override;
// Document read/save methods
procedure LoadFromFile(AFileName: string);
procedure LoadFromFile(AFileName: string; AFormat: TSoundFormat);
class function GuessFormatFromSoundFile(AFileName: string): TSoundFormat;
// Document edition methods
procedure Clear;
procedure AddSoundElement(const AElement: TSoundElement);
function GetSoundElement(const AIndex: Integer): TSoundElement;
function GetSoundElementCount: Integer;
function GetFirstSoundElement: TSoundKeyElement;
function GetNextSoundElement: TSoundElement;
// Document playing methods
procedure Play;
procedure Pause;
procedure Stop;
procedure Seek(ANewPos: Double);
procedure SetSoundPlayer(AKind: TSoundPlayerKind);
end;
var
SoundPlayer: TSoundDocument;
procedure RegisterSoundPlayer(APlayer: TSoundPlayer; AKind: TSoundPlayerKind);
procedure RegisterSoundReader(AReader: TSoundReader; AFormat: TSoundFormat);
function GetSoundPlayer(AKind: TSoundPlayerKind): TSoundPlayer;
function GetSoundReader(AFormat: TSoundFormat): TSoundReader;
implementation
var
GSoundPlayers: array[TSoundPlayerKind] of TSoundPlayer = (nil, nil, nil, nil, nil, nil);
GSoundReaders: array[TSoundFormat] of TSoundReader = (nil, nil, nil, nil, nil, nil, nil);
// GSoundWriter: array[TSoundFormat] of TSoundWriter = (nil, nil, nil, nil, nil, nil, nil);
procedure RegisterSoundPlayer(APlayer: TSoundPlayer; AKind: TSoundPlayerKind);
begin
GSoundPlayers[AKind] := APlayer;
end;
procedure RegisterSoundReader(AReader: TSoundReader; AFormat: TSoundFormat);
begin
GSoundReaders[AFormat] := AReader;
end;
function GetSoundPlayer(AKind: TSoundPlayerKind): TSoundPlayer;
begin
Result := GSoundPlayers[AKind];
end;
function GetSoundReader(AFormat: TSoundFormat): TSoundReader;
begin
Result := GSoundReaders[AFormat];
end;
{ TSoundThread }
procedure TSoundThread.Execute;
begin
end;
{ TSoundPlayer }
constructor TSoundPlayer.Create;
begin
inherited Create;
end;
{ TSoundReader }
constructor TSoundReader.Create;
begin
inherited Create;
end;
{ TSoundDocument }
constructor TSoundDocument.Create;
begin
inherited Create;
FSoundData := TFPList.Create;
SoundDocStream := TMemoryStream.Create;
end;
destructor TSoundDocument.Destroy;
begin
FSoundData.Free;
SoundDocStream.Free;
if FPlayer <> nil then FPlayer.Finalize;
inherited Destroy;
end;
procedure TSoundDocument.LoadFromFile(AFileName: string);
var
lFormat: TSoundFormat;
begin
lFormat := GuessFormatFromSoundFile(AFileName);
LoadFromFile(AFileName, lFormat);
end;
procedure TSoundDocument.LoadFromFile(AFileName: string; AFormat: TSoundFormat);
var
lReader: TSoundReader;
lStream: TFileStream;
begin
lReader := GetSoundReader(AFormat);
lStream := TFileStream.Create(AFileName, fmOpenRead);
try
Clear();
lReader.ReadFromStream(lStream, Self);
lStream.Position := 0;
SoundDocStream.Clear;
SoundDocStream.LoadFromStream(lStream);
finally
lStream.Free;
end;
end;
class function TSoundDocument.GuessFormatFromSoundFile(AFileName: string): TSoundFormat;
var
lExt: String;
begin
Result := sfWav;
lExt := ExtractFileExt(AFileName);
if CompareText(lExt, 'wav') = 0 then Result := sfWav;
//raise Exception.Create(Format('[TSoundDocument.LoadFromFile] Unknown extension: %s', [lExt]));
end;
procedure TSoundDocument.Clear;
var
i: Integer;
begin
for i := 0 to FSoundData.Count - 1 do
TSoundElement(FSoundData.Items[i]).Free;
FSoundData.Clear;
end;
procedure TSoundDocument.AddSoundElement(const AElement: TSoundElement);
begin
FSoundData.Add(AElement);
end;
function TSoundDocument.GetSoundElement(const AIndex: Integer): TSoundElement;
begin
Result := TSoundElement(FSoundData.Items[AIndex]);
end;
function TSoundDocument.GetSoundElementCount: Integer;
begin
Result := FSoundData.Count;
end;
function TSoundDocument.GetFirstSoundElement: TSoundKeyElement;
begin
if GetSoundElementCount() = 0 then
Result := nil
else
Result := GetSoundElement(0) as TSoundKeyElement;
FCurElementIndex := 1;
end;
function TSoundDocument.GetNextSoundElement: TSoundElement;
begin
if GetSoundElementCount() >= FCurElementIndex then Exit(nil);
Result := GetSoundElement(FCurElementIndex);
Inc(FCurElementIndex);
end;
procedure TSoundDocument.Play;
begin
if FPlayer = nil then Exit;
FPlayer.Play(Self);
end;
procedure TSoundDocument.Pause;
begin
if FPlayer = nil then Exit;
FPlayer.Pause(Self);
end;
procedure TSoundDocument.Stop;
begin
if FPlayer = nil then Exit;
FPlayer.Stop(Self);
FPlayer.Finalize;
end;
procedure TSoundDocument.Seek(ANewPos: Double);
begin
if FPlayer = nil then Exit;
end;
procedure TSoundDocument.SetSoundPlayer(AKind: TSoundPlayerKind);
begin
if AKind = FPlayerKind then Exit;
FPlayerKind := AKind;
Stop;
FPlayer := GSoundPlayers[AKind];
end;
var
lReaderIndex: TSoundFormat;
lPlayerIndex: TSoundPlayerKind;
initialization
SoundPlayer := TSoundDocument.Create;
finalization
SoundPlayer.Free;
for lReaderIndex := Low(TSoundFormat) to High(TSoundFormat) do
if GSoundReaders[lReaderIndex] <> nil then GSoundReaders[lReaderIndex].Free;
for lPlayerIndex := Low(TSoundPlayerKind) to High(TSoundPlayerKind) do
if GSoundPlayers[lPlayerIndex] <> nil then GSoundPlayers[lPlayerIndex].Free;
end.
|
unit group1;
interface
uses crt,IOunit;
const
MAXGRPLEN = 14;
MAXGRP = 40;
type
grouprectype = record
index:integer;
name:string[MAXGRPLEN]
end;
grouptype = record
size:integer;
data:array[1..MAXGRP] of grouprectype
end;
itype = 0..39;
memberinfotype = record
marked:boolean;
membership:set of itype
end;
memberptrtype = ^memberinfotype;
Procedure initgroups(var groupdata:grouptype);
Procedure addgroup(var groupdata:grouptype;x:string);
Procedure editgroup(var groupdata:grouptype;num:integer;x:string);
Function numgroups(var groupdata:grouptype):integer;
Function groupname(var groupdata:grouptype;num:integer):string;
Function groupindex(var groupdata:grouptype;num:integer):integer;
Procedure removegroup(var groupdata:grouptype;num:integer);
Procedure loadgroup(var groupdata:grouptype;var f:file);
Procedure savegroup(var groupdata:grouptype;var f:file);
Procedure showmembership(p:memberptrtype;var groupdata:grouptype);
Procedure showgroups(var groupdata:grouptype);
Procedure addrecgroup(p:memberptrtype;var groupdata:grouptype;num:integer);
Procedure removerecgroup(p:memberptrtype;var groupdata:grouptype;num:integer);
Procedure markgroup(p:memberptrtype;var groupdata:grouptype;num:integer;ctrl:integer);
implementation
type
videotype = array[0..65519] of byte;
videoptrtype = ^videotype;
Procedure initgroups(var groupdata:grouptype);
var cnt:integer;
begin
for cnt := 1 to MAXGRP do
groupdata.data[cnt].index := cnt - 1;
groupdata.size := 0
end;
Procedure addgroup(var groupdata:grouptype;x:string);
var cnt,c:integer;
temp:grouprectype;
begin
x := copy(x,1,MAXGRPLEN);
groupdata.size := groupdata.size + 1;
groupdata.data[groupdata.size].name := x;
cnt := groupdata.size - 1;
while (cnt > 0) and (groupdata.data[groupdata.size].name < groupdata.data[cnt].name) do
cnt := cnt - 1;
temp := groupdata.data[groupdata.size];
for c := groupdata.size downto cnt + 2 do
groupdata.data[c] := groupdata.data[c - 1];
groupdata.data[cnt + 1] := temp
end;
Procedure editgroup(var groupdata:grouptype;num:integer;x:string);
var c,cnt:integer;
temp:grouprectype;
begin
cnt := groupdata.size;
while (cnt > 0) and (x < groupdata.data[cnt].name) do
cnt := cnt - 1;
groupdata.data[num].name := copy(x,1,MAXGRPLEN);
temp := groupdata.data[num];
if cnt < num then
begin
for c := num downto cnt + 2 do
groupdata.data[c] := groupdata.data[c - 1];
groupdata.data[cnt + 1] := temp
end
else if cnt > num then
begin
for c := num to cnt - 1 do
groupdata.data[c] := groupdata.data[c + 1];
groupdata.data[cnt] := temp
end
end;
Function numgroups(var groupdata:grouptype):integer;
begin
numgroups := groupdata.size
end;
Function groupname(var groupdata:grouptype;num:integer):string;
begin
groupname := groupdata.data[num].name
end;
Function groupindex(var groupdata:grouptype;num:integer):integer;
begin
groupindex := groupdata.data[num].index
end;
Procedure removegroup(var groupdata:grouptype;num:integer);
var cnt:integer;
temp:grouprectype;
begin
temp := groupdata.data[num];
for cnt := num to groupdata.size - 1 do
groupdata.data[cnt] := groupdata.data[cnt + 1];
groupdata.data[groupdata.size] := temp;
groupdata.size := groupdata.size - 1
end;
Procedure loadgroup(var groupdata:grouptype;var f:file);
var numread:word;
begin
blockread(f,groupdata,sizeof(groupdata),numread)
end;
Procedure savegroup(var groupdata:grouptype;var f:file);
var numwritten:word;
begin
blockwrite(f,groupdata,sizeof(groupdata),numwritten)
end;
Procedure showmembership(p:memberptrtype;var groupdata:grouptype);
var c1,cnt:integer;
q:videoptrtype;
begin
q := ptr($b800,$0);
for cnt := 1 to numgroups(groupdata) do
begin
if groupindex(groupdata,cnt) in p^.membership then
for c1 := 0 to 18 do
q^[1761 + 160*((cnt-1) div 4) + 38*((cnt-1) mod 4) + 2*c1] := 14
else
for c1 := 0 to 18 do
q^[1761 + 160*((cnt-1) div 4) + 38*((cnt-1) mod 4) + 2*c1] := 8
end
end;
Procedure showgroups(var groupdata:grouptype);
var cnt:integer;
begin
gotoxy(1,12);
for cnt := 0 to 9 do write('':80);
for cnt := 1 to numgroups(groupdata) do
begin
gotoxy(1 + 19*((cnt-1) mod 4), 12 + (cnt-1) div 4);
write(cnt:2,'. '+groupname(groupdata,cnt))
end
end;
Procedure addrecgroup(p:memberptrtype;var groupdata:grouptype;num:integer);
var cnt:integer;
begin
if num = 0 then
begin
for cnt := 1 to numgroups(groupdata) do
p^.membership := p^.membership + [groupindex(groupdata,cnt)]
end
else
p^.membership := p^.membership + [groupindex(groupdata,num)]
end;
Procedure removerecgroup(p:memberptrtype;var groupdata:grouptype;num:integer);
begin
if num = 0 then
p^.membership := []
else
p^.membership := p^.membership - [groupindex(groupdata,num)]
end;
Procedure markgroup(p:memberptrtype;var groupdata:grouptype;num:integer;ctrl:integer);
var ingrp:boolean;
begin
ingrp := groupindex(groupdata,num) in p^.membership;
case ctrl of
1:p^.marked := ingrp;
2:p^.marked := p^.marked and ingrp;
3:p^.marked := p^.marked or ingrp;
4:p^.marked := p^.marked xor ingrp;
5:p^.marked := p^.marked and (not ingrp);
6:p^.marked := p^.marked or (not ingrp);
7:p^.marked := p^.marked xor (not ingrp)
end
end;
end. |
unit FMXComponentsDemoMain;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants, FMX.Types, FMX.Controls, FMX.Forms,
FMX.Objects, FMX.Layouts,
FMX.StdCtrls, FMX.Controls.Presentation, FMX.ScrollableList, FMX.RatingBar,
FMX.Ani, FMX.CircleScoreIndicator, FMX.TabControl, FMX.ImageSlider,
FMX.ScrollBox, FMX.Memo, FMX.SimpleBBCodeText, ONE.Objects, Data.Bind.EngExt,
Fmx.Bind.DBEngExt, System.Rtti, System.Bindings.Outputs, Fmx.Bind.Editors,
Data.Bind.Components, FMX.GesturePassword, FMX.CalendarControl,
qcndate, CnCalendar;
type
TFMXComponentsDemoForm = class(TForm)
Layout16: TLayout;
Layout3: TLayout;
Line1: TLine;
Line4: TLine;
FMXScrollableList2: TFMXScrollableList;
Label1: TLabel;
LayoutYears: TLayout;
Layout2: TLayout;
Line2: TLine;
Line3: TLine;
FMXScrollableList1: TFMXScrollableList;
Label2: TLabel;
FMXRatingBar1: TFMXRatingBar;
lblHeader: TLabel;
btnAnimation: TButton;
FloatAnimation1: TFloatAnimation;
FMXCircleScoreIndicator1: TFMXCircleScoreIndicator;
FloatAnimation2: TFloatAnimation;
Layout4: TLayout;
Layout5: TLayout;
Line5: TLine;
Line6: TLine;
FMXScrollableList3: TFMXScrollableList;
Label3: TLabel;
TabControl1: TTabControl;
tabBasic: TTabItem;
tabSlider: TTabItem;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
FMXImageSlider1: TFMXImageSlider;
FloatAnimation3: TFloatAnimation;
tabBBCode: TTabItem;
Memo1: TMemo;
Layout1: TLayout;
FMXSimpleBBCodeText1: TFMXSimpleBBCodeText;
tabGesturePassword: TTabItem;
Layout6: TLayout;
FMXGesturePassword1: TFMXGesturePassword;
lbl1: TLabel;
lblPassword: TLabel;
tabCalendarControl: TTabItem;
FMXCalendarControl1: TFMXCalendarControl;
Layout7: TLayout;
chkShowLunarDate: TCheckBox;
rbCnMonths: TRadioButton;
rbEnMonths: TRadioButton;
Rectangle1: TRectangle;
Rectangle2: TRectangle;
txtCnDate1: TText;
txtCnDate2: TText;
procedure FMXScrollableList2Change(Sender: TObject);
procedure FMXScrollableList1Change(Sender: TObject);
procedure btnAnimationClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FMXScrollableList3Change(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FMXSimpleBBCodeText1Click(Sender: TObject);
procedure Memo1Change(Sender: TObject);
procedure FMXGesturePassword1EnterCompleteEvent(Sender: TObject;
const APassword: string);
procedure chkShowLunarDateChange(Sender: TObject);
procedure rbCnMonthsChange(Sender: TObject);
procedure FMXCalendarControl1SelectedItem(Sender: TObject);
private
{ Private declarations }
FSelection1: TOneSelection;
public
{ Public declarations }
end;
var
FMXComponentsDemoForm: TFMXComponentsDemoForm;
implementation
{$R *.fmx}
procedure TFMXComponentsDemoForm.btnAnimationClick(Sender: TObject);
begin
FloatAnimation1.Start;
FloatAnimation2.Start;
end;
procedure TFMXComponentsDemoForm.chkShowLunarDateChange(Sender: TObject);
begin
FMXCalendarControl1.IsShowLunarDate := chkShowLunarDate.IsChecked;
end;
procedure TFMXComponentsDemoForm.FMXCalendarControl1SelectedItem(
Sender: TObject);
var
D: TCnDate;
Year, Month, Day: Word;
begin
DecodeDate(FMXCalendarControl1.SelectedDate, Year, Month, Day);
D := ToCnDate(FMXCalendarControl1.SelectedDate);
txtCnDate1.Text := Format('农历%s%s', [CnMonthName(D), CnDayName(D)]);
txtCnDate2.Text :=
GetGanZhiFromNumber(GetGanZhiFromYear(Year)) +
GetShengXiaoFromNumber(D.Year) + '年 ' +
GetGanZhiFromNumber(GetGanZhiFromMonth(Year, Month, Day)) + '月 ' +
GetGanZhiFromNumber(GetGanZhiFromDay(Year, Month, Day)) + '日';
end;
procedure TFMXComponentsDemoForm.FMXGesturePassword1EnterCompleteEvent(
Sender: TObject; const APassword: string);
begin
lblPassword.Text := self.FMXGesturePassword1.Password;
end;
procedure TFMXComponentsDemoForm.FMXScrollableList1Change(Sender: TObject);
begin
Label1.Text := FMXScrollableList1.GetSelected;
end;
procedure TFMXComponentsDemoForm.FMXScrollableList2Change(Sender: TObject);
begin
Label2.Text := FMXScrollableList2.GetSelected;
end;
procedure TFMXComponentsDemoForm.FMXScrollableList3Change(Sender: TObject);
begin
Label3.Text := FMXScrollableList3.GetSelected;
end;
procedure TFMXComponentsDemoForm.FMXSimpleBBCodeText1Click(Sender: TObject);
var
c: TControl;
begin
if FSelection1.ChildrenCount > 0 then
begin
c := TControl(FSelection1.Children[0]);
c.HitTest := True;
c.Align := TAlignLayout.None;
c.Parent := Layout1;
c.BoundsRect := FSelection1.BoundsRect;
c.Position.Point := FSelection1.Position.Point;
end;
FSelection1.BoundsRect := TControl(Sender).BoundsRect;
FSelection1.Position.Point := TControl(Sender).Position.Point;
FSelection1.Visible := True;
FSelection1.BringToFront;
TControl(Sender).Parent := FSelection1;
TControl(Sender).Align := TAlignLayout.Client;
TControl(Sender).HitTest := False;
end;
procedure TFMXComponentsDemoForm.FormCreate(Sender: TObject);
begin
Label1.Text := FMXScrollableList1.GetSelected;
Label2.Text := FMXScrollableList2.GetSelected;
Label3.Text := FMXScrollableList3.GetSelected;
FMXImageSlider1.SetPage(0, Image1);
FMXImageSlider1.SetPage(1, Image2);
FMXImageSlider1.SetPage(2, Image3);
FMXImageSlider1.SetPage(3, Image4);
FSelection1 := TOneSelection.Create(Self);
FSelection1.GripSize := 8;
FSelection1.Proportional := False;
Layout1.AddObject(FSelection1);
FMXSimpleBBCodeText1Click(FMXSimpleBBCodeText1);
txtCnDate1.Text := '';
txtCnDate2.Text := '';
end;
procedure TFMXComponentsDemoForm.FormResize(Sender: TObject);
begin
FMXImageSlider1.Height := ClientWidth * 200 / 320;
end;
procedure TFMXComponentsDemoForm.Memo1Change(Sender: TObject);
begin
self.FMXSimpleBBCodeText1.Lines.Assign(Memo1.Lines);
end;
procedure TFMXComponentsDemoForm.rbCnMonthsChange(Sender: TObject);
begin
if (Sender as TControl).Tag = 0 then
Self.FMXCalendarControl1.SetMonthNames(TCnMonths)
else
Self.FMXCalendarControl1.SetMonthNames(TEnMonths);
end;
end.
|
unit InfoXPULLTable;
interface
uses
Classes, DB, DBISAMTb, SysUtils, DBISAMTableAU, DataBuf;
type
TInfoXPULLRecord = record
PItemNumber: String[1];
PSI: String[2];
PDescription: String[20];
PAbbreviation: String[12];
PModCount: SmallInt;
End;
TInfoXPULLClass2 = class
public
PItemNumber: String[1];
PSI: String[2];
PDescription: String[20];
PAbbreviation: String[12];
PModCount: SmallInt;
End;
// function CtoRInfoXPULL(AClass:TInfoXPULLClass):TInfoXPULLRecord;
// procedure RtoCInfoXPULL(ARecord:TInfoXPULLRecord;AClass:TInfoXPULLClass);
TInfoXPULLBuffer = class(TDataBuf)
protected
function PtrIndex(Index:integer):Pointer;override;
public
Data: TInfoXPULLRecord;
function FieldNameToIndex(s:string):integer;override;
function FieldType(index:integer):TFieldType;override;
end;
TEIInfoXPULL = (InfoXPULLPrimaryKey);
TInfoXPULLTable = class( TDBISAMTableAU )
private
FDFItemNumber: TStringField;
FDFSI: TStringField;
FDFDescription: TStringField;
FDFAbbreviation: TStringField;
FDFModCount: TSmallIntField;
procedure SetPItemNumber(const Value: String);
function GetPItemNumber:String;
procedure SetPSI(const Value: String);
function GetPSI:String;
procedure SetPDescription(const Value: String);
function GetPDescription:String;
procedure SetPAbbreviation(const Value: String);
function GetPAbbreviation:String;
procedure SetPModCount(const Value: SmallInt);
function GetPModCount:SmallInt;
procedure SetEnumIndex(Value: TEIInfoXPULL);
function GetEnumIndex: TEIInfoXPULL;
protected
procedure CreateFields; reintroduce;
procedure SetActive(Value: Boolean); override;
procedure LoadFieldDefs(AStringList:TStringList);override;
procedure LoadIndexDefs(AStringList:TStringList);override;
public
function GetDataBuffer:TInfoXPULLRecord;
procedure StoreDataBuffer(ABuffer:TInfoXPULLRecord);
property DFItemNumber: TStringField read FDFItemNumber;
property DFSI: TStringField read FDFSI;
property DFDescription: TStringField read FDFDescription;
property DFAbbreviation: TStringField read FDFAbbreviation;
property DFModCount: TSmallIntField read FDFModCount;
property PItemNumber: String read GetPItemNumber write SetPItemNumber;
property PSI: String read GetPSI write SetPSI;
property PDescription: String read GetPDescription write SetPDescription;
property PAbbreviation: String read GetPAbbreviation write SetPAbbreviation;
property PModCount: SmallInt read GetPModCount write SetPModCount;
published
property Active write SetActive;
property EnumIndex: TEIInfoXPULL read GetEnumIndex write SetEnumIndex;
end; { TInfoXPULLTable }
TInfoXPULLQuery = class( TDBISAMQueryAU )
private
FDFItemNumber: TStringField;
FDFSI: TStringField;
FDFDescription: TStringField;
FDFAbbreviation: TStringField;
FDFModCount: TSmallIntField;
procedure SetPItemNumber(const Value: String);
function GetPItemNumber:String;
procedure SetPSI(const Value: String);
function GetPSI:String;
procedure SetPDescription(const Value: String);
function GetPDescription:String;
procedure SetPAbbreviation(const Value: String);
function GetPAbbreviation:String;
procedure SetPModCount(const Value: SmallInt);
function GetPModCount:SmallInt;
protected
procedure CreateFields; reintroduce;
procedure SetActive(Value: Boolean); override;
public
function GetDataBuffer:TInfoXPULLRecord;
procedure StoreDataBuffer(ABuffer:TInfoXPULLRecord);
property DFItemNumber: TStringField read FDFItemNumber;
property DFSI: TStringField read FDFSI;
property DFDescription: TStringField read FDFDescription;
property DFAbbreviation: TStringField read FDFAbbreviation;
property DFModCount: TSmallIntField read FDFModCount;
property PItemNumber: String read GetPItemNumber write SetPItemNumber;
property PSI: String read GetPSI write SetPSI;
property PDescription: String read GetPDescription write SetPDescription;
property PAbbreviation: String read GetPAbbreviation write SetPAbbreviation;
property PModCount: SmallInt read GetPModCount write SetPModCount;
published
property Active write SetActive;
end; { TInfoXPULLTable }
procedure Register;
implementation
procedure TInfoXPULLTable.CreateFields;
begin
FDFItemNumber := CreateField( 'ItemNumber' ) as TStringField;
FDFSI := CreateField( 'SI' ) as TStringField;
FDFDescription := CreateField( 'Description' ) as TStringField;
FDFAbbreviation := CreateField( 'Abbreviation' ) as TStringField;
FDFModCount := CreateField( 'ModCount' ) as TSmallIntField;
end; { TInfoXPULLTable.CreateFields }
procedure TInfoXPULLTable.SetActive(Value: Boolean);
begin
inherited SetActive(Value);
if Active then
CreateFields;
end; { TInfoXPULLTable.SetActive }
procedure TInfoXPULLTable.SetPItemNumber(const Value: String);
begin
DFItemNumber.Value := Value;
end;
function TInfoXPULLTable.GetPItemNumber:String;
begin
result := DFItemNumber.Value;
end;
procedure TInfoXPULLTable.SetPSI(const Value: String);
begin
DFSI.Value := Value;
end;
function TInfoXPULLTable.GetPSI:String;
begin
result := DFSI.Value;
end;
procedure TInfoXPULLTable.SetPDescription(const Value: String);
begin
DFDescription.Value := Value;
end;
function TInfoXPULLTable.GetPDescription:String;
begin
result := DFDescription.Value;
end;
procedure TInfoXPULLTable.SetPAbbreviation(const Value: String);
begin
DFAbbreviation.Value := Value;
end;
function TInfoXPULLTable.GetPAbbreviation:String;
begin
result := DFAbbreviation.Value;
end;
procedure TInfoXPULLTable.SetPModCount(const Value: SmallInt);
begin
DFModCount.Value := Value;
end;
function TInfoXPULLTable.GetPModCount:SmallInt;
begin
result := DFModCount.Value;
end;
procedure TInfoXPULLTable.LoadFieldDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('ItemNumber, String, 1, N');
Add('SI, String, 2, N');
Add('Description, String, 20, N');
Add('Abbreviation, String, 12, N');
Add('ModCount, SmallInt, 0, N');
end;
end;
procedure TInfoXPULLTable.LoadIndexDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('PrimaryKey, ItemNumber;SI, Y, Y, N, N');
end;
end;
procedure TInfoXPULLTable.SetEnumIndex(Value: TEIInfoXPULL);
begin
case Value of
InfoXPULLPrimaryKey : IndexName := '';
end;
end;
function TInfoXPULLTable.GetDataBuffer:TInfoXPULLRecord;
var buf: TInfoXPULLRecord;
begin
fillchar(buf, sizeof(buf), 0);
buf.PItemNumber := DFItemNumber.Value;
buf.PSI := DFSI.Value;
buf.PDescription := DFDescription.Value;
buf.PAbbreviation := DFAbbreviation.Value;
buf.PModCount := DFModCount.Value;
result := buf;
end;
procedure TInfoXPULLTable.StoreDataBuffer(ABuffer:TInfoXPULLRecord);
begin
DFItemNumber.Value := ABuffer.PItemNumber;
DFSI.Value := ABuffer.PSI;
DFDescription.Value := ABuffer.PDescription;
DFAbbreviation.Value := ABuffer.PAbbreviation;
DFModCount.Value := ABuffer.PModCount;
end;
function TInfoXPULLTable.GetEnumIndex: TEIInfoXPULL;
var iname : string;
begin
result := InfoXPULLPrimaryKey;
iname := uppercase(indexname);
if iname = '' then result := InfoXPULLPrimaryKey;
end;
procedure TInfoXPULLQuery.CreateFields;
begin
FDFItemNumber := CreateField( 'ItemNumber' ) as TStringField;
FDFSI := CreateField( 'SI' ) as TStringField;
FDFDescription := CreateField( 'Description' ) as TStringField;
FDFAbbreviation := CreateField( 'Abbreviation' ) as TStringField;
FDFModCount := CreateField( 'ModCount' ) as TSmallIntField;
end; { TInfoXPULLQuery.CreateFields }
procedure TInfoXPULLQuery.SetActive(Value: Boolean);
begin
inherited SetActive(Value);
if Active then
CreateFields;
end; { TInfoXPULLQuery.SetActive }
procedure TInfoXPULLQuery.SetPItemNumber(const Value: String);
begin
DFItemNumber.Value := Value;
end;
function TInfoXPULLQuery.GetPItemNumber:String;
begin
result := DFItemNumber.Value;
end;
procedure TInfoXPULLQuery.SetPSI(const Value: String);
begin
DFSI.Value := Value;
end;
function TInfoXPULLQuery.GetPSI:String;
begin
result := DFSI.Value;
end;
procedure TInfoXPULLQuery.SetPDescription(const Value: String);
begin
DFDescription.Value := Value;
end;
function TInfoXPULLQuery.GetPDescription:String;
begin
result := DFDescription.Value;
end;
procedure TInfoXPULLQuery.SetPAbbreviation(const Value: String);
begin
DFAbbreviation.Value := Value;
end;
function TInfoXPULLQuery.GetPAbbreviation:String;
begin
result := DFAbbreviation.Value;
end;
procedure TInfoXPULLQuery.SetPModCount(const Value: SmallInt);
begin
DFModCount.Value := Value;
end;
function TInfoXPULLQuery.GetPModCount:SmallInt;
begin
result := DFModCount.Value;
end;
function TInfoXPULLQuery.GetDataBuffer:TInfoXPULLRecord;
var buf: TInfoXPULLRecord;
begin
fillchar(buf, sizeof(buf), 0);
buf.PItemNumber := DFItemNumber.Value;
buf.PSI := DFSI.Value;
buf.PDescription := DFDescription.Value;
buf.PAbbreviation := DFAbbreviation.Value;
buf.PModCount := DFModCount.Value;
result := buf;
end;
procedure TInfoXPULLQuery.StoreDataBuffer(ABuffer:TInfoXPULLRecord);
begin
DFItemNumber.Value := ABuffer.PItemNumber;
DFSI.Value := ABuffer.PSI;
DFDescription.Value := ABuffer.PDescription;
DFAbbreviation.Value := ABuffer.PAbbreviation;
DFModCount.Value := ABuffer.PModCount;
end;
(********************************************)
(************ Register Component ************)
(********************************************)
procedure Register;
begin
RegisterComponents( 'Info Tables', [ TInfoXPULLTable, TInfoXPULLQuery, TInfoXPULLBuffer ] );
end; { Register }
function TInfoXPULLBuffer.FieldNameToIndex(s:string):integer;
const flist:array[1..5] of string = ('ITEMNUMBER','SI','DESCRIPTION','ABBREVIATION','MODCOUNT' );
var x : integer;
begin
s := uppercase(s);
x := 1;
while (x <= 5) and (flist[x] <> s) do inc(x);
if x <= 5 then result := x else result := 0;
end;
function TInfoXPULLBuffer.FieldType(index:integer):TFieldType;
begin
result := ftUnknown;
case index of
1 : result := ftString;
2 : result := ftString;
3 : result := ftString;
4 : result := ftString;
5 : result := ftSmallInt;
end;
end;
function TInfoXPULLBuffer.PtrIndex(index:integer):Pointer;
begin
result := nil;
case index of
1 : result := @Data.PItemNumber;
2 : result := @Data.PSI;
3 : result := @Data.PDescription;
4 : result := @Data.PAbbreviation;
5 : result := @Data.PModCount;
end;
end;
end.
|
unit Favorites;
interface
uses
Collection, Persistent, BackupInterfaces;
type
TFavItem =
class( TPersistent )
public
constructor Create( anId, aKind : integer; aName, aInfo : string );
destructor Destroy; override;
private
fId : integer;
fName : string;
fKind : byte;
fInfo : string;
fItems : TCollection;
fIsRoot : boolean;
public
property Id : integer read fId;
property Name : string read fName write fName;
property Kind : byte read fKind;
property Items : TCollection read fItems;
property Info : string read fInfo;
public
function LocateSubItem( Id : integer ) : TFavItem;
function Serialize : string;
function MatchCord(x, y : integer) : boolean;
procedure DeleteCord(x, y : integer);
protected
procedure LoadFromBackup( Reader : IBackupReader ); override;
procedure StoreToBackup ( Writer : IBackupWriter ); override;
private
fDeleted : boolean;
end;
TFavorites =
class( TPersistent )
public
constructor Create;
destructor Destroy; override;
private
fRoot : TFavItem;
fLastId : integer;
published
function RDONewItem ( Location : widestring; Kind : integer; Name, Info : widestring ) : OleVariant;
function RDODelItem ( Location : widestring ) : OleVariant;
function RDOMoveItem ( ItemLoc : widestring; Dest : widestring ) : OleVariant;
function RDORenameItem ( ItemLoc : widestring; Name : widestring ) : OleVariant;
function RDOGetSubItems( ItemLoc : widestring ) : OleVariant;
public
procedure DeleteCord(x, y : integer);
private
function LocateItem( Location : string; out ParentLocation : string ) : TFavItem;
protected
procedure LoadFromBackup( Reader : IBackupReader ); override;
procedure StoreToBackup ( Writer : IBackupWriter ); override;
public
property Root : TFavItem read fRoot;
public
function CheckIntegrity : boolean;
end;
procedure RegisterBackup;
implementation
uses
CompStringsParser, SysUtils, Protocol, FavProtocol, Logs, Kernel,
MetaInstances;
// TFavItem
constructor TFavItem.Create( anId, aKind : integer; aName, aInfo : string );
begin
inherited Create;
fId := anId;
fKind := aKind;
fInfo := aInfo;
fName := aName;
fItems := TCollection.Create( 0, rkBelonguer );
end;
destructor TFavItem.Destroy;
begin
fItems.Free;
inherited;
end;
function TFavItem.LocateSubItem( Id : integer ) : TFavItem;
var
i : integer;
begin
i := 0;
while (i < fItems.Count) and (TFavItem(fItems[i]).Id <> Id) do
inc( i );
if i < fItems.Count
then result := TFavItem(fItems[i])
else result := nil;
end;
function TFavItem.Serialize : string;
var
i, count : integer;
begin
count := 0;
for i := 0 to pred(fItems.Count) do
if TFavItem(fItems[i]).Kind = fvkFolder
then inc( count );
result := FavProtocol.SerializeItemProps( Id, Kind, Name, Info, count );
end;
function TFavItem.MatchCord(x, y : integer) : boolean;
var
name : string;
x1, y1 : integer;
sel : boolean;
begin
if Kind = fvkLink
then
if Protocol.ParseLinkCookie(fInfo, name, x1, y1, sel)
then result := (x = x1) and (y1 = y)
else result := false
else result := false;
end;
procedure TFavItem.DeleteCord(x, y : integer);
var
i : integer;
Item : TFavItem;
begin
for i := pred(fItems.Count) downto 0 do
begin
Item := TFavItem(fItems[i]);
Item.DeleteCord(x, y);
if Item.MatchCord(x, y)
then
begin
Item.fDeleted := true;
fItems.AtExtract(i); // >> Bugtrap!
end;
end;
end;
procedure TFavItem.LoadFromBackup( Reader : IBackupReader );
begin
inherited;
fId := Reader.ReadInteger( 'Id', 0 );
fName := Reader.ReadString( 'Name', 'Unknown' );
fKind := Reader.ReadInteger( 'Kind', 0 );
fInfo := Reader.ReadString( 'Info', '' );
Reader.ReadObject( 'Items', fItems, nil );
end;
procedure TFavItem.StoreToBackup( Writer : IBackupWriter );
begin
inherited;
Writer.WriteInteger( 'Id', fId );
Writer.WriteString( 'Name', fName );
Writer.WriteInteger( 'Kind', fKind );
Writer.WriteString( 'Info', fInfo );
Writer.WriteLooseObject( 'Items', fItems );
if fDeleted
then
try
Logs.Log( tidLog_Survival, TimeToStr(Now) + ' Error storing favorites Item: ' + fInfo );
except
Logs.Log( tidLog_Survival, 'Error storing favorites Item!' );
end;
end;
// TFavorites
constructor TFavorites.Create;
begin
inherited Create;
fRoot := TFavItem.Create( 0, fvkFolder, 'Favorites', '' );
fRoot.fIsRoot := true;
end;
destructor TFavorites.Destroy;
begin
fRoot.Free;
inherited;
end;
function TFavorites.RDONewItem( Location : widestring; Kind : integer; Name, Info : widestring ) : OleVariant;
var
Parent : TFavItem;
Item : TFavItem;
Useless : string;
begin
Parent := LocateItem( Location, Useless );
if Parent <> nil
then
begin
inc( fLastId );
Item := TFavItem.Create( fLastId, Kind, Name, Info );
Parent.Items.Insert( Item );
result := fLastId;
end
else result := -1;
end;
function TFavorites.RDODelItem( Location : widestring ) : OleVariant;
var
ParentLoc : string;
Useless : string;
Parent : TFavItem;
Item : TFavItem;
begin
Item := LocateItem( Location, ParentLoc );
if (Item <> nil)
then
if not Item.fIsRoot
then
begin
Parent := LocateItem( ParentLoc, Useless );
if Parent <> nil
then
begin
Item.fDeleted := true;
Parent.Items.Extract( Item );
result := true;
end
else result := false
end
else
begin
Logs.Log('favorites', TimeToStr(Now) + ' WARNING!! Trying to delete Root ' + Location);
result := false;
end
else result := false;
end;
function TFavorites.RDOMoveItem( ItemLoc : widestring; Dest : widestring ) : OleVariant;
var
ParentLoc : string;
Useless : string;
Parent : TFavItem;
NewParent : TFavItem;
Item : TFavItem;
begin
if (ItemLoc <> '') and (system.pos(ItemLoc, Dest) <> 1)
then
begin
Item := LocateItem( ItemLoc, ParentLoc );
if (Item <> nil) and not Item.fIsRoot
then
begin
Parent := LocateItem( ParentLoc, Useless );
if Parent <> nil
then
begin
NewParent := LocateItem( Dest, Useless );
if NewParent <> nil
then
begin
Parent.Items.Extract( Item );
NewParent.Items.Insert( Item );
result := true;
end
else result := false
end
else result := false
end
else result := false;
end
else result := false;
end;
function TFavorites.RDORenameItem( ItemLoc : widestring; Name : widestring ) : OleVariant;
var
ParentLoc : string;
Item : TFavItem;
begin
Item := LocateItem( ItemLoc, ParentLoc );
if Item <> nil
then
begin
if length(Name) > 50
then Item.Name := system.copy(Name, 1, 50)
else Item.Name := Name;
result := true;
end
else result := false
end;
function TFavorites.RDOGetSubItems( ItemLoc : widestring ) : OleVariant;
var
ParentLoc : string;
Item : TFavItem;
Child : TFavItem;
i : integer;
begin
Item := LocateItem( ItemLoc, ParentLoc );
if Item <> nil
then
begin
result := '';
for i := 0 to pred(Item.Items.Count) do
begin
Child := TFavItem(Item.Items[i]);
result := result + Child.Serialize + chrItemSeparator;
end;
end
else result := ''
end;
procedure TFavorites.DeleteCord(x, y : integer);
begin
fRoot.DeleteCord(x, y);
end;
function TFavorites.LocateItem( Location : string; out ParentLocation : string ) : TFavItem;
var
idStr : string;
oldpos, pos : integer;
begin
result := fRoot;
if Location <> ''
then
begin
pos := 1;
repeat
oldpos := pos;
idStr := GetNextStringUpTo( Location, pos, chrPathSeparator );
if idStr <> ''
then
begin
ParentLocation := system.copy( Location, 1, oldpos - 1 );
result := result.LocateSubItem( StrToInt(idStr) );
end;
until (idStr = '') or (result = nil);
end
else ParentLocation := '';
end;
procedure TFavorites.LoadFromBackup( Reader : IBackupReader );
begin
inherited;
Reader.ReadObject( 'Root', fRoot, nil );
if fRoot <> nil
then fRoot.fIsRoot := true;
fLastId := Reader.ReadInteger( 'LastId', 0 );
end;
procedure TFavorites.StoreToBackup( Writer : IBackupWriter );
begin
inherited;
Writer.WriteObject( 'Root', fRoot );
Writer.WriteInteger( 'LastId', fLastId );
end;
function TFavorites.CheckIntegrity : boolean;
begin
result := (fRoot <> nil) and MetaInstances.ObjectIs('TFavItem', fRoot);
end;
// RegisterBackup
procedure RegisterBackup;
begin
RegisterClass( TFavItem );
RegisterClass( TFavorites );
end;
end.
|
unit InfoLOANTable;
interface
uses
Classes, DB, DBISAMTb, SysUtils, DBISAMTableAU, DataBuf;
type
TInfoLOANRecord = record
PLender: String[4];
PLoanNumber: String[18];
PModCount: SmallInt;
PShortName: String[15];
PBranch: String[6];
PName: String[30];
PAddress1: String[30];
PAddress2: String[30];
PAddressSearch: String[15];
PCityState: String[25];
PZipCode: String[9];
POfficer: String[6];
POfficer2: String[6];
PLoanDate: String[8];
PMaturityDate: String[8];
PCollateralInUse: String[1];
PCollateralCode: String[10];
PAction: String[1];
PCompanyAgent: String[20];
PPolicy: String[15];
PEffDate: String[8];
PExpDate: String[8];
PBatchdate: String[8];
PEntry: Integer;
PDocumentID: String[6];
PMailDate: String[8];
PUserId: String[6];
PBalance: Currency;
PBalanceDate: String[8];
PInterestRate: String[4];
PRate: String[2];
PVSIStatus: String[2];
PVSINoticeType: String[1];
PVSIDate: String[8];
PWaivedStatus: String[1];
PInsuranceStatus: String[1];
POldInsuranceStatus: String[1];
PLoanStatus: String[1];
PStatusDate: String[8];
PAddSrc: String[1];
PInterestOption: String[1];
PMethod: String[4];
PReqBal: String[1];
PMissingDataList: String[1];
PSpecialApprovalList: String[1];
PRunEvents: String[8];
PHoldNotice: String[1];
PForcedPlacedStatus: String[1];
PTransId: String[5];
PSystemHistDate: String[8];
PSystemTime: String[6];
PVSIPremiumBalance: Integer;
PVSIBalanceDate: String[8];
PVSIRate: String[2];
PVSIIncpt: String[6];
PVSIExpirationdate: String[8];
PVSITerm: Integer;
PVSIOneYr: String[1];
PComment: String[30];
End;
TInfoLOANClass2 = class
public
PLender: String[4];
PLoanNumber: String[18];
PModCount: SmallInt;
PShortName: String[15];
PBranch: String[6];
PName: String[30];
PAddress1: String[30];
PAddress2: String[30];
PAddressSearch: String[15];
PCityState: String[25];
PZipCode: String[9];
POfficer: String[6];
POfficer2: String[6];
PLoanDate: String[8];
PMaturityDate: String[8];
PCollateralInUse: String[1];
PCollateralCode: String[10];
PAction: String[1];
PCompanyAgent: String[20];
PPolicy: String[15];
PEffDate: String[8];
PExpDate: String[8];
PBatchdate: String[8];
PEntry: Integer;
PDocumentID: String[6];
PMailDate: String[8];
PUserId: String[6];
PBalance: Currency;
PBalanceDate: String[8];
PInterestRate: String[4];
PRate: String[2];
PVSIStatus: String[2];
PVSINoticeType: String[1];
PVSIDate: String[8];
PWaivedStatus: String[1];
PInsuranceStatus: String[1];
POldInsuranceStatus: String[1];
PLoanStatus: String[1];
PStatusDate: String[8];
PAddSrc: String[1];
PInterestOption: String[1];
PMethod: String[4];
PReqBal: String[1];
PMissingDataList: String[1];
PSpecialApprovalList: String[1];
PRunEvents: String[8];
PHoldNotice: String[1];
PForcedPlacedStatus: String[1];
PTransId: String[5];
PSystemHistDate: String[8];
PSystemTime: String[6];
PVSIPremiumBalance: Integer;
PVSIBalanceDate: String[8];
PVSIRate: String[2];
PVSIIncpt: String[6];
PVSIExpirationdate: String[8];
PVSITerm: Integer;
PVSIOneYr: String[1];
PComment: String[30];
End;
// function CtoRInfoLOAN(AClass:TInfoLOANClass):TInfoLOANRecord;
// procedure RtoCInfoLOAN(ARecord:TInfoLOANRecord;AClass:TInfoLOANClass);
TInfoLOANBuffer = class(TDataBuf)
protected
function PtrIndex(Index:integer):Pointer;override;
public
Data: TInfoLOANRecord;
function FieldNameToIndex(s:string):integer;override;
function FieldType(index:integer):TFieldType;override;
end;
TEIInfoLOAN = (InfoLOANPrimaryKey, InfoLOANLendShortName, InfoLOANLendPolicy, InfoLOANLendAddress);
TInfoLOANTable = class( TDBISAMTableAU )
private
FDFLender: TStringField;
FDFLoanNumber: TStringField;
FDFModCount: TSmallIntField;
FDFShortName: TStringField;
FDFBranch: TStringField;
FDFName: TStringField;
FDFAddress1: TStringField;
FDFAddress2: TStringField;
FDFAddressSearch: TStringField;
FDFCityState: TStringField;
FDFZipCode: TStringField;
FDFOfficer: TStringField;
FDFOfficer2: TStringField;
FDFLoanDate: TStringField;
FDFMaturityDate: TStringField;
FDFCollateralInUse: TStringField;
FDFCollateralCode: TStringField;
FDFAction: TStringField;
FDFCompanyAgent: TStringField;
FDFPolicy: TStringField;
FDFEffDate: TStringField;
FDFExpDate: TStringField;
FDFBatchdate: TStringField;
FDFEntry: TIntegerField;
FDFDocumentID: TStringField;
FDFMailDate: TStringField;
FDFUserId: TStringField;
FDFBalance: TCurrencyField;
FDFBalanceDate: TStringField;
FDFInterestRate: TStringField;
FDFRate: TStringField;
FDFVSIStatus: TStringField;
FDFVSINoticeType: TStringField;
FDFVSIDate: TStringField;
FDFWaivedStatus: TStringField;
FDFInsuranceStatus: TStringField;
FDFOldInsuranceStatus: TStringField;
FDFLoanStatus: TStringField;
FDFStatusDate: TStringField;
FDFAddSrc: TStringField;
FDFInterestOption: TStringField;
FDFMethod: TStringField;
FDFReqBal: TStringField;
FDFMissingDataList: TStringField;
FDFSpecialApprovalList: TStringField;
FDFRunEvents: TStringField;
FDFHoldNotice: TStringField;
FDFForcedPlacedStatus: TStringField;
FDFTransId: TStringField;
FDFSystemHistDate: TStringField;
FDFSystemTime: TStringField;
FDFVSIPremiumBalance: TIntegerField;
FDFVSIBalanceDate: TStringField;
FDFVSIRate: TStringField;
FDFVSIIncpt: TStringField;
FDFVSIExpirationdate: TStringField;
FDFVSITerm: TIntegerField;
FDFVSIOneYr: TStringField;
FDFComment: TStringField;
procedure SetPLender(const Value: String);
function GetPLender:String;
procedure SetPLoanNumber(const Value: String);
function GetPLoanNumber:String;
procedure SetPModCount(const Value: SmallInt);
function GetPModCount:SmallInt;
procedure SetPShortName(const Value: String);
function GetPShortName:String;
procedure SetPBranch(const Value: String);
function GetPBranch:String;
procedure SetPName(const Value: String);
function GetPName:String;
procedure SetPAddress1(const Value: String);
function GetPAddress1:String;
procedure SetPAddress2(const Value: String);
function GetPAddress2:String;
procedure SetPAddressSearch(const Value: String);
function GetPAddressSearch:String;
procedure SetPCityState(const Value: String);
function GetPCityState:String;
procedure SetPZipCode(const Value: String);
function GetPZipCode:String;
procedure SetPOfficer(const Value: String);
function GetPOfficer:String;
procedure SetPOfficer2(const Value: String);
function GetPOfficer2:String;
procedure SetPLoanDate(const Value: String);
function GetPLoanDate:String;
procedure SetPMaturityDate(const Value: String);
function GetPMaturityDate:String;
procedure SetPCollateralInUse(const Value: String);
function GetPCollateralInUse:String;
procedure SetPCollateralCode(const Value: String);
function GetPCollateralCode:String;
procedure SetPAction(const Value: String);
function GetPAction:String;
procedure SetPCompanyAgent(const Value: String);
function GetPCompanyAgent:String;
procedure SetPPolicy(const Value: String);
function GetPPolicy:String;
procedure SetPEffDate(const Value: String);
function GetPEffDate:String;
procedure SetPExpDate(const Value: String);
function GetPExpDate:String;
procedure SetPBatchdate(const Value: String);
function GetPBatchdate:String;
procedure SetPEntry(const Value: Integer);
function GetPEntry:Integer;
procedure SetPDocumentID(const Value: String);
function GetPDocumentID:String;
procedure SetPMailDate(const Value: String);
function GetPMailDate:String;
procedure SetPUserId(const Value: String);
function GetPUserId:String;
procedure SetPBalance(const Value: Currency);
function GetPBalance:Currency;
procedure SetPBalanceDate(const Value: String);
function GetPBalanceDate:String;
procedure SetPInterestRate(const Value: String);
function GetPInterestRate:String;
procedure SetPRate(const Value: String);
function GetPRate:String;
procedure SetPVSIStatus(const Value: String);
function GetPVSIStatus:String;
procedure SetPVSINoticeType(const Value: String);
function GetPVSINoticeType:String;
procedure SetPVSIDate(const Value: String);
function GetPVSIDate:String;
procedure SetPWaivedStatus(const Value: String);
function GetPWaivedStatus:String;
procedure SetPInsuranceStatus(const Value: String);
function GetPInsuranceStatus:String;
procedure SetPOldInsuranceStatus(const Value: String);
function GetPOldInsuranceStatus:String;
procedure SetPLoanStatus(const Value: String);
function GetPLoanStatus:String;
procedure SetPStatusDate(const Value: String);
function GetPStatusDate:String;
procedure SetPAddSrc(const Value: String);
function GetPAddSrc:String;
procedure SetPInterestOption(const Value: String);
function GetPInterestOption:String;
procedure SetPMethod(const Value: String);
function GetPMethod:String;
procedure SetPReqBal(const Value: String);
function GetPReqBal:String;
procedure SetPMissingDataList(const Value: String);
function GetPMissingDataList:String;
procedure SetPSpecialApprovalList(const Value: String);
function GetPSpecialApprovalList:String;
procedure SetPRunEvents(const Value: String);
function GetPRunEvents:String;
procedure SetPHoldNotice(const Value: String);
function GetPHoldNotice:String;
procedure SetPForcedPlacedStatus(const Value: String);
function GetPForcedPlacedStatus:String;
procedure SetPTransId(const Value: String);
function GetPTransId:String;
procedure SetPSystemHistDate(const Value: String);
function GetPSystemHistDate:String;
procedure SetPSystemTime(const Value: String);
function GetPSystemTime:String;
procedure SetPVSIPremiumBalance(const Value: Integer);
function GetPVSIPremiumBalance:Integer;
procedure SetPVSIBalanceDate(const Value: String);
function GetPVSIBalanceDate:String;
procedure SetPVSIRate(const Value: String);
function GetPVSIRate:String;
procedure SetPVSIIncpt(const Value: String);
function GetPVSIIncpt:String;
procedure SetPVSIExpirationdate(const Value: String);
function GetPVSIExpirationdate:String;
procedure SetPVSITerm(const Value: Integer);
function GetPVSITerm:Integer;
procedure SetPVSIOneYr(const Value: String);
function GetPVSIOneYr:String;
procedure SetPComment(const Value: String);
function GetPComment:String;
function GenerateNewFieldName( AOwner: TComponent; const DatasetName: string; const FieldName: string ): string;
procedure SetEnumIndex(Value: TEIInfoLOAN);
function GetEnumIndex: TEIInfoLOAN;
protected
function CreateField( const FieldName : string ): TField;
procedure CreateFields; reintroduce;
procedure SetActive(Value: Boolean); override;
procedure LoadFieldDefs(AStringList:TStringList);override;
procedure LoadIndexDefs(AStringList:TStringList);override;
public
function GetDataBuffer:TInfoLOANRecord;
procedure StoreDataBuffer(ABuffer:TInfoLOANRecord);
property DFLender: TStringField read FDFLender;
property DFLoanNumber: TStringField read FDFLoanNumber;
property DFModCount: TSmallIntField read FDFModCount;
property DFShortName: TStringField read FDFShortName;
property DFBranch: TStringField read FDFBranch;
property DFName: TStringField read FDFName;
property DFAddress1: TStringField read FDFAddress1;
property DFAddress2: TStringField read FDFAddress2;
property DFAddressSearch: TStringField read FDFAddressSearch;
property DFCityState: TStringField read FDFCityState;
property DFZipCode: TStringField read FDFZipCode;
property DFOfficer: TStringField read FDFOfficer;
property DFOfficer2: TStringField read FDFOfficer2;
property DFLoanDate: TStringField read FDFLoanDate;
property DFMaturityDate: TStringField read FDFMaturityDate;
property DFCollateralInUse: TStringField read FDFCollateralInUse;
property DFCollateralCode: TStringField read FDFCollateralCode;
property DFAction: TStringField read FDFAction;
property DFCompanyAgent: TStringField read FDFCompanyAgent;
property DFPolicy: TStringField read FDFPolicy;
property DFEffDate: TStringField read FDFEffDate;
property DFExpDate: TStringField read FDFExpDate;
property DFBatchdate: TStringField read FDFBatchdate;
property DFEntry: TIntegerField read FDFEntry;
property DFDocumentID: TStringField read FDFDocumentID;
property DFMailDate: TStringField read FDFMailDate;
property DFUserId: TStringField read FDFUserId;
property DFBalance: TCurrencyField read FDFBalance;
property DFBalanceDate: TStringField read FDFBalanceDate;
property DFInterestRate: TStringField read FDFInterestRate;
property DFRate: TStringField read FDFRate;
property DFVSIStatus: TStringField read FDFVSIStatus;
property DFVSINoticeType: TStringField read FDFVSINoticeType;
property DFVSIDate: TStringField read FDFVSIDate;
property DFWaivedStatus: TStringField read FDFWaivedStatus;
property DFInsuranceStatus: TStringField read FDFInsuranceStatus;
property DFOldInsuranceStatus: TStringField read FDFOldInsuranceStatus;
property DFLoanStatus: TStringField read FDFLoanStatus;
property DFStatusDate: TStringField read FDFStatusDate;
property DFAddSrc: TStringField read FDFAddSrc;
property DFInterestOption: TStringField read FDFInterestOption;
property DFMethod: TStringField read FDFMethod;
property DFReqBal: TStringField read FDFReqBal;
property DFMissingDataList: TStringField read FDFMissingDataList;
property DFSpecialApprovalList: TStringField read FDFSpecialApprovalList;
property DFRunEvents: TStringField read FDFRunEvents;
property DFHoldNotice: TStringField read FDFHoldNotice;
property DFForcedPlacedStatus: TStringField read FDFForcedPlacedStatus;
property DFTransId: TStringField read FDFTransId;
property DFSystemHistDate: TStringField read FDFSystemHistDate;
property DFSystemTime: TStringField read FDFSystemTime;
property DFVSIPremiumBalance: TIntegerField read FDFVSIPremiumBalance;
property DFVSIBalanceDate: TStringField read FDFVSIBalanceDate;
property DFVSIRate: TStringField read FDFVSIRate;
property DFVSIIncpt: TStringField read FDFVSIIncpt;
property DFVSIExpirationdate: TStringField read FDFVSIExpirationdate;
property DFVSITerm: TIntegerField read FDFVSITerm;
property DFVSIOneYr: TStringField read FDFVSIOneYr;
property DFComment: TStringField read FDFComment;
property PLender: String read GetPLender write SetPLender;
property PLoanNumber: String read GetPLoanNumber write SetPLoanNumber;
property PModCount: SmallInt read GetPModCount write SetPModCount;
property PShortName: String read GetPShortName write SetPShortName;
property PBranch: String read GetPBranch write SetPBranch;
property PName: String read GetPName write SetPName;
property PAddress1: String read GetPAddress1 write SetPAddress1;
property PAddress2: String read GetPAddress2 write SetPAddress2;
property PAddressSearch: String read GetPAddressSearch write SetPAddressSearch;
property PCityState: String read GetPCityState write SetPCityState;
property PZipCode: String read GetPZipCode write SetPZipCode;
property POfficer: String read GetPOfficer write SetPOfficer;
property POfficer2: String read GetPOfficer2 write SetPOfficer2;
property PLoanDate: String read GetPLoanDate write SetPLoanDate;
property PMaturityDate: String read GetPMaturityDate write SetPMaturityDate;
property PCollateralInUse: String read GetPCollateralInUse write SetPCollateralInUse;
property PCollateralCode: String read GetPCollateralCode write SetPCollateralCode;
property PAction: String read GetPAction write SetPAction;
property PCompanyAgent: String read GetPCompanyAgent write SetPCompanyAgent;
property PPolicy: String read GetPPolicy write SetPPolicy;
property PEffDate: String read GetPEffDate write SetPEffDate;
property PExpDate: String read GetPExpDate write SetPExpDate;
property PBatchdate: String read GetPBatchdate write SetPBatchdate;
property PEntry: Integer read GetPEntry write SetPEntry;
property PDocumentID: String read GetPDocumentID write SetPDocumentID;
property PMailDate: String read GetPMailDate write SetPMailDate;
property PUserId: String read GetPUserId write SetPUserId;
property PBalance: Currency read GetPBalance write SetPBalance;
property PBalanceDate: String read GetPBalanceDate write SetPBalanceDate;
property PInterestRate: String read GetPInterestRate write SetPInterestRate;
property PRate: String read GetPRate write SetPRate;
property PVSIStatus: String read GetPVSIStatus write SetPVSIStatus;
property PVSINoticeType: String read GetPVSINoticeType write SetPVSINoticeType;
property PVSIDate: String read GetPVSIDate write SetPVSIDate;
property PWaivedStatus: String read GetPWaivedStatus write SetPWaivedStatus;
property PInsuranceStatus: String read GetPInsuranceStatus write SetPInsuranceStatus;
property POldInsuranceStatus: String read GetPOldInsuranceStatus write SetPOldInsuranceStatus;
property PLoanStatus: String read GetPLoanStatus write SetPLoanStatus;
property PStatusDate: String read GetPStatusDate write SetPStatusDate;
property PAddSrc: String read GetPAddSrc write SetPAddSrc;
property PInterestOption: String read GetPInterestOption write SetPInterestOption;
property PMethod: String read GetPMethod write SetPMethod;
property PReqBal: String read GetPReqBal write SetPReqBal;
property PMissingDataList: String read GetPMissingDataList write SetPMissingDataList;
property PSpecialApprovalList: String read GetPSpecialApprovalList write SetPSpecialApprovalList;
property PRunEvents: String read GetPRunEvents write SetPRunEvents;
property PHoldNotice: String read GetPHoldNotice write SetPHoldNotice;
property PForcedPlacedStatus: String read GetPForcedPlacedStatus write SetPForcedPlacedStatus;
property PTransId: String read GetPTransId write SetPTransId;
property PSystemHistDate: String read GetPSystemHistDate write SetPSystemHistDate;
property PSystemTime: String read GetPSystemTime write SetPSystemTime;
property PVSIPremiumBalance: Integer read GetPVSIPremiumBalance write SetPVSIPremiumBalance;
property PVSIBalanceDate: String read GetPVSIBalanceDate write SetPVSIBalanceDate;
property PVSIRate: String read GetPVSIRate write SetPVSIRate;
property PVSIIncpt: String read GetPVSIIncpt write SetPVSIIncpt;
property PVSIExpirationdate: String read GetPVSIExpirationdate write SetPVSIExpirationdate;
property PVSITerm: Integer read GetPVSITerm write SetPVSITerm;
property PVSIOneYr: String read GetPVSIOneYr write SetPVSIOneYr;
property PComment: String read GetPComment write SetPComment;
published
property Active write SetActive;
property EnumIndex: TEIInfoLOAN read GetEnumIndex write SetEnumIndex;
end; { TInfoLOANTable }
TInfoLOANQuery = class( TDBISAMQueryAU )
private
FDFLender: TStringField;
FDFLoanNumber: TStringField;
FDFModCount: TSmallIntField;
FDFShortName: TStringField;
FDFBranch: TStringField;
FDFName: TStringField;
FDFAddress1: TStringField;
FDFAddress2: TStringField;
FDFAddressSearch: TStringField;
FDFCityState: TStringField;
FDFZipCode: TStringField;
FDFOfficer: TStringField;
FDFOfficer2: TStringField;
FDFLoanDate: TStringField;
FDFMaturityDate: TStringField;
FDFCollateralInUse: TStringField;
FDFCollateralCode: TStringField;
FDFAction: TStringField;
FDFCompanyAgent: TStringField;
FDFPolicy: TStringField;
FDFEffDate: TStringField;
FDFExpDate: TStringField;
FDFBatchdate: TStringField;
FDFEntry: TIntegerField;
FDFDocumentID: TStringField;
FDFMailDate: TStringField;
FDFUserId: TStringField;
FDFBalance: TCurrencyField;
FDFBalanceDate: TStringField;
FDFInterestRate: TStringField;
FDFRate: TStringField;
FDFVSIStatus: TStringField;
FDFVSINoticeType: TStringField;
FDFVSIDate: TStringField;
FDFWaivedStatus: TStringField;
FDFInsuranceStatus: TStringField;
FDFOldInsuranceStatus: TStringField;
FDFLoanStatus: TStringField;
FDFStatusDate: TStringField;
FDFAddSrc: TStringField;
FDFInterestOption: TStringField;
FDFMethod: TStringField;
FDFReqBal: TStringField;
FDFMissingDataList: TStringField;
FDFSpecialApprovalList: TStringField;
FDFRunEvents: TStringField;
FDFHoldNotice: TStringField;
FDFForcedPlacedStatus: TStringField;
FDFTransId: TStringField;
FDFSystemHistDate: TStringField;
FDFSystemTime: TStringField;
FDFVSIPremiumBalance: TIntegerField;
FDFVSIBalanceDate: TStringField;
FDFVSIRate: TStringField;
FDFVSIIncpt: TStringField;
FDFVSIExpirationdate: TStringField;
FDFVSITerm: TIntegerField;
FDFVSIOneYr: TStringField;
FDFComment: TStringField;
procedure SetPLender(const Value: String);
function GetPLender:String;
procedure SetPLoanNumber(const Value: String);
function GetPLoanNumber:String;
procedure SetPModCount(const Value: SmallInt);
function GetPModCount:SmallInt;
procedure SetPShortName(const Value: String);
function GetPShortName:String;
procedure SetPBranch(const Value: String);
function GetPBranch:String;
procedure SetPName(const Value: String);
function GetPName:String;
procedure SetPAddress1(const Value: String);
function GetPAddress1:String;
procedure SetPAddress2(const Value: String);
function GetPAddress2:String;
procedure SetPAddressSearch(const Value: String);
function GetPAddressSearch:String;
procedure SetPCityState(const Value: String);
function GetPCityState:String;
procedure SetPZipCode(const Value: String);
function GetPZipCode:String;
procedure SetPOfficer(const Value: String);
function GetPOfficer:String;
procedure SetPOfficer2(const Value: String);
function GetPOfficer2:String;
procedure SetPLoanDate(const Value: String);
function GetPLoanDate:String;
procedure SetPMaturityDate(const Value: String);
function GetPMaturityDate:String;
procedure SetPCollateralInUse(const Value: String);
function GetPCollateralInUse:String;
procedure SetPCollateralCode(const Value: String);
function GetPCollateralCode:String;
procedure SetPAction(const Value: String);
function GetPAction:String;
procedure SetPCompanyAgent(const Value: String);
function GetPCompanyAgent:String;
procedure SetPPolicy(const Value: String);
function GetPPolicy:String;
procedure SetPEffDate(const Value: String);
function GetPEffDate:String;
procedure SetPExpDate(const Value: String);
function GetPExpDate:String;
procedure SetPBatchdate(const Value: String);
function GetPBatchdate:String;
procedure SetPEntry(const Value: Integer);
function GetPEntry:Integer;
procedure SetPDocumentID(const Value: String);
function GetPDocumentID:String;
procedure SetPMailDate(const Value: String);
function GetPMailDate:String;
procedure SetPUserId(const Value: String);
function GetPUserId:String;
procedure SetPBalance(const Value: Currency);
function GetPBalance:Currency;
procedure SetPBalanceDate(const Value: String);
function GetPBalanceDate:String;
procedure SetPInterestRate(const Value: String);
function GetPInterestRate:String;
procedure SetPRate(const Value: String);
function GetPRate:String;
procedure SetPVSIStatus(const Value: String);
function GetPVSIStatus:String;
procedure SetPVSINoticeType(const Value: String);
function GetPVSINoticeType:String;
procedure SetPVSIDate(const Value: String);
function GetPVSIDate:String;
procedure SetPWaivedStatus(const Value: String);
function GetPWaivedStatus:String;
procedure SetPInsuranceStatus(const Value: String);
function GetPInsuranceStatus:String;
procedure SetPOldInsuranceStatus(const Value: String);
function GetPOldInsuranceStatus:String;
procedure SetPLoanStatus(const Value: String);
function GetPLoanStatus:String;
procedure SetPStatusDate(const Value: String);
function GetPStatusDate:String;
procedure SetPAddSrc(const Value: String);
function GetPAddSrc:String;
procedure SetPInterestOption(const Value: String);
function GetPInterestOption:String;
procedure SetPMethod(const Value: String);
function GetPMethod:String;
procedure SetPReqBal(const Value: String);
function GetPReqBal:String;
procedure SetPMissingDataList(const Value: String);
function GetPMissingDataList:String;
procedure SetPSpecialApprovalList(const Value: String);
function GetPSpecialApprovalList:String;
procedure SetPRunEvents(const Value: String);
function GetPRunEvents:String;
procedure SetPHoldNotice(const Value: String);
function GetPHoldNotice:String;
procedure SetPForcedPlacedStatus(const Value: String);
function GetPForcedPlacedStatus:String;
procedure SetPTransId(const Value: String);
function GetPTransId:String;
procedure SetPSystemHistDate(const Value: String);
function GetPSystemHistDate:String;
procedure SetPSystemTime(const Value: String);
function GetPSystemTime:String;
procedure SetPVSIPremiumBalance(const Value: Integer);
function GetPVSIPremiumBalance:Integer;
procedure SetPVSIBalanceDate(const Value: String);
function GetPVSIBalanceDate:String;
procedure SetPVSIRate(const Value: String);
function GetPVSIRate:String;
procedure SetPVSIIncpt(const Value: String);
function GetPVSIIncpt:String;
procedure SetPVSIExpirationdate(const Value: String);
function GetPVSIExpirationdate:String;
procedure SetPVSITerm(const Value: Integer);
function GetPVSITerm:Integer;
procedure SetPVSIOneYr(const Value: String);
function GetPVSIOneYr:String;
procedure SetPComment(const Value: String);
function GetPComment:String;
function GenerateNewFieldName( AOwner: TComponent; const DatasetName: string; const FieldName: string ): string;
protected
function CreateField( const FieldName : string ): TField;
procedure CreateFields; reintroduce;
procedure SetActive(Value: Boolean); override;
public
function GetDataBuffer:TInfoLOANRecord;
procedure StoreDataBuffer(ABuffer:TInfoLOANRecord);
property DFLender: TStringField read FDFLender;
property DFLoanNumber: TStringField read FDFLoanNumber;
property DFModCount: TSmallIntField read FDFModCount;
property DFShortName: TStringField read FDFShortName;
property DFBranch: TStringField read FDFBranch;
property DFName: TStringField read FDFName;
property DFAddress1: TStringField read FDFAddress1;
property DFAddress2: TStringField read FDFAddress2;
property DFAddressSearch: TStringField read FDFAddressSearch;
property DFCityState: TStringField read FDFCityState;
property DFZipCode: TStringField read FDFZipCode;
property DFOfficer: TStringField read FDFOfficer;
property DFOfficer2: TStringField read FDFOfficer2;
property DFLoanDate: TStringField read FDFLoanDate;
property DFMaturityDate: TStringField read FDFMaturityDate;
property DFCollateralInUse: TStringField read FDFCollateralInUse;
property DFCollateralCode: TStringField read FDFCollateralCode;
property DFAction: TStringField read FDFAction;
property DFCompanyAgent: TStringField read FDFCompanyAgent;
property DFPolicy: TStringField read FDFPolicy;
property DFEffDate: TStringField read FDFEffDate;
property DFExpDate: TStringField read FDFExpDate;
property DFBatchdate: TStringField read FDFBatchdate;
property DFEntry: TIntegerField read FDFEntry;
property DFDocumentID: TStringField read FDFDocumentID;
property DFMailDate: TStringField read FDFMailDate;
property DFUserId: TStringField read FDFUserId;
property DFBalance: TCurrencyField read FDFBalance;
property DFBalanceDate: TStringField read FDFBalanceDate;
property DFInterestRate: TStringField read FDFInterestRate;
property DFRate: TStringField read FDFRate;
property DFVSIStatus: TStringField read FDFVSIStatus;
property DFVSINoticeType: TStringField read FDFVSINoticeType;
property DFVSIDate: TStringField read FDFVSIDate;
property DFWaivedStatus: TStringField read FDFWaivedStatus;
property DFInsuranceStatus: TStringField read FDFInsuranceStatus;
property DFOldInsuranceStatus: TStringField read FDFOldInsuranceStatus;
property DFLoanStatus: TStringField read FDFLoanStatus;
property DFStatusDate: TStringField read FDFStatusDate;
property DFAddSrc: TStringField read FDFAddSrc;
property DFInterestOption: TStringField read FDFInterestOption;
property DFMethod: TStringField read FDFMethod;
property DFReqBal: TStringField read FDFReqBal;
property DFMissingDataList: TStringField read FDFMissingDataList;
property DFSpecialApprovalList: TStringField read FDFSpecialApprovalList;
property DFRunEvents: TStringField read FDFRunEvents;
property DFHoldNotice: TStringField read FDFHoldNotice;
property DFForcedPlacedStatus: TStringField read FDFForcedPlacedStatus;
property DFTransId: TStringField read FDFTransId;
property DFSystemHistDate: TStringField read FDFSystemHistDate;
property DFSystemTime: TStringField read FDFSystemTime;
property DFVSIPremiumBalance: TIntegerField read FDFVSIPremiumBalance;
property DFVSIBalanceDate: TStringField read FDFVSIBalanceDate;
property DFVSIRate: TStringField read FDFVSIRate;
property DFVSIIncpt: TStringField read FDFVSIIncpt;
property DFVSIExpirationdate: TStringField read FDFVSIExpirationdate;
property DFVSITerm: TIntegerField read FDFVSITerm;
property DFVSIOneYr: TStringField read FDFVSIOneYr;
property DFComment: TStringField read FDFComment;
property PLender: String read GetPLender write SetPLender;
property PLoanNumber: String read GetPLoanNumber write SetPLoanNumber;
property PModCount: SmallInt read GetPModCount write SetPModCount;
property PShortName: String read GetPShortName write SetPShortName;
property PBranch: String read GetPBranch write SetPBranch;
property PName: String read GetPName write SetPName;
property PAddress1: String read GetPAddress1 write SetPAddress1;
property PAddress2: String read GetPAddress2 write SetPAddress2;
property PAddressSearch: String read GetPAddressSearch write SetPAddressSearch;
property PCityState: String read GetPCityState write SetPCityState;
property PZipCode: String read GetPZipCode write SetPZipCode;
property POfficer: String read GetPOfficer write SetPOfficer;
property POfficer2: String read GetPOfficer2 write SetPOfficer2;
property PLoanDate: String read GetPLoanDate write SetPLoanDate;
property PMaturityDate: String read GetPMaturityDate write SetPMaturityDate;
property PCollateralInUse: String read GetPCollateralInUse write SetPCollateralInUse;
property PCollateralCode: String read GetPCollateralCode write SetPCollateralCode;
property PAction: String read GetPAction write SetPAction;
property PCompanyAgent: String read GetPCompanyAgent write SetPCompanyAgent;
property PPolicy: String read GetPPolicy write SetPPolicy;
property PEffDate: String read GetPEffDate write SetPEffDate;
property PExpDate: String read GetPExpDate write SetPExpDate;
property PBatchdate: String read GetPBatchdate write SetPBatchdate;
property PEntry: Integer read GetPEntry write SetPEntry;
property PDocumentID: String read GetPDocumentID write SetPDocumentID;
property PMailDate: String read GetPMailDate write SetPMailDate;
property PUserId: String read GetPUserId write SetPUserId;
property PBalance: Currency read GetPBalance write SetPBalance;
property PBalanceDate: String read GetPBalanceDate write SetPBalanceDate;
property PInterestRate: String read GetPInterestRate write SetPInterestRate;
property PRate: String read GetPRate write SetPRate;
property PVSIStatus: String read GetPVSIStatus write SetPVSIStatus;
property PVSINoticeType: String read GetPVSINoticeType write SetPVSINoticeType;
property PVSIDate: String read GetPVSIDate write SetPVSIDate;
property PWaivedStatus: String read GetPWaivedStatus write SetPWaivedStatus;
property PInsuranceStatus: String read GetPInsuranceStatus write SetPInsuranceStatus;
property POldInsuranceStatus: String read GetPOldInsuranceStatus write SetPOldInsuranceStatus;
property PLoanStatus: String read GetPLoanStatus write SetPLoanStatus;
property PStatusDate: String read GetPStatusDate write SetPStatusDate;
property PAddSrc: String read GetPAddSrc write SetPAddSrc;
property PInterestOption: String read GetPInterestOption write SetPInterestOption;
property PMethod: String read GetPMethod write SetPMethod;
property PReqBal: String read GetPReqBal write SetPReqBal;
property PMissingDataList: String read GetPMissingDataList write SetPMissingDataList;
property PSpecialApprovalList: String read GetPSpecialApprovalList write SetPSpecialApprovalList;
property PRunEvents: String read GetPRunEvents write SetPRunEvents;
property PHoldNotice: String read GetPHoldNotice write SetPHoldNotice;
property PForcedPlacedStatus: String read GetPForcedPlacedStatus write SetPForcedPlacedStatus;
property PTransId: String read GetPTransId write SetPTransId;
property PSystemHistDate: String read GetPSystemHistDate write SetPSystemHistDate;
property PSystemTime: String read GetPSystemTime write SetPSystemTime;
property PVSIPremiumBalance: Integer read GetPVSIPremiumBalance write SetPVSIPremiumBalance;
property PVSIBalanceDate: String read GetPVSIBalanceDate write SetPVSIBalanceDate;
property PVSIRate: String read GetPVSIRate write SetPVSIRate;
property PVSIIncpt: String read GetPVSIIncpt write SetPVSIIncpt;
property PVSIExpirationdate: String read GetPVSIExpirationdate write SetPVSIExpirationdate;
property PVSITerm: Integer read GetPVSITerm write SetPVSITerm;
property PVSIOneYr: String read GetPVSIOneYr write SetPVSIOneYr;
property PComment: String read GetPComment write SetPComment;
published
property Active write SetActive;
end; { TInfoLOANTable }
procedure Register;
implementation
function TInfoLOANTable.GenerateNewFieldName( AOwner: TComponent; const DatasetName: string; const FieldName: string ): string;
var
I: Integer;
NewName: string;
Done: Boolean;
function ComponentExists( AOwner: TComponent; const CompName: string ): Boolean;
var
I: Integer;
begin
Result := False;
for I := 0 To AOwner.ComponentCount - 1 do
begin
if AnsiCompareText( CompName, AOwner.Components[ I ].Name ) = 0 then
begin
Result := True;
Break;
end;
end;
end; { ComponentExists }
begin { TInfoLOANTable.GenerateNewFieldName }
NewName := DatasetName;
for I := 1 to Length( FieldName ) do
begin
if FieldName[ I ] in [ '0'..'9', '_', 'A'..'Z', 'a'..'z' ] then
NewName := NewName + FieldName[ I ];
end;
if ComponentExists( Owner, NewName ) then
begin
I := 1;
Done := False;
repeat
Inc( I );
if not ComponentExists( AOwner, NewName + IntToStr( I ) ) then
begin
Result := NewName + IntToStr( I );
Done := True;
end;
until Done;
end
else
Result := NewName;
end; { TInfoLOANTable.GenerateNewFieldName }
function TInfoLOANTable.CreateField( const FieldName : string ): TField;
begin
{ First, try to find an existing field object. FindField is the same }
{ as FieldByName, but does not raise an exception if the field object }
{ cannot be found. }
Result := FindField( FieldName );
if Result = nil then
begin
{ If an existing field object cannot be found... }
{ Instruct the FieldDefs object to create a new field object }
Result := FieldDefs.Find( FieldName ).CreateField( Owner );
{ The new field object must be given a name so that it may appear in }
{ the Object Inspector. The Delphi default naming convention is used.}
Result.Name := GenerateNewFieldName( Owner, Name, FieldName);
end;
end; { TInfoLOANTable.CreateField }
procedure TInfoLOANTable.CreateFields;
begin
FDFLender := CreateField( 'Lender' ) as TStringField;
FDFLoanNumber := CreateField( 'LoanNumber' ) as TStringField;
FDFModCount := CreateField( 'ModCount' ) as TSmallIntField;
FDFShortName := CreateField( 'ShortName' ) as TStringField;
FDFBranch := CreateField( 'Branch' ) as TStringField;
FDFName := CreateField( 'Name' ) as TStringField;
FDFAddress1 := CreateField( 'Address1' ) as TStringField;
FDFAddress2 := CreateField( 'Address2' ) as TStringField;
FDFAddressSearch := CreateField( 'AddressSearch' ) as TStringField;
FDFCityState := CreateField( 'CityState' ) as TStringField;
FDFZipCode := CreateField( 'ZipCode' ) as TStringField;
FDFOfficer := CreateField( 'Officer' ) as TStringField;
FDFOfficer2 := CreateField( 'Officer2' ) as TStringField;
FDFLoanDate := CreateField( 'LoanDate' ) as TStringField;
FDFMaturityDate := CreateField( 'MaturityDate' ) as TStringField;
FDFCollateralInUse := CreateField( 'CollateralInUse' ) as TStringField;
FDFCollateralCode := CreateField( 'CollateralCode' ) as TStringField;
FDFAction := CreateField( 'Action' ) as TStringField;
FDFCompanyAgent := CreateField( 'CompanyAgent' ) as TStringField;
FDFPolicy := CreateField( 'Policy' ) as TStringField;
FDFEffDate := CreateField( 'EffDate' ) as TStringField;
FDFExpDate := CreateField( 'ExpDate' ) as TStringField;
FDFBatchdate := CreateField( 'Batchdate' ) as TStringField;
FDFEntry := CreateField( 'Entry' ) as TIntegerField;
FDFDocumentID := CreateField( 'DocumentID' ) as TStringField;
FDFMailDate := CreateField( 'MailDate' ) as TStringField;
FDFUserId := CreateField( 'UserId' ) as TStringField;
FDFBalance := CreateField( 'Balance' ) as TCurrencyField;
FDFBalanceDate := CreateField( 'BalanceDate' ) as TStringField;
FDFInterestRate := CreateField( 'InterestRate' ) as TStringField;
FDFRate := CreateField( 'Rate' ) as TStringField;
FDFVSIStatus := CreateField( 'VSIStatus' ) as TStringField;
FDFVSINoticeType := CreateField( 'VSINoticeType' ) as TStringField;
FDFVSIDate := CreateField( 'VSIDate' ) as TStringField;
FDFWaivedStatus := CreateField( 'WaivedStatus' ) as TStringField;
FDFInsuranceStatus := CreateField( 'InsuranceStatus' ) as TStringField;
FDFOldInsuranceStatus := CreateField( 'OldInsuranceStatus' ) as TStringField;
FDFLoanStatus := CreateField( 'LoanStatus' ) as TStringField;
FDFStatusDate := CreateField( 'StatusDate' ) as TStringField;
FDFAddSrc := CreateField( 'AddSrc' ) as TStringField;
FDFInterestOption := CreateField( 'InterestOption' ) as TStringField;
FDFMethod := CreateField( 'Method' ) as TStringField;
FDFReqBal := CreateField( 'ReqBal' ) as TStringField;
FDFMissingDataList := CreateField( 'MissingDataList' ) as TStringField;
FDFSpecialApprovalList := CreateField( 'SpecialApprovalList' ) as TStringField;
FDFRunEvents := CreateField( 'RunEvents' ) as TStringField;
FDFHoldNotice := CreateField( 'HoldNotice' ) as TStringField;
FDFForcedPlacedStatus := CreateField( 'ForcedPlacedStatus' ) as TStringField;
FDFTransId := CreateField( 'TransId' ) as TStringField;
FDFSystemHistDate := CreateField( 'SystemHistDate' ) as TStringField;
FDFSystemTime := CreateField( 'SystemTime' ) as TStringField;
FDFVSIPremiumBalance := CreateField( 'VSIPremiumBalance' ) as TIntegerField;
FDFVSIBalanceDate := CreateField( 'VSIBalanceDate' ) as TStringField;
FDFVSIRate := CreateField( 'VSIRate' ) as TStringField;
FDFVSIIncpt := CreateField( 'VSIIncpt' ) as TStringField;
FDFVSIExpirationdate := CreateField( 'VSIExpirationdate' ) as TStringField;
FDFVSITerm := CreateField( 'VSITerm' ) as TIntegerField;
FDFVSIOneYr := CreateField( 'VSIOneYr' ) as TStringField;
FDFComment := CreateField( 'Comment' ) as TStringField;
end; { TInfoLOANTable.CreateFields }
procedure TInfoLOANTable.SetActive(Value: Boolean);
begin
inherited SetActive(Value);
if Active then
CreateFields;
end; { TInfoLOANTable.SetActive }
procedure TInfoLOANTable.SetPLender(const Value: String);
begin
DFLender.Value := Value;
end;
function TInfoLOANTable.GetPLender:String;
begin
result := DFLender.Value;
end;
procedure TInfoLOANTable.SetPLoanNumber(const Value: String);
begin
DFLoanNumber.Value := Value;
end;
function TInfoLOANTable.GetPLoanNumber:String;
begin
result := DFLoanNumber.Value;
end;
procedure TInfoLOANTable.SetPModCount(const Value: SmallInt);
begin
DFModCount.Value := Value;
end;
function TInfoLOANTable.GetPModCount:SmallInt;
begin
result := DFModCount.Value;
end;
procedure TInfoLOANTable.SetPShortName(const Value: String);
begin
DFShortName.Value := Value;
end;
function TInfoLOANTable.GetPShortName:String;
begin
result := DFShortName.Value;
end;
procedure TInfoLOANTable.SetPBranch(const Value: String);
begin
DFBranch.Value := Value;
end;
function TInfoLOANTable.GetPBranch:String;
begin
result := DFBranch.Value;
end;
procedure TInfoLOANTable.SetPName(const Value: String);
begin
DFName.Value := Value;
end;
function TInfoLOANTable.GetPName:String;
begin
result := DFName.Value;
end;
procedure TInfoLOANTable.SetPAddress1(const Value: String);
begin
DFAddress1.Value := Value;
end;
function TInfoLOANTable.GetPAddress1:String;
begin
result := DFAddress1.Value;
end;
procedure TInfoLOANTable.SetPAddress2(const Value: String);
begin
DFAddress2.Value := Value;
end;
function TInfoLOANTable.GetPAddress2:String;
begin
result := DFAddress2.Value;
end;
procedure TInfoLOANTable.SetPAddressSearch(const Value: String);
begin
DFAddressSearch.Value := Value;
end;
function TInfoLOANTable.GetPAddressSearch:String;
begin
result := DFAddressSearch.Value;
end;
procedure TInfoLOANTable.SetPCityState(const Value: String);
begin
DFCityState.Value := Value;
end;
function TInfoLOANTable.GetPCityState:String;
begin
result := DFCityState.Value;
end;
procedure TInfoLOANTable.SetPZipCode(const Value: String);
begin
DFZipCode.Value := Value;
end;
function TInfoLOANTable.GetPZipCode:String;
begin
result := DFZipCode.Value;
end;
procedure TInfoLOANTable.SetPOfficer(const Value: String);
begin
DFOfficer.Value := Value;
end;
function TInfoLOANTable.GetPOfficer:String;
begin
result := DFOfficer.Value;
end;
procedure TInfoLOANTable.SetPOfficer2(const Value: String);
begin
DFOfficer2.Value := Value;
end;
function TInfoLOANTable.GetPOfficer2:String;
begin
result := DFOfficer2.Value;
end;
procedure TInfoLOANTable.SetPLoanDate(const Value: String);
begin
DFLoanDate.Value := Value;
end;
function TInfoLOANTable.GetPLoanDate:String;
begin
result := DFLoanDate.Value;
end;
procedure TInfoLOANTable.SetPMaturityDate(const Value: String);
begin
DFMaturityDate.Value := Value;
end;
function TInfoLOANTable.GetPMaturityDate:String;
begin
result := DFMaturityDate.Value;
end;
procedure TInfoLOANTable.SetPCollateralInUse(const Value: String);
begin
DFCollateralInUse.Value := Value;
end;
function TInfoLOANTable.GetPCollateralInUse:String;
begin
result := DFCollateralInUse.Value;
end;
procedure TInfoLOANTable.SetPCollateralCode(const Value: String);
begin
DFCollateralCode.Value := Value;
end;
function TInfoLOANTable.GetPCollateralCode:String;
begin
result := DFCollateralCode.Value;
end;
procedure TInfoLOANTable.SetPAction(const Value: String);
begin
DFAction.Value := Value;
end;
function TInfoLOANTable.GetPAction:String;
begin
result := DFAction.Value;
end;
procedure TInfoLOANTable.SetPCompanyAgent(const Value: String);
begin
DFCompanyAgent.Value := Value;
end;
function TInfoLOANTable.GetPCompanyAgent:String;
begin
result := DFCompanyAgent.Value;
end;
procedure TInfoLOANTable.SetPPolicy(const Value: String);
begin
DFPolicy.Value := Value;
end;
function TInfoLOANTable.GetPPolicy:String;
begin
result := DFPolicy.Value;
end;
procedure TInfoLOANTable.SetPEffDate(const Value: String);
begin
DFEffDate.Value := Value;
end;
function TInfoLOANTable.GetPEffDate:String;
begin
result := DFEffDate.Value;
end;
procedure TInfoLOANTable.SetPExpDate(const Value: String);
begin
DFExpDate.Value := Value;
end;
function TInfoLOANTable.GetPExpDate:String;
begin
result := DFExpDate.Value;
end;
procedure TInfoLOANTable.SetPBatchdate(const Value: String);
begin
DFBatchdate.Value := Value;
end;
function TInfoLOANTable.GetPBatchdate:String;
begin
result := DFBatchdate.Value;
end;
procedure TInfoLOANTable.SetPEntry(const Value: Integer);
begin
DFEntry.Value := Value;
end;
function TInfoLOANTable.GetPEntry:Integer;
begin
result := DFEntry.Value;
end;
procedure TInfoLOANTable.SetPDocumentID(const Value: String);
begin
DFDocumentID.Value := Value;
end;
function TInfoLOANTable.GetPDocumentID:String;
begin
result := DFDocumentID.Value;
end;
procedure TInfoLOANTable.SetPMailDate(const Value: String);
begin
DFMailDate.Value := Value;
end;
function TInfoLOANTable.GetPMailDate:String;
begin
result := DFMailDate.Value;
end;
procedure TInfoLOANTable.SetPUserId(const Value: String);
begin
DFUserId.Value := Value;
end;
function TInfoLOANTable.GetPUserId:String;
begin
result := DFUserId.Value;
end;
procedure TInfoLOANTable.SetPBalance(const Value: Currency);
begin
DFBalance.Value := Value;
end;
function TInfoLOANTable.GetPBalance:Currency;
begin
result := DFBalance.Value;
end;
procedure TInfoLOANTable.SetPBalanceDate(const Value: String);
begin
DFBalanceDate.Value := Value;
end;
function TInfoLOANTable.GetPBalanceDate:String;
begin
result := DFBalanceDate.Value;
end;
procedure TInfoLOANTable.SetPInterestRate(const Value: String);
begin
DFInterestRate.Value := Value;
end;
function TInfoLOANTable.GetPInterestRate:String;
begin
result := DFInterestRate.Value;
end;
procedure TInfoLOANTable.SetPRate(const Value: String);
begin
DFRate.Value := Value;
end;
function TInfoLOANTable.GetPRate:String;
begin
result := DFRate.Value;
end;
procedure TInfoLOANTable.SetPVSIStatus(const Value: String);
begin
DFVSIStatus.Value := Value;
end;
function TInfoLOANTable.GetPVSIStatus:String;
begin
result := DFVSIStatus.Value;
end;
procedure TInfoLOANTable.SetPVSINoticeType(const Value: String);
begin
DFVSINoticeType.Value := Value;
end;
function TInfoLOANTable.GetPVSINoticeType:String;
begin
result := DFVSINoticeType.Value;
end;
procedure TInfoLOANTable.SetPVSIDate(const Value: String);
begin
DFVSIDate.Value := Value;
end;
function TInfoLOANTable.GetPVSIDate:String;
begin
result := DFVSIDate.Value;
end;
procedure TInfoLOANTable.SetPWaivedStatus(const Value: String);
begin
DFWaivedStatus.Value := Value;
end;
function TInfoLOANTable.GetPWaivedStatus:String;
begin
result := DFWaivedStatus.Value;
end;
procedure TInfoLOANTable.SetPInsuranceStatus(const Value: String);
begin
DFInsuranceStatus.Value := Value;
end;
function TInfoLOANTable.GetPInsuranceStatus:String;
begin
result := DFInsuranceStatus.Value;
end;
procedure TInfoLOANTable.SetPOldInsuranceStatus(const Value: String);
begin
DFOldInsuranceStatus.Value := Value;
end;
function TInfoLOANTable.GetPOldInsuranceStatus:String;
begin
result := DFOldInsuranceStatus.Value;
end;
procedure TInfoLOANTable.SetPLoanStatus(const Value: String);
begin
DFLoanStatus.Value := Value;
end;
function TInfoLOANTable.GetPLoanStatus:String;
begin
result := DFLoanStatus.Value;
end;
procedure TInfoLOANTable.SetPStatusDate(const Value: String);
begin
DFStatusDate.Value := Value;
end;
function TInfoLOANTable.GetPStatusDate:String;
begin
result := DFStatusDate.Value;
end;
procedure TInfoLOANTable.SetPAddSrc(const Value: String);
begin
DFAddSrc.Value := Value;
end;
function TInfoLOANTable.GetPAddSrc:String;
begin
result := DFAddSrc.Value;
end;
procedure TInfoLOANTable.SetPInterestOption(const Value: String);
begin
DFInterestOption.Value := Value;
end;
function TInfoLOANTable.GetPInterestOption:String;
begin
result := DFInterestOption.Value;
end;
procedure TInfoLOANTable.SetPMethod(const Value: String);
begin
DFMethod.Value := Value;
end;
function TInfoLOANTable.GetPMethod:String;
begin
result := DFMethod.Value;
end;
procedure TInfoLOANTable.SetPReqBal(const Value: String);
begin
DFReqBal.Value := Value;
end;
function TInfoLOANTable.GetPReqBal:String;
begin
result := DFReqBal.Value;
end;
procedure TInfoLOANTable.SetPMissingDataList(const Value: String);
begin
DFMissingDataList.Value := Value;
end;
function TInfoLOANTable.GetPMissingDataList:String;
begin
result := DFMissingDataList.Value;
end;
procedure TInfoLOANTable.SetPSpecialApprovalList(const Value: String);
begin
DFSpecialApprovalList.Value := Value;
end;
function TInfoLOANTable.GetPSpecialApprovalList:String;
begin
result := DFSpecialApprovalList.Value;
end;
procedure TInfoLOANTable.SetPRunEvents(const Value: String);
begin
DFRunEvents.Value := Value;
end;
function TInfoLOANTable.GetPRunEvents:String;
begin
result := DFRunEvents.Value;
end;
procedure TInfoLOANTable.SetPHoldNotice(const Value: String);
begin
DFHoldNotice.Value := Value;
end;
function TInfoLOANTable.GetPHoldNotice:String;
begin
result := DFHoldNotice.Value;
end;
procedure TInfoLOANTable.SetPForcedPlacedStatus(const Value: String);
begin
DFForcedPlacedStatus.Value := Value;
end;
function TInfoLOANTable.GetPForcedPlacedStatus:String;
begin
result := DFForcedPlacedStatus.Value;
end;
procedure TInfoLOANTable.SetPTransId(const Value: String);
begin
DFTransId.Value := Value;
end;
function TInfoLOANTable.GetPTransId:String;
begin
result := DFTransId.Value;
end;
procedure TInfoLOANTable.SetPSystemHistDate(const Value: String);
begin
DFSystemHistDate.Value := Value;
end;
function TInfoLOANTable.GetPSystemHistDate:String;
begin
result := DFSystemHistDate.Value;
end;
procedure TInfoLOANTable.SetPSystemTime(const Value: String);
begin
DFSystemTime.Value := Value;
end;
function TInfoLOANTable.GetPSystemTime:String;
begin
result := DFSystemTime.Value;
end;
procedure TInfoLOANTable.SetPVSIPremiumBalance(const Value: Integer);
begin
DFVSIPremiumBalance.Value := Value;
end;
function TInfoLOANTable.GetPVSIPremiumBalance:Integer;
begin
result := DFVSIPremiumBalance.Value;
end;
procedure TInfoLOANTable.SetPVSIBalanceDate(const Value: String);
begin
DFVSIBalanceDate.Value := Value;
end;
function TInfoLOANTable.GetPVSIBalanceDate:String;
begin
result := DFVSIBalanceDate.Value;
end;
procedure TInfoLOANTable.SetPVSIRate(const Value: String);
begin
DFVSIRate.Value := Value;
end;
function TInfoLOANTable.GetPVSIRate:String;
begin
result := DFVSIRate.Value;
end;
procedure TInfoLOANTable.SetPVSIIncpt(const Value: String);
begin
DFVSIIncpt.Value := Value;
end;
function TInfoLOANTable.GetPVSIIncpt:String;
begin
result := DFVSIIncpt.Value;
end;
procedure TInfoLOANTable.SetPVSIExpirationdate(const Value: String);
begin
DFVSIExpirationdate.Value := Value;
end;
function TInfoLOANTable.GetPVSIExpirationdate:String;
begin
result := DFVSIExpirationdate.Value;
end;
procedure TInfoLOANTable.SetPVSITerm(const Value: Integer);
begin
DFVSITerm.Value := Value;
end;
function TInfoLOANTable.GetPVSITerm:Integer;
begin
result := DFVSITerm.Value;
end;
procedure TInfoLOANTable.SetPVSIOneYr(const Value: String);
begin
DFVSIOneYr.Value := Value;
end;
function TInfoLOANTable.GetPVSIOneYr:String;
begin
result := DFVSIOneYr.Value;
end;
procedure TInfoLOANTable.SetPComment(const Value: String);
begin
DFComment.Value := Value;
end;
function TInfoLOANTable.GetPComment:String;
begin
result := DFComment.Value;
end;
procedure TInfoLOANTable.LoadFieldDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('Lender, String, 4, N');
Add('LoanNumber, String, 18, N');
Add('ModCount, SmallInt, 0, N');
Add('ShortName, String, 15, N');
Add('Branch, String, 6, N');
Add('Name, String, 30, N');
Add('Address1, String, 30, N');
Add('Address2, String, 30, N');
Add('AddressSearch, String, 15, N');
Add('CityState, String, 25, N');
Add('ZipCode, String, 9, N');
Add('Officer, String, 6, N');
Add('Officer2, String, 6, N');
Add('LoanDate, String, 8, N');
Add('MaturityDate, String, 8, N');
Add('CollateralInUse, String, 1, N');
Add('CollateralCode, String, 10, N');
Add('Action, String, 1, N');
Add('CompanyAgent, String, 20, N');
Add('Policy, String, 15, N');
Add('EffDate, String, 8, N');
Add('ExpDate, String, 8, N');
Add('Batchdate, String, 8, N');
Add('Entry, Integer, 0, N');
Add('DocumentID, String, 6, N');
Add('MailDate, String, 8, N');
Add('UserId, String, 6, N');
Add('Balance, Currency, 0, N');
Add('BalanceDate, String, 8, N');
Add('InterestRate, String, 4, N');
Add('Rate, String, 2, N');
Add('VSIStatus, String, 2, N');
Add('VSINoticeType, String, 1, N');
Add('VSIDate, String, 8, N');
Add('WaivedStatus, String, 1, N');
Add('InsuranceStatus, String, 1, N');
Add('OldInsuranceStatus, String, 1, N');
Add('LoanStatus, String, 1, N');
Add('StatusDate, String, 8, N');
Add('AddSrc, String, 1, N');
Add('InterestOption, String, 1, N');
Add('Method, String, 4, N');
Add('ReqBal, String, 1, N');
Add('MissingDataList, String, 1, N');
Add('SpecialApprovalList, String, 1, N');
Add('RunEvents, String, 8, N');
Add('HoldNotice, String, 1, N');
Add('ForcedPlacedStatus, String, 1, N');
Add('TransId, String, 5, N');
Add('SystemHistDate, String, 8, N');
Add('SystemTime, String, 6, N');
Add('VSIPremiumBalance, Integer, 0, N');
Add('VSIBalanceDate, String, 8, N');
Add('VSIRate, String, 2, N');
Add('VSIIncpt, String, 6, N');
Add('VSIExpirationdate, String, 8, N');
Add('VSITerm, Integer, 0, N');
Add('VSIOneYr, String, 1, N');
Add('Comment, String, 30, N');
end;
end;
procedure TInfoLOANTable.LoadIndexDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('PrimaryKey, Lender;LoanNumber, Y, Y, N, N');
Add('LendShortName, Lender;ShortName, N, N, N, N');
Add('LendPolicy, Lender;Policy, N, N, N, N');
Add('LendAddress, Lender;AddressSearch, N, N, N, N');
end;
end;
procedure TInfoLOANTable.SetEnumIndex(Value: TEIInfoLOAN);
begin
case Value of
InfoLOANPrimaryKey : IndexName := '';
InfoLOANLendShortName : IndexName := 'LendShortName';
InfoLOANLendPolicy : IndexName := 'LendPolicy';
InfoLOANLendAddress : IndexName := 'LendAddress';
end;
end;
function TInfoLOANTable.GetDataBuffer:TInfoLOANRecord;
var buf: TInfoLOANRecord;
begin
fillchar(buf, sizeof(buf), 0);
buf.PLender := DFLender.Value;
buf.PLoanNumber := DFLoanNumber.Value;
buf.PModCount := DFModCount.Value;
buf.PShortName := DFShortName.Value;
buf.PBranch := DFBranch.Value;
buf.PName := DFName.Value;
buf.PAddress1 := DFAddress1.Value;
buf.PAddress2 := DFAddress2.Value;
buf.PAddressSearch := DFAddressSearch.Value;
buf.PCityState := DFCityState.Value;
buf.PZipCode := DFZipCode.Value;
buf.POfficer := DFOfficer.Value;
buf.POfficer2 := DFOfficer2.Value;
buf.PLoanDate := DFLoanDate.Value;
buf.PMaturityDate := DFMaturityDate.Value;
buf.PCollateralInUse := DFCollateralInUse.Value;
buf.PCollateralCode := DFCollateralCode.Value;
buf.PAction := DFAction.Value;
buf.PCompanyAgent := DFCompanyAgent.Value;
buf.PPolicy := DFPolicy.Value;
buf.PEffDate := DFEffDate.Value;
buf.PExpDate := DFExpDate.Value;
buf.PBatchdate := DFBatchdate.Value;
buf.PEntry := DFEntry.Value;
buf.PDocumentID := DFDocumentID.Value;
buf.PMailDate := DFMailDate.Value;
buf.PUserId := DFUserId.Value;
buf.PBalance := DFBalance.Value;
buf.PBalanceDate := DFBalanceDate.Value;
buf.PInterestRate := DFInterestRate.Value;
buf.PRate := DFRate.Value;
buf.PVSIStatus := DFVSIStatus.Value;
buf.PVSINoticeType := DFVSINoticeType.Value;
buf.PVSIDate := DFVSIDate.Value;
buf.PWaivedStatus := DFWaivedStatus.Value;
buf.PInsuranceStatus := DFInsuranceStatus.Value;
buf.POldInsuranceStatus := DFOldInsuranceStatus.Value;
buf.PLoanStatus := DFLoanStatus.Value;
buf.PStatusDate := DFStatusDate.Value;
buf.PAddSrc := DFAddSrc.Value;
buf.PInterestOption := DFInterestOption.Value;
buf.PMethod := DFMethod.Value;
buf.PReqBal := DFReqBal.Value;
buf.PMissingDataList := DFMissingDataList.Value;
buf.PSpecialApprovalList := DFSpecialApprovalList.Value;
buf.PRunEvents := DFRunEvents.Value;
buf.PHoldNotice := DFHoldNotice.Value;
buf.PForcedPlacedStatus := DFForcedPlacedStatus.Value;
buf.PTransId := DFTransId.Value;
buf.PSystemHistDate := DFSystemHistDate.Value;
buf.PSystemTime := DFSystemTime.Value;
buf.PVSIPremiumBalance := DFVSIPremiumBalance.Value;
buf.PVSIBalanceDate := DFVSIBalanceDate.Value;
buf.PVSIRate := DFVSIRate.Value;
buf.PVSIIncpt := DFVSIIncpt.Value;
buf.PVSIExpirationdate := DFVSIExpirationdate.Value;
buf.PVSITerm := DFVSITerm.Value;
buf.PVSIOneYr := DFVSIOneYr.Value;
buf.PComment := DFComment.Value;
result := buf;
end;
procedure TInfoLOANTable.StoreDataBuffer(ABuffer:TInfoLOANRecord);
begin
DFLender.Value := ABuffer.PLender;
DFLoanNumber.Value := ABuffer.PLoanNumber;
DFModCount.Value := ABuffer.PModCount;
DFShortName.Value := ABuffer.PShortName;
DFBranch.Value := ABuffer.PBranch;
DFName.Value := ABuffer.PName;
DFAddress1.Value := ABuffer.PAddress1;
DFAddress2.Value := ABuffer.PAddress2;
DFAddressSearch.Value := ABuffer.PAddressSearch;
DFCityState.Value := ABuffer.PCityState;
DFZipCode.Value := ABuffer.PZipCode;
DFOfficer.Value := ABuffer.POfficer;
DFOfficer2.Value := ABuffer.POfficer2;
DFLoanDate.Value := ABuffer.PLoanDate;
DFMaturityDate.Value := ABuffer.PMaturityDate;
DFCollateralInUse.Value := ABuffer.PCollateralInUse;
DFCollateralCode.Value := ABuffer.PCollateralCode;
DFAction.Value := ABuffer.PAction;
DFCompanyAgent.Value := ABuffer.PCompanyAgent;
DFPolicy.Value := ABuffer.PPolicy;
DFEffDate.Value := ABuffer.PEffDate;
DFExpDate.Value := ABuffer.PExpDate;
DFBatchdate.Value := ABuffer.PBatchdate;
DFEntry.Value := ABuffer.PEntry;
DFDocumentID.Value := ABuffer.PDocumentID;
DFMailDate.Value := ABuffer.PMailDate;
DFUserId.Value := ABuffer.PUserId;
DFBalance.Value := ABuffer.PBalance;
DFBalanceDate.Value := ABuffer.PBalanceDate;
DFInterestRate.Value := ABuffer.PInterestRate;
DFRate.Value := ABuffer.PRate;
DFVSIStatus.Value := ABuffer.PVSIStatus;
DFVSINoticeType.Value := ABuffer.PVSINoticeType;
DFVSIDate.Value := ABuffer.PVSIDate;
DFWaivedStatus.Value := ABuffer.PWaivedStatus;
DFInsuranceStatus.Value := ABuffer.PInsuranceStatus;
DFOldInsuranceStatus.Value := ABuffer.POldInsuranceStatus;
DFLoanStatus.Value := ABuffer.PLoanStatus;
DFStatusDate.Value := ABuffer.PStatusDate;
DFAddSrc.Value := ABuffer.PAddSrc;
DFInterestOption.Value := ABuffer.PInterestOption;
DFMethod.Value := ABuffer.PMethod;
DFReqBal.Value := ABuffer.PReqBal;
DFMissingDataList.Value := ABuffer.PMissingDataList;
DFSpecialApprovalList.Value := ABuffer.PSpecialApprovalList;
DFRunEvents.Value := ABuffer.PRunEvents;
DFHoldNotice.Value := ABuffer.PHoldNotice;
DFForcedPlacedStatus.Value := ABuffer.PForcedPlacedStatus;
DFTransId.Value := ABuffer.PTransId;
DFSystemHistDate.Value := ABuffer.PSystemHistDate;
DFSystemTime.Value := ABuffer.PSystemTime;
DFVSIPremiumBalance.Value := ABuffer.PVSIPremiumBalance;
DFVSIBalanceDate.Value := ABuffer.PVSIBalanceDate;
DFVSIRate.Value := ABuffer.PVSIRate;
DFVSIIncpt.Value := ABuffer.PVSIIncpt;
DFVSIExpirationdate.Value := ABuffer.PVSIExpirationdate;
DFVSITerm.Value := ABuffer.PVSITerm;
DFVSIOneYr.Value := ABuffer.PVSIOneYr;
DFComment.Value := ABuffer.PComment;
end;
function TInfoLOANTable.GetEnumIndex: TEIInfoLOAN;
var iname : string;
begin
result := InfoLOANPrimaryKey;
iname := uppercase(indexname);
if iname = '' then result := InfoLOANPrimaryKey;
if iname = 'LENDSHORTNAME' then result := InfoLOANLendShortName;
if iname = 'LENDPOLICY' then result := InfoLOANLendPolicy;
if iname = 'LENDADDRESS' then result := InfoLOANLendAddress;
end;
function TInfoLOANQuery.GenerateNewFieldName( AOwner: TComponent; const DatasetName: string; const FieldName: string ): string;
var
I: Integer;
NewName: string;
Done: Boolean;
function ComponentExists( AOwner: TComponent; const CompName: string ): Boolean;
var
I: Integer;
begin
Result := False;
for I := 0 To AOwner.ComponentCount - 1 do
begin
if AnsiCompareText( CompName, AOwner.Components[ I ].Name ) = 0 then
begin
Result := True;
Break;
end;
end;
end; { ComponentExists }
begin { TInfoLOANQuery.GenerateNewFieldName }
NewName := DatasetName;
for I := 1 to Length( FieldName ) do
begin
if FieldName[ I ] in [ '0'..'9', '_', 'A'..'Z', 'a'..'z' ] then
NewName := NewName + FieldName[ I ];
end;
if ComponentExists( Owner, NewName ) then
begin
I := 1;
Done := False;
repeat
Inc( I );
if not ComponentExists( AOwner, NewName + IntToStr( I ) ) then
begin
Result := NewName + IntToStr( I );
Done := True;
end;
until Done;
end
else
Result := NewName;
end; { TInfoLOANQuery.GenerateNewFieldName }
function TInfoLOANQuery.CreateField( const FieldName : string ): TField;
begin
{ First, try to find an existing field object. FindField is the same }
{ as FieldByName, but does not raise an exception if the field object }
{ cannot be found. }
Result := FindField( FieldName );
if Result = nil then
begin
{ If an existing field object cannot be found... }
{ Instruct the FieldDefs object to create a new field object }
Result := FieldDefs.Find( FieldName ).CreateField( Owner );
{ The new field object must be given a name so that it may appear in }
{ the Object Inspector. The Delphi default naming convention is used.}
Result.Name := GenerateNewFieldName( Owner, Name, FieldName);
end;
end; { TInfoLOANQuery.CreateField }
procedure TInfoLOANQuery.CreateFields;
begin
FDFLender := CreateField( 'Lender' ) as TStringField;
FDFLoanNumber := CreateField( 'LoanNumber' ) as TStringField;
FDFModCount := CreateField( 'ModCount' ) as TSmallIntField;
FDFShortName := CreateField( 'ShortName' ) as TStringField;
FDFBranch := CreateField( 'Branch' ) as TStringField;
FDFName := CreateField( 'Name' ) as TStringField;
FDFAddress1 := CreateField( 'Address1' ) as TStringField;
FDFAddress2 := CreateField( 'Address2' ) as TStringField;
FDFAddressSearch := CreateField( 'AddressSearch' ) as TStringField;
FDFCityState := CreateField( 'CityState' ) as TStringField;
FDFZipCode := CreateField( 'ZipCode' ) as TStringField;
FDFOfficer := CreateField( 'Officer' ) as TStringField;
FDFOfficer2 := CreateField( 'Officer2' ) as TStringField;
FDFLoanDate := CreateField( 'LoanDate' ) as TStringField;
FDFMaturityDate := CreateField( 'MaturityDate' ) as TStringField;
FDFCollateralInUse := CreateField( 'CollateralInUse' ) as TStringField;
FDFCollateralCode := CreateField( 'CollateralCode' ) as TStringField;
FDFAction := CreateField( 'Action' ) as TStringField;
FDFCompanyAgent := CreateField( 'CompanyAgent' ) as TStringField;
FDFPolicy := CreateField( 'Policy' ) as TStringField;
FDFEffDate := CreateField( 'EffDate' ) as TStringField;
FDFExpDate := CreateField( 'ExpDate' ) as TStringField;
FDFBatchdate := CreateField( 'Batchdate' ) as TStringField;
FDFEntry := CreateField( 'Entry' ) as TIntegerField;
FDFDocumentID := CreateField( 'DocumentID' ) as TStringField;
FDFMailDate := CreateField( 'MailDate' ) as TStringField;
FDFUserId := CreateField( 'UserId' ) as TStringField;
FDFBalance := CreateField( 'Balance' ) as TCurrencyField;
FDFBalanceDate := CreateField( 'BalanceDate' ) as TStringField;
FDFInterestRate := CreateField( 'InterestRate' ) as TStringField;
FDFRate := CreateField( 'Rate' ) as TStringField;
FDFVSIStatus := CreateField( 'VSIStatus' ) as TStringField;
FDFVSINoticeType := CreateField( 'VSINoticeType' ) as TStringField;
FDFVSIDate := CreateField( 'VSIDate' ) as TStringField;
FDFWaivedStatus := CreateField( 'WaivedStatus' ) as TStringField;
FDFInsuranceStatus := CreateField( 'InsuranceStatus' ) as TStringField;
FDFOldInsuranceStatus := CreateField( 'OldInsuranceStatus' ) as TStringField;
FDFLoanStatus := CreateField( 'LoanStatus' ) as TStringField;
FDFStatusDate := CreateField( 'StatusDate' ) as TStringField;
FDFAddSrc := CreateField( 'AddSrc' ) as TStringField;
FDFInterestOption := CreateField( 'InterestOption' ) as TStringField;
FDFMethod := CreateField( 'Method' ) as TStringField;
FDFReqBal := CreateField( 'ReqBal' ) as TStringField;
FDFMissingDataList := CreateField( 'MissingDataList' ) as TStringField;
FDFSpecialApprovalList := CreateField( 'SpecialApprovalList' ) as TStringField;
FDFRunEvents := CreateField( 'RunEvents' ) as TStringField;
FDFHoldNotice := CreateField( 'HoldNotice' ) as TStringField;
FDFForcedPlacedStatus := CreateField( 'ForcedPlacedStatus' ) as TStringField;
FDFTransId := CreateField( 'TransId' ) as TStringField;
FDFSystemHistDate := CreateField( 'SystemHistDate' ) as TStringField;
FDFSystemTime := CreateField( 'SystemTime' ) as TStringField;
FDFVSIPremiumBalance := CreateField( 'VSIPremiumBalance' ) as TIntegerField;
FDFVSIBalanceDate := CreateField( 'VSIBalanceDate' ) as TStringField;
FDFVSIRate := CreateField( 'VSIRate' ) as TStringField;
FDFVSIIncpt := CreateField( 'VSIIncpt' ) as TStringField;
FDFVSIExpirationdate := CreateField( 'VSIExpirationdate' ) as TStringField;
FDFVSITerm := CreateField( 'VSITerm' ) as TIntegerField;
FDFVSIOneYr := CreateField( 'VSIOneYr' ) as TStringField;
FDFComment := CreateField( 'Comment' ) as TStringField;
end; { TInfoLOANQuery.CreateFields }
procedure TInfoLOANQuery.SetActive(Value: Boolean);
begin
inherited SetActive(Value);
if Active then
CreateFields;
end; { TInfoLOANQuery.SetActive }
procedure TInfoLOANQuery.SetPLender(const Value: String);
begin
DFLender.Value := Value;
end;
function TInfoLOANQuery.GetPLender:String;
begin
result := DFLender.Value;
end;
procedure TInfoLOANQuery.SetPLoanNumber(const Value: String);
begin
DFLoanNumber.Value := Value;
end;
function TInfoLOANQuery.GetPLoanNumber:String;
begin
result := DFLoanNumber.Value;
end;
procedure TInfoLOANQuery.SetPModCount(const Value: SmallInt);
begin
DFModCount.Value := Value;
end;
function TInfoLOANQuery.GetPModCount:SmallInt;
begin
result := DFModCount.Value;
end;
procedure TInfoLOANQuery.SetPShortName(const Value: String);
begin
DFShortName.Value := Value;
end;
function TInfoLOANQuery.GetPShortName:String;
begin
result := DFShortName.Value;
end;
procedure TInfoLOANQuery.SetPBranch(const Value: String);
begin
DFBranch.Value := Value;
end;
function TInfoLOANQuery.GetPBranch:String;
begin
result := DFBranch.Value;
end;
procedure TInfoLOANQuery.SetPName(const Value: String);
begin
DFName.Value := Value;
end;
function TInfoLOANQuery.GetPName:String;
begin
result := DFName.Value;
end;
procedure TInfoLOANQuery.SetPAddress1(const Value: String);
begin
DFAddress1.Value := Value;
end;
function TInfoLOANQuery.GetPAddress1:String;
begin
result := DFAddress1.Value;
end;
procedure TInfoLOANQuery.SetPAddress2(const Value: String);
begin
DFAddress2.Value := Value;
end;
function TInfoLOANQuery.GetPAddress2:String;
begin
result := DFAddress2.Value;
end;
procedure TInfoLOANQuery.SetPAddressSearch(const Value: String);
begin
DFAddressSearch.Value := Value;
end;
function TInfoLOANQuery.GetPAddressSearch:String;
begin
result := DFAddressSearch.Value;
end;
procedure TInfoLOANQuery.SetPCityState(const Value: String);
begin
DFCityState.Value := Value;
end;
function TInfoLOANQuery.GetPCityState:String;
begin
result := DFCityState.Value;
end;
procedure TInfoLOANQuery.SetPZipCode(const Value: String);
begin
DFZipCode.Value := Value;
end;
function TInfoLOANQuery.GetPZipCode:String;
begin
result := DFZipCode.Value;
end;
procedure TInfoLOANQuery.SetPOfficer(const Value: String);
begin
DFOfficer.Value := Value;
end;
function TInfoLOANQuery.GetPOfficer:String;
begin
result := DFOfficer.Value;
end;
procedure TInfoLOANQuery.SetPOfficer2(const Value: String);
begin
DFOfficer2.Value := Value;
end;
function TInfoLOANQuery.GetPOfficer2:String;
begin
result := DFOfficer2.Value;
end;
procedure TInfoLOANQuery.SetPLoanDate(const Value: String);
begin
DFLoanDate.Value := Value;
end;
function TInfoLOANQuery.GetPLoanDate:String;
begin
result := DFLoanDate.Value;
end;
procedure TInfoLOANQuery.SetPMaturityDate(const Value: String);
begin
DFMaturityDate.Value := Value;
end;
function TInfoLOANQuery.GetPMaturityDate:String;
begin
result := DFMaturityDate.Value;
end;
procedure TInfoLOANQuery.SetPCollateralInUse(const Value: String);
begin
DFCollateralInUse.Value := Value;
end;
function TInfoLOANQuery.GetPCollateralInUse:String;
begin
result := DFCollateralInUse.Value;
end;
procedure TInfoLOANQuery.SetPCollateralCode(const Value: String);
begin
DFCollateralCode.Value := Value;
end;
function TInfoLOANQuery.GetPCollateralCode:String;
begin
result := DFCollateralCode.Value;
end;
procedure TInfoLOANQuery.SetPAction(const Value: String);
begin
DFAction.Value := Value;
end;
function TInfoLOANQuery.GetPAction:String;
begin
result := DFAction.Value;
end;
procedure TInfoLOANQuery.SetPCompanyAgent(const Value: String);
begin
DFCompanyAgent.Value := Value;
end;
function TInfoLOANQuery.GetPCompanyAgent:String;
begin
result := DFCompanyAgent.Value;
end;
procedure TInfoLOANQuery.SetPPolicy(const Value: String);
begin
DFPolicy.Value := Value;
end;
function TInfoLOANQuery.GetPPolicy:String;
begin
result := DFPolicy.Value;
end;
procedure TInfoLOANQuery.SetPEffDate(const Value: String);
begin
DFEffDate.Value := Value;
end;
function TInfoLOANQuery.GetPEffDate:String;
begin
result := DFEffDate.Value;
end;
procedure TInfoLOANQuery.SetPExpDate(const Value: String);
begin
DFExpDate.Value := Value;
end;
function TInfoLOANQuery.GetPExpDate:String;
begin
result := DFExpDate.Value;
end;
procedure TInfoLOANQuery.SetPBatchdate(const Value: String);
begin
DFBatchdate.Value := Value;
end;
function TInfoLOANQuery.GetPBatchdate:String;
begin
result := DFBatchdate.Value;
end;
procedure TInfoLOANQuery.SetPEntry(const Value: Integer);
begin
DFEntry.Value := Value;
end;
function TInfoLOANQuery.GetPEntry:Integer;
begin
result := DFEntry.Value;
end;
procedure TInfoLOANQuery.SetPDocumentID(const Value: String);
begin
DFDocumentID.Value := Value;
end;
function TInfoLOANQuery.GetPDocumentID:String;
begin
result := DFDocumentID.Value;
end;
procedure TInfoLOANQuery.SetPMailDate(const Value: String);
begin
DFMailDate.Value := Value;
end;
function TInfoLOANQuery.GetPMailDate:String;
begin
result := DFMailDate.Value;
end;
procedure TInfoLOANQuery.SetPUserId(const Value: String);
begin
DFUserId.Value := Value;
end;
function TInfoLOANQuery.GetPUserId:String;
begin
result := DFUserId.Value;
end;
procedure TInfoLOANQuery.SetPBalance(const Value: Currency);
begin
DFBalance.Value := Value;
end;
function TInfoLOANQuery.GetPBalance:Currency;
begin
result := DFBalance.Value;
end;
procedure TInfoLOANQuery.SetPBalanceDate(const Value: String);
begin
DFBalanceDate.Value := Value;
end;
function TInfoLOANQuery.GetPBalanceDate:String;
begin
result := DFBalanceDate.Value;
end;
procedure TInfoLOANQuery.SetPInterestRate(const Value: String);
begin
DFInterestRate.Value := Value;
end;
function TInfoLOANQuery.GetPInterestRate:String;
begin
result := DFInterestRate.Value;
end;
procedure TInfoLOANQuery.SetPRate(const Value: String);
begin
DFRate.Value := Value;
end;
function TInfoLOANQuery.GetPRate:String;
begin
result := DFRate.Value;
end;
procedure TInfoLOANQuery.SetPVSIStatus(const Value: String);
begin
DFVSIStatus.Value := Value;
end;
function TInfoLOANQuery.GetPVSIStatus:String;
begin
result := DFVSIStatus.Value;
end;
procedure TInfoLOANQuery.SetPVSINoticeType(const Value: String);
begin
DFVSINoticeType.Value := Value;
end;
function TInfoLOANQuery.GetPVSINoticeType:String;
begin
result := DFVSINoticeType.Value;
end;
procedure TInfoLOANQuery.SetPVSIDate(const Value: String);
begin
DFVSIDate.Value := Value;
end;
function TInfoLOANQuery.GetPVSIDate:String;
begin
result := DFVSIDate.Value;
end;
procedure TInfoLOANQuery.SetPWaivedStatus(const Value: String);
begin
DFWaivedStatus.Value := Value;
end;
function TInfoLOANQuery.GetPWaivedStatus:String;
begin
result := DFWaivedStatus.Value;
end;
procedure TInfoLOANQuery.SetPInsuranceStatus(const Value: String);
begin
DFInsuranceStatus.Value := Value;
end;
function TInfoLOANQuery.GetPInsuranceStatus:String;
begin
result := DFInsuranceStatus.Value;
end;
procedure TInfoLOANQuery.SetPOldInsuranceStatus(const Value: String);
begin
DFOldInsuranceStatus.Value := Value;
end;
function TInfoLOANQuery.GetPOldInsuranceStatus:String;
begin
result := DFOldInsuranceStatus.Value;
end;
procedure TInfoLOANQuery.SetPLoanStatus(const Value: String);
begin
DFLoanStatus.Value := Value;
end;
function TInfoLOANQuery.GetPLoanStatus:String;
begin
result := DFLoanStatus.Value;
end;
procedure TInfoLOANQuery.SetPStatusDate(const Value: String);
begin
DFStatusDate.Value := Value;
end;
function TInfoLOANQuery.GetPStatusDate:String;
begin
result := DFStatusDate.Value;
end;
procedure TInfoLOANQuery.SetPAddSrc(const Value: String);
begin
DFAddSrc.Value := Value;
end;
function TInfoLOANQuery.GetPAddSrc:String;
begin
result := DFAddSrc.Value;
end;
procedure TInfoLOANQuery.SetPInterestOption(const Value: String);
begin
DFInterestOption.Value := Value;
end;
function TInfoLOANQuery.GetPInterestOption:String;
begin
result := DFInterestOption.Value;
end;
procedure TInfoLOANQuery.SetPMethod(const Value: String);
begin
DFMethod.Value := Value;
end;
function TInfoLOANQuery.GetPMethod:String;
begin
result := DFMethod.Value;
end;
procedure TInfoLOANQuery.SetPReqBal(const Value: String);
begin
DFReqBal.Value := Value;
end;
function TInfoLOANQuery.GetPReqBal:String;
begin
result := DFReqBal.Value;
end;
procedure TInfoLOANQuery.SetPMissingDataList(const Value: String);
begin
DFMissingDataList.Value := Value;
end;
function TInfoLOANQuery.GetPMissingDataList:String;
begin
result := DFMissingDataList.Value;
end;
procedure TInfoLOANQuery.SetPSpecialApprovalList(const Value: String);
begin
DFSpecialApprovalList.Value := Value;
end;
function TInfoLOANQuery.GetPSpecialApprovalList:String;
begin
result := DFSpecialApprovalList.Value;
end;
procedure TInfoLOANQuery.SetPRunEvents(const Value: String);
begin
DFRunEvents.Value := Value;
end;
function TInfoLOANQuery.GetPRunEvents:String;
begin
result := DFRunEvents.Value;
end;
procedure TInfoLOANQuery.SetPHoldNotice(const Value: String);
begin
DFHoldNotice.Value := Value;
end;
function TInfoLOANQuery.GetPHoldNotice:String;
begin
result := DFHoldNotice.Value;
end;
procedure TInfoLOANQuery.SetPForcedPlacedStatus(const Value: String);
begin
DFForcedPlacedStatus.Value := Value;
end;
function TInfoLOANQuery.GetPForcedPlacedStatus:String;
begin
result := DFForcedPlacedStatus.Value;
end;
procedure TInfoLOANQuery.SetPTransId(const Value: String);
begin
DFTransId.Value := Value;
end;
function TInfoLOANQuery.GetPTransId:String;
begin
result := DFTransId.Value;
end;
procedure TInfoLOANQuery.SetPSystemHistDate(const Value: String);
begin
DFSystemHistDate.Value := Value;
end;
function TInfoLOANQuery.GetPSystemHistDate:String;
begin
result := DFSystemHistDate.Value;
end;
procedure TInfoLOANQuery.SetPSystemTime(const Value: String);
begin
DFSystemTime.Value := Value;
end;
function TInfoLOANQuery.GetPSystemTime:String;
begin
result := DFSystemTime.Value;
end;
procedure TInfoLOANQuery.SetPVSIPremiumBalance(const Value: Integer);
begin
DFVSIPremiumBalance.Value := Value;
end;
function TInfoLOANQuery.GetPVSIPremiumBalance:Integer;
begin
result := DFVSIPremiumBalance.Value;
end;
procedure TInfoLOANQuery.SetPVSIBalanceDate(const Value: String);
begin
DFVSIBalanceDate.Value := Value;
end;
function TInfoLOANQuery.GetPVSIBalanceDate:String;
begin
result := DFVSIBalanceDate.Value;
end;
procedure TInfoLOANQuery.SetPVSIRate(const Value: String);
begin
DFVSIRate.Value := Value;
end;
function TInfoLOANQuery.GetPVSIRate:String;
begin
result := DFVSIRate.Value;
end;
procedure TInfoLOANQuery.SetPVSIIncpt(const Value: String);
begin
DFVSIIncpt.Value := Value;
end;
function TInfoLOANQuery.GetPVSIIncpt:String;
begin
result := DFVSIIncpt.Value;
end;
procedure TInfoLOANQuery.SetPVSIExpirationdate(const Value: String);
begin
DFVSIExpirationdate.Value := Value;
end;
function TInfoLOANQuery.GetPVSIExpirationdate:String;
begin
result := DFVSIExpirationdate.Value;
end;
procedure TInfoLOANQuery.SetPVSITerm(const Value: Integer);
begin
DFVSITerm.Value := Value;
end;
function TInfoLOANQuery.GetPVSITerm:Integer;
begin
result := DFVSITerm.Value;
end;
procedure TInfoLOANQuery.SetPVSIOneYr(const Value: String);
begin
DFVSIOneYr.Value := Value;
end;
function TInfoLOANQuery.GetPVSIOneYr:String;
begin
result := DFVSIOneYr.Value;
end;
procedure TInfoLOANQuery.SetPComment(const Value: String);
begin
DFComment.Value := Value;
end;
function TInfoLOANQuery.GetPComment:String;
begin
result := DFComment.Value;
end;
function TInfoLOANQuery.GetDataBuffer:TInfoLOANRecord;
var buf: TInfoLOANRecord;
begin
fillchar(buf, sizeof(buf), 0);
buf.PLender := DFLender.Value;
buf.PLoanNumber := DFLoanNumber.Value;
buf.PModCount := DFModCount.Value;
buf.PShortName := DFShortName.Value;
buf.PBranch := DFBranch.Value;
buf.PName := DFName.Value;
buf.PAddress1 := DFAddress1.Value;
buf.PAddress2 := DFAddress2.Value;
buf.PAddressSearch := DFAddressSearch.Value;
buf.PCityState := DFCityState.Value;
buf.PZipCode := DFZipCode.Value;
buf.POfficer := DFOfficer.Value;
buf.POfficer2 := DFOfficer2.Value;
buf.PLoanDate := DFLoanDate.Value;
buf.PMaturityDate := DFMaturityDate.Value;
buf.PCollateralInUse := DFCollateralInUse.Value;
buf.PCollateralCode := DFCollateralCode.Value;
buf.PAction := DFAction.Value;
buf.PCompanyAgent := DFCompanyAgent.Value;
buf.PPolicy := DFPolicy.Value;
buf.PEffDate := DFEffDate.Value;
buf.PExpDate := DFExpDate.Value;
buf.PBatchdate := DFBatchdate.Value;
buf.PEntry := DFEntry.Value;
buf.PDocumentID := DFDocumentID.Value;
buf.PMailDate := DFMailDate.Value;
buf.PUserId := DFUserId.Value;
buf.PBalance := DFBalance.Value;
buf.PBalanceDate := DFBalanceDate.Value;
buf.PInterestRate := DFInterestRate.Value;
buf.PRate := DFRate.Value;
buf.PVSIStatus := DFVSIStatus.Value;
buf.PVSINoticeType := DFVSINoticeType.Value;
buf.PVSIDate := DFVSIDate.Value;
buf.PWaivedStatus := DFWaivedStatus.Value;
buf.PInsuranceStatus := DFInsuranceStatus.Value;
buf.POldInsuranceStatus := DFOldInsuranceStatus.Value;
buf.PLoanStatus := DFLoanStatus.Value;
buf.PStatusDate := DFStatusDate.Value;
buf.PAddSrc := DFAddSrc.Value;
buf.PInterestOption := DFInterestOption.Value;
buf.PMethod := DFMethod.Value;
buf.PReqBal := DFReqBal.Value;
buf.PMissingDataList := DFMissingDataList.Value;
buf.PSpecialApprovalList := DFSpecialApprovalList.Value;
buf.PRunEvents := DFRunEvents.Value;
buf.PHoldNotice := DFHoldNotice.Value;
buf.PForcedPlacedStatus := DFForcedPlacedStatus.Value;
buf.PTransId := DFTransId.Value;
buf.PSystemHistDate := DFSystemHistDate.Value;
buf.PSystemTime := DFSystemTime.Value;
buf.PVSIPremiumBalance := DFVSIPremiumBalance.Value;
buf.PVSIBalanceDate := DFVSIBalanceDate.Value;
buf.PVSIRate := DFVSIRate.Value;
buf.PVSIIncpt := DFVSIIncpt.Value;
buf.PVSIExpirationdate := DFVSIExpirationdate.Value;
buf.PVSITerm := DFVSITerm.Value;
buf.PVSIOneYr := DFVSIOneYr.Value;
buf.PComment := DFComment.Value;
result := buf;
end;
procedure TInfoLOANQuery.StoreDataBuffer(ABuffer:TInfoLOANRecord);
begin
DFLender.Value := ABuffer.PLender;
DFLoanNumber.Value := ABuffer.PLoanNumber;
DFModCount.Value := ABuffer.PModCount;
DFShortName.Value := ABuffer.PShortName;
DFBranch.Value := ABuffer.PBranch;
DFName.Value := ABuffer.PName;
DFAddress1.Value := ABuffer.PAddress1;
DFAddress2.Value := ABuffer.PAddress2;
DFAddressSearch.Value := ABuffer.PAddressSearch;
DFCityState.Value := ABuffer.PCityState;
DFZipCode.Value := ABuffer.PZipCode;
DFOfficer.Value := ABuffer.POfficer;
DFOfficer2.Value := ABuffer.POfficer2;
DFLoanDate.Value := ABuffer.PLoanDate;
DFMaturityDate.Value := ABuffer.PMaturityDate;
DFCollateralInUse.Value := ABuffer.PCollateralInUse;
DFCollateralCode.Value := ABuffer.PCollateralCode;
DFAction.Value := ABuffer.PAction;
DFCompanyAgent.Value := ABuffer.PCompanyAgent;
DFPolicy.Value := ABuffer.PPolicy;
DFEffDate.Value := ABuffer.PEffDate;
DFExpDate.Value := ABuffer.PExpDate;
DFBatchdate.Value := ABuffer.PBatchdate;
DFEntry.Value := ABuffer.PEntry;
DFDocumentID.Value := ABuffer.PDocumentID;
DFMailDate.Value := ABuffer.PMailDate;
DFUserId.Value := ABuffer.PUserId;
DFBalance.Value := ABuffer.PBalance;
DFBalanceDate.Value := ABuffer.PBalanceDate;
DFInterestRate.Value := ABuffer.PInterestRate;
DFRate.Value := ABuffer.PRate;
DFVSIStatus.Value := ABuffer.PVSIStatus;
DFVSINoticeType.Value := ABuffer.PVSINoticeType;
DFVSIDate.Value := ABuffer.PVSIDate;
DFWaivedStatus.Value := ABuffer.PWaivedStatus;
DFInsuranceStatus.Value := ABuffer.PInsuranceStatus;
DFOldInsuranceStatus.Value := ABuffer.POldInsuranceStatus;
DFLoanStatus.Value := ABuffer.PLoanStatus;
DFStatusDate.Value := ABuffer.PStatusDate;
DFAddSrc.Value := ABuffer.PAddSrc;
DFInterestOption.Value := ABuffer.PInterestOption;
DFMethod.Value := ABuffer.PMethod;
DFReqBal.Value := ABuffer.PReqBal;
DFMissingDataList.Value := ABuffer.PMissingDataList;
DFSpecialApprovalList.Value := ABuffer.PSpecialApprovalList;
DFRunEvents.Value := ABuffer.PRunEvents;
DFHoldNotice.Value := ABuffer.PHoldNotice;
DFForcedPlacedStatus.Value := ABuffer.PForcedPlacedStatus;
DFTransId.Value := ABuffer.PTransId;
DFSystemHistDate.Value := ABuffer.PSystemHistDate;
DFSystemTime.Value := ABuffer.PSystemTime;
DFVSIPremiumBalance.Value := ABuffer.PVSIPremiumBalance;
DFVSIBalanceDate.Value := ABuffer.PVSIBalanceDate;
DFVSIRate.Value := ABuffer.PVSIRate;
DFVSIIncpt.Value := ABuffer.PVSIIncpt;
DFVSIExpirationdate.Value := ABuffer.PVSIExpirationdate;
DFVSITerm.Value := ABuffer.PVSITerm;
DFVSIOneYr.Value := ABuffer.PVSIOneYr;
DFComment.Value := ABuffer.PComment;
end;
(********************************************)
(************ Register Component ************)
(********************************************)
procedure Register;
begin
RegisterComponents( 'Info Tables', [ TInfoLOANTable, TInfoLOANQuery, TInfoLOANBuffer ] );
end; { Register }
function TInfoLOANBuffer.FieldNameToIndex(s:string):integer;
const flist:array[1..59] of string = ('LENDER','LOANNUMBER','MODCOUNT','SHORTNAME','BRANCH','NAME'
,'ADDRESS1','ADDRESS2','ADDRESSSEARCH','CITYSTATE','ZIPCODE'
,'OFFICER','OFFICER2','LOANDATE','MATURITYDATE','COLLATERALINUSE'
,'COLLATERALCODE','ACTION','COMPANYAGENT','POLICY','EFFDATE'
,'EXPDATE','BATCHDATE','ENTRY','DOCUMENTID','MAILDATE'
,'USERID','BALANCE','BALANCEDATE','INTERESTRATE','RATE'
,'VSISTATUS','VSINOTICETYPE','VSIDATE','WAIVEDSTATUS','INSURANCESTATUS'
,'OLDINSURANCESTATUS','LOANSTATUS','STATUSDATE','ADDSRC','INTERESTOPTION'
,'METHOD','REQBAL','MISSINGDATALIST','SPECIALAPPROVALLIST','RUNEVENTS'
,'HOLDNOTICE','FORCEDPLACEDSTATUS','TRANSID','SYSTEMHISTDATE','SYSTEMTIME'
,'VSIPREMIUMBALANCE','VSIBALANCEDATE','VSIRATE','VSIINCPT','VSIEXPIRATIONDATE'
,'VSITERM','VSIONEYR','COMMENT' );
var x : integer;
begin
s := uppercase(s);
x := 1;
while (x <= 59) and (flist[x] <> s) do inc(x);
if x <= 59 then result := x else result := 0;
end;
function TInfoLOANBuffer.FieldType(index:integer):TFieldType;
begin
result := ftUnknown;
case index of
1 : result := ftString;
2 : result := ftString;
3 : result := ftSmallInt;
4 : result := ftString;
5 : result := ftString;
6 : result := ftString;
7 : result := ftString;
8 : result := ftString;
9 : result := ftString;
10 : result := ftString;
11 : result := ftString;
12 : result := ftString;
13 : result := ftString;
14 : result := ftString;
15 : result := ftString;
16 : result := ftString;
17 : result := ftString;
18 : result := ftString;
19 : result := ftString;
20 : result := ftString;
21 : result := ftString;
22 : result := ftString;
23 : result := ftString;
24 : result := ftInteger;
25 : result := ftString;
26 : result := ftString;
27 : result := ftString;
28 : result := ftCurrency;
29 : result := ftString;
30 : result := ftString;
31 : result := ftString;
32 : result := ftString;
33 : result := ftString;
34 : result := ftString;
35 : result := ftString;
36 : result := ftString;
37 : result := ftString;
38 : result := ftString;
39 : result := ftString;
40 : result := ftString;
41 : result := ftString;
42 : result := ftString;
43 : result := ftString;
44 : result := ftString;
45 : result := ftString;
46 : result := ftString;
47 : result := ftString;
48 : result := ftString;
49 : result := ftString;
50 : result := ftString;
51 : result := ftString;
52 : result := ftInteger;
53 : result := ftString;
54 : result := ftString;
55 : result := ftString;
56 : result := ftString;
57 : result := ftInteger;
58 : result := ftString;
59 : result := ftString;
end;
end;
function TInfoLOANBuffer.PtrIndex(index:integer):Pointer;
begin
result := nil;
case index of
1 : result := @Data.PLender;
2 : result := @Data.PLoanNumber;
3 : result := @Data.PModCount;
4 : result := @Data.PShortName;
5 : result := @Data.PBranch;
6 : result := @Data.PName;
7 : result := @Data.PAddress1;
8 : result := @Data.PAddress2;
9 : result := @Data.PAddressSearch;
10 : result := @Data.PCityState;
11 : result := @Data.PZipCode;
12 : result := @Data.POfficer;
13 : result := @Data.POfficer2;
14 : result := @Data.PLoanDate;
15 : result := @Data.PMaturityDate;
16 : result := @Data.PCollateralInUse;
17 : result := @Data.PCollateralCode;
18 : result := @Data.PAction;
19 : result := @Data.PCompanyAgent;
20 : result := @Data.PPolicy;
21 : result := @Data.PEffDate;
22 : result := @Data.PExpDate;
23 : result := @Data.PBatchdate;
24 : result := @Data.PEntry;
25 : result := @Data.PDocumentID;
26 : result := @Data.PMailDate;
27 : result := @Data.PUserId;
28 : result := @Data.PBalance;
29 : result := @Data.PBalanceDate;
30 : result := @Data.PInterestRate;
31 : result := @Data.PRate;
32 : result := @Data.PVSIStatus;
33 : result := @Data.PVSINoticeType;
34 : result := @Data.PVSIDate;
35 : result := @Data.PWaivedStatus;
36 : result := @Data.PInsuranceStatus;
37 : result := @Data.POldInsuranceStatus;
38 : result := @Data.PLoanStatus;
39 : result := @Data.PStatusDate;
40 : result := @Data.PAddSrc;
41 : result := @Data.PInterestOption;
42 : result := @Data.PMethod;
43 : result := @Data.PReqBal;
44 : result := @Data.PMissingDataList;
45 : result := @Data.PSpecialApprovalList;
46 : result := @Data.PRunEvents;
47 : result := @Data.PHoldNotice;
48 : result := @Data.PForcedPlacedStatus;
49 : result := @Data.PTransId;
50 : result := @Data.PSystemHistDate;
51 : result := @Data.PSystemTime;
52 : result := @Data.PVSIPremiumBalance;
53 : result := @Data.PVSIBalanceDate;
54 : result := @Data.PVSIRate;
55 : result := @Data.PVSIIncpt;
56 : result := @Data.PVSIExpirationdate;
57 : result := @Data.PVSITerm;
58 : result := @Data.PVSIOneYr;
59 : result := @Data.PComment;
end;
end;
end.
|
unit D3DXErr;
//----------------------------------------------------------------------
//
// d3dxerr.pas -- 0xC code definitions for the D3DX API
//
// Copyright (c) 1991-1999, Microsoft Corp. All rights reserved.
//
//----------------------------------------------------------------------
interface
uses
Windows;
//
//
// Values are 32 bit values layed out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
const
FACILITY_D3DX = $877;
//
// MessageId: D3DXERR_NOMEMORY
//
// MessageText:
//
// Out of memory.
//
const
D3DXERR_NOMEMORY : HRESULT = $C8770BB8;
//
// MessageId: D3DXERR_NULLPOINTER
//
// MessageText:
//
// A NULL pointer was passed as a parameter.
//
const
D3DXERR_NULLPOINTER : HRESULT = $C8770BB9;
//
// MessageId: D3DXERR_INVALIDD3DXDEVICEINDEX
//
// MessageText:
//
// The Device Index passed in is invalid.
//
const
D3DXERR_INVALIDD3DXDEVICEINDEX : HRESULT = $C8770BBA;
//
// MessageId: D3DXERR_NODIRECTDRAWAVAILABLE
//
// MessageText:
//
// DirectDraw has not been created.
//
const
D3DXERR_NODIRECTDRAWAVAILABLE : HRESULT = $C8770BBB;
//
// MessageId: D3DXERR_NODIRECT3DAVAILABLE
//
// MessageText:
//
// Direct3D has not been created.
//
const
D3DXERR_NODIRECT3DAVAILABLE : HRESULT = $C8770BBC;
//
// MessageId: D3DXERR_NODIRECT3DDEVICEAVAILABLE
//
// MessageText:
//
// Direct3D device has not been created.
//
const
D3DXERR_NODIRECT3DDEVICEAVAILABLE : HRESULT = $C8770BBD;
//
// MessageId: D3DXERR_NOPRIMARYAVAILABLE
//
// MessageText:
//
// Primary surface has not been created.
//
const
D3DXERR_NOPRIMARYAVAILABLE : HRESULT = $C8770BBE;
//
// MessageId: D3DXERR_NOZBUFFERAVAILABLE
//
// MessageText:
//
// Z buffer has not been created.
//
const
D3DXERR_NOZBUFFERAVAILABLE : HRESULT = $C8770BBF;
//
// MessageId: D3DXERR_NOBACKBUFFERAVAILABLE
//
// MessageText:
//
// Backbuffer has not been created.
//
const
D3DXERR_NOBACKBUFFERAVAILABLE : HRESULT = $C8770BC0;
//
// MessageId: D3DXERR_COULDNTUPDATECAPS
//
// MessageText:
//
// Failed to update caps database after changing display mode.
//
const
D3DXERR_COULDNTUPDATECAPS : HRESULT = $C8770BC1;
//
// MessageId: D3DXERR_NOZBUFFER
//
// MessageText:
//
// Could not create Z buffer.
//
const
D3DXERR_NOZBUFFER : HRESULT = $C8770BC2;
//
// MessageId: D3DXERR_INVALIDMODE
//
// MessageText:
//
// Display mode is not valid.
//
const
D3DXERR_INVALIDMODE : HRESULT = $C8770BC3;
//
// MessageId: D3DXERR_INVALIDPARAMETER
//
// MessageText:
//
// One or more of the parameters passed is invalid.
//
const
D3DXERR_INVALIDPARAMETER : HRESULT = $C8770BC4;
//
// MessageId: D3DXERR_INITFAILED
//
// MessageText:
//
// D3DX failed to initialize itself.
//
const
D3DXERR_INITFAILED : HRESULT = $C8770BC5;
//
// MessageId: D3DXERR_STARTUPFAILED
//
// MessageText:
//
// D3DX failed to start up.
//
const
D3DXERR_STARTUPFAILED : HRESULT = $C8770BC6;
//
// MessageId: D3DXERR_D3DXNOTSTARTEDYET
//
// MessageText:
//
// D3DXInitialize() must be called first.
//
const
D3DXERR_D3DXNOTSTARTEDYET : HRESULT = $C8770BC7;
//
// MessageId: D3DXERR_NOTINITIALIZED
//
// MessageText:
//
// D3DX is not initialized yet.
//
const
D3DXERR_NOTINITIALIZED : HRESULT = $C8770BC8;
//
// MessageId: D3DXERR_FAILEDDRAWTEXT
//
// MessageText:
//
// Failed to render text to the surface.
//
const
D3DXERR_FAILEDDRAWTEXT : HRESULT = $C8770BC9;
//
// MessageId: D3DXERR_BADD3DXCONTEXT
//
// MessageText:
//
// Bad D3DX context.
//
const
D3DXERR_BADD3DXCONTEXT : HRESULT = $C8770BCA;
//
// MessageId: D3DXERR_CAPSNOTSUPPORTED
//
// MessageText:
//
// The requested device capabilities are not supported.
//
const
D3DXERR_CAPSNOTSUPPORTED : HRESULT = $C8770BCB;
//
// MessageId: D3DXERR_UNSUPPORTEDFILEFORMAT
//
// MessageText:
//
// The image file format is unrecognized.
//
const
D3DXERR_UNSUPPORTEDFILEFORMAT : HRESULT = $C8770BCC;
//
// MessageId: D3DXERR_IFLERROR
//
// MessageText:
//
// The image file loading library error.
//
const
D3DXERR_IFLERROR : HRESULT = $C8770BCD;
//
// MessageId: D3DXERR_FAILEDGETCAPS
//
// MessageText:
//
// Could not obtain device caps.
//
const
D3DXERR_FAILEDGETCAPS : HRESULT = $C8770BCE;
//
// MessageId: D3DXERR_CANNOTRESIZEFULLSCREEN
//
// MessageText:
//
// Resize does not work for full-screen.
//
const
D3DXERR_CANNOTRESIZEFULLSCREEN : HRESULT = $C8770BCF;
//
// MessageId: D3DXERR_CANNOTRESIZENONWINDOWED
//
// MessageText:
//
// Resize does not work for non-windowed contexts.
//
const
D3DXERR_CANNOTRESIZENONWINDOWED : HRESULT = $C8770BD0;
//
// MessageId: D3DXERR_FRONTBUFFERALREADYEXISTS
//
// MessageText:
//
// Front buffer already exists.
//
const
D3DXERR_FRONTBUFFERALREADYEXISTS : HRESULT = $C8770BD1;
//
// MessageId: D3DXERR_FULLSCREENPRIMARYEXISTS
//
// MessageText:
//
// The app is using the primary in full-screen mode.
//
const
D3DXERR_FULLSCREENPRIMARYEXISTS : HRESULT = $C8770BD2;
//
// MessageId: D3DXERR_GETDCFAILED
//
// MessageText:
//
// Could not get device context.
//
const
D3DXERR_GETDCFAILED : HRESULT = $C8770BD3;
//
// MessageId: D3DXERR_BITBLTFAILED
//
// MessageText:
//
// Could not bitBlt.
//
const
D3DXERR_BITBLTFAILED : HRESULT = $C8770BD4;
//
// MessageId: D3DXERR_NOTEXTURE
//
// MessageText:
//
// There is no surface backing up this texture.
//
const
D3DXERR_NOTEXTURE : HRESULT = $C8770BD5;
//
// MessageId: D3DXERR_MIPLEVELABSENT
//
// MessageText:
//
// There is no such miplevel for this surface.
//
const
D3DXERR_MIPLEVELABSENT : HRESULT = $C8770BD6;
//
// MessageId: D3DXERR_SURFACENOTPALETTED
//
// MessageText:
//
// The surface is not paletted.
//
const
D3DXERR_SURFACENOTPALETTED : HRESULT = $C8770BD7;
//
// MessageId: D3DXERR_ENUMFORMATSFAILED
//
// MessageText:
//
// An error occured while enumerating surface formats.
//
const
D3DXERR_ENUMFORMATSFAILED : HRESULT = $C8770BD8;
//
// MessageId: D3DXERR_COLORDEPTHTOOLOW
//
// MessageText:
//
// D3DX only supports color depths of 16 bit or greater.
//
const
D3DXERR_COLORDEPTHTOOLOW : HRESULT = $C8770BD9;
//
// MessageId: D3DXERR_INVALIDFILEFORMAT
//
// MessageText:
//
// The file format is invalid.
//
const
D3DXERR_INVALIDFILEFORMAT : HRESULT = $C8770BDA;
//
// MessageId: D3DXERR_NOMATCHFOUND
//
// MessageText:
//
// No suitable match found.
//
const
D3DXERR_NOMATCHFOUND : HRESULT = $C8770BDB;
implementation
end.
|
unit uGeneral;
interface
uses crt,sysutils,uJadwal,uTanggal,uMember,uKapasitas,uFilm,uKata;
const Nmax = 1000;
type Pemesanan = record
No : integer;
Nama : string;
Tanggal, Bulan, Tahun : integer;
Jam : string;
Jumlahkursi : integer;
Total : longint;
Jenis : string;
end;
type dbPemesanan = record
Pemesanan : array [1..Nmax] of Pemesanan;
Neff : integer;
end;
procedure load (var f:text;p:string);
{* procedure yang digunakan untuk meng-assign nama lojik ke nama fisik
I.S : f terdefinisi
F.S : p telah di-assign dengan variabel f *}
procedure loadPemesanan(var dP : dbPemesanan);
{* procedure yang digunakan untuk me-load data dari file eksternal pemesanan.txt ke dalam variabel internal
I.S : file eksternal pemesanan.txt telah terdefinisi
F.S : data di pemesanan.txt telah ditampung ke dalam dP *}
procedure loadFile(var dF : dbFilm; var dT : dbTayang; var dK: dbKapasitas; var dM : dbMember; var dP : dbPemesanan; var tgl : Tanggal);
{* procedure yang digunakan untuk me-load semua data pada file eksternal ke dalam variabel internal
I.S : semua file eksternal telah terdefinisi
F.S : data pada file eksternal telah ditampung dalam variabel dF, dT, dK, dM, dP, dan tgl}
procedure layarUtama();
{* procedure yang digunakan untuk menampilkan daftar menu yang dapat diakses *}
procedure persiapan();
{* procedure yang digunakan untuk menampilkan tampilan di awal eksekusi program *}
procedure showNextDay(TJadwal : dbTayang; tgl : Tanggal);
{* procedure yang digunakan untuk menampilkan jadwal film pada tanggal setelah hari ini *}
procedure selectMovie(var TKapasitas : dbKapasitas; var TPemesanan : dbPemesanan; TFilm : dbFilm);
{* procedure digunakan untuk melakukan pemilihan film dan kemudian melakukan pemesanan tiket
I.S : TKapasitas, TPemesanan, TFilm telah terdefinisi
F.S : TKapasitas, TPemesanan telah diupdate berdasarkan pemesanan dari user *}
procedure nowPlaying(dT: dbKapasitas;tgl:tanggal);
{* procedure yang menampilkan film hari ini
I.S : dT terdefinisi
F.S : Menuliskan judul film yang tayang *}
procedure upcoming(dT: dbTayang;tgl:tanggal);
{* procedure yang menampilkan film yang tayang minggu depan atau h+7
I.S : dT terdefinisi
F.S : Menuliskan judul film yang tayang *}
procedure F15Exit (T1 : dbKapasitas; T3 : dbMember; T2 : dbPemesanan);
{* procedure F15Exit digunakan untuk menyalin semua hasil perubahan file eksternal
yang ditampung di dalam array ke dalam file eksternal awal tersebut
I.S : T1, T2, dan T3 telah terdefinisi
F.S : File eksternal kapasitas.txt, pemesanan.txt, dan member.txt telah di-update *}
procedure loginMember(T: dbMember; var idx: integer);
{* procedure digunakan untuk melakukan login member dengan memasukkan username dan password
I.S : Terdefinisi
F.S: idx > 0 sebagai penanda login *}
procedure payMember (var T1 : dbPemesanan ; T2 : dbFilm ;var T3: dbMember ;var idx : integer);
{* procedure digunakan untuk melakukan pembayaran dengan menggunakan akun member
I.S : T1, T2, dan T3 terdefinisi
F.S : pembayaran sukses *}
procedure payCreditCard(var T1: dbPemesanan; T2: dbFilm);
{* procedure digunakan untuk melakukan pembayaran dengan menggunakan credit card
I.S : T1 dan T2 terdefinisi
F.S : Jenis pembayaran terupdate *}
function cariIndeks(Tab1 : dbFilm; Tab2 :dbPemesanan) : integer;
{* procedure digunakan untuk melakukan pencarian indeks
I.S : Tab1 dan Tab2 terdefinisi
F.S : indeks untuk array terdefinisi *}
implementation
procedure load (var f:text;p:string);
begin
assign(f,p);
reset(f);
end;
procedure loadPemesanan(var dP : dbPemesanan);
var
dPemesanan: text;
f:ansistring;
pos1,l,i,j:integer;
begin
j:=1;
load(dPemesanan,'database\pemesanan.txt');
while not Eof(dPemesanan) do
begin
readln(dPemesanan,f);
for i:=1 to 9 do
begin
pos1:=pos('|',f);
l:=length(copy(f,1,pos1+1));
case i of
1:val(copy(f,1,pos1-2),dP.Pemesanan[j].No);
2:dP.Pemesanan[j].Nama:=copy(f,1,pos1-2);
3:val(copy(f,1,pos1-2),dP.Pemesanan[j].Tanggal);
4:val(copy(f,1,pos1-2),dP.Pemesanan[j].Bulan);
5:val(copy(f,1,pos1-2),dP.Pemesanan[j].Tahun);
6:dP.Pemesanan[j].Jam:=copy(f,1,pos1-2);
7:val(copy(f,1,pos1-2),dP.Pemesanan[j].Jumlahkursi);
8:val(copy(f,1,pos1-2),dP.Pemesanan[j].Total);
9:dP.Pemesanan[j].Jenis:=copy(f,1,pos1-2);
end;
delete(f,1,l);
end;
j:=j+1;
end;
dP.Neff:=j-1;
close(dPemesanan);
end;
procedure loadFile(var dF : dbFilm; var dT : dbTayang; var dK: dbKapasitas; var dM : dbMember; var dP : dbPemesanan; var tgl : Tanggal);
begin
loadFilm(dF);
loadTayang(dT);
loadKapasitas(dK);
loadMember(dM);
loadPemesanan(dP);
loadTanggal(tgl);
writeln('> File telah di load');
end;
procedure layarUtama;
begin
writeln('===========================================================');
writeln(' Selamat Datang di Pelayan Pemesanan Tiker Bioskop X ');
writeln('===========================================================');
writeln;
writeln('Berikut adalah Fungsi yang bisa digunakan: ');
writeln(' 1. load 6. ratingFilter 11. payCreditCard ');
writeln(' 2. nowPlaying 7. searchMovie 12. payMember ');
writeln(' 3. upcoming 8. showMovie 13. loginMember ');
writeln(' 4. schedule 9. showNextDay 14. register ');
writeln(' 5. genreFilter 10. selectMovie 15. exit ');
writeln();
end;
procedure persiapan;
begin
writeln('> Sedang malakukan proses loading..');
write('> Menyiapkan program');delay(300);write('.');delay(400);write('.');delay(400);writeln('.');delay(700);
writeln('> Semua telah siap!');
end;
//menampilkan jadwal tayang hari berikutnya (F9)
procedure showNextDay(TJadwal : dbTayang; tgl : Tanggal);
var
i : integer;
judul : string;
begin
tgl := afterXDay(tgl, 1);
i := 1;
while (i <= TJadwal.Neff) do
begin
if ((tgl.tanggal = TJadwal.Tayang[i].tanggal)
and (tgl.bulan = TJadwal.Tayang[i].bulan)
and (tgl.tahun = TJadwal.Tayang[i].tahun)) then
begin
write('> ', TJadwal.Tayang[i].Nama, ' | ');
judul := TJadwal.Tayang[i].Nama;
while (TJadwal.Tayang[i].Nama = Judul) do
begin
write(Tjadwal.Tayang[i].Jam,' | ');
i := i+1;
end; // looping untuk penulisan jam tayang Film
writeln;
end else i:=i+1;
end;
end;
//memilih movie
procedure selectMovie(var TKapasitas : dbKapasitas; var TPemesanan : dbPemesanan; TFilm : dbFilm);
var
film : string;
i, idx : integer;
tanggal, jam, hari : string;
tgl, bln, thn, tiket, N : integer;
cek, stop, berhenti : boolean;
terminate : Char;
begin
repeat
berhenti := false;
stop := false;
repeat
write('> Judul Film : ');
readln(film);
i:= 1;
cek := False;
while (i < TKapasitas.Neff) and (cek = False) do
begin
if (lowAll(film) = lowAll(TKapasitas.Kapasitas[i].nama)) then
begin
stop := true; cek:=true;
end else i:=i+1;
end;
if cek = false then
begin
writeln('> input judul salah');
writeln('> Apakah anda ingin melanjutkan pencarian');
write('> Y/N : ');
readln(terminate);
if (low(terminate)='n') then
begin
berhenti:=true;
end else if (low(terminate)='y') then
begin
berhenti:= false;
end else
berhenti:=false;
end;
until (stop=true) or (berhenti=true); // indeks pertama dari judul film sudah ditemukan (i)
if berhenti = false then
begin
stop := false;
idx := i;
repeat
i := idx;
cek := false;
write('> Tanggal Tayang : ');
readln(tanggal);
val(copy(tanggal, 1 , 2),tgl);
val(copy(tanggal, 4, 2), bln);
val(copy(tanggal, 7, 4), thn);
while (cek = false) and (i <= TKapasitas.Neff) and (lowall(TKapasitas.Kapasitas[i].Nama) = lowall(Film)) do
begin
if ((tgl = TKapasitas.Kapasitas[i].tanggal) and (bln = TKapasitas.Kapasitas[i].bulan) and (thn = TKapasitas.Kapasitas[i].tahun)) then
begin
cek := true;
end else
begin
i := i + 1;
end;
end;
if (cek = false) then
begin
writeln('> input tanggal salah');
writeln('> Apakah anda ingin melanjutkan pencarian');
write('> Y/N : ');
readln(terminate);
if (low(terminate)='n') then
begin
berhenti:=true;
end else
if (low(terminate)='y') then
begin
berhenti:= false;
end;
end else
stop := true;
until ((stop = true) or (berhenti = true)); // indeks pada tanggal yang benar sudah didapatkan
end;
if berhenti = false then
begin
//setting jam tayang
stop := false;
idx :=i;
repeat
i := idx;
cek := false;
write('> Jam Tayang : '); readln(jam);
while (cek = false) and (i <= TKapasitas.Neff) and (lowall(film) = lowall(TKapasitas.Kapasitas[i].Nama)) do
begin
if (jam = TKapasitas.Kapasitas[i].Jam) then
begin
cek := true;
end else
begin
i := i +1;
end;
end;
if cek = false then
begin
writeln('> input jam tayang salah, ulangi input jam tayang!');
writeln('> Apakah anda ingin melanjutkan pencarian');
write('> Y/N : ');
readln(terminate);
if (low(terminate)='n') then
begin
berhenti:=true;
stop:= true;
end else
if (low(terminate)='y') then
begin
berhenti:= false;
end;
end else
stop := true;
until stop=true or berhenti=true; // indeks pada film yang diinginkan sudah didapatkan
end;
if berhenti=false then
begin
//pemrosesan pembelian kursi
writeln('> Kapasitas Tersisa ', TKapasitas.Kapasitas[i].Kapasitas ,' orang');
write('> Masukkan jumlah tiket yang ingin dibeli : '); readln(tiket);
if tiket > 0 then
begin
while (tiket > TKapasitas.Kapasitas[i].Kapasitas) or (tiket <= 0) do
begin
write('> Masukkan kembali jumlah tiket yang ingin dibeli : '); readln(tiket);
end;
TKapasitas.Kapasitas[i].Kapasitas := TKapasitas.Kapasitas[i].Kapasitas - tiket;
N := TPemesanan.Neff;
TPemesanan.Neff := N + 1;
TPemesanan.Pemesanan[N+1].Nama:= TKapasitas.Kapasitas[i].Nama;
TPemesanan.Pemesanan[N+1].Jam:= jam;
TPemesanan.Pemesanan[N+1].Tanggal:= tgl;
TPemesanan.Pemesanan[N+1].Bulan:= bln;
TPemesanan.Pemesanan[N+1].Tahun:= thn;
TPemesanan.Pemesanan[N+1].Jenis:= 'Belum Dibayar';
TPemesanan.Pemesanan[N+1].JumlahKursi := tiket;
TPemesanan.Pemesanan[N+1].No := TPemesanan.Neff;
hari := getDay(tgl, bln, thn);
cek := false;
i := 1;
if ((hari = 'Sabtu') or (hari = 'Minggu')) then
begin
while (i < TFilm.Neff) and (cek = False) do
begin
if lowAll(TFilm.Film[i].Nama) = lowAll(film) then
begin
cek := True;
end else i := i +1;
end;
TPemesanan.Pemesanan[N+1].Total := (TFilm.Film[i].hEnd) * tiket;
end else
begin
TPemesanan.Pemesanan[N+1].Total := (TFilm.Film[i].hDay) * tiket;
end;
write('> Pemesanan sukses, nomor pemesanan Anda adalah: ' );
if TPemesanan.Neff < 10 then writeln('00',TPemesanan.Neff) else
if (TPemesanan.Neff<100) then writeln('0',TPemesanan.Neff) else
writeln(TPemesanan.Neff);
end;
writeln('> Apakah Anda Ingin Melanjutkan Pemesanan?');
write('> Y/N : '); readln(terminate);
if low(terminate)='n' then
berhenti := true
else
berhenti:=false;
end;
until (berhenti = True);
end;
procedure nowPlaying(dT: dbKapasitas;tgl:tanggal);
{Kamus}
Var
i:integer;
{Algoritma}
Begin
i:=1;
While (i<=dT.Neff) do
Begin
If (tgl.Tanggal=dT.Kapasitas[i].Tanggal) and (tgl.Bulan=dT.Kapasitas[i].Bulan) and (tgl.Tahun=dT.Kapasitas[i].Tahun) then
Begin
Writeln('> ',dT.Kapasitas[i].Nama);
i:=i+1;
while (dT.Kapasitas[i].Nama=dT.Kapasitas[i-1].Nama) and (i<=dT.Neff) do
i:=i+1;
End
Else
i:=i+1;
End;
End;
procedure upcoming(dT: dbTayang; tgl: Tanggal);
{Kamus}
Var
i, j, a, count :integer;
{Algoritma}
Begin
a := 0;
tgl:=afterXDay(tgl,7);
writeln('> Film yang akan tayang :');
for j:=1 to 7 do
Begin
count:=0;
tgl:=afterXDay(tgl,1);
write('> ');
writeTanggal(tgl);
i:=1;
While (i<=dT.Neff) do
Begin
If (tgl.Tanggal=dT.Tayang[i].Tanggal) and (tgl.Bulan=dT.Tayang[i].Bulan) and (tgl.Tahun=dT.Tayang[i].Tahun) then
Begin
Writeln('> ',dT.Tayang[i].Nama);
count:=count+1;
i:=i+1;
while (dT.Tayang[i].Nama=dT.Tayang[i-1].Nama) and (i<=dT.Neff) do
begin
i:=i+1;
end;
a := a+1;
End
Else
i:=i+1;
End;
if count<1 then
begin
writeln('> Tidak ada Film baru');
end;
writeln();
End;
if a=0 then
begin
writeln('> Tidak ada');
end;
End;
//F-15Exit
procedure F15Exit (T1 : dbKapasitas; T3 : dbMember; T2 : dbPemesanan);
{Kamus Lokal}
var
i,j,k : integer;
fin1,fin2,fin3 : text;
tanggal, bulan, tahun, nomor, total, saldo, kapasitas, jumlahkursi, no : string;
{Algoritma}
begin
assign(fin1, 'database\kapasitas.txt');
rewrite(fin1);
for i := 1 to T1.Neff do
begin
Str(T1.Kapasitas[i].Tanggal, tanggal);
Str(T1.Kapasitas[i].Bulan, bulan);
Str(T1.Kapasitas[i].Tahun, tahun);
Str(T1.Kapasitas[i].Kapasitas, kapasitas);
writeln(fin1, T1.Kapasitas[i].Nama,' | ',tanggal,' | ',bulan,' | ',tahun,' | ',T1.Kapasitas[i].Jam,' | ',kapasitas,' | ')
end;
assign(fin3, 'database\member.txt');
rewrite(fin3);
for k := 1 to T3.Neff do
begin
Str(T3.Member[k].Saldo, saldo);
writeln(fin3, T3.Member[k].UserName,' | ',T3.Member[k].Password,' | ',saldo,' | ')
end;
assign(fin2, 'database\pemesanan.txt');
rewrite(fin2);
for j := 1 to T2.Neff do
begin
Str(T2.Pemesanan[j].No, no);
if (T2.Pemesanan[j].No) < 10 then
nomor := '00'+ no
else if (T2.Pemesanan[j].No < 100) then
nomor := '0'+ no
else
nomor := no;
Str(T2.Pemesanan[j].Tanggal, tanggal);
Str(T2.Pemesanan[j].Bulan, bulan);
Str(T2.Pemesanan[j].Tahun, tahun);
Str(T2.Pemesanan[j].Total, total);
Str(T2.Pemesanan[j].Jumlahkursi, jumlahkursi);
writeln(fin2, nomor,' | ',T2.Pemesanan[j].Nama,' | ',tanggal,' | ',bulan,' | ',tahun,' | ',T2.Pemesanan[j].Jam,' | ',jumlahkursi,' | ',total,' | ',T2.Pemesanan[j].Jenis,' | ')
end;
close(fin1);
close(fin2);
close(fin3);
write('> Sedang menyimpan data'); delay(200);
write('.');delay(200);
write('.');delay(500);
writeln('.');delay(500);
writeln;
end;
//Procedur F13-loginMember
procedure loginMember(T: dbMember; var idx: integer);
//kamus
var a : integer;
sandi, user : string;
found: boolean;
//algoritma lokal
begin
repeat
a := 1 ;
found := false;
write('> Masukkan username :');
readln(user);
write('> Masukkan password :');
readln(sandi);
while (Found = False) and (a <= T.Neff) do
begin
if (user = T.Member[a].UserName) and (sandi = T.Member[a].Password) then
begin
found:= True;
writeln('> Halo ! Anda login sebagai ', T.Member[a].UserName);
writeln('> Sisa Saldo anda adalah ', T.Member[a].Saldo);
end else
begin
a:= a + 1;
end;
end;
if (found = False) then
begin
writeln('> Username atau password salah');
a := 0
end;
until (Found = True);
idx := a
end;
//Fungsi Cari indeks
function cariIndeks(Tab1 : dbFilm; Tab2 :dbPemesanan) : integer;
//kamus lokal
var
i: integer;
cek : boolean;
//Algoritme lokal
begin
i:= 1;
cek := false;
while (i <= 1000) and (cek=False) do
begin
if (Tab1.Film[i].Nama = Tab2.Pemesanan[i].Nama) then
begin
cek := True;
end else
i:= i + 1;
end;
cariIndeks := i;
end;
//F11-payCreditCard
procedure payCreditCard(var T1: dbPemesanan; T2: dbFilm);
//kamus lokal
var
c, idx, DD, MM, YY : integer;
kkredit, nopesan : string;
harga, X, Y: longint;
//Algoritma lokal
begin
write('> Nomor Pemesanan: ');
readln(nopesan);
Val(copy(nopesan,3,1), c);
while c>T1.Neff do
begin
writeln('> Maaf No pemesanan tidak ada dalam data base. Ulangi Input!');
write('> Nomor pesanan: ');
readln(nopesan);
c := StrToInt(nopesan[3]);
end;
if (T1.Pemesanan[c].Jenis<>'Belum Dibayar') then
writeln('> Nomor pesanan telah dibayar')
else
begin
DD := T1.Pemesanan[c].Tanggal;
MM := T1.Pemesanan[c].Bulan;
YY := T1.Pemesanan[c].Tahun;
idx := cariIndeks(T2,T1);
//mengubah isi dari tabel ke long int dan menampungnya ke suatu variable
X := T1.Pemesanan[c].Total;
Y := T2.Film[idx].hEnd;
if (getDay(DD,MM,YY) = 'Sabtu') and ( T1.Pemesanan[c].Jumlahkursi > 1) then
begin
harga:= x - y;
end else
harga:= x;
writeln('> Harga yang harus dibayar: ',harga);
write('> Nomor kartu kredit: ');
//asumsi input selalu valid 15 digit
readln(kkredit);
writeln('> Pembayaran sukses!');
//mmengganti status pencatatan di array
T1.Pemesanan[c].Jenis := 'Credit Card';
end;
end;
//F12-payMember
procedure payMember (var T1 : dbPemesanan ; T2 : dbFilm ;var T3: dbMember ;var idx : integer);
//kamus lokal
var
sisaSaldo, hargamember, harga : longint;
c : integer;
stop: boolean;
nopesan, pilihan : string;
//algoritma
begin
if (idx=0) then
begin
loginMember(T3, idx);
end else
begin
writeln('> Halo ! Anda login sebagai ', T3.Member[idx].UserName);
writeln('> Sisa Saldo anda adalah ', T3.Member[idx].Saldo);
end;
writeln('> Anda akan melakukan pembayaran menggunakan saldo member');
write('> Nomor pesanan: ');
readln(nopesan);
c := StrToInt(nopesan[3]);
while c>T1.Neff do
begin
writeln('> Maaf No pemesanan tidak ada dalam data base. Ulangi Input!');
write('> Nomor pesanan: ');
readln(nopesan);
c := StrToInt(nopesan[3]);
end;
if (T1.Pemesanan[c].Jenis<>'Belum Dibayar') then
writeln('> Nomor pesanan telah dibayar')
else
begin
harga := T1.Pemesanan[c].Total;
hargamember := 9 * harga div 10 ;
writeln('> Harga yang harus dibayar: ',hargamember);
if (T3.Member[idx].Saldo >= hargamember) then
begin
sisaSaldo:= T3.Member[idx].Saldo - hargamember;
writeln('> Sisa saldo anda adalah : ',sisaSaldo);
writeln('> Pembayaran sukses!');
//mmengganti status pencatatan di array
T1.Pemesanan[c].Jenis := 'Member';
T3.Member[idx].Saldo:=sisaSaldo;
end else
begin
writeln('> Sisa saldo anda tidak mencukupi');
writeln('> Silahkan pilih metode pembayaran lain.');
writeln('> Metode pembayaran yang dapat anda lakukan:');
writeln('> 1 Tunai');
writeln('> 2 payCreditCard');
stop:=false;
repeat
write('> ');readln(pilihan);
if (pilihan = 'Tunai') then
begin
writeln('> Kode booking anda adalah ', nopesan);
writeln('> Silahkan melakukan pembayaran di bioskop');
T1.Pemesanan[c].Jenis := 'Tunai';
stop:=true;
end else if (pilihan = 'payCreditCard') then
begin
payCreditCard(T1, T2);
stop:=true;
end else
begin
writeln('> Input salah!');
end;
until stop=true;
end;
end;
end;
end.
|
{***********************************************************************************************************************
*
* TERRA Game Engine
* ==========================================
*
* Copyright (C) 2003, 2014 by SÚrgio Flores (relfos@gmail.com)
*
***********************************************************************************************************************
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
**********************************************************************************************************************
* TERRA_Downsampler
* Implements a framebuffer downsampler via shaders
***********************************************************************************************************************
}
Unit TERRA_Downsampler;
{$I terra.inc}
Interface
Uses {$IFDEF USEDEBUGUNIT}TERRA_Debug,{$ENDIF}
TERRA_String, TERRA_Renderer, TERRA_Texture, TERRA_Math, TERRA_Application, TERRA_Utils, TERRA_Resource;
Type
RenderTargetSampler = Class(TERRAObject)
Protected
_Name:TERRAString;
_Targets:Array Of RenderTargetInterface;
_Textures:Array Of Texture;
_TargetCount:Integer;
_ResultIndex:Integer;
Procedure Init(Width, Height:Integer; PixelSize:PixelSizeType); Virtual; Abstract;
// Free memory
Procedure Clear();
Public
Constructor Create(Const Name:TERRAString; Width, Height:Integer; PixelSize:PixelSizeType);
Procedure Release; Override;
Procedure Update(Source:Texture; DownsamplerShader:ShaderInterface; First, Count:Integer); Virtual; Abstract;
// Number of render texture used
Property TextureCount:Integer Read _TargetCount;
// Get a downsampled render texture
Function GetRenderTexture(Index:Integer):Texture;
Function GetResult():Texture;
End;
RenderTargetDownSampler = Class(RenderTargetSampler)
Protected
// Create the downsampler
Procedure Init(Width, Height:Integer; PixelSize:PixelSizeType); Override;
Public
// Downsample a framebuffer using the shader
// Return value is index of smallest texture downsampled
Procedure Update(Source:Texture; DownsamplerShader:ShaderInterface; First, Count:Integer); Override;
End;
RenderTargetBouncer = Class(RenderTargetSampler)
Protected
// Create the downsampler
Procedure Init(Width, Height:Integer; PixelSize:PixelSizeType); Override;
Public
// Downsample a framebuffer using the shader
// Return value is index of smallest texture downsampled
Procedure Update(Source:Texture; DownsamplerShader:ShaderInterface; First, Count:Integer); Override;
End;
Implementation
Uses TERRA_GraphicsManager, TERRA_InputManager, TERRA_Color;
{ RenderTargetSampler }
Constructor RenderTargetSampler.Create(Const Name:TERRAString; Width, Height:Integer; PixelSize:PixelSizeType);
Begin
Self._Name := Name;
Self.Init(Width, Height, PixelSize); // {$IFDEF FRAMEBUFFEROBJECTS}FBO_COLOR8{$ELSE}0{$ENDIF}); BIBI
End;
Function RenderTargetSampler.GetRenderTexture(Index:Integer):Texture;
Begin
If (Index<0) Or (Index>=_TargetCount) Then
Result := Nil
Else
Begin
If (_Textures[Index] = Nil) Then
Begin
_Textures[Index] := Texture.Create(rtDynamic, Self._Name + '_rt'+IntToString(Index));
_Textures[Index].InitFromSurface(_Targets[Index]);
_Textures[Index].WrapMode := wrapNothing;
End;
Result := _Textures[Index];
End;
End;
Procedure RenderTargetSampler.Release();
Begin
Self.Clear();
End;
Procedure RenderTargetSampler.Clear();
Var
I:Integer;
Begin
For I:=0 To Pred(_TargetCount) Do
Begin
ReleaseObject(_Textures[I]);
ReleaseObject(_Targets[I]);
End;
_TargetCount := 0;
SetLength(_Targets, 0);
SetLength(_Textures, 0);
End;
Function RenderTargetSampler.GetResult: Texture;
Begin
Result := Self.GetRenderTexture(_ResultIndex);
End;
{ RenderTargetDownSampler }
Procedure RenderTargetDownSampler.Init(Width, Height:Integer; PixelSize:PixelSizeType);
Var
I, X,Y:Integer;
Nx, Ny:Integer;
Begin
// Calculate the number of texture if we want to get a 1x1 texture
X := Width;
Y := Height;
Nx := 0;
While (X>1) Do
Begin
Inc(nx);
X := Trunc(X /2.0);
End;
Ny := 0;
While (Y>1) Do
Begin
Inc(NY);
Y := Trunc(Y/2.0);
End;
_TargetCount := IntMax(Nx, Ny);
SetLength(_Targets, _TargetCount);
SetLength(_Textures, _TargetCount);
// Create FrameBuffer Objects
For I :=0 To Pred(_TargetCount) Do
Begin
Width := Width Div 2;
Height := Height Div 2;
_Targets[I] := GraphicsManager.Instance.Renderer.CreateRenderTarget();
_Targets[I].Generate({_Name+'_target'+IntToString(I), }Width, Height, False, PixelSize, 1, False, False);
_Targets[I].BackgroundColor := ColorRed;
End;
End;
Procedure RenderTargetDownSampler.Update(Source:Texture; DownsamplerShader:ShaderInterface; First, Count:Integer);
Var
N, I:Integer;
curRT:RenderTargetInterface;
Graphics:GraphicsManager;
Begin
_ResultIndex := 0;
Graphics := GraphicsManager.Instance;
// Set max number of textures
If (Count<0) Then
N := _TargetCount
Else
N := IntMin(Count, _TargetCount);
// Generate all down-sampled render texture
For I:=First To Pred(N) Do
Begin
curRt := _Targets[i];
If (I>0) Then
Source := Self.GetRenderTexture(Pred(i));
// Render on current fbo
curRt.BeginCapture(clearAll);
// Use previous render texture as input texture
Source.Bind(0);
// User shader to render
Graphics.Renderer.BindShader(DownsamplerShader);
DownsamplerShader.SetFloatUniform('dx', 1 / curRt.Width);
DownsamplerShader.SetFloatUniform('dy', 1 / curRt.Height);
DownsamplerShader.SetIntegerUniform('texture', 0);
// Draw quad on the screen
Graphics.Renderer.SetBlendMode(blendNone);
Graphics.DrawFullscreenQuad(DownsamplerShader, 0, 0, 1.0, 1.0);
curRt.EndCapture();
_ResultIndex := I;
{IF InputManager.Instance.Keys.IsDown(Ord('T')) Then
curRt.GetImage().Save('ds'+IntToString(I)+'.png');}
End;
// Graphics.ActiveViewport.Restore();
End;
{ RenderTargetBouncer }
Procedure RenderTargetBouncer.Init(Width, Height: Integer; PixelSize: PixelSizeType);
Var
I:Integer;
Begin
_TargetCount := 2;
SetLength(_Targets, _TargetCount);
SetLength(_Textures, _TargetCount);
// Create FrameBuffer Objects
For I :=0 To Pred(_TargetCount) Do
Begin
_Targets[I] := GraphicsManager.Instance.Renderer.CreateRenderTarget();
_Targets[I].Generate(Width, Height, False, PixelSize, 1, False, False);
_Targets[I].BackgroundColor := ColorRed;
End;
End;
Procedure RenderTargetBouncer.Update(Source:Texture; DownsamplerShader: ShaderInterface; First, Count: Integer);
Var
N, CurIndex:Integer;
curRT:RenderTargetInterface;
Graphics:GraphicsManager;
Tex:Texture;
Begin
_ResultIndex := 0;
Graphics := GraphicsManager.Instance;
Tex := Self.GetRenderTexture(0);
If (Source = Tex) Then
CurIndex := 1
Else
CurIndex := 0;
// Generate all down-sampled render texture
For N:=1 To Count Do
Begin
curRt := _Targets[curIndex];
// Render on current fbo
curRt.BeginCapture(clearAll);
// Use previous render texture as input texture
Source.Bind(0);
// User shader to render
Graphics.Renderer.BindShader(DownsamplerShader);
DownsamplerShader.SetFloatUniform('dx', 1 / curRt.Width);
DownsamplerShader.SetFloatUniform('dy', 1 / curRt.Height);
DownsamplerShader.SetIntegerUniform('texture', 0);
// Draw quad on the screen
Graphics.Renderer.SetBlendMode(blendNone);
Graphics.DrawFullscreenQuad(DownsamplerShader, 0, 0, 1.0, 1.0);
curRt.EndCapture();
_ResultIndex := CurIndex;
IF InputManager.Instance.Keys.IsDown(Ord('T')) Then
curRt.GetImage().Save('ds'+IntToString(curIndex)+'.png');
Tex := Self.GetRenderTexture(0);
If (Source = Tex) Then
Begin
Source := Self.GetRenderTexture(1);
curIndex := 0;
End Else
Begin
Source := Tex;
curIndex := 1;
End;
End;
// Graphics.ActiveViewport.Restore();
End;
End.
|
unit uRecadoVO;
interface
uses
System.SysUtils, uKeyField, uTableName, uClienteVO, uUsuarioVO, uTipoVO,
uStatusVO, System.Generics.Collections;
type
[TableName('Recado')]
TRecadoVO = class
private
FIdStatus: Integer;
FIdUsuarioDestino: Integer;
FFantasia: string;
FHoraFinal: TTime;
FHora: TTime;
FDescricaoFinal: string;
FDescricaoInicial: string;
FIdTipo: Integer;
FId: Integer;
FRazaoSocial: string;
FNivel: Integer;
FContato: string;
FIdUsuarioLcto: Integer;
FIdCliente: Integer;
FDataFinal: TDate;
FEndereco: string;
FTelefone: string;
FData: TDate;
FTipoRecado: Integer;
FCliente: TClienteVO;
FStatus: TStatusVO;
FUsuarioDestino: TUsuarioVO;
FUsuario: TUsuarioVO;
FTipo: TTipoVO;
FOperacao: string;
procedure SetContato(const Value: string);
procedure SetData(const Value: TDate);
procedure SetDataFinal(const Value: TDate);
procedure SetDescricaoFinal(const Value: string);
procedure SetDescricaoInicial(const Value: string);
procedure SetEndereco(const Value: string);
procedure SetFantasia(const Value: string);
procedure SetHora(const Value: TTime);
procedure SetHoraFinal(const Value: TTime);
procedure SetId(const Value: Integer);
procedure SetIdCliente(const Value: Integer);
procedure SetIdStatus(const Value: Integer);
procedure SetIdTipo(const Value: Integer);
procedure SetIdUsuarioDestino(const Value: Integer);
procedure SetIdUsuarioLcto(const Value: Integer);
procedure SetNivel(const Value: Integer);
procedure SetRazaoSocial(const Value: string);
procedure SetTelefone(const Value: string);
procedure SetCliente(const Value: TClienteVO);
procedure SetStatus(const Value: TStatusVO);
procedure SetTipo(const Value: TTipoVO);
procedure SetTipoRecado(const Value: Integer);
procedure SetUsuario(const Value: TUsuarioVO);
procedure SetUsuarioDestino(const Value: TUsuarioVO);
procedure SetOperacao(const Value: string);
public
[KeyField('Rec_Id')]
property Id: Integer read FId write SetId;
[FieldDate('Rec_Data')]
property Data: TDate read FData write SetData;
[FieldTime('Rec_Hora')]
property Hora: TTime read FHora write SetHora;
[FieldName('Rec_UsuarioLcto')]
property IdUsuarioLcto: Integer read FIdUsuarioLcto write SetIdUsuarioLcto;
[FieldName('Rec_Nivel')]
property Nivel: Integer read FNivel write SetNivel;
[FieldNull('Rec_Cliente')]
property IdCliente: Integer read FIdCliente write SetIdCliente;
[FieldName('Rec_RazaoSocial')]
property RazaoSocial: string read FRazaoSocial write SetRazaoSocial;
[FieldName('Rec_Fantasia')]
property Fantasia: string read FFantasia write SetFantasia;
[FieldName('Rec_Endereco')]
property Endereco: string read FEndereco write SetEndereco;
[FieldName('Rec_Telefone')]
property Telefone: string read FTelefone write SetTelefone;
[FieldName('Rec_Contato')]
property Contato: string read FContato write SetContato;
[FieldNull('Rec_UsuarioDestino')]
property IdUsuarioDestino: Integer read FIdUsuarioDestino write SetIdUsuarioDestino;
[FieldNull('Rec_Tipo')]
property IdTipo: Integer read FIdTipo write SetIdTipo;
[FieldNull('Rec_Status')]
property IdStatus: Integer read FIdStatus write SetIdStatus;
[FieldName('Rec_DescricaoInicial')]
property DescricaoInicial: string read FDescricaoInicial write SetDescricaoInicial;
[FieldDate('Rec_DataFinal')]
property DataFinal: TDate read FDataFinal write SetDataFinal;
[FieldTime('Rec_HoraFinal')]
property HoraFinal: TTime read FHoraFinal write SetHoraFinal;
[FieldTime('Rec_DescricaoFinal')]
property DescricaoFinal: string read FDescricaoFinal write SetDescricaoFinal;
[ForeingKey('Rec_Cliente')]
property Cliente: TClienteVO read FCliente write SetCliente;
[ForeingKey('Rec_UsuarioLcto')]
property Usuario: TUsuarioVO read FUsuario write SetUsuario;
[ForeingKey('Rec_UsuarioDestino')]
property UsuarioDestino: TUsuarioVO read FUsuarioDestino write SetUsuarioDestino;
[ForeingKey('Rec_Tipo')]
property Tipo: TTipoVO read FTipo write SetTipo;
[ForeingKey('Rec_Status')]
property Status: TStatusVO read FStatus write SetStatus;
property TipoRecado: Integer read FTipoRecado write SetTipoRecado;
property Operacao: string read FOperacao write SetOperacao;
constructor create;
destructor destroy; override;
end;
implementation
{ TRecadoVO }
constructor TRecadoVO.create;
begin
inherited create;
FCliente := TClienteVO.create;
FUsuario := TUsuarioVO.Create;
FUsuarioDestino := TUsuarioVO.Create;
FTipo := TTipoVO.Create;
FStatus := TStatusVO.Create;
end;
destructor TRecadoVO.destroy;
begin
FreeAndNil(FCliente);
FreeAndNil(FUsuario);
FreeAndNil(FUsuarioDestino);
FreeAndNil(FTipo);
FreeAndNil(FStatus);
inherited;
end;
procedure TRecadoVO.SetCliente(const Value: TClienteVO);
begin
FCliente := Value;
end;
procedure TRecadoVO.SetContato(const Value: string);
begin
FContato := Value;
end;
procedure TRecadoVO.SetData(const Value: TDate);
begin
FData := Value;
end;
procedure TRecadoVO.SetDataFinal(const Value: TDate);
begin
FDataFinal := Value;
end;
procedure TRecadoVO.SetDescricaoFinal(const Value: string);
begin
FDescricaoFinal := Value;
end;
procedure TRecadoVO.SetDescricaoInicial(const Value: string);
begin
FDescricaoInicial := Value;
end;
procedure TRecadoVO.SetEndereco(const Value: string);
begin
FEndereco := Value;
end;
procedure TRecadoVO.SetFantasia(const Value: string);
begin
FFantasia := Value;
end;
procedure TRecadoVO.SetHora(const Value: TTime);
begin
FHora := Value;
end;
procedure TRecadoVO.SetHoraFinal(const Value: TTime);
begin
FHoraFinal := Value;
end;
procedure TRecadoVO.SetId(const Value: Integer);
begin
FId := Value;
end;
procedure TRecadoVO.SetIdCliente(const Value: Integer);
begin
FIdCliente := Value;
end;
procedure TRecadoVO.SetIdStatus(const Value: Integer);
begin
FIdStatus := Value;
end;
procedure TRecadoVO.SetIdTipo(const Value: Integer);
begin
FIdTipo := Value;
end;
procedure TRecadoVO.SetIdUsuarioDestino(const Value: Integer);
begin
FIdUsuarioDestino := Value;
end;
procedure TRecadoVO.SetIdUsuarioLcto(const Value: Integer);
begin
FIdUsuarioLcto := Value;
end;
procedure TRecadoVO.SetNivel(const Value: Integer);
begin
FNivel := Value;
end;
procedure TRecadoVO.SetOperacao(const Value: string);
begin
if (Value <> 'A') and (Value <> 'E') then
raise Exception.Create('Informe o Tipo de Operação A-Abertura ou E-Encerrado!');
FOperacao := Value;
end;
procedure TRecadoVO.SetRazaoSocial(const Value: string);
begin
FRazaoSocial := Value;
end;
procedure TRecadoVO.SetStatus(const Value: TStatusVO);
begin
FStatus := Value;
end;
procedure TRecadoVO.SetTelefone(const Value: string);
begin
FTelefone := Value;
end;
procedure TRecadoVO.SetTipo(const Value: TTipoVO);
begin
FTipo := Value;
end;
procedure TRecadoVO.SetTipoRecado(const Value: Integer);
begin
FTipoRecado := Value;
end;
procedure TRecadoVO.SetUsuario(const Value: TUsuarioVO);
begin
FUsuario := Value;
end;
procedure TRecadoVO.SetUsuarioDestino(const Value: TUsuarioVO);
begin
FUsuarioDestino := Value;
end;
end.
|
unit InfoLENDERTable;
interface
uses
Classes, DB, DBISAMTb, SysUtils, DBISAMTableAU, DataBuf;
type
TInfoLENDERRecord = record
PLenderID: String[4];
PModCount: SmallInt;
Pclient: String[3];
PSystemType: String[1];
Pstatus: String[1];
PNetStatement: String[1];
Pname: String[50];
PAddress: String[30];
PAddress2: String[30];
PCityState: String[25];
PZipCode: String[9];
PStreetName: String[30];
PStreetAddress: String[30];
PStreetCSZ: String[30];
Pstate: String[2];
PPhoneNumber: String[10];
PPhoneExtension: String[15];
PResidentAdminName: String[30];
PResidentAdminPhone: String[10];
PResidentAdminPhoneExtension: String[15];
PFaxNumber: String[10];
Pgroup: String[3];
PStatementGroup: String[3];
PClientID: String[3];
Ppcgroup: String[3];
PBalanceLimit: Integer;
Pdel_lim: Integer;
Pbaldel: String[1];
PMatureLoanHoldDays: SmallInt;
PTapeHoldDays: SmallInt;
Prunevents: String[6];
Pmethod: String[4];
PCommisionEntityMix: String[5];
PMasterMix: String[5];
PBlanketPolicyMix: String[5];
PGracePeriodOption: String[1];
PNewGraceDays: SmallInt;
PExpGraceDays: SmallInt;
PcancellgraceDays: SmallInt;
PMaxBackDays: SmallInt;
PErrorOmissionInceptionDate: String[8];
POverrideEODate: String[1];
Pmanprint: String[1];
Pbook_all: String[1];
PWaverNonPayDays: SmallInt;
Pnewpmt: String[2];
PStatementContactName: String[30];
POfficeContactName: String[26];
PNoticeSignature: String[30];
PNoticeSignature2: String[30];
PMasterPolicyNumber: String[10];
PBlanketPolicyNumber: String[10];
PEarningMethodCode: String[2];
PCancellationMethocCode: String[2];
Ptapeid: String[6];
Pdiskid: String[6];
PInquiryID: String[6];
PCancellationID: String[6];
PStatementID: String[6];
PBranchBankingOption: String[1];
Punwaive: String[1];
PSpecialApprovalCode_opt9x: String[1];
Pmon_only: String[1];
PkeepForcedData: String[1];
Pautorenew: String[1];
PInterestOption: String[1];
PInterestRate: Currency;
Pt_updins: String[1];
Pt_lndate: String[1];
Pt_matdate: String[1];
Pt_branch: String[1];
Pt_off: String[1];
Pt_short: String[1];
Pt_name: String[1];
Pt_addr: String[1];
Pt_coll: String[1];
PnextrunDate: String[8];
PrunfreqDays: SmallInt;
Pforcerun: String[1];
Plast_updDate: String[8];
Plast_ihisDate: String[8];
Plast_thisDate: String[8];
Plast_diskDate: String[8];
Plast_tapeDate: String[8];
PfirstrunDate: String[8];
Pcancdate: String[8];
PMailCarrier: String[2];
PCallforDataDOW: String[2];
Phold_run: String[1];
Prevlevel: String[1];
Pnum_mod: SmallInt;
Pmod: String[1];
Plen_def: String[6];
Pdef_text: String[20];
PPrintMissingdataOfficerOrder: String[1];
Pmisstitle: String[1];
Psite_type: String[1];
Pic_input: String[1];
Pnoticeid: String[6];
Pinq_type: String[1];
Pdoc_id: String[1];
PCollateralValueOption: String[1];
Pimage_opt: String[1];
Pprintid: String[6];
Pfstrun: String[6];
Pfststmt: String[4];
Pmathold: SmallInt;
PNoticeSortOrder1: String[1];
PNoticeSortOrder2: String[1];
PNoticeSortOrder3: String[1];
PNoticeSortOrder4: String[1];
PNoticeSortOrder5: String[1];
PFiller2: String[75];
Pspec_tab: String[35];
PPremiumChartCopies: Integer;
PMailingLabeltype: String[1];
Pfnotdate: Integer;
Psnotdate: Integer;
PcollateralUse: String[1];
Preflag: String[1];
Pfnottype: String[1];
Ppcprint: String[1];
PBalanceReportSortRequest: String[1];
Ppoldate: Integer;
Phistptr: String[6];
PNoteNumber: SmallInt;
POptions: String[50];
PclContact: String[30];
PclAddress: String[30];
PclCityStZip: String[30];
PclPhone: String[30];
PclFax: String[30];
PplContact: String[30];
PplAddress: String[30];
PplCityStZip: String[30];
PplPhone: String[30];
PplFax: String[30];
PLastRunDate: String[32];
PRunControl: String[2];
PTranControl: String[2];
PLast4RunNum: String[8];
PAccountId: String[4];
PRefundOpt: String[1];
PInterim: String[1];
End;
TInfoLENDERClass2 = class
public
PLenderID: String[4];
PModCount: SmallInt;
Pclient: String[3];
PSystemType: String[1];
Pstatus: String[1];
PNetStatement: String[1];
Pname: String[50];
PAddress: String[30];
PAddress2: String[30];
PCityState: String[25];
PZipCode: String[9];
PStreetName: String[30];
PStreetAddress: String[30];
PStreetCSZ: String[30];
Pstate: String[2];
PPhoneNumber: String[10];
PPhoneExtension: String[15];
PResidentAdminName: String[30];
PResidentAdminPhone: String[10];
PResidentAdminPhoneExtension: String[15];
PFaxNumber: String[10];
Pgroup: String[3];
PStatementGroup: String[3];
PClientID: String[3];
Ppcgroup: String[3];
PBalanceLimit: Integer;
Pdel_lim: Integer;
Pbaldel: String[1];
PMatureLoanHoldDays: SmallInt;
PTapeHoldDays: SmallInt;
Prunevents: String[6];
Pmethod: String[4];
PCommisionEntityMix: String[5];
PMasterMix: String[5];
PBlanketPolicyMix: String[5];
PGracePeriodOption: String[1];
PNewGraceDays: SmallInt;
PExpGraceDays: SmallInt;
PcancellgraceDays: SmallInt;
PMaxBackDays: SmallInt;
PErrorOmissionInceptionDate: String[8];
POverrideEODate: String[1];
Pmanprint: String[1];
Pbook_all: String[1];
PWaverNonPayDays: SmallInt;
Pnewpmt: String[2];
PStatementContactName: String[30];
POfficeContactName: String[26];
PNoticeSignature: String[30];
PNoticeSignature2: String[30];
PMasterPolicyNumber: String[10];
PBlanketPolicyNumber: String[10];
PEarningMethodCode: String[2];
PCancellationMethocCode: String[2];
Ptapeid: String[6];
Pdiskid: String[6];
PInquiryID: String[6];
PCancellationID: String[6];
PStatementID: String[6];
PBranchBankingOption: String[1];
Punwaive: String[1];
PSpecialApprovalCode_opt9x: String[1];
Pmon_only: String[1];
PkeepForcedData: String[1];
Pautorenew: String[1];
PInterestOption: String[1];
PInterestRate: Currency;
Pt_updins: String[1];
Pt_lndate: String[1];
Pt_matdate: String[1];
Pt_branch: String[1];
Pt_off: String[1];
Pt_short: String[1];
Pt_name: String[1];
Pt_addr: String[1];
Pt_coll: String[1];
PnextrunDate: String[8];
PrunfreqDays: SmallInt;
Pforcerun: String[1];
Plast_updDate: String[8];
Plast_ihisDate: String[8];
Plast_thisDate: String[8];
Plast_diskDate: String[8];
Plast_tapeDate: String[8];
PfirstrunDate: String[8];
Pcancdate: String[8];
PMailCarrier: String[2];
PCallforDataDOW: String[2];
Phold_run: String[1];
Prevlevel: String[1];
Pnum_mod: SmallInt;
Pmod: String[1];
Plen_def: String[6];
Pdef_text: String[20];
PPrintMissingdataOfficerOrder: String[1];
Pmisstitle: String[1];
Psite_type: String[1];
Pic_input: String[1];
Pnoticeid: String[6];
Pinq_type: String[1];
Pdoc_id: String[1];
PCollateralValueOption: String[1];
Pimage_opt: String[1];
Pprintid: String[6];
Pfstrun: String[6];
Pfststmt: String[4];
Pmathold: SmallInt;
PNoticeSortOrder1: String[1];
PNoticeSortOrder2: String[1];
PNoticeSortOrder3: String[1];
PNoticeSortOrder4: String[1];
PNoticeSortOrder5: String[1];
PFiller2: String[75];
Pspec_tab: String[35];
PPremiumChartCopies: Integer;
PMailingLabeltype: String[1];
Pfnotdate: Integer;
Psnotdate: Integer;
PcollateralUse: String[1];
Preflag: String[1];
Pfnottype: String[1];
Ppcprint: String[1];
PBalanceReportSortRequest: String[1];
Ppoldate: Integer;
Phistptr: String[6];
PNoteNumber: SmallInt;
POptions: String[50];
PclContact: String[30];
PclAddress: String[30];
PclCityStZip: String[30];
PclPhone: String[30];
PclFax: String[30];
PplContact: String[30];
PplAddress: String[30];
PplCityStZip: String[30];
PplPhone: String[30];
PplFax: String[30];
PLastRunDate: String[32];
PRunControl: String[2];
PTranControl: String[2];
PLast4RunNum: String[8];
PAccountId: String[4];
PRefundOpt: String[1];
PInterim: String[1];
End;
// function CtoRInfoLENDER(AClass:TInfoLENDERClass):TInfoLENDERRecord;
// procedure RtoCInfoLENDER(ARecord:TInfoLENDERRecord;AClass:TInfoLENDERClass);
TInfoLENDERBuffer = class(TDataBuf)
protected
function PtrIndex(Index:integer):Pointer;override;
public
Data: TInfoLENDERRecord;
function FieldNameToIndex(s:string):integer;override;
function FieldType(index:integer):TFieldType;override;
end;
TEIInfoLENDER = (InfoLENDERPrimaryKey, InfoLENDERLender, InfoLENDERLenderName);
TInfoLENDERTable = class( TDBISAMTableAU )
private
FDFLenderID: TStringField;
FDFModCount: TSmallIntField;
FDFclient: TStringField;
FDFSystemType: TStringField;
FDFstatus: TStringField;
FDFNetStatement: TStringField;
FDFname: TStringField;
FDFAddress: TStringField;
FDFAddress2: TStringField;
FDFCityState: TStringField;
FDFZipCode: TStringField;
FDFStreetName: TStringField;
FDFStreetAddress: TStringField;
FDFStreetCSZ: TStringField;
FDFstate: TStringField;
FDFPhoneNumber: TStringField;
FDFPhoneExtension: TStringField;
FDFResidentAdminName: TStringField;
FDFResidentAdminPhone: TStringField;
FDFResidentAdminPhoneExtension: TStringField;
FDFFaxNumber: TStringField;
FDFgroup: TStringField;
FDFStatementGroup: TStringField;
FDFClientID: TStringField;
FDFpcgroup: TStringField;
FDFBalanceLimit: TIntegerField;
FDFdel_lim: TIntegerField;
FDFbaldel: TStringField;
FDFMatureLoanHoldDays: TSmallIntField;
FDFTapeHoldDays: TSmallIntField;
FDFrunevents: TStringField;
FDFmethod: TStringField;
FDFCommisionEntityMix: TStringField;
FDFMasterMix: TStringField;
FDFBlanketPolicyMix: TStringField;
FDFGracePeriodOption: TStringField;
FDFNewGraceDays: TSmallIntField;
FDFExpGraceDays: TSmallIntField;
FDFcancellgraceDays: TSmallIntField;
FDFMaxBackDays: TSmallIntField;
FDFErrorOmissionInceptionDate: TStringField;
FDFOverrideEODate: TStringField;
FDFmanprint: TStringField;
FDFbook_all: TStringField;
FDFWaverNonPayDays: TSmallIntField;
FDFnewpmt: TStringField;
FDFStatementContactName: TStringField;
FDFOfficeContactName: TStringField;
FDFNoticeSignature: TStringField;
FDFNoticeSignature2: TStringField;
FDFMasterPolicyNumber: TStringField;
FDFBlanketPolicyNumber: TStringField;
FDFEarningMethodCode: TStringField;
FDFCancellationMethocCode: TStringField;
FDFtapeid: TStringField;
FDFdiskid: TStringField;
FDFInquiryID: TStringField;
FDFCancellationID: TStringField;
FDFStatementID: TStringField;
FDFBranchBankingOption: TStringField;
FDFunwaive: TStringField;
FDFSpecialApprovalCode_opt9x: TStringField;
FDFmon_only: TStringField;
FDFkeepForcedData: TStringField;
FDFautorenew: TStringField;
FDFInterestOption: TStringField;
FDFInterestRate: TCurrencyField;
FDFt_updins: TStringField;
FDFt_lndate: TStringField;
FDFt_matdate: TStringField;
FDFt_branch: TStringField;
FDFt_off: TStringField;
FDFt_short: TStringField;
FDFt_name: TStringField;
FDFt_addr: TStringField;
FDFt_coll: TStringField;
FDFnextrunDate: TStringField;
FDFrunfreqDays: TSmallIntField;
FDFforcerun: TStringField;
FDFlast_updDate: TStringField;
FDFlast_ihisDate: TStringField;
FDFlast_thisDate: TStringField;
FDFlast_diskDate: TStringField;
FDFlast_tapeDate: TStringField;
FDFfirstrunDate: TStringField;
FDFcancdate: TStringField;
FDFMailCarrier: TStringField;
FDFCallforDataDOW: TStringField;
FDFhold_run: TStringField;
FDFrevlevel: TStringField;
FDFnum_mod: TSmallIntField;
FDFmod: TStringField;
FDFlen_def: TStringField;
FDFdef_text: TStringField;
FDFPrintMissingdataOfficerOrder: TStringField;
FDFmisstitle: TStringField;
FDFsite_type: TStringField;
FDFic_input: TStringField;
FDFnoticeid: TStringField;
FDFinq_type: TStringField;
FDFdoc_id: TStringField;
FDFCollateralValueOption: TStringField;
FDFimage_opt: TStringField;
FDFprintid: TStringField;
FDFfstrun: TStringField;
FDFfststmt: TStringField;
FDFmathold: TSmallIntField;
FDFNoticeSortOrder1: TStringField;
FDFNoticeSortOrder2: TStringField;
FDFNoticeSortOrder3: TStringField;
FDFNoticeSortOrder4: TStringField;
FDFNoticeSortOrder5: TStringField;
FDFFiller2: TStringField;
FDFspec_tab: TStringField;
FDFPremiumChartCopies: TIntegerField;
FDFMailingLabeltype: TStringField;
FDFfnotdate: TIntegerField;
FDFsnotdate: TIntegerField;
FDFcollateralUse: TStringField;
FDFreflag: TStringField;
FDFfnottype: TStringField;
FDFpcprint: TStringField;
FDFBalanceReportSortRequest: TStringField;
FDFpoldate: TIntegerField;
FDFhistptr: TStringField;
FDFNoteNumber: TSmallIntField;
FDFOptions: TStringField;
FDFclContact: TStringField;
FDFclAddress: TStringField;
FDFclCityStZip: TStringField;
FDFclPhone: TStringField;
FDFclFax: TStringField;
FDFplContact: TStringField;
FDFplAddress: TStringField;
FDFplCityStZip: TStringField;
FDFplPhone: TStringField;
FDFplFax: TStringField;
FDFLastRunDate: TStringField;
FDFRunControl: TStringField;
FDFTranControl: TStringField;
FDFLast4RunNum: TStringField;
FDFAccountId: TStringField;
FDFRefundOpt: TStringField;
FDFInterim: TStringField;
procedure SetPLenderID(const Value: String);
function GetPLenderID:String;
procedure SetPModCount(const Value: SmallInt);
function GetPModCount:SmallInt;
procedure SetPclient(const Value: String);
function GetPclient:String;
procedure SetPSystemType(const Value: String);
function GetPSystemType:String;
procedure SetPstatus(const Value: String);
function GetPstatus:String;
procedure SetPNetStatement(const Value: String);
function GetPNetStatement:String;
procedure SetPname(const Value: String);
function GetPname:String;
procedure SetPAddress(const Value: String);
function GetPAddress:String;
procedure SetPAddress2(const Value: String);
function GetPAddress2:String;
procedure SetPCityState(const Value: String);
function GetPCityState:String;
procedure SetPZipCode(const Value: String);
function GetPZipCode:String;
procedure SetPStreetName(const Value: String);
function GetPStreetName:String;
procedure SetPStreetAddress(const Value: String);
function GetPStreetAddress:String;
procedure SetPStreetCSZ(const Value: String);
function GetPStreetCSZ:String;
procedure SetPstate(const Value: String);
function GetPstate:String;
procedure SetPPhoneNumber(const Value: String);
function GetPPhoneNumber:String;
procedure SetPPhoneExtension(const Value: String);
function GetPPhoneExtension:String;
procedure SetPResidentAdminName(const Value: String);
function GetPResidentAdminName:String;
procedure SetPResidentAdminPhone(const Value: String);
function GetPResidentAdminPhone:String;
procedure SetPResidentAdminPhoneExtension(const Value: String);
function GetPResidentAdminPhoneExtension:String;
procedure SetPFaxNumber(const Value: String);
function GetPFaxNumber:String;
procedure SetPgroup(const Value: String);
function GetPgroup:String;
procedure SetPStatementGroup(const Value: String);
function GetPStatementGroup:String;
procedure SetPClientID(const Value: String);
function GetPClientID:String;
procedure SetPpcgroup(const Value: String);
function GetPpcgroup:String;
procedure SetPBalanceLimit(const Value: Integer);
function GetPBalanceLimit:Integer;
procedure SetPdel_lim(const Value: Integer);
function GetPdel_lim:Integer;
procedure SetPbaldel(const Value: String);
function GetPbaldel:String;
procedure SetPMatureLoanHoldDays(const Value: SmallInt);
function GetPMatureLoanHoldDays:SmallInt;
procedure SetPTapeHoldDays(const Value: SmallInt);
function GetPTapeHoldDays:SmallInt;
procedure SetPrunevents(const Value: String);
function GetPrunevents:String;
procedure SetPmethod(const Value: String);
function GetPmethod:String;
procedure SetPCommisionEntityMix(const Value: String);
function GetPCommisionEntityMix:String;
procedure SetPMasterMix(const Value: String);
function GetPMasterMix:String;
procedure SetPBlanketPolicyMix(const Value: String);
function GetPBlanketPolicyMix:String;
procedure SetPGracePeriodOption(const Value: String);
function GetPGracePeriodOption:String;
procedure SetPNewGraceDays(const Value: SmallInt);
function GetPNewGraceDays:SmallInt;
procedure SetPExpGraceDays(const Value: SmallInt);
function GetPExpGraceDays:SmallInt;
procedure SetPcancellgraceDays(const Value: SmallInt);
function GetPcancellgraceDays:SmallInt;
procedure SetPMaxBackDays(const Value: SmallInt);
function GetPMaxBackDays:SmallInt;
procedure SetPErrorOmissionInceptionDate(const Value: String);
function GetPErrorOmissionInceptionDate:String;
procedure SetPOverrideEODate(const Value: String);
function GetPOverrideEODate:String;
procedure SetPmanprint(const Value: String);
function GetPmanprint:String;
procedure SetPbook_all(const Value: String);
function GetPbook_all:String;
procedure SetPWaverNonPayDays(const Value: SmallInt);
function GetPWaverNonPayDays:SmallInt;
procedure SetPnewpmt(const Value: String);
function GetPnewpmt:String;
procedure SetPStatementContactName(const Value: String);
function GetPStatementContactName:String;
procedure SetPOfficeContactName(const Value: String);
function GetPOfficeContactName:String;
procedure SetPNoticeSignature(const Value: String);
function GetPNoticeSignature:String;
procedure SetPNoticeSignature2(const Value: String);
function GetPNoticeSignature2:String;
procedure SetPMasterPolicyNumber(const Value: String);
function GetPMasterPolicyNumber:String;
procedure SetPBlanketPolicyNumber(const Value: String);
function GetPBlanketPolicyNumber:String;
procedure SetPEarningMethodCode(const Value: String);
function GetPEarningMethodCode:String;
procedure SetPCancellationMethocCode(const Value: String);
function GetPCancellationMethocCode:String;
procedure SetPtapeid(const Value: String);
function GetPtapeid:String;
procedure SetPdiskid(const Value: String);
function GetPdiskid:String;
procedure SetPInquiryID(const Value: String);
function GetPInquiryID:String;
procedure SetPCancellationID(const Value: String);
function GetPCancellationID:String;
procedure SetPStatementID(const Value: String);
function GetPStatementID:String;
procedure SetPBranchBankingOption(const Value: String);
function GetPBranchBankingOption:String;
procedure SetPunwaive(const Value: String);
function GetPunwaive:String;
procedure SetPSpecialApprovalCode_opt9x(const Value: String);
function GetPSpecialApprovalCode_opt9x:String;
procedure SetPmon_only(const Value: String);
function GetPmon_only:String;
procedure SetPkeepForcedData(const Value: String);
function GetPkeepForcedData:String;
procedure SetPautorenew(const Value: String);
function GetPautorenew:String;
procedure SetPInterestOption(const Value: String);
function GetPInterestOption:String;
procedure SetPInterestRate(const Value: Currency);
function GetPInterestRate:Currency;
procedure SetPt_updins(const Value: String);
function GetPt_updins:String;
procedure SetPt_lndate(const Value: String);
function GetPt_lndate:String;
procedure SetPt_matdate(const Value: String);
function GetPt_matdate:String;
procedure SetPt_branch(const Value: String);
function GetPt_branch:String;
procedure SetPt_off(const Value: String);
function GetPt_off:String;
procedure SetPt_short(const Value: String);
function GetPt_short:String;
procedure SetPt_name(const Value: String);
function GetPt_name:String;
procedure SetPt_addr(const Value: String);
function GetPt_addr:String;
procedure SetPt_coll(const Value: String);
function GetPt_coll:String;
procedure SetPnextrunDate(const Value: String);
function GetPnextrunDate:String;
procedure SetPrunfreqDays(const Value: SmallInt);
function GetPrunfreqDays:SmallInt;
procedure SetPforcerun(const Value: String);
function GetPforcerun:String;
procedure SetPlast_updDate(const Value: String);
function GetPlast_updDate:String;
procedure SetPlast_ihisDate(const Value: String);
function GetPlast_ihisDate:String;
procedure SetPlast_thisDate(const Value: String);
function GetPlast_thisDate:String;
procedure SetPlast_diskDate(const Value: String);
function GetPlast_diskDate:String;
procedure SetPlast_tapeDate(const Value: String);
function GetPlast_tapeDate:String;
procedure SetPfirstrunDate(const Value: String);
function GetPfirstrunDate:String;
procedure SetPcancdate(const Value: String);
function GetPcancdate:String;
procedure SetPMailCarrier(const Value: String);
function GetPMailCarrier:String;
procedure SetPCallforDataDOW(const Value: String);
function GetPCallforDataDOW:String;
procedure SetPhold_run(const Value: String);
function GetPhold_run:String;
procedure SetPrevlevel(const Value: String);
function GetPrevlevel:String;
procedure SetPnum_mod(const Value: SmallInt);
function GetPnum_mod:SmallInt;
procedure SetPmod(const Value: String);
function GetPmod:String;
procedure SetPlen_def(const Value: String);
function GetPlen_def:String;
procedure SetPdef_text(const Value: String);
function GetPdef_text:String;
procedure SetPPrintMissingdataOfficerOrder(const Value: String);
function GetPPrintMissingdataOfficerOrder:String;
procedure SetPmisstitle(const Value: String);
function GetPmisstitle:String;
procedure SetPsite_type(const Value: String);
function GetPsite_type:String;
procedure SetPic_input(const Value: String);
function GetPic_input:String;
procedure SetPnoticeid(const Value: String);
function GetPnoticeid:String;
procedure SetPinq_type(const Value: String);
function GetPinq_type:String;
procedure SetPdoc_id(const Value: String);
function GetPdoc_id:String;
procedure SetPCollateralValueOption(const Value: String);
function GetPCollateralValueOption:String;
procedure SetPimage_opt(const Value: String);
function GetPimage_opt:String;
procedure SetPprintid(const Value: String);
function GetPprintid:String;
procedure SetPfstrun(const Value: String);
function GetPfstrun:String;
procedure SetPfststmt(const Value: String);
function GetPfststmt:String;
procedure SetPmathold(const Value: SmallInt);
function GetPmathold:SmallInt;
procedure SetPNoticeSortOrder1(const Value: String);
function GetPNoticeSortOrder1:String;
procedure SetPNoticeSortOrder2(const Value: String);
function GetPNoticeSortOrder2:String;
procedure SetPNoticeSortOrder3(const Value: String);
function GetPNoticeSortOrder3:String;
procedure SetPNoticeSortOrder4(const Value: String);
function GetPNoticeSortOrder4:String;
procedure SetPNoticeSortOrder5(const Value: String);
function GetPNoticeSortOrder5:String;
procedure SetPFiller2(const Value: String);
function GetPFiller2:String;
procedure SetPspec_tab(const Value: String);
function GetPspec_tab:String;
procedure SetPPremiumChartCopies(const Value: Integer);
function GetPPremiumChartCopies:Integer;
procedure SetPMailingLabeltype(const Value: String);
function GetPMailingLabeltype:String;
procedure SetPfnotdate(const Value: Integer);
function GetPfnotdate:Integer;
procedure SetPsnotdate(const Value: Integer);
function GetPsnotdate:Integer;
procedure SetPcollateralUse(const Value: String);
function GetPcollateralUse:String;
procedure SetPreflag(const Value: String);
function GetPreflag:String;
procedure SetPfnottype(const Value: String);
function GetPfnottype:String;
procedure SetPpcprint(const Value: String);
function GetPpcprint:String;
procedure SetPBalanceReportSortRequest(const Value: String);
function GetPBalanceReportSortRequest:String;
procedure SetPpoldate(const Value: Integer);
function GetPpoldate:Integer;
procedure SetPhistptr(const Value: String);
function GetPhistptr:String;
procedure SetPNoteNumber(const Value: SmallInt);
function GetPNoteNumber:SmallInt;
procedure SetPOptions(const Value: String);
function GetPOptions:String;
procedure SetPclContact(const Value: String);
function GetPclContact:String;
procedure SetPclAddress(const Value: String);
function GetPclAddress:String;
procedure SetPclCityStZip(const Value: String);
function GetPclCityStZip:String;
procedure SetPclPhone(const Value: String);
function GetPclPhone:String;
procedure SetPclFax(const Value: String);
function GetPclFax:String;
procedure SetPplContact(const Value: String);
function GetPplContact:String;
procedure SetPplAddress(const Value: String);
function GetPplAddress:String;
procedure SetPplCityStZip(const Value: String);
function GetPplCityStZip:String;
procedure SetPplPhone(const Value: String);
function GetPplPhone:String;
procedure SetPplFax(const Value: String);
function GetPplFax:String;
procedure SetPLastRunDate(const Value: String);
function GetPLastRunDate:String;
procedure SetPRunControl(const Value: String);
function GetPRunControl:String;
procedure SetPTranControl(const Value: String);
function GetPTranControl:String;
procedure SetPLast4RunNum(const Value: String);
function GetPLast4RunNum:String;
procedure SetPAccountId(const Value: String);
function GetPAccountId:String;
procedure SetPRefundOpt(const Value: String);
function GetPRefundOpt:String;
procedure SetPInterim(const Value: String);
function GetPInterim:String;
procedure SetEnumIndex(Value: TEIInfoLENDER);
function GetEnumIndex: TEIInfoLENDER;
protected
procedure CreateFields; reintroduce;
procedure SetActive(Value: Boolean); override;
procedure LoadFieldDefs(AStringList:TStringList);override;
procedure LoadIndexDefs(AStringList:TStringList);override;
public
function GetDataBuffer:TInfoLENDERRecord;
procedure StoreDataBuffer(ABuffer:TInfoLENDERRecord);
property DFLenderID: TStringField read FDFLenderID;
property DFModCount: TSmallIntField read FDFModCount;
property DFclient: TStringField read FDFclient;
property DFSystemType: TStringField read FDFSystemType;
property DFstatus: TStringField read FDFstatus;
property DFNetStatement: TStringField read FDFNetStatement;
property DFname: TStringField read FDFname;
property DFAddress: TStringField read FDFAddress;
property DFAddress2: TStringField read FDFAddress2;
property DFCityState: TStringField read FDFCityState;
property DFZipCode: TStringField read FDFZipCode;
property DFStreetName: TStringField read FDFStreetName;
property DFStreetAddress: TStringField read FDFStreetAddress;
property DFStreetCSZ: TStringField read FDFStreetCSZ;
property DFstate: TStringField read FDFstate;
property DFPhoneNumber: TStringField read FDFPhoneNumber;
property DFPhoneExtension: TStringField read FDFPhoneExtension;
property DFResidentAdminName: TStringField read FDFResidentAdminName;
property DFResidentAdminPhone: TStringField read FDFResidentAdminPhone;
property DFResidentAdminPhoneExtension: TStringField read FDFResidentAdminPhoneExtension;
property DFFaxNumber: TStringField read FDFFaxNumber;
property DFgroup: TStringField read FDFgroup;
property DFStatementGroup: TStringField read FDFStatementGroup;
property DFClientID: TStringField read FDFClientID;
property DFpcgroup: TStringField read FDFpcgroup;
property DFBalanceLimit: TIntegerField read FDFBalanceLimit;
property DFdel_lim: TIntegerField read FDFdel_lim;
property DFbaldel: TStringField read FDFbaldel;
property DFMatureLoanHoldDays: TSmallIntField read FDFMatureLoanHoldDays;
property DFTapeHoldDays: TSmallIntField read FDFTapeHoldDays;
property DFrunevents: TStringField read FDFrunevents;
property DFmethod: TStringField read FDFmethod;
property DFCommisionEntityMix: TStringField read FDFCommisionEntityMix;
property DFMasterMix: TStringField read FDFMasterMix;
property DFBlanketPolicyMix: TStringField read FDFBlanketPolicyMix;
property DFGracePeriodOption: TStringField read FDFGracePeriodOption;
property DFNewGraceDays: TSmallIntField read FDFNewGraceDays;
property DFExpGraceDays: TSmallIntField read FDFExpGraceDays;
property DFcancellgraceDays: TSmallIntField read FDFcancellgraceDays;
property DFMaxBackDays: TSmallIntField read FDFMaxBackDays;
property DFErrorOmissionInceptionDate: TStringField read FDFErrorOmissionInceptionDate;
property DFOverrideEODate: TStringField read FDFOverrideEODate;
property DFmanprint: TStringField read FDFmanprint;
property DFbook_all: TStringField read FDFbook_all;
property DFWaverNonPayDays: TSmallIntField read FDFWaverNonPayDays;
property DFnewpmt: TStringField read FDFnewpmt;
property DFStatementContactName: TStringField read FDFStatementContactName;
property DFOfficeContactName: TStringField read FDFOfficeContactName;
property DFNoticeSignature: TStringField read FDFNoticeSignature;
property DFNoticeSignature2: TStringField read FDFNoticeSignature2;
property DFMasterPolicyNumber: TStringField read FDFMasterPolicyNumber;
property DFBlanketPolicyNumber: TStringField read FDFBlanketPolicyNumber;
property DFEarningMethodCode: TStringField read FDFEarningMethodCode;
property DFCancellationMethocCode: TStringField read FDFCancellationMethocCode;
property DFtapeid: TStringField read FDFtapeid;
property DFdiskid: TStringField read FDFdiskid;
property DFInquiryID: TStringField read FDFInquiryID;
property DFCancellationID: TStringField read FDFCancellationID;
property DFStatementID: TStringField read FDFStatementID;
property DFBranchBankingOption: TStringField read FDFBranchBankingOption;
property DFunwaive: TStringField read FDFunwaive;
property DFSpecialApprovalCode_opt9x: TStringField read FDFSpecialApprovalCode_opt9x;
property DFmon_only: TStringField read FDFmon_only;
property DFkeepForcedData: TStringField read FDFkeepForcedData;
property DFautorenew: TStringField read FDFautorenew;
property DFInterestOption: TStringField read FDFInterestOption;
property DFInterestRate: TCurrencyField read FDFInterestRate;
property DFt_updins: TStringField read FDFt_updins;
property DFt_lndate: TStringField read FDFt_lndate;
property DFt_matdate: TStringField read FDFt_matdate;
property DFt_branch: TStringField read FDFt_branch;
property DFt_off: TStringField read FDFt_off;
property DFt_short: TStringField read FDFt_short;
property DFt_name: TStringField read FDFt_name;
property DFt_addr: TStringField read FDFt_addr;
property DFt_coll: TStringField read FDFt_coll;
property DFnextrunDate: TStringField read FDFnextrunDate;
property DFrunfreqDays: TSmallIntField read FDFrunfreqDays;
property DFforcerun: TStringField read FDFforcerun;
property DFlast_updDate: TStringField read FDFlast_updDate;
property DFlast_ihisDate: TStringField read FDFlast_ihisDate;
property DFlast_thisDate: TStringField read FDFlast_thisDate;
property DFlast_diskDate: TStringField read FDFlast_diskDate;
property DFlast_tapeDate: TStringField read FDFlast_tapeDate;
property DFfirstrunDate: TStringField read FDFfirstrunDate;
property DFcancdate: TStringField read FDFcancdate;
property DFMailCarrier: TStringField read FDFMailCarrier;
property DFCallforDataDOW: TStringField read FDFCallforDataDOW;
property DFhold_run: TStringField read FDFhold_run;
property DFrevlevel: TStringField read FDFrevlevel;
property DFnum_mod: TSmallIntField read FDFnum_mod;
property DFmod: TStringField read FDFmod;
property DFlen_def: TStringField read FDFlen_def;
property DFdef_text: TStringField read FDFdef_text;
property DFPrintMissingdataOfficerOrder: TStringField read FDFPrintMissingdataOfficerOrder;
property DFmisstitle: TStringField read FDFmisstitle;
property DFsite_type: TStringField read FDFsite_type;
property DFic_input: TStringField read FDFic_input;
property DFnoticeid: TStringField read FDFnoticeid;
property DFinq_type: TStringField read FDFinq_type;
property DFdoc_id: TStringField read FDFdoc_id;
property DFCollateralValueOption: TStringField read FDFCollateralValueOption;
property DFimage_opt: TStringField read FDFimage_opt;
property DFprintid: TStringField read FDFprintid;
property DFfstrun: TStringField read FDFfstrun;
property DFfststmt: TStringField read FDFfststmt;
property DFmathold: TSmallIntField read FDFmathold;
property DFNoticeSortOrder1: TStringField read FDFNoticeSortOrder1;
property DFNoticeSortOrder2: TStringField read FDFNoticeSortOrder2;
property DFNoticeSortOrder3: TStringField read FDFNoticeSortOrder3;
property DFNoticeSortOrder4: TStringField read FDFNoticeSortOrder4;
property DFNoticeSortOrder5: TStringField read FDFNoticeSortOrder5;
property DFFiller2: TStringField read FDFFiller2;
property DFspec_tab: TStringField read FDFspec_tab;
property DFPremiumChartCopies: TIntegerField read FDFPremiumChartCopies;
property DFMailingLabeltype: TStringField read FDFMailingLabeltype;
property DFfnotdate: TIntegerField read FDFfnotdate;
property DFsnotdate: TIntegerField read FDFsnotdate;
property DFcollateralUse: TStringField read FDFcollateralUse;
property DFreflag: TStringField read FDFreflag;
property DFfnottype: TStringField read FDFfnottype;
property DFpcprint: TStringField read FDFpcprint;
property DFBalanceReportSortRequest: TStringField read FDFBalanceReportSortRequest;
property DFpoldate: TIntegerField read FDFpoldate;
property DFhistptr: TStringField read FDFhistptr;
property DFNoteNumber: TSmallIntField read FDFNoteNumber;
property DFOptions: TStringField read FDFOptions;
property DFclContact: TStringField read FDFclContact;
property DFclAddress: TStringField read FDFclAddress;
property DFclCityStZip: TStringField read FDFclCityStZip;
property DFclPhone: TStringField read FDFclPhone;
property DFclFax: TStringField read FDFclFax;
property DFplContact: TStringField read FDFplContact;
property DFplAddress: TStringField read FDFplAddress;
property DFplCityStZip: TStringField read FDFplCityStZip;
property DFplPhone: TStringField read FDFplPhone;
property DFplFax: TStringField read FDFplFax;
property DFLastRunDate: TStringField read FDFLastRunDate;
property DFRunControl: TStringField read FDFRunControl;
property DFTranControl: TStringField read FDFTranControl;
property DFLast4RunNum: TStringField read FDFLast4RunNum;
property DFAccountId: TStringField read FDFAccountId;
property DFRefundOpt: TStringField read FDFRefundOpt;
property DFInterim: TStringField read FDFInterim;
property PLenderID: String read GetPLenderID write SetPLenderID;
property PModCount: SmallInt read GetPModCount write SetPModCount;
property Pclient: String read GetPclient write SetPclient;
property PSystemType: String read GetPSystemType write SetPSystemType;
property Pstatus: String read GetPstatus write SetPstatus;
property PNetStatement: String read GetPNetStatement write SetPNetStatement;
property Pname: String read GetPname write SetPname;
property PAddress: String read GetPAddress write SetPAddress;
property PAddress2: String read GetPAddress2 write SetPAddress2;
property PCityState: String read GetPCityState write SetPCityState;
property PZipCode: String read GetPZipCode write SetPZipCode;
property PStreetName: String read GetPStreetName write SetPStreetName;
property PStreetAddress: String read GetPStreetAddress write SetPStreetAddress;
property PStreetCSZ: String read GetPStreetCSZ write SetPStreetCSZ;
property Pstate: String read GetPstate write SetPstate;
property PPhoneNumber: String read GetPPhoneNumber write SetPPhoneNumber;
property PPhoneExtension: String read GetPPhoneExtension write SetPPhoneExtension;
property PResidentAdminName: String read GetPResidentAdminName write SetPResidentAdminName;
property PResidentAdminPhone: String read GetPResidentAdminPhone write SetPResidentAdminPhone;
property PResidentAdminPhoneExtension: String read GetPResidentAdminPhoneExtension write SetPResidentAdminPhoneExtension;
property PFaxNumber: String read GetPFaxNumber write SetPFaxNumber;
property Pgroup: String read GetPgroup write SetPgroup;
property PStatementGroup: String read GetPStatementGroup write SetPStatementGroup;
property PClientID: String read GetPClientID write SetPClientID;
property Ppcgroup: String read GetPpcgroup write SetPpcgroup;
property PBalanceLimit: Integer read GetPBalanceLimit write SetPBalanceLimit;
property Pdel_lim: Integer read GetPdel_lim write SetPdel_lim;
property Pbaldel: String read GetPbaldel write SetPbaldel;
property PMatureLoanHoldDays: SmallInt read GetPMatureLoanHoldDays write SetPMatureLoanHoldDays;
property PTapeHoldDays: SmallInt read GetPTapeHoldDays write SetPTapeHoldDays;
property Prunevents: String read GetPrunevents write SetPrunevents;
property Pmethod: String read GetPmethod write SetPmethod;
property PCommisionEntityMix: String read GetPCommisionEntityMix write SetPCommisionEntityMix;
property PMasterMix: String read GetPMasterMix write SetPMasterMix;
property PBlanketPolicyMix: String read GetPBlanketPolicyMix write SetPBlanketPolicyMix;
property PGracePeriodOption: String read GetPGracePeriodOption write SetPGracePeriodOption;
property PNewGraceDays: SmallInt read GetPNewGraceDays write SetPNewGraceDays;
property PExpGraceDays: SmallInt read GetPExpGraceDays write SetPExpGraceDays;
property PcancellgraceDays: SmallInt read GetPcancellgraceDays write SetPcancellgraceDays;
property PMaxBackDays: SmallInt read GetPMaxBackDays write SetPMaxBackDays;
property PErrorOmissionInceptionDate: String read GetPErrorOmissionInceptionDate write SetPErrorOmissionInceptionDate;
property POverrideEODate: String read GetPOverrideEODate write SetPOverrideEODate;
property Pmanprint: String read GetPmanprint write SetPmanprint;
property Pbook_all: String read GetPbook_all write SetPbook_all;
property PWaverNonPayDays: SmallInt read GetPWaverNonPayDays write SetPWaverNonPayDays;
property Pnewpmt: String read GetPnewpmt write SetPnewpmt;
property PStatementContactName: String read GetPStatementContactName write SetPStatementContactName;
property POfficeContactName: String read GetPOfficeContactName write SetPOfficeContactName;
property PNoticeSignature: String read GetPNoticeSignature write SetPNoticeSignature;
property PNoticeSignature2: String read GetPNoticeSignature2 write SetPNoticeSignature2;
property PMasterPolicyNumber: String read GetPMasterPolicyNumber write SetPMasterPolicyNumber;
property PBlanketPolicyNumber: String read GetPBlanketPolicyNumber write SetPBlanketPolicyNumber;
property PEarningMethodCode: String read GetPEarningMethodCode write SetPEarningMethodCode;
property PCancellationMethocCode: String read GetPCancellationMethocCode write SetPCancellationMethocCode;
property Ptapeid: String read GetPtapeid write SetPtapeid;
property Pdiskid: String read GetPdiskid write SetPdiskid;
property PInquiryID: String read GetPInquiryID write SetPInquiryID;
property PCancellationID: String read GetPCancellationID write SetPCancellationID;
property PStatementID: String read GetPStatementID write SetPStatementID;
property PBranchBankingOption: String read GetPBranchBankingOption write SetPBranchBankingOption;
property Punwaive: String read GetPunwaive write SetPunwaive;
property PSpecialApprovalCode_opt9x: String read GetPSpecialApprovalCode_opt9x write SetPSpecialApprovalCode_opt9x;
property Pmon_only: String read GetPmon_only write SetPmon_only;
property PkeepForcedData: String read GetPkeepForcedData write SetPkeepForcedData;
property Pautorenew: String read GetPautorenew write SetPautorenew;
property PInterestOption: String read GetPInterestOption write SetPInterestOption;
property PInterestRate: Currency read GetPInterestRate write SetPInterestRate;
property Pt_updins: String read GetPt_updins write SetPt_updins;
property Pt_lndate: String read GetPt_lndate write SetPt_lndate;
property Pt_matdate: String read GetPt_matdate write SetPt_matdate;
property Pt_branch: String read GetPt_branch write SetPt_branch;
property Pt_off: String read GetPt_off write SetPt_off;
property Pt_short: String read GetPt_short write SetPt_short;
property Pt_name: String read GetPt_name write SetPt_name;
property Pt_addr: String read GetPt_addr write SetPt_addr;
property Pt_coll: String read GetPt_coll write SetPt_coll;
property PnextrunDate: String read GetPnextrunDate write SetPnextrunDate;
property PrunfreqDays: SmallInt read GetPrunfreqDays write SetPrunfreqDays;
property Pforcerun: String read GetPforcerun write SetPforcerun;
property Plast_updDate: String read GetPlast_updDate write SetPlast_updDate;
property Plast_ihisDate: String read GetPlast_ihisDate write SetPlast_ihisDate;
property Plast_thisDate: String read GetPlast_thisDate write SetPlast_thisDate;
property Plast_diskDate: String read GetPlast_diskDate write SetPlast_diskDate;
property Plast_tapeDate: String read GetPlast_tapeDate write SetPlast_tapeDate;
property PfirstrunDate: String read GetPfirstrunDate write SetPfirstrunDate;
property Pcancdate: String read GetPcancdate write SetPcancdate;
property PMailCarrier: String read GetPMailCarrier write SetPMailCarrier;
property PCallforDataDOW: String read GetPCallforDataDOW write SetPCallforDataDOW;
property Phold_run: String read GetPhold_run write SetPhold_run;
property Prevlevel: String read GetPrevlevel write SetPrevlevel;
property Pnum_mod: SmallInt read GetPnum_mod write SetPnum_mod;
property Pmod: String read GetPmod write SetPmod;
property Plen_def: String read GetPlen_def write SetPlen_def;
property Pdef_text: String read GetPdef_text write SetPdef_text;
property PPrintMissingdataOfficerOrder: String read GetPPrintMissingdataOfficerOrder write SetPPrintMissingdataOfficerOrder;
property Pmisstitle: String read GetPmisstitle write SetPmisstitle;
property Psite_type: String read GetPsite_type write SetPsite_type;
property Pic_input: String read GetPic_input write SetPic_input;
property Pnoticeid: String read GetPnoticeid write SetPnoticeid;
property Pinq_type: String read GetPinq_type write SetPinq_type;
property Pdoc_id: String read GetPdoc_id write SetPdoc_id;
property PCollateralValueOption: String read GetPCollateralValueOption write SetPCollateralValueOption;
property Pimage_opt: String read GetPimage_opt write SetPimage_opt;
property Pprintid: String read GetPprintid write SetPprintid;
property Pfstrun: String read GetPfstrun write SetPfstrun;
property Pfststmt: String read GetPfststmt write SetPfststmt;
property Pmathold: SmallInt read GetPmathold write SetPmathold;
property PNoticeSortOrder1: String read GetPNoticeSortOrder1 write SetPNoticeSortOrder1;
property PNoticeSortOrder2: String read GetPNoticeSortOrder2 write SetPNoticeSortOrder2;
property PNoticeSortOrder3: String read GetPNoticeSortOrder3 write SetPNoticeSortOrder3;
property PNoticeSortOrder4: String read GetPNoticeSortOrder4 write SetPNoticeSortOrder4;
property PNoticeSortOrder5: String read GetPNoticeSortOrder5 write SetPNoticeSortOrder5;
property PFiller2: String read GetPFiller2 write SetPFiller2;
property Pspec_tab: String read GetPspec_tab write SetPspec_tab;
property PPremiumChartCopies: Integer read GetPPremiumChartCopies write SetPPremiumChartCopies;
property PMailingLabeltype: String read GetPMailingLabeltype write SetPMailingLabeltype;
property Pfnotdate: Integer read GetPfnotdate write SetPfnotdate;
property Psnotdate: Integer read GetPsnotdate write SetPsnotdate;
property PcollateralUse: String read GetPcollateralUse write SetPcollateralUse;
property Preflag: String read GetPreflag write SetPreflag;
property Pfnottype: String read GetPfnottype write SetPfnottype;
property Ppcprint: String read GetPpcprint write SetPpcprint;
property PBalanceReportSortRequest: String read GetPBalanceReportSortRequest write SetPBalanceReportSortRequest;
property Ppoldate: Integer read GetPpoldate write SetPpoldate;
property Phistptr: String read GetPhistptr write SetPhistptr;
property PNoteNumber: SmallInt read GetPNoteNumber write SetPNoteNumber;
property POptions: String read GetPOptions write SetPOptions;
property PclContact: String read GetPclContact write SetPclContact;
property PclAddress: String read GetPclAddress write SetPclAddress;
property PclCityStZip: String read GetPclCityStZip write SetPclCityStZip;
property PclPhone: String read GetPclPhone write SetPclPhone;
property PclFax: String read GetPclFax write SetPclFax;
property PplContact: String read GetPplContact write SetPplContact;
property PplAddress: String read GetPplAddress write SetPplAddress;
property PplCityStZip: String read GetPplCityStZip write SetPplCityStZip;
property PplPhone: String read GetPplPhone write SetPplPhone;
property PplFax: String read GetPplFax write SetPplFax;
property PLastRunDate: String read GetPLastRunDate write SetPLastRunDate;
property PRunControl: String read GetPRunControl write SetPRunControl;
property PTranControl: String read GetPTranControl write SetPTranControl;
property PLast4RunNum: String read GetPLast4RunNum write SetPLast4RunNum;
property PAccountId: String read GetPAccountId write SetPAccountId;
property PRefundOpt: String read GetPRefundOpt write SetPRefundOpt;
property PInterim: String read GetPInterim write SetPInterim;
published
property Active write SetActive;
property EnumIndex: TEIInfoLENDER read GetEnumIndex write SetEnumIndex;
end; { TInfoLENDERTable }
TInfoLENDERQuery = class( TDBISAMQueryAU )
private
FDFLenderID: TStringField;
FDFModCount: TSmallIntField;
FDFclient: TStringField;
FDFSystemType: TStringField;
FDFstatus: TStringField;
FDFNetStatement: TStringField;
FDFname: TStringField;
FDFAddress: TStringField;
FDFAddress2: TStringField;
FDFCityState: TStringField;
FDFZipCode: TStringField;
FDFStreetName: TStringField;
FDFStreetAddress: TStringField;
FDFStreetCSZ: TStringField;
FDFstate: TStringField;
FDFPhoneNumber: TStringField;
FDFPhoneExtension: TStringField;
FDFResidentAdminName: TStringField;
FDFResidentAdminPhone: TStringField;
FDFResidentAdminPhoneExtension: TStringField;
FDFFaxNumber: TStringField;
FDFgroup: TStringField;
FDFStatementGroup: TStringField;
FDFClientID: TStringField;
FDFpcgroup: TStringField;
FDFBalanceLimit: TIntegerField;
FDFdel_lim: TIntegerField;
FDFbaldel: TStringField;
FDFMatureLoanHoldDays: TSmallIntField;
FDFTapeHoldDays: TSmallIntField;
FDFrunevents: TStringField;
FDFmethod: TStringField;
FDFCommisionEntityMix: TStringField;
FDFMasterMix: TStringField;
FDFBlanketPolicyMix: TStringField;
FDFGracePeriodOption: TStringField;
FDFNewGraceDays: TSmallIntField;
FDFExpGraceDays: TSmallIntField;
FDFcancellgraceDays: TSmallIntField;
FDFMaxBackDays: TSmallIntField;
FDFErrorOmissionInceptionDate: TStringField;
FDFOverrideEODate: TStringField;
FDFmanprint: TStringField;
FDFbook_all: TStringField;
FDFWaverNonPayDays: TSmallIntField;
FDFnewpmt: TStringField;
FDFStatementContactName: TStringField;
FDFOfficeContactName: TStringField;
FDFNoticeSignature: TStringField;
FDFNoticeSignature2: TStringField;
FDFMasterPolicyNumber: TStringField;
FDFBlanketPolicyNumber: TStringField;
FDFEarningMethodCode: TStringField;
FDFCancellationMethocCode: TStringField;
FDFtapeid: TStringField;
FDFdiskid: TStringField;
FDFInquiryID: TStringField;
FDFCancellationID: TStringField;
FDFStatementID: TStringField;
FDFBranchBankingOption: TStringField;
FDFunwaive: TStringField;
FDFSpecialApprovalCode_opt9x: TStringField;
FDFmon_only: TStringField;
FDFkeepForcedData: TStringField;
FDFautorenew: TStringField;
FDFInterestOption: TStringField;
FDFInterestRate: TCurrencyField;
FDFt_updins: TStringField;
FDFt_lndate: TStringField;
FDFt_matdate: TStringField;
FDFt_branch: TStringField;
FDFt_off: TStringField;
FDFt_short: TStringField;
FDFt_name: TStringField;
FDFt_addr: TStringField;
FDFt_coll: TStringField;
FDFnextrunDate: TStringField;
FDFrunfreqDays: TSmallIntField;
FDFforcerun: TStringField;
FDFlast_updDate: TStringField;
FDFlast_ihisDate: TStringField;
FDFlast_thisDate: TStringField;
FDFlast_diskDate: TStringField;
FDFlast_tapeDate: TStringField;
FDFfirstrunDate: TStringField;
FDFcancdate: TStringField;
FDFMailCarrier: TStringField;
FDFCallforDataDOW: TStringField;
FDFhold_run: TStringField;
FDFrevlevel: TStringField;
FDFnum_mod: TSmallIntField;
FDFmod: TStringField;
FDFlen_def: TStringField;
FDFdef_text: TStringField;
FDFPrintMissingdataOfficerOrder: TStringField;
FDFmisstitle: TStringField;
FDFsite_type: TStringField;
FDFic_input: TStringField;
FDFnoticeid: TStringField;
FDFinq_type: TStringField;
FDFdoc_id: TStringField;
FDFCollateralValueOption: TStringField;
FDFimage_opt: TStringField;
FDFprintid: TStringField;
FDFfstrun: TStringField;
FDFfststmt: TStringField;
FDFmathold: TSmallIntField;
FDFNoticeSortOrder1: TStringField;
FDFNoticeSortOrder2: TStringField;
FDFNoticeSortOrder3: TStringField;
FDFNoticeSortOrder4: TStringField;
FDFNoticeSortOrder5: TStringField;
FDFFiller2: TStringField;
FDFspec_tab: TStringField;
FDFPremiumChartCopies: TIntegerField;
FDFMailingLabeltype: TStringField;
FDFfnotdate: TIntegerField;
FDFsnotdate: TIntegerField;
FDFcollateralUse: TStringField;
FDFreflag: TStringField;
FDFfnottype: TStringField;
FDFpcprint: TStringField;
FDFBalanceReportSortRequest: TStringField;
FDFpoldate: TIntegerField;
FDFhistptr: TStringField;
FDFNoteNumber: TSmallIntField;
FDFOptions: TStringField;
FDFclContact: TStringField;
FDFclAddress: TStringField;
FDFclCityStZip: TStringField;
FDFclPhone: TStringField;
FDFclFax: TStringField;
FDFplContact: TStringField;
FDFplAddress: TStringField;
FDFplCityStZip: TStringField;
FDFplPhone: TStringField;
FDFplFax: TStringField;
FDFLastRunDate: TStringField;
FDFRunControl: TStringField;
FDFTranControl: TStringField;
FDFLast4RunNum: TStringField;
FDFAccountId: TStringField;
FDFRefundOpt: TStringField;
FDFInterim: TStringField;
procedure SetPLenderID(const Value: String);
function GetPLenderID:String;
procedure SetPModCount(const Value: SmallInt);
function GetPModCount:SmallInt;
procedure SetPclient(const Value: String);
function GetPclient:String;
procedure SetPSystemType(const Value: String);
function GetPSystemType:String;
procedure SetPstatus(const Value: String);
function GetPstatus:String;
procedure SetPNetStatement(const Value: String);
function GetPNetStatement:String;
procedure SetPname(const Value: String);
function GetPname:String;
procedure SetPAddress(const Value: String);
function GetPAddress:String;
procedure SetPAddress2(const Value: String);
function GetPAddress2:String;
procedure SetPCityState(const Value: String);
function GetPCityState:String;
procedure SetPZipCode(const Value: String);
function GetPZipCode:String;
procedure SetPStreetName(const Value: String);
function GetPStreetName:String;
procedure SetPStreetAddress(const Value: String);
function GetPStreetAddress:String;
procedure SetPStreetCSZ(const Value: String);
function GetPStreetCSZ:String;
procedure SetPstate(const Value: String);
function GetPstate:String;
procedure SetPPhoneNumber(const Value: String);
function GetPPhoneNumber:String;
procedure SetPPhoneExtension(const Value: String);
function GetPPhoneExtension:String;
procedure SetPResidentAdminName(const Value: String);
function GetPResidentAdminName:String;
procedure SetPResidentAdminPhone(const Value: String);
function GetPResidentAdminPhone:String;
procedure SetPResidentAdminPhoneExtension(const Value: String);
function GetPResidentAdminPhoneExtension:String;
procedure SetPFaxNumber(const Value: String);
function GetPFaxNumber:String;
procedure SetPgroup(const Value: String);
function GetPgroup:String;
procedure SetPStatementGroup(const Value: String);
function GetPStatementGroup:String;
procedure SetPClientID(const Value: String);
function GetPClientID:String;
procedure SetPpcgroup(const Value: String);
function GetPpcgroup:String;
procedure SetPBalanceLimit(const Value: Integer);
function GetPBalanceLimit:Integer;
procedure SetPdel_lim(const Value: Integer);
function GetPdel_lim:Integer;
procedure SetPbaldel(const Value: String);
function GetPbaldel:String;
procedure SetPMatureLoanHoldDays(const Value: SmallInt);
function GetPMatureLoanHoldDays:SmallInt;
procedure SetPTapeHoldDays(const Value: SmallInt);
function GetPTapeHoldDays:SmallInt;
procedure SetPrunevents(const Value: String);
function GetPrunevents:String;
procedure SetPmethod(const Value: String);
function GetPmethod:String;
procedure SetPCommisionEntityMix(const Value: String);
function GetPCommisionEntityMix:String;
procedure SetPMasterMix(const Value: String);
function GetPMasterMix:String;
procedure SetPBlanketPolicyMix(const Value: String);
function GetPBlanketPolicyMix:String;
procedure SetPGracePeriodOption(const Value: String);
function GetPGracePeriodOption:String;
procedure SetPNewGraceDays(const Value: SmallInt);
function GetPNewGraceDays:SmallInt;
procedure SetPExpGraceDays(const Value: SmallInt);
function GetPExpGraceDays:SmallInt;
procedure SetPcancellgraceDays(const Value: SmallInt);
function GetPcancellgraceDays:SmallInt;
procedure SetPMaxBackDays(const Value: SmallInt);
function GetPMaxBackDays:SmallInt;
procedure SetPErrorOmissionInceptionDate(const Value: String);
function GetPErrorOmissionInceptionDate:String;
procedure SetPOverrideEODate(const Value: String);
function GetPOverrideEODate:String;
procedure SetPmanprint(const Value: String);
function GetPmanprint:String;
procedure SetPbook_all(const Value: String);
function GetPbook_all:String;
procedure SetPWaverNonPayDays(const Value: SmallInt);
function GetPWaverNonPayDays:SmallInt;
procedure SetPnewpmt(const Value: String);
function GetPnewpmt:String;
procedure SetPStatementContactName(const Value: String);
function GetPStatementContactName:String;
procedure SetPOfficeContactName(const Value: String);
function GetPOfficeContactName:String;
procedure SetPNoticeSignature(const Value: String);
function GetPNoticeSignature:String;
procedure SetPNoticeSignature2(const Value: String);
function GetPNoticeSignature2:String;
procedure SetPMasterPolicyNumber(const Value: String);
function GetPMasterPolicyNumber:String;
procedure SetPBlanketPolicyNumber(const Value: String);
function GetPBlanketPolicyNumber:String;
procedure SetPEarningMethodCode(const Value: String);
function GetPEarningMethodCode:String;
procedure SetPCancellationMethocCode(const Value: String);
function GetPCancellationMethocCode:String;
procedure SetPtapeid(const Value: String);
function GetPtapeid:String;
procedure SetPdiskid(const Value: String);
function GetPdiskid:String;
procedure SetPInquiryID(const Value: String);
function GetPInquiryID:String;
procedure SetPCancellationID(const Value: String);
function GetPCancellationID:String;
procedure SetPStatementID(const Value: String);
function GetPStatementID:String;
procedure SetPBranchBankingOption(const Value: String);
function GetPBranchBankingOption:String;
procedure SetPunwaive(const Value: String);
function GetPunwaive:String;
procedure SetPSpecialApprovalCode_opt9x(const Value: String);
function GetPSpecialApprovalCode_opt9x:String;
procedure SetPmon_only(const Value: String);
function GetPmon_only:String;
procedure SetPkeepForcedData(const Value: String);
function GetPkeepForcedData:String;
procedure SetPautorenew(const Value: String);
function GetPautorenew:String;
procedure SetPInterestOption(const Value: String);
function GetPInterestOption:String;
procedure SetPInterestRate(const Value: Currency);
function GetPInterestRate:Currency;
procedure SetPt_updins(const Value: String);
function GetPt_updins:String;
procedure SetPt_lndate(const Value: String);
function GetPt_lndate:String;
procedure SetPt_matdate(const Value: String);
function GetPt_matdate:String;
procedure SetPt_branch(const Value: String);
function GetPt_branch:String;
procedure SetPt_off(const Value: String);
function GetPt_off:String;
procedure SetPt_short(const Value: String);
function GetPt_short:String;
procedure SetPt_name(const Value: String);
function GetPt_name:String;
procedure SetPt_addr(const Value: String);
function GetPt_addr:String;
procedure SetPt_coll(const Value: String);
function GetPt_coll:String;
procedure SetPnextrunDate(const Value: String);
function GetPnextrunDate:String;
procedure SetPrunfreqDays(const Value: SmallInt);
function GetPrunfreqDays:SmallInt;
procedure SetPforcerun(const Value: String);
function GetPforcerun:String;
procedure SetPlast_updDate(const Value: String);
function GetPlast_updDate:String;
procedure SetPlast_ihisDate(const Value: String);
function GetPlast_ihisDate:String;
procedure SetPlast_thisDate(const Value: String);
function GetPlast_thisDate:String;
procedure SetPlast_diskDate(const Value: String);
function GetPlast_diskDate:String;
procedure SetPlast_tapeDate(const Value: String);
function GetPlast_tapeDate:String;
procedure SetPfirstrunDate(const Value: String);
function GetPfirstrunDate:String;
procedure SetPcancdate(const Value: String);
function GetPcancdate:String;
procedure SetPMailCarrier(const Value: String);
function GetPMailCarrier:String;
procedure SetPCallforDataDOW(const Value: String);
function GetPCallforDataDOW:String;
procedure SetPhold_run(const Value: String);
function GetPhold_run:String;
procedure SetPrevlevel(const Value: String);
function GetPrevlevel:String;
procedure SetPnum_mod(const Value: SmallInt);
function GetPnum_mod:SmallInt;
procedure SetPmod(const Value: String);
function GetPmod:String;
procedure SetPlen_def(const Value: String);
function GetPlen_def:String;
procedure SetPdef_text(const Value: String);
function GetPdef_text:String;
procedure SetPPrintMissingdataOfficerOrder(const Value: String);
function GetPPrintMissingdataOfficerOrder:String;
procedure SetPmisstitle(const Value: String);
function GetPmisstitle:String;
procedure SetPsite_type(const Value: String);
function GetPsite_type:String;
procedure SetPic_input(const Value: String);
function GetPic_input:String;
procedure SetPnoticeid(const Value: String);
function GetPnoticeid:String;
procedure SetPinq_type(const Value: String);
function GetPinq_type:String;
procedure SetPdoc_id(const Value: String);
function GetPdoc_id:String;
procedure SetPCollateralValueOption(const Value: String);
function GetPCollateralValueOption:String;
procedure SetPimage_opt(const Value: String);
function GetPimage_opt:String;
procedure SetPprintid(const Value: String);
function GetPprintid:String;
procedure SetPfstrun(const Value: String);
function GetPfstrun:String;
procedure SetPfststmt(const Value: String);
function GetPfststmt:String;
procedure SetPmathold(const Value: SmallInt);
function GetPmathold:SmallInt;
procedure SetPNoticeSortOrder1(const Value: String);
function GetPNoticeSortOrder1:String;
procedure SetPNoticeSortOrder2(const Value: String);
function GetPNoticeSortOrder2:String;
procedure SetPNoticeSortOrder3(const Value: String);
function GetPNoticeSortOrder3:String;
procedure SetPNoticeSortOrder4(const Value: String);
function GetPNoticeSortOrder4:String;
procedure SetPNoticeSortOrder5(const Value: String);
function GetPNoticeSortOrder5:String;
procedure SetPFiller2(const Value: String);
function GetPFiller2:String;
procedure SetPspec_tab(const Value: String);
function GetPspec_tab:String;
procedure SetPPremiumChartCopies(const Value: Integer);
function GetPPremiumChartCopies:Integer;
procedure SetPMailingLabeltype(const Value: String);
function GetPMailingLabeltype:String;
procedure SetPfnotdate(const Value: Integer);
function GetPfnotdate:Integer;
procedure SetPsnotdate(const Value: Integer);
function GetPsnotdate:Integer;
procedure SetPcollateralUse(const Value: String);
function GetPcollateralUse:String;
procedure SetPreflag(const Value: String);
function GetPreflag:String;
procedure SetPfnottype(const Value: String);
function GetPfnottype:String;
procedure SetPpcprint(const Value: String);
function GetPpcprint:String;
procedure SetPBalanceReportSortRequest(const Value: String);
function GetPBalanceReportSortRequest:String;
procedure SetPpoldate(const Value: Integer);
function GetPpoldate:Integer;
procedure SetPhistptr(const Value: String);
function GetPhistptr:String;
procedure SetPNoteNumber(const Value: SmallInt);
function GetPNoteNumber:SmallInt;
procedure SetPOptions(const Value: String);
function GetPOptions:String;
procedure SetPclContact(const Value: String);
function GetPclContact:String;
procedure SetPclAddress(const Value: String);
function GetPclAddress:String;
procedure SetPclCityStZip(const Value: String);
function GetPclCityStZip:String;
procedure SetPclPhone(const Value: String);
function GetPclPhone:String;
procedure SetPclFax(const Value: String);
function GetPclFax:String;
procedure SetPplContact(const Value: String);
function GetPplContact:String;
procedure SetPplAddress(const Value: String);
function GetPplAddress:String;
procedure SetPplCityStZip(const Value: String);
function GetPplCityStZip:String;
procedure SetPplPhone(const Value: String);
function GetPplPhone:String;
procedure SetPplFax(const Value: String);
function GetPplFax:String;
procedure SetPLastRunDate(const Value: String);
function GetPLastRunDate:String;
procedure SetPRunControl(const Value: String);
function GetPRunControl:String;
procedure SetPTranControl(const Value: String);
function GetPTranControl:String;
procedure SetPLast4RunNum(const Value: String);
function GetPLast4RunNum:String;
procedure SetPAccountId(const Value: String);
function GetPAccountId:String;
procedure SetPRefundOpt(const Value: String);
function GetPRefundOpt:String;
procedure SetPInterim(const Value: String);
function GetPInterim:String;
protected
procedure CreateFields; reintroduce;
procedure SetActive(Value: Boolean); override;
public
function GetDataBuffer:TInfoLENDERRecord;
procedure StoreDataBuffer(ABuffer:TInfoLENDERRecord);
property DFLenderID: TStringField read FDFLenderID;
property DFModCount: TSmallIntField read FDFModCount;
property DFclient: TStringField read FDFclient;
property DFSystemType: TStringField read FDFSystemType;
property DFstatus: TStringField read FDFstatus;
property DFNetStatement: TStringField read FDFNetStatement;
property DFname: TStringField read FDFname;
property DFAddress: TStringField read FDFAddress;
property DFAddress2: TStringField read FDFAddress2;
property DFCityState: TStringField read FDFCityState;
property DFZipCode: TStringField read FDFZipCode;
property DFStreetName: TStringField read FDFStreetName;
property DFStreetAddress: TStringField read FDFStreetAddress;
property DFStreetCSZ: TStringField read FDFStreetCSZ;
property DFstate: TStringField read FDFstate;
property DFPhoneNumber: TStringField read FDFPhoneNumber;
property DFPhoneExtension: TStringField read FDFPhoneExtension;
property DFResidentAdminName: TStringField read FDFResidentAdminName;
property DFResidentAdminPhone: TStringField read FDFResidentAdminPhone;
property DFResidentAdminPhoneExtension: TStringField read FDFResidentAdminPhoneExtension;
property DFFaxNumber: TStringField read FDFFaxNumber;
property DFgroup: TStringField read FDFgroup;
property DFStatementGroup: TStringField read FDFStatementGroup;
property DFClientID: TStringField read FDFClientID;
property DFpcgroup: TStringField read FDFpcgroup;
property DFBalanceLimit: TIntegerField read FDFBalanceLimit;
property DFdel_lim: TIntegerField read FDFdel_lim;
property DFbaldel: TStringField read FDFbaldel;
property DFMatureLoanHoldDays: TSmallIntField read FDFMatureLoanHoldDays;
property DFTapeHoldDays: TSmallIntField read FDFTapeHoldDays;
property DFrunevents: TStringField read FDFrunevents;
property DFmethod: TStringField read FDFmethod;
property DFCommisionEntityMix: TStringField read FDFCommisionEntityMix;
property DFMasterMix: TStringField read FDFMasterMix;
property DFBlanketPolicyMix: TStringField read FDFBlanketPolicyMix;
property DFGracePeriodOption: TStringField read FDFGracePeriodOption;
property DFNewGraceDays: TSmallIntField read FDFNewGraceDays;
property DFExpGraceDays: TSmallIntField read FDFExpGraceDays;
property DFcancellgraceDays: TSmallIntField read FDFcancellgraceDays;
property DFMaxBackDays: TSmallIntField read FDFMaxBackDays;
property DFErrorOmissionInceptionDate: TStringField read FDFErrorOmissionInceptionDate;
property DFOverrideEODate: TStringField read FDFOverrideEODate;
property DFmanprint: TStringField read FDFmanprint;
property DFbook_all: TStringField read FDFbook_all;
property DFWaverNonPayDays: TSmallIntField read FDFWaverNonPayDays;
property DFnewpmt: TStringField read FDFnewpmt;
property DFStatementContactName: TStringField read FDFStatementContactName;
property DFOfficeContactName: TStringField read FDFOfficeContactName;
property DFNoticeSignature: TStringField read FDFNoticeSignature;
property DFNoticeSignature2: TStringField read FDFNoticeSignature2;
property DFMasterPolicyNumber: TStringField read FDFMasterPolicyNumber;
property DFBlanketPolicyNumber: TStringField read FDFBlanketPolicyNumber;
property DFEarningMethodCode: TStringField read FDFEarningMethodCode;
property DFCancellationMethocCode: TStringField read FDFCancellationMethocCode;
property DFtapeid: TStringField read FDFtapeid;
property DFdiskid: TStringField read FDFdiskid;
property DFInquiryID: TStringField read FDFInquiryID;
property DFCancellationID: TStringField read FDFCancellationID;
property DFStatementID: TStringField read FDFStatementID;
property DFBranchBankingOption: TStringField read FDFBranchBankingOption;
property DFunwaive: TStringField read FDFunwaive;
property DFSpecialApprovalCode_opt9x: TStringField read FDFSpecialApprovalCode_opt9x;
property DFmon_only: TStringField read FDFmon_only;
property DFkeepForcedData: TStringField read FDFkeepForcedData;
property DFautorenew: TStringField read FDFautorenew;
property DFInterestOption: TStringField read FDFInterestOption;
property DFInterestRate: TCurrencyField read FDFInterestRate;
property DFt_updins: TStringField read FDFt_updins;
property DFt_lndate: TStringField read FDFt_lndate;
property DFt_matdate: TStringField read FDFt_matdate;
property DFt_branch: TStringField read FDFt_branch;
property DFt_off: TStringField read FDFt_off;
property DFt_short: TStringField read FDFt_short;
property DFt_name: TStringField read FDFt_name;
property DFt_addr: TStringField read FDFt_addr;
property DFt_coll: TStringField read FDFt_coll;
property DFnextrunDate: TStringField read FDFnextrunDate;
property DFrunfreqDays: TSmallIntField read FDFrunfreqDays;
property DFforcerun: TStringField read FDFforcerun;
property DFlast_updDate: TStringField read FDFlast_updDate;
property DFlast_ihisDate: TStringField read FDFlast_ihisDate;
property DFlast_thisDate: TStringField read FDFlast_thisDate;
property DFlast_diskDate: TStringField read FDFlast_diskDate;
property DFlast_tapeDate: TStringField read FDFlast_tapeDate;
property DFfirstrunDate: TStringField read FDFfirstrunDate;
property DFcancdate: TStringField read FDFcancdate;
property DFMailCarrier: TStringField read FDFMailCarrier;
property DFCallforDataDOW: TStringField read FDFCallforDataDOW;
property DFhold_run: TStringField read FDFhold_run;
property DFrevlevel: TStringField read FDFrevlevel;
property DFnum_mod: TSmallIntField read FDFnum_mod;
property DFmod: TStringField read FDFmod;
property DFlen_def: TStringField read FDFlen_def;
property DFdef_text: TStringField read FDFdef_text;
property DFPrintMissingdataOfficerOrder: TStringField read FDFPrintMissingdataOfficerOrder;
property DFmisstitle: TStringField read FDFmisstitle;
property DFsite_type: TStringField read FDFsite_type;
property DFic_input: TStringField read FDFic_input;
property DFnoticeid: TStringField read FDFnoticeid;
property DFinq_type: TStringField read FDFinq_type;
property DFdoc_id: TStringField read FDFdoc_id;
property DFCollateralValueOption: TStringField read FDFCollateralValueOption;
property DFimage_opt: TStringField read FDFimage_opt;
property DFprintid: TStringField read FDFprintid;
property DFfstrun: TStringField read FDFfstrun;
property DFfststmt: TStringField read FDFfststmt;
property DFmathold: TSmallIntField read FDFmathold;
property DFNoticeSortOrder1: TStringField read FDFNoticeSortOrder1;
property DFNoticeSortOrder2: TStringField read FDFNoticeSortOrder2;
property DFNoticeSortOrder3: TStringField read FDFNoticeSortOrder3;
property DFNoticeSortOrder4: TStringField read FDFNoticeSortOrder4;
property DFNoticeSortOrder5: TStringField read FDFNoticeSortOrder5;
property DFFiller2: TStringField read FDFFiller2;
property DFspec_tab: TStringField read FDFspec_tab;
property DFPremiumChartCopies: TIntegerField read FDFPremiumChartCopies;
property DFMailingLabeltype: TStringField read FDFMailingLabeltype;
property DFfnotdate: TIntegerField read FDFfnotdate;
property DFsnotdate: TIntegerField read FDFsnotdate;
property DFcollateralUse: TStringField read FDFcollateralUse;
property DFreflag: TStringField read FDFreflag;
property DFfnottype: TStringField read FDFfnottype;
property DFpcprint: TStringField read FDFpcprint;
property DFBalanceReportSortRequest: TStringField read FDFBalanceReportSortRequest;
property DFpoldate: TIntegerField read FDFpoldate;
property DFhistptr: TStringField read FDFhistptr;
property DFNoteNumber: TSmallIntField read FDFNoteNumber;
property DFOptions: TStringField read FDFOptions;
property DFclContact: TStringField read FDFclContact;
property DFclAddress: TStringField read FDFclAddress;
property DFclCityStZip: TStringField read FDFclCityStZip;
property DFclPhone: TStringField read FDFclPhone;
property DFclFax: TStringField read FDFclFax;
property DFplContact: TStringField read FDFplContact;
property DFplAddress: TStringField read FDFplAddress;
property DFplCityStZip: TStringField read FDFplCityStZip;
property DFplPhone: TStringField read FDFplPhone;
property DFplFax: TStringField read FDFplFax;
property DFLastRunDate: TStringField read FDFLastRunDate;
property DFRunControl: TStringField read FDFRunControl;
property DFTranControl: TStringField read FDFTranControl;
property DFLast4RunNum: TStringField read FDFLast4RunNum;
property DFAccountId: TStringField read FDFAccountId;
property DFRefundOpt: TStringField read FDFRefundOpt;
property DFInterim: TStringField read FDFInterim;
property PLenderID: String read GetPLenderID write SetPLenderID;
property PModCount: SmallInt read GetPModCount write SetPModCount;
property Pclient: String read GetPclient write SetPclient;
property PSystemType: String read GetPSystemType write SetPSystemType;
property Pstatus: String read GetPstatus write SetPstatus;
property PNetStatement: String read GetPNetStatement write SetPNetStatement;
property Pname: String read GetPname write SetPname;
property PAddress: String read GetPAddress write SetPAddress;
property PAddress2: String read GetPAddress2 write SetPAddress2;
property PCityState: String read GetPCityState write SetPCityState;
property PZipCode: String read GetPZipCode write SetPZipCode;
property PStreetName: String read GetPStreetName write SetPStreetName;
property PStreetAddress: String read GetPStreetAddress write SetPStreetAddress;
property PStreetCSZ: String read GetPStreetCSZ write SetPStreetCSZ;
property Pstate: String read GetPstate write SetPstate;
property PPhoneNumber: String read GetPPhoneNumber write SetPPhoneNumber;
property PPhoneExtension: String read GetPPhoneExtension write SetPPhoneExtension;
property PResidentAdminName: String read GetPResidentAdminName write SetPResidentAdminName;
property PResidentAdminPhone: String read GetPResidentAdminPhone write SetPResidentAdminPhone;
property PResidentAdminPhoneExtension: String read GetPResidentAdminPhoneExtension write SetPResidentAdminPhoneExtension;
property PFaxNumber: String read GetPFaxNumber write SetPFaxNumber;
property Pgroup: String read GetPgroup write SetPgroup;
property PStatementGroup: String read GetPStatementGroup write SetPStatementGroup;
property PClientID: String read GetPClientID write SetPClientID;
property Ppcgroup: String read GetPpcgroup write SetPpcgroup;
property PBalanceLimit: Integer read GetPBalanceLimit write SetPBalanceLimit;
property Pdel_lim: Integer read GetPdel_lim write SetPdel_lim;
property Pbaldel: String read GetPbaldel write SetPbaldel;
property PMatureLoanHoldDays: SmallInt read GetPMatureLoanHoldDays write SetPMatureLoanHoldDays;
property PTapeHoldDays: SmallInt read GetPTapeHoldDays write SetPTapeHoldDays;
property Prunevents: String read GetPrunevents write SetPrunevents;
property Pmethod: String read GetPmethod write SetPmethod;
property PCommisionEntityMix: String read GetPCommisionEntityMix write SetPCommisionEntityMix;
property PMasterMix: String read GetPMasterMix write SetPMasterMix;
property PBlanketPolicyMix: String read GetPBlanketPolicyMix write SetPBlanketPolicyMix;
property PGracePeriodOption: String read GetPGracePeriodOption write SetPGracePeriodOption;
property PNewGraceDays: SmallInt read GetPNewGraceDays write SetPNewGraceDays;
property PExpGraceDays: SmallInt read GetPExpGraceDays write SetPExpGraceDays;
property PcancellgraceDays: SmallInt read GetPcancellgraceDays write SetPcancellgraceDays;
property PMaxBackDays: SmallInt read GetPMaxBackDays write SetPMaxBackDays;
property PErrorOmissionInceptionDate: String read GetPErrorOmissionInceptionDate write SetPErrorOmissionInceptionDate;
property POverrideEODate: String read GetPOverrideEODate write SetPOverrideEODate;
property Pmanprint: String read GetPmanprint write SetPmanprint;
property Pbook_all: String read GetPbook_all write SetPbook_all;
property PWaverNonPayDays: SmallInt read GetPWaverNonPayDays write SetPWaverNonPayDays;
property Pnewpmt: String read GetPnewpmt write SetPnewpmt;
property PStatementContactName: String read GetPStatementContactName write SetPStatementContactName;
property POfficeContactName: String read GetPOfficeContactName write SetPOfficeContactName;
property PNoticeSignature: String read GetPNoticeSignature write SetPNoticeSignature;
property PNoticeSignature2: String read GetPNoticeSignature2 write SetPNoticeSignature2;
property PMasterPolicyNumber: String read GetPMasterPolicyNumber write SetPMasterPolicyNumber;
property PBlanketPolicyNumber: String read GetPBlanketPolicyNumber write SetPBlanketPolicyNumber;
property PEarningMethodCode: String read GetPEarningMethodCode write SetPEarningMethodCode;
property PCancellationMethocCode: String read GetPCancellationMethocCode write SetPCancellationMethocCode;
property Ptapeid: String read GetPtapeid write SetPtapeid;
property Pdiskid: String read GetPdiskid write SetPdiskid;
property PInquiryID: String read GetPInquiryID write SetPInquiryID;
property PCancellationID: String read GetPCancellationID write SetPCancellationID;
property PStatementID: String read GetPStatementID write SetPStatementID;
property PBranchBankingOption: String read GetPBranchBankingOption write SetPBranchBankingOption;
property Punwaive: String read GetPunwaive write SetPunwaive;
property PSpecialApprovalCode_opt9x: String read GetPSpecialApprovalCode_opt9x write SetPSpecialApprovalCode_opt9x;
property Pmon_only: String read GetPmon_only write SetPmon_only;
property PkeepForcedData: String read GetPkeepForcedData write SetPkeepForcedData;
property Pautorenew: String read GetPautorenew write SetPautorenew;
property PInterestOption: String read GetPInterestOption write SetPInterestOption;
property PInterestRate: Currency read GetPInterestRate write SetPInterestRate;
property Pt_updins: String read GetPt_updins write SetPt_updins;
property Pt_lndate: String read GetPt_lndate write SetPt_lndate;
property Pt_matdate: String read GetPt_matdate write SetPt_matdate;
property Pt_branch: String read GetPt_branch write SetPt_branch;
property Pt_off: String read GetPt_off write SetPt_off;
property Pt_short: String read GetPt_short write SetPt_short;
property Pt_name: String read GetPt_name write SetPt_name;
property Pt_addr: String read GetPt_addr write SetPt_addr;
property Pt_coll: String read GetPt_coll write SetPt_coll;
property PnextrunDate: String read GetPnextrunDate write SetPnextrunDate;
property PrunfreqDays: SmallInt read GetPrunfreqDays write SetPrunfreqDays;
property Pforcerun: String read GetPforcerun write SetPforcerun;
property Plast_updDate: String read GetPlast_updDate write SetPlast_updDate;
property Plast_ihisDate: String read GetPlast_ihisDate write SetPlast_ihisDate;
property Plast_thisDate: String read GetPlast_thisDate write SetPlast_thisDate;
property Plast_diskDate: String read GetPlast_diskDate write SetPlast_diskDate;
property Plast_tapeDate: String read GetPlast_tapeDate write SetPlast_tapeDate;
property PfirstrunDate: String read GetPfirstrunDate write SetPfirstrunDate;
property Pcancdate: String read GetPcancdate write SetPcancdate;
property PMailCarrier: String read GetPMailCarrier write SetPMailCarrier;
property PCallforDataDOW: String read GetPCallforDataDOW write SetPCallforDataDOW;
property Phold_run: String read GetPhold_run write SetPhold_run;
property Prevlevel: String read GetPrevlevel write SetPrevlevel;
property Pnum_mod: SmallInt read GetPnum_mod write SetPnum_mod;
property Pmod: String read GetPmod write SetPmod;
property Plen_def: String read GetPlen_def write SetPlen_def;
property Pdef_text: String read GetPdef_text write SetPdef_text;
property PPrintMissingdataOfficerOrder: String read GetPPrintMissingdataOfficerOrder write SetPPrintMissingdataOfficerOrder;
property Pmisstitle: String read GetPmisstitle write SetPmisstitle;
property Psite_type: String read GetPsite_type write SetPsite_type;
property Pic_input: String read GetPic_input write SetPic_input;
property Pnoticeid: String read GetPnoticeid write SetPnoticeid;
property Pinq_type: String read GetPinq_type write SetPinq_type;
property Pdoc_id: String read GetPdoc_id write SetPdoc_id;
property PCollateralValueOption: String read GetPCollateralValueOption write SetPCollateralValueOption;
property Pimage_opt: String read GetPimage_opt write SetPimage_opt;
property Pprintid: String read GetPprintid write SetPprintid;
property Pfstrun: String read GetPfstrun write SetPfstrun;
property Pfststmt: String read GetPfststmt write SetPfststmt;
property Pmathold: SmallInt read GetPmathold write SetPmathold;
property PNoticeSortOrder1: String read GetPNoticeSortOrder1 write SetPNoticeSortOrder1;
property PNoticeSortOrder2: String read GetPNoticeSortOrder2 write SetPNoticeSortOrder2;
property PNoticeSortOrder3: String read GetPNoticeSortOrder3 write SetPNoticeSortOrder3;
property PNoticeSortOrder4: String read GetPNoticeSortOrder4 write SetPNoticeSortOrder4;
property PNoticeSortOrder5: String read GetPNoticeSortOrder5 write SetPNoticeSortOrder5;
property PFiller2: String read GetPFiller2 write SetPFiller2;
property Pspec_tab: String read GetPspec_tab write SetPspec_tab;
property PPremiumChartCopies: Integer read GetPPremiumChartCopies write SetPPremiumChartCopies;
property PMailingLabeltype: String read GetPMailingLabeltype write SetPMailingLabeltype;
property Pfnotdate: Integer read GetPfnotdate write SetPfnotdate;
property Psnotdate: Integer read GetPsnotdate write SetPsnotdate;
property PcollateralUse: String read GetPcollateralUse write SetPcollateralUse;
property Preflag: String read GetPreflag write SetPreflag;
property Pfnottype: String read GetPfnottype write SetPfnottype;
property Ppcprint: String read GetPpcprint write SetPpcprint;
property PBalanceReportSortRequest: String read GetPBalanceReportSortRequest write SetPBalanceReportSortRequest;
property Ppoldate: Integer read GetPpoldate write SetPpoldate;
property Phistptr: String read GetPhistptr write SetPhistptr;
property PNoteNumber: SmallInt read GetPNoteNumber write SetPNoteNumber;
property POptions: String read GetPOptions write SetPOptions;
property PclContact: String read GetPclContact write SetPclContact;
property PclAddress: String read GetPclAddress write SetPclAddress;
property PclCityStZip: String read GetPclCityStZip write SetPclCityStZip;
property PclPhone: String read GetPclPhone write SetPclPhone;
property PclFax: String read GetPclFax write SetPclFax;
property PplContact: String read GetPplContact write SetPplContact;
property PplAddress: String read GetPplAddress write SetPplAddress;
property PplCityStZip: String read GetPplCityStZip write SetPplCityStZip;
property PplPhone: String read GetPplPhone write SetPplPhone;
property PplFax: String read GetPplFax write SetPplFax;
property PLastRunDate: String read GetPLastRunDate write SetPLastRunDate;
property PRunControl: String read GetPRunControl write SetPRunControl;
property PTranControl: String read GetPTranControl write SetPTranControl;
property PLast4RunNum: String read GetPLast4RunNum write SetPLast4RunNum;
property PAccountId: String read GetPAccountId write SetPAccountId;
property PRefundOpt: String read GetPRefundOpt write SetPRefundOpt;
property PInterim: String read GetPInterim write SetPInterim;
published
property Active write SetActive;
end; { TInfoLENDERTable }
procedure Register;
implementation
procedure TInfoLENDERTable.CreateFields;
begin
FDFLenderID := CreateField( 'LenderID' ) as TStringField;
FDFModCount := CreateField( 'ModCount' ) as TSmallIntField;
FDFclient := CreateField( 'client' ) as TStringField;
FDFSystemType := CreateField( 'SystemType' ) as TStringField;
FDFstatus := CreateField( 'status' ) as TStringField;
FDFNetStatement := CreateField( 'NetStatement' ) as TStringField;
FDFname := CreateField( 'name' ) as TStringField;
FDFAddress := CreateField( 'Address' ) as TStringField;
FDFAddress2 := CreateField( 'Address2' ) as TStringField;
FDFCityState := CreateField( 'CityState' ) as TStringField;
FDFZipCode := CreateField( 'ZipCode' ) as TStringField;
FDFStreetName := CreateField( 'StreetName' ) as TStringField;
FDFStreetAddress := CreateField( 'StreetAddress' ) as TStringField;
FDFStreetCSZ := CreateField( 'StreetCSZ' ) as TStringField;
FDFstate := CreateField( 'state' ) as TStringField;
FDFPhoneNumber := CreateField( 'PhoneNumber' ) as TStringField;
FDFPhoneExtension := CreateField( 'PhoneExtension' ) as TStringField;
FDFResidentAdminName := CreateField( 'ResidentAdminName' ) as TStringField;
FDFResidentAdminPhone := CreateField( 'ResidentAdminPhone' ) as TStringField;
FDFResidentAdminPhoneExtension := CreateField( 'ResidentAdminPhoneExtension' ) as TStringField;
FDFFaxNumber := CreateField( 'FaxNumber' ) as TStringField;
FDFgroup := CreateField( 'group' ) as TStringField;
FDFStatementGroup := CreateField( 'StatementGroup' ) as TStringField;
FDFClientID := CreateField( 'ClientID' ) as TStringField;
FDFpcgroup := CreateField( 'pcgroup' ) as TStringField;
FDFBalanceLimit := CreateField( 'BalanceLimit' ) as TIntegerField;
FDFdel_lim := CreateField( 'del_lim' ) as TIntegerField;
FDFbaldel := CreateField( 'baldel' ) as TStringField;
FDFMatureLoanHoldDays := CreateField( 'MatureLoanHoldDays' ) as TSmallIntField;
FDFTapeHoldDays := CreateField( 'TapeHoldDays' ) as TSmallIntField;
FDFrunevents := CreateField( 'runevents' ) as TStringField;
FDFmethod := CreateField( 'method' ) as TStringField;
FDFCommisionEntityMix := CreateField( 'CommisionEntityMix' ) as TStringField;
FDFMasterMix := CreateField( 'MasterMix' ) as TStringField;
FDFBlanketPolicyMix := CreateField( 'BlanketPolicyMix' ) as TStringField;
FDFGracePeriodOption := CreateField( 'GracePeriodOption' ) as TStringField;
FDFNewGraceDays := CreateField( 'NewGraceDays' ) as TSmallIntField;
FDFExpGraceDays := CreateField( 'ExpGraceDays' ) as TSmallIntField;
FDFcancellgraceDays := CreateField( 'cancellgraceDays' ) as TSmallIntField;
FDFMaxBackDays := CreateField( 'MaxBackDays' ) as TSmallIntField;
FDFErrorOmissionInceptionDate := CreateField( 'ErrorOmissionInceptionDate' ) as TStringField;
FDFOverrideEODate := CreateField( 'OverrideEODate' ) as TStringField;
FDFmanprint := CreateField( 'manprint' ) as TStringField;
FDFbook_all := CreateField( 'book_all' ) as TStringField;
FDFWaverNonPayDays := CreateField( 'WaverNonPayDays' ) as TSmallIntField;
FDFnewpmt := CreateField( 'newpmt' ) as TStringField;
FDFStatementContactName := CreateField( 'StatementContactName' ) as TStringField;
FDFOfficeContactName := CreateField( 'OfficeContactName' ) as TStringField;
FDFNoticeSignature := CreateField( 'NoticeSignature' ) as TStringField;
FDFNoticeSignature2 := CreateField( 'NoticeSignature2' ) as TStringField;
FDFMasterPolicyNumber := CreateField( 'MasterPolicyNumber' ) as TStringField;
FDFBlanketPolicyNumber := CreateField( 'BlanketPolicyNumber' ) as TStringField;
FDFEarningMethodCode := CreateField( 'EarningMethodCode' ) as TStringField;
FDFCancellationMethocCode := CreateField( 'CancellationMethocCode' ) as TStringField;
FDFtapeid := CreateField( 'tapeid' ) as TStringField;
FDFdiskid := CreateField( 'diskid' ) as TStringField;
FDFInquiryID := CreateField( 'InquiryID' ) as TStringField;
FDFCancellationID := CreateField( 'CancellationID' ) as TStringField;
FDFStatementID := CreateField( 'StatementID' ) as TStringField;
FDFBranchBankingOption := CreateField( 'BranchBankingOption' ) as TStringField;
FDFunwaive := CreateField( 'unwaive' ) as TStringField;
FDFSpecialApprovalCode_opt9x := CreateField( 'SpecialApprovalCode_opt9x' ) as TStringField;
FDFmon_only := CreateField( 'mon_only' ) as TStringField;
FDFkeepForcedData := CreateField( 'keepForcedData' ) as TStringField;
FDFautorenew := CreateField( 'autorenew' ) as TStringField;
FDFInterestOption := CreateField( 'InterestOption' ) as TStringField;
FDFInterestRate := CreateField( 'InterestRate' ) as TCurrencyField;
FDFt_updins := CreateField( 't_updins' ) as TStringField;
FDFt_lndate := CreateField( 't_lndate' ) as TStringField;
FDFt_matdate := CreateField( 't_matdate' ) as TStringField;
FDFt_branch := CreateField( 't_branch' ) as TStringField;
FDFt_off := CreateField( 't_off' ) as TStringField;
FDFt_short := CreateField( 't_short' ) as TStringField;
FDFt_name := CreateField( 't_name' ) as TStringField;
FDFt_addr := CreateField( 't_addr' ) as TStringField;
FDFt_coll := CreateField( 't_coll' ) as TStringField;
FDFnextrunDate := CreateField( 'nextrunDate' ) as TStringField;
FDFrunfreqDays := CreateField( 'runfreqDays' ) as TSmallIntField;
FDFforcerun := CreateField( 'forcerun' ) as TStringField;
FDFlast_updDate := CreateField( 'last_updDate' ) as TStringField;
FDFlast_ihisDate := CreateField( 'last_ihisDate' ) as TStringField;
FDFlast_thisDate := CreateField( 'last_thisDate' ) as TStringField;
FDFlast_diskDate := CreateField( 'last_diskDate' ) as TStringField;
FDFlast_tapeDate := CreateField( 'last_tapeDate' ) as TStringField;
FDFfirstrunDate := CreateField( 'firstrunDate' ) as TStringField;
FDFcancdate := CreateField( 'cancdate' ) as TStringField;
FDFMailCarrier := CreateField( 'MailCarrier' ) as TStringField;
FDFCallforDataDOW := CreateField( 'CallforDataDOW' ) as TStringField;
FDFhold_run := CreateField( 'hold_run' ) as TStringField;
FDFrevlevel := CreateField( 'revlevel' ) as TStringField;
FDFnum_mod := CreateField( 'num_mod' ) as TSmallIntField;
FDFmod := CreateField( 'mod' ) as TStringField;
FDFlen_def := CreateField( 'len_def' ) as TStringField;
FDFdef_text := CreateField( 'def_text' ) as TStringField;
FDFPrintMissingdataOfficerOrder := CreateField( 'PrintMissingdataOfficerOrder' ) as TStringField;
FDFmisstitle := CreateField( 'misstitle' ) as TStringField;
FDFsite_type := CreateField( 'site_type' ) as TStringField;
FDFic_input := CreateField( 'ic_input' ) as TStringField;
FDFnoticeid := CreateField( 'noticeid' ) as TStringField;
FDFinq_type := CreateField( 'inq_type' ) as TStringField;
FDFdoc_id := CreateField( 'doc_id' ) as TStringField;
FDFCollateralValueOption := CreateField( 'CollateralValueOption' ) as TStringField;
FDFimage_opt := CreateField( 'image_opt' ) as TStringField;
FDFprintid := CreateField( 'printid' ) as TStringField;
FDFfstrun := CreateField( 'fstrun' ) as TStringField;
FDFfststmt := CreateField( 'fststmt' ) as TStringField;
FDFmathold := CreateField( 'mathold' ) as TSmallIntField;
FDFNoticeSortOrder1 := CreateField( 'NoticeSortOrder1' ) as TStringField;
FDFNoticeSortOrder2 := CreateField( 'NoticeSortOrder2' ) as TStringField;
FDFNoticeSortOrder3 := CreateField( 'NoticeSortOrder3' ) as TStringField;
FDFNoticeSortOrder4 := CreateField( 'NoticeSortOrder4' ) as TStringField;
FDFNoticeSortOrder5 := CreateField( 'NoticeSortOrder5' ) as TStringField;
FDFFiller2 := CreateField( 'Filler2' ) as TStringField;
FDFspec_tab := CreateField( 'spec_tab' ) as TStringField;
FDFPremiumChartCopies := CreateField( 'PremiumChartCopies' ) as TIntegerField;
FDFMailingLabeltype := CreateField( 'MailingLabeltype' ) as TStringField;
FDFfnotdate := CreateField( 'fnotdate' ) as TIntegerField;
FDFsnotdate := CreateField( 'snotdate' ) as TIntegerField;
FDFcollateralUse := CreateField( 'collateralUse' ) as TStringField;
FDFreflag := CreateField( 'reflag' ) as TStringField;
FDFfnottype := CreateField( 'fnottype' ) as TStringField;
FDFpcprint := CreateField( 'pcprint' ) as TStringField;
FDFBalanceReportSortRequest := CreateField( 'BalanceReportSortRequest' ) as TStringField;
FDFpoldate := CreateField( 'poldate' ) as TIntegerField;
FDFhistptr := CreateField( 'histptr' ) as TStringField;
FDFNoteNumber := CreateField( 'NoteNumber' ) as TSmallIntField;
FDFOptions := CreateField( 'Options' ) as TStringField;
FDFclContact := CreateField( 'clContact' ) as TStringField;
FDFclAddress := CreateField( 'clAddress' ) as TStringField;
FDFclCityStZip := CreateField( 'clCityStZip' ) as TStringField;
FDFclPhone := CreateField( 'clPhone' ) as TStringField;
FDFclFax := CreateField( 'clFax' ) as TStringField;
FDFplContact := CreateField( 'plContact' ) as TStringField;
FDFplAddress := CreateField( 'plAddress' ) as TStringField;
FDFplCityStZip := CreateField( 'plCityStZip' ) as TStringField;
FDFplPhone := CreateField( 'plPhone' ) as TStringField;
FDFplFax := CreateField( 'plFax' ) as TStringField;
FDFLastRunDate := CreateField( 'LastRunDate' ) as TStringField;
FDFRunControl := CreateField( 'RunControl' ) as TStringField;
FDFTranControl := CreateField( 'TranControl' ) as TStringField;
FDFLast4RunNum := CreateField( 'Last4RunNum' ) as TStringField;
FDFAccountId := CreateField( 'AccountId' ) as TStringField;
FDFRefundOpt := CreateField( 'RefundOpt' ) as TStringField;
FDFInterim := CreateField( 'Interim' ) as TStringField;
end; { TInfoLENDERTable.CreateFields }
procedure TInfoLENDERTable.SetActive(Value: Boolean);
begin
inherited SetActive(Value);
if Active then
CreateFields;
end; { TInfoLENDERTable.SetActive }
procedure TInfoLENDERTable.SetPLenderID(const Value: String);
begin
DFLenderID.Value := Value;
end;
function TInfoLENDERTable.GetPLenderID:String;
begin
result := DFLenderID.Value;
end;
procedure TInfoLENDERTable.SetPModCount(const Value: SmallInt);
begin
DFModCount.Value := Value;
end;
function TInfoLENDERTable.GetPModCount:SmallInt;
begin
result := DFModCount.Value;
end;
procedure TInfoLENDERTable.SetPclient(const Value: String);
begin
DFclient.Value := Value;
end;
function TInfoLENDERTable.GetPclient:String;
begin
result := DFclient.Value;
end;
procedure TInfoLENDERTable.SetPSystemType(const Value: String);
begin
DFSystemType.Value := Value;
end;
function TInfoLENDERTable.GetPSystemType:String;
begin
result := DFSystemType.Value;
end;
procedure TInfoLENDERTable.SetPstatus(const Value: String);
begin
DFstatus.Value := Value;
end;
function TInfoLENDERTable.GetPstatus:String;
begin
result := DFstatus.Value;
end;
procedure TInfoLENDERTable.SetPNetStatement(const Value: String);
begin
DFNetStatement.Value := Value;
end;
function TInfoLENDERTable.GetPNetStatement:String;
begin
result := DFNetStatement.Value;
end;
procedure TInfoLENDERTable.SetPname(const Value: String);
begin
DFname.Value := Value;
end;
function TInfoLENDERTable.GetPname:String;
begin
result := DFname.Value;
end;
procedure TInfoLENDERTable.SetPAddress(const Value: String);
begin
DFAddress.Value := Value;
end;
function TInfoLENDERTable.GetPAddress:String;
begin
result := DFAddress.Value;
end;
procedure TInfoLENDERTable.SetPAddress2(const Value: String);
begin
DFAddress2.Value := Value;
end;
function TInfoLENDERTable.GetPAddress2:String;
begin
result := DFAddress2.Value;
end;
procedure TInfoLENDERTable.SetPCityState(const Value: String);
begin
DFCityState.Value := Value;
end;
function TInfoLENDERTable.GetPCityState:String;
begin
result := DFCityState.Value;
end;
procedure TInfoLENDERTable.SetPZipCode(const Value: String);
begin
DFZipCode.Value := Value;
end;
function TInfoLENDERTable.GetPZipCode:String;
begin
result := DFZipCode.Value;
end;
procedure TInfoLENDERTable.SetPStreetName(const Value: String);
begin
DFStreetName.Value := Value;
end;
function TInfoLENDERTable.GetPStreetName:String;
begin
result := DFStreetName.Value;
end;
procedure TInfoLENDERTable.SetPStreetAddress(const Value: String);
begin
DFStreetAddress.Value := Value;
end;
function TInfoLENDERTable.GetPStreetAddress:String;
begin
result := DFStreetAddress.Value;
end;
procedure TInfoLENDERTable.SetPStreetCSZ(const Value: String);
begin
DFStreetCSZ.Value := Value;
end;
function TInfoLENDERTable.GetPStreetCSZ:String;
begin
result := DFStreetCSZ.Value;
end;
procedure TInfoLENDERTable.SetPstate(const Value: String);
begin
DFstate.Value := Value;
end;
function TInfoLENDERTable.GetPstate:String;
begin
result := DFstate.Value;
end;
procedure TInfoLENDERTable.SetPPhoneNumber(const Value: String);
begin
DFPhoneNumber.Value := Value;
end;
function TInfoLENDERTable.GetPPhoneNumber:String;
begin
result := DFPhoneNumber.Value;
end;
procedure TInfoLENDERTable.SetPPhoneExtension(const Value: String);
begin
DFPhoneExtension.Value := Value;
end;
function TInfoLENDERTable.GetPPhoneExtension:String;
begin
result := DFPhoneExtension.Value;
end;
procedure TInfoLENDERTable.SetPResidentAdminName(const Value: String);
begin
DFResidentAdminName.Value := Value;
end;
function TInfoLENDERTable.GetPResidentAdminName:String;
begin
result := DFResidentAdminName.Value;
end;
procedure TInfoLENDERTable.SetPResidentAdminPhone(const Value: String);
begin
DFResidentAdminPhone.Value := Value;
end;
function TInfoLENDERTable.GetPResidentAdminPhone:String;
begin
result := DFResidentAdminPhone.Value;
end;
procedure TInfoLENDERTable.SetPResidentAdminPhoneExtension(const Value: String);
begin
DFResidentAdminPhoneExtension.Value := Value;
end;
function TInfoLENDERTable.GetPResidentAdminPhoneExtension:String;
begin
result := DFResidentAdminPhoneExtension.Value;
end;
procedure TInfoLENDERTable.SetPFaxNumber(const Value: String);
begin
DFFaxNumber.Value := Value;
end;
function TInfoLENDERTable.GetPFaxNumber:String;
begin
result := DFFaxNumber.Value;
end;
procedure TInfoLENDERTable.SetPgroup(const Value: String);
begin
DFgroup.Value := Value;
end;
function TInfoLENDERTable.GetPgroup:String;
begin
result := DFgroup.Value;
end;
procedure TInfoLENDERTable.SetPStatementGroup(const Value: String);
begin
DFStatementGroup.Value := Value;
end;
function TInfoLENDERTable.GetPStatementGroup:String;
begin
result := DFStatementGroup.Value;
end;
procedure TInfoLENDERTable.SetPClientID(const Value: String);
begin
DFClientID.Value := Value;
end;
function TInfoLENDERTable.GetPClientID:String;
begin
result := DFClientID.Value;
end;
procedure TInfoLENDERTable.SetPpcgroup(const Value: String);
begin
DFpcgroup.Value := Value;
end;
function TInfoLENDERTable.GetPpcgroup:String;
begin
result := DFpcgroup.Value;
end;
procedure TInfoLENDERTable.SetPBalanceLimit(const Value: Integer);
begin
DFBalanceLimit.Value := Value;
end;
function TInfoLENDERTable.GetPBalanceLimit:Integer;
begin
result := DFBalanceLimit.Value;
end;
procedure TInfoLENDERTable.SetPdel_lim(const Value: Integer);
begin
DFdel_lim.Value := Value;
end;
function TInfoLENDERTable.GetPdel_lim:Integer;
begin
result := DFdel_lim.Value;
end;
procedure TInfoLENDERTable.SetPbaldel(const Value: String);
begin
DFbaldel.Value := Value;
end;
function TInfoLENDERTable.GetPbaldel:String;
begin
result := DFbaldel.Value;
end;
procedure TInfoLENDERTable.SetPMatureLoanHoldDays(const Value: SmallInt);
begin
DFMatureLoanHoldDays.Value := Value;
end;
function TInfoLENDERTable.GetPMatureLoanHoldDays:SmallInt;
begin
result := DFMatureLoanHoldDays.Value;
end;
procedure TInfoLENDERTable.SetPTapeHoldDays(const Value: SmallInt);
begin
DFTapeHoldDays.Value := Value;
end;
function TInfoLENDERTable.GetPTapeHoldDays:SmallInt;
begin
result := DFTapeHoldDays.Value;
end;
procedure TInfoLENDERTable.SetPrunevents(const Value: String);
begin
DFrunevents.Value := Value;
end;
function TInfoLENDERTable.GetPrunevents:String;
begin
result := DFrunevents.Value;
end;
procedure TInfoLENDERTable.SetPmethod(const Value: String);
begin
DFmethod.Value := Value;
end;
function TInfoLENDERTable.GetPmethod:String;
begin
result := DFmethod.Value;
end;
procedure TInfoLENDERTable.SetPCommisionEntityMix(const Value: String);
begin
DFCommisionEntityMix.Value := Value;
end;
function TInfoLENDERTable.GetPCommisionEntityMix:String;
begin
result := DFCommisionEntityMix.Value;
end;
procedure TInfoLENDERTable.SetPMasterMix(const Value: String);
begin
DFMasterMix.Value := Value;
end;
function TInfoLENDERTable.GetPMasterMix:String;
begin
result := DFMasterMix.Value;
end;
procedure TInfoLENDERTable.SetPBlanketPolicyMix(const Value: String);
begin
DFBlanketPolicyMix.Value := Value;
end;
function TInfoLENDERTable.GetPBlanketPolicyMix:String;
begin
result := DFBlanketPolicyMix.Value;
end;
procedure TInfoLENDERTable.SetPGracePeriodOption(const Value: String);
begin
DFGracePeriodOption.Value := Value;
end;
function TInfoLENDERTable.GetPGracePeriodOption:String;
begin
result := DFGracePeriodOption.Value;
end;
procedure TInfoLENDERTable.SetPNewGraceDays(const Value: SmallInt);
begin
DFNewGraceDays.Value := Value;
end;
function TInfoLENDERTable.GetPNewGraceDays:SmallInt;
begin
result := DFNewGraceDays.Value;
end;
procedure TInfoLENDERTable.SetPExpGraceDays(const Value: SmallInt);
begin
DFExpGraceDays.Value := Value;
end;
function TInfoLENDERTable.GetPExpGraceDays:SmallInt;
begin
result := DFExpGraceDays.Value;
end;
procedure TInfoLENDERTable.SetPcancellgraceDays(const Value: SmallInt);
begin
DFcancellgraceDays.Value := Value;
end;
function TInfoLENDERTable.GetPcancellgraceDays:SmallInt;
begin
result := DFcancellgraceDays.Value;
end;
procedure TInfoLENDERTable.SetPMaxBackDays(const Value: SmallInt);
begin
DFMaxBackDays.Value := Value;
end;
function TInfoLENDERTable.GetPMaxBackDays:SmallInt;
begin
result := DFMaxBackDays.Value;
end;
procedure TInfoLENDERTable.SetPErrorOmissionInceptionDate(const Value: String);
begin
DFErrorOmissionInceptionDate.Value := Value;
end;
function TInfoLENDERTable.GetPErrorOmissionInceptionDate:String;
begin
result := DFErrorOmissionInceptionDate.Value;
end;
procedure TInfoLENDERTable.SetPOverrideEODate(const Value: String);
begin
DFOverrideEODate.Value := Value;
end;
function TInfoLENDERTable.GetPOverrideEODate:String;
begin
result := DFOverrideEODate.Value;
end;
procedure TInfoLENDERTable.SetPmanprint(const Value: String);
begin
DFmanprint.Value := Value;
end;
function TInfoLENDERTable.GetPmanprint:String;
begin
result := DFmanprint.Value;
end;
procedure TInfoLENDERTable.SetPbook_all(const Value: String);
begin
DFbook_all.Value := Value;
end;
function TInfoLENDERTable.GetPbook_all:String;
begin
result := DFbook_all.Value;
end;
procedure TInfoLENDERTable.SetPWaverNonPayDays(const Value: SmallInt);
begin
DFWaverNonPayDays.Value := Value;
end;
function TInfoLENDERTable.GetPWaverNonPayDays:SmallInt;
begin
result := DFWaverNonPayDays.Value;
end;
procedure TInfoLENDERTable.SetPnewpmt(const Value: String);
begin
DFnewpmt.Value := Value;
end;
function TInfoLENDERTable.GetPnewpmt:String;
begin
result := DFnewpmt.Value;
end;
procedure TInfoLENDERTable.SetPStatementContactName(const Value: String);
begin
DFStatementContactName.Value := Value;
end;
function TInfoLENDERTable.GetPStatementContactName:String;
begin
result := DFStatementContactName.Value;
end;
procedure TInfoLENDERTable.SetPOfficeContactName(const Value: String);
begin
DFOfficeContactName.Value := Value;
end;
function TInfoLENDERTable.GetPOfficeContactName:String;
begin
result := DFOfficeContactName.Value;
end;
procedure TInfoLENDERTable.SetPNoticeSignature(const Value: String);
begin
DFNoticeSignature.Value := Value;
end;
function TInfoLENDERTable.GetPNoticeSignature:String;
begin
result := DFNoticeSignature.Value;
end;
procedure TInfoLENDERTable.SetPNoticeSignature2(const Value: String);
begin
DFNoticeSignature2.Value := Value;
end;
function TInfoLENDERTable.GetPNoticeSignature2:String;
begin
result := DFNoticeSignature2.Value;
end;
procedure TInfoLENDERTable.SetPMasterPolicyNumber(const Value: String);
begin
DFMasterPolicyNumber.Value := Value;
end;
function TInfoLENDERTable.GetPMasterPolicyNumber:String;
begin
result := DFMasterPolicyNumber.Value;
end;
procedure TInfoLENDERTable.SetPBlanketPolicyNumber(const Value: String);
begin
DFBlanketPolicyNumber.Value := Value;
end;
function TInfoLENDERTable.GetPBlanketPolicyNumber:String;
begin
result := DFBlanketPolicyNumber.Value;
end;
procedure TInfoLENDERTable.SetPEarningMethodCode(const Value: String);
begin
DFEarningMethodCode.Value := Value;
end;
function TInfoLENDERTable.GetPEarningMethodCode:String;
begin
result := DFEarningMethodCode.Value;
end;
procedure TInfoLENDERTable.SetPCancellationMethocCode(const Value: String);
begin
DFCancellationMethocCode.Value := Value;
end;
function TInfoLENDERTable.GetPCancellationMethocCode:String;
begin
result := DFCancellationMethocCode.Value;
end;
procedure TInfoLENDERTable.SetPtapeid(const Value: String);
begin
DFtapeid.Value := Value;
end;
function TInfoLENDERTable.GetPtapeid:String;
begin
result := DFtapeid.Value;
end;
procedure TInfoLENDERTable.SetPdiskid(const Value: String);
begin
DFdiskid.Value := Value;
end;
function TInfoLENDERTable.GetPdiskid:String;
begin
result := DFdiskid.Value;
end;
procedure TInfoLENDERTable.SetPInquiryID(const Value: String);
begin
DFInquiryID.Value := Value;
end;
function TInfoLENDERTable.GetPInquiryID:String;
begin
result := DFInquiryID.Value;
end;
procedure TInfoLENDERTable.SetPCancellationID(const Value: String);
begin
DFCancellationID.Value := Value;
end;
function TInfoLENDERTable.GetPCancellationID:String;
begin
result := DFCancellationID.Value;
end;
procedure TInfoLENDERTable.SetPStatementID(const Value: String);
begin
DFStatementID.Value := Value;
end;
function TInfoLENDERTable.GetPStatementID:String;
begin
result := DFStatementID.Value;
end;
procedure TInfoLENDERTable.SetPBranchBankingOption(const Value: String);
begin
DFBranchBankingOption.Value := Value;
end;
function TInfoLENDERTable.GetPBranchBankingOption:String;
begin
result := DFBranchBankingOption.Value;
end;
procedure TInfoLENDERTable.SetPunwaive(const Value: String);
begin
DFunwaive.Value := Value;
end;
function TInfoLENDERTable.GetPunwaive:String;
begin
result := DFunwaive.Value;
end;
procedure TInfoLENDERTable.SetPSpecialApprovalCode_opt9x(const Value: String);
begin
DFSpecialApprovalCode_opt9x.Value := Value;
end;
function TInfoLENDERTable.GetPSpecialApprovalCode_opt9x:String;
begin
result := DFSpecialApprovalCode_opt9x.Value;
end;
procedure TInfoLENDERTable.SetPmon_only(const Value: String);
begin
DFmon_only.Value := Value;
end;
function TInfoLENDERTable.GetPmon_only:String;
begin
result := DFmon_only.Value;
end;
procedure TInfoLENDERTable.SetPkeepForcedData(const Value: String);
begin
DFkeepForcedData.Value := Value;
end;
function TInfoLENDERTable.GetPkeepForcedData:String;
begin
result := DFkeepForcedData.Value;
end;
procedure TInfoLENDERTable.SetPautorenew(const Value: String);
begin
DFautorenew.Value := Value;
end;
function TInfoLENDERTable.GetPautorenew:String;
begin
result := DFautorenew.Value;
end;
procedure TInfoLENDERTable.SetPInterestOption(const Value: String);
begin
DFInterestOption.Value := Value;
end;
function TInfoLENDERTable.GetPInterestOption:String;
begin
result := DFInterestOption.Value;
end;
procedure TInfoLENDERTable.SetPInterestRate(const Value: Currency);
begin
DFInterestRate.Value := Value;
end;
function TInfoLENDERTable.GetPInterestRate:Currency;
begin
result := DFInterestRate.Value;
end;
procedure TInfoLENDERTable.SetPt_updins(const Value: String);
begin
DFt_updins.Value := Value;
end;
function TInfoLENDERTable.GetPt_updins:String;
begin
result := DFt_updins.Value;
end;
procedure TInfoLENDERTable.SetPt_lndate(const Value: String);
begin
DFt_lndate.Value := Value;
end;
function TInfoLENDERTable.GetPt_lndate:String;
begin
result := DFt_lndate.Value;
end;
procedure TInfoLENDERTable.SetPt_matdate(const Value: String);
begin
DFt_matdate.Value := Value;
end;
function TInfoLENDERTable.GetPt_matdate:String;
begin
result := DFt_matdate.Value;
end;
procedure TInfoLENDERTable.SetPt_branch(const Value: String);
begin
DFt_branch.Value := Value;
end;
function TInfoLENDERTable.GetPt_branch:String;
begin
result := DFt_branch.Value;
end;
procedure TInfoLENDERTable.SetPt_off(const Value: String);
begin
DFt_off.Value := Value;
end;
function TInfoLENDERTable.GetPt_off:String;
begin
result := DFt_off.Value;
end;
procedure TInfoLENDERTable.SetPt_short(const Value: String);
begin
DFt_short.Value := Value;
end;
function TInfoLENDERTable.GetPt_short:String;
begin
result := DFt_short.Value;
end;
procedure TInfoLENDERTable.SetPt_name(const Value: String);
begin
DFt_name.Value := Value;
end;
function TInfoLENDERTable.GetPt_name:String;
begin
result := DFt_name.Value;
end;
procedure TInfoLENDERTable.SetPt_addr(const Value: String);
begin
DFt_addr.Value := Value;
end;
function TInfoLENDERTable.GetPt_addr:String;
begin
result := DFt_addr.Value;
end;
procedure TInfoLENDERTable.SetPt_coll(const Value: String);
begin
DFt_coll.Value := Value;
end;
function TInfoLENDERTable.GetPt_coll:String;
begin
result := DFt_coll.Value;
end;
procedure TInfoLENDERTable.SetPnextrunDate(const Value: String);
begin
DFnextrunDate.Value := Value;
end;
function TInfoLENDERTable.GetPnextrunDate:String;
begin
result := DFnextrunDate.Value;
end;
procedure TInfoLENDERTable.SetPrunfreqDays(const Value: SmallInt);
begin
DFrunfreqDays.Value := Value;
end;
function TInfoLENDERTable.GetPrunfreqDays:SmallInt;
begin
result := DFrunfreqDays.Value;
end;
procedure TInfoLENDERTable.SetPforcerun(const Value: String);
begin
DFforcerun.Value := Value;
end;
function TInfoLENDERTable.GetPforcerun:String;
begin
result := DFforcerun.Value;
end;
procedure TInfoLENDERTable.SetPlast_updDate(const Value: String);
begin
DFlast_updDate.Value := Value;
end;
function TInfoLENDERTable.GetPlast_updDate:String;
begin
result := DFlast_updDate.Value;
end;
procedure TInfoLENDERTable.SetPlast_ihisDate(const Value: String);
begin
DFlast_ihisDate.Value := Value;
end;
function TInfoLENDERTable.GetPlast_ihisDate:String;
begin
result := DFlast_ihisDate.Value;
end;
procedure TInfoLENDERTable.SetPlast_thisDate(const Value: String);
begin
DFlast_thisDate.Value := Value;
end;
function TInfoLENDERTable.GetPlast_thisDate:String;
begin
result := DFlast_thisDate.Value;
end;
procedure TInfoLENDERTable.SetPlast_diskDate(const Value: String);
begin
DFlast_diskDate.Value := Value;
end;
function TInfoLENDERTable.GetPlast_diskDate:String;
begin
result := DFlast_diskDate.Value;
end;
procedure TInfoLENDERTable.SetPlast_tapeDate(const Value: String);
begin
DFlast_tapeDate.Value := Value;
end;
function TInfoLENDERTable.GetPlast_tapeDate:String;
begin
result := DFlast_tapeDate.Value;
end;
procedure TInfoLENDERTable.SetPfirstrunDate(const Value: String);
begin
DFfirstrunDate.Value := Value;
end;
function TInfoLENDERTable.GetPfirstrunDate:String;
begin
result := DFfirstrunDate.Value;
end;
procedure TInfoLENDERTable.SetPcancdate(const Value: String);
begin
DFcancdate.Value := Value;
end;
function TInfoLENDERTable.GetPcancdate:String;
begin
result := DFcancdate.Value;
end;
procedure TInfoLENDERTable.SetPMailCarrier(const Value: String);
begin
DFMailCarrier.Value := Value;
end;
function TInfoLENDERTable.GetPMailCarrier:String;
begin
result := DFMailCarrier.Value;
end;
procedure TInfoLENDERTable.SetPCallforDataDOW(const Value: String);
begin
DFCallforDataDOW.Value := Value;
end;
function TInfoLENDERTable.GetPCallforDataDOW:String;
begin
result := DFCallforDataDOW.Value;
end;
procedure TInfoLENDERTable.SetPhold_run(const Value: String);
begin
DFhold_run.Value := Value;
end;
function TInfoLENDERTable.GetPhold_run:String;
begin
result := DFhold_run.Value;
end;
procedure TInfoLENDERTable.SetPrevlevel(const Value: String);
begin
DFrevlevel.Value := Value;
end;
function TInfoLENDERTable.GetPrevlevel:String;
begin
result := DFrevlevel.Value;
end;
procedure TInfoLENDERTable.SetPnum_mod(const Value: SmallInt);
begin
DFnum_mod.Value := Value;
end;
function TInfoLENDERTable.GetPnum_mod:SmallInt;
begin
result := DFnum_mod.Value;
end;
procedure TInfoLENDERTable.SetPmod(const Value: String);
begin
DFmod.Value := Value;
end;
function TInfoLENDERTable.GetPmod:String;
begin
result := DFmod.Value;
end;
procedure TInfoLENDERTable.SetPlen_def(const Value: String);
begin
DFlen_def.Value := Value;
end;
function TInfoLENDERTable.GetPlen_def:String;
begin
result := DFlen_def.Value;
end;
procedure TInfoLENDERTable.SetPdef_text(const Value: String);
begin
DFdef_text.Value := Value;
end;
function TInfoLENDERTable.GetPdef_text:String;
begin
result := DFdef_text.Value;
end;
procedure TInfoLENDERTable.SetPPrintMissingdataOfficerOrder(const Value: String);
begin
DFPrintMissingdataOfficerOrder.Value := Value;
end;
function TInfoLENDERTable.GetPPrintMissingdataOfficerOrder:String;
begin
result := DFPrintMissingdataOfficerOrder.Value;
end;
procedure TInfoLENDERTable.SetPmisstitle(const Value: String);
begin
DFmisstitle.Value := Value;
end;
function TInfoLENDERTable.GetPmisstitle:String;
begin
result := DFmisstitle.Value;
end;
procedure TInfoLENDERTable.SetPsite_type(const Value: String);
begin
DFsite_type.Value := Value;
end;
function TInfoLENDERTable.GetPsite_type:String;
begin
result := DFsite_type.Value;
end;
procedure TInfoLENDERTable.SetPic_input(const Value: String);
begin
DFic_input.Value := Value;
end;
function TInfoLENDERTable.GetPic_input:String;
begin
result := DFic_input.Value;
end;
procedure TInfoLENDERTable.SetPnoticeid(const Value: String);
begin
DFnoticeid.Value := Value;
end;
function TInfoLENDERTable.GetPnoticeid:String;
begin
result := DFnoticeid.Value;
end;
procedure TInfoLENDERTable.SetPinq_type(const Value: String);
begin
DFinq_type.Value := Value;
end;
function TInfoLENDERTable.GetPinq_type:String;
begin
result := DFinq_type.Value;
end;
procedure TInfoLENDERTable.SetPdoc_id(const Value: String);
begin
DFdoc_id.Value := Value;
end;
function TInfoLENDERTable.GetPdoc_id:String;
begin
result := DFdoc_id.Value;
end;
procedure TInfoLENDERTable.SetPCollateralValueOption(const Value: String);
begin
DFCollateralValueOption.Value := Value;
end;
function TInfoLENDERTable.GetPCollateralValueOption:String;
begin
result := DFCollateralValueOption.Value;
end;
procedure TInfoLENDERTable.SetPimage_opt(const Value: String);
begin
DFimage_opt.Value := Value;
end;
function TInfoLENDERTable.GetPimage_opt:String;
begin
result := DFimage_opt.Value;
end;
procedure TInfoLENDERTable.SetPprintid(const Value: String);
begin
DFprintid.Value := Value;
end;
function TInfoLENDERTable.GetPprintid:String;
begin
result := DFprintid.Value;
end;
procedure TInfoLENDERTable.SetPfstrun(const Value: String);
begin
DFfstrun.Value := Value;
end;
function TInfoLENDERTable.GetPfstrun:String;
begin
result := DFfstrun.Value;
end;
procedure TInfoLENDERTable.SetPfststmt(const Value: String);
begin
DFfststmt.Value := Value;
end;
function TInfoLENDERTable.GetPfststmt:String;
begin
result := DFfststmt.Value;
end;
procedure TInfoLENDERTable.SetPmathold(const Value: SmallInt);
begin
DFmathold.Value := Value;
end;
function TInfoLENDERTable.GetPmathold:SmallInt;
begin
result := DFmathold.Value;
end;
procedure TInfoLENDERTable.SetPNoticeSortOrder1(const Value: String);
begin
DFNoticeSortOrder1.Value := Value;
end;
function TInfoLENDERTable.GetPNoticeSortOrder1:String;
begin
result := DFNoticeSortOrder1.Value;
end;
procedure TInfoLENDERTable.SetPNoticeSortOrder2(const Value: String);
begin
DFNoticeSortOrder2.Value := Value;
end;
function TInfoLENDERTable.GetPNoticeSortOrder2:String;
begin
result := DFNoticeSortOrder2.Value;
end;
procedure TInfoLENDERTable.SetPNoticeSortOrder3(const Value: String);
begin
DFNoticeSortOrder3.Value := Value;
end;
function TInfoLENDERTable.GetPNoticeSortOrder3:String;
begin
result := DFNoticeSortOrder3.Value;
end;
procedure TInfoLENDERTable.SetPNoticeSortOrder4(const Value: String);
begin
DFNoticeSortOrder4.Value := Value;
end;
function TInfoLENDERTable.GetPNoticeSortOrder4:String;
begin
result := DFNoticeSortOrder4.Value;
end;
procedure TInfoLENDERTable.SetPNoticeSortOrder5(const Value: String);
begin
DFNoticeSortOrder5.Value := Value;
end;
function TInfoLENDERTable.GetPNoticeSortOrder5:String;
begin
result := DFNoticeSortOrder5.Value;
end;
procedure TInfoLENDERTable.SetPFiller2(const Value: String);
begin
DFFiller2.Value := Value;
end;
function TInfoLENDERTable.GetPFiller2:String;
begin
result := DFFiller2.Value;
end;
procedure TInfoLENDERTable.SetPspec_tab(const Value: String);
begin
DFspec_tab.Value := Value;
end;
function TInfoLENDERTable.GetPspec_tab:String;
begin
result := DFspec_tab.Value;
end;
procedure TInfoLENDERTable.SetPPremiumChartCopies(const Value: Integer);
begin
DFPremiumChartCopies.Value := Value;
end;
function TInfoLENDERTable.GetPPremiumChartCopies:Integer;
begin
result := DFPremiumChartCopies.Value;
end;
procedure TInfoLENDERTable.SetPMailingLabeltype(const Value: String);
begin
DFMailingLabeltype.Value := Value;
end;
function TInfoLENDERTable.GetPMailingLabeltype:String;
begin
result := DFMailingLabeltype.Value;
end;
procedure TInfoLENDERTable.SetPfnotdate(const Value: Integer);
begin
DFfnotdate.Value := Value;
end;
function TInfoLENDERTable.GetPfnotdate:Integer;
begin
result := DFfnotdate.Value;
end;
procedure TInfoLENDERTable.SetPsnotdate(const Value: Integer);
begin
DFsnotdate.Value := Value;
end;
function TInfoLENDERTable.GetPsnotdate:Integer;
begin
result := DFsnotdate.Value;
end;
procedure TInfoLENDERTable.SetPcollateralUse(const Value: String);
begin
DFcollateralUse.Value := Value;
end;
function TInfoLENDERTable.GetPcollateralUse:String;
begin
result := DFcollateralUse.Value;
end;
procedure TInfoLENDERTable.SetPreflag(const Value: String);
begin
DFreflag.Value := Value;
end;
function TInfoLENDERTable.GetPreflag:String;
begin
result := DFreflag.Value;
end;
procedure TInfoLENDERTable.SetPfnottype(const Value: String);
begin
DFfnottype.Value := Value;
end;
function TInfoLENDERTable.GetPfnottype:String;
begin
result := DFfnottype.Value;
end;
procedure TInfoLENDERTable.SetPpcprint(const Value: String);
begin
DFpcprint.Value := Value;
end;
function TInfoLENDERTable.GetPpcprint:String;
begin
result := DFpcprint.Value;
end;
procedure TInfoLENDERTable.SetPBalanceReportSortRequest(const Value: String);
begin
DFBalanceReportSortRequest.Value := Value;
end;
function TInfoLENDERTable.GetPBalanceReportSortRequest:String;
begin
result := DFBalanceReportSortRequest.Value;
end;
procedure TInfoLENDERTable.SetPpoldate(const Value: Integer);
begin
DFpoldate.Value := Value;
end;
function TInfoLENDERTable.GetPpoldate:Integer;
begin
result := DFpoldate.Value;
end;
procedure TInfoLENDERTable.SetPhistptr(const Value: String);
begin
DFhistptr.Value := Value;
end;
function TInfoLENDERTable.GetPhistptr:String;
begin
result := DFhistptr.Value;
end;
procedure TInfoLENDERTable.SetPNoteNumber(const Value: SmallInt);
begin
DFNoteNumber.Value := Value;
end;
function TInfoLENDERTable.GetPNoteNumber:SmallInt;
begin
result := DFNoteNumber.Value;
end;
procedure TInfoLENDERTable.SetPOptions(const Value: String);
begin
DFOptions.Value := Value;
end;
function TInfoLENDERTable.GetPOptions:String;
begin
result := DFOptions.Value;
end;
procedure TInfoLENDERTable.SetPclContact(const Value: String);
begin
DFclContact.Value := Value;
end;
function TInfoLENDERTable.GetPclContact:String;
begin
result := DFclContact.Value;
end;
procedure TInfoLENDERTable.SetPclAddress(const Value: String);
begin
DFclAddress.Value := Value;
end;
function TInfoLENDERTable.GetPclAddress:String;
begin
result := DFclAddress.Value;
end;
procedure TInfoLENDERTable.SetPclCityStZip(const Value: String);
begin
DFclCityStZip.Value := Value;
end;
function TInfoLENDERTable.GetPclCityStZip:String;
begin
result := DFclCityStZip.Value;
end;
procedure TInfoLENDERTable.SetPclPhone(const Value: String);
begin
DFclPhone.Value := Value;
end;
function TInfoLENDERTable.GetPclPhone:String;
begin
result := DFclPhone.Value;
end;
procedure TInfoLENDERTable.SetPclFax(const Value: String);
begin
DFclFax.Value := Value;
end;
function TInfoLENDERTable.GetPclFax:String;
begin
result := DFclFax.Value;
end;
procedure TInfoLENDERTable.SetPplContact(const Value: String);
begin
DFplContact.Value := Value;
end;
function TInfoLENDERTable.GetPplContact:String;
begin
result := DFplContact.Value;
end;
procedure TInfoLENDERTable.SetPplAddress(const Value: String);
begin
DFplAddress.Value := Value;
end;
function TInfoLENDERTable.GetPplAddress:String;
begin
result := DFplAddress.Value;
end;
procedure TInfoLENDERTable.SetPplCityStZip(const Value: String);
begin
DFplCityStZip.Value := Value;
end;
function TInfoLENDERTable.GetPplCityStZip:String;
begin
result := DFplCityStZip.Value;
end;
procedure TInfoLENDERTable.SetPplPhone(const Value: String);
begin
DFplPhone.Value := Value;
end;
function TInfoLENDERTable.GetPplPhone:String;
begin
result := DFplPhone.Value;
end;
procedure TInfoLENDERTable.SetPplFax(const Value: String);
begin
DFplFax.Value := Value;
end;
function TInfoLENDERTable.GetPplFax:String;
begin
result := DFplFax.Value;
end;
procedure TInfoLENDERTable.SetPLastRunDate(const Value: String);
begin
DFLastRunDate.Value := Value;
end;
function TInfoLENDERTable.GetPLastRunDate:String;
begin
result := DFLastRunDate.Value;
end;
procedure TInfoLENDERTable.SetPRunControl(const Value: String);
begin
DFRunControl.Value := Value;
end;
function TInfoLENDERTable.GetPRunControl:String;
begin
result := DFRunControl.Value;
end;
procedure TInfoLENDERTable.SetPTranControl(const Value: String);
begin
DFTranControl.Value := Value;
end;
function TInfoLENDERTable.GetPTranControl:String;
begin
result := DFTranControl.Value;
end;
procedure TInfoLENDERTable.SetPLast4RunNum(const Value: String);
begin
DFLast4RunNum.Value := Value;
end;
function TInfoLENDERTable.GetPLast4RunNum:String;
begin
result := DFLast4RunNum.Value;
end;
procedure TInfoLENDERTable.SetPAccountId(const Value: String);
begin
DFAccountId.Value := Value;
end;
function TInfoLENDERTable.GetPAccountId:String;
begin
result := DFAccountId.Value;
end;
procedure TInfoLENDERTable.SetPRefundOpt(const Value: String);
begin
DFRefundOpt.Value := Value;
end;
function TInfoLENDERTable.GetPRefundOpt:String;
begin
result := DFRefundOpt.Value;
end;
procedure TInfoLENDERTable.SetPInterim(const Value: String);
begin
DFInterim.Value := Value;
end;
function TInfoLENDERTable.GetPInterim:String;
begin
result := DFInterim.Value;
end;
procedure TInfoLENDERTable.LoadFieldDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('LenderID, String, 4, N');
Add('ModCount, SmallInt, 0, N');
Add('client, String, 3, N');
Add('SystemType, String, 1, N');
Add('status, String, 1, N');
Add('NetStatement, String, 1, N');
Add('name, String, 50, N');
Add('Address, String, 30, N');
Add('Address2, String, 30, N');
Add('CityState, String, 25, N');
Add('ZipCode, String, 9, N');
Add('StreetName, String, 30, N');
Add('StreetAddress, String, 30, N');
Add('StreetCSZ, String, 30, N');
Add('state, String, 2, N');
Add('PhoneNumber, String, 10, N');
Add('PhoneExtension, String, 15, N');
Add('ResidentAdminName, String, 30, N');
Add('ResidentAdminPhone, String, 10, N');
Add('ResidentAdminPhoneExtension, String, 15, N');
Add('FaxNumber, String, 10, N');
Add('group, String, 3, N');
Add('StatementGroup, String, 3, N');
Add('ClientID, String, 3, N');
Add('pcgroup, String, 3, N');
Add('BalanceLimit, Integer, 0, N');
Add('del_lim, Integer, 0, N');
Add('baldel, String, 1, N');
Add('MatureLoanHoldDays, SmallInt, 0, N');
Add('TapeHoldDays, SmallInt, 0, N');
Add('runevents, String, 6, N');
Add('method, String, 4, N');
Add('CommisionEntityMix, String, 5, N');
Add('MasterMix, String, 5, N');
Add('BlanketPolicyMix, String, 5, N');
Add('GracePeriodOption, String, 1, N');
Add('NewGraceDays, SmallInt, 0, N');
Add('ExpGraceDays, SmallInt, 0, N');
Add('cancellgraceDays, SmallInt, 0, N');
Add('MaxBackDays, SmallInt, 0, N');
Add('ErrorOmissionInceptionDate, String, 8, N');
Add('OverrideEODate, String, 1, N');
Add('manprint, String, 1, N');
Add('book_all, String, 1, N');
Add('WaverNonPayDays, SmallInt, 0, N');
Add('newpmt, String, 2, N');
Add('StatementContactName, String, 30, N');
Add('OfficeContactName, String, 26, N');
Add('NoticeSignature, String, 30, N');
Add('NoticeSignature2, String, 30, N');
Add('MasterPolicyNumber, String, 10, N');
Add('BlanketPolicyNumber, String, 10, N');
Add('EarningMethodCode, String, 2, N');
Add('CancellationMethocCode, String, 2, N');
Add('tapeid, String, 6, N');
Add('diskid, String, 6, N');
Add('InquiryID, String, 6, N');
Add('CancellationID, String, 6, N');
Add('StatementID, String, 6, N');
Add('BranchBankingOption, String, 1, N');
Add('unwaive, String, 1, N');
Add('SpecialApprovalCode_opt9x, String, 1, N');
Add('mon_only, String, 1, N');
Add('keepForcedData, String, 1, N');
Add('autorenew, String, 1, N');
Add('InterestOption, String, 1, N');
Add('InterestRate, Currency, 0, N');
Add('t_updins, String, 1, N');
Add('t_lndate, String, 1, N');
Add('t_matdate, String, 1, N');
Add('t_branch, String, 1, N');
Add('t_off, String, 1, N');
Add('t_short, String, 1, N');
Add('t_name, String, 1, N');
Add('t_addr, String, 1, N');
Add('t_coll, String, 1, N');
Add('nextrunDate, String, 8, N');
Add('runfreqDays, SmallInt, 0, N');
Add('forcerun, String, 1, N');
Add('last_updDate, String, 8, N');
Add('last_ihisDate, String, 8, N');
Add('last_thisDate, String, 8, N');
Add('last_diskDate, String, 8, N');
Add('last_tapeDate, String, 8, N');
Add('firstrunDate, String, 8, N');
Add('cancdate, String, 8, N');
Add('MailCarrier, String, 2, N');
Add('CallforDataDOW, String, 2, N');
Add('hold_run, String, 1, N');
Add('revlevel, String, 1, N');
Add('num_mod, SmallInt, 0, N');
Add('mod, String, 1, N');
Add('len_def, String, 6, N');
Add('def_text, String, 20, N');
Add('PrintMissingdataOfficerOrder, String, 1, N');
Add('misstitle, String, 1, N');
Add('site_type, String, 1, N');
Add('ic_input, String, 1, N');
Add('noticeid, String, 6, N');
Add('inq_type, String, 1, N');
Add('doc_id, String, 1, N');
Add('CollateralValueOption, String, 1, N');
Add('image_opt, String, 1, N');
Add('printid, String, 6, N');
Add('fstrun, String, 6, N');
Add('fststmt, String, 4, N');
Add('mathold, SmallInt, 0, N');
Add('NoticeSortOrder1, String, 1, N');
Add('NoticeSortOrder2, String, 1, N');
Add('NoticeSortOrder3, String, 1, N');
Add('NoticeSortOrder4, String, 1, N');
Add('NoticeSortOrder5, String, 1, N');
Add('Filler2, String, 75, N');
Add('spec_tab, String, 35, N');
Add('PremiumChartCopies, Integer, 0, N');
Add('MailingLabeltype, String, 1, N');
Add('fnotdate, Integer, 0, N');
Add('snotdate, Integer, 0, N');
Add('collateralUse, String, 1, N');
Add('reflag, String, 1, N');
Add('fnottype, String, 1, N');
Add('pcprint, String, 1, N');
Add('BalanceReportSortRequest, String, 1, N');
Add('poldate, Integer, 0, N');
Add('histptr, String, 6, N');
Add('NoteNumber, SmallInt, 0, N');
Add('Options, String, 50, N');
Add('clContact, String, 30, N');
Add('clAddress, String, 30, N');
Add('clCityStZip, String, 30, N');
Add('clPhone, String, 30, N');
Add('clFax, String, 30, N');
Add('plContact, String, 30, N');
Add('plAddress, String, 30, N');
Add('plCityStZip, String, 30, N');
Add('plPhone, String, 30, N');
Add('plFax, String, 30, N');
Add('LastRunDate, String, 32, N');
Add('RunControl, String, 2, N');
Add('TranControl, String, 2, N');
Add('Last4RunNum, String, 8, N');
Add('AccountId, String, 4, N');
Add('RefundOpt, String, 1, N');
Add('Interim, String, 1, N');
end;
end;
procedure TInfoLENDERTable.LoadIndexDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('PrimaryKey, LenderID, Y, Y, N, N');
Add('Lender, LenderID, N, N, N, N');
Add('LenderName, name, N, N, Y, N');
end;
end;
procedure TInfoLENDERTable.SetEnumIndex(Value: TEIInfoLENDER);
begin
case Value of
InfoLENDERPrimaryKey : IndexName := '';
InfoLENDERLender : IndexName := 'Lender';
InfoLENDERLenderName : IndexName := 'LenderName';
end;
end;
function TInfoLENDERTable.GetDataBuffer:TInfoLENDERRecord;
var buf: TInfoLENDERRecord;
begin
fillchar(buf, sizeof(buf), 0);
buf.PLenderID := DFLenderID.Value;
buf.PModCount := DFModCount.Value;
buf.Pclient := DFclient.Value;
buf.PSystemType := DFSystemType.Value;
buf.Pstatus := DFstatus.Value;
buf.PNetStatement := DFNetStatement.Value;
buf.Pname := DFname.Value;
buf.PAddress := DFAddress.Value;
buf.PAddress2 := DFAddress2.Value;
buf.PCityState := DFCityState.Value;
buf.PZipCode := DFZipCode.Value;
buf.PStreetName := DFStreetName.Value;
buf.PStreetAddress := DFStreetAddress.Value;
buf.PStreetCSZ := DFStreetCSZ.Value;
buf.Pstate := DFstate.Value;
buf.PPhoneNumber := DFPhoneNumber.Value;
buf.PPhoneExtension := DFPhoneExtension.Value;
buf.PResidentAdminName := DFResidentAdminName.Value;
buf.PResidentAdminPhone := DFResidentAdminPhone.Value;
buf.PResidentAdminPhoneExtension := DFResidentAdminPhoneExtension.Value;
buf.PFaxNumber := DFFaxNumber.Value;
buf.Pgroup := DFgroup.Value;
buf.PStatementGroup := DFStatementGroup.Value;
buf.PClientID := DFClientID.Value;
buf.Ppcgroup := DFpcgroup.Value;
buf.PBalanceLimit := DFBalanceLimit.Value;
buf.Pdel_lim := DFdel_lim.Value;
buf.Pbaldel := DFbaldel.Value;
buf.PMatureLoanHoldDays := DFMatureLoanHoldDays.Value;
buf.PTapeHoldDays := DFTapeHoldDays.Value;
buf.Prunevents := DFrunevents.Value;
buf.Pmethod := DFmethod.Value;
buf.PCommisionEntityMix := DFCommisionEntityMix.Value;
buf.PMasterMix := DFMasterMix.Value;
buf.PBlanketPolicyMix := DFBlanketPolicyMix.Value;
buf.PGracePeriodOption := DFGracePeriodOption.Value;
buf.PNewGraceDays := DFNewGraceDays.Value;
buf.PExpGraceDays := DFExpGraceDays.Value;
buf.PcancellgraceDays := DFcancellgraceDays.Value;
buf.PMaxBackDays := DFMaxBackDays.Value;
buf.PErrorOmissionInceptionDate := DFErrorOmissionInceptionDate.Value;
buf.POverrideEODate := DFOverrideEODate.Value;
buf.Pmanprint := DFmanprint.Value;
buf.Pbook_all := DFbook_all.Value;
buf.PWaverNonPayDays := DFWaverNonPayDays.Value;
buf.Pnewpmt := DFnewpmt.Value;
buf.PStatementContactName := DFStatementContactName.Value;
buf.POfficeContactName := DFOfficeContactName.Value;
buf.PNoticeSignature := DFNoticeSignature.Value;
buf.PNoticeSignature2 := DFNoticeSignature2.Value;
buf.PMasterPolicyNumber := DFMasterPolicyNumber.Value;
buf.PBlanketPolicyNumber := DFBlanketPolicyNumber.Value;
buf.PEarningMethodCode := DFEarningMethodCode.Value;
buf.PCancellationMethocCode := DFCancellationMethocCode.Value;
buf.Ptapeid := DFtapeid.Value;
buf.Pdiskid := DFdiskid.Value;
buf.PInquiryID := DFInquiryID.Value;
buf.PCancellationID := DFCancellationID.Value;
buf.PStatementID := DFStatementID.Value;
buf.PBranchBankingOption := DFBranchBankingOption.Value;
buf.Punwaive := DFunwaive.Value;
buf.PSpecialApprovalCode_opt9x := DFSpecialApprovalCode_opt9x.Value;
buf.Pmon_only := DFmon_only.Value;
buf.PkeepForcedData := DFkeepForcedData.Value;
buf.Pautorenew := DFautorenew.Value;
buf.PInterestOption := DFInterestOption.Value;
buf.PInterestRate := DFInterestRate.Value;
buf.Pt_updins := DFt_updins.Value;
buf.Pt_lndate := DFt_lndate.Value;
buf.Pt_matdate := DFt_matdate.Value;
buf.Pt_branch := DFt_branch.Value;
buf.Pt_off := DFt_off.Value;
buf.Pt_short := DFt_short.Value;
buf.Pt_name := DFt_name.Value;
buf.Pt_addr := DFt_addr.Value;
buf.Pt_coll := DFt_coll.Value;
buf.PnextrunDate := DFnextrunDate.Value;
buf.PrunfreqDays := DFrunfreqDays.Value;
buf.Pforcerun := DFforcerun.Value;
buf.Plast_updDate := DFlast_updDate.Value;
buf.Plast_ihisDate := DFlast_ihisDate.Value;
buf.Plast_thisDate := DFlast_thisDate.Value;
buf.Plast_diskDate := DFlast_diskDate.Value;
buf.Plast_tapeDate := DFlast_tapeDate.Value;
buf.PfirstrunDate := DFfirstrunDate.Value;
buf.Pcancdate := DFcancdate.Value;
buf.PMailCarrier := DFMailCarrier.Value;
buf.PCallforDataDOW := DFCallforDataDOW.Value;
buf.Phold_run := DFhold_run.Value;
buf.Prevlevel := DFrevlevel.Value;
buf.Pnum_mod := DFnum_mod.Value;
buf.Pmod := DFmod.Value;
buf.Plen_def := DFlen_def.Value;
buf.Pdef_text := DFdef_text.Value;
buf.PPrintMissingdataOfficerOrder := DFPrintMissingdataOfficerOrder.Value;
buf.Pmisstitle := DFmisstitle.Value;
buf.Psite_type := DFsite_type.Value;
buf.Pic_input := DFic_input.Value;
buf.Pnoticeid := DFnoticeid.Value;
buf.Pinq_type := DFinq_type.Value;
buf.Pdoc_id := DFdoc_id.Value;
buf.PCollateralValueOption := DFCollateralValueOption.Value;
buf.Pimage_opt := DFimage_opt.Value;
buf.Pprintid := DFprintid.Value;
buf.Pfstrun := DFfstrun.Value;
buf.Pfststmt := DFfststmt.Value;
buf.Pmathold := DFmathold.Value;
buf.PNoticeSortOrder1 := DFNoticeSortOrder1.Value;
buf.PNoticeSortOrder2 := DFNoticeSortOrder2.Value;
buf.PNoticeSortOrder3 := DFNoticeSortOrder3.Value;
buf.PNoticeSortOrder4 := DFNoticeSortOrder4.Value;
buf.PNoticeSortOrder5 := DFNoticeSortOrder5.Value;
buf.PFiller2 := DFFiller2.Value;
buf.Pspec_tab := DFspec_tab.Value;
buf.PPremiumChartCopies := DFPremiumChartCopies.Value;
buf.PMailingLabeltype := DFMailingLabeltype.Value;
buf.Pfnotdate := DFfnotdate.Value;
buf.Psnotdate := DFsnotdate.Value;
buf.PcollateralUse := DFcollateralUse.Value;
buf.Preflag := DFreflag.Value;
buf.Pfnottype := DFfnottype.Value;
buf.Ppcprint := DFpcprint.Value;
buf.PBalanceReportSortRequest := DFBalanceReportSortRequest.Value;
buf.Ppoldate := DFpoldate.Value;
buf.Phistptr := DFhistptr.Value;
buf.PNoteNumber := DFNoteNumber.Value;
buf.POptions := DFOptions.Value;
buf.PclContact := DFclContact.Value;
buf.PclAddress := DFclAddress.Value;
buf.PclCityStZip := DFclCityStZip.Value;
buf.PclPhone := DFclPhone.Value;
buf.PclFax := DFclFax.Value;
buf.PplContact := DFplContact.Value;
buf.PplAddress := DFplAddress.Value;
buf.PplCityStZip := DFplCityStZip.Value;
buf.PplPhone := DFplPhone.Value;
buf.PplFax := DFplFax.Value;
buf.PLastRunDate := DFLastRunDate.Value;
buf.PRunControl := DFRunControl.Value;
buf.PTranControl := DFTranControl.Value;
buf.PLast4RunNum := DFLast4RunNum.Value;
buf.PAccountId := DFAccountId.Value;
buf.PRefundOpt := DFRefundOpt.Value;
buf.PInterim := DFInterim.Value;
result := buf;
end;
procedure TInfoLENDERTable.StoreDataBuffer(ABuffer:TInfoLENDERRecord);
begin
DFLenderID.Value := ABuffer.PLenderID;
DFModCount.Value := ABuffer.PModCount;
DFclient.Value := ABuffer.Pclient;
DFSystemType.Value := ABuffer.PSystemType;
DFstatus.Value := ABuffer.Pstatus;
DFNetStatement.Value := ABuffer.PNetStatement;
DFname.Value := ABuffer.Pname;
DFAddress.Value := ABuffer.PAddress;
DFAddress2.Value := ABuffer.PAddress2;
DFCityState.Value := ABuffer.PCityState;
DFZipCode.Value := ABuffer.PZipCode;
DFStreetName.Value := ABuffer.PStreetName;
DFStreetAddress.Value := ABuffer.PStreetAddress;
DFStreetCSZ.Value := ABuffer.PStreetCSZ;
DFstate.Value := ABuffer.Pstate;
DFPhoneNumber.Value := ABuffer.PPhoneNumber;
DFPhoneExtension.Value := ABuffer.PPhoneExtension;
DFResidentAdminName.Value := ABuffer.PResidentAdminName;
DFResidentAdminPhone.Value := ABuffer.PResidentAdminPhone;
DFResidentAdminPhoneExtension.Value := ABuffer.PResidentAdminPhoneExtension;
DFFaxNumber.Value := ABuffer.PFaxNumber;
DFgroup.Value := ABuffer.Pgroup;
DFStatementGroup.Value := ABuffer.PStatementGroup;
DFClientID.Value := ABuffer.PClientID;
DFpcgroup.Value := ABuffer.Ppcgroup;
DFBalanceLimit.Value := ABuffer.PBalanceLimit;
DFdel_lim.Value := ABuffer.Pdel_lim;
DFbaldel.Value := ABuffer.Pbaldel;
DFMatureLoanHoldDays.Value := ABuffer.PMatureLoanHoldDays;
DFTapeHoldDays.Value := ABuffer.PTapeHoldDays;
DFrunevents.Value := ABuffer.Prunevents;
DFmethod.Value := ABuffer.Pmethod;
DFCommisionEntityMix.Value := ABuffer.PCommisionEntityMix;
DFMasterMix.Value := ABuffer.PMasterMix;
DFBlanketPolicyMix.Value := ABuffer.PBlanketPolicyMix;
DFGracePeriodOption.Value := ABuffer.PGracePeriodOption;
DFNewGraceDays.Value := ABuffer.PNewGraceDays;
DFExpGraceDays.Value := ABuffer.PExpGraceDays;
DFcancellgraceDays.Value := ABuffer.PcancellgraceDays;
DFMaxBackDays.Value := ABuffer.PMaxBackDays;
DFErrorOmissionInceptionDate.Value := ABuffer.PErrorOmissionInceptionDate;
DFOverrideEODate.Value := ABuffer.POverrideEODate;
DFmanprint.Value := ABuffer.Pmanprint;
DFbook_all.Value := ABuffer.Pbook_all;
DFWaverNonPayDays.Value := ABuffer.PWaverNonPayDays;
DFnewpmt.Value := ABuffer.Pnewpmt;
DFStatementContactName.Value := ABuffer.PStatementContactName;
DFOfficeContactName.Value := ABuffer.POfficeContactName;
DFNoticeSignature.Value := ABuffer.PNoticeSignature;
DFNoticeSignature2.Value := ABuffer.PNoticeSignature2;
DFMasterPolicyNumber.Value := ABuffer.PMasterPolicyNumber;
DFBlanketPolicyNumber.Value := ABuffer.PBlanketPolicyNumber;
DFEarningMethodCode.Value := ABuffer.PEarningMethodCode;
DFCancellationMethocCode.Value := ABuffer.PCancellationMethocCode;
DFtapeid.Value := ABuffer.Ptapeid;
DFdiskid.Value := ABuffer.Pdiskid;
DFInquiryID.Value := ABuffer.PInquiryID;
DFCancellationID.Value := ABuffer.PCancellationID;
DFStatementID.Value := ABuffer.PStatementID;
DFBranchBankingOption.Value := ABuffer.PBranchBankingOption;
DFunwaive.Value := ABuffer.Punwaive;
DFSpecialApprovalCode_opt9x.Value := ABuffer.PSpecialApprovalCode_opt9x;
DFmon_only.Value := ABuffer.Pmon_only;
DFkeepForcedData.Value := ABuffer.PkeepForcedData;
DFautorenew.Value := ABuffer.Pautorenew;
DFInterestOption.Value := ABuffer.PInterestOption;
DFInterestRate.Value := ABuffer.PInterestRate;
DFt_updins.Value := ABuffer.Pt_updins;
DFt_lndate.Value := ABuffer.Pt_lndate;
DFt_matdate.Value := ABuffer.Pt_matdate;
DFt_branch.Value := ABuffer.Pt_branch;
DFt_off.Value := ABuffer.Pt_off;
DFt_short.Value := ABuffer.Pt_short;
DFt_name.Value := ABuffer.Pt_name;
DFt_addr.Value := ABuffer.Pt_addr;
DFt_coll.Value := ABuffer.Pt_coll;
DFnextrunDate.Value := ABuffer.PnextrunDate;
DFrunfreqDays.Value := ABuffer.PrunfreqDays;
DFforcerun.Value := ABuffer.Pforcerun;
DFlast_updDate.Value := ABuffer.Plast_updDate;
DFlast_ihisDate.Value := ABuffer.Plast_ihisDate;
DFlast_thisDate.Value := ABuffer.Plast_thisDate;
DFlast_diskDate.Value := ABuffer.Plast_diskDate;
DFlast_tapeDate.Value := ABuffer.Plast_tapeDate;
DFfirstrunDate.Value := ABuffer.PfirstrunDate;
DFcancdate.Value := ABuffer.Pcancdate;
DFMailCarrier.Value := ABuffer.PMailCarrier;
DFCallforDataDOW.Value := ABuffer.PCallforDataDOW;
DFhold_run.Value := ABuffer.Phold_run;
DFrevlevel.Value := ABuffer.Prevlevel;
DFnum_mod.Value := ABuffer.Pnum_mod;
DFmod.Value := ABuffer.Pmod;
DFlen_def.Value := ABuffer.Plen_def;
DFdef_text.Value := ABuffer.Pdef_text;
DFPrintMissingdataOfficerOrder.Value := ABuffer.PPrintMissingdataOfficerOrder;
DFmisstitle.Value := ABuffer.Pmisstitle;
DFsite_type.Value := ABuffer.Psite_type;
DFic_input.Value := ABuffer.Pic_input;
DFnoticeid.Value := ABuffer.Pnoticeid;
DFinq_type.Value := ABuffer.Pinq_type;
DFdoc_id.Value := ABuffer.Pdoc_id;
DFCollateralValueOption.Value := ABuffer.PCollateralValueOption;
DFimage_opt.Value := ABuffer.Pimage_opt;
DFprintid.Value := ABuffer.Pprintid;
DFfstrun.Value := ABuffer.Pfstrun;
DFfststmt.Value := ABuffer.Pfststmt;
DFmathold.Value := ABuffer.Pmathold;
DFNoticeSortOrder1.Value := ABuffer.PNoticeSortOrder1;
DFNoticeSortOrder2.Value := ABuffer.PNoticeSortOrder2;
DFNoticeSortOrder3.Value := ABuffer.PNoticeSortOrder3;
DFNoticeSortOrder4.Value := ABuffer.PNoticeSortOrder4;
DFNoticeSortOrder5.Value := ABuffer.PNoticeSortOrder5;
DFFiller2.Value := ABuffer.PFiller2;
DFspec_tab.Value := ABuffer.Pspec_tab;
DFPremiumChartCopies.Value := ABuffer.PPremiumChartCopies;
DFMailingLabeltype.Value := ABuffer.PMailingLabeltype;
DFfnotdate.Value := ABuffer.Pfnotdate;
DFsnotdate.Value := ABuffer.Psnotdate;
DFcollateralUse.Value := ABuffer.PcollateralUse;
DFreflag.Value := ABuffer.Preflag;
DFfnottype.Value := ABuffer.Pfnottype;
DFpcprint.Value := ABuffer.Ppcprint;
DFBalanceReportSortRequest.Value := ABuffer.PBalanceReportSortRequest;
DFpoldate.Value := ABuffer.Ppoldate;
DFhistptr.Value := ABuffer.Phistptr;
DFNoteNumber.Value := ABuffer.PNoteNumber;
DFOptions.Value := ABuffer.POptions;
DFclContact.Value := ABuffer.PclContact;
DFclAddress.Value := ABuffer.PclAddress;
DFclCityStZip.Value := ABuffer.PclCityStZip;
DFclPhone.Value := ABuffer.PclPhone;
DFclFax.Value := ABuffer.PclFax;
DFplContact.Value := ABuffer.PplContact;
DFplAddress.Value := ABuffer.PplAddress;
DFplCityStZip.Value := ABuffer.PplCityStZip;
DFplPhone.Value := ABuffer.PplPhone;
DFplFax.Value := ABuffer.PplFax;
DFLastRunDate.Value := ABuffer.PLastRunDate;
DFRunControl.Value := ABuffer.PRunControl;
DFTranControl.Value := ABuffer.PTranControl;
DFLast4RunNum.Value := ABuffer.PLast4RunNum;
DFAccountId.Value := ABuffer.PAccountId;
DFRefundOpt.Value := ABuffer.PRefundOpt;
DFInterim.Value := ABuffer.PInterim;
end;
function TInfoLENDERTable.GetEnumIndex: TEIInfoLENDER;
var iname : string;
begin
result := InfoLENDERPrimaryKey;
iname := uppercase(indexname);
if iname = '' then result := InfoLENDERPrimaryKey;
if iname = 'LENDER' then result := InfoLENDERLender;
if iname = 'LENDERNAME' then result := InfoLENDERLenderName;
end;
procedure TInfoLENDERQuery.CreateFields;
begin
FDFLenderID := CreateField( 'LenderID' ) as TStringField;
FDFModCount := CreateField( 'ModCount' ) as TSmallIntField;
FDFclient := CreateField( 'client' ) as TStringField;
FDFSystemType := CreateField( 'SystemType' ) as TStringField;
FDFstatus := CreateField( 'status' ) as TStringField;
FDFNetStatement := CreateField( 'NetStatement' ) as TStringField;
FDFname := CreateField( 'name' ) as TStringField;
FDFAddress := CreateField( 'Address' ) as TStringField;
FDFAddress2 := CreateField( 'Address2' ) as TStringField;
FDFCityState := CreateField( 'CityState' ) as TStringField;
FDFZipCode := CreateField( 'ZipCode' ) as TStringField;
FDFStreetName := CreateField( 'StreetName' ) as TStringField;
FDFStreetAddress := CreateField( 'StreetAddress' ) as TStringField;
FDFStreetCSZ := CreateField( 'StreetCSZ' ) as TStringField;
FDFstate := CreateField( 'state' ) as TStringField;
FDFPhoneNumber := CreateField( 'PhoneNumber' ) as TStringField;
FDFPhoneExtension := CreateField( 'PhoneExtension' ) as TStringField;
FDFResidentAdminName := CreateField( 'ResidentAdminName' ) as TStringField;
FDFResidentAdminPhone := CreateField( 'ResidentAdminPhone' ) as TStringField;
FDFResidentAdminPhoneExtension := CreateField( 'ResidentAdminPhoneExtension' ) as TStringField;
FDFFaxNumber := CreateField( 'FaxNumber' ) as TStringField;
FDFgroup := CreateField( 'group' ) as TStringField;
FDFStatementGroup := CreateField( 'StatementGroup' ) as TStringField;
FDFClientID := CreateField( 'ClientID' ) as TStringField;
FDFpcgroup := CreateField( 'pcgroup' ) as TStringField;
FDFBalanceLimit := CreateField( 'BalanceLimit' ) as TIntegerField;
FDFdel_lim := CreateField( 'del_lim' ) as TIntegerField;
FDFbaldel := CreateField( 'baldel' ) as TStringField;
FDFMatureLoanHoldDays := CreateField( 'MatureLoanHoldDays' ) as TSmallIntField;
FDFTapeHoldDays := CreateField( 'TapeHoldDays' ) as TSmallIntField;
FDFrunevents := CreateField( 'runevents' ) as TStringField;
FDFmethod := CreateField( 'method' ) as TStringField;
FDFCommisionEntityMix := CreateField( 'CommisionEntityMix' ) as TStringField;
FDFMasterMix := CreateField( 'MasterMix' ) as TStringField;
FDFBlanketPolicyMix := CreateField( 'BlanketPolicyMix' ) as TStringField;
FDFGracePeriodOption := CreateField( 'GracePeriodOption' ) as TStringField;
FDFNewGraceDays := CreateField( 'NewGraceDays' ) as TSmallIntField;
FDFExpGraceDays := CreateField( 'ExpGraceDays' ) as TSmallIntField;
FDFcancellgraceDays := CreateField( 'cancellgraceDays' ) as TSmallIntField;
FDFMaxBackDays := CreateField( 'MaxBackDays' ) as TSmallIntField;
FDFErrorOmissionInceptionDate := CreateField( 'ErrorOmissionInceptionDate' ) as TStringField;
FDFOverrideEODate := CreateField( 'OverrideEODate' ) as TStringField;
FDFmanprint := CreateField( 'manprint' ) as TStringField;
FDFbook_all := CreateField( 'book_all' ) as TStringField;
FDFWaverNonPayDays := CreateField( 'WaverNonPayDays' ) as TSmallIntField;
FDFnewpmt := CreateField( 'newpmt' ) as TStringField;
FDFStatementContactName := CreateField( 'StatementContactName' ) as TStringField;
FDFOfficeContactName := CreateField( 'OfficeContactName' ) as TStringField;
FDFNoticeSignature := CreateField( 'NoticeSignature' ) as TStringField;
FDFNoticeSignature2 := CreateField( 'NoticeSignature2' ) as TStringField;
FDFMasterPolicyNumber := CreateField( 'MasterPolicyNumber' ) as TStringField;
FDFBlanketPolicyNumber := CreateField( 'BlanketPolicyNumber' ) as TStringField;
FDFEarningMethodCode := CreateField( 'EarningMethodCode' ) as TStringField;
FDFCancellationMethocCode := CreateField( 'CancellationMethocCode' ) as TStringField;
FDFtapeid := CreateField( 'tapeid' ) as TStringField;
FDFdiskid := CreateField( 'diskid' ) as TStringField;
FDFInquiryID := CreateField( 'InquiryID' ) as TStringField;
FDFCancellationID := CreateField( 'CancellationID' ) as TStringField;
FDFStatementID := CreateField( 'StatementID' ) as TStringField;
FDFBranchBankingOption := CreateField( 'BranchBankingOption' ) as TStringField;
FDFunwaive := CreateField( 'unwaive' ) as TStringField;
FDFSpecialApprovalCode_opt9x := CreateField( 'SpecialApprovalCode_opt9x' ) as TStringField;
FDFmon_only := CreateField( 'mon_only' ) as TStringField;
FDFkeepForcedData := CreateField( 'keepForcedData' ) as TStringField;
FDFautorenew := CreateField( 'autorenew' ) as TStringField;
FDFInterestOption := CreateField( 'InterestOption' ) as TStringField;
FDFInterestRate := CreateField( 'InterestRate' ) as TCurrencyField;
FDFt_updins := CreateField( 't_updins' ) as TStringField;
FDFt_lndate := CreateField( 't_lndate' ) as TStringField;
FDFt_matdate := CreateField( 't_matdate' ) as TStringField;
FDFt_branch := CreateField( 't_branch' ) as TStringField;
FDFt_off := CreateField( 't_off' ) as TStringField;
FDFt_short := CreateField( 't_short' ) as TStringField;
FDFt_name := CreateField( 't_name' ) as TStringField;
FDFt_addr := CreateField( 't_addr' ) as TStringField;
FDFt_coll := CreateField( 't_coll' ) as TStringField;
FDFnextrunDate := CreateField( 'nextrunDate' ) as TStringField;
FDFrunfreqDays := CreateField( 'runfreqDays' ) as TSmallIntField;
FDFforcerun := CreateField( 'forcerun' ) as TStringField;
FDFlast_updDate := CreateField( 'last_updDate' ) as TStringField;
FDFlast_ihisDate := CreateField( 'last_ihisDate' ) as TStringField;
FDFlast_thisDate := CreateField( 'last_thisDate' ) as TStringField;
FDFlast_diskDate := CreateField( 'last_diskDate' ) as TStringField;
FDFlast_tapeDate := CreateField( 'last_tapeDate' ) as TStringField;
FDFfirstrunDate := CreateField( 'firstrunDate' ) as TStringField;
FDFcancdate := CreateField( 'cancdate' ) as TStringField;
FDFMailCarrier := CreateField( 'MailCarrier' ) as TStringField;
FDFCallforDataDOW := CreateField( 'CallforDataDOW' ) as TStringField;
FDFhold_run := CreateField( 'hold_run' ) as TStringField;
FDFrevlevel := CreateField( 'revlevel' ) as TStringField;
FDFnum_mod := CreateField( 'num_mod' ) as TSmallIntField;
FDFmod := CreateField( 'mod' ) as TStringField;
FDFlen_def := CreateField( 'len_def' ) as TStringField;
FDFdef_text := CreateField( 'def_text' ) as TStringField;
FDFPrintMissingdataOfficerOrder := CreateField( 'PrintMissingdataOfficerOrder' ) as TStringField;
FDFmisstitle := CreateField( 'misstitle' ) as TStringField;
FDFsite_type := CreateField( 'site_type' ) as TStringField;
FDFic_input := CreateField( 'ic_input' ) as TStringField;
FDFnoticeid := CreateField( 'noticeid' ) as TStringField;
FDFinq_type := CreateField( 'inq_type' ) as TStringField;
FDFdoc_id := CreateField( 'doc_id' ) as TStringField;
FDFCollateralValueOption := CreateField( 'CollateralValueOption' ) as TStringField;
FDFimage_opt := CreateField( 'image_opt' ) as TStringField;
FDFprintid := CreateField( 'printid' ) as TStringField;
FDFfstrun := CreateField( 'fstrun' ) as TStringField;
FDFfststmt := CreateField( 'fststmt' ) as TStringField;
FDFmathold := CreateField( 'mathold' ) as TSmallIntField;
FDFNoticeSortOrder1 := CreateField( 'NoticeSortOrder1' ) as TStringField;
FDFNoticeSortOrder2 := CreateField( 'NoticeSortOrder2' ) as TStringField;
FDFNoticeSortOrder3 := CreateField( 'NoticeSortOrder3' ) as TStringField;
FDFNoticeSortOrder4 := CreateField( 'NoticeSortOrder4' ) as TStringField;
FDFNoticeSortOrder5 := CreateField( 'NoticeSortOrder5' ) as TStringField;
FDFFiller2 := CreateField( 'Filler2' ) as TStringField;
FDFspec_tab := CreateField( 'spec_tab' ) as TStringField;
FDFPremiumChartCopies := CreateField( 'PremiumChartCopies' ) as TIntegerField;
FDFMailingLabeltype := CreateField( 'MailingLabeltype' ) as TStringField;
FDFfnotdate := CreateField( 'fnotdate' ) as TIntegerField;
FDFsnotdate := CreateField( 'snotdate' ) as TIntegerField;
FDFcollateralUse := CreateField( 'collateralUse' ) as TStringField;
FDFreflag := CreateField( 'reflag' ) as TStringField;
FDFfnottype := CreateField( 'fnottype' ) as TStringField;
FDFpcprint := CreateField( 'pcprint' ) as TStringField;
FDFBalanceReportSortRequest := CreateField( 'BalanceReportSortRequest' ) as TStringField;
FDFpoldate := CreateField( 'poldate' ) as TIntegerField;
FDFhistptr := CreateField( 'histptr' ) as TStringField;
FDFNoteNumber := CreateField( 'NoteNumber' ) as TSmallIntField;
FDFOptions := CreateField( 'Options' ) as TStringField;
FDFclContact := CreateField( 'clContact' ) as TStringField;
FDFclAddress := CreateField( 'clAddress' ) as TStringField;
FDFclCityStZip := CreateField( 'clCityStZip' ) as TStringField;
FDFclPhone := CreateField( 'clPhone' ) as TStringField;
FDFclFax := CreateField( 'clFax' ) as TStringField;
FDFplContact := CreateField( 'plContact' ) as TStringField;
FDFplAddress := CreateField( 'plAddress' ) as TStringField;
FDFplCityStZip := CreateField( 'plCityStZip' ) as TStringField;
FDFplPhone := CreateField( 'plPhone' ) as TStringField;
FDFplFax := CreateField( 'plFax' ) as TStringField;
FDFLastRunDate := CreateField( 'LastRunDate' ) as TStringField;
FDFRunControl := CreateField( 'RunControl' ) as TStringField;
FDFTranControl := CreateField( 'TranControl' ) as TStringField;
FDFLast4RunNum := CreateField( 'Last4RunNum' ) as TStringField;
FDFAccountId := CreateField( 'AccountId' ) as TStringField;
FDFRefundOpt := CreateField( 'RefundOpt' ) as TStringField;
FDFInterim := CreateField( 'Interim' ) as TStringField;
end; { TInfoLENDERQuery.CreateFields }
procedure TInfoLENDERQuery.SetActive(Value: Boolean);
begin
inherited SetActive(Value);
if Active then
CreateFields;
end; { TInfoLENDERQuery.SetActive }
procedure TInfoLENDERQuery.SetPLenderID(const Value: String);
begin
DFLenderID.Value := Value;
end;
function TInfoLENDERQuery.GetPLenderID:String;
begin
result := DFLenderID.Value;
end;
procedure TInfoLENDERQuery.SetPModCount(const Value: SmallInt);
begin
DFModCount.Value := Value;
end;
function TInfoLENDERQuery.GetPModCount:SmallInt;
begin
result := DFModCount.Value;
end;
procedure TInfoLENDERQuery.SetPclient(const Value: String);
begin
DFclient.Value := Value;
end;
function TInfoLENDERQuery.GetPclient:String;
begin
result := DFclient.Value;
end;
procedure TInfoLENDERQuery.SetPSystemType(const Value: String);
begin
DFSystemType.Value := Value;
end;
function TInfoLENDERQuery.GetPSystemType:String;
begin
result := DFSystemType.Value;
end;
procedure TInfoLENDERQuery.SetPstatus(const Value: String);
begin
DFstatus.Value := Value;
end;
function TInfoLENDERQuery.GetPstatus:String;
begin
result := DFstatus.Value;
end;
procedure TInfoLENDERQuery.SetPNetStatement(const Value: String);
begin
DFNetStatement.Value := Value;
end;
function TInfoLENDERQuery.GetPNetStatement:String;
begin
result := DFNetStatement.Value;
end;
procedure TInfoLENDERQuery.SetPname(const Value: String);
begin
DFname.Value := Value;
end;
function TInfoLENDERQuery.GetPname:String;
begin
result := DFname.Value;
end;
procedure TInfoLENDERQuery.SetPAddress(const Value: String);
begin
DFAddress.Value := Value;
end;
function TInfoLENDERQuery.GetPAddress:String;
begin
result := DFAddress.Value;
end;
procedure TInfoLENDERQuery.SetPAddress2(const Value: String);
begin
DFAddress2.Value := Value;
end;
function TInfoLENDERQuery.GetPAddress2:String;
begin
result := DFAddress2.Value;
end;
procedure TInfoLENDERQuery.SetPCityState(const Value: String);
begin
DFCityState.Value := Value;
end;
function TInfoLENDERQuery.GetPCityState:String;
begin
result := DFCityState.Value;
end;
procedure TInfoLENDERQuery.SetPZipCode(const Value: String);
begin
DFZipCode.Value := Value;
end;
function TInfoLENDERQuery.GetPZipCode:String;
begin
result := DFZipCode.Value;
end;
procedure TInfoLENDERQuery.SetPStreetName(const Value: String);
begin
DFStreetName.Value := Value;
end;
function TInfoLENDERQuery.GetPStreetName:String;
begin
result := DFStreetName.Value;
end;
procedure TInfoLENDERQuery.SetPStreetAddress(const Value: String);
begin
DFStreetAddress.Value := Value;
end;
function TInfoLENDERQuery.GetPStreetAddress:String;
begin
result := DFStreetAddress.Value;
end;
procedure TInfoLENDERQuery.SetPStreetCSZ(const Value: String);
begin
DFStreetCSZ.Value := Value;
end;
function TInfoLENDERQuery.GetPStreetCSZ:String;
begin
result := DFStreetCSZ.Value;
end;
procedure TInfoLENDERQuery.SetPstate(const Value: String);
begin
DFstate.Value := Value;
end;
function TInfoLENDERQuery.GetPstate:String;
begin
result := DFstate.Value;
end;
procedure TInfoLENDERQuery.SetPPhoneNumber(const Value: String);
begin
DFPhoneNumber.Value := Value;
end;
function TInfoLENDERQuery.GetPPhoneNumber:String;
begin
result := DFPhoneNumber.Value;
end;
procedure TInfoLENDERQuery.SetPPhoneExtension(const Value: String);
begin
DFPhoneExtension.Value := Value;
end;
function TInfoLENDERQuery.GetPPhoneExtension:String;
begin
result := DFPhoneExtension.Value;
end;
procedure TInfoLENDERQuery.SetPResidentAdminName(const Value: String);
begin
DFResidentAdminName.Value := Value;
end;
function TInfoLENDERQuery.GetPResidentAdminName:String;
begin
result := DFResidentAdminName.Value;
end;
procedure TInfoLENDERQuery.SetPResidentAdminPhone(const Value: String);
begin
DFResidentAdminPhone.Value := Value;
end;
function TInfoLENDERQuery.GetPResidentAdminPhone:String;
begin
result := DFResidentAdminPhone.Value;
end;
procedure TInfoLENDERQuery.SetPResidentAdminPhoneExtension(const Value: String);
begin
DFResidentAdminPhoneExtension.Value := Value;
end;
function TInfoLENDERQuery.GetPResidentAdminPhoneExtension:String;
begin
result := DFResidentAdminPhoneExtension.Value;
end;
procedure TInfoLENDERQuery.SetPFaxNumber(const Value: String);
begin
DFFaxNumber.Value := Value;
end;
function TInfoLENDERQuery.GetPFaxNumber:String;
begin
result := DFFaxNumber.Value;
end;
procedure TInfoLENDERQuery.SetPgroup(const Value: String);
begin
DFgroup.Value := Value;
end;
function TInfoLENDERQuery.GetPgroup:String;
begin
result := DFgroup.Value;
end;
procedure TInfoLENDERQuery.SetPStatementGroup(const Value: String);
begin
DFStatementGroup.Value := Value;
end;
function TInfoLENDERQuery.GetPStatementGroup:String;
begin
result := DFStatementGroup.Value;
end;
procedure TInfoLENDERQuery.SetPClientID(const Value: String);
begin
DFClientID.Value := Value;
end;
function TInfoLENDERQuery.GetPClientID:String;
begin
result := DFClientID.Value;
end;
procedure TInfoLENDERQuery.SetPpcgroup(const Value: String);
begin
DFpcgroup.Value := Value;
end;
function TInfoLENDERQuery.GetPpcgroup:String;
begin
result := DFpcgroup.Value;
end;
procedure TInfoLENDERQuery.SetPBalanceLimit(const Value: Integer);
begin
DFBalanceLimit.Value := Value;
end;
function TInfoLENDERQuery.GetPBalanceLimit:Integer;
begin
result := DFBalanceLimit.Value;
end;
procedure TInfoLENDERQuery.SetPdel_lim(const Value: Integer);
begin
DFdel_lim.Value := Value;
end;
function TInfoLENDERQuery.GetPdel_lim:Integer;
begin
result := DFdel_lim.Value;
end;
procedure TInfoLENDERQuery.SetPbaldel(const Value: String);
begin
DFbaldel.Value := Value;
end;
function TInfoLENDERQuery.GetPbaldel:String;
begin
result := DFbaldel.Value;
end;
procedure TInfoLENDERQuery.SetPMatureLoanHoldDays(const Value: SmallInt);
begin
DFMatureLoanHoldDays.Value := Value;
end;
function TInfoLENDERQuery.GetPMatureLoanHoldDays:SmallInt;
begin
result := DFMatureLoanHoldDays.Value;
end;
procedure TInfoLENDERQuery.SetPTapeHoldDays(const Value: SmallInt);
begin
DFTapeHoldDays.Value := Value;
end;
function TInfoLENDERQuery.GetPTapeHoldDays:SmallInt;
begin
result := DFTapeHoldDays.Value;
end;
procedure TInfoLENDERQuery.SetPrunevents(const Value: String);
begin
DFrunevents.Value := Value;
end;
function TInfoLENDERQuery.GetPrunevents:String;
begin
result := DFrunevents.Value;
end;
procedure TInfoLENDERQuery.SetPmethod(const Value: String);
begin
DFmethod.Value := Value;
end;
function TInfoLENDERQuery.GetPmethod:String;
begin
result := DFmethod.Value;
end;
procedure TInfoLENDERQuery.SetPCommisionEntityMix(const Value: String);
begin
DFCommisionEntityMix.Value := Value;
end;
function TInfoLENDERQuery.GetPCommisionEntityMix:String;
begin
result := DFCommisionEntityMix.Value;
end;
procedure TInfoLENDERQuery.SetPMasterMix(const Value: String);
begin
DFMasterMix.Value := Value;
end;
function TInfoLENDERQuery.GetPMasterMix:String;
begin
result := DFMasterMix.Value;
end;
procedure TInfoLENDERQuery.SetPBlanketPolicyMix(const Value: String);
begin
DFBlanketPolicyMix.Value := Value;
end;
function TInfoLENDERQuery.GetPBlanketPolicyMix:String;
begin
result := DFBlanketPolicyMix.Value;
end;
procedure TInfoLENDERQuery.SetPGracePeriodOption(const Value: String);
begin
DFGracePeriodOption.Value := Value;
end;
function TInfoLENDERQuery.GetPGracePeriodOption:String;
begin
result := DFGracePeriodOption.Value;
end;
procedure TInfoLENDERQuery.SetPNewGraceDays(const Value: SmallInt);
begin
DFNewGraceDays.Value := Value;
end;
function TInfoLENDERQuery.GetPNewGraceDays:SmallInt;
begin
result := DFNewGraceDays.Value;
end;
procedure TInfoLENDERQuery.SetPExpGraceDays(const Value: SmallInt);
begin
DFExpGraceDays.Value := Value;
end;
function TInfoLENDERQuery.GetPExpGraceDays:SmallInt;
begin
result := DFExpGraceDays.Value;
end;
procedure TInfoLENDERQuery.SetPcancellgraceDays(const Value: SmallInt);
begin
DFcancellgraceDays.Value := Value;
end;
function TInfoLENDERQuery.GetPcancellgraceDays:SmallInt;
begin
result := DFcancellgraceDays.Value;
end;
procedure TInfoLENDERQuery.SetPMaxBackDays(const Value: SmallInt);
begin
DFMaxBackDays.Value := Value;
end;
function TInfoLENDERQuery.GetPMaxBackDays:SmallInt;
begin
result := DFMaxBackDays.Value;
end;
procedure TInfoLENDERQuery.SetPErrorOmissionInceptionDate(const Value: String);
begin
DFErrorOmissionInceptionDate.Value := Value;
end;
function TInfoLENDERQuery.GetPErrorOmissionInceptionDate:String;
begin
result := DFErrorOmissionInceptionDate.Value;
end;
procedure TInfoLENDERQuery.SetPOverrideEODate(const Value: String);
begin
DFOverrideEODate.Value := Value;
end;
function TInfoLENDERQuery.GetPOverrideEODate:String;
begin
result := DFOverrideEODate.Value;
end;
procedure TInfoLENDERQuery.SetPmanprint(const Value: String);
begin
DFmanprint.Value := Value;
end;
function TInfoLENDERQuery.GetPmanprint:String;
begin
result := DFmanprint.Value;
end;
procedure TInfoLENDERQuery.SetPbook_all(const Value: String);
begin
DFbook_all.Value := Value;
end;
function TInfoLENDERQuery.GetPbook_all:String;
begin
result := DFbook_all.Value;
end;
procedure TInfoLENDERQuery.SetPWaverNonPayDays(const Value: SmallInt);
begin
DFWaverNonPayDays.Value := Value;
end;
function TInfoLENDERQuery.GetPWaverNonPayDays:SmallInt;
begin
result := DFWaverNonPayDays.Value;
end;
procedure TInfoLENDERQuery.SetPnewpmt(const Value: String);
begin
DFnewpmt.Value := Value;
end;
function TInfoLENDERQuery.GetPnewpmt:String;
begin
result := DFnewpmt.Value;
end;
procedure TInfoLENDERQuery.SetPStatementContactName(const Value: String);
begin
DFStatementContactName.Value := Value;
end;
function TInfoLENDERQuery.GetPStatementContactName:String;
begin
result := DFStatementContactName.Value;
end;
procedure TInfoLENDERQuery.SetPOfficeContactName(const Value: String);
begin
DFOfficeContactName.Value := Value;
end;
function TInfoLENDERQuery.GetPOfficeContactName:String;
begin
result := DFOfficeContactName.Value;
end;
procedure TInfoLENDERQuery.SetPNoticeSignature(const Value: String);
begin
DFNoticeSignature.Value := Value;
end;
function TInfoLENDERQuery.GetPNoticeSignature:String;
begin
result := DFNoticeSignature.Value;
end;
procedure TInfoLENDERQuery.SetPNoticeSignature2(const Value: String);
begin
DFNoticeSignature2.Value := Value;
end;
function TInfoLENDERQuery.GetPNoticeSignature2:String;
begin
result := DFNoticeSignature2.Value;
end;
procedure TInfoLENDERQuery.SetPMasterPolicyNumber(const Value: String);
begin
DFMasterPolicyNumber.Value := Value;
end;
function TInfoLENDERQuery.GetPMasterPolicyNumber:String;
begin
result := DFMasterPolicyNumber.Value;
end;
procedure TInfoLENDERQuery.SetPBlanketPolicyNumber(const Value: String);
begin
DFBlanketPolicyNumber.Value := Value;
end;
function TInfoLENDERQuery.GetPBlanketPolicyNumber:String;
begin
result := DFBlanketPolicyNumber.Value;
end;
procedure TInfoLENDERQuery.SetPEarningMethodCode(const Value: String);
begin
DFEarningMethodCode.Value := Value;
end;
function TInfoLENDERQuery.GetPEarningMethodCode:String;
begin
result := DFEarningMethodCode.Value;
end;
procedure TInfoLENDERQuery.SetPCancellationMethocCode(const Value: String);
begin
DFCancellationMethocCode.Value := Value;
end;
function TInfoLENDERQuery.GetPCancellationMethocCode:String;
begin
result := DFCancellationMethocCode.Value;
end;
procedure TInfoLENDERQuery.SetPtapeid(const Value: String);
begin
DFtapeid.Value := Value;
end;
function TInfoLENDERQuery.GetPtapeid:String;
begin
result := DFtapeid.Value;
end;
procedure TInfoLENDERQuery.SetPdiskid(const Value: String);
begin
DFdiskid.Value := Value;
end;
function TInfoLENDERQuery.GetPdiskid:String;
begin
result := DFdiskid.Value;
end;
procedure TInfoLENDERQuery.SetPInquiryID(const Value: String);
begin
DFInquiryID.Value := Value;
end;
function TInfoLENDERQuery.GetPInquiryID:String;
begin
result := DFInquiryID.Value;
end;
procedure TInfoLENDERQuery.SetPCancellationID(const Value: String);
begin
DFCancellationID.Value := Value;
end;
function TInfoLENDERQuery.GetPCancellationID:String;
begin
result := DFCancellationID.Value;
end;
procedure TInfoLENDERQuery.SetPStatementID(const Value: String);
begin
DFStatementID.Value := Value;
end;
function TInfoLENDERQuery.GetPStatementID:String;
begin
result := DFStatementID.Value;
end;
procedure TInfoLENDERQuery.SetPBranchBankingOption(const Value: String);
begin
DFBranchBankingOption.Value := Value;
end;
function TInfoLENDERQuery.GetPBranchBankingOption:String;
begin
result := DFBranchBankingOption.Value;
end;
procedure TInfoLENDERQuery.SetPunwaive(const Value: String);
begin
DFunwaive.Value := Value;
end;
function TInfoLENDERQuery.GetPunwaive:String;
begin
result := DFunwaive.Value;
end;
procedure TInfoLENDERQuery.SetPSpecialApprovalCode_opt9x(const Value: String);
begin
DFSpecialApprovalCode_opt9x.Value := Value;
end;
function TInfoLENDERQuery.GetPSpecialApprovalCode_opt9x:String;
begin
result := DFSpecialApprovalCode_opt9x.Value;
end;
procedure TInfoLENDERQuery.SetPmon_only(const Value: String);
begin
DFmon_only.Value := Value;
end;
function TInfoLENDERQuery.GetPmon_only:String;
begin
result := DFmon_only.Value;
end;
procedure TInfoLENDERQuery.SetPkeepForcedData(const Value: String);
begin
DFkeepForcedData.Value := Value;
end;
function TInfoLENDERQuery.GetPkeepForcedData:String;
begin
result := DFkeepForcedData.Value;
end;
procedure TInfoLENDERQuery.SetPautorenew(const Value: String);
begin
DFautorenew.Value := Value;
end;
function TInfoLENDERQuery.GetPautorenew:String;
begin
result := DFautorenew.Value;
end;
procedure TInfoLENDERQuery.SetPInterestOption(const Value: String);
begin
DFInterestOption.Value := Value;
end;
function TInfoLENDERQuery.GetPInterestOption:String;
begin
result := DFInterestOption.Value;
end;
procedure TInfoLENDERQuery.SetPInterestRate(const Value: Currency);
begin
DFInterestRate.Value := Value;
end;
function TInfoLENDERQuery.GetPInterestRate:Currency;
begin
result := DFInterestRate.Value;
end;
procedure TInfoLENDERQuery.SetPt_updins(const Value: String);
begin
DFt_updins.Value := Value;
end;
function TInfoLENDERQuery.GetPt_updins:String;
begin
result := DFt_updins.Value;
end;
procedure TInfoLENDERQuery.SetPt_lndate(const Value: String);
begin
DFt_lndate.Value := Value;
end;
function TInfoLENDERQuery.GetPt_lndate:String;
begin
result := DFt_lndate.Value;
end;
procedure TInfoLENDERQuery.SetPt_matdate(const Value: String);
begin
DFt_matdate.Value := Value;
end;
function TInfoLENDERQuery.GetPt_matdate:String;
begin
result := DFt_matdate.Value;
end;
procedure TInfoLENDERQuery.SetPt_branch(const Value: String);
begin
DFt_branch.Value := Value;
end;
function TInfoLENDERQuery.GetPt_branch:String;
begin
result := DFt_branch.Value;
end;
procedure TInfoLENDERQuery.SetPt_off(const Value: String);
begin
DFt_off.Value := Value;
end;
function TInfoLENDERQuery.GetPt_off:String;
begin
result := DFt_off.Value;
end;
procedure TInfoLENDERQuery.SetPt_short(const Value: String);
begin
DFt_short.Value := Value;
end;
function TInfoLENDERQuery.GetPt_short:String;
begin
result := DFt_short.Value;
end;
procedure TInfoLENDERQuery.SetPt_name(const Value: String);
begin
DFt_name.Value := Value;
end;
function TInfoLENDERQuery.GetPt_name:String;
begin
result := DFt_name.Value;
end;
procedure TInfoLENDERQuery.SetPt_addr(const Value: String);
begin
DFt_addr.Value := Value;
end;
function TInfoLENDERQuery.GetPt_addr:String;
begin
result := DFt_addr.Value;
end;
procedure TInfoLENDERQuery.SetPt_coll(const Value: String);
begin
DFt_coll.Value := Value;
end;
function TInfoLENDERQuery.GetPt_coll:String;
begin
result := DFt_coll.Value;
end;
procedure TInfoLENDERQuery.SetPnextrunDate(const Value: String);
begin
DFnextrunDate.Value := Value;
end;
function TInfoLENDERQuery.GetPnextrunDate:String;
begin
result := DFnextrunDate.Value;
end;
procedure TInfoLENDERQuery.SetPrunfreqDays(const Value: SmallInt);
begin
DFrunfreqDays.Value := Value;
end;
function TInfoLENDERQuery.GetPrunfreqDays:SmallInt;
begin
result := DFrunfreqDays.Value;
end;
procedure TInfoLENDERQuery.SetPforcerun(const Value: String);
begin
DFforcerun.Value := Value;
end;
function TInfoLENDERQuery.GetPforcerun:String;
begin
result := DFforcerun.Value;
end;
procedure TInfoLENDERQuery.SetPlast_updDate(const Value: String);
begin
DFlast_updDate.Value := Value;
end;
function TInfoLENDERQuery.GetPlast_updDate:String;
begin
result := DFlast_updDate.Value;
end;
procedure TInfoLENDERQuery.SetPlast_ihisDate(const Value: String);
begin
DFlast_ihisDate.Value := Value;
end;
function TInfoLENDERQuery.GetPlast_ihisDate:String;
begin
result := DFlast_ihisDate.Value;
end;
procedure TInfoLENDERQuery.SetPlast_thisDate(const Value: String);
begin
DFlast_thisDate.Value := Value;
end;
function TInfoLENDERQuery.GetPlast_thisDate:String;
begin
result := DFlast_thisDate.Value;
end;
procedure TInfoLENDERQuery.SetPlast_diskDate(const Value: String);
begin
DFlast_diskDate.Value := Value;
end;
function TInfoLENDERQuery.GetPlast_diskDate:String;
begin
result := DFlast_diskDate.Value;
end;
procedure TInfoLENDERQuery.SetPlast_tapeDate(const Value: String);
begin
DFlast_tapeDate.Value := Value;
end;
function TInfoLENDERQuery.GetPlast_tapeDate:String;
begin
result := DFlast_tapeDate.Value;
end;
procedure TInfoLENDERQuery.SetPfirstrunDate(const Value: String);
begin
DFfirstrunDate.Value := Value;
end;
function TInfoLENDERQuery.GetPfirstrunDate:String;
begin
result := DFfirstrunDate.Value;
end;
procedure TInfoLENDERQuery.SetPcancdate(const Value: String);
begin
DFcancdate.Value := Value;
end;
function TInfoLENDERQuery.GetPcancdate:String;
begin
result := DFcancdate.Value;
end;
procedure TInfoLENDERQuery.SetPMailCarrier(const Value: String);
begin
DFMailCarrier.Value := Value;
end;
function TInfoLENDERQuery.GetPMailCarrier:String;
begin
result := DFMailCarrier.Value;
end;
procedure TInfoLENDERQuery.SetPCallforDataDOW(const Value: String);
begin
DFCallforDataDOW.Value := Value;
end;
function TInfoLENDERQuery.GetPCallforDataDOW:String;
begin
result := DFCallforDataDOW.Value;
end;
procedure TInfoLENDERQuery.SetPhold_run(const Value: String);
begin
DFhold_run.Value := Value;
end;
function TInfoLENDERQuery.GetPhold_run:String;
begin
result := DFhold_run.Value;
end;
procedure TInfoLENDERQuery.SetPrevlevel(const Value: String);
begin
DFrevlevel.Value := Value;
end;
function TInfoLENDERQuery.GetPrevlevel:String;
begin
result := DFrevlevel.Value;
end;
procedure TInfoLENDERQuery.SetPnum_mod(const Value: SmallInt);
begin
DFnum_mod.Value := Value;
end;
function TInfoLENDERQuery.GetPnum_mod:SmallInt;
begin
result := DFnum_mod.Value;
end;
procedure TInfoLENDERQuery.SetPmod(const Value: String);
begin
DFmod.Value := Value;
end;
function TInfoLENDERQuery.GetPmod:String;
begin
result := DFmod.Value;
end;
procedure TInfoLENDERQuery.SetPlen_def(const Value: String);
begin
DFlen_def.Value := Value;
end;
function TInfoLENDERQuery.GetPlen_def:String;
begin
result := DFlen_def.Value;
end;
procedure TInfoLENDERQuery.SetPdef_text(const Value: String);
begin
DFdef_text.Value := Value;
end;
function TInfoLENDERQuery.GetPdef_text:String;
begin
result := DFdef_text.Value;
end;
procedure TInfoLENDERQuery.SetPPrintMissingdataOfficerOrder(const Value: String);
begin
DFPrintMissingdataOfficerOrder.Value := Value;
end;
function TInfoLENDERQuery.GetPPrintMissingdataOfficerOrder:String;
begin
result := DFPrintMissingdataOfficerOrder.Value;
end;
procedure TInfoLENDERQuery.SetPmisstitle(const Value: String);
begin
DFmisstitle.Value := Value;
end;
function TInfoLENDERQuery.GetPmisstitle:String;
begin
result := DFmisstitle.Value;
end;
procedure TInfoLENDERQuery.SetPsite_type(const Value: String);
begin
DFsite_type.Value := Value;
end;
function TInfoLENDERQuery.GetPsite_type:String;
begin
result := DFsite_type.Value;
end;
procedure TInfoLENDERQuery.SetPic_input(const Value: String);
begin
DFic_input.Value := Value;
end;
function TInfoLENDERQuery.GetPic_input:String;
begin
result := DFic_input.Value;
end;
procedure TInfoLENDERQuery.SetPnoticeid(const Value: String);
begin
DFnoticeid.Value := Value;
end;
function TInfoLENDERQuery.GetPnoticeid:String;
begin
result := DFnoticeid.Value;
end;
procedure TInfoLENDERQuery.SetPinq_type(const Value: String);
begin
DFinq_type.Value := Value;
end;
function TInfoLENDERQuery.GetPinq_type:String;
begin
result := DFinq_type.Value;
end;
procedure TInfoLENDERQuery.SetPdoc_id(const Value: String);
begin
DFdoc_id.Value := Value;
end;
function TInfoLENDERQuery.GetPdoc_id:String;
begin
result := DFdoc_id.Value;
end;
procedure TInfoLENDERQuery.SetPCollateralValueOption(const Value: String);
begin
DFCollateralValueOption.Value := Value;
end;
function TInfoLENDERQuery.GetPCollateralValueOption:String;
begin
result := DFCollateralValueOption.Value;
end;
procedure TInfoLENDERQuery.SetPimage_opt(const Value: String);
begin
DFimage_opt.Value := Value;
end;
function TInfoLENDERQuery.GetPimage_opt:String;
begin
result := DFimage_opt.Value;
end;
procedure TInfoLENDERQuery.SetPprintid(const Value: String);
begin
DFprintid.Value := Value;
end;
function TInfoLENDERQuery.GetPprintid:String;
begin
result := DFprintid.Value;
end;
procedure TInfoLENDERQuery.SetPfstrun(const Value: String);
begin
DFfstrun.Value := Value;
end;
function TInfoLENDERQuery.GetPfstrun:String;
begin
result := DFfstrun.Value;
end;
procedure TInfoLENDERQuery.SetPfststmt(const Value: String);
begin
DFfststmt.Value := Value;
end;
function TInfoLENDERQuery.GetPfststmt:String;
begin
result := DFfststmt.Value;
end;
procedure TInfoLENDERQuery.SetPmathold(const Value: SmallInt);
begin
DFmathold.Value := Value;
end;
function TInfoLENDERQuery.GetPmathold:SmallInt;
begin
result := DFmathold.Value;
end;
procedure TInfoLENDERQuery.SetPNoticeSortOrder1(const Value: String);
begin
DFNoticeSortOrder1.Value := Value;
end;
function TInfoLENDERQuery.GetPNoticeSortOrder1:String;
begin
result := DFNoticeSortOrder1.Value;
end;
procedure TInfoLENDERQuery.SetPNoticeSortOrder2(const Value: String);
begin
DFNoticeSortOrder2.Value := Value;
end;
function TInfoLENDERQuery.GetPNoticeSortOrder2:String;
begin
result := DFNoticeSortOrder2.Value;
end;
procedure TInfoLENDERQuery.SetPNoticeSortOrder3(const Value: String);
begin
DFNoticeSortOrder3.Value := Value;
end;
function TInfoLENDERQuery.GetPNoticeSortOrder3:String;
begin
result := DFNoticeSortOrder3.Value;
end;
procedure TInfoLENDERQuery.SetPNoticeSortOrder4(const Value: String);
begin
DFNoticeSortOrder4.Value := Value;
end;
function TInfoLENDERQuery.GetPNoticeSortOrder4:String;
begin
result := DFNoticeSortOrder4.Value;
end;
procedure TInfoLENDERQuery.SetPNoticeSortOrder5(const Value: String);
begin
DFNoticeSortOrder5.Value := Value;
end;
function TInfoLENDERQuery.GetPNoticeSortOrder5:String;
begin
result := DFNoticeSortOrder5.Value;
end;
procedure TInfoLENDERQuery.SetPFiller2(const Value: String);
begin
DFFiller2.Value := Value;
end;
function TInfoLENDERQuery.GetPFiller2:String;
begin
result := DFFiller2.Value;
end;
procedure TInfoLENDERQuery.SetPspec_tab(const Value: String);
begin
DFspec_tab.Value := Value;
end;
function TInfoLENDERQuery.GetPspec_tab:String;
begin
result := DFspec_tab.Value;
end;
procedure TInfoLENDERQuery.SetPPremiumChartCopies(const Value: Integer);
begin
DFPremiumChartCopies.Value := Value;
end;
function TInfoLENDERQuery.GetPPremiumChartCopies:Integer;
begin
result := DFPremiumChartCopies.Value;
end;
procedure TInfoLENDERQuery.SetPMailingLabeltype(const Value: String);
begin
DFMailingLabeltype.Value := Value;
end;
function TInfoLENDERQuery.GetPMailingLabeltype:String;
begin
result := DFMailingLabeltype.Value;
end;
procedure TInfoLENDERQuery.SetPfnotdate(const Value: Integer);
begin
DFfnotdate.Value := Value;
end;
function TInfoLENDERQuery.GetPfnotdate:Integer;
begin
result := DFfnotdate.Value;
end;
procedure TInfoLENDERQuery.SetPsnotdate(const Value: Integer);
begin
DFsnotdate.Value := Value;
end;
function TInfoLENDERQuery.GetPsnotdate:Integer;
begin
result := DFsnotdate.Value;
end;
procedure TInfoLENDERQuery.SetPcollateralUse(const Value: String);
begin
DFcollateralUse.Value := Value;
end;
function TInfoLENDERQuery.GetPcollateralUse:String;
begin
result := DFcollateralUse.Value;
end;
procedure TInfoLENDERQuery.SetPreflag(const Value: String);
begin
DFreflag.Value := Value;
end;
function TInfoLENDERQuery.GetPreflag:String;
begin
result := DFreflag.Value;
end;
procedure TInfoLENDERQuery.SetPfnottype(const Value: String);
begin
DFfnottype.Value := Value;
end;
function TInfoLENDERQuery.GetPfnottype:String;
begin
result := DFfnottype.Value;
end;
procedure TInfoLENDERQuery.SetPpcprint(const Value: String);
begin
DFpcprint.Value := Value;
end;
function TInfoLENDERQuery.GetPpcprint:String;
begin
result := DFpcprint.Value;
end;
procedure TInfoLENDERQuery.SetPBalanceReportSortRequest(const Value: String);
begin
DFBalanceReportSortRequest.Value := Value;
end;
function TInfoLENDERQuery.GetPBalanceReportSortRequest:String;
begin
result := DFBalanceReportSortRequest.Value;
end;
procedure TInfoLENDERQuery.SetPpoldate(const Value: Integer);
begin
DFpoldate.Value := Value;
end;
function TInfoLENDERQuery.GetPpoldate:Integer;
begin
result := DFpoldate.Value;
end;
procedure TInfoLENDERQuery.SetPhistptr(const Value: String);
begin
DFhistptr.Value := Value;
end;
function TInfoLENDERQuery.GetPhistptr:String;
begin
result := DFhistptr.Value;
end;
procedure TInfoLENDERQuery.SetPNoteNumber(const Value: SmallInt);
begin
DFNoteNumber.Value := Value;
end;
function TInfoLENDERQuery.GetPNoteNumber:SmallInt;
begin
result := DFNoteNumber.Value;
end;
procedure TInfoLENDERQuery.SetPOptions(const Value: String);
begin
DFOptions.Value := Value;
end;
function TInfoLENDERQuery.GetPOptions:String;
begin
result := DFOptions.Value;
end;
procedure TInfoLENDERQuery.SetPclContact(const Value: String);
begin
DFclContact.Value := Value;
end;
function TInfoLENDERQuery.GetPclContact:String;
begin
result := DFclContact.Value;
end;
procedure TInfoLENDERQuery.SetPclAddress(const Value: String);
begin
DFclAddress.Value := Value;
end;
function TInfoLENDERQuery.GetPclAddress:String;
begin
result := DFclAddress.Value;
end;
procedure TInfoLENDERQuery.SetPclCityStZip(const Value: String);
begin
DFclCityStZip.Value := Value;
end;
function TInfoLENDERQuery.GetPclCityStZip:String;
begin
result := DFclCityStZip.Value;
end;
procedure TInfoLENDERQuery.SetPclPhone(const Value: String);
begin
DFclPhone.Value := Value;
end;
function TInfoLENDERQuery.GetPclPhone:String;
begin
result := DFclPhone.Value;
end;
procedure TInfoLENDERQuery.SetPclFax(const Value: String);
begin
DFclFax.Value := Value;
end;
function TInfoLENDERQuery.GetPclFax:String;
begin
result := DFclFax.Value;
end;
procedure TInfoLENDERQuery.SetPplContact(const Value: String);
begin
DFplContact.Value := Value;
end;
function TInfoLENDERQuery.GetPplContact:String;
begin
result := DFplContact.Value;
end;
procedure TInfoLENDERQuery.SetPplAddress(const Value: String);
begin
DFplAddress.Value := Value;
end;
function TInfoLENDERQuery.GetPplAddress:String;
begin
result := DFplAddress.Value;
end;
procedure TInfoLENDERQuery.SetPplCityStZip(const Value: String);
begin
DFplCityStZip.Value := Value;
end;
function TInfoLENDERQuery.GetPplCityStZip:String;
begin
result := DFplCityStZip.Value;
end;
procedure TInfoLENDERQuery.SetPplPhone(const Value: String);
begin
DFplPhone.Value := Value;
end;
function TInfoLENDERQuery.GetPplPhone:String;
begin
result := DFplPhone.Value;
end;
procedure TInfoLENDERQuery.SetPplFax(const Value: String);
begin
DFplFax.Value := Value;
end;
function TInfoLENDERQuery.GetPplFax:String;
begin
result := DFplFax.Value;
end;
procedure TInfoLENDERQuery.SetPLastRunDate(const Value: String);
begin
DFLastRunDate.Value := Value;
end;
function TInfoLENDERQuery.GetPLastRunDate:String;
begin
result := DFLastRunDate.Value;
end;
procedure TInfoLENDERQuery.SetPRunControl(const Value: String);
begin
DFRunControl.Value := Value;
end;
function TInfoLENDERQuery.GetPRunControl:String;
begin
result := DFRunControl.Value;
end;
procedure TInfoLENDERQuery.SetPTranControl(const Value: String);
begin
DFTranControl.Value := Value;
end;
function TInfoLENDERQuery.GetPTranControl:String;
begin
result := DFTranControl.Value;
end;
procedure TInfoLENDERQuery.SetPLast4RunNum(const Value: String);
begin
DFLast4RunNum.Value := Value;
end;
function TInfoLENDERQuery.GetPLast4RunNum:String;
begin
result := DFLast4RunNum.Value;
end;
procedure TInfoLENDERQuery.SetPAccountId(const Value: String);
begin
DFAccountId.Value := Value;
end;
function TInfoLENDERQuery.GetPAccountId:String;
begin
result := DFAccountId.Value;
end;
procedure TInfoLENDERQuery.SetPRefundOpt(const Value: String);
begin
DFRefundOpt.Value := Value;
end;
function TInfoLENDERQuery.GetPRefundOpt:String;
begin
result := DFRefundOpt.Value;
end;
procedure TInfoLENDERQuery.SetPInterim(const Value: String);
begin
DFInterim.Value := Value;
end;
function TInfoLENDERQuery.GetPInterim:String;
begin
result := DFInterim.Value;
end;
function TInfoLENDERQuery.GetDataBuffer:TInfoLENDERRecord;
var buf: TInfoLENDERRecord;
begin
fillchar(buf, sizeof(buf), 0);
buf.PLenderID := DFLenderID.Value;
buf.PModCount := DFModCount.Value;
buf.Pclient := DFclient.Value;
buf.PSystemType := DFSystemType.Value;
buf.Pstatus := DFstatus.Value;
buf.PNetStatement := DFNetStatement.Value;
buf.Pname := DFname.Value;
buf.PAddress := DFAddress.Value;
buf.PAddress2 := DFAddress2.Value;
buf.PCityState := DFCityState.Value;
buf.PZipCode := DFZipCode.Value;
buf.PStreetName := DFStreetName.Value;
buf.PStreetAddress := DFStreetAddress.Value;
buf.PStreetCSZ := DFStreetCSZ.Value;
buf.Pstate := DFstate.Value;
buf.PPhoneNumber := DFPhoneNumber.Value;
buf.PPhoneExtension := DFPhoneExtension.Value;
buf.PResidentAdminName := DFResidentAdminName.Value;
buf.PResidentAdminPhone := DFResidentAdminPhone.Value;
buf.PResidentAdminPhoneExtension := DFResidentAdminPhoneExtension.Value;
buf.PFaxNumber := DFFaxNumber.Value;
buf.Pgroup := DFgroup.Value;
buf.PStatementGroup := DFStatementGroup.Value;
buf.PClientID := DFClientID.Value;
buf.Ppcgroup := DFpcgroup.Value;
buf.PBalanceLimit := DFBalanceLimit.Value;
buf.Pdel_lim := DFdel_lim.Value;
buf.Pbaldel := DFbaldel.Value;
buf.PMatureLoanHoldDays := DFMatureLoanHoldDays.Value;
buf.PTapeHoldDays := DFTapeHoldDays.Value;
buf.Prunevents := DFrunevents.Value;
buf.Pmethod := DFmethod.Value;
buf.PCommisionEntityMix := DFCommisionEntityMix.Value;
buf.PMasterMix := DFMasterMix.Value;
buf.PBlanketPolicyMix := DFBlanketPolicyMix.Value;
buf.PGracePeriodOption := DFGracePeriodOption.Value;
buf.PNewGraceDays := DFNewGraceDays.Value;
buf.PExpGraceDays := DFExpGraceDays.Value;
buf.PcancellgraceDays := DFcancellgraceDays.Value;
buf.PMaxBackDays := DFMaxBackDays.Value;
buf.PErrorOmissionInceptionDate := DFErrorOmissionInceptionDate.Value;
buf.POverrideEODate := DFOverrideEODate.Value;
buf.Pmanprint := DFmanprint.Value;
buf.Pbook_all := DFbook_all.Value;
buf.PWaverNonPayDays := DFWaverNonPayDays.Value;
buf.Pnewpmt := DFnewpmt.Value;
buf.PStatementContactName := DFStatementContactName.Value;
buf.POfficeContactName := DFOfficeContactName.Value;
buf.PNoticeSignature := DFNoticeSignature.Value;
buf.PNoticeSignature2 := DFNoticeSignature2.Value;
buf.PMasterPolicyNumber := DFMasterPolicyNumber.Value;
buf.PBlanketPolicyNumber := DFBlanketPolicyNumber.Value;
buf.PEarningMethodCode := DFEarningMethodCode.Value;
buf.PCancellationMethocCode := DFCancellationMethocCode.Value;
buf.Ptapeid := DFtapeid.Value;
buf.Pdiskid := DFdiskid.Value;
buf.PInquiryID := DFInquiryID.Value;
buf.PCancellationID := DFCancellationID.Value;
buf.PStatementID := DFStatementID.Value;
buf.PBranchBankingOption := DFBranchBankingOption.Value;
buf.Punwaive := DFunwaive.Value;
buf.PSpecialApprovalCode_opt9x := DFSpecialApprovalCode_opt9x.Value;
buf.Pmon_only := DFmon_only.Value;
buf.PkeepForcedData := DFkeepForcedData.Value;
buf.Pautorenew := DFautorenew.Value;
buf.PInterestOption := DFInterestOption.Value;
buf.PInterestRate := DFInterestRate.Value;
buf.Pt_updins := DFt_updins.Value;
buf.Pt_lndate := DFt_lndate.Value;
buf.Pt_matdate := DFt_matdate.Value;
buf.Pt_branch := DFt_branch.Value;
buf.Pt_off := DFt_off.Value;
buf.Pt_short := DFt_short.Value;
buf.Pt_name := DFt_name.Value;
buf.Pt_addr := DFt_addr.Value;
buf.Pt_coll := DFt_coll.Value;
buf.PnextrunDate := DFnextrunDate.Value;
buf.PrunfreqDays := DFrunfreqDays.Value;
buf.Pforcerun := DFforcerun.Value;
buf.Plast_updDate := DFlast_updDate.Value;
buf.Plast_ihisDate := DFlast_ihisDate.Value;
buf.Plast_thisDate := DFlast_thisDate.Value;
buf.Plast_diskDate := DFlast_diskDate.Value;
buf.Plast_tapeDate := DFlast_tapeDate.Value;
buf.PfirstrunDate := DFfirstrunDate.Value;
buf.Pcancdate := DFcancdate.Value;
buf.PMailCarrier := DFMailCarrier.Value;
buf.PCallforDataDOW := DFCallforDataDOW.Value;
buf.Phold_run := DFhold_run.Value;
buf.Prevlevel := DFrevlevel.Value;
buf.Pnum_mod := DFnum_mod.Value;
buf.Pmod := DFmod.Value;
buf.Plen_def := DFlen_def.Value;
buf.Pdef_text := DFdef_text.Value;
buf.PPrintMissingdataOfficerOrder := DFPrintMissingdataOfficerOrder.Value;
buf.Pmisstitle := DFmisstitle.Value;
buf.Psite_type := DFsite_type.Value;
buf.Pic_input := DFic_input.Value;
buf.Pnoticeid := DFnoticeid.Value;
buf.Pinq_type := DFinq_type.Value;
buf.Pdoc_id := DFdoc_id.Value;
buf.PCollateralValueOption := DFCollateralValueOption.Value;
buf.Pimage_opt := DFimage_opt.Value;
buf.Pprintid := DFprintid.Value;
buf.Pfstrun := DFfstrun.Value;
buf.Pfststmt := DFfststmt.Value;
buf.Pmathold := DFmathold.Value;
buf.PNoticeSortOrder1 := DFNoticeSortOrder1.Value;
buf.PNoticeSortOrder2 := DFNoticeSortOrder2.Value;
buf.PNoticeSortOrder3 := DFNoticeSortOrder3.Value;
buf.PNoticeSortOrder4 := DFNoticeSortOrder4.Value;
buf.PNoticeSortOrder5 := DFNoticeSortOrder5.Value;
buf.PFiller2 := DFFiller2.Value;
buf.Pspec_tab := DFspec_tab.Value;
buf.PPremiumChartCopies := DFPremiumChartCopies.Value;
buf.PMailingLabeltype := DFMailingLabeltype.Value;
buf.Pfnotdate := DFfnotdate.Value;
buf.Psnotdate := DFsnotdate.Value;
buf.PcollateralUse := DFcollateralUse.Value;
buf.Preflag := DFreflag.Value;
buf.Pfnottype := DFfnottype.Value;
buf.Ppcprint := DFpcprint.Value;
buf.PBalanceReportSortRequest := DFBalanceReportSortRequest.Value;
buf.Ppoldate := DFpoldate.Value;
buf.Phistptr := DFhistptr.Value;
buf.PNoteNumber := DFNoteNumber.Value;
buf.POptions := DFOptions.Value;
buf.PclContact := DFclContact.Value;
buf.PclAddress := DFclAddress.Value;
buf.PclCityStZip := DFclCityStZip.Value;
buf.PclPhone := DFclPhone.Value;
buf.PclFax := DFclFax.Value;
buf.PplContact := DFplContact.Value;
buf.PplAddress := DFplAddress.Value;
buf.PplCityStZip := DFplCityStZip.Value;
buf.PplPhone := DFplPhone.Value;
buf.PplFax := DFplFax.Value;
buf.PLastRunDate := DFLastRunDate.Value;
buf.PRunControl := DFRunControl.Value;
buf.PTranControl := DFTranControl.Value;
buf.PLast4RunNum := DFLast4RunNum.Value;
buf.PAccountId := DFAccountId.Value;
buf.PRefundOpt := DFRefundOpt.Value;
buf.PInterim := DFInterim.Value;
result := buf;
end;
procedure TInfoLENDERQuery.StoreDataBuffer(ABuffer:TInfoLENDERRecord);
begin
DFLenderID.Value := ABuffer.PLenderID;
DFModCount.Value := ABuffer.PModCount;
DFclient.Value := ABuffer.Pclient;
DFSystemType.Value := ABuffer.PSystemType;
DFstatus.Value := ABuffer.Pstatus;
DFNetStatement.Value := ABuffer.PNetStatement;
DFname.Value := ABuffer.Pname;
DFAddress.Value := ABuffer.PAddress;
DFAddress2.Value := ABuffer.PAddress2;
DFCityState.Value := ABuffer.PCityState;
DFZipCode.Value := ABuffer.PZipCode;
DFStreetName.Value := ABuffer.PStreetName;
DFStreetAddress.Value := ABuffer.PStreetAddress;
DFStreetCSZ.Value := ABuffer.PStreetCSZ;
DFstate.Value := ABuffer.Pstate;
DFPhoneNumber.Value := ABuffer.PPhoneNumber;
DFPhoneExtension.Value := ABuffer.PPhoneExtension;
DFResidentAdminName.Value := ABuffer.PResidentAdminName;
DFResidentAdminPhone.Value := ABuffer.PResidentAdminPhone;
DFResidentAdminPhoneExtension.Value := ABuffer.PResidentAdminPhoneExtension;
DFFaxNumber.Value := ABuffer.PFaxNumber;
DFgroup.Value := ABuffer.Pgroup;
DFStatementGroup.Value := ABuffer.PStatementGroup;
DFClientID.Value := ABuffer.PClientID;
DFpcgroup.Value := ABuffer.Ppcgroup;
DFBalanceLimit.Value := ABuffer.PBalanceLimit;
DFdel_lim.Value := ABuffer.Pdel_lim;
DFbaldel.Value := ABuffer.Pbaldel;
DFMatureLoanHoldDays.Value := ABuffer.PMatureLoanHoldDays;
DFTapeHoldDays.Value := ABuffer.PTapeHoldDays;
DFrunevents.Value := ABuffer.Prunevents;
DFmethod.Value := ABuffer.Pmethod;
DFCommisionEntityMix.Value := ABuffer.PCommisionEntityMix;
DFMasterMix.Value := ABuffer.PMasterMix;
DFBlanketPolicyMix.Value := ABuffer.PBlanketPolicyMix;
DFGracePeriodOption.Value := ABuffer.PGracePeriodOption;
DFNewGraceDays.Value := ABuffer.PNewGraceDays;
DFExpGraceDays.Value := ABuffer.PExpGraceDays;
DFcancellgraceDays.Value := ABuffer.PcancellgraceDays;
DFMaxBackDays.Value := ABuffer.PMaxBackDays;
DFErrorOmissionInceptionDate.Value := ABuffer.PErrorOmissionInceptionDate;
DFOverrideEODate.Value := ABuffer.POverrideEODate;
DFmanprint.Value := ABuffer.Pmanprint;
DFbook_all.Value := ABuffer.Pbook_all;
DFWaverNonPayDays.Value := ABuffer.PWaverNonPayDays;
DFnewpmt.Value := ABuffer.Pnewpmt;
DFStatementContactName.Value := ABuffer.PStatementContactName;
DFOfficeContactName.Value := ABuffer.POfficeContactName;
DFNoticeSignature.Value := ABuffer.PNoticeSignature;
DFNoticeSignature2.Value := ABuffer.PNoticeSignature2;
DFMasterPolicyNumber.Value := ABuffer.PMasterPolicyNumber;
DFBlanketPolicyNumber.Value := ABuffer.PBlanketPolicyNumber;
DFEarningMethodCode.Value := ABuffer.PEarningMethodCode;
DFCancellationMethocCode.Value := ABuffer.PCancellationMethocCode;
DFtapeid.Value := ABuffer.Ptapeid;
DFdiskid.Value := ABuffer.Pdiskid;
DFInquiryID.Value := ABuffer.PInquiryID;
DFCancellationID.Value := ABuffer.PCancellationID;
DFStatementID.Value := ABuffer.PStatementID;
DFBranchBankingOption.Value := ABuffer.PBranchBankingOption;
DFunwaive.Value := ABuffer.Punwaive;
DFSpecialApprovalCode_opt9x.Value := ABuffer.PSpecialApprovalCode_opt9x;
DFmon_only.Value := ABuffer.Pmon_only;
DFkeepForcedData.Value := ABuffer.PkeepForcedData;
DFautorenew.Value := ABuffer.Pautorenew;
DFInterestOption.Value := ABuffer.PInterestOption;
DFInterestRate.Value := ABuffer.PInterestRate;
DFt_updins.Value := ABuffer.Pt_updins;
DFt_lndate.Value := ABuffer.Pt_lndate;
DFt_matdate.Value := ABuffer.Pt_matdate;
DFt_branch.Value := ABuffer.Pt_branch;
DFt_off.Value := ABuffer.Pt_off;
DFt_short.Value := ABuffer.Pt_short;
DFt_name.Value := ABuffer.Pt_name;
DFt_addr.Value := ABuffer.Pt_addr;
DFt_coll.Value := ABuffer.Pt_coll;
DFnextrunDate.Value := ABuffer.PnextrunDate;
DFrunfreqDays.Value := ABuffer.PrunfreqDays;
DFforcerun.Value := ABuffer.Pforcerun;
DFlast_updDate.Value := ABuffer.Plast_updDate;
DFlast_ihisDate.Value := ABuffer.Plast_ihisDate;
DFlast_thisDate.Value := ABuffer.Plast_thisDate;
DFlast_diskDate.Value := ABuffer.Plast_diskDate;
DFlast_tapeDate.Value := ABuffer.Plast_tapeDate;
DFfirstrunDate.Value := ABuffer.PfirstrunDate;
DFcancdate.Value := ABuffer.Pcancdate;
DFMailCarrier.Value := ABuffer.PMailCarrier;
DFCallforDataDOW.Value := ABuffer.PCallforDataDOW;
DFhold_run.Value := ABuffer.Phold_run;
DFrevlevel.Value := ABuffer.Prevlevel;
DFnum_mod.Value := ABuffer.Pnum_mod;
DFmod.Value := ABuffer.Pmod;
DFlen_def.Value := ABuffer.Plen_def;
DFdef_text.Value := ABuffer.Pdef_text;
DFPrintMissingdataOfficerOrder.Value := ABuffer.PPrintMissingdataOfficerOrder;
DFmisstitle.Value := ABuffer.Pmisstitle;
DFsite_type.Value := ABuffer.Psite_type;
DFic_input.Value := ABuffer.Pic_input;
DFnoticeid.Value := ABuffer.Pnoticeid;
DFinq_type.Value := ABuffer.Pinq_type;
DFdoc_id.Value := ABuffer.Pdoc_id;
DFCollateralValueOption.Value := ABuffer.PCollateralValueOption;
DFimage_opt.Value := ABuffer.Pimage_opt;
DFprintid.Value := ABuffer.Pprintid;
DFfstrun.Value := ABuffer.Pfstrun;
DFfststmt.Value := ABuffer.Pfststmt;
DFmathold.Value := ABuffer.Pmathold;
DFNoticeSortOrder1.Value := ABuffer.PNoticeSortOrder1;
DFNoticeSortOrder2.Value := ABuffer.PNoticeSortOrder2;
DFNoticeSortOrder3.Value := ABuffer.PNoticeSortOrder3;
DFNoticeSortOrder4.Value := ABuffer.PNoticeSortOrder4;
DFNoticeSortOrder5.Value := ABuffer.PNoticeSortOrder5;
DFFiller2.Value := ABuffer.PFiller2;
DFspec_tab.Value := ABuffer.Pspec_tab;
DFPremiumChartCopies.Value := ABuffer.PPremiumChartCopies;
DFMailingLabeltype.Value := ABuffer.PMailingLabeltype;
DFfnotdate.Value := ABuffer.Pfnotdate;
DFsnotdate.Value := ABuffer.Psnotdate;
DFcollateralUse.Value := ABuffer.PcollateralUse;
DFreflag.Value := ABuffer.Preflag;
DFfnottype.Value := ABuffer.Pfnottype;
DFpcprint.Value := ABuffer.Ppcprint;
DFBalanceReportSortRequest.Value := ABuffer.PBalanceReportSortRequest;
DFpoldate.Value := ABuffer.Ppoldate;
DFhistptr.Value := ABuffer.Phistptr;
DFNoteNumber.Value := ABuffer.PNoteNumber;
DFOptions.Value := ABuffer.POptions;
DFclContact.Value := ABuffer.PclContact;
DFclAddress.Value := ABuffer.PclAddress;
DFclCityStZip.Value := ABuffer.PclCityStZip;
DFclPhone.Value := ABuffer.PclPhone;
DFclFax.Value := ABuffer.PclFax;
DFplContact.Value := ABuffer.PplContact;
DFplAddress.Value := ABuffer.PplAddress;
DFplCityStZip.Value := ABuffer.PplCityStZip;
DFplPhone.Value := ABuffer.PplPhone;
DFplFax.Value := ABuffer.PplFax;
DFLastRunDate.Value := ABuffer.PLastRunDate;
DFRunControl.Value := ABuffer.PRunControl;
DFTranControl.Value := ABuffer.PTranControl;
DFLast4RunNum.Value := ABuffer.PLast4RunNum;
DFAccountId.Value := ABuffer.PAccountId;
DFRefundOpt.Value := ABuffer.PRefundOpt;
DFInterim.Value := ABuffer.PInterim;
end;
(********************************************)
(************ Register Component ************)
(********************************************)
procedure Register;
begin
RegisterComponents( 'Info Tables', [ TInfoLENDERTable, TInfoLENDERQuery, TInfoLENDERBuffer ] );
end; { Register }
function TInfoLENDERBuffer.FieldNameToIndex(s:string):integer;
const flist:array[1..144] of string = ('LENDERID','MODCOUNT','CLIENT','SYSTEMTYPE','STATUS','NETSTATEMENT'
,'NAME','ADDRESS','ADDRESS2','CITYSTATE','ZIPCODE'
,'STREETNAME','STREETADDRESS','STREETCSZ','STATE','PHONENUMBER'
,'PHONEEXTENSION','RESIDENTADMINNAME','RESIDENTADMINPHONE','RESIDENTADMINPHONEEXTENSION','FAXNUMBER'
,'GROUP','STATEMENTGROUP','CLIENTID','PCGROUP','BALANCELIMIT'
,'DEL_LIM','BALDEL','MATURELOANHOLDDAYS','TAPEHOLDDAYS','RUNEVENTS'
,'METHOD','COMMISIONENTITYMIX','MASTERMIX','BLANKETPOLICYMIX','GRACEPERIODOPTION'
,'NEWGRACEDAYS','EXPGRACEDAYS','CANCELLGRACEDAYS','MAXBACKDAYS','ERROROMISSIONINCEPTIONDATE'
,'OVERRIDEEODATE','MANPRINT','BOOK_ALL','WAVERNONPAYDAYS','NEWPMT'
,'STATEMENTCONTACTNAME','OFFICECONTACTNAME','NOTICESIGNATURE','NOTICESIGNATURE2','MASTERPOLICYNUMBER'
,'BLANKETPOLICYNUMBER','EARNINGMETHODCODE','CANCELLATIONMETHOCCODE','TAPEID','DISKID'
,'INQUIRYID','CANCELLATIONID','STATEMENTID','BRANCHBANKINGOPTION','UNWAIVE'
,'SPECIALAPPROVALCODE_OPT9X','MON_ONLY','KEEPFORCEDDATA','AUTORENEW','INTERESTOPTION'
,'INTERESTRATE','T_UPDINS','T_LNDATE','T_MATDATE','T_BRANCH'
,'T_OFF','T_SHORT','T_NAME','T_ADDR','T_COLL'
,'NEXTRUNDATE','RUNFREQDAYS','FORCERUN','LAST_UPDDATE','LAST_IHISDATE'
,'LAST_THISDATE','LAST_DISKDATE','LAST_TAPEDATE','FIRSTRUNDATE','CANCDATE'
,'MAILCARRIER','CALLFORDATADOW','HOLD_RUN','REVLEVEL','NUM_MOD'
,'MOD','LEN_DEF','DEF_TEXT','PRINTMISSINGDATAOFFICERORDER','MISSTITLE'
,'SITE_TYPE','IC_INPUT','NOTICEID','INQ_TYPE','DOC_ID'
,'COLLATERALVALUEOPTION','IMAGE_OPT','PRINTID','FSTRUN','FSTSTMT'
,'MATHOLD','NOTICESORTORDER1','NOTICESORTORDER2','NOTICESORTORDER3','NOTICESORTORDER4'
,'NOTICESORTORDER5','FILLER2','SPEC_TAB','PREMIUMCHARTCOPIES','MAILINGLABELTYPE'
,'FNOTDATE','SNOTDATE','COLLATERALUSE','REFLAG','FNOTTYPE'
,'PCPRINT','BALANCEREPORTSORTREQUEST','POLDATE','HISTPTR','NOTENUMBER'
,'OPTIONS','CLCONTACT','CLADDRESS','CLCITYSTZIP','CLPHONE'
,'CLFAX','PLCONTACT','PLADDRESS','PLCITYSTZIP','PLPHONE'
,'PLFAX','LASTRUNDATE','RUNCONTROL','TRANCONTROL','LAST4RUNNUM'
,'ACCOUNTID','REFUNDOPT','INTERIM' );
var x : integer;
begin
s := uppercase(s);
x := 1;
while (x <= 144) and (flist[x] <> s) do inc(x);
if x <= 144 then result := x else result := 0;
end;
function TInfoLENDERBuffer.FieldType(index:integer):TFieldType;
begin
result := ftUnknown;
case index of
1 : result := ftString;
2 : result := ftSmallInt;
3 : result := ftString;
4 : result := ftString;
5 : result := ftString;
6 : result := ftString;
7 : result := ftString;
8 : result := ftString;
9 : result := ftString;
10 : result := ftString;
11 : result := ftString;
12 : result := ftString;
13 : result := ftString;
14 : result := ftString;
15 : result := ftString;
16 : result := ftString;
17 : result := ftString;
18 : result := ftString;
19 : result := ftString;
20 : result := ftString;
21 : result := ftString;
22 : result := ftString;
23 : result := ftString;
24 : result := ftString;
25 : result := ftString;
26 : result := ftInteger;
27 : result := ftInteger;
28 : result := ftString;
29 : result := ftSmallInt;
30 : result := ftSmallInt;
31 : result := ftString;
32 : result := ftString;
33 : result := ftString;
34 : result := ftString;
35 : result := ftString;
36 : result := ftString;
37 : result := ftSmallInt;
38 : result := ftSmallInt;
39 : result := ftSmallInt;
40 : result := ftSmallInt;
41 : result := ftString;
42 : result := ftString;
43 : result := ftString;
44 : result := ftString;
45 : result := ftSmallInt;
46 : result := ftString;
47 : result := ftString;
48 : result := ftString;
49 : result := ftString;
50 : result := ftString;
51 : result := ftString;
52 : result := ftString;
53 : result := ftString;
54 : result := ftString;
55 : result := ftString;
56 : result := ftString;
57 : result := ftString;
58 : result := ftString;
59 : result := ftString;
60 : result := ftString;
61 : result := ftString;
62 : result := ftString;
63 : result := ftString;
64 : result := ftString;
65 : result := ftString;
66 : result := ftString;
67 : result := ftCurrency;
68 : result := ftString;
69 : result := ftString;
70 : result := ftString;
71 : result := ftString;
72 : result := ftString;
73 : result := ftString;
74 : result := ftString;
75 : result := ftString;
76 : result := ftString;
77 : result := ftString;
78 : result := ftSmallInt;
79 : result := ftString;
80 : result := ftString;
81 : result := ftString;
82 : result := ftString;
83 : result := ftString;
84 : result := ftString;
85 : result := ftString;
86 : result := ftString;
87 : result := ftString;
88 : result := ftString;
89 : result := ftString;
90 : result := ftString;
91 : result := ftSmallInt;
92 : result := ftString;
93 : result := ftString;
94 : result := ftString;
95 : result := ftString;
96 : result := ftString;
97 : result := ftString;
98 : result := ftString;
99 : result := ftString;
100 : result := ftString;
101 : result := ftString;
102 : result := ftString;
103 : result := ftString;
104 : result := ftString;
105 : result := ftString;
106 : result := ftString;
107 : result := ftSmallInt;
108 : result := ftString;
109 : result := ftString;
110 : result := ftString;
111 : result := ftString;
112 : result := ftString;
113 : result := ftString;
114 : result := ftString;
115 : result := ftInteger;
116 : result := ftString;
117 : result := ftInteger;
118 : result := ftInteger;
119 : result := ftString;
120 : result := ftString;
121 : result := ftString;
122 : result := ftString;
123 : result := ftString;
124 : result := ftInteger;
125 : result := ftString;
126 : result := ftSmallInt;
127 : result := ftString;
128 : result := ftString;
129 : result := ftString;
130 : result := ftString;
131 : result := ftString;
132 : result := ftString;
133 : result := ftString;
134 : result := ftString;
135 : result := ftString;
136 : result := ftString;
137 : result := ftString;
138 : result := ftString;
139 : result := ftString;
140 : result := ftString;
141 : result := ftString;
142 : result := ftString;
143 : result := ftString;
144 : result := ftString;
end;
end;
function TInfoLENDERBuffer.PtrIndex(index:integer):Pointer;
begin
result := nil;
case index of
1 : result := @Data.PLenderID;
2 : result := @Data.PModCount;
3 : result := @Data.Pclient;
4 : result := @Data.PSystemType;
5 : result := @Data.Pstatus;
6 : result := @Data.PNetStatement;
7 : result := @Data.Pname;
8 : result := @Data.PAddress;
9 : result := @Data.PAddress2;
10 : result := @Data.PCityState;
11 : result := @Data.PZipCode;
12 : result := @Data.PStreetName;
13 : result := @Data.PStreetAddress;
14 : result := @Data.PStreetCSZ;
15 : result := @Data.Pstate;
16 : result := @Data.PPhoneNumber;
17 : result := @Data.PPhoneExtension;
18 : result := @Data.PResidentAdminName;
19 : result := @Data.PResidentAdminPhone;
20 : result := @Data.PResidentAdminPhoneExtension;
21 : result := @Data.PFaxNumber;
22 : result := @Data.Pgroup;
23 : result := @Data.PStatementGroup;
24 : result := @Data.PClientID;
25 : result := @Data.Ppcgroup;
26 : result := @Data.PBalanceLimit;
27 : result := @Data.Pdel_lim;
28 : result := @Data.Pbaldel;
29 : result := @Data.PMatureLoanHoldDays;
30 : result := @Data.PTapeHoldDays;
31 : result := @Data.Prunevents;
32 : result := @Data.Pmethod;
33 : result := @Data.PCommisionEntityMix;
34 : result := @Data.PMasterMix;
35 : result := @Data.PBlanketPolicyMix;
36 : result := @Data.PGracePeriodOption;
37 : result := @Data.PNewGraceDays;
38 : result := @Data.PExpGraceDays;
39 : result := @Data.PcancellgraceDays;
40 : result := @Data.PMaxBackDays;
41 : result := @Data.PErrorOmissionInceptionDate;
42 : result := @Data.POverrideEODate;
43 : result := @Data.Pmanprint;
44 : result := @Data.Pbook_all;
45 : result := @Data.PWaverNonPayDays;
46 : result := @Data.Pnewpmt;
47 : result := @Data.PStatementContactName;
48 : result := @Data.POfficeContactName;
49 : result := @Data.PNoticeSignature;
50 : result := @Data.PNoticeSignature2;
51 : result := @Data.PMasterPolicyNumber;
52 : result := @Data.PBlanketPolicyNumber;
53 : result := @Data.PEarningMethodCode;
54 : result := @Data.PCancellationMethocCode;
55 : result := @Data.Ptapeid;
56 : result := @Data.Pdiskid;
57 : result := @Data.PInquiryID;
58 : result := @Data.PCancellationID;
59 : result := @Data.PStatementID;
60 : result := @Data.PBranchBankingOption;
61 : result := @Data.Punwaive;
62 : result := @Data.PSpecialApprovalCode_opt9x;
63 : result := @Data.Pmon_only;
64 : result := @Data.PkeepForcedData;
65 : result := @Data.Pautorenew;
66 : result := @Data.PInterestOption;
67 : result := @Data.PInterestRate;
68 : result := @Data.Pt_updins;
69 : result := @Data.Pt_lndate;
70 : result := @Data.Pt_matdate;
71 : result := @Data.Pt_branch;
72 : result := @Data.Pt_off;
73 : result := @Data.Pt_short;
74 : result := @Data.Pt_name;
75 : result := @Data.Pt_addr;
76 : result := @Data.Pt_coll;
77 : result := @Data.PnextrunDate;
78 : result := @Data.PrunfreqDays;
79 : result := @Data.Pforcerun;
80 : result := @Data.Plast_updDate;
81 : result := @Data.Plast_ihisDate;
82 : result := @Data.Plast_thisDate;
83 : result := @Data.Plast_diskDate;
84 : result := @Data.Plast_tapeDate;
85 : result := @Data.PfirstrunDate;
86 : result := @Data.Pcancdate;
87 : result := @Data.PMailCarrier;
88 : result := @Data.PCallforDataDOW;
89 : result := @Data.Phold_run;
90 : result := @Data.Prevlevel;
91 : result := @Data.Pnum_mod;
92 : result := @Data.Pmod;
93 : result := @Data.Plen_def;
94 : result := @Data.Pdef_text;
95 : result := @Data.PPrintMissingdataOfficerOrder;
96 : result := @Data.Pmisstitle;
97 : result := @Data.Psite_type;
98 : result := @Data.Pic_input;
99 : result := @Data.Pnoticeid;
100 : result := @Data.Pinq_type;
101 : result := @Data.Pdoc_id;
102 : result := @Data.PCollateralValueOption;
103 : result := @Data.Pimage_opt;
104 : result := @Data.Pprintid;
105 : result := @Data.Pfstrun;
106 : result := @Data.Pfststmt;
107 : result := @Data.Pmathold;
108 : result := @Data.PNoticeSortOrder1;
109 : result := @Data.PNoticeSortOrder2;
110 : result := @Data.PNoticeSortOrder3;
111 : result := @Data.PNoticeSortOrder4;
112 : result := @Data.PNoticeSortOrder5;
113 : result := @Data.PFiller2;
114 : result := @Data.Pspec_tab;
115 : result := @Data.PPremiumChartCopies;
116 : result := @Data.PMailingLabeltype;
117 : result := @Data.Pfnotdate;
118 : result := @Data.Psnotdate;
119 : result := @Data.PcollateralUse;
120 : result := @Data.Preflag;
121 : result := @Data.Pfnottype;
122 : result := @Data.Ppcprint;
123 : result := @Data.PBalanceReportSortRequest;
124 : result := @Data.Ppoldate;
125 : result := @Data.Phistptr;
126 : result := @Data.PNoteNumber;
127 : result := @Data.POptions;
128 : result := @Data.PclContact;
129 : result := @Data.PclAddress;
130 : result := @Data.PclCityStZip;
131 : result := @Data.PclPhone;
132 : result := @Data.PclFax;
133 : result := @Data.PplContact;
134 : result := @Data.PplAddress;
135 : result := @Data.PplCityStZip;
136 : result := @Data.PplPhone;
137 : result := @Data.PplFax;
138 : result := @Data.PLastRunDate;
139 : result := @Data.PRunControl;
140 : result := @Data.PTranControl;
141 : result := @Data.PLast4RunNum;
142 : result := @Data.PAccountId;
143 : result := @Data.PRefundOpt;
144 : result := @Data.PInterim;
end;
end;
end.
|
unit Converter;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls,
Defines, StringFunctions;
type
TMainForm = class(TForm)
FileBox: TListBox;
LogBox: TListBox;
IndividualProgressBar: TProgressBar;
OverallProgressBar: TProgressBar;
AddFilesBtn: TButton;
AddFolderBtn: TButton;
DeleteFilesBtn: TButton;
ClearFilesBtn: TButton;
SettingsBtn: TButton;
OutputPathBtn: TButton;
ConvertBtn: TButton;
IndividualStatusLabel: TLabel;
OverallStatusLabel: TLabel;
procedure AddFilesBtnClick(Sender: TObject);
procedure AddFolderBtnClick(Sender: TObject);
procedure DeleteFilesBtnClick(Sender: TObject);
procedure ClearFilesBtnClick(Sender: TObject);
procedure OutputPathBtnClick(Sender: TObject);
procedure ConvertBtnClick(Sender: TObject);
private
{ Private declarations }
public
procedure addToLog(text:string);
procedure addToFileBox(text:string);
procedure createLogFile(filename:string);
procedure deleteFromFileBox(index:integer);
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
uses
AddFolderForm, setOutputPathForm, XML_Parser;
procedure TMainForm.createLogFile(filename:string);
var
FileHandle:TextFile;
begin
AssignFile(FileHandle, logfile_path);
ReWrite(FileHandle);
CloseFile(FileHandle);
end;
procedure TMainForm.addToLog(text:string);
var
FileHandle:TextFile;
begin
LogBox.items.add(text);
LogBox.topindex := LogBox.items.count - 1;
AssignFile(FileHandle, logfile_path);
Append(FileHandle);
writeln(FileHandle, text);
CloseFile(FileHandle);
end;
procedure TMainForm.addToFileBox(text:string);
begin
if findStringInStringList(text, XML_FileList) = -1 then
begin
XML_FileList.add(text);
FileBox.Items.add(getLastSubstring(text, '\'));
addToLog('Using file ' + text);
end
else
addToLog('File ' + text + ' is already marked for conversion');
end;
procedure TMainForm.deleteFromFileBox(index:integer);
begin
addToLog('Removing file ' + XML_FileList[index]);
XML_FileList.delete(index);
FileBox.Items.delete(index);
end;
procedure TMainForm.AddFilesBtnClick(Sender: TObject);
var
GetFiles:TOpenDialog;
ii:integer;
begin
GetFiles := TOpenDialog.create(self);
GetFiles.InitialDir := initial_directory;
GetFiles.Options := [ofAllowMultiSelect];
GetFiles.Filter := 'XML Files|*.xml';
addToLog('Add Files Button clicked');
addToLog('Initial Directory = ' + initial_directory);
addToLog('MultiSelect selected. XML files filtered');
if not GetFiles.execute then addToLog('Add files dialog canceled')
else
begin
for ii := 0 to GetFiles.Files.count - 1 do
begin
addToFileBox(GetFiles.Files[ii]);
end;
end;
GetFiles.free;
end;
procedure TMainForm.AddFolderBtnClick(Sender: TObject);
begin
addToLog('Add Folder Button Clicked.');
AddFolder.Visible := true;
end;
procedure TMainForm.DeleteFilesBtnClick(Sender: TObject);
var
any_selected : boolean;
ii : integer;
begin
addToLog('Add Folder Button Clicked.');
any_selected := false;
for ii := FileBox.Items.count - 1 downto 0 do
begin
if FileBox.Selected[ii] then
begin
deleteFromFileBox(ii);
any_selected := true;
end;
end;
if not any_selected then begin
ShowMessage('No Files selected for deletion.');
addToLog('No Files selected for deletion.');
end;
end;
procedure TMainForm.ClearFilesBtnClick(Sender: TObject);
var
ii : integer;
begin
addToLog('Clear Files Button Clicked.');
for ii := FileBox.Items.Count - 1 downto 0 do
deleteFromFileBox(ii);
addToLog('All files removed');
end;
procedure TMainForm.OutputPathBtnClick(Sender: TObject);
begin
addToLog('Output Path Button Clicked.');
addToLog('Current output path: ' + output_filepath);
outputPathForm.Show;
end;
procedure TMainForm.ConvertBtnClick(Sender: TObject);
var
overall_increment : Extended;
ii : integer;
parser : TXML_Parser;
begin
addToLog('Convert button clicked.');
if FileBox.Items.Count <> 0 then
begin
addToLog('Starting conversion...');
IndividualStatusLabel.caption := 'Starting conversion...';
OverallStatusLabel.caption := 'Starting conversion...';
IndividualProgressBar.position := 0;
OverallProgressBar.position := 0;
overall_increment := 100.0 / FileBox.Items.count;
Application.ProcessMessages;
parser := TXML_Parser.create;
for ii := 0 to FileBox.Items.count - 1 do begin
addToLog('Converting ' + FileBox.Items[ii]);
OverallStatusLabel.caption := 'Converting ' + FileBox.Items[ii];
IndividualProgressBar.position := 0;
Application.ProcessMessages;
addToLog('Parsing ' + FileBox.Items[ii]);
OverallStatusLabel.caption := 'Parsing ' + FileBox.Items[ii];
parser.parseXML(XML_FileList[ii]);
IndividualProgressBar.position := 100;
IndividualStatusLabel.caption := 'Done.';
OverallProgressBar.position := OverallProgressBar.position + Round(overall_increment);
Application.ProcessMessages;
end;
OverallProgressBar.position := 100;
OverallStatusLabel.caption := 'Done.';
Application.ProcessMessages;
end
else
begin
ShowMessage('No files to convert.');
addToLog('No files to convert.');
end;
end;
initialization
begin
MainForm.createLogFile(logfile_path);
end;
end.
|
unit coinData;
interface
uses
System.IOUtils, sysutils, StrUtils, System.classes, FMX.Graphics, base58, FMX.Dialogs,
WalletStructureData, Nano;
function CreateCoin(id, x, y: Integer; MasterSeed: AnsiString; description: AnsiString = ''): TWalletInfo;
function getCoinIconResource(id: Integer): TStream;
function isValidForCoin(id: Integer; address: AnsiString): Boolean;
function getURLToExplorer(id: Integer; hash: AnsiString): AnsiString;
type
CoinType = ( Bitcoin , Litecoin , Dash , BitcoinCash , Ethereum , RavenCoin , DigiByte , BitcoinSV , Nano );
type
coinInfo = record
id: Integer;
displayName: AnsiString;
name: AnsiString;
shortcut: AnsiString;
WifByte: AnsiString;
p2sh: AnsiString;
p2pk: AnsiString;
flag: System.UInt32;
decimals: smallint;
availableFirstLetter: AnsiString;
hrp: AnsiString;
qrname: AnsiString;
ResourceName: AnsiString;
end;
const
// all supported coin ResourceName : '_IMG';
availableCoin: array[0..8] of coinInfo = ((
id: 0;
displayName: 'Bitcoin';
name: 'bitcoin';
shortcut: 'BTC';
WifByte: '80';
p2sh: '05';
p2pk: '00';
flag: 0;
decimals: 8;
availableFirstLetter: '13b';
hrp: 'bc';
qrname: 'bitcoin';
ResourceName: 'BITCOIN_IMG';
), (
id: 1;
displayName: 'Litecoin';
name: 'litecoin';
shortcut: 'LTC';
WifByte: 'B0';
p2sh: '32' { '05' };
p2pk: '30';
flag: 0;
decimals: 8;
availableFirstLetter: 'lm';
hrp: 'ltc';
qrname: 'litecoin';
ResourceName: 'LITECOIN_IMG';
), (
id: 2;
displayName: 'DASH';
name: 'dash';
shortcut: 'DASH';
WifByte: 'CC';
p2sh: '10';
p2pk: '4c';
flag: 0;
decimals: 8;
availableFirstLetter: 'X';
qrname: 'dash';
ResourceName: 'DASH_IMG';
), (
id: 3;
displayName: 'Bitcoin Cash';
name: 'bitcoinabc';
shortcut: 'BCH';
WifByte: '80';
p2sh: '05';
p2pk: '00';
flag: 0;
decimals: 8;
availableFirstLetter: '13pq';
qrname: 'bitcoincash';
ResourceName: 'BITCOINCASH_IMG';
), (
id: 4;
displayName: 'Ethereum';
name: 'ethereum';
shortcut: 'ETH';
WifByte: '';
p2pk: '00';
flag: 1;
decimals: 18;
availableFirstLetter: '0';
qrname: 'ethereum';
ResourceName: 'ETHEREUM_IMG';
), (
id: 5;
displayName: 'Ravencoin';
name: 'ravencoin';
shortcut: 'RVN';
WifByte: '80';
p2sh: '7a';
p2pk: '3c';
flag: 0;
decimals: 8;
availableFirstLetter: 'Rr';
qrname: 'ravencoin';
ResourceName: 'RAVENCOIN_IMG';
), (
id: 6;
displayName: 'Digibyte';
name: 'digibyte';
shortcut: 'DGB';
WifByte: '80';
p2sh: '3f';
p2pk: '1e';
flag: 0;
decimals: 8;
availableFirstLetter: 'SD';
qrname: 'digibyte';
ResourceName: 'DIGIBYTE_IMG';
), (
id: 7;
displayName: 'Bitcoin SV';
name: 'bitcoinsv';
shortcut: 'BSV';
WifByte: '80';
p2sh: '05';
p2pk: '00';
flag: 0;
decimals: 8;
availableFirstLetter: '13pq';
qrname: 'bitcoincash';
ResourceName: 'BITCOINSV_IMG';
), (
id: 8;
displayName: 'Nano';
name: 'nano';
shortcut: 'NANO';
WifByte: '';
p2sh: '';
p2pk: '';
flag: 2;
decimals: 30;
availableFirstLetter: 'xn';
qrname: 'nano';
ResourceName: 'NANO_IMG';
));
implementation
uses
Bitcoin, Ethereum, misc, UHome;
function getURLToExplorer(id: Integer; hash: AnsiString): AnsiString;
var
URL: AnsiString;
begin // ethereum
case id of
0:
URL := 'https://blockchair.com/bitcoin/transaction/';
1:
URL := 'https://blockchair.com/litecoin/transaction/';
2:
URL := 'https://chainz.cryptoid.info/dash/tx.dws?';
3:
URL := 'https://blockchair.com/bitcoin-cash/transaction/';
4:
//URL := 'https://blockchair.com/ethereum/transaction/';
URL := 'https://etherscan.io/tx/';
5:
URL := 'https://ravencoin.network/tx/';
6:
URL := 'https://digiexplorer.info/tx/';
7:
URL := 'https://bsvexplorer.info//#/tx/';
8:
URL := 'https://www.nanode.co/block/';
end;
result := URL + hash;
end;
function getCoinIconResource(id: Integer): TStream;
begin
result := resourceMenager.getAssets( AvailableCoin[id].Resourcename );
end;
function CreateCoin(id, x, y: Integer; MasterSeed: AnsiString; description: AnsiString = ''): TWalletInfo;
begin
case availableCoin[id].flag of
0:
result := Bitcoin_createHD(id, x, y, MasterSeed);
1:
result := Ethereum_createHD(id, x, y, MasterSeed);
2:
result:= nano_createHD(x,y,MasterSeed);
end;
// if description <> '' then
// begin
result.description := description;
/// end
// else
// result.description := result.addr;
wipeAnsiString(MasterSeed);
end;
function checkFirstLetter(id: Integer; address: AnsiString): Boolean;
var
c: Ansichar;
position: Integer;
begin
address := removeSpace(address);
if containsText(address, ':') then
begin
position := pos(':', address);
address := rightStr(address, length(address) - position);
end;
for c in availableCoin[id].availableFirstLetter do
begin
if lowercase(address[low(address)]) = lowercase(c) then
exit(true);
end;
result := false;
end;
// check if given address is of given coin
function isValidForCoin(id: Integer; address: AnsiString): Boolean;
var
str: AnsiString;
x: Integer;
info: TAddressInfo;
a1,a2:string;
begin
result := false;
if availableCoin[id].flag = 0 then
begin
if (id in [3, 7]) then
begin
if pos(':', address) <> 0 then
begin
str := rightStr(address, length(address) - pos(':', address));
end
else
str := address;
str := StringReplace(str, ' ', '', [rfReplaceAll]);
// showmessage(Str);
// str := StringReplace(str, 'bitcoincash:', '', [rfReplaceAll]);
if (lowercase(str[low(str)]) = 'q') or (lowercase(str[low(str)]) = 'p') then
begin
// isValidBCHCashAddress(Address)
result := true;
end
else
begin
info := decodeAddressInfo(address, id);
if info.scriptType >= 0 then
result := true;
end;
end
else
begin
try
info := decodeAddressInfo(address, id);
except
on E: Exception do
begin
exit(false);
end;
end;
if info.scriptType >= 0 then
result := true;
end;
// showmessage(str + ' sh ' + availablecoin[id].p2sh + ' pk ' + availablecoin[id].p2pk);
end
else if availableCoin[id].flag = 1 then
begin
// showmessage(inttostr(length(address)));
result := ((isHex(rightStr(address, 40))) and (length(address) = 42));
end else if availableCoin[id].flag =2 then begin
a1:=StringReplace(address,'xrb_','',[rfReplaceAll]);
a1:=StringReplace(a1,'nano_','',[rfReplaceAll]);
a2:=nano_accountFromHexKey(nano_keyFromAccount(address));
a2:=StringReplace(a2,'xrb_','',[rfReplaceAll]);
a2:=StringReplace(a2,'nano_','',[rfReplaceAll]);
result:=(a1=a2);
end;
result := result and checkFirstLetter(id, address);
end;
end.
|
unit ce_project;
{$I ce_defines.inc}
interface
uses
{$IFDEF DEBUG}
LclProc,
{$ENDIF}
Classes, SysUtils, process, strUtils, ce_common, ce_writableComponent,
ce_dmdwrap, ce_observer;
type
(*******************************************************************************
* Represents a D project.
*
* It includes all the options defined in ce_dmdwrap, organized in
* a collection to allow multiples configurations.
*
* Basically it' s designed to provide the options for the dmd process.
*)
TCEProject = class(TWritableLfmTextComponent)
private
fOnChange: TNotifyEvent;
fModified: boolean;
fRootFolder: string;
fBasePath: string;
fLibAliases: TStringList;
fOptsColl: TCollection;
fSrcs, fSrcsCop: TStringList;
fConfIx: Integer;
fUpdateCount: NativeInt;
fProjectSubject: TCECustomSubject;
fRunner: TCheckedAsyncProcess;
fOutputFilename: string;
fCanBeRun: boolean;
procedure updateOutFilename;
procedure doChanged;
procedure setLibAliases(const aValue: TStringList);
procedure subMemberChanged(sender : TObject);
procedure setOptsColl(const aValue: TCollection);
procedure setRoot(const aValue: string);
procedure setSrcs(const aValue: TStringList);
procedure setConfIx(aValue: Integer);
function getConfig(const ix: integer): TCompilerConfiguration;
function getCurrConf: TCompilerConfiguration;
function runPrePostProcess(const processInfo: TCompileProcOptions): Boolean;
// passes pre/post/executed project/ outputs as bubles.
procedure runProcOutput(sender: TObject);
// passes compilation message as "to be guessed"
procedure compProcOutput(proc: TProcess);
protected
procedure beforeLoad; override;
procedure afterSave; override;
procedure afterLoad; override;
procedure setFilename(const aValue: string); override;
procedure readerPropNoFound(Reader: TReader; Instance: TPersistent;
var PropName: string; IsPath: Boolean; var Handled, Skip: Boolean); override;
published
property RootFolder: string read fRootFolder write setRoot;
property OptionsCollection: TCollection read fOptsColl write setOptsColl;
property Sources: TStringList read fSrcs write setSrcs; // 'read' should return a copy to avoid abs/rel errors
property ConfigurationIndex: Integer read fConfIx write setConfIx;
property LibraryAliases: TStringList read fLibAliases write setLibAliases;
public
constructor create(aOwner: TComponent); override;
destructor destroy; override;
procedure beginUpdate;
procedure endUpdate;
procedure reset;
procedure addDefaults;
function isProjectSource(const aFilename: string): boolean;
function getAbsoluteSourceName(aIndex: integer): string;
function getAbsoluteFilename(const aFilename: string): string;
procedure addSource(const aFilename: string);
function addConfiguration: TCompilerConfiguration;
procedure getOpts(const aList: TStrings);
function runProject(const runArgs: string = ''): Boolean;
function compileProject: Boolean;
//
property configuration[ix: integer]: TCompilerConfiguration read getConfig;
property currentConfiguration: TCompilerConfiguration read getCurrConf;
property onChange: TNotifyEvent read fOnChange write fOnChange;
property modified: Boolean read fModified;
property canBeRun: Boolean read fCanBeRun;
property outputFilename: string read fOutputFilename;
end;
implementation
uses
ce_interfaces, controls, dialogs, ce_symstring, ce_libman, ce_dcd;
constructor TCEProject.create(aOwner: TComponent);
begin
inherited create(aOwner);
//
fProjectSubject := TCEProjectSubject.create;
//
fLibAliases := TStringList.Create;
fSrcs := TStringList.Create;
fSrcs.OnChange := @subMemberChanged;
fSrcsCop := TStringList.Create;
fOptsColl := TCollection.create(TCompilerConfiguration);
//
reset;
addDefaults;
subjProjNew(TCEProjectSubject(fProjectSubject), self);
subjProjChanged(TCEProjectSubject(fProjectSubject), self);
//
{$IFDEF LINUX}
fBasePath := '/';
{$ENDIF}
//
fModified := false;
end;
destructor TCEProject.destroy;
begin
subjProjClosing(TCEProjectSubject(fProjectSubject), self);
fProjectSubject.Free;
//
fOnChange := nil;
fLibAliases.Free;
fSrcs.free;
fSrcsCop.Free;
fOptsColl.free;
killProcess(fRunner);
inherited;
end;
function TCEProject.addConfiguration: TCompilerConfiguration;
begin
result := TCompilerConfiguration(fOptsColl.Add);
result.onChanged := @subMemberChanged;
end;
procedure TCEProject.setOptsColl(const aValue: TCollection);
var
i: nativeInt;
begin
fOptsColl.Assign(aValue);
for i:= 0 to fOptsColl.Count-1 do
Configuration[i].onChanged := @subMemberChanged;
end;
procedure TCEProject.addSource(const aFilename: string);
var
relSrc, absSrc, ext: string;
begin
ext := ExtractFileExt(aFilename);
if (dExtList.IndexOf(ext) = -1) and
(ext <> '.obj') and (ext <> '.o')
and (ext <> '.lib') and (ext <> '.a') then
exit;
for relSrc in fSrcs do
begin
absSrc := expandFilenameEx(fBasePath,relsrc);
if aFilename = absSrc then exit;
end;
fSrcs.Add(ExtractRelativepath(fBasePath, aFilename));
end;
procedure TCEProject.setRoot(const aValue: string);
begin
if fRootFolder = aValue then exit;
beginUpdate;
fRootFolder := aValue;
endUpdate;
end;
procedure TCEProject.setFilename(const aValue: string);
var
oldAbs, newRel, oldBase: string;
i: NativeInt;
begin
if fFilename = aValue then exit;
//
beginUpdate;
fFilename := aValue;
oldBase := fBasePath;
fBasePath := extractFilePath(fFilename);
//
for i:= 0 to fSrcs.Count-1 do
begin
oldAbs := expandFilenameEx(oldBase,fSrcs[i]);
newRel := ExtractRelativepath(fBasePath, oldAbs);
fSrcs[i] := newRel;
end;
//
endUpdate;
end;
procedure TCEProject.setLibAliases(const aValue: TStringList);
begin
beginUpdate;
fLibAliases.Assign(aValue);
endUpdate;
end;
procedure TCEProject.setSrcs(const aValue: TStringList);
begin
beginUpdate;
fSrcs.Assign(aValue);
patchPlateformPaths(fSrcs);
endUpdate;
end;
procedure TCEProject.setConfIx(aValue: Integer);
begin
beginUpdate;
if aValue < 0 then aValue := 0;
if aValue > fOptsColl.Count-1 then aValue := fOptsColl.Count-1;
fConfIx := aValue;
endUpdate;
end;
procedure TCEProject.subMemberChanged(sender : TObject);
begin
beginUpdate;
fModified := true;
endUpdate;
end;
procedure TCEProject.beginUpdate;
begin
Inc(fUpdateCount);
end;
procedure TCEProject.endUpdate;
begin
Dec(fUpdateCount);
if fUpdateCount > 0 then
begin
{$IFDEF DEBUG}
DebugLn('project update count > 0');
{$ENDIF}
exit;
end;
fUpdateCount := 0;
doChanged;
end;
procedure TCEProject.doChanged;
{$IFDEF DEBUG}
var
lst: TStringList;
{$ENDIF}
begin
fModified := true;
updateOutFilename;
subjProjChanged(TCEProjectSubject(fProjectSubject), self);
if assigned(fOnChange) then fOnChange(Self);
{$IFDEF DEBUG}
lst := TStringList.Create;
try
lst.Add('---------begin----------');
getOpts(lst);
lst.Add('---------end-----------');
DebugLn(lst.Text);
finally
lst.Free;
end;
{$ENDIF}
end;
function TCEProject.getConfig(const ix: integer): TCompilerConfiguration;
begin
result := TCompilerConfiguration(fOptsColl.Items[ix]);
result.onChanged := @subMemberChanged;
end;
function TCEProject.getCurrConf: TCompilerConfiguration;
begin
result := TCompilerConfiguration(fOptsColl.Items[fConfIx]);
end;
procedure TCEProject.addDefaults;
begin
with TCompilerConfiguration(fOptsColl.Add) do
begin
Name := 'debug';
debugingOptions.debug := true;
debugingOptions.codeviewCformat := true;
outputOptions.boundsCheck := onAlways;
end;
with TCompilerConfiguration(fOptsColl.Add) do
begin
Name := 'unittest';
outputOptions.unittest := true;
outputOptions.boundsCheck := onAlways;
end;
with TCompilerConfiguration(fOptsColl.Add) do
begin
Name := 'release';
outputOptions.release := true;
outputOptions.inlining := true;
outputOptions.boundsCheck := offAlways;
outputOptions.optimizations := true;
end;
end;
procedure TCEProject.reset;
var
defConf: TCompilerConfiguration;
begin
beginUpdate;
fConfIx := 0;
fOptsColl.Clear;
defConf := addConfiguration;
defConf.name := 'default';
fSrcs.Clear;
fFilename := '';
endUpdate;
fModified := false;
end;
procedure TCEProject.getOpts(const aList: TStrings);
var
rel, abs: string;
i: Integer;
ex_files: TStringList;
ex_folds: TStringList;
str: string;
begin
if fConfIx = -1 then exit;
ex_files := TStringList.Create;
ex_folds := TStringList.Create;
try
// prepares the exclusions
for i := 0 to currentConfiguration.pathsOptions.exclusions.Count-1 do
begin
str := symbolExpander.get(currentConfiguration.pathsOptions.exclusions.Strings[i]);
rel := expandFilenameEx(fBasePath, currentConfiguration.pathsOptions.exclusions.Strings[i]);
if fileExists(str) then
ex_files.Add(str)
else if DirectoryExists(str) then
ex_folds.Add(str);
if fileExists(rel) then
ex_files.Add(rel)
else if DirectoryExists(rel) then
ex_folds.Add(rel);
end;
// sources
for rel in fSrcs do if rel <> '' then
begin
abs := expandFilenameEx(fBasePath, rel);
if ex_files.IndexOf(abs) = -1 then
if ex_folds.IndexOf(ExtractFilePath(abs)) = -1
then aList.Add(abs); // note: process.inc ln 249. double quotes are added if there's a space.
end;
// libraries
LibMan.getLibFiles(fLibAliases, aList);
LibMan.getLibSources(fLibAliases, aList);
// config
TCompilerConfiguration(fOptsColl.Items[fConfIx]).getOpts(aList);
finally
ex_files.Free;
ex_folds.Free;
end;
end;
function TCEProject.isProjectSource(const aFilename: string): boolean;
var
i: Integer;
begin
for i := 0 to fSrcs.Count-1 do
if getAbsoluteSourceName(i) = aFilename then
exit(true);
exit(false);
end;
function TCEProject.getAbsoluteSourceName(aIndex: integer): string;
begin
if aIndex < 0 then exit('');
if aIndex > fSrcs.Count-1 then exit('');
result := expandFileNameEx(fBasePath, fSrcs.Strings[aIndex]);
end;
function TCEProject.getAbsoluteFilename(const aFilename: string): string;
begin
result := expandFileNameEx(fBasePath, aFilename);
end;
procedure TCEProject.afterSave;
begin
fModified := false;
updateOutFilename;
end;
procedure TCEProject.beforeLoad;
begin
beginUpdate;
Inherited;
end;
procedure TCEProject.afterLoad;
var
hasPatched: Boolean;
// either all the source files have moved or only the project file
procedure checkMissingAllSources;
var
allMissing: boolean;
dirHint: string;
newdir: string;
ini: string;
src: string;
i: Integer;
begin
if fSrcs.Count = 0 then exit;
allMissing := true;
for i:= 0 to fSrcs.Count-1 do
if fileExists(getAbsoluteSourceName(i)) then
allMissing := false;
if not allMissing then exit;
if dlgOkCancel( 'The project source(s) are all missing. ' + LineEnding +
'This can be encountered if the project file has been moved from its original location.' + LineEnding + LineEnding +
'Do you wish to select the new root folder ?') <> mrOk then exit;
// TODO-cimprovement: use commonFolder() when it'll be compat. with the rel. paths.
// hint for the common dir
dirHint := fSrcs.Strings[i];
while (dirHint[1] = '.') or (dirHint[1] = DirectorySeparator) do
dirHint := dirHint[2..length(dirHint)];
ini := extractFilePath(fFilename);
if not selectDirectory( format('select the folder (that contains "%s")',[dirHint]), ini, newdir) then
exit;
for i := 0 to fSrcs.Count-1 do
begin
src := fSrcs.Strings[i];
while (src[1] = '.') or (src[1] = DirectorySeparator) do
src := src[2..length(src)];
if fileExists(expandFilenameEx(fBasePath, newdir + DirectorySeparator + src)) then
fSrcs.Strings[i] := ExtractRelativepath(fBasePath, newdir + DirectorySeparator + src);
hasPatched := true;
end;
end;
// single sources files are missing
procedure checkMissingSingleSource;
var
oldsrc: string;
opendlg: TOpenDialog;
i: Integer;
begin
for i:= fSrcs.Count-1 downto 0 do
begin
oldsrc := getAbsoluteSourceName(i);
if fileExists(oldsrc) then continue;
if dlgOkCancel(format('a particular project source file ("%s") is missing. '
+ LineEnding + 'This happends if a source file has been moved, renamed ' +
'or deleted.' + LineEnding + LineEnding +
'Do you wish to select its new location?', [fSrcs[i]])) <> mrOk then exit;
//
opendlg := TOpenDialog.Create(nil);
try
opendlg.InitialDir := extractFilePath(fFilename);
opendlg.FileName := fSrcs[i];
if opendlg.execute then
begin
if ExtractFileName(oldsrc) <> ExtractFileName(opendlg.filename) then
if dlgOkCancel('the filenames are different, replace the old file ?') <> mrOk then
continue;
fSrcs[i] := ExtractRelativepath(fBasePath, opendlg.Filename);
hasPatched := true;
end else
begin
if dlgOkCancel('You have choosen not to update the file, ' +
'do you wish to remove it from the project ?') <> mrOk then
continue;
fSrcs.Delete(i);
hasPatched := true;
end;
finally
opendlg.Free;
end;
end;
end;
//
begin
patchPlateformPaths(fSrcs);
fModified := false;
hasPatched := false;
//
// TODO-cfeature: a modal form with the file list, green checkers and red crosses to indicate the state
// and some actions to apply to a particular selection: patch root, remove from project, replace, etc...
checkMissingAllSources;
checkMissingSingleSource;
if hasPatched then
begin
dlgOkInfo('some source file paths has been patched, some others invalid ' +
'paths or file may still exist (-of, -od, extraSources, etc)' +
'but cannot be automatically handled. Note that the modifications have not been saved.');
end;
//
updateOutFilename;
endUpdate;
if not hasPatched then fModified := false;
end;
procedure TCEProject.readerPropNoFound(Reader: TReader; Instance: TPersistent;
var PropName: string; IsPath: Boolean; var Handled, Skip: Boolean);
//var
//idt: string;
//curr: TCompilerConfiguration;
begin
// continue loading: this method ensures the project compat. in case of drastic changes.
{curr := self.configuration[OptionsCollection.Count-1];
if PropName = 'debugIdentifier' then
begin
idt := Reader.ReadUnicodeString; // next prop starts one char too late
if curr.debugingOptions.debugIdentifiers.IndexOf(idt) = -1 then
curr.debugingOptions.debugIdentifiers.Add(idt);
Skip := true;
Handled := true;
end
else if PropName = 'versionIdentifier' then
begin
idt := Reader.ReadString; // next prop starts one char too late
if curr.outputOptions.versionIdentifiers.IndexOf(idt) = -1 then
curr.outputOptions.versionIdentifiers.Add(idt);
Skip := true;
Handled := true;
exit;
end
else}
begin
Skip := true;
Handled := false;
end;
end;
procedure TCEProject.updateOutFilename;
begin
fOutputFilename := currentConfiguration.pathsOptions.outputFilename;
// field is specified
if fOutputFilename <> '' then
begin
fOutputFilename := symbolExpander.get(fOutputFilename);
fOutputFilename := getAbsoluteFilename(fOutputFilename);
{$IFDEF WINDOWS}
// field is specified without ext or with a dot in the name.
// DMD will add the ext. (e.g: "-ofresourced")
// https://issues.dlang.org/show_bug.cgi?id=13989
if fileexists(fOutputFilename + exeExt) then
if currentConfiguration.outputOptions.binaryKind = executable then
fOutputFilename := fOutputFilename + exeExt;
{$ENDIF}
end
// try to guess
else if Sources.Count > 0 then
begin
// ideally, main() should be searched for, when project binaryKind is executable
fOutputFilename := extractFilename(Sources.Strings[0]);
fOutputFilename := stripFileExt(fOutputFilename);
if FileExists(fileName) then
fOutputFilename := extractFilePath(fileName) + fOutputFilename
else
fOutputFilename := GetTempDir(false) + fOutputFilename;
// force extension
case currentConfiguration.outputOptions.binaryKind of
executable: fOutputFilename := ChangeFileExt(fOutputFilename, exeExt);
staticlib: fOutputFilename := ChangeFileExt(fOutputFilename, libExt);
sharedlib: fOutputFilename := ChangeFileExt(fOutputFilename, dynExt);
obj: fOutputFilename := ChangeFileExt(fOutputFilename, objExt);
end;
end;
//
fCanBeRun := false;
if currentConfiguration.outputOptions.binaryKind = executable then
fCanBeRun := fileExists(fOutputFilename);
end;
function TCEProject.runPrePostProcess(const processInfo: TCompileProcOptions): Boolean;
var
process: TProcess;
pname: string;
i, j: integer;
begin
pname := symbolExpander.get(processInfo.executable);
if (not exeInSysPath(pname)) and (pname <> '') then
exit(false)
else if (pname = '') then
exit(true);
//
process := TProcess.Create(nil);
try
processInfo.setProcess(process);
process.Executable := pname;
j := process.Parameters.Count-1;
for i:= 0 to j do
process.Parameters.AddText(symbolExpander.get(process.Parameters.Strings[i]));
for i:= 0 to j do
process.Parameters.Delete(0);
if process.CurrentDirectory = '' then
process.CurrentDirectory := extractFilePath(process.Executable);
ensureNoPipeIfWait(process);
process.Execute;
while process.Running do
if not (poWaitOnExit in process.Options) then
if poUsePipes in process.Options then
runProcOutput(process);
finally
result := process.ExitStatus = 0;
process.Free;
end;
end;
function TCEProject.compileProject: Boolean;
var
config: TCompilerConfiguration;
compilproc: TProcess;
olddir, prjpath: string;
prjname: string;
msgs: ICEMessagesDisplay;
begin
result := false;
config := currentConfiguration;
msgs := getMessageDisplay;
if config = nil then
begin
msgs.message('unexpected project error: no active configuration',
Self, amcProj, amkErr);
exit;
end;
//
msgs.clearByData(Self);
subjProjCompiling(TCEProjectSubject(fProjectSubject), Self);
//
if not runPrePostProcess(config.preBuildProcess) then
msgs.message('project warning: the pre-compilation process has not been properly executed',
Self, amcProj, amkWarn);
//
if (Sources.Count = 0) and (config.pathsOptions.extraSources.Count = 0) then
exit;
//
prjname := shortenPath(filename, 25);
compilproc := TProcess.Create(nil);
olddir := '';
getDir(0, olddir);
try
msgs.message('compiling ' + prjname, Self, amcProj, amkInf);
prjpath := extractFilePath(fileName);
if directoryExists(prjpath) then
begin
chDir(prjpath);
compilproc.CurrentDirectory := prjpath;
end;
compilproc.Executable := DCompiler;
compilproc.Options := compilproc.Options + [poStderrToOutPut, poUsePipes];
compilproc.ShowWindow := swoHIDE;
getOpts(compilproc.Parameters);
compilproc.Execute;
while compilProc.Running do
compProcOutput(compilproc);
if compilproc.ExitStatus = 0 then begin
msgs.message(prjname + ' has been successfully compiled', Self, amcProj, amkInf);
result := true;
end else
msgs.message(prjname + ' has not been compiled', Self, amcProj, amkWarn);
if not runPrePostProcess(config.PostBuildProcess) then
msgs.message( 'project warning: the post-compilation process has not been properly executed',
Self, amcProj, amkWarn);
finally
updateOutFilename;
compilproc.Free;
chDir(olddir);
end;
end;
function TCEProject.runProject(const runArgs: string = ''): Boolean;
var
prm: string;
i: Integer;
begin
result := false;
killProcess(fRunner);
//
fRunner := TCheckedAsyncProcess.Create(nil); // fRunner can use the input process widget.
currentConfiguration.runOptions.setProcess(fRunner);
if runArgs <> '' then
begin
prm := '';
i := 1;
repeat
prm := ExtractDelimited(i, runArgs, [' ']);
prm := symbolExpander.get(prm);
if prm <> '' then
fRunner.Parameters.AddText(prm);
Inc(i);
until prm = '';
end;
//
if not fileExists(outputFilename) then
begin
getMessageDisplay.message('output executable missing: ' + shortenPath(outputFilename, 25),
Self, amcProj, amkErr);
exit;
end;
//
fRunner.Executable := outputFilename;
if fRunner.CurrentDirectory = '' then
fRunner.CurrentDirectory := extractFilePath(fRunner.Executable);
if poUsePipes in fRunner.Options then begin
fRunner.OnReadData := @runProcOutput;
fRunner.OnTerminate := @runProcOutput;
getprocInputHandler.addProcess(fRunner);
end;
fRunner.Execute;
//
result := true;
end;
procedure TCEProject.runProcOutput(sender: TObject);
var
proc: TProcess;
lst: TStringList;
str: string;
msgs: ICEMessagesDisplay;
begin
proc := TProcess(sender);
lst := TStringList.Create;
msgs := getMessageDisplay;
try
processOutputToStrings(proc, lst);
for str in lst do
msgs.message(str, Self, amcProj, amkBub);
finally
lst.Free;
end;
//
if not proc.Active then
getprocInputHandler.removeProcess(proc);
end;
procedure TCEProject.compProcOutput(proc: TProcess);
var
lst: TStringList;
str: string;
msgs: ICEMessagesDisplay;
begin
lst := TStringList.Create;
msgs := getMessageDisplay;
try
processOutputToStrings(proc, lst);
for str in lst do
msgs.message(str, Self, amcProj, amkAuto);
finally
lst.Free;
end;
end;
initialization
RegisterClasses([TCEProject]);
end.
|
unit Com_Sync;
interface
uses Windows, Classes, SyncObjs;
type
TSyncObj = class(TObject)
private
FOwnerThread : Cardinal;
FAcquireCount : Integer;
FName : String;
FNoProcessEvents : Boolean;
function _Acquire(Timeout : Cardinal) : Boolean; virtual; abstract;
procedure _Release; virtual; abstract;
procedure _Close; virtual; abstract;
function GetProcessEvents : Boolean;
procedure SetProcessEvents(Value : Boolean);
public
destructor Destroy; override;
procedure Acquire; overload; virtual;
function Acquire(Timeout : Cardinal) : Boolean; overload; virtual;
procedure WaitFor; overload;
function WaitFor(Timeout : Cardinal) : Boolean; overload;
procedure Release; virtual;
function Acquired : Boolean;
function AcquiredByAny : Boolean;
property Name : String read FName;
property ProcessEvents : Boolean read GetProcessEvents write SetProcessEvents;
end;
TCriticalSectionSafe = class(TCriticalSection)
private
function GetThreadID : Cardinal;
public
procedure Acquire; override;
procedure Release; override;
property ThreadID : Cardinal read GetThreadID;
{$IFDEF D6}
function TryEnter : Boolean;
{$ENDIF}
end;
TCriticalSectionHelper = class helper for TCriticalSection
public
function TryAcquire(TimeOut : Cardinal) : Boolean;
end;
TExclusiveSection = class(TObject)
private
FLock : Integer;
public
function Acquire : Boolean;
procedure Release;
function Enter : Boolean;
procedure Leave;
end;
TThreadSync = class(TSyncObj)
private
FSection : TCriticalSectionSafe;
function _Acquire(Timeout : Cardinal) : Boolean; override;
procedure _Release; override;
procedure _Close; override;
public
constructor Create; virtual;
end;
THandleSync = class(TSyncObj)
private
function _Acquire(Timeout : Cardinal) : Boolean; override;
procedure _Release; override;
procedure _Close; override;
protected
FHandle : Integer;
FOwnsHandle : Boolean;
public
constructor Create(AHandle : Integer; const _Name : String; OwnsHandle : Boolean = True); virtual;
property Handle : Integer read FHandle;
end;
TSemaphoreSync = class(THandleSync)
private
procedure _Release; override;
public
constructor Create(const _Name : String; MaxCount : Integer; Global : Boolean = False); reintroduce; virtual;
end;
TMutexSync = class(TSemaphoreSync)
public
constructor Create(const _Name : String; Global : Boolean = False); reintroduce; virtual;
end;
TRealMutexSync = class(THandleSync)
private
procedure _Release; override;
public
constructor Create(const _Name : String; Global : Boolean = False); reintroduce; virtual;
end;
TEventSync = class(THandleSync)
private
FManualReset : Boolean;
procedure _Release; override;
function _Acquire(Timeout : Cardinal) : Boolean; override;
public
constructor Create(const _Name : String; ManualReset : Boolean; Global : Boolean = False); reintroduce; overload; virtual;
constructor Create(ManualReset : Boolean); reintroduce; overload; virtual;
procedure SetEvent;
procedure ResetEvent;
end;
function IsAlreadyRunning(Global : Boolean = False;
const InstanceName : String = '') : Boolean; overload;
function IsAlreadyRunning(const FileName : String; Global : Boolean = False;
const InstanceName : String = '') : Boolean; overload;
procedure CreateRunningMutex(const FileName : String; var AMutex : TSyncObj; Global : Boolean;
InstanceName : String = '');
function CreateCriticalSection(var CS : TCriticalSection) : TCriticalSection;
implementation
uses Sysutils, Forms;
type
TTryEnterCriticalSection = function(var lpCriticalSection: TRTLCriticalSection): BOOL; stdcall;
var
FTryEnterCriticalSection : TTryEnterCriticalSection;
EveryoneDCAL : RawByteString;
SecDesc : SECURITY_ATTRIBUTES;
function GetGlobal(const Global : Boolean) : String;
begin
Result := '';
if Global and (Win32MajorVersion >= 5) then
Result := 'Global\';
end;
function GetSecDesc : Pointer;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
if EveryoneDCAL = '' then
begin
SecDesc.nLength := SizeOf(SecDesc);
SecDesc.lpSecurityDescriptor := Pointer(EveryoneDCAL);
SecDesc.bInheritHandle := False;
end;
Result := @SecDesc;
end
else
Result := nil;
end;
{ TSyncObj }
destructor TSyncObj.Destroy;
begin
try
if FAcquireCount > 0 then
begin
FAcquireCount := 0;
_Release;
end;
_Close;
finally
inherited Destroy;
end; //try-finally
end;
function TSyncObj.GetProcessEvents : Boolean;
begin
Result := not FNoProcessEvents;
end;
procedure TSyncObj.SetProcessEvents(Value : Boolean);
begin
FNoProcessEvents := not Value;
end;
function TSyncObj.Acquired : Boolean;
begin
Result := (GetCurrentThreadID = FOwnerThread) and (FAcquireCount > 0);
end;
function TSyncObj.AcquiredByAny : Boolean;
begin
Result := FAcquireCount > 0;
end;
procedure TSyncObj.Acquire;
begin
Acquire(INFINITE);
end;
function TSyncObj.Acquire(Timeout : Cardinal) : Boolean;
begin
if (FAcquireCount = 0) or (GetCurrentThreadID <> FOwnerThread) then
Result := _Acquire(Timeout)
else
Result := True;
if Result then
begin
FOwnerThread := GetCurrentThreadID;
Inc(FAcquireCount);
end;
end;
procedure TSyncObj.WaitFor;
begin
Acquire(INFINITE);
end;
function TSyncObj.WaitFor(Timeout : Cardinal) : Boolean;
begin
Result := Acquire(Timeout);
end;
procedure TSyncObj.Release;
begin
if FAcquireCount > 0 then
begin
Dec(FAcquireCount);
if FAcquireCount = 0 then
_Release;
end
else
_Release;
end;
{ TThreadSync }
constructor TThreadSync.Create;
begin
inherited Create;
FSection := TCriticalSectionSafe.Create;
end;
procedure TThreadSync._Close;
begin
FreeAndNil(FSection);
end;
function TThreadSync._Acquire(Timeout : Cardinal) : Boolean;
var
Timer : Integer;
begin
Result := False;
if (TimeOut = INFINITE) or (Win32Platform <> VER_PLATFORM_WIN32_NT) then
begin
FSection.Acquire;
Result := True;
end
else begin
Timer := Integer(Timeout) and MaxInt;
while not Result and (Timer >= 0) do
begin
Result := FSection.TryEnter;
if not Result and (Timer > 0) then
SleepEx(20,False);
Dec(Timer,20);
end;
end;
end;
procedure TThreadSync._Release;
begin
FSection.Release;
end;
{ THandleSync }
constructor THandleSync.Create(AHandle : Integer; const _Name : String; OwnsHandle : Boolean = True);
begin
FName := _Name;
if AHandle = 0 then
RaiseLastOsError;
FHandle := AHandle;
FOwnsHandle := OwnsHandle;
end;
procedure THandleSync._Close;
begin
if FOwnsHandle then
CloseHandle(FHandle);
end;
function THandleSync._Acquire(Timeout : Cardinal) : Boolean;
var
r : Cardinal;
Msg: TMsg;
function Check(ret : Cardinal) : Cardinal;
begin
if ret = WAIT_ABANDONED_0 then
Result := WAIT_OBJECT_0
else
Result := ret;
end;
begin
if (Timeout <> INFINITE) or not FNoProcessEvents or (GetCurrentThreadID <> MainThreadID) then
begin
r := Check(WaitForSingleObject(FHandle,Timeout));
end
else begin
r := 0;
repeat
if r = WAIT_OBJECT_0 + 1 then
PeekMessage(Msg, 0, 0, 0, PM_NOREMOVE);
Sleep(0);
CheckSynchronize;
r := Check(MsgWaitForMultipleObjects(1, FHandle, False, Timeout, QS_ALLINPUT ));
if r = WAIT_FAILED then
RaiseLastOSError;
until r = WAIT_OBJECT_0;
end;
Result := r = WAIT_OBJECT_0;
end;
procedure THandleSync._Release;
begin
end;
{ TSemaphoreSync }
constructor TSemaphoreSync.Create(const _Name : String; MaxCount : Integer; Global : Boolean = False);
begin
inherited Create(CreateSemaphore(GetSecDesc,MaxCount,MaxCount,PChar(GetGlobal(Global) + _Name)),_Name);
end;
procedure TSemaphoreSync._Release;
begin
ReleaseSemaphore(FHandle,1,nil);
end;
{ TMutexSync }
constructor TMutexSync.Create(const _Name : String; Global : Boolean = False);
begin
inherited Create(_Name,1,Global);
end;
{ TRealMutexSync }
constructor TRealMutexSync.Create(const _Name : String; Global : Boolean = False);
begin
inherited Create(CreateMutex(GetSecDesc,False,PChar(GetGlobal(Global) + _Name)),_Name);
end;
procedure TRealMutexSync._Release;
begin
ReleaseMutex(FHandle);
end;
{ TEventSync }
constructor TEventSync.Create(const _Name : String; ManualReset : Boolean; Global : Boolean = False);
begin
FManualReset := ManualReset;
inherited Create(CreateEvent(GetSecDesc,ManualReset,False,PChar(GetGlobal(Global) + _Name)),_Name,True);
end;
constructor TEventSync.Create(ManualReset : Boolean);
begin
FManualReset := ManualReset;
FHandle := CreateEvent(GetSecDesc,ManualReset,False,nil);
if FHandle = 0 then
RaiseLastOsError;
end;
function TEventSync._Acquire(Timeout : Cardinal) : Boolean;
begin
Result := inherited _Acquire(Timeout);
if Result and not FManualReset then
Dec(FAcquireCount);
end;
procedure TEventSync._Release;
begin
if FManualReset then
Windows.ResetEvent(FHandle);
end;
procedure TEventSync.SetEvent;
begin
Windows.SetEvent(FHandle);
end;
procedure TEventSync.ResetEvent;
begin
Release;
end;
{ TCriticalSectionSafe }
procedure TCriticalSectionSafe.Acquire;
var
t : Cardinal;
FirstAcquire : Boolean;
begin
if Win32Platform <> VER_PLATFORM_WIN32_WINDOWS then
inherited
else
begin
t := GetCurrentThreadID;
FirstAcquire := FSection.OwningThread <> t;
inherited;
FSection.OwningThread := t;
if FirstAcquire then
FSection.RecursionCount := 1
else
Inc(FSection.RecursionCount);
end;
end;
procedure TCriticalSectionSafe.Release;
begin
if FSection.OwningThread = GetCurrentThreadID then
begin
if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
begin
Dec(FSection.RecursionCount);
if FSection.RecursionCount = 0 then
FSection.OwningThread := 0;
end;
inherited Release;
end;
end;
function TCriticalSectionSafe.GetThreadID: Cardinal;
begin
Result := FSection.OwningThread;
end;
{ TCriticalSectionHelper }
function TCriticalSectionHelper.TryAcquire(TimeOut: Cardinal) : Boolean;
begin
Result := TryEnter;
while not Result and (TimeOut > 0) do
begin
Dec(TimeOut);
Sleep(1);
Result := TryEnter;
end;
end;
{ TExclusiveSection }
function TExclusiveSection.Acquire: Boolean;
begin
Result := InterlockedIncrement(FLock) = 1;
if not Result then
InterlockedDecrement(FLock);
end;
procedure TExclusiveSection.Release;
begin
InterlockedDecrement(FLock);
end;
function TExclusiveSection.Enter: Boolean;
begin
Result := Acquire;
end;
procedure TExclusiveSection.Leave;
begin
Release;
end;
{ Procedures }
var
ExeMutex : TSyncObj;
procedure CreateRunningMutex(const FileName : String; var AMutex : TSyncObj; Global : Boolean;
InstanceName : String);
var
S : String;
i : Integer;
begin
S := 'process.' + Lowercase(ChangeFileExt(ExtractFileName(FileName),''));
if InstanceName <> '' then
begin
for i := 1 to Length(InstanceName) do
if CharInSet(InstanceName[i], [':','\']) then
InstanceName[i] := '.';
S := S + '$' + Lowercase(InstanceName);
end;
AMutex := TRealMutexSync.Create(S,Global);
AMutex.Acquire(0);
end;
function IsAlreadyRunning(Global : Boolean; const InstanceName : String) : Boolean;
begin
if ExeMutex = nil then
CreateRunningMutex(Paramstr(0),ExeMutex,Global,InstanceName);
Result := not ExeMutex.Acquired;
end;
function IsAlreadyRunning(const FileName : String; Global : Boolean;
const InstanceName : String) : Boolean;
var
AMutex : TSyncObj;
begin
CreateRunningMutex(FileName,AMutex,Global,InstanceName);
Result := not AMutex.Acquired;
AMutex.Free;
end;
var
L_CCS_LOCK : Integer;
function CreateCriticalSection(var CS : TCriticalSection) : TCriticalSection;
var
i : Integer;
begin
while not Assigned(CS) do
begin
i := InterlockedIncrement(L_CCS_LOCK);
try
if i = 1 then
begin
if not Assigned(CS) then
CS := TCriticalSection.Create;
end
else
Sleep(0);
finally
InterlockedDecrement(L_CCS_LOCK);
end;
end;
Result := CS;
end;
initialization
@FTryEnterCriticalSection := GetProcAddress(GetModuleHandle('kernel32'),'TryEnterCriticalSection');
finalization
FreeAndNil(ExeMutex);
end.
|
unit iocp_baseModule;
interface
uses
SysUtils, Classes, DB, DBClient, Provider, IniFiles, Variants,
iocp_base, iocp_sockets, http_objects, iocp_msgPacks, iocp_WsJSON;
type
// 数模基类
// 开发时从本数模继承子类,在以下事件(属性)中操作数据库:
// OnApplyUpdates、OnExecQuery、OnExecSQL、OnExecStoredProcedure
// OnHttpExecQuery、OnHttpExecSQL
// 请在子类的文件中加单元引用:MidasLib
TExecSQLEvent = procedure(AParams: TReceiveParams; AResult: TReturnResult) of object;
TApplyUpdatesEvent = procedure(AParams: TReceiveParams; AResult: TReturnResult; out ErrorCount: Integer) of object;
THttpRequestEvent = procedure(Sender: TObject; Request: THttpRequest; Response: THttpResponse) of object;
TWebSocketAction = procedure(Sender: TObject; JSON: TReceiveJSON; Result: TResultJSON) of object;
// 增加两个方法 AddToBackground、Wakeup,用于在数模实例中实现后台执行
// 新增:后台、唤醒事件
TBackgroundEvent = procedure(Socket: TBaseSocket) of object;
TInIOCPDataModule = class(TDataModule)
private
{ Private declarations }
FOnApplyUpdates: TApplyUpdatesEvent; // 用 Delta 数据更新
FOnExecQuery: TExecSQLEvent; // 执行 SELECT-SQL,返回一个数据集
FOnExecStoredProc: TExecSQLEvent; // 执行存储过程,可能返回数据集
FOnExecSQL: TExecSQLEvent; // 执行 SQL 命令不返回数据集
FOnHttpExecQuery: THttpRequestEvent; // 执行 HTTP 查询
FOnHttpExecSQL: THttpRequestEvent; // 执行 HTTP 命令
FOnWebSocketQuery: TWebSocketAction; // WebSocket 查询
FOnWebSocketUpdates: TWebSocketAction; // WebSocket 更新
protected
FBackgroundMethod: TBackgroundEvent; // 加入后台事件
FWakeupMethod: TBackgroundEvent; // 唤醒事件
procedure InstallDatabase(const AClassName); virtual; // 配置数据库连接
procedure InterApplyUpdates(const DataSetProviders: array of TDataSetProvider;
Params: TReceiveParams; out ErrorCount: Integer);
procedure AddToBackground(Socket: TBaseSocket); // 后台执行
procedure Wakeup(Socket: TBaseSocket); // 后台执行完毕后,唤醒客户端
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
procedure ApplyUpdates(AParams: TReceiveParams; AResult: TReturnResult);
procedure ExecQuery(AParams: TReceiveParams; AResult: TReturnResult);
procedure ExecSQL(AParams: TReceiveParams; AResult: TReturnResult);
procedure ExecStoredProcedure(AParams: TReceiveParams; AResult: TReturnResult);
procedure HttpExecQuery(Request: THttpRequest; Response: THttpResponse);
procedure HttpExecSQL(Request: THttpRequest; Response: THttpResponse);
procedure WebSocketQuery(JSON: TReceiveJSON; Result: TResultJSON);
procedure WebSocketUpdates(JSON: TReceiveJSON; Result: TResultJSON);
published
property OnApplyUpdates: TApplyUpdatesEvent read FOnApplyUpdates write FOnApplyUpdates;
property OnExecQuery: TExecSQLEvent read FOnExecQuery write FOnExecQuery;
property OnExecSQL: TExecSQLEvent read FOnExecSQL write FOnExecSQL;
property OnExecStoredProcedure: TExecSQLEvent read FOnExecStoredProc write FOnExecStoredProc;
property OnHttpExecQuery: THttpRequestEvent read FOnHttpExecQuery write FOnHttpExecQuery;
property OnHttpExecSQL: THttpRequestEvent read FOnHttpExecSQL write FOnHttpExecSQL;
property OnWebSocketQuery: TWebSocketAction read FOnWebSocketQuery write FOnWebSocketQuery;
property OnWebSocketUpdates: TWebSocketAction read FOnWebSocketUpdates write FOnWebSocketUpdates;
end;
TDataModuleClass = class of TInIOCPDataModule;
implementation
uses
iocp_server;
{$R *.dfm}
{ TInIOCPDataModule }
procedure TInIOCPDataModule.AddToBackground(Socket: TBaseSocket);
begin
if Assigned(FBackgroundMethod) then // 加入后台
FBackgroundMethod(Socket);
end;
procedure TInIOCPDataModule.ApplyUpdates(AParams: TReceiveParams; AResult: TReturnResult);
var
ErrorCount: Integer;
begin
if (Self = nil) then
begin
AResult.ActResult := arFail;
AResult.Msg := '未建数模实例.';
end else
if Assigned(FOnApplyUpdates) then
try
if (AParams.VarCount > 0) then
FOnApplyUpdates(AParams, AResult, ErrorCount)
else begin
AResult.ActResult := arFail;
AResult.Msg := 'Delta 为空.';
end;
except
on E: Exception do
begin
AResult.ActResult := arFail;
AResult.Msg := E.Message;
end;
end;
end;
constructor TInIOCPDataModule.Create(AOwner: TComponent);
begin
inherited;
// AOwner 是 TInIOCPServer,见:TBusiWorker.CreateDataModules;
if not (csDesigning in ComponentState) and
Assigned(TInIOCPServer(AOwner).BaseManager) then
begin
FBackgroundMethod := TInIOCPServer(AOwner).BaseManager.AddToBackground; // 加入后台事件
FWakeupMethod := TInIOCPServer(AOwner).BaseManager.Wakeup; // 唤醒事件
end;
end;
procedure TInIOCPDataModule.ExecQuery(AParams: TReceiveParams; AResult: TReturnResult);
begin
if (Self = nil) then
begin
AResult.ActResult := arFail;
AResult.Msg := '未建数模实例.';
end else
if Assigned(FOnExecQuery) then
try
FOnExecQuery(AParams, AResult);
except
on E: Exception do
begin
AResult.ActResult := arFail;
AResult.Msg := E.Message;
end;
end;
end;
procedure TInIOCPDataModule.ExecSQL(AParams: TReceiveParams; AResult: TReturnResult);
begin
if (Self = nil) then
begin
AResult.ActResult := arFail;
AResult.Msg := '未建数模实例.';
end else
if Assigned(FOnExecSQL) then
try
FOnExecSQL(AParams, AResult);
except
on E: Exception do
begin
AResult.ActResult := arFail;
AResult.Msg := E.Message;
end;
end;
end;
procedure TInIOCPDataModule.ExecStoredProcedure(AParams: TReceiveParams; AResult: TReturnResult);
begin
if (Self = nil) then
begin
AResult.ActResult := arFail;
AResult.Msg := '未建数模实例.';
end else
if Assigned(FOnExecStoredProc) then
try
FOnExecStoredProc(AParams, AResult);
except
on E: Exception do
begin
AResult.ActResult := arFail;
AResult.Msg := E.Message;
end;
end;
end;
procedure TInIOCPDataModule.HttpExecQuery(Request: THttpRequest; Response: THttpResponse);
begin
if (Self = nil) then // 返回 JSON 格式的异常
begin
Response.SendJSON('{"Error":"未建数模实例."}');
end else
if Assigned(FOnHttpExecQuery) then
try
FOnHttpExecQuery(Self, Request, Response);
except
on E: Exception do // 返回 JSON 格式的异常
Response.SendJSON('{"Error":"' + E.Message + '"}');
end;
end;
procedure TInIOCPDataModule.HttpExecSQL(Request: THttpRequest; Response: THttpResponse);
begin
if (Self = nil) then // 返回 JSON 格式的异常
begin
Response.SendJSON('{"Error":"未建数模实例."}');
end else
if Assigned(FOnHttpExecSQL) then
try
FOnHttpExecSQL(Self, Request, Response);
except
on E: Exception do // 返回 JSON 格式的异常
Response.SendJSON('{"Error":"' + E.Message + '"}');
end;
end;
procedure TInIOCPDataModule.InstallDatabase(const AClassName);
begin
// 如果各子类数模都用同一套数据库组件,可以在设计时加数据库
// 组件到 TInIOCPDataModule,在此写通用的配置数据库连接方法,
// 子类调用即可。
{ with TIniFile.Create('db_options.ini') do
begin
DatabaseConnection.DatabaseName := ReadString(AClassName, 'DatabaseName', '');
... ...
end; }
end;
procedure TInIOCPDataModule.InterApplyUpdates(
const DataSetProviders: array of TDataSetProvider;
Params: TReceiveParams; out ErrorCount: Integer);
var
i, k, n: Integer;
DeltaField: TVarField;
begin
// 用 Delta 更新数据表
// 新版改变:
// 1. 第1、2个字段为用户名称 __UserGroup, __UserName,
// 2. 以后字段为 Delta 数据,可能有多个。
// 遍历各 Variant 元素(可能为 Null)
// 子表可能有外键,先更新子表,最后更新主表
try
k := 0;
n := 0;
for i := Params.VarCount - 1 downto 2 do // 忽略第1、2字段:__UserGroup, __UserName
begin
DeltaField := Params.Fields[i]; // 3,2,1
if (DeltaField.VarType = etVariant) then // Delta 类型数据
begin
if (DeltaField.IsNull = False) then // 不为 Null
try
DataSetProviders[n].ApplyUpdates(DeltaField.AsVariant, 0, ErrorCount);
finally
Inc(k, ErrorCount);
end;
Inc(n);
end;
end;
ErrorCount := k;
except
raise; // 重新触发异常
end;
end;
procedure TInIOCPDataModule.Wakeup(Socket: TBaseSocket);
begin
if Assigned(FWakeupMethod) then // 唤醒
FWakeupMethod(Socket);
end;
procedure TInIOCPDataModule.WebSocketQuery(JSON: TReceiveJSON; Result: TResultJSON);
begin
if (Self = nil) then // 返回 JSON 格式的异常
begin
Result.S['Error'] := '未建数模实例.';
end else
if Assigned(FOnWebSocketQuery) then
try
FOnWebSocketQuery(TWebSocket(JSON.Socket).Worker, JSON, Result);
except
on E: Exception do // 返回 JSON 格式的异常
Result.S['Error'] := E.Message;
end;
end;
procedure TInIOCPDataModule.WebSocketUpdates(JSON: TReceiveJSON; Result: TResultJSON);
begin
if (Self = nil) then
Result.S['Error'] := '未建数模实例.'
else
if Assigned(FOnWebSocketUpdates) then
try
FOnWebSocketUpdates(Self, JSON, Result);
except
on E: Exception do // 返回 JSON 格式的异常
Result.S['Error'] := E.Message;
end;
end;
end.
|
{
MIT License
Copyright (c) 2017 Marcos Douglas B. Santos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
}
unit James.Crypto.MD5.Clss;
{$include james.inc}
interface
uses
Classes, SysUtils, md5,
James.Data,
James.Data.Clss;
type
TMD5Stream = class sealed(TInterfacedObject, IDataStream)
private
FOrigin: IDataStream;
function GetStream: IDataStream;
public
constructor Create(Origin: IDataStream); reintroduce;
class function New(Origin: IDataStream): IDataStream;
function Save(Stream: TStream): IDataStream; overload;
function Save(const FileName: string): IDataStream; overload;
function Save(Strings: TStrings): IDataStream; overload;
function AsString: string;
function Size: Int64;
end;
implementation
{ TMD5Stream }
function TMD5Stream.GetStream: IDataStream;
begin
Result := TDataStream.New(
MD5Print(
MD5String(
FOrigin.AsString
)
)
);
end;
constructor TMD5Stream.Create(Origin: IDataStream);
begin
inherited Create;
FOrigin := Origin;
end;
class function TMD5Stream.New(Origin: IDataStream): IDataStream;
begin
Result := Create(Origin);
end;
function TMD5Stream.Save(Stream: TStream): IDataStream;
begin
Result := GetStream.Save(Stream);
end;
function TMD5Stream.Save(const FileName: string): IDataStream;
begin
Result := GetStream.Save(FileName);
end;
function TMD5Stream.Save(Strings: TStrings): IDataStream;
begin
Result := GetStream.Save(Strings);
end;
function TMD5Stream.AsString: string;
begin
Result := GetStream.AsString;
end;
function TMD5Stream.Size: Int64;
begin
Result := GetStream.Size;
end;
end.
|
unit K623486769_5;
{* [Requestlink:623486769] }
// Модуль: "w:\common\components\rtl\Garant\Daily\K623486769_5.pas"
// Стереотип: "TestCase"
// Элемент модели: "K623486769_5" MUID: (574EAFD002C5)
// Имя типа: "TK623486769_5"
{$Include w:\common\components\rtl\Garant\Daily\TestDefine.inc.pas}
interface
{$If Defined(nsTest) AND NOT Defined(NoScripts)}
uses
l3IntfUses
, EVDtoHTMLWithExternalHyperlinks
;
type
TK623486769_5 = class(TEVDtoHTMLWithExternalHyperlinks)
{* [Requestlink:623486769] }
protected
function GetFolder: AnsiString; override;
{* Папка в которую входит тест }
function GetModelElementGUID: AnsiString; override;
{* Идентификатор элемента модели, который описывает тест }
end;//TK623486769_5
{$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts)
implementation
{$If Defined(nsTest) AND NOT Defined(NoScripts)}
uses
l3ImplUses
, TestFrameWork
//#UC START# *574EAFD002C5impl_uses*
//#UC END# *574EAFD002C5impl_uses*
;
function TK623486769_5.GetFolder: AnsiString;
{* Папка в которую входит тест }
begin
Result := '8.0';
end;//TK623486769_5.GetFolder
function TK623486769_5.GetModelElementGUID: AnsiString;
{* Идентификатор элемента модели, который описывает тест }
begin
Result := '574EAFD002C5';
end;//TK623486769_5.GetModelElementGUID
initialization
TestFramework.RegisterTest(TK623486769_5.Suite);
{$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts)
end.
|
unit RSTreeView;
{ *********************************************************************** }
{ }
{ RSPak Copyright (c) Rozhenko Sergey }
{ http://sites.google.com/site/sergroj/ }
{ sergroj@mail.ru }
{ }
{ This file is a subject to any one of these licenses at your choice: }
{ BSD License, MIT License, Apache License, Mozilla Public License. }
{ }
{ *********************************************************************** }
{$I RSPak.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Controls, ComCtrls, RSCommon;
{$I RSWinControlImport.inc}
type
TRSTreeView = class(TTreeView)
private
FOnCreateParams: TRSCreateParamsEvent;
FProps: TRSWinControlProps;
protected
{$IFDEF D2006}
// Delphi 2006 bug: TreeView doesn't save state in case DestroyHandle is called
procedure DestroyWnd; override;
{$ENDIF}
procedure CreateParams(var Params:TCreateParams); override;
procedure TranslateWndProc(var Msg:TMessage);
procedure WndProc(var Msg:TMessage); override;
public
constructor Create(AOwner:TComponent); override;
published
property OnCancelEdit;
property OnCanResize;
property OnResize;
{$I RSWinControlProps.inc}
end;
procedure register;
implementation
procedure register;
begin
RegisterComponents('RSPak', [TRSTreeView]);
end;
{
********************************** TRSTreeView ***********************************
}
constructor TRSTreeView.Create(AOwner:TComponent);
begin
inherited Create(AOwner);
WindowProc:=TranslateWndProc;
end;
procedure TRSTreeView.CreateParams(var Params:TCreateParams);
begin
inherited CreateParams(Params);
if Assigned(FOnCreateParams) then FOnCreateParams(Params);
end;
{$IFDEF D2006}
procedure TRSTreeView.DestroyWnd;
var state: TControlState;
begin
state:= ControlState;
ControlState:= state + [csRecreating];
inherited;
ControlState:= state;
end;
{$ENDIF}
procedure TRSTreeView.TranslateWndProc(var Msg:TMessage);
var b:boolean;
begin
if assigned(FProps.OnWndProc) then
begin
b:=false;
FProps.OnWndProc(Self, Msg, b, WndProc);
if b then exit;
end;
WndProc(Msg);
end;
procedure TRSTreeView.WndProc(var Msg:TMessage);
begin
RSProcessProps(self, Msg, FProps);
inherited;
end;
end.
|
unit OAuth.GMail;
interface
uses
Quick.OAuth,
Quick.HttpServer.Request;
type
TOAuthGMail = class (TOAuthBase)
private
fClientID: string;
fSecretID: string;
protected
function CreateAuthorizationRequest: string; override;
function CreateAuthToAccessRequest (const aAuthToken: string): string; override;
function CreateRefreshRequest (const aRefreshToken: string): string; override;
function CreateAuthorizationHTMLPage (const aAuthorised: boolean): string; override;
public
constructor Create(const aClientID, aSecretID: string);
end;
implementation
{ TOAuthGMail }
uses
Quick.OAuth.Utils,
SysUtils;
constructor TOAuthGMail.Create(const aClientID, aSecretID: string);
begin
inherited Create;
fClientID:=aClientID;
fSecretID:=aSecretID;
AuthCodeParam:='code';
AuthErrorParam:='error';
AccessTokenParam:='access_token';
ExpirationParam:='expires_in';
RefreshTokenParam:='refresh_token';
end;
function TOAuthGMail.CreateAuthorizationHTMLPage(
const aAuthorised: boolean): string;
const
DENY_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeA'+
'AAACXBIWXMAAA7DAAAOwwHHb6hkAAABtElEQVR4nO2bUY7CMAxEhz0NB+EgrDjXCg6yB+E4+9NKCAiN'+
'7XHcjf1+ED+Z6ahNHScFiqIoBNwvp+v9crpG+3hG6+sgFQFwXv7ejj+/31JBDyy+ugN4ElkJD8Hqqyu'+
'AhohYjA3D12YAGyIiMSYsXx8D6BTpFmPB9NUMQCjSJcaA7ettAEqRTTErHr5eAjCKfBSz4OXryzhgiz'+
'OzWCJd/Fs8HoFHzHeCtxf2JNgt3MMID8zXoMpAtDarEDIbidJklMJUQ6MDty6GNDSNRdxtluWwhReDU'+
'fONKADAx2jkZCsOAOAaXn4pY2let6oAAN/qTIG61lAHAOwmBFO1aQoACA/BXGqbAwDCQqCsOCkBAMND'+
'oC23aQEAw0Kg9hqoAQDuIdAbLfQAALcQXFptLgEA9BDc+oxeLbF/Qz0C7AFTT4KpX4OpC6HUpXDqxVD'+
'q5fBOLn5lbEMkdUssdVM0dVs89cZI6q2x1JujqbfHUx+Q2MPFj/LidUqsKajB05NXS4y6Zl/GurHGe6'+
'QOSpLF5jgqqxSb67C0UGzO4/KdYnN/MLEhluOTmYZY+MWvDPU122dzRVHk5g+X6Lw5aVkK9AAAAABJRU5ErkJggg==';
GRANT_IMAGE = 'data:image/png;base64,' +
'iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0' +
'RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7N11dFRXuwbwZzKZuCdEIZBAPLg7xaFIi1tKKVparIJT' +
'pEWLlSIt7u5Q3N2DhgQJGoi7TGYyM/ePfLmlBsnsPXPmzLy/te5ad63mvOf9wmT2c/Y5Z2+AEEIIIYQQQgghhBBCCCGEEEIIIYQQ' +
'QgghhBBCCCGEEEIIIYQQQgghhkKip/N4APgIQB0AwQD8AJQCYAvAQk89EEIIIYZEASAHQBKAZwAeArgC4DSARF2fXJcBwAVALwAR' +
'AGrp8DyEEEKIMdEAuAZgA4AtAFJ1cRJdBABvAN8BGITCK3xCCCGEaCcbwHIAcwG85VlYyrGWOYBhAHYDaAya2ieEEEJYWQCoC+DL' +
'//3/lwCoeBTmNQMQAGAbgKqc6hFCCCHkn24C6A7gKWshM/Ze0BHADdDgTwghhOhadRSGgPashVhvAfQFsBGANWsjhBBCCCkWKwDd' +
'UPhMwC1ti7AEgAEAVjHWIIQQQkjJmQFoB+AVgEhtCmj7DEBHALtAgz8hhBAipAIAnwI4WNIDtQkAFVB4/8FBi2MJIYQQwlcWgBoA' +
'HpXkoJI+BCgDsB00+BNCCCGGwh7AJhS+jl9sJZ3C/w6FK/sRQgghxHB4A0hH4VLCxVKSWwDeKJxeoNX9CCGEEMOTBSAQQHxxfrgk' +
'twC+Aw3+hBBCiKGyB/BNcX+4uDMALgBeggIAIYQQYsiyAfgCSPvQDxZ3BqAXaPAnhBBCDJ0dgB7F+cHizgBcA1BT63beEVrBFf27' +
'hqNFPV+U9XGArbWMR1lCCCFEVHLylHgRl4njl15i1Y77iHqSwqv0FRRuIPRexQkAHihcbpBp4yALmRQ/j2mEIT0qQSrVxS7EhBBC' +
'iDipVBos23IHo+ech0LJvNmfBoVjd9L7fqg4twA+AofB/8DvHfFV78o0+BNCCCF/I5VK8HWfKjjwe0dYyJgX2ZWgcOx+r+IEgDqs' +
'nfw8phGa1fVlLUMIIYQYtWZ1fTFndEMepT44dhcnAASxdBBawRVDelRiKUEIIYSYjC97VkZoeRfWMh8cu4sTAAJYOujfNZym/Qkh' +
'hJBikkol+KJrOGuZD47dxQkATiwdtKhfluVwQgghxOS0qMc8djp/6AeKEwDsWTrw9WI6nBBCCDE5vt7MY+cHCxQnAFiwdGBnQ+/5' +
'E0IIISVhb8s09AKA5Yd+oKTbARNCCCHECFAAIIQQQkwQBQBCCCHEBFEAIIQQQkwQBQBCCCHEBFEAIIQQQkwQBQBCCCHEBJkL3cCH' +
'mIcsZDq+4OFIOj8hhBDyNzQDQAghhJggCgCEEEKICaIAQAghhJggCgCEEEKICaIAQAghhJggCgCEEEKICaIAQAghhJggCgCEEEKI' +
'CaIAQAghhJggCgCEEEKICaIAQAghhJggCgCEEEKICaIAQAghhJggCgCEEEKICaIAQAghhJggSTF+RsNyAtqP3nTk5CnRYcg+nL32' +
'WuhWCCGEfGCMpxkAwgUN/oQQIi4UAAgzGvwJIUR8KAAQJjT4E0KIOFEAIFqjwZ8QQsSLAgDRCg3+hBAibhQASInR4E8IIeJHAYCU' +
'CA3+hBBiHCgAkGKjwZ8QQowHBQBSLDT4E0KIcaEAQD6IBn9CCDE+FADIe9HgTwghxokCAPlPNPgTQojxogBA/hUN/oQQYtwoAJB/' +
'oMGfEEKMHwUA8hc0+BNCiGl4717B/6PReRfE6NWsVRubtmyHnZ2d0K0QQogoeHu4spZ47xhPMwBE52jwJ4QQw0MBgOgUDf6EEGKY' +
'KAAQnaHBnxBCDBcFAKITNPgTQohhowBAuKPBnxBCDB8FAMIVDf6EECIOFAAINzT4E0KIeFAAIFzQ4E8IIeJCAYAwo8GfEELEhwIA' +
'YUKDPyGEiBMFAKI1GvwJIUS8KAAQrdDgTwgh4kYBgJQYDf6EECJ+FABIidDgTwghxoECACk2GvwJIcR4mOv6BG8SUnR9CkIIITrA' +
'YT96k2bo4x/NABBCCCEmiAIAIYQQYoIoABBCCCEmiAIAIYQQYoIoABBCCCEmiAIAIYQQYoIoABBCCCEmiAIAIYQQYoIoABBCCCEm' +
'iAIAIYQQYoIoABBCCCEmiAIAIYQQYoIoABBCCCEmiAIAIYQQYoIoABBCCCEmyFzoBojhSkxMREz0Q8TERCMmOhrPn8UiMysTmRmZ' +
'yMrKQnZ2NgDAzs4O9vb2cHRyhL2dPcr5+SMoOBhBQcEICg6Bu7u7wP9LCCHaMPT97AkbSTF+RsNyAvoAiUdubi4uXjiH48eO4dTJ' +
'E3jzJo5LXTc3NzT5qClatGyNxo2bwMHRkUtdQggxZt4erqwl3jvGUwAwcQpFPv44eABbNm3E1atXoFQqdXo+mUyG2nXqolfvPvi4' +
'XXvIZBY6PR8hhIgVBQCiEwnx8di4YR3WrV2N5ORkQXpwc3ND9569EfFZX/j6lhWkB0IIMVQUAAhX8W/fYs6cmdixbStUKpXQ7QAA' +
'pFIpunXvidFjxsHD01PodgghxCBQACBc5ObmYs2qFfhl4fz/f3jP0FhbW+OLAYMwfMQo2NvbC90OIYQIigIAYXboj4MYO/pbwab6' +
'S6pUqVKY/fN8tG7TVuhWCCFEMLoOALQOgBGTy+WYNHEcBnzRVzSDPwAkJSXhi88jMPzrL5GTkyN0O4QQYpQoABipyMhbaPZRQ6xa' +
'sVzoVrS2c8d2tGzeBLdvRwrdCiGEGB0KAEbo0B8H0aljOzyLjRW6FWbPYmPRsV1b7Nu7W+hWCCHEqFAAMDIrV/yOQQP6IT8/X+hW' +
'uFEqFRg6ZBCWLvlV6FYIIcRoUAAwEhqNBvN+no0fJo6HWq0Wuh3uNBoNfpo2BZMmjjPK/32EEKJvtBeAkZjyw0SsWP6b0G3o3KoV' +
'y6EqUGHGrDlCt0IIIaJGMwBGYOmSX01i8C+yds0q/LZsidBtEEKIqFEAELl9e3djxk/ThG5D736cOhk7tm8Tug1CCBEtCgAiduHC' +
'eQz/+iuTvCeu0Wjw3TcjceHCeaFbIYQQUaKVAEXqyePHaN+uNTLS03V+LncPT4RXqgrfcv4o41sO7h6esLGxhZW1DQBAnpeL3Nwc' +
'JCbE49XL53j5PBb37kQiKTFe5705OjnhwMEjqBAQoPNzEUJKhsNKdqLGOv7RUsDkH1JTU9CuTSs8f/5MZ+fw8PRCs5Yfo1bdBvD2' +
'KaNVjbjXL3HtygWcOnYICfFvOXf4p3J+fvjj8DE4O7vo7ByEkJKjAEABgOVw8je5ubno0a0zbly/ppP6AUGh6NK9D6pUrwWJpDgf' +
'jw/TaDS4ffMadm3fiEfRUVxq/l2t2nWwZdtOWFtb66Q+IaTkKABQAGA5nLxDocjHZ3164dzZM9xre3h6o3ffgahdryG3gf/vNBoN' +
'rl46j03rViAh/g33+k0+aop1GzZBJrPgXpsQUnIUACgAsBxO/kelUmHokIE4sH8f99qNPmqBAV+OgJWVfq6eFYp8bFq3EocP8F/e' +
't3Wbtli+cg3MzWmJC0KERgGAAgDL4QSFA+aXgwfi8KE/uNa1tLLC16PGonbdhlzrFtfVy+exeMEs5MvlXOu2a98BS5b9TjMBhAiM' +
'AoBhBwB6DdDA5eXl4fPP+nAf/O3tHTBx2hzBBn8AqF23IabMmA9HRyeudQ8e2I/ePbrRVsKEEPIeFAAMWFpaKrp37YQzp09xrevk' +
'7IKffl6MoOAwrnW1Ub5CEKbNXgQnzk/wX7hwHn16ddfLa5KEECJGdAvAQD1/9gwRfXrg6ZMnXOtaW9tgyoz58CtvWO/Nv3zxDJPH' +
'jkROTjbXuuX8/LB+wxZaJ4DolEajQUJ8PF69eomXL1/g1atXSExIQGpqClKSk5GalobsrCxkZmUCAJQKBXJzcwEA9vb2MJNKYWVp' +
'CSsra9jY2sLd3R1ubqXg6uoKNzc3lC5TBuX8/OFXzg+OTnxnzHSJbgEY9i0ACgAG6ML5cxg4oB/3q1epVIqxk6ajcrWaXOvycu/O' +
'LcyYMg4qVQHXuk5Ozli+ag0aNBDudgcxHjk5Obhz5zaiHtzHw6goREXdR0x0NOScn2X5L87OLvD390doWDgqVa6MypWrICg4BDKZ' +
'TC/nLwkKABQAWA43KRqNBqtWLsePUydDqVRyr99/yHC0atuRe12eTp84gmWLfuZeVyqVYuSobzHq2+9hZkZ3vkjxJSUl4dLF87h+' +
'/RquX7uKqAcPoFKphG7rLywsLBEeHo469eqjQYOGqF2nrkGsiUEBgAIAy+EmIzU1BcO/HopTJ0/opH77T7oi4oshOqnN24Y1v+PA' +
'nu06qd2gYSMsXvo73N3ddVKfiJ9KpcKtmzdw6uQJnD59Evfu3oVGw/Q1qHcymQWq16iBxk0+Qus2bREUFCxIHxQAKACwHG4Sjh45' +
'jDHff4PExESd1K9Rqx6+nzBNZwv88KbRaDB35mRcv3JRJ/U9PDwwZ+58tGjZWif1ifio1WrcuH4NBw7sw4F9e3X2tygUX9+yaNGq' +
'Fdq374iatWrr7buAAgAFAJbDjVpmRgZ++nEqNm5Yp7NzBAaHYuK0OXpb5IcXhSIfM6aMQ9T9Ozo7R/sOHTFrzlzaQ8CEPX78CJs3' +
'bsDePbuQkJAgdDt64efvjx49eqNrt+7w9PLS6bkoAFAAYDncKKnVauzYthUzpk9DUlKSzs7jXyEQP/w0FzY2tjo7hy7l5eZi2sTv' +
'8PRJjM7O4e7ujvETJ6Nrt+6imSEhbPLz83Fg/z5s2rgeV69cFrodwUilUjT5qCl69OyN1m3aQiqVcj8HBQAKACyHG53IyFuYOG4M' +
'IiNv6fQ8ZXzLYcqM+bB3cNTpeXQtKysTU8aNwquXz3V6nurVa+CnGbNRuUoVnZ6HCCclJRlbN2/CypXLkRCv+62qxaRMGV981vdz' +
'RHz2ORwc+X1nUACgAMByuNF49CgGc+fMwh8HD+j8gSKfMr744ce5cHYxjj++tLQUTJv4HeJevdTpeSQSCdp36Ihvvx+DgIBAnZ6L' +
'6M/zZ8+wdMmv2LF9K/Lz84Vux6A5ODigT0RfDBw0BB6enkK3Y/IoAIjco0cxWLxoIfbs3qWXV4f8ygdgwpRZcOC8vK7QMjPSMX3K' +
'WDx7+ljn55JKpejUuQu+Hj6SgoCIxcW9xi8L5mPrlk0oKOC7toSxk8ks0L1HT3w3eiy9MSMgCgAide3qFSz5dRFOnDimt1eIKgQG' +
'Y/zkWbCzt9fL+fQtNzcHs6aNR3TUfb2cTyKRoEHDRhgwcBCat2hFzwiIRFJSEhbM+xmbNm6AUqkQuh1Rs7W1Rf8BgzBk6FdwcnIW' +
'uh2TQwFARBITE7FzxzZs27IZjx8/0uu5q9aojW9G/wBLKyu9nlff8vPzMX/2VETeuKrX8wYGBqF7z17o0rU7SpUqpddzk+JRKpVY' +
't3Y15s6ZhczMTKHbMSqOTk749rvR+Lxff9pqW48oABi49PQ0HDt6FH8c2I/Tp08KMtXYpn0n9O3/pcmscKdWq7Fu1TIcPrBb7+eW' +
'yWRo8lEztGvfAS1atqSrIgNx7OgRTJk8Ec+fPRO6FaMWEhqG6TNmoU7dekK3YhIoABgYjUaDh1EPcOHCeZw4fgxXLl8S7P6iVCrF' +
'F4OGoUWb9oKcX2jHDx/A6uW/CrYsq7m5OerWq4/mLVqiQYOGCA4JpdsEepaQkICJ48fgj4MHhG7FZEgkEnT8pBOm/TQDbm5uQrdj' +
'1CgACCwjPR13797Bvbt3cPt2JC5fuoSUlGSh24KDoxNGfDcBFStXE7oVQd27cwu/zJ2OzAzht/11dXVD3Xr1UKVKVVSqXAUVK1YS' +
'1c5tYqLRaLBzx3ZM+WEi0tJShW7HJDk6OWHCxB/QJ6Kv0K0YLQoAOqDRaJCZkQGgcGev9PQ0JPxv686E+Hg8e/YMz5/FIvZZLN6+' +
'eSNwt/8UElYJI76bABdXSt8AkJqSjF/mTsfDB3eFbuUfvL194OfnV7iVq58fPDw94erqBnd3dzg5OcPWtnCRJgdHR5o9KKbExESM' +
'HP4Vzpw+JXQrBEDbj9th5uy59GyMDph8ADD1hSTeJZFI0Lrdp/jsi8GQSulBnHep1Wrs2rYBO7duEN3GLbpkiAGcxbGjR/DtqBEG' +
'MQv3b+ytZSjjagt3J2t4OBb+n4ONBRysZbC3lsHexgJmEsBcagYrWeHKe7n5BVBrNFAUqJGXX4CMPCXSc/KRlq1Aek4+4lJz8SY1' +
'B2/SciFXGNYuhEVcXFyxcNFiNG/RUuhWjAoFAAoAAIBS7p74cvh3CK9UVehWDNr9u5FYtmgukhJppTfAeAKAQpGPHyZOwPp1a4Ru' +
'5f852lggyMcRwT5O8PdwQDl3O7jYWer0nMlZcjyNz8TjN5l49DYDj99mIEduGGscSCQSfDn0a4wZNwEymUzodowCBQATDwASiQTN' +
'Wn6MiC8Gw9raRuh2RCE/Px87t67H/t3bTH42wBgCwJu4OAzs/7nOl8/+ECuZFJXKuaB6eTdU8nWBj6vwe2xoNBo8jc/C7ecpuP0s' +
'BdFx6VAUqAXtqXqNmvht+Ur4+JQWtA9jQAHAhAOAh6c3Bn/9DV31a+nenVtYvmQBEuIN7zkOfRF7ALh48QKGDOwv2JS/vbUMdQLd' +
'0SDEE+G+zpBJDftV23ylCjeeJuPCw3jceJqMfKUwtwycnV2wcvVa1K1XX5DzGwsKACYYACwtLdGhU3d80rknZBYWQrcjagUFBTh2' +
'eD+2bVyDvLxcodvROzEHgPXr1mDi+LF6f81WaiZBnUB3NKvkg6p+rpCaifPhzHylCteeJOHEnTjcfp6q99kwmcwCM2fPQa/eEXo9' +
'rzGhAGBiAaBewyaI6DcErm70RC1PKclJWL/6N1y+cEboVvRKjAFArVZjxk/TsHTJr3o9r7ujNdpUK41mFX3gZGtcwTshPQ/H7rzG' +
'ibtvkJat3w2RBg8Ziok/TNHJdsPGjgKAiQSAoJBw9PqsP0LCKgndilF78igau7ZtwM3rV4RuRS/EFgDy8/Mx7KshOHhgv97OGeDl' +
'iE9rl0XdIA/RXu0Xl1Klxpn7b7H76nPEpeTo7bytWrfBb8tXwdJStw9JGhsKAEYeAAKDQ9Gjzxd0n1/PYqIfYNvGNbh/N1LoVnRK' +
'TAEgJycHn0f0wsWLF/RyvuDSTujdsAIql3PRy/kMiUajwZVHidh2MRaxCVl6OWf9+g2wZv0m2NnZ6eV8xoACgBEGAIlEgmo1aqNt' +
'h84mv5Kf0GKfPMKhA7tx4exJqNXCPj2tC2IJAJkZGejdqztu3riu83P5e9gjonEAqpenhbQ0AC5ExWPjuSd4m6b7Z2SqVq2GTVu3' +
'0x4axUQBwIgCgJWVNRo3a4mPO3SGp5ePXs+tVCrp3dz3ePsmDof278LZU8cgl+cJ3Q43YggAqakp6Nm9C+7d1e1Kjk62FohoHIDm' +
'lbxp1cW/Uak1OHr7NTade4KsPKVOzxUcHIJtO/fQyoHFQAHACAKAf4VANG/1Meo3airIu/z370Zi6S9zMGr0JAQEher9/GKiUOTj' +
'5vUrOHHkIO7fjRT9OgKGHgAyMzLQtcsnOh38zSQSdKjpix4NysPGklbQfJ/MPCXWnnqEk3fj2L74PyAkNAy79uyjmYAPoAAg0gBQ' +
'xrccatVtiEYftYCXt36v9otoNBrs370Nm9evhEajgZOzC2bOW0pvGBTT27jXOHfmBK5dPo9XL58L3Y5WDDkA5OTkoEe3zjqd9i/n' +
'bo9hbUMR4OWos3MYo4ev07H0SBReJGXr7BxVqlTFtp17YG9vr7NziB0FAJEEADMzM5QPCEatOvVRq04DeAm8ClZWViYWzZuBO7f+' +
'+uXq518B02b9AksrK4E6E6e3ca9x7coFXLtyEU8fR4vmeQFDDQByuRwRvbrr7IE/qZkE3er5o1t9f6N/sl9XlCo1Np59gr3XXuhs' +
'JqxO3XrYtGU7rK2tdVJf7CgAGGgAkEgkKO1bDuGVqqJi5aoICasEW1vDeLo1JvoBFs75ESnJSf/63+s2aIKR30+k+6BaysnJRtT9' +
'O7h/9zbu343E65fPDfZWgSEGALVajSGD+uvsVT8PJ2t826Eign1oK2Ye7r9Mw8KD95GYoZtnY5q3aIk16zbSOgH/ggKAAQQAc3Nz' +
'eHr5oJx/BfiVD4B/+UD4la8AGxvh1wJ/l1KhwPYt63Bgz/YPXqF26/U5uvSgFbp4yM3NwbOnjxH79DGePX2MZ7GPkfD2jd5XsPs3' +
'hhgAfpo2RWeL/NQP9sCwtmF0r5+z3PwCLDx4H1ceJeqkfv+Bg/DjTzN1UlvMKADoIABIJBLY/O9q3draGjKZDA4OTrB3cISDoyOc' +
'nF3g6loKnt4+8PTyhqubO8zMDHsN8BfPY7Fk4Ww8j31SrJ+XSCQY8d1E1GvYRLeNmSi1Wo3kpETEv41Dwts3SElJQnpaKjIzMpCV' +
'mYHMzHQoFArI5XIAQG5Otk5mEQwtAGzetAHffTOSe10ziQQRTSqgUx2/Yn2pkZLTADh4/SVWn4qBSs3/szp9xmz06z+Ae10xowDA' +
'+AvYvv8k0/GGTqVS4eDeHdi2aU2JrzgtLCwxddYClK8QpKPuCKtuHZoxHW9IAeDixQvo2a0z95kRe2sZxnxaGZXKmt6CPkK48zwF' +
'c/be5f66oLm5Odau34SmzZpzrStmug4Ahn1ZS97r3p1bGD1iEDatW6HVl6pCkY95M6cgIz1NB90R8qc3cXEYMrA/98Hfw8kasyNq' +
'0eCvR5XLuWJe39rwduH7SnNBQQH6RvRC966dsGP7NmRn6+4NBFKIAoAIpSQnYfGCWfhx0vfMr6clJyVi7ozJUCp1u/gHMV0KRT4G' +
'9v+c+5a+gd6OmNu3Nkq7GtazOKbA09kGs/rU4v56pUqlwvlzZzFi2FBUqRiC4V9/ibt37nA9B/kTBQARUSjysW/XVowa2g/nTh/n' +
'Vjcm+gGWL5nPrR4h7/ph4gRERt7iWrOirwt+6lkDjjbGtWufmDjZWmB67xqo5q+bB7Vzc3Oxc8d2tG7ZFF0+7YDjx48a7Ns2YkUB' +
'QARUqgKcOHoQI7/8HJvWrdDJUrVnTx3DgT3budclpu3UyRPYsH4t15rV/N0wuXs1WFnQa2NCs5JJMbFLVdQK0O3iYpcuXUTfPr3w' +
'UaP6OH78qE7PZUooABgwjUaDyxfPYtTQL7B8yQIkJ+nmFZwiG9cuN5ltconuJSQkYMSwr7hetVXzd8OELlVgYU5fXYbCXGqGMZ9W' +
'Rs0Kul9h9NGjGPTt0ws9u3dB1IP7Oj+fsaO/IgOkUqlw9tQxDB/8GRbMnob4t3F6Oa9UKkVaKt/7tMQ0aTQajBrxNdf7/hV9XTC+' +
'cxXIpPS1ZWhkUjOM61RZbzssnj1zGq1aNMVP06b8/6u0pOToL8mA5Obm4NCB3Rg+OAJLFs5GQvwbvZ3bxdUNk2fMR/NW7fR2TmK8' +
'tm7ZhDOnT3GrF+jtiEldq9KVvwErmgkI9NbPvgsqlQpLl/yKFs0a4/q1q3o5p7GhvyYD8Dz2CZYvWYDBfbti7YolSEpM0Ov5Q8Iq' +
'Ydb8ZQgKDtPreYlxSkhIwLSpk7nV83SyxqSuVemevwhYyaSY1LUqfDi/Ivg+T588wacd2+Hn2TOhUqn0dl5jQOtlCiQnJxtXL53H' +
'mZNHEB0lzL0siUSC9p92Q8+I/rQON+Fm4vgxyEhP51LL3lqGH7pVo6f9RcTRxgJTulfHd+uuIiNXoZdzqtVqLJg/F7du3cSSZb/D' +
'xUX4JeTFgAKAHikVCty6cQXnz55E5I2rgr577+TsgiHDvkW1GnUE64EYn2NHj+CPgwe41JKaSTDm08r0nr8IeThZY/SnlfDDlps6' +
'WTb4v5w9cxqtmjfF2vUbERZeUW/nFSsKADqWm5uDu5E3cevGFVy7fAG5uTlCt4TadRti0FejYO9Ae6QTfpRKBaZOmcStXt8mAbTC' +
'n4hV9HVBv6aBWHkiRq/njYt7jU86fIxVa9ajUeMmej232FAA0IGE+Le4ef0ybl67jIcP7hrErnAAYG1jg4h+g+lBP6ITK37/Dc9i' +
'Y7nUqh/sgY61y3GpRYTToWZZPInPxJn7b/V63pycHPSN6IWlv61Am7Yf6/XcYkIBgJFcnoenjx/hcUwUHsc8xKOYKINcWz+8UlV8' +
'Ofx7lHL3ELoVYoSSkpLwy0I+q0l6OlljWNsw2tXPSAxtHYrY+Cy8TNbv2v75+fkYNKAfFi/9DR0/6aTXc4sFBYASyMvNxcsXsXj+' +
'7Cmexz7Fk8fRePXiGdRqtdCt/SdHJ2d89sUQNGjcDBIJfaUS3Vgw72dkZWUx15GaSfBN+4qwsaSvJmNhJZNizKeV8O3aq5Ar9fuU' +
'vkqlwvCvh8LW1g7NW7TU67nFgP7KPmDHlvV4+TwWz589QWJCvGjWopZIJGjZpgN6RHwBW1s7odshRuzVq5fYtHEDl1rd6vkjuLQT' +
'l1rEcJRxs8PSwfVx93kq7r1MxZ1nqUjO0s8CPkqlEoMG9MOmLdtRt159vZxTLCgAfMCOLeuEbqHE/PwrYMCXIxAQFCp0K8QELJg/' +
'F0ol++te5dzt0a2+P4eOiCFys7dC04reaFrRGwAQm5CFG0+TcPZBPF7p+PaAXC5Hv759cOjICfiXL6/Tc4kJBQAj4upWCp2790HT' +
'Fm1hZkZrPBHdexYbi53btzHXMZNIMKxtKKRmdJvKVPh72MPfwx7d6vkj+nU6jtx+jXNR8ShQ6eaWamZmJr74PAIHDx+DnR3NigIU' +
'AIyCnb09OnbqgbbtO0FmQQumEP1ZtnQxl7dcOtT05b63PBGP4NJOCC7thF4Ny2PXlec4fidOJ0Hg0aMYjBg2FCtXr6NnokBLAYua' +
'paUlOnbugV+Xb0THzj1o8Cd6lZycjB3btzLXcbK1QI8GNC1LAHdHa3zZKgSLB9RDNX/dbCx0+NAfWLH8N53UFhuaARAha2sbNGne' +
'Gp907gFnWvKSCGTdmlXIz89nrhPROICe+id/4e1igyndq+FidAKWHYlCZh7fVVNnzfgJTZs2R4WA2LD0hQAAIABJREFUAK51xYb+' +
'6kTE0ckZLdu0R9sOnenJfiIouVyOtWtWM9fx97BH80reHDoixqh+sAdCSjthwYH7uPM8hVtduVyOEcOGYt/BwzA3N91hkG4BiECZ' +
'sn4YMuw7LFu9FV179qXBnwju4IH9SElJZq4T0TiA7sWS93Kxs8S0HtXwKeeVISMjb2H578u41hQb040+Bk4mk6FGrXpo3rodwitV' +
'pS9JYlA2bVzPXCO4tBOql9fNfV5iXCQSCfo1DYSPqy2WHYnitsHQLwvmoWu3HihVqhSXemJDAcDAePuUwUfNW6Npiza0WQ8xSI8f' +
'P8LVK5eZ6/RuWIFDN8SUtKzsAxsLKebtv8clBGRlZWH2zOmYO38hh+7EhwKAAXB1K4VadRuibv3GCAoJo6t9YtA2c1j1L9DbEZXL' +
'0U5/pOQahHgCAObuuwc1h5VZt23djC/6D0BoWDhzLbGhACAQGvSNh1yeh8sXzuKj5q2FbkXn1Go19u7dzVznk1plOXRDTFWDEE+k' +
'ZSuw4kQ0cy2VSoUF8+dixaq17I2JDAUAPZFKpSjrVx7Va9ZB9Zp14VeeHn4yBvlyOWb/OAEP7t3Bm7hX6N13oNAt6dTVK5eREB/P' +
'VMPd0Rp1g2hXSsKmfU1fxKXm4NCtV8y1Dh/6A08ePza51wIpAOhYq487okrVmgirVAVWVtZCt0M4ypfLMevH8Xhw7w4AYN+uwkVx' +
'jDkE7Nu7h7lGm2qlaclfwsXAFsF4Ep+JR28ymOqo1WosXfor5i9YxKkzcaDXAHWs/+DhqF6rLg3+Rubvg3+Rfbu2YtO6FQJ1pVsq' +
'lQqH/jjAVENqJkGzij6cOiKmrmj7aCsLKXOtXTt2IDExkUNX4kEBgJAS+q/Bv4ixhoBbN28gOZnt3f86ge5wsqUlqwk/3i426NuE' +
'fepeqVRg187tHDoSDwoAhJTAhwb/IsYYAk6dPMFco1kluvon/LWpVgb+HvbMdbZv3cKhG/GgAEBIMRV38C9ibCHg9OmTTMfbW8tQ' +
'1Y/2riD8mUkkGNwyhLlOTEw0IiNvcehIHCgAEFIMJR38ixhLCEhKSsK9u3eZatQJdKeH/4jOhJR2QjV/9oC5n8ODrmJBAYCQD9B2' +
'8C9iDCHg0sXz0DAuulK0gAshutKjPvu20idPHufQiThQACDkPVgH/yJiDwHXr19jOt7KQopwX2dO3RDy74JLOyHYx4mpxpPHj/Hy' +
'5QtOHRk2gw8AUinb6x1qtZrx/GxLJahUBUzHE+HwGvyLlDQEqFQqpvPx3Ob0+rWrTMdXKusCmdTgv26IEWhZhf1B05Mn2B94FQOD' +
'/4tkH4DZvkRlMhnT8Uqlkul4Igy5PA/Tp4zhNvgX2bdrK06fOFysn1UzfnZZw3OR7OxsPIyKYqpR3Z92/SP60TDEEzaWbOMGj82u' +
'xMDgA4C5OeMMAAUAUkJFy/tGR93nXjsoJBx16jcu1s8WMM4esX52i9y9ewcFBWy9VCpLG/8Q/bCUSVGNMXDevXObUzeGTQQBgHEG' +
'QM04jcr4JVpAAUBUeE/7vysoJBzjp8yEtbVNsX6eNbyam/MJAA/u32M63sFaBm9XWy69EFIctSqUYjr+xYvnSEtL5dSN4RJBAGD7' +
'ElMxXrlYWLCtWkYzAOJhSIM/ABQwBwA+twAePmSb/g8p7Qx6+Y/oU7XybkyfOY1Gw/zaqxgYfACQWbAFgPz8fKbjWWcAlAoF0/FE' +
'Pwxt8AcARb6c6bwWFpZMxxeJZrz/H1zakUsfhBSXg7UM3i4l+3v7u6dPn3LqxnAZfACwtWWbOpTL85iOt5CxzQDkM36JE90zxMEf' +
'APLy2D67rH87QOFbNDExbHuu+7mzL9FKSEkFeLMFz7jX7NsMGzqDDwB2dnZMx+fl5TIdb2FpxXR8ZibbNpVEtwx18AfYP7usfzsA' +
'kJiQwBxEylEAIAJgDZ6vKQAIz86W7UtMzvjl5ejEtqhERnoa0/FEdwx58AcAeS5bALDlEABevXrJdLyDtQwudnxuRZCSkStUkCvY' +
'niMRMw8nti3YX7+iACA4O3u2FJebm8N0vKMjWwDIzEhnOp7ohqEP/gD7LQAeMwCsK6KVpqf/BSFXqDBl201M2XbTZEOAuyNbAEgz' +
'gYs3ww8AdmwBIDszk+l4B0e25UszKAAYHDEM/gCQlcX22eURAF4xXgW5M16FkZIrGvyjXqcj6nW6yYYAJ1u257dyGWfgxMDgA4CT' +
'M+MUPOMA7ODI9iAJ3QIwLGIZ/AH2z46zM/viO/Fv3zId78F4FUZKRq5U4ccdkYh6/ef3XtTrdPyw7SbyFKa1LLmVjO01WNYZODEw' +
'+ADg6sq2ohPrFLwj4wwA3QIwHGIa/AH2z46rG/vyu+mMIYR1GpYUn1yhwpStN3Hv5T8XsIl+nY6p226Z1EyAtQXbInJ5NAMgPFdX' +
'tv2dWZ/Cd3RiCwDJyUlMxxM+xDb4A+yzV24cAkBKcjLT8azTsKR4/u3K/+9MbSZAasa2/JQpLOJm8AHAzY1tSUfWaVTWtwAS3r5h' +
'3kedsBHj4A9wmAFgnD0DgLR0th7srfgsR0z+W25+ASb/x5X/35niTAD5bwYfAFhnAFJT2a5g3Eq5QyLRPkkqFPlITWHrgWhPrIM/' +
'AKSmsM0e8ZgBSE9jC9D2NjQDoEuZeUpM3HwDD99z5f93pvxgIPkrgw8A7u4eTMcnJyYwHW9lZQ0nJ7aHqeLfxjEdT7Qj5sFfo9Ew' +
'3z5yK8U2ewYUBlgWdlZs92HJf0vLzsf4jdfxJL7kb4tQCCCACAKAl7c30xV4fn4+shifA/D09mE6/u2b10zHk5IT8+APFE7/s+wj' +
'YWZmBi8vL+Y+FIx7WcikBv8VI0ovk7Px/fpreJmcrXUNU3smgPyTwf91WllZMd8GSE5KZDreizkA0AyAPol98AeAJMaZq1Lu7lw2' +
'A2INAOYUALi78zwVYzZcQ2IG+2tq0a/TMXnbLQoBJkoUf52lS5dhOp71y9TLuzTT8W/jaAZAX4xh8AeAlGS20Frah+0zW4T1SWhz' +
'KW0EzNPhW68wZdtN5Mj5Ddj0YKDpEkUA8CnN9mXGeg+e9RbA82dPmI4nxWMsgz8AvGG8beTDGJqLqFRsg4IZw+078idFgRq/HnqA' +
'ZUcfQqXm/1YR3Q4wTaIIAKwzAKzbOrLOACQnJSI97cOv6BDtGdPgD7DPGpVmDM3EcMSl5OD7dVdx/I5ubyVGv07HlG23uM4uEMMm' +
'igBQtlw5puPfvmELAJ5e3pBK2ZaVfPb0MdPx5L8Z2+APsIdW1r8ZYhhO3XuDUWuv4Flill7O9/B1OkZvuIbkLLlezkeEJYoAUKFC' +
'ANPxrF+mFhaWKF2mLFONp08eMR1P/p0xDv4Ae2hl/ZshwkrLzsdPOyOx8OB9vd+bf5WcjbEbriMuhW0nVWL4TCIAZGVmMO+s5l8h' +
'iOn4WAoA3Bnr4J+RkY7sLLYrPv/yFTh1Q/RJA+Do7dcYuuIirj0WbhnxxIw8jNlwDdFxtJeJMRNFAPDw9GTe2vTl81im4/0ZQ8iT' +
'x9FMx5O/MtbBHwBePHvKdLyDgwM8PNgW0CL69zwxC+M3XseSw1EGcR8+M0+J8ZtuYN+1F6DFzI2TKJbpkkgk8PP3x727d7Wu8Tz2' +
'CcIqVtH6+PJazACYm5vDv0IggkLCERwaDo1Gw7SoESlkzIM/UPhZZVGerv5FJStPia0XnuKPm6+gNrB9QwpUaqw6GYN7L1Mx4uNw' +
'2FvT3g7GRBQBAAACA4PZAgDjVVVZv/IwNzdHQcF/J3MrK2sEBIUgODQcwaEVERQSxmUxFvInYx/8AeDFc7bPakBgIKdOiC7l5hfg' +
'wI2X2HP1OXLzhb/if59rj5MwYvVljGoXjopl2ZZGJ4ZDNAEgNCwMu3ZqfzxrAJDJZChT1u8vT/M7O7siODQcQaHhCA4Jh1/5ALrC' +
'1yFTGPwB4Hks22c1LLwip06ILuQpCgf+fddeICtPPFvOJmfKMXHzDTQK80K/poFwsaOLG7ETTQAIZ/xSe/3yBZQKBWQW2u9OVqde' +
'IwQGhyI4pPAK35Vxq2JSfKYy+CsU+XgTx/YGQGhYOKduCE9pOfk4cus1Dt58KaqB/10aAGcfvMXVR4n4tHY5dK3nR8s9i5h4AkBF' +
'tgCgUhUgNvYxgoLDtK7xaddeTD0Q7ZjK4A8ATx/HMK++F04BwGBoANx7kYqjt1/jUnSCTlbxE4JcqcKWC09x7mE8utTxQ5NwL0jN' +
'aPZTbEQT3ZydXeDl7c1U43H0Q07dEH0xpcEfAB7FsH1GS5cuA0cnJ07dEG3Fp+dh64WnGLTsPCZuvoHzUfF6HfydHe2xcf4E1K2m' +
'/QVPccSl5OCXP+5j0LLzOHDjJfKVtJ+AmIhmBgAAwsMq4u2bN1of/yjmAYAu/BoiOmVqgz8API6JYjo+NEy3X/jkv8Wl5uJyTAIu' +
'RifgaTzbuiMswgLLYeO8CfAr44WP6lRFl68n4/KtBzo9Z1KmHCuOR2P7xVg0CfdC4zAvVPB00Ok5CTtRBYAq1arh+PGjWh8f81C3' +
'fwSEH1Mc/AHgUTRbAKhevSanTsiHZOYp8eBlKiKfpSDyWQoS0tm352XVpU1jLPphGGysrQAAtjZW2L10Gj77biaOX7ih8/Nn5Cqw' +
'79oL7Lv2AmVcbdEozAsNQzzh7WJ4f2tEZAGgRg22L7e01BQkJSaglDstkmLITHXwT4h/y7xpVLUaNTh1Q96VIy/Ai+RsvEjMQsyb' +
'DMTEpSMuNVfotv6ftZUl5owZjIhPW/7rf9u0YCKGTJyH3UfP662nVyk52HTuCTadewI3BytU9HVBRV9nhJd1gaeTtd76IP9NVAGg' +
'arXqkEqlTA9JPbh3G02ateLYFeHJVAd/ALh/N5LpeKlUiipVqnLqxvjJlSoUqNRQawoX48nKUyA7T4nMPCUSMvKQmJGHxAw53qbm' +
'GvTmOGGB5bB69hgE+f33rqkWMnOsmPk9HO3tsGbnYT12Vyg5U47T99/g9P3CW7iONhbwdrGBj4stvF1s4O1iA1c7K1hZSGEpk8LO' +
'yhxWMim9YaBjogoAdnZ2CAwMwsOH2k+T3r8bSQHAQJny4A8UhlMWIaFhsLW15dSNfigK1IiNz8Sjtxl49CYDCRl5SM6UI1+pRrZc' +
'nK/K6Yu5VIoR/Tpj9KCesLT48Ap9UjMzLJj4FYL8ymDi/FUoYHzbhEVGrgIZuQo8fP3hvQbsrGSwlJmhlIM13B2tEOTthABvB/h7' +
'OMDCnAICC1EFAACoXqMmUwC4d+cWx24IL6Y++ANA1H22/+2st8j0JSNXgfNR8Tj3MB6P32QYzatx+hRc3hfLfhyFqqEl36NkSO8O' +
'CK7gi36jZyMtQz/bDLPIliuRLQdSsvIRHQeci4oHAEjNJAj0dkTDEE80DPWEo432a7yYKtEFgNp16mDjhnVaH5+WmoK41y/hU9qX' +
'Y1eEBQ3+QNzrl0hNSWaqUat2bU7d8KcBcCUmAcfuxOH2sxQa9LVkbWWJbwd0w/C+nWEh0/7ru0ntKji1cT4ivp2B+4+ecexQf1Rq' +
'DR6+TsfD1+lYdTIGVf1c0aJKadQJdAetSFA8ogsA9es3ZK5x9/ZNCgAGggb/Qncj2Z7QlkgkqFuvAadu+LrzPAVrTz8W9NU4Y9C6' +
'US3MHjMYZX34PMTsV8YLpzcvwLyV2zFn+RaoRRzKVGoNbjxNxo2nyShbyg49GpRHvWB62PtDRBcAPL28UL5CBTx9ov2OabduXEWb' +
'dp9y7Ipogwb/P926cZXp+ICAQIPcAvibNVfwhAZ+JmGB5TB1RD80r1+de22ZuTnGDumFulXD8OUPC/AmgW0WyhC8SMrG7D13aB2C' +
'YhDlExQNGjRiOj7q3m3I5cK/s2vKaPD/U75cznz/v35D9pkxXaDBX3s+nm5YOm0kzm/9VSeD/7sa166MSzsWo1+XNjAzkiV96bP3' +
'YaIMAPUbsH3ZKZVK5leuiPZo8P+ru7dvQqlke+Kdx60xYhh8PN0w6/tBuLlvOXp1aK63AdnJwQ4LJn6F05sWokbFIL2ckwhLpAGg' +
'AaRSKVONW9fZplyJdmjw/yfW6X+pVIp69etz6oYIxa+MFxZM/AqRB1ZiSO8OsLIU5qn2yiHlcXTdz5g3fig83JwF6YHohygDgLOz' +
'C6pWY5sSu371ItRqNaeOSHHQ4P9ParUaN65eZKpRvUZNODnRF7VY1akSirU/j8WNfb+jX5c2TE/38yI1M0P/bm1x++BKzPp+ENxd' +
'aYMpYyTKAAAAzVv8c8nLkshIT0N01D1O3ZAPocH/3z18cBcZGR9eDOV9mjdvwakboi+O9rYY2L0dLmz/FUfWzsEnLRpAamZ4X8fW' +
'VpYY0rsDbu5fjvFD+1AQMDKG94krJh5felcunuPQCX+nTxwxqocU5fI8TJ8yRieDf3BoOCZMnSXKwR8Arlxi/ww2b0krW4qB1MwM' +
'TWpXwe/Tv0XMiQ34edwQhAf6Cd1Wsdjb2mD0oB64d3gNlv04CpWCywvdEuGgOE+XML0c+iYhheXw96pZrTLi4l5rfbyTswt+X7sd' +
'EonhPPW6Y8s67NiyHkHBYRgv4oGtCF35/zeNRoMh/bojLVX7vxEfn9K4fov/77aIt4erzmqbAnOpFPWqh+OTFg3QoXk9uDk7Ct0S' +
'N1cio7D5wEnsO34BGVk5QrejE7ocv4qDw9/fewc34W82MWjarDk2rF+r9fHpaamIjrqPkLCK/JpiUDT4A0BM9APMmDxW1CGABv/3' +
'i466xzT4A0ALuvo3OKVcnNCsfjW0bFATTetWhZODndAt6USdqqGoUzUUP48dgmPnr2P7oTM4eekWcvMMd+Mk8leiDgAft2vPFAAA' +
'4PyZEwYRAN4d/IuIOQTQ4P9h506fYK7Rtl17Dp0QFl7urqhXLQx1q4WhQfWKCPIvY1CzirpmaSFD+2b10L5ZPeQrlLgc+QAnLt7E' +
'iQs3ER37Uuj2yHuI+hZAQUEBqlYKQwrDGuo2NrZYvn4HLCwsOXZWMv82+L9LbLcDaPD/MKVCgUF9uyInJ1vrGi4urrh9Lwrm5rrL' +
'8XQL4E+WFjL4+3ojoFxphAWUQ5XQCqgSUoFelXsPpyrthG6BCd0CMGDm5uZo2ao1tmzeqHWN3Nwc3Lx+BXXrN+bYWfF9aPAHxDUT' +
'QIN/8Vy/eolp8AeAth+30+ngb+ysLC3+/117e1sbONrbwsnBDk4Odijl4gQvd1eU8SoFL3dXlPPxRBlvd4N8Up8QbYn+26Nd+w5M' +
'AQAAzp0+LkgAKM7gX0QMIYAG/+I7d/o4c42PjWj6387WGq0b1UKjmpUQHuQPX293ONrbolSNT5jqpt8+yKlDIoSkG3uRkZWDF3EJ' +
'uP/oGc5du4Oj568jO8d43pISkugDQIOGjeDk5Iz09DSta9y+eR1paSlwdtbfdGdJBv8ihhwCaPAvvrTUFNyJvM5Uw8nJGfXqG+bu' +
'fyXh6eaC0YN7omf7prC2Eu42HDFMMnNzuDk7ws3ZEdXDA9G3UyvkyfOx49AZLFyzE7Gv3grdoqiJfj5LJpOhfYeOTDVUqgKcOnaY' +
'U0cfps3gX6QoBOTl5XLuSns0+JfMqeOHoVKpmGp0/ORTyGQyTh3pn5WlBcYP7YNbB5bji65taPAnxWZtZYnPOrXC1T3LMGXE57C0' +
'EO/fgdBEHwAAoEvXbsw1Thw9qJelgVkG/yKGFAJo8C8ZjUaDU8fZwyaPz7xQ/Mt44dTG+Rg9qAdsrK2EboeIlMzcHCP7dcH+FTNo' +
'hUItGUUAqFmrNvzLs61MlZKchMib1zh19O94DP5FDCEE0OBfcrdvXkNSYjxTDT9/f1SrXoNTR/pVMcgfR9f9jNCAckK3QoxE7coh' +
'OL1pIUIqlBW6FdExigAAAJ06d2WucfzwAQ6d/LvTJw5zG/yLxEQ/wMyp4wRZNpiW99XO8SPsD6V17dZDlO+Z+5fxwu5l01DKha7W' +
'CF8+nm7YsXgKzQSUkNEEgC5duzF/KUbevIq3DEsLv0+9Bh8hrGJl7nWjo+5j+g9j9DoTkC+XY/aPExAddZ977aCQcIybPBNWVtbc' +
'awst/m0cbl6/zFRDIpGgcxf2sKtvVpYWWDd3HA3+RGdKe5bCxgUT6ZmAEjCaAODrWxb1GzRkqqHRaHDowG5OHf2VpZUVxk6aoZMQ' +
'oM/bATTtr71D+3dDo2FaVwsNGzVGmTK+nDrSn2/6d0PFIH+h2yBGrlalYIwd0kvoNkTDaAIAAER89jlzjTMnjyArK5O9mX8h9hBA' +
'g7/2cnKycebkUeY6PD7j+ubp5oKvI9je5yekuL6K+BR+ZbyEbkMUjCoAtGn7MTw8PZlq5Ofn48RR3S0eItYQQIM/mxNHDjI/q+Hu' +
'7o6WrVpz6kh/Rg/uSU/7E72xkBW+HUA+zKgCgLm5OXr0YJ/+OXJgL5QKBYeO/p3YQgAN/myUSiUOH9zDXKdHz96ie/ff3tYGPds3' +
'FboNYmK6tmkMWxsKnR9iVAEAAHpHfAapVMpUIy0tBadO6HZhILGEABr82Z09dRSpDBtWAYCZmRl6R3zGqSP9adWoJtMiP6xr7xcw' +
'LrhEtMf6u2f5t7extkLLBjWZzm8KjC4AlC5dhss06b5dW1FQUMCho/9m6CGABn92arUa+3dvZ67TslVrUT7816hmJabjLRif6JbL' +
'dTeTR96P9XfP+m/fuDb/71VjY3QBAAAGDf6SuUZyUiLOn2Hfr/1DDDUE0ODPx4WzJxH/No65Do/PtBDCGZ/8t5CxbVci1+GtPPJ+' +
'efn5TMezvs4XRotNfZBRBoDadeqicpUqzHX27tzMvGZ7cRhaCKDBnw+1Wo09Ozcz16lUuTLq1K3HoSP9K+vjwXQ86yAgz6cAIBTW' +
'3z3rv3250mwPhJsCowwAAJ8rprdv4nD21DEO3XyYoYQAGvz5OX/mBOJevWSuM3jIUA7dCMPelu3fWsY6A0ABQDC5ctYZAAum4x3s' +
'bJmONwVGGwDate8Ib28f5jo7t67X6RsB7xI6BNDgz49KVYCdW9mXfvby9ka79my7XbKQydi+hFnZWLE9yZ3HOAgR7bE+A2BtKexn' +
'z8LC+HeoNNoAIJPJMPhL9iun5KREHDuiuz0C/k6oEECDP18njv6BhHj2vcoHDxkq6Kt/dnZ2TMdn5bC9ieLq5MB0fEZWDtPxRHsZ' +
'WdlMx7s4s/3bZ2az/duzfvbFwGgDAAD0ieiLUqVKMdfZu2OzXtfa13cIoMGfL4UiH7u3b2Ku4+rqhj4RfTl0pD1bW7Zp1BdxCUzH' +
'uzIOAm8SU5iOJ9p7k8D2u2fdN+L5a7ZdNykAiJy1tTWXZwEyMtKxb9dWDh0Vn75CAA3+/B3Ysx1pqewDz6DBX8LGRtjfnYurC9Px' +
'92JimY53c3ZkOv4tBQDBvE1i+92zzv7cf/SM6XgXF7bPvhgYdQAAgH79B8LFxZW5zoG9O5CUyHY1U1KWVlYYM2k6gkPDudcu2kqY' +
'tvTlKyM9Dfv3sL/37+DggL6f9+PQERt//wpMx5+7xvbZYp4BSGBbgIloj3UGgDUAnL3K9tnzL8/22RcDow8ANjY26D9wEHMdpUKB' +
'zetXcuioZKysrDFhymydbSVMW/rytWXDKuTlst8uGjBwMBwc2a5+eagQEMB0/NHz15kexGOdBqZbAMJ5k8gWvtxctP/85+TKcezC' +
'Dabzs372xcDoAwBQOJXq5ubGXOfS+dM6GTA/RJe3A3gz1Wl/AHjx7CmXHf8cHB0xcNAQDh2xCwoKZjo+OycPOw6d0fr4Ml7uTOen' +
'GQDhsM4A+Hpr/2+/4/AZ5ObJmc7P+tkXA5MIALa2thj69XDmOhqNButWLmXe010bYggBpjz4azQarF6+GGq1mrnWsGEj4OjEduXL' +
'S526dSGRSJhqLFyzE0otl9VmXcyF9UEwor3ncWy/+3I+2v3b5yuUWLB6B9O5zczMUKduXaYaYmASAQAA+n0xgMu6AE+fxOC4Hl8L' +
'fJchhwBTHvwB4OypY3j44C5zHQ8PD3wxgP2WFS+urm4IDg5hqhH76i2WbNir1bHaDgJFUtIzEZ+UylSDlNybhGSkZWRpfbxEItE6' +
'/C1ev4f57ZPQsHA4O9NDgEbD0tISI7/5lkutTetWIC1NmHuLhhgCTH3wz8nOwqa1y7nUGjHqW1hbG9azE40aN2GuMXPZJly987DE' +
'x9nZWjM/B8D6NDgpufuPnzMd7+7qBBvrki8CdSUyCrN/Z19+m8dnXgxMJgAAhfup+5cvz1wnLzcXm9au4NCRdgwpBJj64A8Am9ev' +
'REZGOnOdsmXLoXefCA4d8fVppy7MNfIVSkR8Mx1x8SW/J896G+AB42BESu4BY+jSZubn1dtERHw7Awol+y6unTp1Zq4hBiYVAMzN' +
'zfHD5Glcap0/cwL37tziUksbhhACaPAvfJ3yxNE/uNSaMGmy4Evv/ptKlStzeSAqMSUdXb6eXOIQEFyebRtk1sGIlBxr6Crpv/nr' +
'+CR0/XoKklLZg3hIaBhCw/i/em2ITCoAAIX7qjdu8hFzHY1Gg99+nafXFQL/TsgQQIM/oFQq8fuv87g8FFqjZi183K49h650o0ev' +
'3lzqPHzyAh/1Hlmi2wEVGbcUZp2OJiV3P4YtdIUH+RX7Z69ERuGjXqMQ/ZR94y0A6Mnpsy4GJhcAAGDqj9Nhbs62yxgAJCXGY+uG' +
'1Rw60p4QIYAG/0LbN6/F61cvmOuYmZlh2k8zmJ+216U+EX25PRSVmJKODgPHY8HqHcWarq3EGAAexb5i3pOAFF9GVg4eP3/NVKNi' +
'4If/zRXKAsxbuR0dBo3ncuUPFD702qu34d2G0xWTDACBgUHo2asPl1pH/tjL5elvFvoMATT4F3oW+wQH9+7kUqtL126oUqUql1q6' +
'Ymtry2VBrSL5CiWmLlqHWp8OwbrdR9/7znZYYDmmcFSgUuHSrQdaH09K5vKtB1AxvA4rkUgQFljuP/97Tq4ca3cdQc1PBuPHxeu5' +
'3PMvMnDwEMGX39bwhUjYAAAgAElEQVSn4vxVMc1vsi4GoSvJycloWL82MtLZk6OXtw/mLFwOS8atS1npcl1/gAb/IkqlEuO++RIv' +
'X7DfW7azs8P5i1fh4cn2oJs+ZGZkoEG9WkhO5r+4jq2NFVo2qIlGtSqhYpA/yvp4wNHeDhaywpm6qu0H4tkr7XdXHNa3E34c9QWv' +
'dsl7jJ+7Eks3avfaJwD4lfFC5IHCh6wVygJkZGXjRVwC7kbH4ty1Ozh24QbzIj//xsPDA+cuXoW9vT332try9mBexv69Y7zJBgAA' +
'WL9uDcaO/o5Lreat2mHQV6O41GKhqxBAg/+f1q1ahj/28bn6n/rjdINZ9a84tm/bipHDvxK6jRKrEloBZzYvFLoNk9Cg2zBRvnq5' +
'ZNnvXN544UnXAcAkbwEU6RPRF9Vr1ORS68TRg7hy8RyXWix0cTuABv8/3btzC4f27+JSKyQkFJ/368+llr507dYdderWE7qNErsX' +
'HYv0TLb96cmHpaZnIerJc6HbKLH69Rvgk09N49W/d5l0ADAzM8OcufO5PBAIACuWLRRsgaB38QwBNPj/KScnG0t/mcPlqf+iz55M' +
'JuPQmf5IJBIsXLTYIDYqKgmVWo2LN/W/j4epuXjzHtRq/S+VzsLJyRkLFi026IdwdcWkAwBQeBXW74sBXGplZWZg6S8/C7JXwN/x' +
'CAE0+P9Jo9Hgt0VzkZKcxKVer94R3Gaf9M3Xtyx+XbxUdF+Yh85cEboFo/fHaXH9jiUSCeYvXITSpcsI3YogTD4AAMCYcRNQrlzx' +
'3zt9nzu3rmPPDvalKHlgCQE0+P/V4YN7cPXyeS61PDw8MGHiD1xqCaVFy9ZcNtjSp0Nnrmq9KRH5MIWyAIfPXhW6jRIZPmIUWrdp' +
'K3QbgqEAAMDGxgY/z1/I7Ypm26Y1gq4S+C5tQgAN/n/19EkMt7X+AWDm7LkGs9sfi/ETJnFbIEgf0jKycO6asK/sGrNTl28hIytH' +
'6DaKrXOXbhg9drzQbQiKAsD/1K/fAL37fMallkajwaJ5M5CWKvzzAEDJQgAN/n+Vk5ONhXN+hFKp5FKvc5duRnPFIZFIMHvOPLRs' +
'1VroVopt34mLQrdgtPafuCR0C8XWqnUbLPjlV9HdxuKNAsA7Jk2eymXLYADISE/DL3OnQ6UyjCnH4oQAGvz/SqPRYPGCWUiI1/79' +
'83eVKlUK036azqWWoZDJZFi1Zr1oVk87ePISClQqodswOsoC8Uz/d+3WHctXruH28LeYUQB4h729PeZyvBUQdf8O1q5cyqUWD+8L' +
'ATT4/9P2zetw89plbvVmzZlnlHuMS6VS/DxvAb4aNsLgr6hSM7Jw+nKk0G0YnZMXbyEtI0voNt5LIpFgxMhvsHDREtG9faMrFAD+' +
'pslHTdGvP5+3AgDg6B/7cOLoQW71WP1bCKDB/5+uX7mI3ds3cqvXs1cftGn7Mbd6hkYikWDCxB+wZt1GODk5C93Oe63ZeUToFozO' +
'6h2HhG7hvRwcHPD7itUYM26CwYdUfTLplQD/i0KRjzatWuBhFJ/1w6VSc/zw088ICavEpR4PRSsGFhSoaPD/m7hXLzH++6+Ql8tn' +
'A5myZcvh+KmzsLOz41LP0L169RIjh3+Ny5cM83671MwMdw+tho+nm9CtGIWXbxJQpd0Ag33/v379BliwaLEoX/WjlQAFYGFhicVL' +
'lsHCwpJLPZWqAPNnT0NSYjyXejxYWllhzKTpmDB1Fg3+78hIT8PMaeO4Df7m5uZY8ttykxn8AaBMGV/s2rMf6zZsgpe3t9Dt/INK' +
'rca63TQLwMuanUcMcvB3d3fHL78uxfZde0U5+OsDBYD/EBIahvETJ3Grl5GehplTxyMnx3CWI7WysoaVlbXQbRiM/Px8zP5pIhIT' +
'+AW1Ud9+j2rVqnOrJyYtWrbG6bMXMXrseLi4MF/JcLV+9zFaE4ADhbIAG/ceF7qNv3B1dcPY8RNx4fJ1dO3Wnab834MCwHsMHDSE' +
'6ytbr1+9wJyfJnF7pYzwo9FosHj+TDx5FM2tZr169TF8hPAbRAnJwcEBI0d9i6s3IjH1x+kICQkVuiUAQHxyquhWrTNE+09cRFIq' +
'+46qPISEhmHaTzNw9UYkho8YZVKzbtqiZwA+ID09Da2aN8WrVy+51WzctCWGjhhNydSArF+9DAf38tnhDyhc7e/YybMoVaoUt5rG' +
'4sH9e9izexfOnj2Dh1EPoGbYO55F1dAAnN68QJBzGwONRoNGPUbgXkysIOc3MzNDSGgYGjf5CJ06dUZoWLggfegSbQdsAG7fjsQn' +
'7T+GQpHPrWab9p3Qb6D4tlU1Rvt2bcWmdSu41TMzM8OWbTvRsFFjbjWNVWpqCq5euYKYmGg8fvQIsbFPkJ6WjoyMDOTk5ECpVOj0' +
'/Nt+nYxWDcW5J4PQDp25gl4jf9LpOWQyC9ja2sLR0RFOzk4oXz4AFQICEBQUjDp16xrla7XvMvkAwPoL4BVAVq1YjkkTx3GpVaR3' +
'34Ho2LkH15qkZM6eOsZth78iY8ZNwIiR33CrR/5dt86f4MIFtv0ZqoRWwOlNC2g2TgtNe4/CrQePmWo0bNQY23bs5tSR8aG3AAxE' +
'/4GDuO8XvXn9Spw8+gfXmqT4rl4+j2WL+O7e2KJFKwwbPpJbPfLfvhgwiLnG7agnOEULA5XYkXPXmAd/AOjP4d+QaI8CQAnMW/AL' +
'Klbi9y6/RqPBimULcen8GW41SfHcibyBRXOnc73/HBAQiMXLfoeZGf1Z6UPLVq3h61uWuc6s3wxj904x+Xn5VuYaZcr4olnzFhy6' +
'Idqib6oSsLa2xvoNW+Dh6cmtplqtxqJ503Hx3CluNcn7PXxwD3NnTub6Noa9vT1WrF4Le3t7bjXJ+5mZmeGzz/sx17l+NxqHztAb' +
'AcV14OQl3Lz/iLlOv/4DIJVKOXREtEUBoIQ8PD2xYuUabosEAYUh4Nf5M3Hx/GluNcm/i3l4HzOnjkO+XM6tppmZGZYsW47AwCBu' +
'NUnx9OnzGWxs2BeyGj93JeT5un3g0BjI8xWYOH8Vcx1ra2v06NmLQ0eEBQUALdSoWQvTZ87iWlOtVmPx/Fm4fsUwl081BtFR9zF9' +
'8ljI5Xlc6078YQqat2jJtSYpHgdHR3TnMJA8fx2PJRv2cujIuP26fjdexCUw1+nd5zOD3zPCFFAA0FLvPp/hq2EjuNYsXDJ4Ks6e' +
'Osa1LgEe3LuDmVPHcR/8e/WOwJAv6XVOIQ0f8Q0sLdln5Oau3IbX8UkcOjJObxKSsWA1+1oZlpaWGPrVMA4dEVYUABiMnzAJnbt0' +
'41pTpVJh2aKfcfKYYe+uJSY3r1/BjKljkZfHZ33/Ik2bNcesOXO51iQl5+HhgR49ezPXyZPnY9qidRw6Mk6TFqxGbh77rbPeEZ/B' +
'08uLQ0eEFQUABhKJBPMX/oL69RtwratWq7F8yXwc2LuDa11TdPH8acydMRlKBd/7u8HBIVj62wqYm5tzrUu0M2z4SMhkFsx1dhw+' +
'izNXb3PoyLicvhKJ3UfZ1lwACjda++qr4Rw6IjxQAGAkk1lg+ao1qBAQwLWuRqPBhtW/YdumtVzfUzclhw/uwaK506FS8d30xcen' +
'NDZv3QEHBweudYn2vH18uDxUptFo8OWkBUjPNJxNu4SWmZ2DYVMWcfke6tW7j0HuEGmqKABw4Ozsgu079qBMGV/utXdt24Clv8zh' +
'PogZM41Ggx1b1mHN8sXcw5OLiyu2bNtJU5gGaOSob2Ftzb675dvEFIz7md/S0GI3etbvXJ6NsLGxMfnNsQwNBQBOPL28sG3Hbri7' +
'u3OvffbUMcyYwm+PemNWUFCAxQtmYseW9dxr29vbY/PWHdxnewgfXt7e3B4u23LgJPafoDdyDp25gq0H+axR8tWwERScDQztBcDZ' +
'vbt30bVzR2RmZnKv7Vc+AGMnTYezge2tbihysrMwb9ZU3L/Lf2lXS0tLbNq6A/Xq1edem/Ajl8vRsF5txMW9Zq7l5uyIy7uWoJSL' +
'E4fOxCclPRN1Ow9FYgr7dr9e3t44f/EqlzUbTAntBSAyFStVwtr1m7hMRf7ds6ePMfabL/H0/9q78/CYrj4O4N/JZCKRzRZLIhHR' +
'SEIR+5ogEWIvWmttLapvF+qlRVuKVnVF37YoLSq1tLprLVWitMVbbXVB7cTW0ipijWTeP9J5O43ILOece2fmfj/P43mKub9zqbn3' +
'd7bf2feL9Nje7sTxHEwcd7+Sl7/FYsFrC97gy98LBAYG4pEJj0qJdebsOQyf8DzydTquWE8FBVbc8+gLUl7+APDY45P58vdATAAU' +
'aNa8BZYufwfBwcHSY5/943dMGj+KtQLs/PD9Djw67gGclNDrK8psNuOll19FRvtM6bFJjZ69bkdycn0psbK3fY8Zc4x3VsCTr7yJ' +
'9V/ukBKrQYOG0g9SIzmYACjStFlzLFychcDAQOmx8/Ly8OrsZ7FsyeuG3yHw6cfv4ekpE3Ax94L02P7+/pgzbwG639ZTemxSx8/P' +
'D8+9MFPaFs3nF6ww1HqAT7O3Sin4AxR+h6bPeI7HLXsoj18D4O02f7EJgwf2xxWJteft1a6TjNHjHkO4wcpqXrt2FQvmzEb252uV' +
'xLf1/Hv0vF1JfFJv6hOTMHfOK1JihQQH4fOsF5FQPVpKPE+1/8hxpA0Yg/O5F6XE+9f9D+KxxydLiWVEqtcAMAHQwBebsjF08J24' +
'fFluGVqbChEVMeaRybilZqKS+J7m+LGjeOHpJ3As54iS+BaLBf95ZQ66de+hJD5p4/Lly0hvk4LDhw9JiZcYF4N1bz6HsBD5U3ue' +
'4HzuRWQMHItfDuVIiRdbvTo2ZG9RMgpqFFwE6ANSW7fBshUrlRWOOXP6N0waPwprP/lQSXxP8vWWbEz8933KXv6lSpXCgoWL+fL3' +
'AUFBQXh+5mxpw897Dh5Fv1HTfPLUwCtXr6HvqGnSXv4mkwnPPPsCX/4ejgmARpo0bYaV732I8uUrKIl//fp1vD7vJTw3fRIuXJC/' +
'BVFv165dxcL5r2Dms9Ok1/S3KV26NBYvWYqMjA5K4pP2WrRoKeWcAJsvd/yEEY++4FM7A/ILCjBswnP4asdP0mL2HzAQKamtpcUj' +
'NTgFoLH9+/ahb+9eOHHiuLI2wsuUxf2jH0G9Bo2VtaGlnCOHMOv5p5BzRM5QbnHCwsPx1tIVaNjIN/7O6G+XLl1Ch4y2OLB/v7SY' +
'Q3plYtbj90uLp6eHZ8zFa8tXSYsXW7061q3PRkhIiLSYRsU1AD4oJ+coBvTrjf379ilrw2Qy4bZe/XBH/8Fee2BNQUEBVn3wDpZn' +
'vYHr19WVQo6MjELWshVITExS1gbp64edO9G1cyby8uQN348f2R/jR4qfP6Cnp17JwnPzl0uLFxBQCh9/sgZ16taVFtPIuAbAB0VH' +
'x+DjVWvQrHkLZW1YrVa8v3IpHnloJA7s977CQb+eOompj41F1qLXlL78ExOT8NGq1Xz5+7i69eph/EQ5BYJsZsxdiidmL5IaU0uz' +
'Fq6U+vIHgImPPc6XvxfhCICOrl27ilEP3I8PP3hPaTtmsxldbrsDfQYM9fjRAKvVis/XfYLFr8/BVUVbJ21atUrBgoVv8lQ/g7Ba' +
'rRg8sD/Wfya3iNaoIb0wZfRQqTFVm/5qFp59Te7Lv21aOrKWruCef4k4BeDjCgoKMGXy45j/2lzlbcXG3YKR9/8bcbfUVN6WO47l' +
'HMH8V2di988/Km+r1+298eKs2VLOkCfvcebMGXRsny7lrAB7I/t3w9Pjhnv8y89qteKRZ+ZJnfMHgKpVo7F63Xpli5yNigmAQWQt' +
'WYxHJ4yXOkdZHJPJhPT2nTFw6D0I8pDa3NeuXcWH7y7HByuXIS8vT2lbJpMJY/49DmPGPuzxD2tS4+effkT3rp1wSfLpmn06t8Ur' +
'U0fD32yWGleW/IICjJ72Mpa8L3cEJDAwEB989Cnq1qsnNS4xATCUr776EiPuHoo//lD/d1aufAUMHX4fmrZIVd5WSXZ+9w1en/sS' +
'Tp1UtyvCJjg4GC+/Og8dMjsqb4s82yerPsaIYUOll9LOaNUIbzzzMEKDPSO5trl46QpGPPo8Ptm4VWpck8mEOfPms26GIkwADObo' +
'0SMYMnAA9uzZrUl7yQ0aY/CwfyGqaowm7dn8euokliyci+1fb9GkvZiYalj4ZhaSkmpp0h55vqenT8N/Zs+SHrdWfCyWz34cMZGV' +
'pMd2x4lfz6Df6GnYufuA9NijRo+Rdvoi3YgJgAHl5ubioVH345NVH2vSntnsjw6duuGOfoMQHBKqtK0rVy7jvbffwicfrlQ+3G+T' +
'ktoac+bNR7lywl8m8iEFBQW4e+ggrF2zWnrsiHJlsOTFiWiWrG/C+fW3P2Pgv6fjzNlz0mNnduyEBW8shp8fN5OpwgTAoKxWK16b' +
'NwdPTZuidBucvdDQMNzebxDapHWQvj7g3Lk/8cWGdVj1wUqcPavNvwmTyYQHRz2EsQ+Ph9lD52VJX1euXEHf3r2wfZvcoXEAKBVg' +
'wYuP3ocB3dtJj+2MN99bi7FPz8G1PPnPj6bNmmPZipUs9asYEwCD275tK+4ZcTd+PXVKszZLBQaiWYtUNG/VGkm16yIoyL1k4M+z' +
'f+DHnd9h+9eb8c32r5Gfr00iAwDhZcrgpZdfZVlfcuj8+fPo1aMbfv5Jze6T2zJaYfakBxAeqs0hQhcuXsK4p+di+aoNSuInJibh' +
'/Q9XIbxMGSXx6W9MAAinT5/GfSOHY8uWzZq3bTabUSM+AdXj4hEZVRWRUdEIDQtH6eBgBAYGIT8/H1cuX8aVq5dx5vRvOHn8GE6e' +
'OIb9e/cg5+hhze8XAOolJ2Pe/DcQE1NNl/bJ+/x66hS6demInJyjSuJHV6mI+U+PVT4lsOOnvRg+4TkczDmpJH5kZBQ+WrUakVFR' +
'SuLTPxk+ARD9C/CVBMRqteL1Ba9h2pQnlG8V9FYmkwl3DRuOSZOncH8/uezA/v3oeVsXnD59Wkl8i78/Jtw7AKOH3g4/P7lbUPML' +
'CvDi62/jmbnLcD0/X2psm4iICLz/4SeIq1FDSXy6ERMAJgD/sPP77/Gve4fj0MGDet+KR4mIiMCsl15B27R0vW+FvNi+fXtxR8/u' +
'+O2335S10bxBbcx6/H4kVI+WEm/PgaMY/eTL2PrdLinxilOpUiW8/e4HiI/3zCJivopnAdA/1EtOxtrPNqJ3n75634rHyOzYCdmb' +
'v+LLn4TFx9fEex+sQuUqVZS18fW3P6PVHQ9g/LOv4eIl98tdX7l6DTPmLkXrfqOUvvwrVqyIFSvf58vfB3EEwIut/2wdxo19SNMF' +
'gp4kLCwMj016AncOHKz3rZCPyck5itt7dFe2JsCmWlQlPDfhXrRv1cil69Zu/i/GPT0XR0/8qujOClWJjMTKdz9E9bg4pe1Q8TgF' +
'wASgROfPncOT06Yga8livW9FU23T0vH8C7NQJTJS71shH3X48CG0aOrai9ldXdNbYNIDgxAfW7XEz+09dAxTXlokvaLfzXy17RvE' +
'xlbXpC26ERMAJgBO+WTVx5jwyFicOXNG71tRKiwsDFOmPoU+/bz7HHbyDhIewE7z8zOhW3pLPDFqCGKrVv7H7x0/dQbPzV+OrA8+' +
'U7bIrzhGeX56KiYATACcdvbsH5g6ZTLeXr5Meo1zT9Ct+22YMm06KlXyjBKr5Pu0TABsAiz+6N+tHcbf2x8Wf3/8Z/F7mLv0I1y5' +
'qv3uHyM9Pz0REwAmAC7bvm0rHhn3b/zyyx69b0WKmJhqmD7jWaSl61NRjYxLjwTApnRQYZW9S5fdXygoyojPT0/CXQDksiZNm2Hd' +
'5xvxyIRHvbpUp8USgAdGjUb25q/48ifDuXT5iq4vf/J9TAB8lMUSgFGjxyB781fo3KWr3rfjsnYZ7bFx0xZMmPi4VycxRESeigmA' +
'j4uJqYb5ry/Cu+9/hNq31tH7dhyKq1EDb2Ytw5tZy1hxjIhIISYABtG8RUusWfc5nn3+RVSoUEHv27lBlchITH1yOjZu+hLtMtrr' +
'fTtERD6PiwAN6Nq1q1i7Zg2ylizGls1f6LZjwM/PDy1bpeDOgYPRsVNn+Pv763IfRDej5yJAT8Dnp764C4AJgFIHDxzA0reW4NNP' +
'V+HwoUPK2zOZTKh9ax106JCJvv0HICqq5MInRHpiAsDnp56YADAB0Mzhw4ewKXsjNmVvxJdbNuPChQtS4pYtWw4pqalo2zYdbdLS' +
'uY+fvAYTAD4/9cQEgAmALqxWK44dy8G+vXvxyy97sG/fXhw9fBi5F3Nx7s9zuHDhAnJzcwEAoaGhCA0NRVh4GMJCwxBTLRY1ExKQ' +
'mJiEmjUTlB6sQqQSEwA+P/Vk+ASAiEgvog/g8mXC8Puf5yXdjfZt8/mtLxYCIiLyUt9+PB+jh96OwFIBmrVp8ffHkF6Z2P7BXM3a' +
'JO/EEQAior9cvnwZ3/x3O9atW4M1n36K48ePCcX78/tVAIBjp07jyZeXYMUnG5XuuslMbYLp44YjLrpw2q1McheheBEREWjdpi0y' +
'2meides2CAsPl3Gb5CROARARKXTkyGF8tm4tPlu3Ftu2bsW1a1elxbYlADb//WEPHn1+Abb/IPecjnpJNTB97HC0bHjrP35dNAGw' +
'ZzabUfvWW5GR0QEZ7TNRp25dmEzOvELIXUwAiIgkys3NxeYvNmHD5+uxccPnOHHiuLK2iiYAAFBQYMV7a7/AzIXv4Oe9h4Xi164Z' +
'izF39UaP9inw87vxcS4zASgqMjIKbdPSkZbeDimprRESEqKsLaNiAkBEJEhlL78kxSUA9rZ+twtPz30Lm7btdClus+RaGD30dnRI' +
'bVxiL1xlAmCPowNqMAEgInKRlr38kmxaNhv1khyfafHVjp8wc+FKrP9yx03XCJhMJrRr2RBj7roDzRvUdhhz5+4DaN1vlMv3LANH' +
'B+RgAkBE5ITdu3dh44bPsfHz9di+fRvy8vL0viV0bNMUy2Y97vTnf/zlIF7J+gDvr92Mq9cK779UgAU9OqTgvjtvQ52EOKdj9Rs9' +
'Dauzt7l8z7JZLBY0adIUbdPS0Ta9HZKSaul9S17DExKAqwDc3sOy98ARZn9EJJ2n9PJLYjKZkL10llOjAPZO//EnFr27BgAwpFcm' +
'IsqVcen6nbsPoE3/0bqd81GSKpGRSEtrh7T0dmiVkorQ0FC9b8kj5ebmomaNaiIhrgIo8Sx1ZxKAMwDcTkOyN3+FmjUT3L2ciOj/' +
'du/ehY1/vfA9pZfviKujADJ4Su/fEY4O3NyePbuR1rqVSIgzACJK+oAzx6+dhUACsCl7IxMAInKLN/TyHVmzaTt27j7g8iiAu3bu' +
'PoA1m7Zr0paovLw8fPnlFnz55RY8OW3K/0cH2qalIyW1taFHBzZlbxQNcdbRB5wZAVgNINPdO0hISMT6jV/AbDa7G4KIDMQbe/mO' +
'aDkK4C29f0eMPDqQn5+P9DYp2Lv3F5EwnwLoXNIHnEkAZgEQWkr65FMzcNew4SIhiMhH+UIv3xF31wK4ypPn/kUZaXRgwfx5mPTY' +
'RNEwMwGMKekDziQAfQAsF7kLi8WCrKUrkJLaWiQMEfkIX+zlO6LFKICv9P4dsVgsaNy4CdLS2/nc6MDmLzbhzv59ZHwnegN4p6QP' +
'OJMAVARwysnP3pTFEoDJT0zF4KF3cTqAyGCM0Mt3RPUogC/3/h3xhdGB69evY9HC1zFtymQZL/8CAJVQuBDwppx9qW8F0FT0jgCg' +
'Zs0E9L9zIFJbt0F0dAyCg4NlhCUiD2PEXr4jKkcBjNL7d+QfowNp6Uiq5bhokl4uXryInJyj2JS9EcveyhKd87f3FYCWjj7kbAJw' +
'H4CXhW6HiIiw4a2ZaFA7XmrMH/YcQOt+xuz9U7HuBeDwPGg/J4MtA3BR6HaIiLxUVEgQ+iVEi82D/uW5+UJLqor19Nylwi9/E4B+' +
'CdGICgmSc1OklwsAVjjzQWfqAADAHwDmwcGKQiIiX5OV2Rh9a1YFAOTmXcfHB08KxZNdF0DWvv8ucVWwpEMjAMDyvcdw55r/Csck' +
'XcyBEzUAAOdHAADgeQC5bt0OEZGXstgdszupSaLwKIDVasWMeUsFo/xtxjw5vf9JTRL//3NLMUcLk1c4D+AFZz/sSgJwEsAUl2+H' +
'iMiLHcu9/P//rl+xDLrEVRGOuTp7G779eZ9wnB/2yOn9d42rgvoV/z5vIOfC5RI+TR5sEoDfnP2wKwkAAMwGsMPFa4iIvNbx3Cv/' +
'+LmMUQBAzloAWXP/j9v1/gHgxMUrxX+YPNl2AK+4coGrCUAeCgsDnXPxOiIizVnMfogJF9sTnnPh0j9+LmsUwLYWwF0y5/7te//A' +
'jX9mV8WEh8JidvX1QgL+BNAXwHVXLnLn/9ABAANdbYiISAtRYSEY1rA23u3bGWfGj8ALmSlC8eynAGw8YS2Airl/m+L+zK54ITMF' +
'Z8aPwLt9O2NYw9qICuOR8ApdBzAAwCFXL3R2F0BRHwO4B8ACCFYIJCISYTH7oWVMJDJvqYaONauhbqUK//j96HCxl0/RKQDg71EA' +
'vXYEqOz9A8X/mV0RHR6CsFIB6FmrBnrWKvyz/fDrGazeewRr9h/Bl0dPIC+/QKgNAgBYAQxD4cE/LnM3AQCAN1CYeSwAYBGIQ0Tk' +
'korBQehwSzV0TayOjBoxKBNY6qafrSrY+zxx8TLyrVaYTf/s60xumohVB09CpA9utVrxzLxlWDrrMZeuk9H7B4BHG994VHu+1YoT' +
'F8VGAKKLmXapW6kC6laqgEdSGuLitTx8nXMKH/9yEB/sPoij5y4ItWdQ+QBGAljsbgCRBAAA3kRhjYAsAOGCsYiIiuWol1+SyiHB' +
'8Pfzw/UC93qc1wusOHXxyg0FcpIj5IwCrN60zaVRAFm9/65xVdCoUtkbfv3UxSu4XuB+cuHv54dKwaVL/ExwgAXtakSjXY1ozO7U' +
'mqMDrvsThcP+bvX8bUQTAABYBaABCisPNZIQj4gIUWEh6BhfDZnx1U3uZf8AABIbSURBVJBRIwZhpQLcimP2MyEyNFiol3k898YE' +
'ACicP5cxCjBj3lKnzwhQOfcPiA//R4YGw+xiHQH70YHzV69h/YEcrN53GGv2HcGx8yw/U8R2FC74c3nOvygZCQAAHATQHIVnBkwF' +
'ECYpLhEZhNnPhOTKEeiSUB1dE6qjQZWKMElaYVQ1PEQoAcjJvYQmuLG3LGstgK0ugKMzAlTt+7d3VHAHgOiai6JrBw6ePYeP9xzC' +
'qr2H8MXhE7iWny8U34tdBDANhYV+pCzCl5UAAIU3NBvAcgBjUTg3waWfRHRTsnr5joiuAyhpVbyMUQCgsC6Ao1EAVfv+7R0XnP+X' +
'veI/rmw4RjVPxqjmyUYdHbiAwvK+L8CFIj/OkJkA2PwKYByA6QD6oXDLYFNwtwCR4VnMfmgRXQUd42NdnssXUdyiNFeUNCyu1Y4A' +
'1Sv/bcR3AIj9XZfEQDsLrAC+BrAEhdPrTtX2d5WKBMDmLIBX//oRAaAtgGYAEgHEAagAIBSAmpSfiDyCVr38koiOADgqjKPFWgDV' +
'c/82okWARP+uXeEDaweuobCHfwaFU+m7AWwFsPGvX1NKZQJg7zSAt//6QUTy3Y3CYULdt+SqnMt3l8opAED9WgAt5v5tcgSLAImu' +
'AXCXl6wduA5gNFws2auKVgkAEalhAjD5rx+6cWVfvh5UFAMqSkZdAAB4fv6KG+oCyJj7B4CJxez7L+q4aAIQpm4KwBX2awc8qO6A' +
'P4CXAdQEMAaFe/l1wwSAyHuVRuGi2656NN6gSkXcXvsWdKoZi3qVtZnLd5eqYkD2VNUFUL3v316+1YqTggcBRYUFC12vQnF1Bz7d' +
'exgrf96PHSekrqtz1oMAYlG4Tk5szkUAEwAi7xSGwhocYoXuXdQoqiLuqB2P22vfgriy3lP7S1UxoKJUrAXQau4fkFMEqHKI5yUA' +
'RdnWDoxPaYSDZ89h5c/78c7P+/DNcU2TgW4AVqMwgT+vZcM2TACIvE9ZFD44mmrRWCl/M7olxGFMi/poFl1ZiyalM/uZUCU0GDkK' +
'igHZk70WwN/sp9ncPyB+CJA7RYD0Flc2HA+3aoiHWzXEdydPY+5/f0TWzj24lKfJeXepADYAyIQGi/6KYgJA5F0qoHCF8K2qG6oc' +
'UhqjmidjWMPaqFC65BefN4gODxFKAG5WDKgomXUBACjf929PNAGoqtMCQFnqV4nAvG5peKpdcyzY8TNmf/09TuUqH6FviMIkoC2A' +
'31U3Zo8JAJH3CAewFopf/mWDSmFcy4Z4sFk9BAfovqlAGtU7AWxk1gWQwdG+f3vCCYCPHPtboXQQxqc0wgNN62H21u/x3JZv8eeV' +
'qyqbrANgDYB0aDgd4KdVQ0QkJBjAJyg8d0OJIIs/xqc0woHRQzAhtZFPvfwBtcWAiprUJFG48pnVatVs7t/Gk4sA6SE4wIKJqY1x' +
'8KEheCSlIQL9zSqba4TCdT0ln6QkERMAIs/nD+AdAC1VNdC2elXs/Fd/PJ3RAmWDPGsLnyyqiwHZs40C6M2V3j/gXUWAtFQ2qBRm' +
'ZLTED/cNQJvqVVU2lYLC77rSTMOGCQCR55sJoKOKwGUCS2FetzR8PqQn4ss7/6LwRlpNAdhMbio+CiDqUSf2/dvz1iJAWokvXwYb' +
'hvTE4p4ZKF86UFUznQC8qCq4PSYARJ7t/r9+SJdRIwa7HxyIEY1u1b1Snxa0KAZkLzmiDLrqOArQzYl9/0WdEJwC8NURAHsmEzAo' +
'OQk/3X8n2tWIVtXMgyg8XVcpJgBEnisdwCzZQc1+JkxJa4Y1g7qjcohm0426k1UMyBWPS1gL4A5XVv7b5FutOCF4EqAREgCbyiGl' +
'sXbQbXiibVNVWx9nAUhTEdiGCQCRZ4oE8BYkzwVWDimNdYN6YFKbJvAzQrffjq0YkLtsxYBcUb+iPqMAzu77t2eUIkAy+ZlMmNy2' +
'KdYOug2V5CfT/gCWAlD2D4gJAJHnMQN4E0AlmUFrRZTDtnv6IC1O6SImj2UrBiTCnVXyk3RYC+BMzf+ijFgESJb0uGhsG9EHSRHl' +
'ZIeuBGAZFC0KZAJA5HmmoHD4X5qUapHYMuwOxPjYNi1Xia4DyHGjKIzWawHcmfsHWARIVLUyodgy7Ha0jJH+/7o1gEmygwJMAIg8' +
'TVMA42UG7FXrFqwb3MNnt/e5QuudADZarQVwZ+7fhkWAxJULCsRng3ugx18HOUk0EUBj2UGZABB5jlIA3oDE4b6etWpgee9M1QVM' +
'vIaWxYDsaVUXwJ25f5tjF8QSAKOPLtkEWfzxTp9O6HNrTZlh/VE4LSi1JjcTACLPMR1ALVnBuiRUx/I7OgotfPM1WhYDKkpGdcCS' +
'iPT+AfERgCiOAPyf2c+EN3tloFPNWJlhE1E4PSgNnwxEnqEOCvf+SpEeF413+nSCxcyvuD29pgAA9aMAIr1/gEWAZAswm/Fe387I' +
'jK8mM+wYAPVkBePTgUh/JgBzIOlwrnqVK+DD/l047F8MrYsBFaVqFEC09w+wCJAKpfzNeKdPJ9StVEFWSDOAlwA5/4yYABDpbxAk' +
'1fkvXzoQ7/Xr7HMH+ciiRzEge6pGAUR7/zKKAPnaQUCyhARY8NGArogIljZ9nwqgv4xATACI9BUMYIaMQBazH97t2xlxZcNlhPNJ' +
'ehQDKurORPnlYwcIxpRRBKhSsHGqSrqqWplQvN27o8wpuWch4dRAJgBE+noQQGUZgWZmpqJ1bJSMUD5Lr2JANkt2H8Vdn+0Qar84' +
'd322A0t2H3X7etGpjSoGLgLkrDbVq2JmZqqscJGQcEYIEwAi/ZQBMFZGoMz4avhXk7oyQvk8PYoBXcnPx0ObfsDQz3bgYl6+UPvF' +
'uZiXj6Gf7cCQde7FPyp4DHAMFwA65b6mddElobqscOMBuF7xyQ4TACL9jAUgXDs0IjgIi3pkGOJEPxm03gmw+48LaLI8G//ZeUCo' +
'XWdk7TmK5m9nY/cfF1y67rjg/D+3ADpvfvd0WesByqJwV4DbmAAQ6SMMko75ndO1rYqDSHyWlsWAsvYcRfMV2dj1+3mhNl2x6/fz' +
'aLJ8Ixb8dNjpa1gESDuVQ0pjfndplb4fBOD2oh8mAET6GAGBL67NgLoJ6FXrFgm3YxxaFAO6dD0fw9Z/iyHrdiA377pQe+64fD0f' +
'Izd8h2Hrv8Wl646nBFgESFvdE+PQt46USoFhAO5292ImAETas0BC0Z+QAAueaS9l96ChqJ4C+OVsLlq+vQmLdh0RakeGRbuOoMmy' +
'jfjJwQgEiwBp7/kOrWRt130IQIA7FzIBINJeHwDCe8EmpjZmz8sNoi+rkhKAJbuPosnyDfjxzDmhNmTac/YCWr6dXeIugeM8CEhz' +
'UWEhGJ/SSEaoqgB6uXMhEwAi7Y0QDRBXNhwPtagv414MR7gYUO6VG4oBqV7lL6qkXQL5VitOCtY2YBEg94xr2QDx5d0v4GRnuDsX' +
'MQEg0lYCgFaiQaalN2OpXzeJFgPKt/6zGNAuDVf5i7LtEthlt0uARYD0U8rfjEltmsgI1QaAy4uBmAAQaetuCNbxrlEuHL1vjZd0' +
'O8YjsxhQ4Sr/jZqu8he16/fzaGq3S0B0AWAkiwAJ6VcnQcYogAnAXa5eJOXwESJyih+AO0WDTExtrNkRv6ZJLwldb50q7YBDqaLD' +
'Q5BzzrW98vZ+OXsBr/10yCMW+rnDtktg66k/0DpK7KCaqh68ANAb/v2a/UwY16oBRny4QTTUIACPAShw9gKOABBppyUAoZNgYsJD' +
'MbCe2KlvJL4OYOSG77z25W9v0a4jGLnhO6EYXAAobnBykoy/xygAzVy5gAkAkXbcWqlr74Fm9WQeKGJYog/bq/lOd7LcEhxgwcIe' +
'GVjYI0P5yY6ifxYmAOICzGbc37SejFAuPWP4JCHShglAD5EA/n5+uJO9fyk8edV6YoWy+Hp4bwypn4Qh9ZPwzci+qFOpvN63dVOs' +
'AijH4PpJMpL7O+DCGiMmAETaqAcgRiRAl4TqqMySv1J4aq91cPKNL3xbQjA4OUnHO7s51qKQo3JIaXSMjxUNEw2gjrMfZgJApI0M' +
'0QB3N6gl4z4InpcABFn8MatjKhb1LH7IPzjAgkU9M7D4Jr+vJ1YBlOcuOd/xds5+kAkAkTaETv+ICA5CZnw1WfdieJ700qoVUQ7f' +
'jOyLUc2THX52UHIStt/TB7UihA+RlMbTkilv1rlmLMqXDhQNwwSAyIOUgmDxn47xsZpt/TMC0WJAsgx244VeK6Ictt/TxyOmBPz9' +
'/FA5RKymAv3N389PxjRAKpw8G0D/bwCR76sPQOgp2TWhuqRbIUBOMSARjob8HfGUKQEWAZKvc81Y0RDBABwPJ4EJAJEWGotcbDH7' +
'IaOG0PpBKoZe0wCJFcpi24g+Tg35OzKomEWDWvKkqRRf0TE+VsZuAKeeOUwAiNQTOvKrVUwkwgPdOu2TSqDH3HVxq/xF6blLgDsA' +
'5AsPDEDzaKF6YYCTzxwmAETqCY0AtIgRfhhQMbRMAEpb/LGwR4bbQ/6O2KYEFvbIQGmLdhXeuQBQjZbi33kmAEQeIABATZEATatW' +
'lnQrZE+rYkCJFcpi64g+GFJffQ99SP0k7Li3n2ZTAiwCpEbjqEqiIRIBOMw0mQAQqVUDgNC5vY0iK0q6FbKnRe91YL1EzefobWsM' +
'RjS6VXlbnnwQkDdrJp70+wOIdfQhJgBEagmd2xsTHqrranVfpjIBCPQ3Y1bHVLzZq70uq/SDLP6Y1y1N+S4BTgGoUSU0WMb6Cocj' +
'j0wAiNQSSgBu9eAa8N5O1Qp2Vwr7qDYoOQnbRvRWVjiICYA6EkaNHCYA2q0WITImof171cuGyboPKsJWDOh6gbyT/QbWS8Scrm2d' +
'7nVrcV597Yrl8c3Ivhi9+gu89s1PQu3ZYxEgtWLLCH/3ox19gCMARGoJreapFs4EQBWZxYD0HvJ3RMWUAIsAqVWtjPACS4fPHiYA' +
'RGoJreDjCIBaMqYBEiuUxfZ7PGPI3xGZhYNYBEgtCd99h88eJgBEakWIXMxtVmqJzmGrKOyjmqzCQSwCpJaE0T8mAEQ6KytyMSsA' +
'quVuAqC6sI9qMgoHcQGgWhK++w6fPUwAiNQSOtvTG18u3sSdl5iWhX1UEykcpFUhJaOS8N0v5egDTACI1HL4JSyJlmVdjcjVl5ge' +
'hX1Uc7dwENcAqBVsEU4AHHY+mAAQqSWUAEh4CFAJnB0B8PRV/qLc2SXAKQC1JPw7c5gAsHtBpJbQt7iUv1AVYXLAmV5srYhyeLtP' +
'R9Su6Du9/psZlJyEhpEV0XvFauw6/UeJn2UCoFag+Hff4SICjgAQkWHZigHdzMB6idh+Tx9DvPxtbIWDhje8+ZQAiwD5BiYARGRY' +
'NysG5OtD/o4EWfzxWvebTwmwCJBvYAJARIZWdBrAmwr7qHazwkFcAOgbmAAQkaHZz2X74ip/UbZdAvZTAlXDuAXQFzABICJDiw4P' +
'NfyQvyNFpwQ4AuAbuAuAiAytdWwUhtZPMtRCP3fZdgkcPHte71shCZgAEJGhdU2orvcteJXaFcszWfIRTACIiHRinfqg3rdABsY1' +
'AERERAbEBICIiMiAmAAQEREZEBMAIiIiA2ICQEREZEBMAIiIiAyICQAREZEBMQEgIiIyICYAREREBsQEgIiIyICYABARERkQEwAi' +
'IiIDYgJARERkQEwAiIiIDIgJABERkQH5630DRERGZZr0ktD11qkPSroTMiKOABARERkQEwAiIiIDYgJARERkQEwAiIiIDIgJABER' +
'kQExASAiIjIgJgBEREQGxASAiIjIgJgAEBERGRATACIiIgNiAkBERGRATACIiIgMiAkAERGRATEBICIiMiAmAERERAbkr/cNEBEZ' +
'lXXqg3rfAhkYRwCIiIgMiAkAERGRATEBICIiMiAmAERERAbEBICIiMiAmAAQEREZEBMAIiIiA2ICQEREZEBMAIiIiAyICQAREZEB' +
'MQEgIiIyICYAREREBsQEgIiIyICYABARERkQEwAiIiIDMul9A0Q+zqr3DRCRYZX4jucIABERkQExASAiIjIgJgBEREQGxASAiIjI' +
'gJgAEBERGRATACIiIgNiAkBERGRATACIiIgMiAkAERGRATEBICIiMiAmAERERAbEBICIiMiAmAAQEREZEBMAIiIiA2ICQERERERE' +
'RERERERERERERERERERERERERERERERERERERESko/8BXdk/jkRh35gAAAAASUVORK5CYII=';
RESPONSE_PAGE =
'<!doctype html>'+sLineBreak+
'<html lang="en">'+sLineBreak+
'<head>'+sLineBreak+
' <title>Authentication Result</title>'+sLineBreak+
' <meta name="viewport" content="width=device-width, initial-scale=1">'+sLineBreak+
'</head>'+sLineBreak+
'<body>'+sLineBreak+
'<style>'+sLineBreak+
' hr'+sLineBreak+
' {'+sLineBreak+
' border: none;'+sLineBreak+
' height: 1px;'+sLineBreak+
' background-color: rgb(171, 171, 171);'+sLineBreak+
' }'+sLineBreak+
' div.container'+sLineBreak+
' {'+sLineBreak+
' position: fixed;'+sLineBreak+
' font-family: Arial;'+sLineBreak+
' font-size: 12pt;'+sLineBreak+
' max-width: 100%;'+sLineBreak+
' max-height: 100%;'+sLineBreak+
' top: 50%;'+sLineBreak+
' left: 50%;'+sLineBreak+
' transform: translate(-50%, -50%);'+sLineBreak+
' }'+sLineBreak+
' div.section'+sLineBreak+
' {'+sLineBreak+
' display: inline-block;'+sLineBreak+
' margin: 15px;'+sLineBreak+
' padding: 5px;'+sLineBreak+
' float: left;'+sLineBreak+
' }'+sLineBreak+
' div.image img'+sLineBreak+
' {'+sLineBreak+
' height: 100%;'+sLineBreak+
' }'+sLineBreak+
' div.text'+sLineBreak+
' {'+sLineBreak+
' padding-top: 15px;'+sLineBreak+
' }'+sLineBreak+
' div.text2'+sLineBreak+
' {'+sLineBreak+
' font-size: 18pt;'+sLineBreak+
' }'+sLineBreak+
' span.title'+sLineBreak+
' {'+sLineBreak+
' font-size: 26px;'+sLineBreak+
' }'+sLineBreak+
'</style>'+sLineBreak+
' <div class="container">'+sLineBreak+
' <div class="section image">'+sLineBreak+
' <img src="#ADD_IMAGE_HERE#" width="256" height="256">'+sLineBreak+
' </div>'+sLineBreak+
' <div class="section text">'+sLineBreak+
' #ADD_TEXT_HERE#'+sLineBreak+
' <p>#ADD_TEXT2_HERE#' + sLineBreak +
' </div>'+sLineBreak+
' </div>'+sLineBreak+
' </body>'+sLineBreak+
'</html>';
begin
if aAuthorised then
result:=RESPONSE_PAGE.Replace('#ADD_IMAGE_HERE#', GRANT_IMAGE)
.Replace('#ADD_TEXT_HERE#', 'Authorisation Completed. '+
'You can close this page and return to the application')
.Replace('#ADD_TEXT2_HERE#', 'Icons made by ' +
'<a href="https://creativemarket.com/eucalyp" title="Eucalyp">' +
'Eucalyp</a> from <a href="https://www.flaticon.com/" title="Flaticon">' +
' www.flaticon.com</a>')
else
result:=RESPONSE_PAGE.Replace('#ADD_IMAGE_HERE#', DENY_IMAGE)
.Replace('#ADD_TEXT_HERE#', 'Authorisation Completed. '+
'Authorisation was denied');
end;
function TOAuthGMail.CreateAuthorizationRequest: string;
var
scopes: string;
begin
inherited;
scopes:='https://www.googleapis.com/auth/userinfo.profile+' +
'https://www.googleapis.com/auth/userinfo.email';
result:='https://accounts.google.com/o/oauth2/v2/auth'+
'?scope=' + scopes
+ '&state=profile'
+ '&redirect_uri='+ EncodeURL(CallbackURL)
+ '&response_type=code'
+ '&client_id=' + fClientID
+ '&approval_prompt=force'
+ '&access_type=offline'
+ '&hl=en';
result:='GET '+ result;
end;
function TOAuthGMail.CreateAuthToAccessRequest(
const aAuthToken: string): string;
begin
inherited;
result:='https://oauth2.googleapis.com/token' +
'?client_id=' + fClientID +
'&client_secret=' + fSecretID +
'&redirect_uri=' + EncodeURL(CallbackURL) +
'&code=' + aAuthToken +
'&grant_type=authorization_code';
result:='POST ' + result;
end;
function TOAuthGMail.CreateRefreshRequest(const aRefreshToken: string): string;
begin
inherited;
result:='https://oauth2.googleapis.com/token' +
'?client_id=' + fClientID +
'&client_secret=' + fSecretID +
'&refresh_token=' + aRefreshToken +
'&grant_type=refresh_token';
result:='POST ' + result;
end;
end.
|
unit Atributos;
interface
uses
Base, Rtti, System.Classes;
type
// TTipoCampo = (tcNormal, tcPK, tcRequerido);
TCamposAnoni = record
NomeTabela: string;
Sep: string;
PKs: TResultArray;
TipoRtti: TRttiType;
end;
TFuncReflexao = reference to function(ACampos: TCamposAnoni): Integer;
AttTabela = class(TCustomAttribute)
private
FNome: string;
public
constructor Create(ANomeTabela: string);
property Nome: string read FNome write FNome;
end;
/// <summary>
/// Atributos de Chave Primaria e Relacionamentos
/// </summary>
AttPK = class(TCustomAttribute)
end;
/// <summary>
/// Atributos de Validação
/// </summary>
AttBaseValidacao = class(TCustomAttribute)
private
FMensagemErro: string;
procedure SetMessagemErro(const Value: string);
public
property MessagemErro: string read FMensagemErro write SetMessagemErro;
end;
AttNotNull = class(AttBaseValidacao)
public
constructor Create(const ANomeCampo: string);
function ValidarString(Value: string): Boolean;
function ValidarInteger(Value: Integer): Boolean;
function ValidarFloat(Value: Double): Boolean;
function ValidarData(Value: Double): Boolean;
end;
AttMinValue = class(AttBaseValidacao)
private
FValorMinimo: Double;
public
constructor Create(ValorMinimo: Double; const ANomeCampo: string);
function Validar(Value: Double): Boolean;
end;
AttMaxValue = class(AttBaseValidacao)
private
FValorMaximo: Double;
public
constructor Create(ValorMaximo: Double; const ANomeCampo: string);
function Validar(Value: Double): Boolean;
end;
// Reflection para os comandos Sql
function ReflexaoSQL(ATabela: TTabela; AnoniComando: TFuncReflexao): Integer;
function PegaNomeTab(ATabela: TTabela): string;
function PegaPks(ATabela: TTabela): TResultArray;
procedure ValidaTabela(ATabela: TTabela);
procedure SetarPropriedade(AObj: TObject; AProp: string; AValor: Variant);
implementation
uses
System.TypInfo, System.SysUtils, Forms, Winapi.Windows, System.Variants;
procedure SetarPropriedade(AObj: TObject; AProp: string; AValor: Variant);
var
Contexto: TRttiContext;
TipoRtti: TRttiType;
PropRtti: TRttiProperty;
begin
Contexto := TRttiContext.Create;
try
TipoRtti := Contexto.GetType(AObj.ClassType);
for PropRtti in TipoRtti.GetProperties do
begin
if CompareText(PropRtti.Name, AProp) = 0 then
begin
PropRtti.SetValue(AObj, System.Variants.VarToStr(AValor));
end;
end;
finally
Contexto.free;
end;
end;
function ReflexaoSQL(ATabela: TTabela; AnoniComando: TFuncReflexao): Integer;
var
ACampos: TCamposAnoni;
Contexto: TRttiContext;
begin
ACampos.NomeTabela := PegaNomeTab(ATabela);
if ACampos.NomeTabela = EmptyStr then
raise Exception.Create('Informe o Atributo NomeTabela na classe ' +
ATabela.ClassName);
ACampos.PKs := PegaPks(ATabela);
if Length(ACampos.PKs) = 0 then
raise Exception.Create('Informe campos da chave primária na classe ' +
ATabela.ClassName);
Contexto := TRttiContext.Create;
try
ACampos.TipoRtti := Contexto.GetType(ATabela.ClassType);
// executamos os comandos Sql através do método anônimo
ACampos.Sep := '';
Result := AnoniComando(ACampos);
finally
Contexto.free;
end;
end;
function PegaNomeTab(ATabela: TTabela): string;
var
Contexto: TRttiContext;
TipoRtti: TRttiType;
AtribRtti: TCustomAttribute;
begin
Contexto := TRttiContext.Create;
TipoRtti := Contexto.GetType(ATabela.ClassType);
try
for AtribRtti in TipoRtti.GetAttributes do
if AtribRtti Is AttTabela then
begin
Result := (AtribRtti as AttTabela).Nome;
Break;
end;
finally
Contexto.free;
end;
end;
procedure ValidaTabela(ATabela: TTabela);
var
Contexto: TRttiContext;
TipoRtti: TRttiType;
PropRtti: TRttiProperty;
AtribRtti: TCustomAttribute;
ListaErros: TStrings;
begin
try
if not Assigned(ATabela) then
raise Exception.Create('Tabela não foi passada no parâmetro!');
ListaErros := TStringList.Create;
try
Contexto := TRttiContext.Create;
try
TipoRtti := Contexto.GetType(ATabela.ClassType);
for PropRtti in TipoRtti.GetProperties do
begin
for AtribRtti in PropRtti.GetAttributes do
begin
PropRtti.PropertyType.TypeKind;
if AtribRtti is AttMinValue then
begin
if not AttMinValue(AtribRtti)
.Validar(PropRtti.GetValue(ATabela).AsExtended) then
ListaErros.Add(AttBaseValidacao(AtribRtti).MessagemErro);
end;
if AtribRtti is AttMaxValue then
begin
if not AttMinValue(AtribRtti)
.Validar(PropRtti.GetValue(ATabela).AsExtended) then
ListaErros.Add(AttBaseValidacao(AtribRtti).MessagemErro);
end;
if AtribRtti is AttNotNull then
begin
case PropRtti.PropertyType.TypeKind of
tkFloat:
begin
if CompareText(PropRtti.PropertyType.Name, 'TDateTime') = 0
then
begin
if not AttNotNull(AtribRtti)
.ValidarData(PropRtti.GetValue(ATabela).AsExtended) then
ListaErros.Add(AttBaseValidacao(AtribRtti).MessagemErro);
end
else
begin
if not AttNotNull(AtribRtti)
.ValidarFloat(PropRtti.GetValue(ATabela).AsExtended) then
ListaErros.Add(AttBaseValidacao(AtribRtti).MessagemErro);
end;
end;
tkInteger:
begin
if not AttNotNull(AtribRtti)
.ValidarInteger(PropRtti.GetValue(ATabela).AsInteger) then
ListaErros.Add(AttBaseValidacao(AtribRtti).MessagemErro);
end;
else
begin
if not AttNotNull(AtribRtti)
.ValidarString(PropRtti.GetValue(ATabela).AsString) then
ListaErros.Add(AttBaseValidacao(AtribRtti).MessagemErro);
end;
end;
end;
end;
end;
finally
Contexto.free;
end;
if ListaErros.Count > 0 then
raise Exception.Create(PChar(ListaErros.Text));
finally
ListaErros.free;
end;
except
raise;
end;
end;
function PegaPks(ATabela: TTabela): TResultArray;
var
Contexto: TRttiContext;
TipoRtti: TRttiType;
PropRtti: TRttiProperty;
AtribRtti: TCustomAttribute;
i: Integer;
begin
Contexto := TRttiContext.Create;
try
TipoRtti := Contexto.GetType(ATabela.ClassType);
i := 0;
for PropRtti in TipoRtti.GetProperties do
for AtribRtti in PropRtti.GetAttributes do
if AtribRtti Is AttPK then
begin
SetLength(Result, i + 1);
Result[i] := PropRtti.Name;
inc(i);
end;
finally
Contexto.free;
end;
end;
{ TNomeTabela }
constructor AttTabela.Create(ANomeTabela: string);
begin
FNome := ANomeTabela;
end;
{ TBaseValidacao }
procedure AttBaseValidacao.SetMessagemErro(const Value: string);
begin
FMensagemErro := Value;
end;
{ TValidaIntegerMinimo }
constructor AttMinValue.Create(ValorMinimo: Double; const ANomeCampo: string);
begin
FValorMinimo := ValorMinimo;
FMensagemErro := 'Campo ' + ANomeCampo + ' com valor inválido!';
end;
function AttMinValue.Validar(Value: Double): Boolean;
begin
Result := Value >= FValorMinimo;
end;
constructor AttMaxValue.Create(ValorMaximo: Double; const ANomeCampo: string);
begin
FValorMaximo := ValorMaximo;
FMensagemErro := 'Campo ' + ANomeCampo + ' com valor inválido!';
end;
function AttMaxValue.Validar(Value: Double): Boolean;
begin
Result := Value <= FValorMaximo;
end;
{ TValidaStringNaoNulo }
constructor AttNotNull.Create(const ANomeCampo: string);
begin
FMensagemErro := 'Campo obrigatório não informado: ' + ANomeCampo ;
end;
function AttNotNull.ValidarString(Value: string): Boolean;
begin
Result := not(Value = EmptyStr);
end;
function AttNotNull.ValidarInteger(Value: Integer): Boolean;
begin
Result := not(Value <= 0);
end;
function AttNotNull.ValidarFloat(Value: Double): Boolean;
begin
Result := not(Value <= 0);
end;
function AttNotNull.ValidarData(Value: Double): Boolean;
begin
Result := not(Value = 0);
end;
end.
|
unit dcBooleanEdit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
LMDCustomControl, LMDCustomPanel, LMDCustomBevelPanel, LMDBaseEdit,
LMDCustomEdit, FFSMaskEdit, dcEdit;
type
TdcBooleanEdit = class(TdcEdit)
private
FTestString: string;
FStringIndex: integer;
FTrueString: string;
FFalseString: string;
FAsBoolean: boolean;
procedure SetStringIndex(const Value: integer);
procedure SetTrueString(const Value: string);
procedure SetFalseString(const Value: string);
procedure ReadData(sender:TObject); override;
procedure WriteData(sender:TObject); override;
procedure ClearData(sender:TObject); override;
procedure SetAsBoolean(const Value: boolean);
{ Private declarations }
protected
{ Protected declarations }
procedure KeyPress(var Key: Char); override;
public
{ Public declarations }
constructor create(AOwner:TComponent);override;
published
{ Published declarations }
property AsBoolean:boolean read FAsBoolean write SetAsBoolean;
property StringIndex:integer read FStringIndex write SetStringIndex;
property TrueString:string read FTrueString write SetTrueString;
property FalseString:string read FFalseString write SetFalseString;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('FFS Data Entry', [TdcBooleanEdit]);
end;
{ TdcBooleanEdit }
procedure TdcBooleanEdit.ReadData(sender:TObject);
var s : string;
begin
if not assigned(fdclink.DataController) then begin
AsBoolean := false;
exit;
end;
s := '';
if stringIndex > 0 then begin
if assigned(fdclink.datacontroller.databuf) then s := fdclink.datacontroller.databuf.AsString[DataBufIndex];
if fStringIndex <= length(s) then AsBoolean := pos(system.copy(s,fStringIndex,1), TrueString) > 0
else AsBoolean := false;
end
else begin
if assigned(fdclink.datacontroller.databuf) then AsBoolean := fdclink.datacontroller.databuf.AsBoolean[DataBufIndex]
else AsBoolean := false;
end;
end;
procedure TdcBooleanEdit.SetAsBoolean(const Value: boolean);
begin
FAsBoolean := Value;
if FAsBoolean then Text := FTrueString
else Text := FFalseString;
end;
procedure TdcBooleanEdit.SetStringIndex(const Value: integer);
begin
FStringIndex := Value;
end;
procedure TdcBooleanEdit.SetTrueString(const Value: string);
begin
FTrueString := Value;
end;
procedure TdcBooleanEdit.SetFalseString(const Value: string);
begin
FFalseString := Value;
end;
procedure TdcBooleanEdit.WriteData(sender:TObject);
var s : string;
begin
if ReadOnly then exit;
if not assigned(fdclink.DataController) then exit;
if not assigned(fdclink.datacontroller.databuf) then exit;
if StringIndex > 0 then begin
s := fdclink.datacontroller.databuf.asString[DataBufIndex];
while (length(s) < fStringIndex) do s := s + ' ';
if AsBoolean then s[fStringIndex] := TrueString[1]
else s[fstringIndex] := FalseString[1];
fdclink.datacontroller.databuf.asString[DataBufIndex] := s;
end
else begin
fdclink.DataController.DataBuf.AsBoolean[DataBufIndex] := AsBoolean;
end;
end;
procedure TdcBooleanEdit.ClearData(sender:TObject);
begin
AsBoolean := false;
end;
constructor TdcBooleanEdit.create(AOwner: TComponent);
begin
inherited;
fStringIndex := 1;
fTrueString := 'Y';
fFalseString := 'N';
end;
procedure TdcBooleanEdit.KeyPress(var Key: Char);
begin
FTestString := upcase(key);
if pos(FTestString, FTrueString) = 1 then AsBoolean := true
else if pos(FTestString, FFalseString) = 1 then AsBoolean := false
else if FTestString = ' ' then AsBoolean := not AsBoolean;
key := #0;
inherited;
end;
end.
|
PROGRAM d5a;
USES sysutils;
FUNCTION answer(filename:string) : string;
VAR
f: text;
l: string;
i, amt, src, dest: integer;
stack: array[1..9] of string;
BEGIN
answer := '';
FOR i := 1 TO 9 DO stack[i] := '';
assign(f, filename);
reset(f);
WHILE not eof(f) DO
BEGIN
{read stacks}
readln(f, l);
IF pos(' 1 ', l) > 0 THEN break;
FOR i := 1 TO 9 DO stack[i] += trim(copy(l, -2+4*i, 1));
END;
readln(f, l);
WHILE not eof(f) DO
BEGIN
{read instruction}
readln(f, l);
amt := strtoint(trim(copy(l, pos('move', l)+5, 2)));
src := strtoint(trim(copy(l, pos('from', l)+5, 2)));
dest := strtoint(trim(copy(l, pos('to', l)+3, 1)));
FOR i := 1 TO amt DO
BEGIN
IF (length(stack[src]) > 0) THEN
BEGIN
stack[dest] := stack[src][1] + stack[dest];
stack[src] := copy(stack[src], 2, length(stack[src]));
END;
END;
END;
close(f);
FOR i := 1 TO 9 DO
BEGIN
IF (length(stack[i]) > 0) THEN answer += trim(stack[i][1]);
END;
answer := trim(answer);
END;
CONST
testfile = 'd5.test.1';
filename = 'd5.input';
VAR
a: string;
BEGIN{d5a}
assert(answer(testfile) = 'CMZ', 'test faal');
a := answer(filename);
assert(a <> 'CMZWCZTHTMPS');
assert(a <> 'WCZTHTMPSWCZTHTMPS');
writeln('');
writeln('answer: ', answer(filename));
END.
|
unit uTabelaPrecoVO;
interface
uses
System.SysUtils, uTableName, uKeyField, System.Generics.Collections, uProdutoVO,
uStatusVO, uTipoVO, uModuloVO;
type
[TableName('TabPreco_Modulo')]
TTabPrecoModuloVO = class
private
FIdTabPreco: Integer;
FIdModulo: Integer;
FId: Integer;
FModulo: TModuloVO;
procedure SetId(const Value: Integer);
procedure SetIdModulo(const Value: Integer);
procedure SetIdTabPreco(const Value: Integer);
procedure SetModulo(const Value: TModuloVO);
public
[KeyField('TabM_Id')]
property Id: Integer read FId write SetId;
[FieldName('TabM_TabPreco')]
property IdTabPreco: Integer read FIdTabPreco write SetIdTabPreco;
[FieldName('TabM_Modulo')]
property IdModulo: Integer read FIdModulo write SetIdModulo;
property Modulo: TModuloVO read FModulo write SetModulo;
constructor Create(); overload;
destructor Destroy(); override;
end;
[TableName('TabPreco')]
TTabelaPrecoVO = class
private
FIdStatus: Integer;
FObservacao: string;
FValorMensalRegNormal: Double;
FValorMensalSimples: Double;
FAtivo: Boolean;
FIdTipo: Integer;
FValorImplRegNormal: Double;
FValorImplSimples: Double;
FIdProduto: Integer;
FId: Integer;
FReferencia: string;
FNome: string;
FData: TDate;
FProduto: TProduto;
FStatus: TStatusVO;
FTipo: TTipoVO;
FItensTabela: TObjectList<TTabPrecoModuloVO>;
procedure SetAtivo(const Value: Boolean);
procedure SetData(const Value: TDate);
procedure SetId(const Value: Integer);
procedure SetIdProduto(const Value: Integer);
procedure SetIdStatus(const Value: Integer);
procedure SetIdTipo(const Value: Integer);
procedure SetNome(const Value: string);
procedure SetObservacao(const Value: string);
procedure SetReferencia(const Value: string);
procedure SetValorImplRegNormal(const Value: Double);
procedure SetValorImplSimples(const Value: Double);
procedure SetValorMensalRegNormal(const Value: Double);
procedure SetValorMensalSimples(const Value: Double);
procedure SetStatus(const Value: TStatusVO);
procedure SetTipo(const Value: TTipoVO);
procedure SetProduto(const Value: TProduto);
procedure SetItensTabela(const Value: TObjectList<TTabPrecoModuloVO>);
public
[KeyField('Tab_Id')]
property Id: Integer read FId write SetId;
[FieldDate('Tab_Data')]
property Data: TDate read FData write SetData;
[FieldName('Tab_Referencia')]
property Referencia: string read FReferencia write SetReferencia;
[FieldName('Tab_Nome')]
property Nome: string read FNome write SetNome;
[FieldNull('Tab_Produto')]
property IdProduto: Integer read FIdProduto write SetIdProduto;
[FieldNull('Tab_Status')]
property IdStatus: Integer read FIdStatus write SetIdStatus;
[FieldNull('Tab_Tipo')]
property IdTipo: Integer read FIdTipo write SetIdTipo;
[FieldName('Tab_Ativo')]
property Ativo: Boolean read FAtivo write SetAtivo;
[FieldName('Tab_ValorImplSimples')]
property ValorImplSimples: Double read FValorImplSimples write SetValorImplSimples;
[FieldName('Tab_ValorMensalSimples')]
property ValorMensalSimples: Double read FValorMensalSimples write SetValorMensalSimples;
[FieldName('Tab_ValorImplRegNormal')]
property ValorImplRegNormal: Double read FValorImplRegNormal write SetValorImplRegNormal;
[FieldName('Tab_ValorMensalRegNormal')]
property ValorMensalRegNormal: Double read FValorMensalRegNormal write SetValorMensalRegNormal;
[FieldName('Tab_Observacao')]
property Observacao: string read FObservacao write SetObservacao;
property Produto: TProduto read FProduto write SetProduto;
property Status: TStatusVO read FStatus write SetStatus;
property Tipo: TTipoVO read FTipo write SetTipo;
property ItensTabela: TObjectList<TTabPrecoModuloVO> read FItensTabela write SetItensTabela;
constructor Create(); overload;
destructor Destroy(); override;
end;
TListaTabPrecoVO = TObjectList<TTabelaPrecoVO>;
TTabPrecoConsulta = class
private
FId: Integer;
FNome: string;
procedure SetId(const Value: Integer);
procedure SetNome(const Value: string);
public
property Id: Integer read FId write SetId;
property Nome: string read FNome write SetNome;
end;
TListaTabPrecoConsulta = TObjectList<TTabPrecoConsulta>;
TTabPrecoFiltro = class
private
FStatusId: string;
FTipoId: string;
FProdutoId: string;
FTabelaId: string;
public
property TabelaId: string read FTabelaId write FTabelaId;
property ProdutoId: string read FProdutoId write FProdutoId;
property StatusId: string read FStatusId write FStatusId;
property TipoId: string read FTipoId write FTipoId;
end;
implementation
{ TTabelaPrecoVO }
constructor TTabelaPrecoVO.Create;
begin
inherited Create;
FProduto := TProduto.Create;
FStatus := TStatusVO.Create;
FTipo := TTipoVO.Create;
FItensTabela := TObjectList<TTabPrecoModuloVO>.Create();
end;
destructor TTabelaPrecoVO.Destroy;
begin
FreeAndNil(FItensTabela);
FreeAndNil(FTipo);
FreeAndNil(FStatus);
FreeAndNil(FProduto);
inherited;
end;
procedure TTabelaPrecoVO.SetAtivo(const Value: Boolean);
begin
FAtivo := Value;
end;
procedure TTabelaPrecoVO.SetData(const Value: TDate);
begin
FData := Value;
end;
procedure TTabelaPrecoVO.SetId(const Value: Integer);
begin
FId := Value;
end;
procedure TTabelaPrecoVO.SetIdProduto(const Value: Integer);
begin
FIdProduto := Value;
end;
procedure TTabelaPrecoVO.SetIdStatus(const Value: Integer);
begin
FIdStatus := Value;
end;
procedure TTabelaPrecoVO.SetIdTipo(const Value: Integer);
begin
FIdTipo := Value;
end;
procedure TTabelaPrecoVO.SetItensTabela(
const Value: TObjectList<TTabPrecoModuloVO>);
begin
FItensTabela := Value;
end;
procedure TTabelaPrecoVO.SetNome(const Value: string);
begin
FNome := Value;
end;
procedure TTabelaPrecoVO.SetObservacao(const Value: string);
begin
FObservacao := Value;
end;
procedure TTabelaPrecoVO.SetProduto(const Value: TProduto);
begin
FProduto := Value;
end;
procedure TTabelaPrecoVO.SetReferencia(const Value: string);
begin
FReferencia := Value;
end;
procedure TTabelaPrecoVO.SetStatus(const Value: TStatusVO);
begin
FStatus := Value;
end;
procedure TTabelaPrecoVO.SetTipo(const Value: TTipoVO);
begin
FTipo := Value;
end;
procedure TTabelaPrecoVO.SetValorImplRegNormal(const Value: Double);
begin
FValorImplRegNormal := Value;
end;
procedure TTabelaPrecoVO.SetValorImplSimples(const Value: Double);
begin
FValorImplSimples := Value;
end;
procedure TTabelaPrecoVO.SetValorMensalRegNormal(const Value: Double);
begin
FValorMensalRegNormal := Value;
end;
procedure TTabelaPrecoVO.SetValorMensalSimples(const Value: Double);
begin
FValorMensalSimples := Value;
end;
{ TTabPrecoModuloVO }
constructor TTabPrecoModuloVO.Create;
begin
inherited Create;
FModulo := TModuloVO.Create;
end;
destructor TTabPrecoModuloVO.Destroy;
begin
FreeAndNil(FModulo);
inherited;
end;
procedure TTabPrecoModuloVO.SetId(const Value: Integer);
begin
FId := Value;
end;
procedure TTabPrecoModuloVO.SetIdModulo(const Value: Integer);
begin
FIdModulo := Value;
end;
procedure TTabPrecoModuloVO.SetIdTabPreco(const Value: Integer);
begin
FIdTabPreco := Value;
end;
procedure TTabPrecoModuloVO.SetModulo(const Value: TModuloVO);
begin
FModulo := Value;
end;
{ TTabPrecoConsulta }
procedure TTabPrecoConsulta.SetId(const Value: Integer);
begin
FId := Value;
end;
procedure TTabPrecoConsulta.SetNome(const Value: string);
begin
FNome := Value;
end;
end.
|
unit mainForm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uCEFWinControl, uCEFChromiumWindow, Vcl.StdCtrls,
Vcl.ExtCtrls;
type
TForm0 = class(TForm)
TopPanel: TPanel;
UrlEdit: TEdit;
GoButton: TButton;
ChromiumWindow1: TChromiumWindow;
BrowserInitTimer: TTimer;
BottomPanel: TPanel;
ChildBrowserButton: TButton;
procedure GoButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BrowserInitTimerTimer(Sender: TObject);
procedure ChildBrowserButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form0: TForm0;
implementation
{$R *.dfm}
uses
uSimpleBrowser;
procedure TForm0.FormCreate(Sender: TObject);
begin
// Assert(ChromiumWindow1.CreateBrowser, 'Failed to initialize the browser');
if not ChromiumWindow1.CreateBrowser then BrowserInitTimer.Enabled := True;
end;
procedure TForm0.BrowserInitTimerTimer(Sender: TObject);
begin
if ChromiumWindow1.CreateBrowser then BrowserInitTimer.Enabled := False;
end;
procedure TForm0.FormShow(Sender: TObject);
begin
// Assert(ChromiumWindow1.CreateBrowser, 'Failed to initialize the browser');
end;
procedure TForm0.GoButtonClick(Sender: TObject);
begin
ChromiumWindow1.LoadURL(UrlEdit.Text);
end;
procedure TForm0.ChildBrowserButtonClick(Sender: TObject);
var
LSimpleBrowser: TForm1;
begin
LSimpleBrowser := TForm1.Create(nil);
try
LSimpleBrowser.ShowModal;
finally
LSimpleBrowser.Free;
end;
end;
end.
|
unit MapTypes;
interface
uses
Windows, Classes, Graphics, GameTypes, LanderTypes, Protocol, VoyagerServerInterfaces,
Circuits, CircuitsHandler, Land, LocalCacheTypes;
const
cBasicZoomRes : TZoomRes = zr32x64;
cBasicRotation : TRotation = drNorth;
type
TZoomFactor =
record
m : integer;
n : integer;
end;
const
cZoomFactors : array [TZoomRes] of TZoomFactor =
(
(m : 1 shl ord(zr4x8); n : 1 shl ord(zr32x64)),
(m : 1 shl ord(zr8x16); n : 1 shl ord(zr32x64)),
(m : 1 shl ord(zr16x32); n : 1 shl ord(zr32x64)),
(m : 1 shl ord(zr32x64); n : 1 shl ord(zr32x64))
);
type
TMapImage = TGameImage;
type
TMapPoint =
record
r, c : integer;
end;
const
idMask = $FFFF0000;
idLandMask = $00000000;
idConcreteMask = $00010000;
idBuildingMask = $00020000;
idRoadBlockMask = $00030000;
idRailroadBlockMask = $00040000;
idEffectMask = $00050000;
idRailingMask = $00060000;
idRGBColorMask = $80000000;
type
idLand = byte;
idConcrete = byte;
idBuilding = word;
idCompany = word;
idRoadBlock = byte;
idRailroadBlock = byte;
idFluid = byte;
idEffect = byte;
type
TSoundData =
record
wavefile : string;
atenuation : single;
priority : integer;
looped : boolean;
probability : single;
period : integer;
end;
type
PSoundDataArray = ^TSoundDataArray;
TSoundDataArray = array [0 .. 0] of TSoundData;
type
TSoundSetKind = (ssNone, ssAnimDriven, ssStochastic);
type
TSoundSetData =
record
Kind : TSoundSetKind;
Count : integer;
Sounds : PSoundDataArray;
end;
type
PLandBlockClass = ^TLandBlockClass;
TLandBlockClass =
record
id : integer;
ImagePath : string;
DefImg : boolean;
SoundData : TSoundData;
end;
type
PLandAccident = ^TLandAccident;
TLandAccident =
record
x, y : integer;
visclass : integer;
end;
type
TFacId = byte;
type
TEffectOption = (eoGlassed, eoAnimated);
TEffectOptions = set of TEffectOption;
type
TEfxData =
record
id : integer;
x, y : integer;
Options : TEffectOptions;
end;
type
PEfxDataArray = ^TEfxDataArray;
TEfxDataArray = array [0 .. 0] of TEfxData;
type
TBuildingEfxData =
record
Count : integer;
Efxs : PEfxDataArray;
end;
type
PBuildingClass = ^TBuildingClass;
TBuildingClass =
packed record
id : idBuilding;
Size : smallint;
Name : string;
ImagePath : string;
DefImg : boolean;
Urban : boolean;
Accident : boolean;
ZoneType : TZoneType;
VoidSquares : byte;
FacId : TFacId;
Requires : TFacId;
HideColor : TColor;
Selectable : boolean;
Animated : boolean;
AnimArea : TRect;
EfxData : TBuildingEfxData;
SoundData : TSoundSetData;
end;
type
IBuildingClassBag =
interface
procedure Add(const which : TBuildingClass);
function Get(id : idBuilding) : PBuildingClass;
function GetMaxId : idBuilding;
procedure Clear;
end;
type
PRoadBlockClass = ^TRoadBlockClass;
TRoadBlockClass =
record
id : idRoadBlock;
ImagePath : string;
RailingImgPath : string;
end;
type
PRailRoadBlockClass = ^TRailroadBlockClass;
TRailroadBlockClass =
record
id : integer;
ImagePath : string;
end;
type
PFluidClass = ^TFluidClass;
TFluidClass =
record
id : idFluid;
Color : TColor;
end;
type
PEffectClass = ^TEffectClass;
TEffectClass =
record
id : idEffect;
ImagePath : string;
XHook : integer;
YHook : integer;
SoundData : TSoundSetData;
end;
type
IWorldMapInit =
interface
procedure InitMap;
procedure SetCircuitsHandler(const which : ICircuitsHandler);
procedure SetCoordConverter(const which : ICoordinateConverter);
end;
type
ILocalCacheManager =
interface
function LoadMap(const MapName : string) : boolean;
function Load(const url : string) : boolean;
procedure SetAdviseSink(const Sink : ILocalCacheAdviseSink);
function GetLandMap : TMapImage;
function GetLandAccidentCount : integer;
function GetLandAccident(i : integer) : PLandAccident;
procedure AddAccident(x, y, vclass : integer);
function RemoveAccident(x, y : integer) : boolean;
procedure SaveAccidents;
function GetBuildingClass(id : idBuilding) : PBuildingClass;
function GetRoadBlockClass(id : idRoadBlock) : PRoadBlockClass;
function GetRailroadBlockClass(id : idRailroadBlock) : PRailroadBlockClass;
function GetFluidClass(id : idFluid) : PFluidClass;
function GetEffectClass(id : idEffect) : PEffectClass;
function GetLandClass(landId : idLand) : PLandBlockClass;
function GetLandImage(const zoom : TZoomRes; id : idLand; suit : integer) : TGameImage;
procedure LandImageReleased(const zoom : TZoomRes; id : idLand; suit : integer);
function GetLandAccidentImage(const zoom : TZoomRes; id : idBuilding; suit : integer) : TGameImage;
procedure LandAccidentImageReleased(const zoom : TZoomRes; id : idBuilding; suit : integer);
function GetBuildingImage(const zoom : TZoomRes; id : idBuilding) : TGameImage;
function GetConcreteImage(const zoom : TZoomRes; id : idConcrete) : TGameImage;
function GetRoadBlockImage(const zoom : TZoomRes; id : idRoadBlock) : TGameImage;
function GetRailingImage(const zoom : TZoomRes; id : idRoadBlock) : TGameImage;
function GetRailroadBlockImage(const zoom : TZoomRes; id : idRailroadBlock) : TGameImage;
function GetEffectImage(const zoom : TZoomRes; id : idEffect) : TGameImage;
function GetSpareImage(const zoom : TZoomRes) : TGameImage;
function GetDownloadImage(const zoom : TZoomRes) : TGameImage;
function GetShadeImage(const zoom : TZoomRes) : TGameImage;
function GetRedShadeImage(const zoom : TZoomRes) : TGameImage;
function GetBlackShadeImage(const zoom : TZoomRes) : TGameImage;
function GetBuildingClasses : IBuildingClassBag;
end;
type
TErrorCode = VoyagerServerInterfaces.TErrorCode;
TObjectReport = VoyagerServerInterfaces.TObjectReport;
TSegmentReport = VoyagerServerInterfaces.TSegmentReport;
IClientView = VoyagerServerInterfaces.IClientView;
implementation
end.
|
unit AddressNoteActionsUnit;
interface
uses
SysUtils, Classes, BaseActionUnit,
DataObjectUnit, NoteParametersUnit, AddressNoteUnit, IConnectionUnit,
AddNoteFileResponseUnit, EnumsUnit;
type
TAddressNoteActions = class(TBaseAction)
private
FRoute4MeManager: IUnknown; //IRoute4MeManager;
public
/// <remarks>
/// Route4MeManager it must be IRoute4MeManager
/// <remarks>
constructor Create(Connection: IConnection; Route4MeManager: IUnknown);
destructor Destroy; override;
function Get(NoteParameters: TNoteParameters;
out ErrorString: String): TAddressNoteList;
function Add(NoteParameters: TNoteParameters; NoteContents: String;
out ErrorString: String): TAddressNote;
function AddFile(RouteId: String; AddressId: integer;
Latitude, Longitude: double; DeviceType: TDeviceType;
ActivityType: TStatusUpdateType; Filename: String;
out ErrorString: String): TAddressNote;
end;
implementation
{ TAddressNoteActions }
uses
System.Generics.Collections, System.NetEncoding,
SettingsUnit, IRoute4MeManagerUnit,
GenericParametersUnit, CommonTypesUnit, AddressParametersUnit, AddressUnit,
AddAddressNoteResponseUnit;
function TAddressNoteActions.Add(NoteParameters: TNoteParameters;
NoteContents: String; out ErrorString: String): TAddressNote;
var
Response: TAddAddressNoteResponse;
Parameters: TGenericParameters;
NoteParameterPairs: TListStringPair;
i: integer;
begin
Result := nil;
Parameters := TGenericParameters.Create;
try
Parameters.AddBodyParameter('strUpdateType', TStatusUpdateTypeDescription[NoteParameters.ActivityType]);
Parameters.AddBodyParameter('strNoteContents', TNetEncoding.URL.Encode(NoteContents));
NoteParameterPairs := NoteParameters.Serialize('');
try
for i := 0 to NoteParameterPairs.Count - 1 do
Parameters.AddParameter(NoteParameterPairs[i].Key, NoteParameterPairs[i].Value);
finally
FreeAndNil(NoteParameterPairs);
end;
Response := FConnection.Post(TSettings.EndPoints.AddRouteNotes, Parameters,
TAddAddressNoteResponse, ErrorString) as TAddAddressNoteResponse;
try
if (Response <> nil) then
if (Response.Note <> nil) then
Result := Response.Note
else
if (Response.Status = False) then
ErrorString := 'Note not added';
finally
FreeAndNil(Response);
end;
finally
FreeAndNil(Parameters);
end;
end;
function TAddressNoteActions.AddFile(RouteId: String; AddressId: integer;
Latitude, Longitude: double; DeviceType: TDeviceType;
ActivityType: TStatusUpdateType; Filename: String;
out ErrorString: String): TAddressNote;
var
Response: TAddAddressNoteResponse;
Parameters: TGenericParameters;
NoteParameterPairs: TListStringPair;
i: integer;
NoteParameters: TNoteParameters;
FileStream: TStream;
begin
Result := nil;
if not FileExists(Filename) then
begin
ErrorString := Format('File "%s" not existed', [Filename]);
Exit;
end;
NoteParameters := TNoteParameters.Create;
try
NoteParameters.RouteId := RouteId;
NoteParameters.AddressId := AddressId;
NoteParameters.Latitude := Latitude;
NoteParameters.Longitude := Longitude;
NoteParameters.DeviceType := DeviceType;
NoteParameters.ActivityType := ActivityType;
Parameters := TGenericParameters.Create;
try
NoteParameterPairs := NoteParameters.Serialize('');
try
for i := 0 to NoteParameterPairs.Count - 1 do
Parameters.AddParameter(NoteParameterPairs[i].Key, NoteParameterPairs[i].Value);
finally
FreeAndNil(NoteParameterPairs);
end;
FileStream := TFileStream.Create(Filename, fmOpenRead);
try
// todo 1: сделать Add a Note File
Response := FConnection.Post(TSettings.EndPoints.AddRouteNotes, Parameters,
FileStream, TAddAddressNoteResponse, ErrorString) as TAddAddressNoteResponse;
try
if (Response <> nil) then
if (Response.Note <> nil) then
Result := Response.Note
else
if (Response.Status = False) then
ErrorString := 'Note file not added';
finally
FreeAndNil(Response);
end;
finally
FreeAndNil(FileStream);
end;
finally
FreeAndNil(Parameters);
end;
finally
FreeAndNil(NoteParameters);
end;
end;
constructor TAddressNoteActions.Create(Connection: IConnection;
Route4MeManager: IUnknown);
begin
Inherited Create(Connection);
FRoute4MeManager := Route4MeManager;
end;
destructor TAddressNoteActions.Destroy;
begin
FRoute4MeManager := nil;
inherited;
end;
function TAddressNoteActions.Get(NoteParameters: TNoteParameters;
out ErrorString: String): TAddressNoteList;
var
AddressParameters: TAddressParameters;
Address: TAddress;
i: integer;
begin
Result := TAddressNoteList.Create;
AddressParameters := TAddressParameters.Create();
try
AddressParameters.RouteId := NoteParameters.RouteId;
AddressParameters.RouteDestinationId := NoteParameters.AddressId;
AddressParameters.Notes := True;
Address := (FRoute4MeManager as IRoute4MeManager).Address.Get(AddressParameters, ErrorString);
try
if (Address <> nil) then
begin
Address.OwnsNotes := False;
for i := 0 to High(Address.Notes) do
Result.Add(Address.Notes[i]);
end;
finally
FreeAndNil(Address);
end;
finally
FreeAndNil(AddressParameters);
end;
end;
end.
|
unit osAppResources;
interface
uses
Classes, SysUtils, Forms, osUtils;
type
TResourceType = (rtEdit, rtQuery, rtReport, rtOther);
{ TosAppResource }
TosAppResource = class(TCollectionItem)
private
FDescription: string;
FFilterDefName: string;
FName: string;
FResClass: TPersistentClass;
FResType: TResourceType;
FImageIndex: integer;
FDomainName: string;
FResClassName: string;
FDataClassName: string;
FDataClass: TPersistentClass;
FReportClassName: string;
FReportClass: TPersistentClass;
FViews: variant;
procedure SetImageIndex(const Value: integer);
protected
function GetDisplayName: string; override;
public
constructor Create(AOwner: TCollection); override;
property ResClass: TPersistentClass read FResClass write FResClass;
property DataClass: TPersistentClass read FDataClass write FDataClass;
property ReportClass: TPersistentClass read FReportClass write FReportClass;
published
property Name: string read FName write FName;
property Description: string read FDescription write FDescription;
property FilterDefName: string read FFilterDefName write FFilterDefName;
property ResClassName: string read FResClassName write FResClassName;
property DataClassName: string read FDataClassName write FDataClassName;
property ReportClassName: string read FReportClassName write FReportClassName;
property DomainName: string read FDomainName write FDomainName;
property ImageIndex: integer read FImageIndex write SetImageIndex;
property ResType: TResourceType read FResType write FResType;
property views: variant read FViews;
end;
{ TosAppResourceCollection }
TosAppResourceCollection = class(TOwnedCollection)
private
function GetItem(Index: Integer): TosAppResource;
procedure SetItem(Index: Integer; Value: TosAppResource);
public
constructor Create(AOwner: TComponent);
property Items[Index: Integer]: TosAppResource read GetItem write SetItem; default;
end;
{ TosAppResourceManager }
TosAppResourceManager = class(TComponent)
private
FCurrentResource: TosAppResource;
FResources: TosAppResourceCollection;
procedure SetResources(const Value: TosAppResourceCollection);
public
///////////////////////// alterado por romulo aurélio ceccon
// esta procedure foi necessária porque a propriedade ResClass só é
// alterada durante a procedure Loaded. Como o Manager é criado em runtime
// eu preciso de um modo de recarregar a esta propriedade
procedure Reload;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Loaded; override;
procedure AddResource(const PName, PDescription, PFilterDefName, PResClassName,
PDataClassName, PReportClassName, PDomainName: string; PImageIndex: integer;
PResType: integer);
property CurrentResource: TosAppResource read FCurrentResource write FCurrentResource;
published
property Resources: TosAppResourceCollection read FResources write SetResources;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('OS Controls', [TosAppResourceManager]);
end;
{ TosAppResource }
constructor TosAppResource.Create(AOwner: TCollection);
begin
inherited Create(AOwner);
FResType := rtEdit;
end;
function TosAppResource.GetDisplayName: string;
begin
Result := FName;
end;
procedure TosAppResource.SetImageIndex(const Value: integer);
begin
FImageIndex := Value;
end;
{ TosAppResourceCollection }
constructor TosAppResourceCollection.Create(AOwner: TComponent);
begin
inherited Create(AOwner, TosAppResource);
end;
function TosAppResourceCollection.GetItem(Index: Integer): TosAppResource;
begin
Result := TosAppResource(inherited GetItem(Index));
end;
procedure TosAppResourceCollection.SetItem(Index: Integer;
Value: TosAppResource);
begin
inherited SetItem(Index, Value);
end;
{ TosAppResourceManager }
procedure TosAppResourceManager.AddResource(const PName, PDescription,
PFilterDefName, PResClassName, PDataClassName, PReportClassName,
PDomainName: string; PImageIndex, PResType: integer);
begin
with TosAppResource(FResources.Add) do
begin
Name := PName;
Description := PDescription;
FilterDefName := PFilterDefName;
ResClassName := PResClassName;
DataClassName := PDataClassName;
ReportClassName := PReportClassName;
DomainName := PDomainName;
ImageIndex := PImageIndex;
if PResType > 2 then
ResType := rtOther
else
ResType := TResourceType(PResType);
end;
end;
constructor TosAppResourceManager.Create(AOwner: TComponent);
begin
inherited;
FResources := TosAppResourceCollection.Create(Self);
end;
destructor TosAppResourceManager.Destroy;
begin
FResources.Free;
inherited;
end;
procedure TosAppResourceManager.Loaded;
var
i: integer;
begin
inherited;
if not (csDesigning in ComponentState) then
for i:=0 to Resources.Count - 1 do
case Resources[i].ResType of
rtEdit, rtReport, rtOther:
begin
Resources[i].ResClass := OSGetClass(Resources[i].ResClassName);
Resources[i].DataClass := OSGetClass(Resources[i].DataClassName);
Resources[i].ReportClass := OSGetClass(Resources[i].ReportClassName);
end;
end;
end;
procedure TosAppResourceManager.Reload;
var
i: integer;
begin
///////////////////////// alterado por romulo aurélio ceccon
for i := 0 to Resources.Count - 1 do
case Resources[i].ResType of
rtEdit, rtReport, rtOther:
begin
Resources[i].ResClass := OSGetClass(Resources[i].ResClassName);
Resources[i].DataClass := OSGetClass(Resources[i].DataClassName);
Resources[i].ReportClass := OSGetClass(Resources[i].ReportClassName);
end;
end;
end;
procedure TosAppResourceManager.SetResources(
const Value: TosAppResourceCollection);
begin
FResources.Assign(Value);
end;
end.
|
{
Copyright (C) 2013-2018 Tim Sinaeve tim.sinaeve@gmail.com
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit ts.Editor.ToolView.Base;
{ Base toolview form that can be used to create descendants that implement
IEditorToolView.
It reacts to changes in the common settings (IEditorSettings) which are
associated with the owning manager (IEditorManager) instance.
This base class provides properties which are shortcuts to the following
instances that are used by the editor manager:
- Manager : IEditorManager - The owning editor manager instance
- Settings : IEditorSettings - All persistable settings
- View : IEditorView - The currently active editor view
- Views : IEditorViews - The list of available editor views
It provides virtual event handlers which act as callback methods to let us
respond to certain changes in the active editor view or to changes in the
settings. It acts as an observer to react on any relevant changes in the
observed instances.
}
{$MODE DELPHI}
interface
uses
Forms,
ts.Editor.Interfaces;
type
TCustomEditorToolView = class(TForm, IEditorToolView)
strict private
// this flag is set when there are pending updates.
FUpdate: Boolean;
function GetManager: IEditorManager;
function GetSettings: IEditorSettings;
function GetUpdate: Boolean;
function GetView: IEditorView;
function GetViews: IEditorViews;
procedure SetUpdate(AValue: Boolean);
strict protected
function GetForm: TForm;
function GetName: string;
function GetVisible: Boolean;
// virtual event handlers
procedure EditorCaretPositionChange(
Sender : TObject;
X, Y : Integer
); virtual;
procedure EditorSettingsChanged(Sender: TObject); virtual;
procedure EditorActiveViewChanged(Sender: TObject); virtual;
procedure EditorModified(Sender: TObject); virtual;
procedure EditorChange(Sender: TObject); virtual;
procedure Modified; virtual;
procedure UpdateView; virtual;
procedure SettingsChanged; virtual;
property Update: Boolean
read GetUpdate write SetUpdate;
property Manager: IEditorManager
read GetManager;
property Settings: IEditorSettings
read GetSettings;
property View: IEditorView
read GetView;
property Views: IEditorViews
read GetViews;
public
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
end;
implementation
{$R *.lfm}
{$REGION 'construction and destruction'}
procedure TCustomEditorToolView.AfterConstruction;
begin
inherited AfterConstruction;
Manager.Settings.AddEditorSettingsChangedHandler(EditorSettingsChanged);
Manager.Events.AddOnCaretPositionEvent(EditorCaretPositionChange);
Manager.Events.AddOnActiveViewChangeHandler(EditorActiveViewChanged);
Manager.Events.AddOnChangeHandler(EditorChange);
Manager.Events.AddOnModifiedHandler(EditorModified);
end;
procedure TCustomEditorToolView.BeforeDestruction;
begin
inherited BeforeDestruction;
end;
{$ENDREGION}
{$REGION 'property access mehods'}
function TCustomEditorToolView.GetUpdate: Boolean;
begin
Result := FUpdate;
end;
procedure TCustomEditorToolView.SetUpdate(AValue: Boolean);
begin
if AValue <> Update then
begin
FUpdate := AValue;
end;
end;
function TCustomEditorToolView.GetView: IEditorView;
begin
Result := Owner as IEditorView;
end;
function TCustomEditorToolView.GetViews: IEditorViews;
begin
Result := Owner as IEditorViews;
end;
function TCustomEditorToolView.GetForm: TForm;
begin
Result := Self;
end;
function TCustomEditorToolView.GetName: string;
begin
Result := inherited Name;
end;
function TCustomEditorToolView.GetVisible: Boolean;
begin
Result := inherited Visible;
end;
function TCustomEditorToolView.GetManager: IEditorManager;
begin
Result := Owner as IEditorManager;
end;
function TCustomEditorToolView.GetSettings: IEditorSettings;
begin
Result := Owner as IEditorSettings;
end;
{$ENDREGION}
{$REGION 'event handlers'}
procedure TCustomEditorToolView.EditorCaretPositionChange(Sender: TObject; X,
Y: Integer);
begin
UpdateView;
end;
procedure TCustomEditorToolView.EditorSettingsChanged(Sender: TObject);
begin
SettingsChanged;
end;
procedure TCustomEditorToolView.EditorActiveViewChanged(Sender: TObject);
begin
UpdateView;
end;
procedure TCustomEditorToolView.EditorModified(Sender: TObject);
begin
UpdateView;
end;
procedure TCustomEditorToolView.EditorChange(Sender: TObject);
begin
UpdateView;
end;
{$ENDREGION}
{$REGION 'protected methods'}
procedure TCustomEditorToolView.UpdateView;
begin
// to be overridden
end;
procedure TCustomEditorToolView.Modified;
begin
FUpdate := True;
end;
{ Responds to changes in the global settings. }
procedure TCustomEditorToolView.SettingsChanged;
begin
// to be overridden
end;
{$ENDREGION}
end.
|
{-----------------------------------------------------------------------------
VertSB (historypp project)
Version: 1.0
Created: 25.03.2003
Author: Oxygen
[ Description ]
Reimplementation of TControlScrollBar for use with
THistoryGrid to make scrolling much better. Sets Page
for scrollbar to different value, instead of using
Control's ClientHeight.
[ History ]
1.0 () First Release.
[ Modifications ]
* (25.03.2003) Scrolling doesn't calls now Control.ScrollBy so slight
flicker is removed
* (31.03.2003) Setting pagesize now works!
[ Known Issues ]
None
Based on Borland's Forms.pas source.
Copyright (c) 1995,99 Inprise Corporation
-----------------------------------------------------------------------------}
unit VertSB;
interface
{$DEFINE PAGE_SIZE}
uses
Classes, Forms, Graphics, Messages, Controls, Math, Windows;
type
{ TVertScrollBar }
TScrollBarKind = (sbHorizontal, sbVertical);
TScrollBarInc = 1..32767;
TScrollBarStyle = (ssRegular, ssFlat, ssHotTrack);
TVertScrollBar = class(TControlScrollBar)
private
FControl: TScrollingWinControl;
FIncrement: TScrollBarInc;
FPageIncrement: TScrollbarInc;
FPosition: Integer;
FRange: Integer;
FCalcRange: Integer;
FKind: TScrollBarKind;
FMargin: Word;
FVisible: Boolean;
FTracking: Boolean;
{$IFDEF PAGE_SIZE}
FPageSize: Integer;
{$ENDIF}
FScaled: Boolean;
FSmooth: Boolean;
FDelay: Integer;
FButtonSize: Integer;
FColor: TColor;
FParentColor: Boolean;
FSize: Integer;
FStyle: TScrollBarStyle;
FThumbSize: Integer;
FPageDiv: Integer;
FLineDiv: Integer;
FUpdatingScrollBars: Boolean;
FUpdateNeeded: Boolean;
procedure CalcAutoRange;
function ControlSize(ControlSB, AssumeSB: Boolean): Integer;
procedure DoSetRange(Value: Integer);
function GetScrollPos: Integer;
function NeedsScrollBarVisible: Boolean;
function IsIncrementStored: Boolean;
procedure SetButtonSize(Value: Integer);
procedure SetColor(Value: TColor);
procedure SetParentColor(Value: Boolean);
procedure SetPosition(Value: Integer);
procedure SetRange(Value: Integer);
procedure SetSize(Value: Integer);
procedure SetStyle(Value: TScrollBarStyle);
procedure SetThumbSize(Value: Integer);
procedure SetVisible(Value: Boolean);
function IsRangeStored: Boolean;
procedure Update(ControlSB, AssumeSB: Boolean);
procedure WINUpdateScrollBars;
public
constructor Create(AControl: TScrollingWinControl; AKind: TScrollBarKind);
procedure Assign(Source: TPersistent); override;
procedure ChangeBiDiPosition;
property Kind: TScrollBarKind read FKind;
function IsScrollBarVisible: Boolean;
property ScrollPos: Integer read GetScrollPos;
procedure ScrollMessage(var Msg: TWMScroll);
published
property ButtonSize: Integer read FButtonSize write SetButtonSize default 0;
property Color: TColor read FColor write SetColor default clBtnHighlight;
property Increment: TScrollBarInc read FIncrement write FIncrement stored IsIncrementStored default 8;
property Margin: Word read FMargin write FMargin default 0;
property ParentColor: Boolean read FParentColor write SetParentColor default True;
property Position: Integer read FPosition write SetPosition default 0;
property Range: Integer read FRange write SetRange stored IsRangeStored default 0;
property Smooth: Boolean read FSmooth write FSmooth default False;
property Size: Integer read FSize write SetSize default 0;
property Style: TScrollBarStyle read FStyle write SetStyle default ssRegular;
property ThumbSize: Integer read FThumbSize write SetThumbSize default 0;
property Tracking: Boolean read FTracking write FTracking default True;
property Visible: Boolean read FVisible write SetVisible default True;
{$IFDEF PAGE_SIZE}
{OXY}property PageSize: Integer read FPageSize write FPageSize;
{$ENDIF}
end;
implementation
uses FlatSB, CommCtrl;
{ TVertScrollBar }
procedure TVertScrollBar.WINUpdateScrollBars;
begin
if not FUpdatingScrollBars and FControl.HandleAllocated then
try
FUpdatingScrollBars := True;
if NeedsScrollBarVisible{OXY: FControl.VertScrollBar.NeedsScrollBarVisible} then
begin
//FHorzScrollBar.Update(False, True);
Update(True, False);
end
else if False {OXY: FHorzScrollBar.NeedsScrollBarVisible} then
begin
Update(False, True);
//FHorzScrollBar.Update(True, False);
end
else
begin
Update(False, False);
//FHorzScrollBar.Update(True, False);
end;
finally
FUpdatingScrollBars := False;
end;
end;
constructor TVertScrollBar.Create(AControl: TScrollingWinControl; AKind: TScrollBarKind);
begin
inherited Create;
{$IFDEF PAGE_SIZE}
FPageSize := 10;
{$ENDIF}
FControl := AControl;
FKind := AKind;
FTracking := True;
FPageIncrement := 80;
FUpdatingScrollBars := False;
FIncrement := FPageIncrement div 10;
FVisible := True;
FDelay := 10;
FLineDiv := 1;
FPageDiv := 1;
FColor := clBtnHighlight;
FParentColor := True;
FUpdateNeeded := True;
end;
function TVertScrollBar.IsIncrementStored: Boolean;
begin
Result := not Smooth;
end;
procedure TVertScrollBar.Assign(Source: TPersistent);
begin
if Source is TVertScrollBar then
begin
Visible := TVertScrollBar(Source).Visible;
Range := TVertScrollBar(Source).Range;
Position := TVertScrollBar(Source).Position;
Increment := TVertScrollBar(Source).Increment;
Exit;
end;
inherited Assign(Source);
end;
procedure TVertScrollBar.ChangeBiDiPosition;
begin
if Kind = sbHorizontal then
if IsScrollBarVisible then
if FControl.UseRightToLeftScrollBar then
Position := 0
else
Position := Range;
end;
procedure TVertScrollBar.CalcAutoRange;
var
I: Integer;
NewRange, AlignMargin: Integer;
procedure ProcessHorz(Control: TControl);
begin
if Control.Visible then
case Control.Align of
alLeft, alNone:
if (Control.Align = alLeft) or (Control.Anchors * [akLeft, akRight] = [akLeft]) then
NewRange := Max(NewRange, Position + Control.Left + Control.Width);
alRight: Inc(AlignMargin, Control.Width);
end;
end;
procedure ProcessVert(Control: TControl);
begin
if Control.Visible then
case Control.Align of
alTop, alNone:
if (Control.Align = alTop) or (Control.Anchors * [akTop, akBottom] = [akTop]) then
NewRange := Max(NewRange, Position + Control.Top + Control.Height);
alBottom: Inc(AlignMargin, Control.Height);
end;
end;
begin
if False {OXY: FControl.AutoScroll } then
begin
if False {OXY: FControl.AutoScrollEnabled } then
begin
NewRange := 0;
AlignMargin := 0;
for I := 0 to FControl.ControlCount - 1 do
if Kind = sbHorizontal then
ProcessHorz(FControl.Controls[I]) else
ProcessVert(FControl.Controls[I]);
DoSetRange(NewRange + AlignMargin + Margin);
end
else DoSetRange(0);
end;
end;
function TVertScrollBar.IsScrollBarVisible: Boolean;
var
Style: Longint;
begin
Style := WS_HSCROLL;
if Kind = sbVertical then Style := WS_VSCROLL;
Result := (Visible) and
(GetWindowLong(FControl.Handle, GWL_STYLE) and Style <> 0);
end;
function TVertScrollBar.ControlSize(ControlSB, AssumeSB: Boolean): Integer;
var
BorderAdjust: Integer;
function ScrollBarVisible(Code: Word): Boolean;
var
Style: Longint;
begin
Style := WS_HSCROLL;
if Code = SB_VERT then Style := WS_VSCROLL;
Result := GetWindowLong(FControl.Handle, GWL_STYLE) and Style <> 0;
end;
function Adjustment(Code, Metric: Word): Integer;
begin
Result := 0;
if not ControlSB then
if AssumeSB and not ScrollBarVisible(Code) then
Result := -(GetSystemMetrics(Metric) - BorderAdjust)
else if not AssumeSB and ScrollBarVisible(Code) then
Result := GetSystemMetrics(Metric) - BorderAdjust;
end;
begin
BorderAdjust := Integer(GetWindowLong(FControl.Handle, GWL_STYLE) and
(WS_BORDER or WS_THICKFRAME) <> 0);
if Kind = sbVertical then
Result := FControl.ClientHeight + Adjustment(SB_HORZ, SM_CXHSCROLL) else
Result := FControl.ClientWidth + Adjustment(SB_VERT, SM_CYVSCROLL);
end;
function TVertScrollBar.GetScrollPos: Integer;
begin
Result := 0;
if Visible then Result := Position;
end;
function TVertScrollBar.NeedsScrollBarVisible: Boolean;
begin
Result := FRange > ControlSize(False, False);
end;
procedure TVertScrollBar.ScrollMessage(var Msg: TWMScroll);
var
Incr, FinalIncr, Count: Integer;
CurrentTime, StartTime, ElapsedTime: Longint;
function GetRealScrollPosition: Integer;
var
SI: TScrollInfo;
Code: Integer;
begin
SI.cbSize := SizeOf(TScrollInfo);
SI.fMask := SIF_TRACKPOS;
Code := SB_HORZ;
if FKind = sbVertical then Code := SB_VERT;
Result := Msg.Pos;
if FlatSB_GetScrollInfo(FControl.Handle, Code, SI) then
Result := SI.nTrackPos;
end;
begin
with Msg do
begin
if FSmooth and (ScrollCode in [SB_LINEUP, SB_LINEDOWN, SB_PAGEUP, SB_PAGEDOWN]) then
begin
case ScrollCode of
SB_LINEUP, SB_LINEDOWN:
begin
Incr := FIncrement div FLineDiv;
FinalIncr := FIncrement mod FLineDiv;
Count := FLineDiv;
end;
SB_PAGEUP, SB_PAGEDOWN:
begin
Incr := FPageIncrement;
FinalIncr := Incr mod FPageDiv;
Incr := Incr div FPageDiv;
Count := FPageDiv;
end;
else
Count := 0;
Incr := 0;
FinalIncr := 0;
end;
CurrentTime := 0;
while Count > 0 do
begin
StartTime := GetCurrentTime;
ElapsedTime := StartTime - CurrentTime;
if ElapsedTime < FDelay then Sleep(FDelay - ElapsedTime);
CurrentTime := StartTime;
case ScrollCode of
SB_LINEUP: SetPosition(FPosition - Incr);
SB_LINEDOWN: SetPosition(FPosition + Incr);
SB_PAGEUP: SetPosition(FPosition - Incr);
SB_PAGEDOWN: SetPosition(FPosition + Incr);
end;
FControl.Update;
Dec(Count);
end;
if FinalIncr > 0 then
begin
case ScrollCode of
SB_LINEUP: SetPosition(FPosition - FinalIncr);
SB_LINEDOWN: SetPosition(FPosition + FinalIncr);
SB_PAGEUP: SetPosition(FPosition - FinalIncr);
SB_PAGEDOWN: SetPosition(FPosition + FinalIncr);
end;
end;
end
else
case ScrollCode of
SB_LINEUP: SetPosition(FPosition - FIncrement);
SB_LINEDOWN: SetPosition(FPosition + FIncrement);
{$IFDEF PAGE_SIZE}
SB_PAGEUP: SetPosition(FPosition - FPageSize);
SB_PAGEDOWN: SetPosition(FPosition + FPageSize);
{$ELSE}
SB_PAGEUP: SetPosition(FPosition - ControlSize(True, False));
SB_PAGEDOWN: SetPosition(FPosition + ControlSize(True, False));
{$ENDIF}
SB_THUMBPOSITION:
if FCalcRange > 32767 then
SetPosition(GetRealScrollPosition) else
SetPosition(Pos);
SB_THUMBTRACK:
if Tracking then
if FCalcRange > 32767 then
SetPosition(GetRealScrollPosition) else
SetPosition(Pos);
SB_TOP: SetPosition(0);
SB_BOTTOM: SetPosition(FCalcRange);
SB_ENDSCROLL: begin end;
end;
end;
end;
procedure TVertScrollBar.SetButtonSize(Value: Integer);
const
SysConsts: array[TScrollBarKind] of Integer = (SM_CXHSCROLL, SM_CXVSCROLL);
var
NewValue: Integer;
begin
if Value <> ButtonSize then
begin
NewValue := Value;
if NewValue = 0 then
Value := GetSystemMetrics(SysConsts[Kind]);
FButtonSize := Value;
FUpdateNeeded := True;
WINUpdateScrollBars;
if NewValue = 0 then
FButtonSize := 0;
end;
end;
procedure TVertScrollBar.SetColor(Value: TColor);
begin
if Value <> Color then
begin
FColor := Value;
FParentColor := False;
FUpdateNeeded := True;
WINUpdateScrollBars;
end;
end;
procedure TVertScrollBar.SetParentColor(Value: Boolean);
begin
if ParentColor <> Value then
begin
FParentColor := Value;
if Value then Color := clBtnHighlight;
end;
end;
procedure TVertScrollBar.SetPosition(Value: Integer);
var
Code: Word;
Form: TCustomForm;
OldPos: Integer;
begin
if csReading in FControl.ComponentState then
FPosition := Value
else
begin
if Value > FCalcRange then Value := FCalcRange
else if Value < 0 then Value := 0;
if Kind = sbHorizontal then
Code := SB_HORZ else
Code := SB_VERT;
if Value <> FPosition then
begin
OldPos := FPosition;
FPosition := Value;
{OXY:
if Kind = sbHorizontal then
FControl.ScrollBy(OldPos - Value, 0) else
FControl.ScrollBy(0, OldPos - Value);
}
if csDesigning in FControl.ComponentState then
begin
Form := GetParentForm(FControl);
if (Form <> nil) and (Form.Designer <> nil) then Form.Designer.Modified;
end;
end;
if FlatSB_GetScrollPos(FControl.Handle, Code) <> FPosition then
FlatSB_SetScrollPos(FControl.Handle, Code, FPosition, True);
end;
end;
procedure TVertScrollBar.SetSize(Value: Integer);
const
SysConsts: array[TScrollBarKind] of Integer = (SM_CYHSCROLL, SM_CYVSCROLL);
var
NewValue: Integer;
begin
if Value <> Size then
begin
NewValue := Value;
if NewValue = 0 then
Value := GetSystemMetrics(SysConsts[Kind]);
FSize := Value;
FUpdateNeeded := True;
WINUpdateScrollBars;
if NewValue = 0 then
FSize := 0;
end;
end;
procedure TVertScrollBar.SetStyle(Value: TScrollBarStyle);
begin
if Style <> Value then
begin
FStyle := Value;
FUpdateNeeded := True;
WINUpdateScrollBars;
end;
end;
procedure TVertScrollBar.SetThumbSize(Value: Integer);
begin
if Value <> ThumbSize then
begin
FThumbSize := Value;
FUpdateNeeded := True;
WINUpdateScrollBars;
end;
end;
procedure TVertScrollBar.DoSetRange(Value: Integer);
begin
FRange := Value;
if FRange < 0 then FRange := 0;
WINUpdateScrollBars;
end;
procedure TVertScrollBar.SetRange(Value: Integer);
begin
//OXY: FControl.FAutoScroll := False;
FScaled := True;
DoSetRange(Value);
end;
function TVertScrollBar.IsRangeStored: Boolean;
begin
Result := not False;// OXY: FControl.AutoScroll;
end;
procedure TVertScrollBar.SetVisible(Value: Boolean);
begin
FVisible := Value;
WINUpdateScrollBars;
end;
procedure TVertScrollBar.Update(ControlSB, AssumeSB: Boolean);
type
TPropKind = (pkStyle, pkButtonSize, pkThumbSize, pkSize, pkBkColor);
const
Props: array[TScrollBarKind, TPropKind] of Integer = (
{ Horizontal }
(WSB_PROP_HSTYLE, WSB_PROP_CXHSCROLL, WSB_PROP_CXHTHUMB, WSB_PROP_CYHSCROLL,
WSB_PROP_HBKGCOLOR),
{ Vertical }
(WSB_PROP_VSTYLE, WSB_PROP_CYVSCROLL, WSB_PROP_CYVTHUMB, WSB_PROP_CXVSCROLL,
WSB_PROP_VBKGCOLOR));
Kinds: array[TScrollBarKind] of Integer = (WSB_PROP_HSTYLE, WSB_PROP_VSTYLE);
Styles: array[TScrollBarStyle] of Integer = (FSB_REGULAR_MODE,
FSB_ENCARTA_MODE, FSB_FLAT_MODE);
var
Code: Word;
ScrollInfo: TScrollInfo;
procedure UpdateScrollProperties(Redraw: Boolean);
begin
FlatSB_SetScrollProp(FControl.Handle, Props[Kind, pkStyle], Styles[Style], Redraw);
if ButtonSize > 0 then
FlatSB_SetScrollProp(FControl.Handle, Props[Kind, pkButtonSize], ButtonSize, False);
if ThumbSize > 0 then
FlatSB_SetScrollProp(FControl.Handle, Props[Kind, pkThumbSize], ThumbSize, False);
if Size > 0 then
FlatSB_SetScrollProp(FControl.Handle, Props[Kind, pkSize], Size, False);
FlatSB_SetScrollProp(FControl.Handle, Props[Kind, pkBkColor],
ColorToRGB(Color), False);
end;
begin
FCalcRange := 0;
Code := SB_HORZ;
if Kind = sbVertical then Code := SB_VERT;
if Visible then
begin
{$IFDEF PAGE_SIZE}
FCalcRange := Range-FPageSize+1;
{$ELSE}
FCalcRange := Range - ControlSize(ControlSB, AssumeSB);
{$ENDIF}
if FCalcRange < 0 then FCalcRange := 0;
end;
ScrollInfo.cbSize := SizeOf(ScrollInfo);
ScrollInfo.fMask := SIF_ALL;
ScrollInfo.nMin := 0;
if FCalcRange > 0 then
ScrollInfo.nMax := Range else
ScrollInfo.nMax := 0;
{$IFDEF PAGE_SIZE}
ScrollInfo.nPage := FPageSize;
{$ELSE}
ScrollInfo.nPage := ControlSize(ControlSB, AssumeSB) + 1;
{$ENDIF}
ScrollInfo.nPos := FPosition;
ScrollInfo.nTrackPos := FPosition;
// if FUpdateNeeded then
begin
UpdateScrollProperties(FUpdateNeeded);
FUpdateNeeded := False;
end;
FlatSB_SetScrollInfo(FControl.Handle, Code, ScrollInfo, True);
SetPosition(FPosition);
FPageIncrement := (ControlSize(True, False) * 9) div 10;
if Smooth then FIncrement := FPageIncrement div 10;
end;
end.
|
unit WPObj_Annotation;
//******************************************************************************
// WPTools V5 - THE word processing component for VCL and .NET
// Copyright (C) 2004 by WPCubed GmbH and Julian Ziersch, all rights reserved
// WEB: http://www.wpcubed.com mailto: support@wptools.de
//******************************************************************************
// WPObj_Annotation - WPTools 6 Annotation Object
//******************************************************************************
interface
uses {$IFDEF DELPHIXE}WinAPI.Windows, {$ELSE} Windows, {$ENDIF}
Classes, Sysutils, Forms, WPRTEDefs, WPRTEPaint, Graphics, Dialogs;
type
TWPOAnnotation = class(TWPObject)
private
FCaption: string;
FPaintMode : Integer;
public
constructor Create(RTFData: TWPRTFDataCollectionBase); override;
destructor Destroy; override;
procedure Paint(toCanvas : TCanvas; BoundCanvas : TRect;
ParentTxtObj: TWPTextObj; PaintMode: TWPTextObjectPaintModes); override;
procedure Select(yes: Boolean); override;
published
property Caption: string read FCaption write FCaption;
property PaintMode : Integer read FPaintMode write FPaintMode default 0;
end;
implementation
constructor TWPOAnnotation.Create(RTFData: TWPRTFDataCollectionBase);
begin
inherited Create(RTFData);
WidthTW := 300;
HeightTW := 200;
end;
destructor TWPOAnnotation.Destroy;
begin
inherited Destroy;
end;
procedure TWPOAnnotation.Paint(toCanvas : TCanvas; BoundCanvas : TRect;
ParentTxtObj: TWPTextObj; PaintMode: TWPTextObjectPaintModes);
var y: Integer;
begin
// Use FPaintMode ...
//! OBSOLETE UpdateBoundCanvas;
toCanvas.Brush.Color := clWhite;
toCanvas.Brush.Style := bsSolid;
toCanvas.Pen.Color := clRed;
toCanvas.Pen.Width := 0;
toCanvas.Rectangle(
BoundCanvas.Left,
BoundCanvas.Top,
BoundCanvas.Right,
BoundCanvas.Bottom);
toCanvas.Brush.Color := clYellow;
y := (BoundCanvas.Bottom - BoundCanvas.Top) div 5;
InflateRect(BoundCanvas, -y, -y);
RoundRect(toCanvas.Handle, BoundCanvas.Left-1, BoundCanvas.Top-1, BoundCanvas.Right, BoundCanvas.Bottom, y div 2, y div 2);
end;
// Instead of selection this object we show an editor
procedure TWPOAnnotation.Select(yes: Boolean);
var s: string;
begin
if yes then
begin
s := Caption;
if InputQuery('Annotation', 'Text:', s) then
Caption := s;
end;
end;
initialization
if GlobalWPToolsCustomEnviroment <> nil then
begin
GlobalWPToolsCustomEnviroment.RegisterWPObject([TWPOAnnotation]);
end;
finalization
if GlobalWPToolsCustomEnviroment <> nil then
begin
GlobalWPToolsCustomEnviroment.UnRegisterWPObject([TWPOAnnotation]);
end;
end.
|
unit ZMCollector;
// ZMCollector.pas - Collects files that hunter finds
(* ***************************************************************************
TZipMaster VCL originally by Chris Vleghert, Eric W. Engler.
Present Maintainers and Authors Roger Aelbrecht and Russell Peters.
Copyright (C) 1997-2002 Chris Vleghert and Eric W. Engler
Copyright (C) 1992-2008 Eric W. Engler
Copyright (C) 2009, 2010, 2011, 2012, 2013 Russell Peters and Roger Aelbrecht
Copyright (C) 2014, 2015 Russell Peters and Roger Aelbrecht
The MIT License (MIT)
Copyright (c) 2014, 2015 delphizip
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
contact: problems AT delphizip DOT org
updates: http://www.delphizip.org
*************************************************************************** *)
// modified 2015-05-21
{$include '.\ZipVers.inc'}
{$ALIGN ON}
{$BOOLEVAL OFF} // important: must be off!
{$LONGSTRINGS ON}
{$EXTENDEDSYNTAX ON}
{$RANGECHECKS OFF}
{$OVERFLOWCHECKS OFF}
{$TYPEDADDRESS ON}
{$WRITEABLECONST OFF}
interface
{$WARN SYMBOL_PLATFORM OFF}
{$DEFINE DEBUG_HUNTER}
uses
{$IFDEF VERDXE2up} // Delphi XE2 or newer
System.Classes, WinApi.Windows,
{$ELSE}
Classes, Windows,
{$ENDIF}
ZipMstr, ZMHuntMisc, ZMBody;
type
TZMCollector = class(TZMCaughtList)
private
FBody: TZMBody;
FCurrentArgs: TZMZipArgs;
FFoundStreams: TZMZipStreamArgList;
FSelectArgs: TZMZipArgList;
function AllowedDuplicate(var Name: string; const Existing: TZMCaughtItem):
boolean;
function DoSetAddNameEvent(const ZBasePath: string; var EntryName: string):
Integer;
function MakeCaughtEntry(const Base, OrigName, Name: string; const FoundRec:
PWin32FindDataW): TZMCaughtItem;
function UpdateName(var EntryName: string): Integer;
function XLateName(var EntryName: string): Integer;
// protected
// function Contains(const EntryName: string): boolean;
public
constructor Create(TheBody: TZMBody);
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
function Deposit(const Base, Path: string; const FoundRec: PWin32FindDataW):
Integer;
property CurrentArgs: TZMZipArgs read FCurrentArgs write FCurrentArgs;
property FoundStreams: TZMZipStreamArgList read FFoundStreams;
property SelectArgs: TZMZipArgList read FSelectArgs;
end;
const
EventChangedIt = 16;
implementation
uses
{$IFDEF VERDXE2up} // Delphi XE2 or newer
System.SysUtils, Vcl.Dialogs, Vcl.Controls,
{$ELSE}
SysUtils, Dialogs,
{$ENDIF}
ZMUtils, ZMXcpt, ZMMsg, ZMStructs, ZMCore, ZMDiags, ZMNameUtils, ZMHashTable,
ZMTimeUtils;
const
__UNIT__ = 8;
const _U_ = (__UNIT__ shl ZERR_LINE_SHIFTS);
const
ZipIncludeListThreshold = 2;
//function SplitPath(const Raw: string; var Rest: string): string;
//var
// EPosn: Integer;
// FPosn: Integer;
// Sin: string;
//begin
// FPosn := Pos('\', Raw);
// EPosn := Length(Raw);
// Sin := Raw;
// if FPosn > 0 then
// begin
// Rest := Copy(Raw, FPosn + 1, EPosn);
// EPosn := FPosn; // keep trailing
// end
// else
// Rest := '';
// Result := Copy(Sin, 1, EPosn);
//end;
constructor TZMCollector.Create(TheBody: TZMBody);
begin
inherited Create;
FBody := TheBody;
end;
procedure TZMCollector.AfterConstruction;
begin
inherited;
FSelectArgs := TZMZipArgList.Create;
FFoundStreams := TZMZipStreamArgList.Create;
end;
function TZMCollector.AllowedDuplicate(var Name: string; const Existing:
TZMCaughtItem): boolean;
var
Dup: TZMHashEntry;
DupCount: Integer;
ExactCount: Integer;
begin
Result := False;
Dup := HashTable.FirstDup(Existing);
DupCount := 0;
ExactCount := 0;
while Dup <> nil do
begin
if CompareFileNames(TZMCaughtItem(Dup).Name, Name) = 0 then
Inc(ExactCount);
Inc(DupCount);
Dup := HashTable.NextDup(Dup);
end;
if ExactCount = 0 then
Result := True // allowed
else
// is duplicate source and name
if {(not IsDir) and} AddAutoDuplicates in CurrentArgs.AddOptions then
begin
// generate a unique name
Name := AppendToName(Name, '{' + IntToStr(DupCount) + '}');
Result := True; // allowed
end;
end;
procedure TZMCollector.BeforeDestruction;
begin
FSelectArgs.Free;
FFoundStreams.Free;
inherited;
end;
// TODO: Contains
//function TZMCollector.Contains(const EntryName: string): boolean;
//begin
//Result := False;
//// TODO : implement
//end;
function TZMCollector.Deposit(const Base, Path: string; const FoundRec:
PWin32FindDataW): Integer;
var
Entry: TZMCaughtItem;
Existing: TZMCaughtItem;
FullPath: string;
IsDir: Boolean;
Name: string;
OrigName: string;
begin
OrigName := String(FoundRec^.cFileName);
IsDir := (FoundRec.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) <> 0;
if IsDir and (OrigName <> '') then
OrigName := OrigName + '\';
OrigName := Path + OrigName;
FullPath := OrigName;
if Base <> '' then
FullPath := IncludeTrailingPathDelimiter(Base) + FullPath;
Name := OrigName;
Result := UpdateName(Name);
if Result >= 0 then
begin
Result := 0;
// does it exist?
Existing := Find(FullPath);
if (Existing <> nil) and (not IsDir) and
((CurrentArgs.AddOptions*[AddDupSource, AddAutoDuplicates]) <> []) then
begin
if AllowedDuplicate(Name, Existing) then
Existing := nil;
end;
if Existing = nil then
begin
Entry := MakeCaughtEntry(Base, OrigName, Name, FoundRec);
Add(Entry);
Result := 1; // used it
end;
end;
if (FBody.Verbosity > ZvVerbose) then
begin
if (Result = 1) then
FBody.DiagStr(ZTrace, 'Accepting: ' + FullPath + '|' + OrigName + ' => ' + Name, _U_ + 230)
else
FBody.DiagStr(ZTrace, 'Rejecting: ' + FullPath + '|' + OrigName + ' => ' + Name, _U_ + 232);
end;
// if (Result <> 1) and (FBody.Verbosity > ZvVerbose) then
// FBody.DiagStr(ZTrace, 'Rejecting: ' + FullPath + '|' + OrigName + ' => ' + Name, _U_ + 458);
end;
// return <0 _ skipped, 0 _ did nothing, >0 _ changed
function TZMCollector.DoSetAddNameEvent(const ZBasePath: string; var EntryName:
string): Integer;
var
IsChanged: Boolean;
TempName: string;
TmpSetAddName: TZMSetAddNameEvent;
begin
Result := 0;
TmpSetAddName := FBody.Master.OnSetAddName;
if Assigned(TmpSetAddName) then
begin
TempName := EntryName;
IsChanged := False;
TmpSetAddName(FBody.Master, TempName, ZBasePath, IsChanged);
if IsChanged then
begin
FBody.DiagFmt(ZI_ChangedTo, [EntryName, TempName], _U_ + 255);
TempName := Unquote(TempName);
if TempName = '' then
begin
Result := ZMError(ZE_EntryCancelled, _U_ + 259);
FBody.DiagStr(ZI_UserCancelledEntry, EntryName, _U_ + 260);
end
else
begin
EntryName := TempName;
Result := EventChangedIt; // changed
end;
end;
end;
end;
function TZMCollector.MakeCaughtEntry(const Base, OrigName, Name: string; const
FoundRec: PWin32FindDataW): TZMCaughtItem;
begin
Result := TZMCaughtItem.Create;
Result.Name := Name;
Result.DefaultName := OrigName;
Result.Attrs := FoundRec^.dwFileAttributes and $3F;
Result.DOSTime := FileTimeToDOSTime(FoundRec^.ftLastWriteTime);
Result.Size := (Int64(FoundRec^.nFileSizeHigh) shl 32) or FoundRec^.nFileSizeLow;
Result.Args := CurrentArgs;
Result.Base := Base;
end;
// return <0 _ user skip, 0 _ no change, 1 _ changed
function TZMCollector.UpdateName(var EntryName: string): Integer;
var
Tmp: string;
begin
Result := 0; // no change
if not CurrentArgs.NFlag then
begin
Tmp := EntryName;
Result := DoSetAddNameEvent(CurrentArgs.BasePath, Tmp);
if Result < 0 then
Exit; // user skip entry
EntryName := Tmp;
end;
if CurrentArgs.XArg <> '' then
Result := XLateName(EntryName);
if (EntryName <> '') and IsInvalidIntName(EntryName) then
begin
FBody.DiagStr(DFQuote+ZT_RejectingBadEntryName, EntryName, _U_ + 302);
Result := FBody.PrepareErrMsg(ZE_BadFileName, [EntryName], _U_ + 303);
end;
end;
function TZMCollector.XLateName(var EntryName: string): Integer;
var
Old: string;
Sep: Integer;
Subst: string;
Tmp: string;
begin
Result := 0;
Old := CurrentArgs.XArg;
Old := SetSlash(Old, PsdExternal);
Sep := Pos('::', Old);
Subst := Trim(Copy(Old, Sep + 2, 2048));
// Subst := SetSlash(Subst, PsdExternal);
if (Length(Old) < 2) {or IsWild(Old)} then
Old := ''
else
Old := Trim(Copy(Old, 1, Sep - 1));
if Old = '*' then
begin
if LastChar(Subst) = '*' then
EntryName := Copy(Subst, 1, length(Subst)-1) + EntryName
else
EntryName := Subst;
Inc(Result); // changed
end
else
if Old = '' then
begin
EntryName := Subst + EntryName;
Inc(Result); // changed
end
else
begin
Old := SetSlash(Old, PsdExternal);
Tmp := StringReplace(EntryName, Old, Subst,
[RfReplaceAll, RfIgnoreCase]);
if CompareStr(Tmp, EntryName) <> 0 then
begin
EntryName := Tmp;
Inc(Result); // changed
end;
end;
end;
end.
|
unit l3LogicalArray;
{ Библиотека "L3 (Low Level Library)" }
{ Автор: Люлин А.В. © }
{ Модуль: l3LogicalArray - }
{ Начат: 30.05.2005 16:30 }
{ $Id: l3LogicalArray.pas,v 1.9 2015/03/24 15:08:15 voba Exp $ }
// $Log: l3LogicalArray.pas,v $
// Revision 1.9 2015/03/24 15:08:15 voba
// - k:585129136
//
// Revision 1.8 2013/04/08 14:50:41 lulin
// - портируем.
//
// Revision 1.7 2013/04/04 11:33:02 lulin
// - портируем.
//
// Revision 1.6 2011/05/18 12:09:16 lulin
// {RequestLink:266409354}.
//
// Revision 1.5 2007/08/14 19:31:59 lulin
// - оптимизируем очистку памяти.
//
// Revision 1.4 2007/08/14 14:30:13 lulin
// - оптимизируем перемещение блоков памяти.
//
// Revision 1.3 2007/02/27 09:55:02 lulin
// - cleanup.
//
// Revision 1.2 2006/12/06 07:40:44 voba
// - enh увеличил макс. количество элементов в массиве
//
// Revision 1.1 2005/05/30 12:34:48 lulin
// - массив логических значений теперь живет в L3.
//
// Revision 1.9 2005/05/30 12:27:47 lulin
// - "правильно" назван класс.
//
// Revision 1.8 2004/10/06 17:15:13 lulin
// - борьба за кошерность.
//
// Revision 1.7 2003/05/23 17:38:41 voba
// no message
//
// Revision 1.6 2001/08/31 11:02:36 law
// - rename unit: MyUtil -> l3FileUtils.
//
// Revision 1.5 2001/04/05 08:52:17 law
// - cleanup: использование модулей WinTypes и WinProcs заменен на Windows.
//
// Revision 1.4 2001/02/21 13:23:45 law
// - bug fix: изменен алгоритм функции cntBitBuff.
//
// Revision 1.3 2000/12/15 15:36:27 law
// - вставлены директивы Log.
//
{$Include l3Define.inc }
interface
uses
Windows,
SysUtils,
l3Base,
l3ProtoObject
;
const
//MaxBitsInArray=524264; {(maxint*2-1)*8; with maxint=32767}
cMaxBitsInArray = High(Longint);
type
TLogicOperType = (LogicAND, LogicOR, LogicXOR);
TSetMode = (smSet, smReset);
//PWordArray=^TWordArray;
//TWordArray = array[0..Pred(High(longint))] of word;
Tl3LogicalArray = class(Tl3ProtoObject)
private
fBitSize : longint; {Bits within the Bitarray}
fSize : Longint; {Bytes within the Bitarray}
fBArray : PAnsiChar; {Pointer to bitarray, dynamically initialized}
fSetCount : Longint;
Procedure DisposeArray;
Procedure MakeArray(Value : Longint);
Procedure SetLogArray(N: Longint; Value : Boolean);
Function GetSettedCount : Longint;
protected
// internal methods
procedure Cleanup;
override;
{-}
public
procedure SetNum (ix: longint);
procedure ResetNum (ix: longint);
procedure SetInterval (ib, ie: longint; aMode : TSetMode);
procedure ToggleNum (ix: longint);
function TestNum (ix: longint):boolean;
procedure LogicConnect(aSecondBArray: Tl3LogicalArray; aConnectMode: TLogicOperType);
procedure AllInvert;
procedure AllFalse;
procedure AllTrue;
Property LogArray[N: Longint]: Boolean read TestNum write SetLogArray ; Default;
Property ArrayCapacity : Longint read fBitSize Write MakeArray;
Property SettedCount : Longint read GetSettedCount;
end;
implementation
uses
l3MinMax,
l3BitArr,
l3Bits // строго после l3BitArr
;
function cntBitBuff(aBuff: PAnsiChar; aSize: Longint): Longint;
{eax, edx}
register;
{-}
asm
or edx, edx
jz @@ret
dec edx
call l3Bit2Index
or eax, eax
jge @@ret
not eax
@@ret:
end;//asm
procedure SetBitInWord(var Target:word; BitNr:word);
Begin
Target:=Target or (1 shl BitNr);
end;
procedure ClrBitInWord(var Target : Word; BitNr : Word);
Begin
Target:=Target and (Not(1 shl BitNr));
end;
procedure InvertBitInWord(var Target : Word; BitNr : Word);
Begin
Target:=Target xor (1 shl BitNr);
end;
function TstBitInWord(Target, BitNr: Word) : Boolean;
Begin
TstBitInWord:=Target and (1 shl BitNr) <> 0;
end;
// start class Tl3LogicalArray
procedure Tl3LogicalArray.Cleanup;
begin
DisposeArray;
inherited;
end;
Procedure Tl3LogicalArray.MakeArray(Value : Longint);
var
lNewBitSize : Longint;
lNewSize : Longint;
lNewBArray : PAnsiChar;
Begin
If Value = fBitSize then Exit;
If Value <= 0 then
begin
DisposeArray;
FSetCount := 0;
Exit;
end;
lNewBitSize := Min(Value, cMaxBitsInArray);
lNewSize := ((lNewBitSize + 31) div 32) * 4; //размер в байтах, но кратно Longint
if fSize <> lNewSize then
begin
if lNewSize <> 0 then
l3System.GetLocalMemZ(lNewBArray, lNewSize)
else
lNewBArray := Nil;
if fBArray <> nil then
begin
l3Move(fBArray^, lNewBArray^, Min(lNewSize, fSize));
//!! При расширении массива надо учитывать, что за последним элементом еще некоторое количество неиспользуемых бит,
// которые не обязательно нулевые, т к некоторые операции работают с целыми байтами - LogicConnect, AllInvert, AllFalse, AllTrue
{V FSetCount correct need!!!}
DisposeArray;
end
else
FSetCount := 0;
fBArray := lNewBArray;
fSize := lNewSize;
end;
fBitSize := lNewBitSize;
end;
procedure Tl3LogicalArray.DisposeArray;
begin
l3System.FreeLocalMem(fBArray);
fBArray:=Nil;
fSize := 0;
fBitSize := 0;
end;
procedure Tl3LogicalArray.SetInterval(ib, ie: Longint; aMode : TSetMode);
Var
I : Longint;
Wb, We : Longint;
lMask : Byte;
procedure SetBitsInByte(aByteNum : Longint; aFirstBitNum, aLastBitNum : Byte);
var
lMask : Byte;
iByte : Byte;
begin
lMask := 0;
for iByte := aFirstBitNum to aLastBitNum do
lMask := lMask + (1 shl iByte);
if aMode = smSet then
Byte(fBArray[aByteNum]) := Byte(fBArray[aByteNum]) or lMask
else
Byte(fBArray[aByteNum]) := Byte(fBArray[aByteNum]) and not lMask;
end;
Begin
if Ib > Ie then l3Swap(ib, ie);
if Ib < 0 then Ib := 0;
if Ie >= fBitSize then Ie := pred(fBitSize);
if Ie < 0 then Exit;
// номера первого и последнего байтов где все биты надо взводить
Wb := (Ib + 7) div 8;
We := (Ie div 8);
if aMode = smSet then
lMask := $FF
else
lMask := $00;
//взводим целыми байтами
if We > Wb then
l3FillChar(fBArray[Wb], (We - Wb), lMask);
//теперь разберемся с началом
I := (Ib div 8) * 8 + 7; //последний бит в первом байте
If I > Ie then I := Ie; // Ib и Ie в одном байте
SetBitsInByte(Ib div 8, // байт с Ib
Ib mod 8, // номер бита для Ib
I mod 8 // номер бита для I
);
if I <> Ie then // остался хвост
SetBitsInByte(Ie div 8, // байт с Ie
0, // c первого бита
Ie mod 8 // номер бита для Ie
);
if (FSetCount = 0) and (aMode = smSet) then
fSetCount := Ie - Ib + 1
else
if (fSetCount = fBitSize) and (aMode = smReset) then
fSetCount := fBitSize - (Ie - Ib + 1)
else
fSetCount := -1;
end;
procedure Tl3LogicalArray.AllFalse;
{Clear the whole bitarray}
begin
l3FillChar(fBArray^, fSize, 0);
FSetCount := 0;
end;
procedure Tl3LogicalArray.AllTrue;
{Clear the whole bitarray}
Begin
l3FillChar(fBArray^, fSize, $FF);
FSetCount := fBitSize;
end;
procedure Tl3LogicalArray.AllInvert;
{Invert the whole bitarray}
var
I : Longint;
lBArray : PAnsiChar;
begin
lBArray := fBArray;
for I := 0 to Pred(fSize div 4) do
begin
PLongint(lBArray)^ := not PLongint(lBArray)^;
Inc(lBArray, 4);
end;
FSetCount := fBitSize - fSetCount;
end;
procedure Tl3LogicalArray.LogicConnect (aSecondBArray: Tl3LogicalArray; aConnectMode: TLogicOperType);
{Logical connect two bitarrays. They must be the same size}
var
I : Longint;
lBArray : PAnsiChar;
lSecondBArray : PAnsiChar;
begin
if (fBitSize > 0) and (aSecondBArray.fBitSize > 0) then
begin
lBArray := fBArray;
lSecondBArray := aSecondBArray.fBArray;
case aConnectMode of
LogicAND :
for I := 0 to Pred(Min(fSize, aSecondBArray.fSize) div 4) do
begin
PLongint(lBArray)^ := PLongint(lBArray)^ and PLongint(lSecondBArray)^;
Inc(lBArray, 4);
Inc(lSecondBArray, 4);
end;
LogicOR :
for I := 0 to Pred(Min(fSize, aSecondBArray.fSize) div 4) do
begin
PLongint(lBArray)^ := PLongint(lBArray)^ or PLongint(lSecondBArray)^;
Inc(lBArray, 4);
Inc(lSecondBArray, 4);
end;
LogicXOR :
for I := 0 to Pred(Min(fSize, aSecondBArray.fSize) div 4) do
begin
PLongint(lBArray)^ := PLongint(lBArray)^ xor PLongint(lSecondBArray)^;
Inc(lBArray, 4);
Inc(lSecondBArray, 4);
end;
end;
fSetCount := -1;
end;
end;
procedure Tl3LogicalArray.SetNum(Ix: Longint);
var
lLongNum : PLongint;
lBitNum : Byte;
begin
if (Ix >= 0) and (Ix < fBitSize) then
begin
lLongNum := PLongint(fBArray + Ix div 8);
lBitNum := Ix mod 8;
if not l3TestBit(lLongNum^, lBitNum) then
begin
l3SetBit(lLongNum^, lBitNum);
Inc(FSetCount);
end;
end;
end;
procedure Tl3LogicalArray.ResetNum(Ix: Longint);
var
lLongNum : PLongint;
lBitNum : Byte;
begin
if (Ix >= 0) and (Ix < fBitSize) then
begin
lLongNum := PLongint(fBArray + Ix div 8);
lBitNum := Ix mod 8;
if l3TestBit(lLongNum^, lBitNum) then
begin
l3ClearBit(lLongNum^, lBitNum);
Dec(FSetCount);
end;
end;
end;
procedure Tl3LogicalArray.ToggleNum(Ix: Longint);
var
lLongNum : PLongint;
lBitNum : Byte;
begin
if (Ix >= 0) and (Ix < fBitSize) then
begin
lLongNum := PLongint(fBArray + Ix div 8);
lBitNum := Ix mod 8;
l3InvertBit(lLongNum^, lBitNum);
if l3TestBit(lLongNum^, lBitNum) then
Inc(fSetCount)
else
Dec(fSetCount);
end;
end;
function Tl3LogicalArray.TestNum(ix: longint): boolean;
{-}
begin
if (Ix >= 0) and (Ix < fBitSize) then
Result := l3TestBit(PLongint(fBArray + Ix div 8)^, Ix mod 8)
else
Result := False;
end;
procedure Tl3LogicalArray.SetLogArray(N: Longint; Value : Boolean);
begin
if Value then
SetNum(N)
else
ResetNum(N);
end;
function Tl3LogicalArray.GetSettedCount : Longint;
begin
if FSetCount < 0 then
fSetCount := cntBitBuff(PAnsiChar(fBArray), fBitSize);
Result := fSetCount;
end;
end.
|
// This unit gives the program the capabiliy to have this variables in multiple units.
// Esta unidade permite nos ter variaveis para serem usadas em todas as units.
unit GlobalVariables;
interface
// screenrec record is used to stone position and size of the screen.
// recorde screenrec é usado para guardar posicao e localizacao do ecra.
type screenrec = record
x : integer;
y : integer;
width : integer;
height : integer;
End;
// this is used to store what a key for a door is.
// aqui é defenido o que é uma chave de uma porta.
DoorKey = record
ID : integer;
x : integer;
y : integer;
End;
// This is used to define menu options
// Isto define as opcoes dos menus.
Options = record
ID : integer;
text : String;
End;
// This defines menus.
// Isto define menus.
Menu = record
options : Array[0..10] of Options;
noptions : integer;
x : integer;
y : integer;
over : integer;
foptions : integer;
opened : Boolean;
End;
// This defines the actions fo the blocks.
// Isto define uma acao de um bloco.
blockaction = record
x : integer;
y : integer;
level : integer;
useAction : boolean;
End;
// This defines where to move the doors.
// Isto define para onde mover as portas.
DoorAction = record
xt : integer;
yt : integer;
opened : boolean;
End;
// blockType record defines a block and contains background color, text color, simbols and name.
// recorde blockType define blocos e contem cor de fundo, cor de texto, caracter e nome.
blockType = record
ID : integer;
bColor : integer;
tColor : integer;
collidable : boolean;
action : blockaction;
door : DoorAction;
Name : String;
simbol : Char;
End;
// This is what defines the keys for each player.
// Isto define as teclas para cada jogador.
KeyboardActions = record
ID : integer;
up : integer;
down : integer;
left : integer;
right : integer;
End;
// EntityType record defines the mob/entity types, includes Name, ID, Damage and Life.
// EntityType define a vida e o valor de ataque de um tipo de entidade.
EntityType = record
ID : integer;
Damage : integer;
Life : integer;
End;
// EntityFullType defines an entity type with colors.
// EntityFullType define uma entidade total.
EntityFullType = record
ID : integer;
Name : String;
keydoors : Array[0..20] of DoorKey;
EntType : EntityType;
bColor : integer;
tColor : integer;
Simbol : Char;
End;
// Entity record define a mob and includes Name, EntType, bColor, tColor, Simbol and KeyboardActions.
// Entity define a entidade contento Name, EntType, bColor, tColor, Simbol and KeyboardActions.
Entity = record
Name : String;
EntType : EntityType;
KeyAction : KeyboardActions;
keydoors : Array[0..20] of DoorKey;
bColor : integer;
tColor : integer;
x : integer;
y : integer;
Simbol : Char;
Visible : boolean;
Updatable : boolean;
Updates : Integer;
isPlayer : boolean;
End;
// This is for the XML reader. This defines the TAGNEEDs.
// Isto é para o leitor de XML e define as TAGNEEDs.
TagNeeds = record
Name : String;
DefaultValue : String;
InputType : String;
End;
// This is for the XML reader. This defines the SUBTAGs.
// Isto é para o leitor de XML e define as SUBTAGs.
SubTag = record
Name : String;
tagNeeds : Array[0..10] of TagNeeds;
End;
// This is for the XML reader. This defines the TAGs.
// Isto é para o leitor de XML e define as TAGs.
Tag = record
inUse : boolean;
Name : String;
usetagNeeds : boolean;
tagNeeds : Array[0..10] of TagNeeds;
usesubTags : boolean;
subTags : Array[0..10] of SubTag;
End;
TagData = record
name : String;
value : String;
End;
codeTag = record
name : String[250];
dataAm, fromChar, toChar, fromLine, toLine : integer;
data : Array[0..20] of TagData;
End;
TagDataType = record
data : Array[0..20] of TagData;
End;
subTagsType = record
subTag : Array[0..20] of codeTag;
End;
codeFullTag = record
name : String[250];
hasSub : boolean;
data : Array[0..20] of TagData;
dataAm, fromChar, toChar, fromLine, toLine, subAmount : integer;
subTag : Array[0..20] of codeTag;
End;
codeFile = record
code : Array[0..10000] of String[250];
End;
levelsdata = record
id : integer;
name : string;
through : boolean;
End;
var tags : Array[0..200] of codeFullTag;
tagamount, KeyActionsAmount, LevelsAmount, BlocksTypeAmount, EntityTypeAmount, EntityModelAmount : integer;
processedCode : codeFile;
ShowLevel, ShowEachPlayerLife, ShowEachPlayerName : boolean;
SeperatorCharacter : char;
LevelInformation : Array[0..100] of levelsdata;
// Screen contains the width, height and inicial x and y position for the game screen.
// Screen contem largura, altura e posicao inicial em x e y do ecra de jogo.
var screen : screenrec;
// blocks is an array that holds all the blocks on the game.
// blocks é uma variavel que contem todos os blocos do jogo.
var blocks : Array[0..20] of blockType;
// worldBlocks is THE MOST IMPORTANT ARRAY of the game, this holds all the world blocks.
// worldBlocks é a ARRAY MAIS IMPORTANTE do jogo, contem todos os blocos presentes no mapa.
var worldBlocks : Array[0..1794] of blockType;
// This tells us when and if the map has been changed.
// Esta variavel informa nos se o mapa foi alterado.
var MAPCHANGE : boolean;
// This is the current level that the player is on.
// Esta variavel guarda o nevel actual do player.
var currentLevel : Integer;
// This array stores all the entity types available.
// Esta array guarda todos os tipos de entidades disponiveis.
var EntityTypes : Array[0..20] of EntityType;
var EntityFullTypes : Array[0..20] of EntityFullType;
// This array stores all the players keyboard settings.
// Esta array guarda todas as definicoes do player.
var Keys : Array[0..20] of KeyboardActions;
// This array stores all the entities on the map.
// Esta array guarda todas as entidades presentes no mapa.
var entities : Array[0..100] of Entity;
// This are all the
var MainMenu, GameMenu, NewGame, KeyboardSettings : Menu;
var NPlayers : Integer;
// Running var is used to keep the information and an easy closing method for the game.
// A variavel Running é usada para nos mantermos facilmente informados do estado do jogo e facilmente fechar o jogo.
var changedLevel, running, needDisplay, gameReady, CREATE, special, inEditor : boolean;
// This represents the exe Current Location.
var gameDirectory : String;
// This represents the resorces folder.
var resDirectory : String;
// This stores the Tags.
// Aqui sao guardadas as Tags.
// var Tags : Array[0..10] of Tag;
var Loading : boolean;
Type PlayerLoadedData = Record
level : integer;
entities : Array[0..100] of Entity;
End;
Var PlayerDataFile : File of PlayerLoadedData;
Var PlayerData : PlayerLoadedData;
implementation
end.
|
unit SieveOfEratosthenes;
// siehe: http://www.delphipraxis.net/topic90577_primzahlen+im+intervall+2+n+ermitteln.htm
interface
uses
Classes;
type
TSieveOfEratosthenes = class(TPersistent)
private
fMaxValue: Cardinal;
fSieve: TBits;
fPrimes: array of Cardinal;
fPrimesFound : Cardinal;
function GetPrimes(const i: Cardinal): Cardinal;
function GetPrimesFound: Cardinal;
procedure SetMaxValue(AValue: Cardinal);
public
constructor Create(AMaxValue: Cardinal);
destructor Destroy;override;
property MaxValue: Cardinal read fMaxValue write SetMaxValue;
property Primes[const index: Cardinal]: Cardinal read GetPrimes;
property PrimesFound: Cardinal read GetPrimesFound;
procedure FindPrimes();
function IsPrime(value:cardinal):Boolean;
end;
implementation
{ TSieveOfEratosthenes }
constructor TSieveOfEratosthenes.Create(AMaxValue: Cardinal);
begin
inherited Create;
fSieve := TBits.Create;
MaxValue := AMaxValue;
end;
destructor TSieveOfEratosthenes.Destroy;
begin
fSieve.Free;
inherited;
end;
procedure TSieveOfEratosthenes.FindPrimes;
var i, j: Cardinal;
begin
fSieve.Size := 0; // alten Inhalt wegwerfen
fSieve.Size := MaxValue+1; // speicher für Sieb reservieren
// hier wird gesiebt
i := 2;
while i*i <= MaxValue do begin
if fSieve.Bits[i] = false then
begin
j := i*i;
while j <= MaxValue do
begin
fSieve.Bits[j] := true;
Inc(j, i);
end;
end;
i := i + 1;
end;
// Zählen der gefundenen Primzahlen
fPrimesFound := 0;
for i := 2 to MaxValue do
if fSieve.Bits[i] = false then
Inc(fPrimesFound);
// speichern der Primzahl
SetLength(fPrimes, fPrimesFound);
j := 0;
for i := 2 to MaxValue do begin
if fSieve.Bits[i] = false then
begin
fPrimes[j] := i;
Inc(j);
end;
end;
end;
function TSieveOfEratosthenes.GetPrimes(const i: Cardinal): Cardinal;
begin
Result := fPrimes[i];
end;
function TSieveOfEratosthenes.GetPrimesFound: Cardinal;
begin
Result := Length(fPrimes);
end;
function TSieveOfEratosthenes.IsPrime(value: cardinal): Boolean;
begin
result := not fSieve.Bits[value];
end;
procedure TSieveOfEratosthenes.SetMaxValue(AValue: Cardinal);
begin
fMaxValue := AValue;
end;
end.
|
program TFTP_Template;
{$mode objfpc}{$H+}
{ Advanced example - Template }
{ }
{ This example shows how to create webserver and TFTP server with remote shell }
{ This version is for Raspberry Pi 2B and will also work on a 3B. }
{ After the first time that kernel7.img has been transferred to micro sd card }
{ tftp xx.xx.xx.xx < cmdstftp }
{ contents of cmdstftp }
{ binary }
{ put kernel7.img }
{ quit }
uses
{InitUnit, Include InitUnit to allow us to change the startup behaviour}
RaspberryPi2, {Include RaspberryPi2 to make sure all standard functions are included}
GlobalConst,
GlobalTypes,
Threads,
Console,
HTTP, {Include HTTP and WebStatus so we can see from a web browser what is happening}
WebStatus,
SysUtils, { TimeToStr & Time }
Logging,
uTFTP,
Winsock2,
{ needed to use ultibo-tftp }
{ needed for telnet }
Shell,
ShellFilesystem,
ShellUpdate,
RemoteShell;
{ needed for telnet }
var
LeftWindow:TWindowHandle;
HTTPListener:THTTPListener;
{ needed to use ultibo-tftp }
TCP : TWinsock2TCPClient;
IPAddress : string;
function WaitForIPComplete : string;
var
TCP : TWinsock2TCPClient;
begin
TCP := TWinsock2TCPClient.Create;
Result := TCP.LocalAddress;
if (Result = '') or (Result = '0.0.0.0') or (Result = '255.255.255.255') then
begin
while (Result = '') or (Result = '0.0.0.0') or (Result = '255.255.255.255') do
begin
sleep (1500);
Result := TCP.LocalAddress;
end;
end;
TCP.Free;
end;
procedure Msg (Sender : TObject; s : string);
begin
ConsoleWindowWriteLn (LeftWindow, s);
end;
procedure WaitForSDDrive;
begin
while not DirectoryExists ('C:\') do sleep (500);
end;
begin
{The following 3 lines are logging to the console
CONSOLE_REGISTER_LOGGING:=True;
LoggingConsoleDeviceAdd(ConsoleDeviceGetDefault);
LoggingDeviceSetDefault(LoggingDeviceFindByType(LOGGING_TYPE_CONSOLE));
}
{The following 2 lines are logging to a file
LoggingDeviceSetTarget(LoggingDeviceFindByType(LOGGING_TYPE_FILE),'c:\ultibologging.log');
LoggingDeviceSetDefault(LoggingDeviceFindByType(LOGGING_TYPE_FILE)); }
{Create a console window to show what is happening}
LeftWindow:=ConsoleWindowCreate(ConsoleDeviceGetDefault,CONSOLE_POSITION_LEFT,True);
{Display a startup message on the console}
ConsoleWindowWriteLn(LeftWindow,'Starting TFTP_Template example');
// wait for IP address and SD Card to be initialised.
WaitForSDDrive;
IPAddress := WaitForIPComplete;
{Create and start the HTTP Listener for our web status page}
HTTPListener:=THTTPListener.Create;
HTTPListener.Active:=True;
ConsoleWindowWriteLn (LeftWindow, 'Local Address ' + IPAddress);
SetOnMsg (@Msg);
{Register the web status page, the "Thread List" page will allow us to see what is happening in the example}
WebStatusRegister(HTTPListener,'','',True);
{Halt this thread}
ThreadHalt(0);
end.
|
unit K569230238_EVD2EVD;
{* [RequestLink:569230238] }
// Модуль: "w:\common\components\rtl\Garant\Daily\K569230238_EVD2EVD.pas"
// Стереотип: "TestCase"
// Элемент модели: "K569230238_EVD2EVD" MUID: (5492DC8502F9)
// Имя типа: "TK569230238_EVD2EVD"
{$Include w:\common\components\rtl\Garant\Daily\TestDefine.inc.pas}
interface
{$If Defined(nsTest) AND NOT Defined(NoScripts)}
uses
l3IntfUses
, EVDtoEVDWriterTest
;
type
TK569230238_EVD2EVD = class(TEVDtoEVDWriterTest)
{* [RequestLink:569230238] }
protected
function GetFolder: AnsiString; override;
{* Папка в которую входит тест }
function GetModelElementGUID: AnsiString; override;
{* Идентификатор элемента модели, который описывает тест }
end;//TK569230238_EVD2EVD
{$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts)
implementation
{$If Defined(nsTest) AND NOT Defined(NoScripts)}
uses
l3ImplUses
, TestFrameWork
//#UC START# *5492DC8502F9impl_uses*
//#UC END# *5492DC8502F9impl_uses*
;
function TK569230238_EVD2EVD.GetFolder: AnsiString;
{* Папка в которую входит тест }
begin
Result := '7.11';
end;//TK569230238_EVD2EVD.GetFolder
function TK569230238_EVD2EVD.GetModelElementGUID: AnsiString;
{* Идентификатор элемента модели, который описывает тест }
begin
Result := '5492DC8502F9';
end;//TK569230238_EVD2EVD.GetModelElementGUID
initialization
TestFramework.RegisterTest(TK569230238_EVD2EVD.Suite);
{$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts)
end.
|
unit UAccessGroup;
interface
uses Classes, UAccessBase, UAccessContainer, CheckLst;
type
TSAVAccessGroup = class(TSAVAccessContainer)
private
FPriority: Integer;
procedure SetPriority(const Value: Integer);
//function UserAdd(const aSID: string): Boolean;
protected
public
property Priority: Integer read FPriority write SetPriority;
constructor Create; overload;
constructor Create(aBase: TSAVAccessBase; const aCaption, aSID, aPriority,
aDescription:
string);
overload;
procedure Save; override;
function Load(aSID: string = ''): Boolean; override;
procedure Open(aBase: TSAVAccessBase; const aCaption, aSID: string; const
aDescription: string = ''; const aParam: string = ''; const aVersion:
TVersionString = ''); override;
procedure GetUsersSID(List: TStrings; const aCaption: Boolean = False);
overload;
procedure GetUsersSID(List: TCheckListBox; const aCaption: Boolean = False);
overload;
function UserAdd(const aSID: string): Boolean;
function UserDelete(const aSID: string): Boolean;
function UserOff(const aSID: string): Boolean;
function UserOn(const aSID: string): Boolean;
function UserSwitch(const aSID: string; const aWork: Boolean): Boolean;
procedure Clear; override;
procedure UpdateVersion; override;
end;
implementation
uses SysUtils, VKDBFDataSet, VKDBFNTX, VKDBFIndex, VKDBFSorters,
UAccessConstant, SAVLib_DBF, IniFiles;
{ TSAVAccessGroup }
function TSAVAccessGroup.UserAdd(const aSID: string): Boolean;
var
Ini01: TIniFile;
begin
Result := True;
Ini01 := TIniFile.Create(IncludeTrailingPathDelimiter(WorkDir) +
csContainerCfg);
Ini01.WriteBool(csIniUsers, aSID, True);
FreeAndNil(Ini01);
try
Ini01 := TIniFile.Create(IncludeTrailingPathDelimiter(Bases.UsersDir) + aSID
+
'\' + csContainerCfg);
Ini01.WriteInteger(csIniGroups, SID, FPriority);
except
Result := False
end;
if Assigned(Ini01) then
FreeAndNil(Ini01);
end;
procedure TSAVAccessGroup.Clear;
begin
inherited;
FPriority := 0;
end;
constructor TSAVAccessGroup.Create(aBase: TSAVAccessBase; const aCaption,
aSID, aPriority, aDescription: string);
begin
Create;
Open(aBase, aCaption, aSID, aDescription, aPriority);
Save;
end;
constructor TSAVAccessGroup.Create;
begin
inherited Create;
ContainerType := 'G';
end;
procedure TSAVAccessGroup.GetUsersSID(List: TStrings; const aCaption: Boolean =
False);
var
Ini01: TIniFile;
i: Integer;
s: string;
OldFiltered: Boolean;
OldRecNo: Integer;
begin
Ini01 := TIniFile.Create(IncludeTrailingPathDelimiter(WorkDir) +
csContainerCfg);
List.Clear;
Ini01.ReadSection(csIniUsers, List);
if (aCaption) and (Bases.TableUsers.RecordCount > 0) then
begin
OldFiltered := Bases.TableUsers.Filtered;
OldRecNo := Bases.TableUsers.RecNo;
Bases.TableUsers.Filtered := False;
for i := 0 to List.Count - 1 do
begin
if Bases.TableUsers.Locate(csFieldSID, List[i], []) then
s := Bases.TableUsers.FieldByName(csFieldCaption).AsString
else
s := csNotFound;
List[i] := s + '=' + List[i];
end;
Bases.TableUsers.RecNo := OldRecNo;
Bases.TableUsers.Filtered := OldFiltered;
end;
FreeAndNil(Ini01);
end;
function TSAVAccessGroup.Load(aSID: string): Boolean;
var
table1: TVKDBFNTX;
s: string;
begin
if aSID = '' then
s := SID
else
s := aSID;
table1 := TVKDBFNTX.Create(nil);
InitOpenDBF(table1, IncludeTrailingPathDelimiter(Bases.JournalsDir)
+ csTableGroups, 66);
table1.Open;
Result := table1.Locate(csFieldSID, s, []);
if Result then
begin
SID := s;
Caption := table1.fieldByName(csFieldCaption).AsString;
Description := table1.FieldByName(csFieldDescription).AsString;
ID := table1.FieldByName(csFieldID).AsInteger;
Priority := table1.FieldByName(csFieldPrority).AsInteger;
WorkDir := IncludeTrailingPathDelimiter(Bases.GroupsDir) + SID;
ReadVersion;
end;
table1.Close;
FreeAndNil(table1);
end;
procedure TSAVAccessGroup.Open(aBase: TSAVAccessBase; const aCaption, aSID,
aDescription, aParam: string; const aVersion: TVersionString);
begin
WorkDir := IncludeTrailingPathDelimiter(aBase.GroupsDir) + aSID;
inherited Open(aBase, aCaption, aSID, aDescription, aParam, aVersion);
FPriority := StrToInt(aParam);
end;
procedure TSAVAccessGroup.Save;
var
table1: TVKDBFNTX;
j: Integer;
begin
inherited;
table1 := TVKDBFNTX.Create(nil);
SAVLib_DBF.InitOpenDBF(table1, Bases.JournalsPath + csTableGroups, 66);
with table1.Indexes.Add as TVKNTXIndex do
NTXFileName := Bases.JournalsPath + csIndexGroupName;
with table1.Indexes.Add as TVKNTXIndex do
NTXFileName := Bases.JournalsPath + csIndexGroupVersion;
table1.Open;
if table1.FLock then
begin
if (SID = '') or (not (table1.Locate(csFieldSID, SID, []))) then
begin
table1.Append;
j := table1.GetNextAutoInc(csFieldID);
if SID = '' then
SID := IntToStr(j);
table1.FieldByName(csFieldSID).AsString := SID;
table1.FieldByName(csFieldID).AsInteger := j;
end
else
table1.Edit;
table1.FieldByName(csFieldPrority).AsInteger := FPriority;
table1.FieldByName(csFieldCaption).AsString := Caption;
table1.FieldByName(csFieldDescription).AsString := Description;
table1.FieldByName(csFieldVersion).AsString := GetNewVersion;
Version := table1.FieldByName(csFieldVersion).AsString;
ID := table1.FieldByName(csFieldID).AsInteger;
table1.Post;
table1.UnLock;
end
else
raise Exception.Create(csFLockError + Table1.DBFFileName);
table1.Close;
FreeAndNil(table1);
WorkDir := IncludeTrailingPathDelimiter(Bases.GroupsDir) + SID;
ForceDirectories(WorkDir);
WriteVersion;
end;
procedure TSAVAccessGroup.SetPriority(const Value: Integer);
begin
FPriority := Value;
end;
function TSAVAccessGroup.UserDelete(const aSID: string): Boolean;
var
Ini01: TIniFile;
begin
Result := True;
Ini01 := TIniFile.Create(IncludeTrailingPathDelimiter(WorkDir) +
csContainerCfg);
Ini01.DeleteKey(csIniUsers, aSID);
FreeAndNil(Ini01);
try
Ini01 := TIniFile.Create(IncludeTrailingPathDelimiter(Bases.UsersDir) + aSID
+
'\' + csContainerCfg);
Ini01.DeleteKey(csIniGroups, SID);
except
Result := False;
end;
if Assigned(Ini01) then
FreeAndNil(Ini01);
end;
procedure TSAVAccessGroup.GetUsersSID(List: TCheckListBox;
const aCaption: Boolean);
var
Ini01: TMemIniFile;
i: Integer;
s: string;
OldFiltered: Boolean;
OldRecNo: Integer;
begin
Ini01 := TMemIniFile.Create(IncludeTrailingPathDelimiter(WorkDir) +
csContainerCfg);
List.Clear;
Ini01.ReadSection(csIniUsers, List.Items);
for i := 0 to List.Count - 1 do
List.Checked[i] := Ini01.ReadBool(csIniUsers, List.Items[i], False);
if (aCaption) and (Bases.TableUsers.RecordCount > 0) then
begin
OldFiltered := Bases.TableUsers.Filtered;
OldRecNo := Bases.TableUsers.RecNo;
Bases.TableUsers.Filtered := False;
for i := 0 to List.Count - 1 do
begin
if Bases.TableUsers.Locate(csFieldSID, List.Items[i], []) then
s := Bases.TableUsers.FieldByName(csFieldCaption).AsString
else
s := 'Not found';
List.Items[i] := s + '=' + List.items[i];
end;
Bases.TableUsers.RecNo := OldRecNo;
Bases.TableUsers.Filtered := OldFiltered;
end;
FreeAndNil(Ini01);
end;
function TSAVAccessGroup.UserOff(const aSID: string): Boolean;
begin
Result := UserSwitch(aSID, False);
end;
function TSAVAccessGroup.UserOn(const aSID: string): Boolean;
begin
Result := UserSwitch(aSID, True);
end;
function TSAVAccessGroup.UserSwitch(const aSID: string;
const aWork: Boolean): Boolean;
var
Ini01: TIniFile;
begin
Result := True;
Ini01 := TIniFile.Create(IncludeTrailingPathDelimiter(WorkDir) +
csContainerCfg);
Ini01.WriteBool(csIniUsers, aSID, aWork);
FreeAndNil(Ini01);
try
Ini01 := TIniFile.Create(IncludeTrailingPathDelimiter(Bases.UsersDir) + aSID
+
'\' + csContainerCfg);
if aWork then
Ini01.WriteInteger(csIniGroups, SID, Priority)
else
Ini01.DeleteKey(csIniGroups, SID);
except
Result := False;
end;
if Assigned(Ini01) then
FreeAndNil(Ini01);
end;
procedure TSAVAccessGroup.UpdateVersion;
var
table1: TVKDBFNTX;
begin
inherited;
table1 := TVKDBFNTX.Create(nil);
InitOpenDBF(table1, Bases.JournalsPath + csTableGroups, 66);
with table1.Indexes.Add as TVKNTXIndex do
NTXFileName := Bases.JournalsPath + csIndexGroupVersion;
table1.Open;
if table1.Locate(csFieldSID, SID, []) then
begin
if table1.FLock then
begin
table1.Edit;
table1.FieldByName(csFieldVersion).AsString := Version;
table1.Post;
end
else
raise Exception.Create(csFLockError + Table1.DBFFileName);
end;
table1.Close;
FreeAndNil(table1);
end;
end.
|
{$MODE OBJFPC}
program DoubleTours;
const
InputFile = 'WALK.INP';
OutputFile = 'WALK.OUT';
maxN = 10;//100000;
maxM = 10;//100000;
maxC = 2000000000;
maxD = maxN * maxC;
type
TEdge = record
x, y: Integer;
w: Integer;
selected: Boolean;
end;
THeap = record
nItems: Integer;
items: array[1..maxN] of Integer;
pos: array[1..maxN] of Integer;
end;
TTrace = array[1..maxN] of Integer;
var
e: array[-maxM..maxM] of TEdge;
link: array[-maxM..maxM] of Integer;
head: array[1..maxN] of Integer;
d: array[1..maxN] of Int64;
trace: array[1..maxN] of Integer;
price: array[1..maxN] of Int64;
heap: THeap;
n, m: Integer;
d1, d2, res: Int64;
p, q: array[1..maxN] of Integer;
np, nq: Integer;
procedure Enter;
var
f: TextFile;
i, j, u, v: Integer;
begin
AssignFile(f, InputFile); Reset(f);
try
ReadLn(f, n, m);
for i := 1 to m do
begin
with e[i] do ReadLn(f, x, y, w);
j := -i;
e[j].x := e[i].y; e[j].y := e[i].x; e[j].w := e[i].w;
end;
finally
CloseFile(f);
end;
end;
procedure BuildIncidentLists;
var
i: Integer;
begin
FillDWord(head[1], n, 0);
for i := -m to m do
if i <> 0 then
with e[i] do
begin
link[i] := head[x];
head[x] := i;
end;
end;
procedure Init;
var
i: Integer;
begin
FillChar(price[1], n * SizeOf(price[1]), 0);
for i := -m to m do
e[i].selected := False;
end;
function wp(const e: TEdge): Int64;
begin
with e do
Result := w + price[x] - price[y];
end;
procedure DijkstraInit;
var
i: Integer;
begin
for i := 1 to n do d[i] := maxD + 1;
d[1] := 0;
FillDWord(heap.pos[1], n, 0);
heap.nItems := 1;
heap.items[1] := 1;
end;
function Extract: Integer;
var
p, c: Integer;
v: Integer;
begin
with Heap do
begin
Result := items[1];
v := items[nItems];
Dec(nItems);
p := 1;
repeat
c := p * 2;
if (c < nItems) and (d[items[c + 1]] < d[items[c]]) then Inc(c);
if (c > nItems) or (d[items[c]] >= d[v]) then Break;
items[p] := items[c];
pos[items[p]] := p;
p := c;
until False;
items[p] := v;
pos[v] := p;
end;
end;
function Update(v: Integer; dv: Int64): Boolean;
var
p, c: Integer;
begin
Result := d[v] > dv;
if not Result then Exit;
d[v] := dv;
with Heap do
begin
c := pos[v];
if c = 0 then
begin
Inc(nItems); c := nItems;
end;
repeat
p := c div 2;
if (p = 0) or (d[items[p]] <= d[v]) then Break;
items[c] := items[p];
pos[items[c]] := c;
c := p;
until False;
items[c] := v;
pos[v] := c;
end;
end;
function Dijkstra: Boolean;
var
u, v, i: Integer;
begin
DijkstraInit;
repeat
u := Extract;
if u = n then Exit(True);
i := head[u];
while i <> 0 do
begin
v := e[i].y;
if not e[i].selected and Update(v, d[u] + wp(e[i])) then
trace[v] := i;
i := link[i];
end;
until heap.nItems = 0;
Result := False;
end;
procedure AdjustPotentials;
var
u, v, i: Integer;
begin
for v := 1 to n do
if d[v] < d[n] then
Dec(price[v], d[n] - d[v]);
v := n;
repeat
i := trace[v];
e[i].selected := True;
e[-i].w := -e[i].w;
v := e[i].x;
until v = 1;
end;
procedure RemoveEdges;
var
i: Integer;
begin
for i := 1 to m do
if e[i].selected and e[-i].selected then
begin
e[i].selected := False;
e[-i].selected := False;
end;
end;
function Solve: Int64;
var
u: Integer;
i: Integer;
begin
if not Dijkstra then Exit(-1);
AdjustPotentials;
d1 := price[n] - price[1];
if not Dijkstra then Exit(-1);
AdjustPotentials;
d2 := price[n] - price[1];
Result := d1 + d2;
RemoveEdges;
np := 0;
u := 1;
repeat
Inc(np);
p[np] := u;
i := head[u];
while not e[i].selected do i := link[i];
u := e[i].y;
e[i].selected := False;
until u = n;
nq := 0;
u := 1;
repeat
Inc(nq);
q[nq] := u;
i := head[u];
while not e[i].selected do i := link[i];
u := e[i].y;
e[i].selected := False;
until u = n;
end;
procedure PrintResult;
var
f: TextFile;
k: Integer;
begin
AssignFile(f, OutputFile); Rewrite(f);
try
WriteLn(f, Res);
if Res <> -1 then
begin
for k := 1 to np do Write(f, p[k], ' ');
Write(f, n);
for k := nq downto 1 do Write(f, ' ', q[k]);
end;
finally
CloseFile(f);
end;
end;
begin
Enter;
BuildIncidentLists;
Init;
res := Solve;
PrintResult;
end.
|
unit Main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, ExtCtrls, IniFiles, Misc, SensorTypes, Menus,
DdhAppX, ImgList, StdCtrls, ArchManThd;
type
TFormReplay = class(TForm)
AppExt: TDdhAppExt;
TrayPopupMenu: TPopupMenu;
pmiClose: TMenuItem;
pmiAbout: TMenuItem;
Timer: TTimer;
pmiStart: TMenuItem;
pmiStop: TMenuItem;
N3: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure pmiAboutClick(Sender: TObject);
procedure pmiCloseClick(Sender: TObject);
procedure AppExtTrayDefault(Sender: TObject);
procedure AppExtLBtnDown(Sender: TObject);
procedure TimerTimer(Sender: TObject);
procedure pmiStartClick(Sender: TObject);
procedure pmiStopClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
AMThd:TArchManThread;
Sensors:TList;
StartDate:TDateTime;
LastSec:Integer;
end;
var
FormReplay: TFormReplay;
implementation
const
RecsPerDay=SecsPerDay;
dtOneSecond=1/SecsPerDay;
{$R *.DFM}
procedure TFormReplay.FormCreate(Sender: TObject);
const
Section='config';
var
Ini:TIniFile;
FName:String;
i,ID:Integer;
begin
InitFormattingVariables;
AMThd:=TArchManThread.Create;//('127.0.0.1');
AMThd.Resume;
FName:=GetModuleFullName+'.ini';
if not FileExists(FName)
then raise Exception.Create('Программа повтора данных: Не найден файл конфигурации "'+FName+'"');
Ini:=TIniFile.Create(FName);
StartDate:=Ini.ReadDate(Section,'StartDate',Int(Now)-1);
Sensors:=TList.Create;
Sensors.Count:=Ini.ReadInteger(Section,'SensorCount',0);
for i:=0 to Sensors.Count-1 do begin
AMThd.StrToTrackID(Ini.ReadString(Section,'Sensor'+IntToStr(i+1),'ZZZ'),ID);
Sensors[i]:=Pointer(ID);
AMThd.setTrackInfo(ID,TMySensor.GetRecSize,RecsPerDay);
end;
Ini.Free;
end;
procedure TFormReplay.FormDestroy(Sender: TObject);
begin
Sensors.Free;
AMThd.Free;
end;
procedure TFormReplay.pmiAboutClick(Sender: TObject);
begin
Application.MessageBox(
'СКУ (для презентаций)'#13#13+
'Программа повтора данных'#13+
'(имитация поступления новых данных повторением старых)'#13#13+
'(c) 2000-2002 ООО "Компания Телекомнур"'#13+
'e-mail: test@mail.rb.ru',
'О программе',
MB_ICONINFORMATION or MB_OK);
end;
procedure TFormReplay.pmiCloseClick(Sender: TObject);
begin
Close;
end;
procedure TFormReplay.AppExtTrayDefault(Sender: TObject);
var
P:TPoint;
begin
GetCursorPos(P);
PopupMenu.Popup(P.x,P.y);
end;
procedure TFormReplay.AppExtLBtnDown(Sender: TObject);
var
P:TPoint;
begin
GetCursorPos(P);
TrayPopupMenu.Popup(P.x,P.y);
end;
procedure TFormReplay.TimerTimer(Sender: TObject);
var
DayTime,SrcTime,DstTime:TDateTime;
NewSec:Integer;
i,ID:Integer;
Data:WideString;
begin
NewSec:=Trunc(Time*SecsPerDay);
if LastSec<>NewSec then begin
DayTime:=NewSec*dtOneSecond;
SrcTime:=StartDate+DayTime;
DstTime:=Date+DayTime;
for i:=0 to Sensors.Count-1 do begin
ID:=Integer(Sensors[i]);
AMThd.readRecords(ID,SrcTime,1,Data);
AMThd.writeRecords(ID,DstTime,1,Data);
end;
LastSec:=NewSec;
end;
end;
procedure TFormReplay.pmiStartClick(Sender: TObject);
begin
Timer.Enabled:=True;
pmiStart.Visible:=False;
pmiStop.Visible:=True;
end;
procedure TFormReplay.pmiStopClick(Sender: TObject);
begin
Timer.Enabled:=False;
pmiStart.Visible:=True;
pmiStop.Visible:=False;
end;
end.
|
unit MainUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,
CP.AudioBuffer, CP.Def, CP.AudioProcessor, CP.Image, CP.Filter,
CP.IntegralImage;
type
TAPITestForm = class(TForm)
btnTestAudioProcessor: TButton;
Memo: TMemo;
btnTestFilter: TButton;
btnTestIntegralImage: TButton;
btnTestSilenceRemover: TButton;
btnTestChromaprint: TButton;
btnTestCombinedBuffer: TButton;
btnTestChromaResampler: TButton;
btnTestChromaFilter: TButton;
btnChromaTest: TButton;
btnTestBase64: TButton;
btnTestQuantize: TButton;
btnTestFingerprintCalculator: TButton;
btnFingerPrintCompressor: TButton;
btnTestStringReader: TButton;
btnTestBitStringWriter: TButton;
btnTestFingerprintDecompressor: TButton;
btnTestAPI: TButton;
btnMovingAverage: TButton;
procedure btnTestAudioProcessorClick(Sender: TObject);
procedure btnTestFilterClick(Sender: TObject);
procedure btnTestIntegralImageClick(Sender: TObject);
procedure btnTestSilenceRemoverClick(Sender: TObject);
procedure btnTestChromaprintClick(Sender: TObject);
procedure btnTestCombinedBufferClick(Sender: TObject);
procedure btnTestChromaResamplerClick(Sender: TObject);
procedure btnTestChromaFilterClick(Sender: TObject);
procedure btnChromaTestClick(Sender: TObject);
procedure btnTestBase64Click(Sender: TObject);
procedure btnTestQuantizeClick(Sender: TObject);
procedure btnTestFingerprintCalculatorClick(Sender: TObject);
procedure btnFingerPrintCompressorClick(Sender: TObject);
procedure btnTestStringReaderClick(Sender: TObject);
procedure btnTestBitStringWriterClick(Sender: TObject);
procedure btnTestFingerprintDecompressorClick(Sender: TObject);
procedure btnTestAPIClick(Sender: TObject);
procedure btnMovingAverageClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
APITestForm: TAPITestForm;
implementation
uses
CP.TestUtils, CP.SilenceRemover, CP.ImageBuilder, CP.FeatureVectorConsumer,
CP.Base64, CP.Quantizer, CP.Classifier, CP.FingerPrintCalculator, CP.Utils,
CP.FingerprintCompressor, CP.BitString,
CP.Chromaprint,
CP.Chroma, CP.FFT, CP.CombinedBuffer;
{$R *.dfm}
type
TFeatureVectorBuffer = class(TFeatureVectorConsumer)
private
m_features: TDoubleArray;
public
procedure Consume(var features: TDoubleArray); override;
end;
procedure TAPITestForm.btnChromaTestClick(Sender: TObject);
var
buffer: TFeatureVectorBuffer;
Chroma: TChroma;
frame: TFFTFrame;
expected_features: TDoubleArray;
i: integer;
begin
Memo.Clear;
SetLength(expected_features, 12);
expected_features[0] := 1.0;
expected_features[1] := 0.0;
expected_features[2] := 0.0;
expected_features[3] := 0.0;
expected_features[4] := 0.0;
expected_features[5] := 0.0;
expected_features[6] := 0.0;
expected_features[7] := 0.0;
expected_features[8] := 0.0;
expected_features[9] := 0.0;
expected_features[10] := 0.0;
expected_features[11] := 0.0;
Memo.Lines.Add('Test Chroma, NormalA');
Memo.Lines.Add('=======================');
buffer := TFeatureVectorBuffer.Create;
Chroma := TChroma.Create(10, 510, 256, 1000, buffer);
frame := TFFTFrame.Create(128);
TDoubleArray(frame.Data)[113] := 1.0;
Chroma.Consume(frame);
if (Length(buffer.m_features) = 12) then
begin
for i := 0 to 11 do
begin
if (abs(expected_features[i] - buffer.m_features[i]) > 0.0001) then
begin
Memo.Lines.Add('Different value at index: ' + IntToStr(i));
end;
end;
end
else
begin
Memo.Lines.Add('Features same size: NOT OK');
end;
buffer.Free;
frame.Free;
Chroma.Free;
Memo.Lines.Add('Test Chroma, NormalGSharp');
Memo.Lines.Add('=======================');
buffer := TFeatureVectorBuffer.Create;
Chroma := TChroma.Create(10, 510, 256, 1000, buffer);
frame := TFFTFrame.Create(128);
// frame.Data[112] := 1.0;
TDoubleArray(frame.Data)[112] := 1.0;
Chroma.Consume(frame);
expected_features[11] := 1.0;
expected_features[0] := 0.0;
if (Length(buffer.m_features) = 12) then
begin
for i := 0 to 11 do
begin
if (abs(expected_features[i] - buffer.m_features[i]) > 0.0001) then
begin
Memo.Lines.Add('Different value at index: ' + IntToStr(i));
end;
end;
end
else
begin
Memo.Lines.Add('Features same size: NOT OK');
end;
buffer.Free;
Chroma.Free;
frame.Free;
Memo.Lines.Add('Test Chroma, NormalB');
Memo.Lines.Add('=======================');
buffer := TFeatureVectorBuffer.Create;
Chroma := TChroma.Create(10, 510, 256, 1000, buffer);
frame := TFFTFrame.Create(128);
// frame.Data[64] := 1.0; // 250 Hz
TDoubleArray(frame.Data)[64] := 1.0; // 250 Hz
Chroma.Consume(frame);
expected_features[2] := 1.0;
expected_features[11] := 0.0;
if (Length(buffer.m_features) = 12) then
begin
for i := 0 to 11 do
begin
if (abs(expected_features[i] - buffer.m_features[i]) > 0.0001) then
begin
Memo.Lines.Add('Different value at index: ' + IntToStr(i));
end;
end;
end
else
begin
Memo.Lines.Add('Features same size: NOT OK');
end;
buffer.Free;
Chroma.Free;
frame.Free;
Memo.Lines.Add('Test Chroma, InterpolatedB');
Memo.Lines.Add('=======================');
buffer := TFeatureVectorBuffer.Create;
Chroma := TChroma.Create(10, 510, 256, 1000, buffer);
Chroma.Interpolate := True;
frame := TFFTFrame.Create(128);
// frame.Data[64] := 1.0;
TDoubleArray(frame.Data)[64] := 1.0;
Chroma.Consume(frame);
expected_features[0] := 0.0;
expected_features[1] := 0.286905;
expected_features[2] := 0.713095;
expected_features[3] := 0.0;
expected_features[4] := 0.0;
expected_features[5] := 0.0;
expected_features[6] := 0.0;
expected_features[7] := 0.0;
expected_features[8] := 0.0;
expected_features[9] := 0.0;
expected_features[10] := 0.0;
expected_features[11] := 0.0;
if (Length(buffer.m_features) = 12) then
begin
for i := 0 to 11 do
begin
if (abs(expected_features[i] - buffer.m_features[i]) > 0.0001) then
begin
Memo.Lines.Add('Different value at index: ' + IntToStr(i));
end;
end;
end
else
begin
Memo.Lines.Add('Features same size: NOT OK');
end;
buffer.Free;
Chroma.Free;
frame.Free;
Memo.Lines.Add('Test Chroma, InterpolatedA');
Memo.Lines.Add('=======================');
buffer := TFeatureVectorBuffer.Create;
Chroma := TChroma.Create(10, 510, 256, 1000, buffer);
Chroma.Interpolate := True;
frame := TFFTFrame.Create(128);
// frame.Data[113] := 1.0;
TDoubleArray(frame.Data)[113] := 1.0;
Chroma.Consume(frame);
expected_features[0] := 0.555242;
expected_features[1] := 0.0;
expected_features[2] := 0.0;
expected_features[3] := 0.0;
expected_features[4] := 0.0;
expected_features[5] := 0.0;
expected_features[6] := 0.0;
expected_features[7] := 0.0;
expected_features[8] := 0.0;
expected_features[9] := 0.0;
expected_features[10] := 0.0;
expected_features[11] := 0.44475;
if (Length(buffer.m_features) = 12) then
begin
for i := 0 to 11 do
begin
if (abs(expected_features[i] - buffer.m_features[i]) > 0.0001) then
begin
Memo.Lines.Add('Different value at index: ' + IntToStr(i));
end;
end;
end
else
begin
Memo.Lines.Add('Features same size: NOT OK');
end;
buffer.Free;
Chroma.Free;
frame.Free;
Memo.Lines.Add('Test Chroma, InterpolatedGSharp');
Memo.Lines.Add('=======================');
buffer := TFeatureVectorBuffer.Create;
Chroma := TChroma.Create(10, 510, 256, 1000, buffer);
Chroma.Interpolate := True;
frame := TFFTFrame.Create(128);
// frame.Data[112] := 1.0;
TDoubleArray(frame.Data)[112] := 1.0;
Chroma.Consume(frame);
expected_features[0] := 0.401354;
expected_features[1] := 0.0;
expected_features[2] := 0.0;
expected_features[3] := 0.0;
expected_features[4] := 0.0;
expected_features[5] := 0.0;
expected_features[6] := 0.0;
expected_features[7] := 0.0;
expected_features[8] := 0.0;
expected_features[9] := 0.0;
expected_features[10] := 0.0;
expected_features[11] := 0.598646;
if (Length(buffer.m_features) = 12) then
begin
for i := 0 to 11 do
begin
if (abs(expected_features[i] - buffer.m_features[i]) > 0.0001) then
begin
Memo.Lines.Add('Different value at index: ' + IntToStr(i));
end;
end;
end
else
begin
Memo.Lines.Add('Features same size: NOT OK');
end;
buffer.Free;
Chroma.Free;
frame.Free;
SetLength(expected_features, 0);
end;
procedure TAPITestForm.btnFingerPrintCompressorClick(Sender: TObject);
var
lCompressor: TFingerprintCompressor;
fingerprint: TUINT32Array;
Value: string;
expected: string;
begin
Memo.Clear;
Memo.Lines.Add('Test FingerprintCompressor, OneItemOneBit');
Memo.Lines.Add('=======================');
SetLength(fingerprint, 1);
fingerprint[0] := 1;
expected := chr(0) + chr(0) + chr(0) + chr(1) + chr(1);
lCompressor := TFingerprintCompressor.Create;
Value := lCompressor.Compress(fingerprint);
if Value = expected then
Memo.Lines.Add('FingerprintCompressor, OneItemOneBit : OK')
else
Memo.Lines.Add('FingerprintCompressor, OneItemOneBit : NOT OK');
lCompressor.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test FingerprintCompressor, OneItemThreeBits');
Memo.Lines.Add('=======================');
SetLength(fingerprint, 1);
fingerprint[0] := 7;
expected := chr(0) + chr(0) + chr(0) + chr(1) + chr(73) + chr(0);
lCompressor := TFingerprintCompressor.Create;
Value := lCompressor.Compress(fingerprint);
if Value = expected then
Memo.Lines.Add('FingerprintCompressor, OneItemThreeBits : OK')
else
Memo.Lines.Add('FingerprintCompressor, OneItemThreeBits : NOT OK');
lCompressor.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test FingerprintCompressor, OneItemOneBitExcept');
Memo.Lines.Add('=======================');
SetLength(fingerprint, 1);
fingerprint[0] := 1 shl 6;
expected := chr(0) + chr(0) + chr(0) + chr(1) + chr(7) + chr(0);
lCompressor := TFingerprintCompressor.Create;
Value := lCompressor.Compress(fingerprint);
if Value = expected then
Memo.Lines.Add('FingerprintCompressor, OneItemOneBitExcept : OK')
else
Memo.Lines.Add('FingerprintCompressor, OneItemOneBitExcept : NOT OK');
lCompressor.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test FingerprintCompressor, OneItemOneBitExcept2');
Memo.Lines.Add('=======================');
SetLength(fingerprint, 1);
fingerprint[0] := 1 shl 8;
expected := chr(0) + chr(0) + chr(0) + chr(1) + chr(7) + chr(2);
lCompressor := TFingerprintCompressor.Create;
Value := lCompressor.Compress(fingerprint);
if Value = expected then
Memo.Lines.Add('FingerprintCompressor, OneItemOneBitExcept2 : OK')
else
Memo.Lines.Add('FingerprintCompressor, OneItemOneBitExcept2 : NOT OK');
lCompressor.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test FingerprintCompressor, TwoItems');
Memo.Lines.Add('=======================');
SetLength(fingerprint, 2);
fingerprint[0] := 1;
fingerprint[1] := 0;
expected := chr(0) + chr(0) + chr(0) + chr(2) + chr(65) + chr(0);
lCompressor := TFingerprintCompressor.Create;
Value := lCompressor.Compress(fingerprint);
if Value = expected then
Memo.Lines.Add('FingerprintCompressor, TwoItems : OK')
else
Memo.Lines.Add('FingerprintCompressor, TwoItems : NOT OK');
lCompressor.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test FingerprintCompressor, TwoItemsNoChange');
Memo.Lines.Add('=======================');
SetLength(fingerprint, 2);
fingerprint[0] := 1;
fingerprint[1] := 1;
expected := chr(0) + chr(0) + chr(0) + chr(2) + chr(1) + chr(0);
lCompressor := TFingerprintCompressor.Create;
Value := lCompressor.Compress(fingerprint);
if Value = expected then
Memo.Lines.Add('FingerprintCompressor, TwoItemsNoChange : OK')
else
Memo.Lines.Add('FingerprintCompressor, TwoItemsNoChange : NOT OK');
lCompressor.Free;
end;
procedure TAPITestForm.btnMovingAverageClick(Sender: TObject);
var
avg: TMovingAverage;
begin
avg := TMovingAverage.Create(2);
Memo.Clear;
Memo.Lines.Add('Value: ' + IntToStr(avg.GetAverage)); // 0
avg.AddValue(100);
Memo.Lines.Add('Value: ' + IntToStr(avg.GetAverage)); // 100
avg.AddValue(50);
Memo.Lines.Add('Value: ' + IntToStr(avg.GetAverage)); // 75
avg.AddValue(0);
Memo.Lines.Add('Value: ' + IntToStr(avg.GetAverage)); // 25
avg.AddValue(1000);
Memo.Lines.Add('Value: ' + IntToStr(avg.GetAverage)); // 500
avg.Free;
end;
procedure TAPITestForm.btnTestAPIClick(Sender: TObject);
var
zeroes: TSmallintArray;
i, n: integer;
c: TChromaprint;
fp: Ansistring;
// fpi: TSmallintArray;
fpi: TUINT32Array;
expected: array of byte;
expectedString: Ansistring;
encoded: Ansistring;
encodedsize: integer;
lError: boolean;
algo: integer;
begin
Memo.Clear;
Memo.Lines.Add('Test API, Test2SilenceFp');
Memo.Lines.Add('=======================');
SetLength(zeroes, 1024);
for i := 0 to 1024 - 1 do
zeroes[i] := 0;
c := TChromaprint.Create;
c.New(ord(CHROMAPRINT_ALGORITHM_TEST2));
c.Start(44100, 1);
for i := 0 to 130 - 1 do
begin
c.Feed(zeroes, 1024);
end;
c.Finish;
c.GetRawFingerprint(fpi, n);
if n = 3 then
begin
Memo.Lines.Add('RAW Length: OK');
if (fpi[0] = 627964279) then
Memo.Lines.Add('RAW Value 0: OK');
if (fpi[1] = 627964279) then
Memo.Lines.Add('RAW Value 1: OK');
if (fpi[2] = 627964279) then
Memo.Lines.Add('RAW Value 2: OK');
end
else
begin
Memo.Lines.Add('RAW Length: NOT OK');
end;
c.GetFingerprint(fp);
i := Length(fp);
if i = 18 then
begin
Memo.Lines.Add('Length: OK');
if fp = 'AQAAA0mUaEkSRZEGAA' then
Memo.Lines.Add('String: OK')
else
Memo.Lines.Add('String: NOT OK');
end
else
begin
Memo.Lines.Add('Length: NOT OK');
end;
c.Free;
SetLength(zeroes, 0);
SetLength(fpi, 0);
Memo.Lines.Add('');
Memo.Lines.Add('Test API, TestEncodeFingerprint');
Memo.Lines.Add('=======================');
SetLength(fpi, 2);
fpi[0] := 1;
fpi[1] := 0;
SetLength(expected, 6);
expected[0] := 55;
expected[1] := 0;
expected[2] := 0;
expected[3] := 2;
expected[4] := 65;
expected[5] := 0;
c := TChromaprint.Create;
c.New(ord(CHROMAPRINT_ALGORITHM_TEST2));
c.EnocdeFingerprint(fpi, 55, encoded, encodedsize, False);
if encodedsize = 6 then
begin
Memo.Lines.Add('Length: OK');
lError := False;
for i := 1 to encodedsize do
begin
if (encoded[i] <> Ansistring(chr(expected[i - 1]))) then
begin
Memo.Lines.Add('Differenz at Position: ' + IntToStr(i));
lError := True;
end;
end;
if not lError then
Memo.Lines.Add('String: OK');
end
else
begin
Memo.Lines.Add('Length: NOT OK');
end;
c.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test API, TestEncodeFingerprintBase64');
Memo.Lines.Add('=======================');
expectedString := 'NwAAAkEA';
c := TChromaprint.Create;
c.New(ord(CHROMAPRINT_ALGORITHM_TEST2));
c.EnocdeFingerprint(fpi, 55, encoded, encodedsize, True);
if encodedsize = 8 then
begin
Memo.Lines.Add('Length: OK');
if encoded = expectedString then
Memo.Lines.Add('String: OK')
else
Memo.Lines.Add('String: NOT OK');
end
else
begin
Memo.Lines.Add('Length: NOT OK');
end;
c.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test API, TestDecodeFingerprint');
Memo.Lines.Add('=======================');
expectedString := 'NwAAAkEA';
c := TChromaprint.Create;
c.New(ord(CHROMAPRINT_ALGORITHM_TEST2));
encoded := chr(55) + chr(0) + chr(0) + chr(2) + chr(65) + chr(0);
algo := 2;
c.DecodeFingerprint(encoded, fpi, algo, False);
if Length(fpi) = 2 then
begin
Memo.Lines.Add('Length: OK');
if algo = 55 then
Memo.Lines.Add('Algo: OK')
else
Memo.Lines.Add('Algo: NOT OK');
if fpi[0] = 1 then
Memo.Lines.Add('FP[0]: OK')
else
Memo.Lines.Add('FP[0]: NOT OK');
if fpi[1] = 0 then
Memo.Lines.Add('FP[1]: OK')
else
Memo.Lines.Add('FP[1]: NOT OK');
end
else
begin
Memo.Lines.Add('Length: NOT OK');
end;
c.Free;
end;
procedure TAPITestForm.btnTestAudioProcessorClick(Sender: TObject);
var
buffer, Buffer2: TAudioBuffer;
Processor: TAudioProcessor;
DataMono, DataStereo, DataMono11025, DataMono8000: TSmallintArray;
i: integer;
lError: boolean;
lErrCount: integer;
begin
Memo.Clear;
DataMono := LoadAudioFile('data\test_mono_44100.raw');
DataStereo := LoadAudioFile('data\test_stereo_44100.raw');
DataMono11025 := LoadAudioFile('data\test_mono_11025.raw');
DataMono8000 := LoadAudioFile('data\test_mono_8000.raw');
buffer := TAudioBuffer.Create;
Buffer2 := TAudioBuffer.Create;
Processor := TAudioProcessor.Create(44100, buffer);
{$DEFINE TestMono}
{$DEFINE TestStereoToMono}
{$DEFINE ResampleMono}
{$DEFINE ResampleMono8000}
{$DEFINE StereoToMonoAndResample}
{$IFDEF TestMono}
Memo.Lines.Add('Test Mono');
Memo.Lines.Add('=======================');
if Processor.TargetSampleRate = 44100 then
Memo.Lines.Add('Target Sample Rate: OK');
if Processor.consumer = buffer then
Memo.Lines.Add('Processor Consumer: OK');
Processor.TargetSampleRate := 11025;
if Processor.TargetSampleRate = 11025 then
Memo.Lines.Add('Target Sample Rate: OK');
Processor.consumer := Buffer2;
if Processor.consumer = Buffer2 then
Memo.Lines.Add('Processor Consumer: OK');
Processor.consumer := buffer;
Processor.TargetSampleRate := 44100;
Processor.Reset(44100, 1);
Processor.Consume(DataMono, 0, Length(DataMono));
Processor.Flush();
if Length(DataMono) = Length(buffer.Data) then
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: OK');
lError := False;
for i := 0 to Length(DataMono) - 1 do
begin
if DataMono[i] <> buffer.Data[i] then
begin
Memo.Lines.Add('Signals differ at index: ' + IntToStr(i) + ', ' + IntToStr(DataMono[i]) + ' - ' + IntToStr(buffer.Data[i]));
lError := True;
end;
end;
if not lError then
Memo.Lines.Add('Buffer Data and Readed Data equal: OK');
end
else
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: NOT OK');
end;
{$ENDIF}
{$IFDEF TestStereoToMono}
{ Test Stereo To Mono }
Memo.Lines.Add('');
Memo.Lines.Add('Test Stereo To Mono');
Memo.Lines.Add('=======================');
buffer.Reset;
Processor.TargetSampleRate := 44100;
Processor.Reset(44100, 2);
Processor.Consume(DataStereo, 0, Length(DataStereo));
Processor.Flush();
if Length(DataMono) = Length(buffer.Data) then
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: OK');
lError := False;
for i := 0 to Length(DataMono) - 1 do
begin
if DataMono[i] <> buffer.Data[i] then
begin
Memo.Lines.Add('Signals differ at index: ' + IntToStr(i) + ', ' + IntToStr(DataMono[i]) + ' - ' + IntToStr(buffer.Data[i]));
lError := True;
end;
end;
if not lError then
Memo.Lines.Add('Buffer Data and Readed Data equal: OK');
end
else
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: NOT OK');
end;
{$ENDIF}
{$IFDEF ResampleMono}
Memo.Lines.Add('');
Memo.Lines.Add('Test Resample Mono');
Memo.Lines.Add('=======================');
buffer.Reset;
Processor.TargetSampleRate := 11025;
Processor.Reset(44100, 1);
Processor.Consume(DataMono, 0, Length(DataMono));
Processor.Flush();
lErrCount := 0;
if Length(DataMono11025) = Length(buffer.Data) then
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: OK');
lError := False;
for i := 0 to Length(DataMono11025) - 1 do
begin
if DataMono11025[i] <> buffer.Data[i] then
begin
Memo.Lines.Add('Signals differ at index: ' + IntToStr(i) + ', ' + IntToStr(DataMono11025[i]) + ' || ' + IntToStr(buffer.Data[i]));
Inc(lErrCount);
lError := True;
end;
end;
if lError then
begin
Memo.Lines.Add('Buffer Data and Readed Data equal: NOT OK');
Memo.Lines.Add('Error Count: ' + IntToStr(lErrCount) + ' / ' + IntToStr(Length(DataMono11025)));
end
else
Memo.Lines.Add('Buffer Data and Readed Data equal: OK');
end
else
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: NOT OK');
end;
{$ENDIF}
{$IFDEF ResampleMono8000}
Memo.Lines.Add('');
Memo.Lines.Add('Test Resample Mono 8000');
Memo.Lines.Add('=======================');
buffer.Reset;
Processor.TargetSampleRate := 8000;
Processor.Reset(44100, 1);
Processor.Consume(DataMono, 0, Length(DataMono));
Processor.Flush();
lErrCount := 0;
if Length(DataMono8000) = Length(buffer.Data) then
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: OK');
lError := False;
for i := 0 to Length(DataMono8000) - 1 do
begin
if DataMono8000[i] <> buffer.Data[i] then
begin
Memo.Lines.Add('Signals differ at index: ' + IntToStr(i) + ', ' + IntToStr(DataMono8000[i]) + ' || ' + IntToStr(buffer.Data[i]));
Inc(lErrCount);
lError := True;
end;
end;
if lError then
begin
Memo.Lines.Add('Buffer Data and Readed Data equal: NOT OK');
Memo.Lines.Add('Error Count: ' + IntToStr(lErrCount) + ' / ' + IntToStr(Length(DataMono11025)));
end
else
Memo.Lines.Add('Buffer Data and Readed Data equal: OK');
end
else
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: NOT OK');
end;
{$ENDIF}
{$IFDEF StereoToMonoAndResample}
Memo.Lines.Add('');
Memo.Lines.Add('Test Stereo To Mono And Resample');
Memo.Lines.Add('=======================');
buffer.Reset;
Processor.TargetSampleRate := 11025;
Processor.Reset(44100, 2);
Processor.Consume(DataStereo, 0, Length(DataStereo));
Processor.Flush();
lErrCount := 0;
if Length(DataMono11025) = Length(buffer.Data) then
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: OK');
lError := False;
for i := 0 to Length(DataMono11025) - 1 do
begin
if DataMono11025[i] <> buffer.Data[i] then
begin
Memo.Lines.Add('Signals differ at index: ' + IntToStr(i) + ', ' + IntToStr(DataMono11025[i]) + ' || ' + IntToStr(buffer.Data[i]));
Inc(lErrCount);
lError := True;
end;
end;
if lError then
begin
Memo.Lines.Add('Buffer Data and Readed Data equal: NOT OK');
Memo.Lines.Add('Error Count: ' + IntToStr(lErrCount) + ' / ' + IntToStr(Length(DataMono11025)));
end
else
Memo.Lines.Add('Buffer Data and Readed Data equal: OK');
end
else
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: NOT OK');
end;
{$ENDIF}
buffer.Free;
Buffer2.Free;
Processor.Free;
end;
procedure TAPITestForm.btnTestBase64Click(Sender: TObject);
begin
Memo.Lines.Clear;
Memo.Lines.Add('Test Base64, Base64Encode');
Memo.Lines.Add('=======================');
if Base64Encode('x') = 'eA' then
Memo.Lines.Add('Base64Encode 1: OK')
else
Memo.Lines.Add('Base64Encode 1: NOT OK');
if Base64Encode('xx') = 'eHg' then
Memo.Lines.Add('Base64Encode 2: OK')
else
Memo.Lines.Add('Base64Encode 2: NOT OK');
if Base64Encode('xxx') = 'eHh4' then
Memo.Lines.Add('Base64Encode 3: OK')
else
Memo.Lines.Add('Base64Encode 3: NOT OK');
if Base64Encode('xxxx') = 'eHh4eA' then
Memo.Lines.Add('Base64Encode 4: OK')
else
Memo.Lines.Add('Base64Encode 4: NOT OK');
if Base64Encode('xxxxx') = 'eHh4eHg' then
Memo.Lines.Add('Base64Encode 5: OK')
else
Memo.Lines.Add('Base64Encode 5: NOT OK');
if Base64Encode('xxxxxx') = 'eHh4eHh4' then
Memo.Lines.Add('Base64Encode 6: OK')
else
Memo.Lines.Add('Base64Encode 6: NOT OK');
if Base64Encode(chr($FF) + chr($EE)) = '_-4' then
Memo.Lines.Add('Base64Encode 7: OK')
else
Memo.Lines.Add('Base64Encode 7: NOT OK');
Memo.Lines.Add('');
if Base64Decode('eA') = 'x' then
Memo.Lines.Add('Base64Decode 1: OK')
else
Memo.Lines.Add('Base64Decode 1: NOT OK');
if Base64Decode('eHg') = 'xx' then
Memo.Lines.Add('Base64Decode 2: OK')
else
Memo.Lines.Add('Base64Decode 2: NOT OK');
if Base64Decode('eHh4') = 'xxx' then
Memo.Lines.Add('Base64Decode 3: OK')
else
Memo.Lines.Add('Base64Decode 3: NOT OK');
if Base64Decode('eHh4eA') = 'xxxx' then
Memo.Lines.Add('Base64Decode 4: OK')
else
Memo.Lines.Add('Base64Decode 4: NOT OK');
if Base64Decode('eHh4eHg') = 'xxxxx' then
Memo.Lines.Add('Base64Decode 5: OK')
else
Memo.Lines.Add('Base64Decode 5: NOT OK');
if Base64Decode('eHh4eHh4') = 'xxxxxx' then
Memo.Lines.Add('Base64Decode 6: OK')
else
Memo.Lines.Add('Base64Decode 6: NOT OK');
if Base64Decode('_-4') = chr($FF) + chr($EE) then
Memo.Lines.Add('Base64Decode 7: OK')
else
Memo.Lines.Add('Base64Decode 7: NOT OK');
end;
procedure TAPITestForm.btnTestBitStringWriterClick(Sender: TObject);
var
writer: TBitStringWriter;
expected: string;
begin
Memo.Lines.Clear;
writer := TBitStringWriter.Create;
writer.Write(0, 2);
writer.Write(1, 2);
writer.Write(2, 2);
writer.Write(3, 2);
writer.Flush();
Memo.Lines.Clear;
Memo.Lines.Add('Test BitStringWriter, OneByte');
Memo.Lines.Add('=======================');
expected := chr(byte(-28));
if writer.Value = expected then
Memo.Lines.Add('BitStringWriter, OneByte: OK')
else
Memo.Lines.Add('BitStringWriter, OneByte: NOT OK');
writer.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test BitStringWriter, TwoBytesIncomplete');
Memo.Lines.Add('=======================');
writer := TBitStringWriter.Create;
writer.Write(0, 2);
writer.Write(1, 2);
writer.Write(2, 2);
writer.Write(3, 2);
writer.Write(1, 2);
writer.Flush();
expected := chr(byte(-28)) + chr(byte(1));
if writer.Value = expected then
Memo.Lines.Add('BitStringWriter, TwoBytesIncomplete: OK')
else
Memo.Lines.Add('BitStringWriter, TwoBytesIncomplete: NOT OK');
writer.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test BitStringWriter, TwoBytesSplit');
Memo.Lines.Add('=======================');
writer := TBitStringWriter.Create;
writer.Write(0, 3);
writer.Write(1, 3);
writer.Write(2, 3);
writer.Write(3, 3);
writer.Flush();
expected := chr(byte(-120)) + chr(byte(6));
if writer.Value = expected then
Memo.Lines.Add('BitStringWriter, TwoBytesSplit: OK')
else
Memo.Lines.Add('BitStringWriter, TwoBytesSplit: NOT OK');
writer.Free;
end;
procedure TAPITestForm.btnTestChromaFilterClick(Sender: TObject);
var
lImage: TImage;
lImageBuilder: TImageBuilder;
lFilter: TChromaFilter;
d1: TDoubleArray;
d2, d3, d4: TDoubleArray;
lRes: double;
lCoefficients: array of double;
begin
Memo.Lines.Clear;
SetLength(lCoefficients, 2);
lCoefficients[0] := 0.5;
lCoefficients[1] := 0.5;
SetLength(d1, 12);
d1[0] := 0.0;
d1[1] := 5.0;
d1[2] := 0.0;
d1[3] := 0.0;
d1[4] := 0.0;
d1[5] := 0.0;
d1[6] := 0.0;
d1[7] := 0.0;
d1[8] := 0.0;
d1[9] := 0.0;
d1[10] := 0.0;
d1[11] := 0.0;
SetLength(d2, 12);
d2[0] := 1.0;
d2[1] := 6.0;
d2[2] := 0.0;
d2[3] := 0.0;
d2[4] := 0.0;
d2[5] := 0.0;
d2[6] := 0.0;
d2[7] := 0.0;
d2[8] := 0.0;
d2[9] := 0.0;
d2[10] := 0.0;
d2[11] := 0.0;
SetLength(d3, 12);
d3[0] := 2.0;
d3[1] := 7.0;
d3[2] := 0.0;
d3[3] := 0.0;
d3[4] := 0.0;
d3[5] := 0.0;
d3[6] := 0.0;
d3[7] := 0.0;
d3[8] := 0.0;
d3[9] := 0.0;
d3[10] := 0.0;
d3[11] := 0.0;
SetLength(d4, 12);
d4[0] := 3.0;
d4[1] := 8.0;
d4[2] := 0.0;
d4[3] := 0.0;
d4[4] := 0.0;
d4[5] := 0.0;
d4[6] := 0.0;
d4[7] := 0.0;
d4[8] := 0.0;
d4[9] := 0.0;
d4[10] := 0.0;
d4[11] := 0.0;
Memo.Lines.Add('Test ChromaFilter, Blur2');
Memo.Lines.Add('=======================');
lImage := TImage.Create(12);
lImageBuilder := TImageBuilder.Create(lImage);
lFilter := TChromaFilter.Create(@lCoefficients[0], 2, lImageBuilder);
lFilter.Consume(d1);
lFilter.Consume(d2);
lFilter.Consume(d3);
if lImage.NumRows = 2 then
begin
Memo.Lines.Add('Numbers of rows match: OK');
lRes := lImage.GetData(0, 0);
if lRes = 0.5 then
Memo.Lines.Add('Value on 0/0 match: OK');
lRes := lImage.GetData(1, 0);
if lRes = 1.5 then
Memo.Lines.Add('Value on 1/0 match: OK');
lRes := lImage.GetData(0, 1);
if lRes = 5.5 then
Memo.Lines.Add('Value on 0/1 match: OK');
lRes := lImage.GetData(1, 1);
if lRes = 6.5 then
Memo.Lines.Add('Value on 1/1 match: OK');
end
else
begin
Memo.Lines.Add('Numbers of rows match: NOT OK');
end;
lImage.Free;
lImageBuilder.Free;
lFilter.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test ChromaResampler, Blur3');
Memo.Lines.Add('=======================');
SetLength(lCoefficients, 3);
lCoefficients[0] := 0.5;
lCoefficients[1] := 0.7;
lCoefficients[2] := 0.5;
lImage := TImage.Create(12);
lImageBuilder := TImageBuilder.Create(lImage);
lFilter := TChromaFilter.Create(@lCoefficients[0], 3, lImageBuilder);
lFilter.Consume(d1);
lFilter.Consume(d2);
lFilter.Consume(d3);
lFilter.Consume(d4);
if lImage.NumRows = 2 then
begin
Memo.Lines.Add('Numbers of rows match: OK');
lRes := lImage.GetData(0, 0);
if (lRes <= 1.7001) and (lRes >= 1.699) then
Memo.Lines.Add('Value on 0/0 match: OK');
lRes := lImage.GetData(1, 0);
if (lRes <= 3.4001) and (lRes >= 3.399) then
Memo.Lines.Add('Value on 1/0 match: OK');
lRes := lImage.GetData(0, 1);
if (lRes <= 10.2001) and (lRes >= 10.199) then
Memo.Lines.Add('Value on 0/1 match: OK');
lRes := lImage.GetData(1, 1);
if (lRes <= 11.9001) and (lRes >= 11.899) then
Memo.Lines.Add('Value on 1/1 match: OK');
end
else
begin
Memo.Lines.Add('Numbers of rows match: NOT OK');
end;
lImage.Free;
lImageBuilder.Free;
lFilter.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test ChromaResampler, Diff');
Memo.Lines.Add('=======================');
SetLength(lCoefficients, 2);
lCoefficients[0] := 1.0;
lCoefficients[1] := -1.0;
lImage := TImage.Create(12);
lImageBuilder := TImageBuilder.Create(lImage);
lFilter := TChromaFilter.Create(@lCoefficients[0], 2, lImageBuilder);
lFilter.Consume(d1);
lFilter.Consume(d2);
lFilter.Consume(d3);
if lImage.NumRows = 2 then
begin
Memo.Lines.Add('Numbers of rows match: OK');
lRes := lImage.GetData(0, 0);
if lRes = -1.0 then
Memo.Lines.Add('Value on 0/0 match: OK');
lRes := lImage.GetData(1, 0);
if lRes = -1.0 then
Memo.Lines.Add('Value on 1/0 match: OK');
lRes := lImage.GetData(0, 1);
if lRes = -1.0 then
Memo.Lines.Add('Value on 0/1 match: OK');
lRes := lImage.GetData(1, 1);
if lRes = -1.0 then
Memo.Lines.Add('Value on 1/1 match: OK');
end
else
begin
Memo.Lines.Add('Numbers of rows match: NOT OK');
end;
lImage.Free;
lImageBuilder.Free;
lFilter.Free;
end;
procedure TAPITestForm.btnTestChromaprintClick(Sender: TObject);
const
chromagram: array [0 .. 13, 0 .. 11] of double = ((0.155444, 0.268618, 0.474445, 0.159887, 0.1761, 0.423511, 0.178933, 0.34433, 0.360958, 0.30421,
0.200217, 0.17072), (0.159809, 0.238675, 0.286526, 0.166119, 0.225144, 0.449236, 0.162444, 0.371875, 0.259626, 0.483961, 0.24491, 0.17034),
(0.156518, 0.271503, 0.256073, 0.152689, 0.174664, 0.52585, 0.141517, 0.253695, 0.293199, 0.332114, 0.442906, 0.170459),
(0.154183, 0.38592, 0.497451, 0.203884, 0.362608, 0.355691, 0.125349, 0.146766, 0.315143, 0.318133, 0.172547, 0.112769),
(0.201289, 0.42033, 0.509467, 0.259247, 0.322772, 0.325837, 0.140072, 0.177756, 0.320356, 0.228176, 0.148994, 0.132588),
(0.187921, 0.302804, 0.46976, 0.302809, 0.183035, 0.228691, 0.206216, 0.35174, 0.308208, 0.233234, 0.316017, 0.243563),
(0.213539, 0.240346, 0.308664, 0.250704, 0.204879, 0.365022, 0.241966, 0.312579, 0.361886, 0.277293, 0.338944, 0.290351),
(0.227784, 0.252841, 0.295752, 0.265796, 0.227973, 0.451155, 0.219418, 0.272508, 0.376082, 0.312717, 0.285395, 0.165745),
(0.168662, 0.180795, 0.264397, 0.225101, 0.562332, 0.33243, 0.236684, 0.199847, 0.409727, 0.247569, 0.21153, 0.147286),
(0.0491864, 0.0503369, 0.130942, 0.0505802, 0.0694409, 0.0303877, 0.0389852, 0.674067, 0.712933, 0.05762, 0.0245158, 0.0389336),
(0.0814379, 0.0312366, 0.240546, 0.134609, 0.063374, 0.0466124, 0.0752175, 0.657041, 0.680085, 0.0720311, 0.0249404, 0.0673359),
(0.139331, 0.0173442, 0.49035, 0.287237, 0.0453947, 0.0873279, 0.15423, 0.447475, 0.621502, 0.127166, 0.0355933, 0.141163),
(0.115417, 0.0132515, 0.356601, 0.245902, 0.0283943, 0.0588233, 0.117077, 0.499376, 0.715366, 0.100398, 0.0281382, 0.0943482),
(0.047297, 0.0065354, 0.181074, 0.121455, 0.0135504, 0.030693, 0.0613105, 0.631705, 0.73548, 0.0550565, 0.0128093, 0.0460393));
var
buffer, Buffer2: TAudioBuffer;
Processor: TAudioProcessor;
DataMono, DataStereo, DataMono11025, DataMono8000: TSmallintArray;
i: integer;
lError: boolean;
lErrCount: integer;
lImage: TImage;
lImageBuilder: TImageBuilder;
lChromaNormalizer: TChromaNormalizer;
lChroma: TChroma;
lFFT: TFFT;
lProcessor: TAudioProcessor;
y, x: integer;
l1, l2: double;
begin
Memo.Lines.Clear;
DataStereo := LoadAudioFile('data\test_stereo_44100.raw');
lImage := TImage.Create(12);
lImageBuilder := TImageBuilder.Create(lImage);
lChromaNormalizer := TChromaNormalizer.Create(lImageBuilder);
lChroma := TChroma.Create(cMIN_FREQ, cMAX_FREQ, cFRAME_SIZE, cSAMPLE_RATE, lChromaNormalizer);
lFFT := TFFT.Create(cFRAME_SIZE, cOVERLAP, lChroma);
lProcessor := TAudioProcessor.Create(cSAMPLE_RATE, lFFT);
lProcessor.Reset(44100, 2);
lProcessor.Consume(DataStereo, 0, Length(DataStereo));
lProcessor.Flush();
if lImage.NumRows = 14 then
begin
Memo.Lines.Add('Numbers of rows match: OK');
lError := False;
for y := 0 to 13 do
begin
for x := 0 to 11 do
begin
l1 := chromagram[y, x];
l2 := lImage.GetData(y, x);
if (abs(l1 - l2) > 0.0005) then
begin
Memo.Lines.Add(' Image not equal at (' + IntToStr(x) + ',' + IntToStr(y) + '): ' + FloatToStrF(l1 - l2, ffNumber, 8, 3));
lError := True;
end;
end;
end;
if not lError then
Memo.Lines.Add('Image equal: OK');
end
else
begin
Memo.Lines.Add('Numbers of rows match: NOT OK');
end;
lProcessor.Free;
lFFT.Free;
lChromaNormalizer.Free;
lChroma.Free;
lImageBuilder.Free;
lImage.Free;
SetLength(DataStereo, 0);
end;
procedure TAPITestForm.btnTestChromaResamplerClick(Sender: TObject);
var
lImage: TImage;
lImageBuilder: TImageBuilder;
lResampler: TChromaResampler;
d1: TDoubleArray;
d2, d3, d4: TDoubleArray;
lRes: double;
begin
Memo.Lines.Clear;
SetLength(d1, 12);
d1[0] := 0.0;
d1[1] := 5.0;
d1[2] := 0.0;
d1[3] := 0.0;
d1[4] := 0.0;
d1[5] := 0.0;
d1[6] := 0.0;
d1[7] := 0.0;
d1[8] := 0.0;
d1[9] := 0.0;
d1[10] := 0.0;
d1[11] := 0.0;
SetLength(d2, 12);
d2[0] := 1.0;
d2[1] := 6.0;
d2[2] := 0.0;
d2[3] := 0.0;
d2[4] := 0.0;
d2[5] := 0.0;
d2[6] := 0.0;
d2[7] := 0.0;
d2[8] := 0.0;
d2[9] := 0.0;
d2[10] := 0.0;
d2[11] := 0.0;
SetLength(d3, 12);
d3[0] := 2.0;
d3[1] := 7.0;
d3[2] := 0.0;
d3[3] := 0.0;
d3[4] := 0.0;
d3[5] := 0.0;
d3[6] := 0.0;
d3[7] := 0.0;
d3[8] := 0.0;
d3[9] := 0.0;
d3[10] := 0.0;
d3[11] := 0.0;
SetLength(d4, 12);
d4[0] := 3.0;
d4[1] := 8.0;
d4[2] := 0.0;
d4[3] := 0.0;
d4[4] := 0.0;
d4[5] := 0.0;
d4[6] := 0.0;
d4[7] := 0.0;
d4[8] := 0.0;
d4[9] := 0.0;
d4[10] := 0.0;
d4[11] := 0.0;
Memo.Lines.Add('Test ChromaResampler, Test 1');
Memo.Lines.Add('=======================');
lImage := TImage.Create(12);
lImageBuilder := TImageBuilder.Create(lImage);
lResampler := TChromaResampler.Create(2, lImageBuilder);
lResampler.Consume(d1);
lResampler.Consume(d2);
lResampler.Consume(d3);
if lImage.NumRows = 1 then
begin
Memo.Lines.Add('Numbers of rows match: OK');
lRes := lImage.GetData(0, 0);
if lRes = 0.5 then
Memo.Lines.Add('Value on 0/0 match: OK');
lRes := lImage.GetData(0, 1);
if lRes = 5.5 then
Memo.Lines.Add('Value on 0/1 match: OK');
end
else
begin
Memo.Lines.Add('Numbers of rows match: NOT OK');
end;
lImage.Free;
lImageBuilder.Free;
lResampler.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test ChromaResampler, Test 2');
Memo.Lines.Add('=======================');
lImage := TImage.Create(12);
lImageBuilder := TImageBuilder.Create(lImage);
lResampler := TChromaResampler.Create(2, lImageBuilder);
lResampler.Consume(d1);
lResampler.Consume(d2);
lResampler.Consume(d3);
lResampler.Consume(d4);
if lImage.NumRows = 2 then
begin
Memo.Lines.Add('Numbers of rows match: OK');
lRes := lImage.GetData(0, 0);
if lRes = 0.5 then
Memo.Lines.Add('Value on 0/0 match: OK');
lRes := lImage.GetData(0, 1);
if lRes = 5.5 then
Memo.Lines.Add('Value on 0/1 match: OK');
lRes := lImage.GetData(1, 0);
if lRes = 2.5 then
Memo.Lines.Add('Value on 1/0 match: OK');
lRes := lImage.GetData(1, 1);
if lRes = 7.5 then
Memo.Lines.Add('Value on 1/1 match: OK');
end
else
begin
Memo.Lines.Add('Numbers of rows match: NOT OK');
end;
lImage.Free;
lImageBuilder.Free;
lResampler.Free;
end;
procedure TAPITestForm.btnTestCombinedBufferClick(Sender: TObject);
var
Buffer1, Buffer2: TSmallintArray;
lCombinedBuffer: TCombinedBuffer;
i: integer;
begin
Memo.Lines.Clear;
SetLength(Buffer1, 5);
Buffer1[0] := 1;
Buffer1[1] := 2;
Buffer1[2] := 3;
Buffer1[3] := 4;
Buffer1[4] := 5;
SetLength(Buffer2, 3);
Buffer2[0] := 6;
Buffer2[1] := 7;
Buffer2[2] := 8;
Memo.Lines.Add('Test CombinedBuffer, Size');
Memo.Lines.Add('=======================');
lCombinedBuffer := TCombinedBuffer.Create(Buffer1, 5, Buffer2, 3);
if lCombinedBuffer.Size = 8 then
Memo.Lines.Add('CombinedBuffer Size: OK');
lCombinedBuffer.Shift(1);
if lCombinedBuffer.Size = 7 then
Memo.Lines.Add('CombinedBuffer Size after shift: OK');
lCombinedBuffer.Shift(-1);
for i := 0 to 7 do
begin
if (i + 1) = lCombinedBuffer.GetValue(i) then
Memo.Lines.Add('CombinedBuffer read pos[' + IntToStr(i) + ']: OK')
else
Memo.Lines.Add('CombinedBuffer read pos[' + IntToStr(i) + ']: NOT OK');
end;
lCombinedBuffer.Shift(1);
for i := 0 to 6 do
begin
if (i + 2) = lCombinedBuffer.GetValue(i) then
Memo.Lines.Add('CombinedBuffer read after shift pos[' + IntToStr(i) + ']: OK')
else
Memo.Lines.Add('CombinedBuffer read after shift pos[' + IntToStr(i) + ']: NOT OK');
end;
lCombinedBuffer.Shift(5);
for i := 0 to 1 do
begin
if (i + 7) = lCombinedBuffer.GetValue(i) then
Memo.Lines.Add('CombinedBuffer read after 2.shift pos[' + IntToStr(i) + ']: OK')
else
Memo.Lines.Add('CombinedBuffer read after 2.shift pos[' + IntToStr(i) + ']: NOT OK');
end;
SetLength(Buffer1, 0);
SetLength(Buffer2, 0);
lCombinedBuffer.Free;
end;
procedure TAPITestForm.btnTestFilterClick(Sender: TObject);
var
lImage: TImage;
lFilter: TFilter;
lIntegralImage: TIntegralImage;
lRes: double;
begin
Memo.Lines.Clear;
lImage := TImage.Create(2, 2);
lImage.SetData(0, 0, 0.0);
lImage.SetData(0, 1, 1.0);
lImage.SetData(1, 0, 2.0);
lImage.SetData(1, 1, 3.0);
lFilter := TFilter.Create(0, 0, 1, 1);
lIntegralImage := TIntegralImage.Create(lImage);
lRes := lFilter.Apply(lIntegralImage, 0);
if lRes = 0.0 then
Memo.Lines.Add('Apply Filter 0: OK');
lRes := lFilter.Apply(lIntegralImage, 1);
if (lRes <= 1.0986124) and (lRes >= 1.0986122) then
Memo.Lines.Add('Apply Filter 1: OK');
lImage.Free;
lFilter.Free;
lIntegralImage.Free;
end;
procedure TAPITestForm.btnTestFingerprintCalculatorClick(Sender: TObject);
var
lImage: TImage;
lClassifier: TClassifierArray;
lCalculator: TFingerprintCalculator;
integral_image: TIntegralImage;
fp: TUINT32Array;
begin
Memo.Lines.Clear;
lImage := TImage.Create(2, 2);
lImage.SetData(0, 0, 0.0);
lImage.SetData(0, 1, 1.0);
lImage.SetData(1, 0, 2.0);
lImage.SetData(1, 1, 3.0);
SetLength(lClassifier, 1);
lClassifier[0] := TClassifier.Create(TFilter.Create(0, 0, 1, 1), TQuantizer.Create(0.01, 1.01, 1.5));
lCalculator := TFingerprintCalculator.Create(lClassifier);
integral_image := TIntegralImage.Create(lImage);
if lCalculator.CalculateSubfingerprint(integral_image, 0) = GrayCode(0) then
Memo.Lines.Add('CalculateSubfingerprint 0: OK')
else
Memo.Lines.Add('CalculateSubfingerprint 0: NOT OK');
if lCalculator.CalculateSubfingerprint(integral_image, 1) = GrayCode(2) then
Memo.Lines.Add('CalculateSubfingerprint 1: OK')
else
Memo.Lines.Add('CalculateSubfingerprint 1: NOT OK');
lImage.Free;
lCalculator.Free;
integral_image.Free;
lClassifier[0].Free;
Memo.Lines.Add('');
Memo.Lines.Add('FingerprintCalculator, Calculate');
Memo.Lines.Add('=======================');
lImage := TImage.Create(2, 3);
lImage.SetData(0, 0, 0.0);
lImage.SetData(0, 1, 1.0);
lImage.SetData(1, 0, 2.0);
lImage.SetData(1, 1, 3.0);
lImage.SetData(2, 0, 4.0);
lImage.SetData(2, 1, 5.0);
SetLength(lClassifier, 1);
lClassifier[0] := TClassifier.Create(TFilter.Create(0, 0, 1, 1), TQuantizer.Create(0.01, 1.01, 1.5));
lCalculator := TFingerprintCalculator.Create(lClassifier);
fp := lCalculator.Calculate(lImage);
if Length(fp) = 3 then
begin
Memo.Lines.Add('FingerprintCalculator Length: OK');
if fp[0] = GrayCode(0) then
Memo.Lines.Add('FingerprintCalculator 0: OK')
else
Memo.Lines.Add('FingerprintCalculator 0: NOT OK');
if fp[1] = GrayCode(2) then
Memo.Lines.Add('FingerprintCalculator 1: OK')
else
Memo.Lines.Add('FingerprintCalculator 1: NOT OK');
if fp[2] = GrayCode(3) then
Memo.Lines.Add('FingerprintCalculator 2: OK')
else
Memo.Lines.Add('FingerprintCalculator 2: NOT OK');
end
else
begin
Memo.Lines.Add('FingerprintCalculator Length: NOT OK');
end;
lImage.Free;
lCalculator.Free;
lClassifier[0].Free;
end;
procedure TAPITestForm.btnTestFingerprintDecompressorClick(Sender: TObject);
var
expected: TUINT32Array;
Data: string;
algorithm: integer;
Value: TUINT32Array;
begin
Memo.Lines.Clear;
Memo.Lines.Add('FingerprintDecompressor, OneItemOneBi');
Memo.Lines.Add('=======================');
SetLength(expected, 1);
expected[0] := 1;
Data := chr(0) + chr(0) + chr(0) + chr(1) + chr(1);
algorithm := 1;
Value := DecompressFingerprint(Data, algorithm);
CheckFingerprints(Memo.Lines, Value, expected, Length(expected));
if algorithm = 0 then
Memo.Lines.Add('Algorithm: OK')
else
Memo.Lines.Add('Algorithm: NOT OK');
Memo.Lines.Add('');
Memo.Lines.Add('FingerprintDecompressor, OneItemThreeBits');
Memo.Lines.Add('=======================');
SetLength(expected, 1);
expected[0] := 7;
Data := chr(0) + chr(0) + chr(0) + chr(1) + chr(73) + chr(0);
algorithm := 1;
Value := DecompressFingerprint(Data, algorithm);
CheckFingerprints(Memo.Lines, Value, expected, Length(expected));
if algorithm = 0 then
Memo.Lines.Add('Algorithm: OK')
else
Memo.Lines.Add('Algorithm: NOT OK');
Memo.Lines.Add('');
Memo.Lines.Add('FingerprintDecompressor, OneItemOneBitExcept');
Memo.Lines.Add('=======================');
SetLength(expected, 1);
expected[0] := 1 shl 6;
Data := chr(0) + chr(0) + chr(0) + chr(1) + chr(7) + chr(0);
algorithm := 1;
Value := DecompressFingerprint(Data, algorithm);
CheckFingerprints(Memo.Lines, Value, expected, Length(expected));
if algorithm = 0 then
Memo.Lines.Add('Algorithm: OK')
else
Memo.Lines.Add('Algorithm: NOT OK');
Memo.Lines.Add('');
Memo.Lines.Add('FingerprintDecompressor, OneItemOneBitExcept2');
Memo.Lines.Add('=======================');
SetLength(expected, 1);
expected[0] := 1 shl 8;
Data := chr(0) + chr(0) + chr(0) + chr(1) + chr(7) + chr(2);
algorithm := 1;
Value := DecompressFingerprint(Data, algorithm);
CheckFingerprints(Memo.Lines, Value, expected, Length(expected));
if algorithm = 0 then
Memo.Lines.Add('Algorithm: OK')
else
Memo.Lines.Add('Algorithm: NOT OK');
Memo.Lines.Add('');
Memo.Lines.Add('FingerprintDecompressor, TwoItems');
Memo.Lines.Add('=======================');
SetLength(expected, 2);
expected[0] := 1;
expected[1] := 0;
Data := chr(0) + chr(0) + chr(0) + chr(2) + chr(65) + chr(0);
algorithm := 1;
Value := DecompressFingerprint(Data, algorithm);
CheckFingerprints(Memo.Lines, Value, expected, Length(expected));
if algorithm = 0 then
Memo.Lines.Add('Algorithm: OK')
else
Memo.Lines.Add('Algorithm: NOT OK');
Memo.Lines.Add('');
Memo.Lines.Add('FingerprintDecompressor, TwoItemsNoChange');
Memo.Lines.Add('=======================');
SetLength(expected, 2);
expected[0] := 1;
expected[1] := 1;
Data := chr(0) + chr(0) + chr(0) + chr(2) + chr(1) + chr(0);
algorithm := 1;
Value := DecompressFingerprint(Data, algorithm);
CheckFingerprints(Memo.Lines, Value, expected, Length(expected));
if algorithm = 0 then
Memo.Lines.Add('Algorithm: OK')
else
Memo.Lines.Add('Algorithm: NOT OK');
Memo.Lines.Add('');
Memo.Lines.Add('FingerprintDecompressor, Invalid1');
Memo.Lines.Add('=======================');
SetLength(expected, 1);
expected[0] := 0;
Data := chr(0) + chr(255) + chr(255) + chr(255);
algorithm := 1;
Value := DecompressFingerprint(Data, algorithm);
CheckFingerprints(Memo.Lines, Value, expected, Length(expected));
if algorithm = 0 then
Memo.Lines.Add('Algorithm: OK')
else
Memo.Lines.Add('Algorithm: NOT OK');
SetLength(Value,0);
end;
procedure TAPITestForm.btnTestIntegralImageClick(Sender: TObject);
var
lImage: TImage;
lIntegralImage: TIntegralImage;
lRes: double;
begin
Memo.Lines.Clear;
Memo.Lines.Add('IntegralImage, Basic2D');
Memo.Lines.Add('=======================');
lImage := TImage.Create(2, 2);
lImage.SetData(0, 0, 1.0);
lImage.SetData(0, 1, 2.0);
lImage.SetData(1, 0, 3.0);
lImage.SetData(1, 1, 4.0);
lIntegralImage := TIntegralImage.Create(lImage);
if lIntegralImage.GetData(0, 0) = 1.0 then
Memo.Lines.Add('Integeral Image 0: OK');
if lIntegralImage.GetData(0, 1) = 3.0 then
Memo.Lines.Add('Integeral Image 1: OK');
if lIntegralImage.GetData(1, 0) = 4.0 then
Memo.Lines.Add('Integeral Image 2: OK');
if lIntegralImage.GetData(1, 1) = 10.0 then
Memo.Lines.Add('Integeral Image 3: OK');
lIntegralImage.Free;
lImage.Free;
Memo.Lines.Add('');
Memo.Lines.Add('IntegralImage, Vertical1D');
Memo.Lines.Add('=======================');
lImage := TImage.Create(1, 3);
lImage.SetData(0, 0, 1.0);
lImage.SetData(1, 0, 2.0);
lImage.SetData(2, 0, 3.0);
lIntegralImage := TIntegralImage.Create(lImage);
if lIntegralImage.GetData(0, 0) = 1.0 then
Memo.Lines.Add('Integeral Image 0: OK');
if lIntegralImage.GetData(1, 0) = 3.0 then
Memo.Lines.Add('Integeral Image 1: OK');
if lIntegralImage.GetData(2, 0) = 6.0 then
Memo.Lines.Add('Integeral Image 2: OK');
lIntegralImage.Free;
lImage.Free;
Memo.Lines.Add('');
Memo.Lines.Add('IntegralImage, Horizontal1D');
Memo.Lines.Add('=======================');
lImage := TImage.Create(3, 1);
lImage.SetData(0, 0, 1.0);
lImage.SetData(0, 1, 2.0);
lImage.SetData(0, 2, 3.0);
lIntegralImage := TIntegralImage.Create(lImage);
if lIntegralImage.GetData(0, 0) = 1.0 then
Memo.Lines.Add('Integeral Image 0: OK');
if lIntegralImage.GetData(0, 1) = 3.0 then
Memo.Lines.Add('Integeral Image 1: OK');
if lIntegralImage.GetData(0, 2) = 6.0 then
Memo.Lines.Add('Integeral Image 2: OK');
lIntegralImage.Free;
lImage.Free;
Memo.Lines.Add('');
Memo.Lines.Add('IntegralImage, Area');
Memo.Lines.Add('=======================');
lImage := TImage.Create(3, 3);
lImage.SetData(0, 0, 1.0);
lImage.SetData(0, 1, 2.0);
lImage.SetData(0, 2, 3.0);
lImage.SetData(1, 0, 4.0);
lImage.SetData(1, 1, 5.0);
lImage.SetData(1, 2, 6.0);
lImage.SetData(2, 0, 7.0);
lImage.SetData(2, 1, 8.0);
lImage.SetData(2, 2, 9.0);
lIntegralImage := TIntegralImage.Create(lImage);
if lIntegralImage.Area(0, 0, 0, 0) = (1.0) then
Memo.Lines.Add('Integeral Image Area 0: OK');
if lIntegralImage.Area(0, 0, 1, 0) = (1.0 + 4) then
Memo.Lines.Add('Integeral Image Area 1: OK');
if lIntegralImage.Area(0, 0, 2, 0) = (1.0 + 4 + 7) then
Memo.Lines.Add('Integeral Image Area 2: OK');
if lIntegralImage.Area(0, 0, 0, 1) = (1.0 + 2) then
Memo.Lines.Add('Integeral Image Area 3: OK');
if lIntegralImage.Area(0, 0, 1, 1) = (1.0 + 4 + 2 + 5) then
Memo.Lines.Add('Integeral Image Area 4: OK');
if lIntegralImage.Area(0, 0, 2, 1) = (1.0 + 4 + 7 + 2 + 5 + 8) then
Memo.Lines.Add('Integeral Image Area 5: OK');
if lIntegralImage.Area(0, 1, 0, 1) = (2.0) then
Memo.Lines.Add('Integeral Image Area 6: OK');
if lIntegralImage.Area(0, 1, 1, 1) = (2.0 + 5) then
Memo.Lines.Add('Integeral Image Area 7: OK');
if lIntegralImage.Area(0, 1, 2, 1) = (2.0 + 5 + 8) then
Memo.Lines.Add('Integeral Image Area 8: OK');
lIntegralImage.Free;
lImage.Free;
end;
procedure TAPITestForm.btnTestQuantizeClick(Sender: TObject);
var
q: TQuantizer;
begin
Memo.Lines.Clear;
Memo.Lines.Add('Test Quantizer, Quantize');
Memo.Lines.Add('=======================');
q := TQuantizer.Create(0.0, 0.1, 0.3);
if q.Quantize(-0.1) = 0 then
Memo.Lines.Add('Quantize 1: OK')
else
Memo.Lines.Add('Quantize 1: NOT OK');
if q.Quantize(0.0) = 1 then
Memo.Lines.Add('Quantize 2: OK')
else
Memo.Lines.Add('Quantize 2: NOT OK');
if q.Quantize(0.03) = 1 then
Memo.Lines.Add('Quantize 3: OK')
else
Memo.Lines.Add('Quantize 3: NOT OK');
if q.Quantize(0.1) = 2 then
Memo.Lines.Add('Quantize 4: OK')
else
Memo.Lines.Add('Quantize 4: NOT OK');
if q.Quantize(0.13) = 2 then
Memo.Lines.Add('Quantize 5: OK')
else
Memo.Lines.Add('Quantize 5: NOT OK');
if q.Quantize(0.3) = 3 then
Memo.Lines.Add('Quantize 6: OK')
else
Memo.Lines.Add('Quantize 6: NOT OK');
if q.Quantize(0.33) = 3 then
Memo.Lines.Add('Quantize 7: OK')
else
Memo.Lines.Add('Quantize 7: NOT OK');
if q.Quantize(1000.0) = 3 then
Memo.Lines.Add('Quantize 8: OK')
else
Memo.Lines.Add('Quantize 8: NOT OK');
q.Free;
end;
procedure TAPITestForm.btnTestSilenceRemoverClick(Sender: TObject);
var
samples, Samples1, Samples2: TSmallintArray;
buffer: TAudioBuffer;
Processor: TSilenceRemover;
lError: boolean;
i: integer;
begin
Memo.Lines.Clear;
{
SetLength(samples, 6);
samples[0] := 1000;
samples[1] := 2000;
samples[2] := 3000;
samples[3] := 4000;
samples[4] := 5000;
samples[5] := 6000;
Buffer := TAudioBuffer.Create;
Processor := TSilenceRemover.Create(Buffer);
Processor.Reset(44100, 1);
Processor.Consume(samples, Length(samples));
Processor.Flush();
Memo.Lines.Add('Test SilenceRemover, PassThrough ');
Memo.Lines.Add('=======================');
if Length(samples) = Length(Buffer.data) then
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: OK');
lError := FALSE;
for i := 0 to Length(samples) - 1 do
begin
if samples[i] <> Buffer.data[i] then
begin
Memo.Lines.Add('Signals differ at index: ' + IntToStr(i) + ', ' + IntToStr(samples[i]) + ' || ' + IntToStr(Buffer.data[i]));
lError := TRUE;
end;
end;
if lError then
begin
Memo.Lines.Add('Buffer Data and Readed Data equal: NOT OK');
end
else
Memo.Lines.Add('Buffer Data and Readed Data equal: OK');
end
else
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: NOT OK');
end;
Buffer.Free;
Processor.Free;
}
Memo.Lines.Add('');
Memo.Lines.Add('Test SilenceRemover, RemoveLeadingSilence ');
Memo.Lines.Add('=======================');
SetLength(Samples1, 9);
Samples1[0] := 0;
Samples1[1] := 60;
Samples1[2] := 0;
Samples1[3] := 1000;
Samples1[4] := 2000;
Samples1[5] := 0;
Samples1[6] := 4000;
Samples1[7] := 5000;
Samples1[8] := 0;
SetLength(Samples2, 6);
Samples2[0] := 1000;
Samples2[1] := 2000;
Samples2[2] := 0;
Samples2[3] := 4000;
Samples2[4] := 5000;
Samples2[5] := 0;
buffer := TAudioBuffer.Create;
Processor := TSilenceRemover.Create(buffer, 100);
Processor.Reset(44100, 1);
Processor.Consume(Samples1, 0, Length(Samples1));
Processor.Flush();
if Length(Samples2) = Length(buffer.Data) then
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: OK');
lError := False;
for i := 0 to Length(Samples2) - 1 do
begin
if Samples2[i] <> buffer.Data[i] then
begin
Memo.Lines.Add('Signals differ at index: ' + IntToStr(i) + ', ' + IntToStr(Samples2[i]) + ' || ' + IntToStr(buffer.Data[i]));
lError := True;
end;
end;
if lError then
begin
Memo.Lines.Add('Buffer Data and Readed Data equal: NOT OK');
end
else
Memo.Lines.Add('Buffer Data and Readed Data equal: OK');
end
else
begin
Memo.Lines.Add('Buffer Data Size and Readed Data Size: NOT OK');
end;
buffer.Free;
Processor.Free;
end;
procedure TAPITestForm.btnTestStringReaderClick(Sender: TObject);
var
Data: string;
reader: TBitStringReader;
begin
Memo.Clear;
Memo.Lines.Add('Test BitStringReader, OneByte');
Memo.Lines.Add('=======================');
Data := chr(byte(-28));
reader := TBitStringReader.Create(Data);
if (reader.Read(2) = 0) then
Memo.Lines.Add('BitStringReader 0: OK')
else
Memo.Lines.Add('BitStringReader 0: NOT OK');
if (reader.Read(2) = 1) then
Memo.Lines.Add('BitStringReader 1: OK')
else
Memo.Lines.Add('BitStringReader 1: NOT OK');
if (reader.Read(2) = 2) then
Memo.Lines.Add('BitStringReader 2: OK')
else
Memo.Lines.Add('BitStringReader 2: NOT OK');
if (reader.Read(2) = 3) then
Memo.Lines.Add('BitStringReader 3: OK')
else
Memo.Lines.Add('BitStringReader 3: NOT OK');
reader.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test BitStringReader, TwoBytesIncomplete');
Memo.Lines.Add('=======================');
Data := chr(byte(-28)) + chr(byte(1));
reader := TBitStringReader.Create(Data);
if (reader.Read(2) = 0) then
Memo.Lines.Add('BitStringReader 0: OK')
else
Memo.Lines.Add('BitStringReader 0: NOT OK');
if (reader.Read(2) = 1) then
Memo.Lines.Add('BitStringReader 1: OK')
else
Memo.Lines.Add('BitStringReader 1: NOT OK');
if (reader.Read(2) = 2) then
Memo.Lines.Add('BitStringReader 2: OK')
else
Memo.Lines.Add('BitStringReader 2: NOT OK');
if (reader.Read(2) = 3) then
Memo.Lines.Add('BitStringReader 3: OK')
else
Memo.Lines.Add('BitStringReader 3: NOT OK');
if (reader.Read(2) = 1) then
Memo.Lines.Add('BitStringReader 4: OK')
else
Memo.Lines.Add('BitStringReader 4: NOT OK');
reader.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test BitStringReader, TwoBytesSplit');
Memo.Lines.Add('=======================');
Data := chr(byte(-120)) + chr(byte(6));
reader := TBitStringReader.Create(Data);
if (reader.Read(3) = 0) then
Memo.Lines.Add('BitStringReader 0: OK')
else
Memo.Lines.Add('BitStringReader 0: NOT OK');
if (reader.Read(3) = 1) then
Memo.Lines.Add('BitStringReader 1: OK')
else
Memo.Lines.Add('BitStringReader 1: NOT OK');
if (reader.Read(3) = 2) then
Memo.Lines.Add('BitStringReader 2: OK')
else
Memo.Lines.Add('BitStringReader 2: NOT OK');
if (reader.Read(3) = 3) then
Memo.Lines.Add('BitStringReader 3: OK')
else
Memo.Lines.Add('BitStringReader 3: NOT OK');
reader.Free;
Memo.Lines.Add('');
Memo.Lines.Add('Test BitStringReader, AvailableBitsAndEOF');
Memo.Lines.Add('=======================');
Data := chr(byte(-120)) + chr(byte(6));
reader := TBitStringReader.Create(Data);
if reader.AvailableBits = 16 then
begin
Memo.Lines.Add('AvailableBits 16: OK');
Memo.Lines.Add('EOF: ' + BoolToStr(reader.EOF, True));
reader.Read(3);
if reader.AvailableBits = 13 then
begin
Memo.Lines.Add('AvailableBits 13: OK');
Memo.Lines.Add('EOF: ' + BoolToStr(reader.EOF, True));
reader.Read(3);
if reader.AvailableBits = 10 then
begin
Memo.Lines.Add('AvailableBits 10: OK');
Memo.Lines.Add('EOF: ' + BoolToStr(reader.EOF, True));
reader.Read(3);
if reader.AvailableBits = 7 then
begin
Memo.Lines.Add('AvailableBits 7: OK');
Memo.Lines.Add('EOF: ' + BoolToStr(reader.EOF, True));
reader.Read(7);
if reader.AvailableBits = 0 then
begin
Memo.Lines.Add('AvailableBits 0: OK');
Memo.Lines.Add('EOF: ' + BoolToStr(reader.EOF, True));
if reader.Read(3) = 0 then
begin
Memo.Lines.Add('Read ZERO: OK');
if reader.AvailableBits = 0 then
begin
Memo.Lines.Add('AvailableBits 0: OK');
Memo.Lines.Add('EOF: ' + BoolToStr(reader.EOF, True));
end;
end;
end;
end;
end;
end;
end
else
begin
Memo.Lines.Add('AvailableBits 16: NOT OK');
end;
reader.Free;
end;
procedure TAPITestForm.FormCreate(Sender: TObject);
begin
Memo.Clear;
end;
{ TFeatureVectorBuffer }
procedure TFeatureVectorBuffer.Consume(var features: TDoubleArray);
begin
m_features := features;
end;
end.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.