| 7 |
using OpenSim.Framework; |
using OpenSim.Framework; |
| 8 |
using OpenSim.Region.ClientStack.LindenUDP; |
using OpenSim.Region.ClientStack.LindenUDP; |
| 9 |
using OpenSim.Region.ClientStack; |
using OpenSim.Region.ClientStack; |
| 10 |
|
using OpenMetaverse.Packets; |
| 11 |
|
|
| 12 |
namespace ModularRex.RexNetwork |
namespace ModularRex.RexNetwork |
| 13 |
{ |
{ |
| 20 |
: base(remoteEP, scene, assetCache, packServer, authenSessions, agentId, |
: base(remoteEP, scene, assetCache, packServer, authenSessions, agentId, |
| 21 |
sessionId, circuitCode, proxyEP, userSettings) |
sessionId, circuitCode, proxyEP, userSettings) |
| 22 |
{ |
{ |
| 23 |
|
OnBinaryGenericMessage -= base.RexClientView_BinaryGenericMessage; |
| 24 |
|
OnBinaryGenericMessage += ng_BinaryGenericMessage; |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
protected void ng_BinaryGenericMessage(Object sender, string method, byte[][] args) |
| 28 |
|
{ |
| 29 |
|
if (method.ToLower() == "RexPrimData".ToLower()) |
| 30 |
|
{ |
| 31 |
|
HandleRexPrimData(args); |
| 32 |
|
return; |
| 33 |
|
} |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
private void HandleRexPrimData(byte[][] args) |
| 37 |
|
{ |
| 38 |
|
int rpdLen = 0; |
| 39 |
|
int idx = 0; |
| 40 |
|
bool first = false; |
| 41 |
|
UUID id = UUID.Zero; |
| 42 |
|
|
| 43 |
|
foreach (byte[] arg in args) |
| 44 |
|
{ |
| 45 |
|
if (!first) |
| 46 |
|
{ |
| 47 |
|
id = new UUID(Util.FieldToString(arg)); |
| 48 |
|
first = true; |
| 49 |
|
continue; |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
rpdLen += arg.Length; |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
first = false; |
| 56 |
|
byte[] rpdArray = new byte[rpdLen]; |
| 57 |
|
|
| 58 |
|
foreach (byte[] arg in args) |
| 59 |
|
{ |
| 60 |
|
if (!first) |
| 61 |
|
{ |
| 62 |
|
first = true; |
| 63 |
|
continue; |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
arg.CopyTo(rpdArray, idx); |
| 67 |
|
idx += arg.Length; |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
TriggerOnRexObjectProperties(this, id, new RexObjectProperties(rpdArray, true)); |
| 71 |
} |
} |
| 72 |
|
|
| 73 |
public override void SendRexObjectProperties(UUID id, RexObjectProperties x) |
public override void SendRexObjectProperties(UUID id, RexObjectProperties x) |
| 74 |
{ |
{ |
| 75 |
//TODO: implement |
GenericMessagePacket gmp = new GenericMessagePacket(); |
| 76 |
|
gmp.MethodData.Method = Utils.StringToBytes("RexPrimData"); |
| 77 |
|
|
| 78 |
|
byte[] temprexprimdata = x.GetRexPrimDataToBytes(true); //send urls to ng-clients |
| 79 |
|
int numlines = 0; |
| 80 |
|
int i = 0; |
| 81 |
|
|
| 82 |
|
if (temprexprimdata != null) |
| 83 |
|
{ |
| 84 |
|
while (i <= temprexprimdata.Length) |
| 85 |
|
{ |
| 86 |
|
numlines++; |
| 87 |
|
i += 200; |
| 88 |
|
} |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
gmp.ParamList = new GenericMessagePacket.ParamListBlock[1 + numlines]; |
| 92 |
|
gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock(); |
| 93 |
|
gmp.ParamList[0].Parameter = Utils.StringToBytes(id.ToString()); |
| 94 |
|
|
| 95 |
|
for (i = 0; i < numlines; i++) |
| 96 |
|
{ |
| 97 |
|
gmp.ParamList[i + 1] = new GenericMessagePacket.ParamListBlock(); |
| 98 |
|
|
| 99 |
|
if ((temprexprimdata.Length - i * 200) < 200) |
| 100 |
|
{ |
| 101 |
|
gmp.ParamList[i + 1].Parameter = new byte[temprexprimdata.Length - i * 200]; |
| 102 |
|
Buffer.BlockCopy(temprexprimdata, i * 200, gmp.ParamList[i + 1].Parameter, 0, temprexprimdata.Length - i * 200); |
| 103 |
|
} |
| 104 |
|
else |
| 105 |
|
{ |
| 106 |
|
gmp.ParamList[i + 1].Parameter = new byte[200]; |
| 107 |
|
Buffer.BlockCopy(temprexprimdata, i * 200, gmp.ParamList[i + 1].Parameter, 0, 200); |
| 108 |
|
} |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
OutPacket(gmp, ThrottleOutPacketType.Task); |
| 112 |
} |
} |
| 113 |
} |
} |
| 114 |
} |
} |