I've tried to upload, my connection is garbled, so here's a simple plugin example:


[pascal]library SEncode;

//---------------------------------------------------------------------------
uses
SysUtils, Classes, AsphyreDef, EncodePlugins;

{$R *.res}

//---------------------------------------------------------------------------
const
PluginVersion = $100; // current version of the plugin
PluginMinVersion = $100; // lowest compatible version of previous plugins
// PluginMinVersion determines which previous versions of the plugin can
// be decoded by current version of plugin. If it has the same value
// as PluginVersion, then this plugin can only decode its own encodings.

//---------------------------------------------------------------------------
var
AttrVersion : ShortString = 'Version 1.0'#0;
AttrMinVersion: ShortString = 'Compatible with version 1.0 and higher'#0;
AttrName : ShortString = 'Simple encode algorythm'#0;
AttrID : ShortString = 'MyEncode8'#0;
AttrFlags : array[flagEncode..flagDecode] of ShortString = ('Encode Data'#0,
'Decode Data'#0);

//---------------------------------------------------------------------------
procedure DoEncode(Source, Dest: Pointer; SourceSize, DestSize: Cardinal);
var
i: Integer;
InB, OutB: PByte;
begin
InB:= Source;
OutB:= Dest;
for i:= 0 to SourceSize - 1 do
begin
OutB^:= InB^;
Inc(OutB^);
Inc(InB);
Inc(OutB);
end;
end;

//---------------------------------------------------------------------------
procedure DoDecode(Source, Dest: Pointer; SourceSize, DestSize: Cardinal);
var
i: Integer;
InB, OutB: PByte;
begin
InB:= Source;
OutB:= Dest;
for i:= 0 to SourceSize - 1 do
begin
OutB^:= InB^;
Dec(OutB^);
Inc(InB);
Inc(OutB);
end;
end;

//---------------------------------------------------------------------------
function PluginExec(Source, Dest: Pointer; SourceSize,
DestSize, Flags: Longword): Integer; stdcall;
begin
Result:= errFlags;

case Flags of
// compress the data
flagEncode:
begin
DoEncode(Source, Dest, SourceSize, DestSize);
Result:= SourceSize;
end;

// decompress the data
flagDecode:
begin
DoDecode(Source, Dest, SourceSize, DestSize);
Result:= SourceSize;
end;

// plugin parameters
flagParams:
begin
// change Result to >= 0, if successful
Result:= errFlags;
end;

// reset plugin
flagReset:
begin
// change Result to >= 0, if successful
Result:= errFlags;
end;
end; // case Flags of
end;

//---------------------------------------------------------------------------
function PluginEnum(EnumFunc: TEnumFunc; MiscParam: Longword): Integer; stdcall;
var
KeepGoing: Boolean;
cFlag: Longword;
begin
// number of successful calls
Result:= 0;

// plugin name
KeepGoing:= EnumFunc(AttribName, 0, @AttrName[1], MiscParam);
if (not KeepGoing) then Exit else Inc(Result);

// plugin id
KeepGoing:= EnumFunc(AttribID, 0, @AttrID[1], MiscParam);
if (not KeepGoing) then Exit else Inc(Result);

// plugin version
KeepGoing:= EnumFunc(AttribVersion, PluginVersion, @AttrVersion[1], MiscParam);
if (not KeepGoing) then Exit else Inc(Result);

// plugin minimal version
KeepGoing:= EnumFunc(attribMinVersion, PluginMinVersion, @AttrMinVersion[1], MiscParam);
if (not KeepGoing) then Exit else Inc(Result);

// encode flags
for cFlag:= flagEncode to flagParams do
begin
KeepGoing:= EnumFunc(attribFlags, cFlag, @AttrFlags[cFlag][1], MiscParam);
if (not KeepGoing) then Exit else Inc(Result);
end;
end;

//---------------------------------------------------------------------------
exports
PluginExec,
PluginEnum;

//---------------------------------------------------------------------------
// Plugin Initialization
//---------------------------------------------------------------------------
begin
end.[/pascal]