Annotation of /trunk/ModularRex/RexNetwork/ClientViews/NaaliClientView.cs
Parent Directory
|
Revision Log
Revision 243 - (view) (download)
| 1 : | mikkopa | 170 | using System; |
| 2 : | using System.Collections.Generic; | ||
| 3 : | using System.Text; | ||
| 4 : | using OpenMetaverse; | ||
| 5 : | using ModularRex.RexFramework; | ||
| 6 : | using System.Net; | ||
| 7 : | using OpenSim.Framework; | ||
| 8 : | using OpenSim.Region.ClientStack.LindenUDP; | ||
| 9 : | using OpenSim.Region.ClientStack; | ||
| 10 : | mikkopa | 173 | using OpenMetaverse.Packets; |
| 11 : | mikkopa | 243 | using OpenSim.Region.Framework.Scenes; |
| 12 : | mikkopa | 170 | |
| 13 : | namespace ModularRex.RexNetwork | ||
| 14 : | { | ||
| 15 : | mikkopa | 211 | /// <summary> |
| 16 : | /// This client view is ment for realXtend Naali. This may not be compatible with LL client nor older realXtend clients. | ||
| 17 : | /// </summary> | ||
| 18 : | mikkopa | 209 | public class NaaliClientView : RexClientViewBase |
| 19 : | mikkopa | 170 | { |
| 20 : | mikkopa | 243 | public NaaliClientView(EndPoint remoteEP, Scene scene, |
| 21 : | LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse authenSessions, UUID agentId, | ||
| 22 : | UUID sessionId, uint circuitCode) | ||
| 23 : | : base(remoteEP, scene, udpServer, udpClient, authenSessions, agentId, | ||
| 24 : | sessionId, circuitCode) | ||
| 25 : | mikkopa | 170 | { |
| 26 : | mikkopa | 173 | OnBinaryGenericMessage -= base.RexClientView_BinaryGenericMessage; |
| 27 : | OnBinaryGenericMessage += ng_BinaryGenericMessage; | ||
| 28 : | mikkopa | 170 | } |
| 29 : | |||
| 30 : | mikkopa | 173 | protected void ng_BinaryGenericMessage(Object sender, string method, byte[][] args) |
| 31 : | { | ||
| 32 : | if (method.ToLower() == "RexPrimData".ToLower()) | ||
| 33 : | { | ||
| 34 : | HandleRexPrimData(args); | ||
| 35 : | return; | ||
| 36 : | } | ||
| 37 : | } | ||
| 38 : | |||
| 39 : | private void HandleRexPrimData(byte[][] args) | ||
| 40 : | { | ||
| 41 : | int rpdLen = 0; | ||
| 42 : | int idx = 0; | ||
| 43 : | bool first = false; | ||
| 44 : | UUID id = UUID.Zero; | ||
| 45 : | |||
| 46 : | foreach (byte[] arg in args) | ||
| 47 : | { | ||
| 48 : | if (!first) | ||
| 49 : | { | ||
| 50 : | id = new UUID(Util.FieldToString(arg)); | ||
| 51 : | first = true; | ||
| 52 : | continue; | ||
| 53 : | } | ||
| 54 : | |||
| 55 : | rpdLen += arg.Length; | ||
| 56 : | } | ||
| 57 : | |||
| 58 : | first = false; | ||
| 59 : | byte[] rpdArray = new byte[rpdLen]; | ||
| 60 : | |||
| 61 : | foreach (byte[] arg in args) | ||
| 62 : | { | ||
| 63 : | if (!first) | ||
| 64 : | { | ||
| 65 : | first = true; | ||
| 66 : | continue; | ||
| 67 : | } | ||
| 68 : | |||
| 69 : | arg.CopyTo(rpdArray, idx); | ||
| 70 : | idx += arg.Length; | ||
| 71 : | } | ||
| 72 : | |||
| 73 : | TriggerOnRexObjectProperties(this, id, new RexObjectProperties(rpdArray, true)); | ||
| 74 : | } | ||
| 75 : | |||
| 76 : | mikkopa | 170 | public override void SendRexObjectProperties(UUID id, RexObjectProperties x) |
| 77 : | { | ||
| 78 : | mikkopa | 173 | GenericMessagePacket gmp = new GenericMessagePacket(); |
| 79 : | gmp.MethodData.Method = Utils.StringToBytes("RexPrimData"); | ||
| 80 : | |||
| 81 : | byte[] temprexprimdata = x.GetRexPrimDataToBytes(true); //send urls to ng-clients | ||
| 82 : | int numlines = 0; | ||
| 83 : | int i = 0; | ||
| 84 : | |||
| 85 : | if (temprexprimdata != null) | ||
| 86 : | { | ||
| 87 : | while (i <= temprexprimdata.Length) | ||
| 88 : | { | ||
| 89 : | numlines++; | ||
| 90 : | i += 200; | ||
| 91 : | } | ||
| 92 : | } | ||
| 93 : | |||
| 94 : | gmp.ParamList = new GenericMessagePacket.ParamListBlock[1 + numlines]; | ||
| 95 : | gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock(); | ||
| 96 : | gmp.ParamList[0].Parameter = Utils.StringToBytes(id.ToString()); | ||
| 97 : | |||
| 98 : | for (i = 0; i < numlines; i++) | ||
| 99 : | { | ||
| 100 : | gmp.ParamList[i + 1] = new GenericMessagePacket.ParamListBlock(); | ||
| 101 : | |||
| 102 : | if ((temprexprimdata.Length - i * 200) < 200) | ||
| 103 : | { | ||
| 104 : | gmp.ParamList[i + 1].Parameter = new byte[temprexprimdata.Length - i * 200]; | ||
| 105 : | Buffer.BlockCopy(temprexprimdata, i * 200, gmp.ParamList[i + 1].Parameter, 0, temprexprimdata.Length - i * 200); | ||
| 106 : | } | ||
| 107 : | else | ||
| 108 : | { | ||
| 109 : | gmp.ParamList[i + 1].Parameter = new byte[200]; | ||
| 110 : | Buffer.BlockCopy(temprexprimdata, i * 200, gmp.ParamList[i + 1].Parameter, 0, 200); | ||
| 111 : | } | ||
| 112 : | } | ||
| 113 : | |||
| 114 : | OutPacket(gmp, ThrottleOutPacketType.Task); | ||
| 115 : | mikkopa | 170 | } |
| 116 : | } | ||
| 117 : | } |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

