LLUUID myAgentID, uint parentEstateID, LLUUID regionID, LLVector3 position, byte offline,
byte dialog, LLUUID id, uint timestamp, string myAgentName, string message,
byte[] binaryBucket)
{
LLUUID myAgentID, uint parentEstateID, LLUUID regionID, LLVector3 position, byte offline,
byte dialog, LLUUID id, uint timestamp, string myAgentName, string message,
byte[] binaryBucket)
{
Christopher,> One thing though: if we do go with the former, what happens when there are two fields with the same name in different blocks?
Christopher, that's a good point. There's no obvious clean way to do that though there's various less clean ways. To what extent does this situation arise?
If this is something that arises significantly maybe the second option is better?On 7/16/06, Christopher Omega < [EMAIL PROTECTED]> wrote:I personally would graitate to the former. Not needing to know what block a particular field belongs to seems to me more like a good thing. One thing though: if we do go with the former, what happens when there are two fields with the same name in different blocks?
On 7/15/06, Hugh Perkins < [EMAIL PROTECTED]> wrote:In avatar.cs, we can see for example:Hashtable blocks = new Hashtable();
Hashtable fields = new Hashtable();
fields["RegionHandle"] = regionHandle;
fields["LookAt"] = lookAt;
fields["Position"] = position;
blocks[fields] = "Info";
fields = new Hashtable();
fields["AgentID"] = Client.Network.AgentID;
fields["SessionID"] = Client.Network.SessionID;
blocks[fields] = "AgentData";
Packet packet = PacketBuilder.BuildPacket("TeleportLocationRequest", Client.Protocol, blocks);It could be nice to handle this in a similar way as we can handle inbound binary calls, in order to make it as easy to read and maintain as possible?Now, it's not quite as easy as inbound because of the issue with blocks, so there are a couple of ways of doing this. I'm wondering if there are any opinions on which one is better?Method 1, using custom attributes:In avatar.cs:TeleportLocationRequest teleportlocationrequest = new TeleportLocationRequest();
teleportlocationrequest.RegionHandle = regionHandle;
teleportlocationrequest.LookAt = lookAt;
teleportlocationrequest.Position = position;
teleportlocationrequest.AgentID = Client.Network.AgentID;
teleportlocationrequest.SessionID = Client.Network.SessionID;
Packet packet = BinaryMarshaller.Marshall( teleportlocationrequest );TeleportLocationRequest looks like this:public class TeleportLocationRequest
{[BlockInfo]
public U64 RegionHandle;
[BlockInfo]
public LLVector3 LookAt = new LLVector3();
[BlockInfo]
public LLVector3 Position = new LLVector3();
[BlockAgentData]
public LLUUID AgentID = new LLUUID();
[BlockAgentData]
public LLUUID SessionID = new LLUUID();
}Pretty easy to do, the attributes are fairly easy to read?
Method 2: use classes for each block
In avatar.cs:TeleportLocationRequest teleportlocationrequest = new TeleportLocationRequest();
teleportlocationrequest.Info.RegionHandle = regionHandle;
teleportlocationrequest.Info.LookAt = lookAt;
teleportlocationrequest.Info.Position = position;
teleportlocationrequest.AgentData.AgentID = Client.Network.AgentID;
teleportlocationrequest.AgentData.SessionID = Client.Network.SessionID;
Packet packet = BinaryMarshaller.Marshall( teleportlocationrequest );Our TeleportLocationRequest looks something like:public class TeleportLocationRequest
{
public class _Info
{
public U64 RegionHandle;
public LLVector3 LookAt = new LLVector3();
public LLVector3 Position = new LLVector3();
}public class _AgentData
{
public LLUUID AgentID = new LLUUID();
public LLUUID SessionID = new LLUUID();
}
public _Info Info = new _Info();
public _AgentData AgentData = new _AgentData();
}... or possibly some other variant on naming, to avoid using underscores.
Again, fairly easy to do, so unclear which is better.
Opinions?
_______________________________________________
libsecondlife-dev mailing list
libsecondlife-dev@gna.org
https://mail.gna.org/listinfo/libsecondlife-dev
--
"Anyone that would give up a little liberty for a little security, deserves neither and loses both." -Ben Franklin_______________________________________________
libsecondlife-dev mailing list
libsecondlife-dev@gna.org
https://mail.gna.org/listinfo/libsecondlife-dev
_______________________________________________ libsecondlife-dev mailing list libsecondlife-dev@gna.org https://mail.gna.org/listinfo/libsecondlife-dev