aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
diff options
context:
space:
mode:
authorHomer Horwitz2008-09-28 12:44:49 +0000
committerHomer Horwitz2008-09-28 12:44:49 +0000
commit4452121227f4252c4e13f032ab9e05119c594045 (patch)
tree4fc0b769f9231ab49f0c44077cff70a2663f486b /OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
parentUpdate svn properties. Minor formatting cleanup. Fix a compiler warning. F... (diff)
downloadopensim-SC_OLD-4452121227f4252c4e13f032ab9e05119c594045.zip
opensim-SC_OLD-4452121227f4252c4e13f032ab9e05119c594045.tar.gz
opensim-SC_OLD-4452121227f4252c4e13f032ab9e05119c594045.tar.bz2
opensim-SC_OLD-4452121227f4252c4e13f032ab9e05119c594045.tar.xz
Refactor to avoid some duplicate code.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs47
1 files changed, 19 insertions, 28 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
index 35a7fcc..41a03d9 100644
--- a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
@@ -36,23 +36,27 @@ namespace OpenSim.Region.Environment
36 { 36 {
37 private EventQueueHelper() {} // no construction possible, it's an utility class 37 private EventQueueHelper() {} // no construction possible, it's an utility class
38 38
39 private static byte[] regionHandleToByteArray(ulong regionHandle)
40 {
41 // Reverse endianness of RegionHandle
42 return new byte[]
43 {
44 (byte)((regionHandle >> 56) % 256),
45 (byte)((regionHandle >> 48) % 256),
46 (byte)((regionHandle >> 40) % 256),
47 (byte)((regionHandle >> 32) % 256),
48 (byte)((regionHandle >> 24) % 256),
49 (byte)((regionHandle >> 16) % 256),
50 (byte)((regionHandle >> 8) % 256),
51 (byte)(regionHandle % 256)
52 };
53 }
54
39 public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint) 55 public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint)
40 { 56 {
41 LLSDMap llsdSimInfo = new LLSDMap(3); 57 LLSDMap llsdSimInfo = new LLSDMap(3);
42 byte[] regionhandle = new byte[8];
43 int i = 0;
44 58
45 // Reverse endianness of RegionHandle 59 llsdSimInfo.Add("Handle", new LLSDBinary(regionHandleToByteArray(Handle)));
46 regionhandle[i++] = (byte)((Handle >> 56) % 256);
47 regionhandle[i++] = (byte)((Handle >> 48) % 256);
48 regionhandle[i++] = (byte)((Handle >> 40) % 256);
49 regionhandle[i++] = (byte)((Handle >> 32) % 256);
50 regionhandle[i++] = (byte)((Handle >> 24) % 256);
51 regionhandle[i++] = (byte)((Handle >> 16) % 256);
52 regionhandle[i++] = (byte)((Handle >> 8) % 256);
53 regionhandle[i++] = (byte)(Handle % 256);
54
55 llsdSimInfo.Add("Handle", new LLSDBinary(regionhandle));
56 llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes())); 60 llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes()));
57 llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port)); 61 llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port));
58 62
@@ -68,6 +72,7 @@ namespace OpenSim.Region.Environment
68 72
69 return llsdMessage; 73 return llsdMessage;
70 } 74 }
75
71 public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt, 76 public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt,
72 IPEndPoint newRegionExternalEndPoint, 77 IPEndPoint newRegionExternalEndPoint,
73 string capsURL, UUID AgentID, UUID SessionID) 78 string capsURL, UUID AgentID, UUID SessionID)
@@ -97,21 +102,7 @@ namespace OpenSim.Region.Environment
97 AgentDataArr.Add(AgentDataMap); 102 AgentDataArr.Add(AgentDataMap);
98 103
99 LLSDMap RegionDataMap = new LLSDMap(4); 104 LLSDMap RegionDataMap = new LLSDMap(4);
100 byte[] regionhandle = new byte[8]; 105 RegionDataMap.Add("RegionHandle", LLSD.FromBinary(regionHandleToByteArray(Handle)));
101
102 {
103 int i = 0;
104 regionhandle[i++] = (byte)((Handle >> 56) % 256);
105 regionhandle[i++] = (byte)((Handle >> 48) % 256);
106 regionhandle[i++] = (byte)((Handle >> 40) % 256);
107 regionhandle[i++] = (byte)((Handle >> 32) % 256);
108 regionhandle[i++] = (byte)((Handle >> 24) % 256);
109 regionhandle[i++] = (byte)((Handle >> 16) % 256);
110 regionhandle[i++] = (byte)((Handle >> 8) % 256);
111 regionhandle[i++] = (byte)(Handle % 256);
112 }
113
114 RegionDataMap.Add("RegionHandle", LLSD.FromBinary(regionhandle));
115 RegionDataMap.Add("SeedCapability", LLSD.FromString(capsURL)); 106 RegionDataMap.Add("SeedCapability", LLSD.FromString(capsURL));
116 RegionDataMap.Add("SimIP", LLSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); 107 RegionDataMap.Add("SimIP", LLSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
117 RegionDataMap.Add("SimPort", LLSD.FromInteger(newRegionExternalEndPoint.Port)); 108 RegionDataMap.Add("SimPort", LLSD.FromInteger(newRegionExternalEndPoint.Port));