Quote Originally Posted by PyroGine Development
Ahh ok I see. There is one in fact called DelphiDoc, which I tried, but I was getting AVs. I will check out PasDoc too.

On another note I just updated the PGNet unit with a new class that support network object persistence. I simply derived a new class from PGNet, override the OnRecive event handler to handle processing objects, finally added a new event handler to received the object rather than the data pointer and size. Now you will be able to send live objects across the wire.

Deceleration
[code=delphi] TPGNetObjects = class(TPGNet)
protected
FPersistence: TPGPersistence;
procedure OnReceive(const aHost: TPGString; aPort: Integer; aData: Pointer; aSize: Integer);
public
constructor Create; override;
destructor Destroy; override;
procedure OnReceiveObject(const aHost: TPGString; aPort: Integer; aObj: TPGPersistentObject); virtual;
end;
[/code]

Implementation
[code=delphi]procedure TPGNetObjects.OnReceive(const aHost: TPGString; aPort: Integer; aData: Pointer; aSize: Integer);

function GetObject(aData: Pointer; aSize: Integer): TPGPersistentObject;
var
stm: TPGMemoryStream;
begin
Result := nil;
if aData = nil then Exit;

stm := TPGMemoryStream.Create;
try
stm.OpenBuffer(aData, aSize);
Result := FPersistence.LoadObject(stm);
finally
PG_FreeAndNil(stm);
end;
end;

var
obj: TPGPersistentObject;
begin
// check if incoming data has a possibly valid persistant object
// signature
if (aData <> nil) and (aSize > FPersistence.ObjIdSize) then
begin
// try to get object instance from incoming stream
obj := GetObject(aData, aSize);

// if we got a valid object then pass it to the event handler
if Assigned(obj) then
begin

// call event handler
OnReceiveObject(aHost, aPort, obj);

// free object
PG_FreeAndNil(obj);
end;
end;
end;

constructor TPGNetObjects.Create;
begin
inherited;
SetReceiveEvent(OnReceive);
FPersistence := TPGPersistence.Create;
end;

destructor TPGNetObjects.Destroy;
begin
PG_FreeAndNil(FPersistence);
inherited;
end;

procedure TPGNetObjects.OnReceiveObject(const aHost: TPGString; aPort: Integer; aObj: TPGPersistentObject);
begin
// handle received objects here, override for your own derived classes
end;[/code]
Very nice

cheers,
Paul