aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General/RegionHandle.cs
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/General/RegionHandle.cs
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/General/RegionHandle.cs33
1 files changed, 17 insertions, 16 deletions
diff --git a/OpenSim/Framework/General/RegionHandle.cs b/OpenSim/Framework/General/RegionHandle.cs
index d800e57..807a17c 100644
--- a/OpenSim/Framework/General/RegionHandle.cs
+++ b/OpenSim/Framework/General/RegionHandle.cs
@@ -28,13 +28,14 @@
28 28
29using System; 29using System;
30using System.Net; 30using System.Net;
31using System.Net.Sockets;
31 32
32namespace OpenSim.Framework 33namespace OpenSim.Framework
33{ 34{
34 /// <summary> 35 /// <summary>
35 /// A class for manipulating RegionHandle coordinates 36 /// A class for manipulating RegionHandle coordinates
36 /// </summary> 37 /// </summary>
37 class RegionHandle 38 internal class RegionHandle
38 { 39 {
39 private UInt64 handle; 40 private UInt64 handle;
40 41
@@ -48,28 +49,28 @@ namespace OpenSim.Framework
48 { 49 {
49 IPAddress addr = IPAddress.Parse(ip); 50 IPAddress addr = IPAddress.Parse(ip);
50 51
51 if (addr.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork) 52 if (addr.AddressFamily != AddressFamily.InterNetwork)
52 throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address"); 53 throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address");
53 54
54 uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0); 55 uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0);
55 56
56 // Split the IP address in half 57 // Split the IP address in half
57 short a = (short)((baseHandle << 16) & 0xFFFF); 58 short a = (short) ((baseHandle << 16) & 0xFFFF);
58 short b = (short)((baseHandle << 0) & 0xFFFF); 59 short b = (short) ((baseHandle << 0) & 0xFFFF);
59 60
60 // Raise the bounds a little 61 // Raise the bounds a little
61 uint nx = (uint)x; 62 uint nx = (uint) x;
62 uint ny = (uint)y; 63 uint ny = (uint) y;
63 64
64 // Multiply grid coords to get region coords 65 // Multiply grid coords to get region coords
65 nx *= 256; 66 nx *= 256;
66 ny *= 256; 67 ny *= 256;
67 68
68 // Stuff the IP address in too 69 // Stuff the IP address in too
69 nx = (uint)a << 16; 70 nx = (uint) a << 16;
70 ny = (uint)b << 16; 71 ny = (uint) b << 16;
71 72
72 handle = ((UInt64)nx << 32) | (uint)ny; 73 handle = ((UInt64) nx << 32) | (uint) ny;
73 } 74 }
74 75
75 /// <summary> 76 /// <summary>
@@ -79,7 +80,7 @@ namespace OpenSim.Framework
79 /// <param name="y">Grid Y Coordinate</param> 80 /// <param name="y">Grid Y Coordinate</param>
80 public RegionHandle(uint x, uint y) 81 public RegionHandle(uint x, uint y)
81 { 82 {
82 handle = ((x * 256) << 32) | (y * 256); 83 handle = ((x*256) << 32) | (y*256);
83 } 84 }
84 85
85 /// <summary> 86 /// <summary>
@@ -118,10 +119,10 @@ namespace OpenSim.Framework
118 /// <returns>Grid Server IP Address</returns> 119 /// <returns>Grid Server IP Address</returns>
119 public IPAddress getGridIP() 120 public IPAddress getGridIP()
120 { 121 {
121 uint a = (uint)((handle >> 16) & 0xFFFF); 122 uint a = (uint) ((handle >> 16) & 0xFFFF);
122 uint b = (uint)((handle >> 48) & 0xFFFF); 123 uint b = (uint) ((handle >> 48) & 0xFFFF);
123 124
124 return new IPAddress((long)(a << 16) | (long)b); 125 return new IPAddress((long) (a << 16) | (long) b);
125 } 126 }
126 127
127 /// <summary> 128 /// <summary>
@@ -130,7 +131,7 @@ namespace OpenSim.Framework
130 /// <returns>X Coordinate</returns> 131 /// <returns>X Coordinate</returns>
131 public uint getGridX() 132 public uint getGridX()
132 { 133 {
133 uint x = (uint)((handle >> 32) & 0xFFFF); 134 uint x = (uint) ((handle >> 32) & 0xFFFF);
134 135
135 return x; 136 return x;
136 } 137 }
@@ -141,9 +142,9 @@ namespace OpenSim.Framework
141 /// <returns>Y Coordinate</returns> 142 /// <returns>Y Coordinate</returns>
142 public uint getGridY() 143 public uint getGridY()
143 { 144 {
144 uint y = (uint)((handle >> 0) & 0xFFFF); 145 uint y = (uint) ((handle >> 0) & 0xFFFF);
145 146
146 return y; 147 return y;
147 } 148 }
148 } 149 }
149} 150} \ No newline at end of file