aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General/UUID.cs
diff options
context:
space:
mode:
authorJeff Ames2007-10-31 01:21:04 +0000
committerJeff Ames2007-10-31 01:21:04 +0000
commit98b238cf6b75e9d26cf8f423decfbfd9df36b438 (patch)
tree553a190fec2f6e7492dd28129326929e3dbb3e15 /OpenSim/Framework/General/UUID.cs
parentTevarus' patch for object flags & implemented Phantom edits (diff)
downloadopensim-SC_OLD-98b238cf6b75e9d26cf8f423decfbfd9df36b438.zip
opensim-SC_OLD-98b238cf6b75e9d26cf8f423decfbfd9df36b438.tar.gz
opensim-SC_OLD-98b238cf6b75e9d26cf8f423decfbfd9df36b438.tar.bz2
opensim-SC_OLD-98b238cf6b75e9d26cf8f423decfbfd9df36b438.tar.xz
set svn:eol-style
Diffstat (limited to 'OpenSim/Framework/General/UUID.cs')
-rw-r--r--OpenSim/Framework/General/UUID.cs308
1 files changed, 154 insertions, 154 deletions
diff --git a/OpenSim/Framework/General/UUID.cs b/OpenSim/Framework/General/UUID.cs
index f27cd6c..3b292b1 100644
--- a/OpenSim/Framework/General/UUID.cs
+++ b/OpenSim/Framework/General/UUID.cs
@@ -1,155 +1,155 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using libsecondlife; 30using libsecondlife;
31 31
32namespace OpenSim.Framework 32namespace OpenSim.Framework
33{ 33{
34 internal class UUID 34 internal class UUID
35 { 35 {
36 public LLUUID llUUID; 36 public LLUUID llUUID;
37 37
38 public UUID(string uuid) 38 public UUID(string uuid)
39 { 39 {
40 llUUID = new LLUUID(uuid); 40 llUUID = new LLUUID(uuid);
41 } 41 }
42 42
43 public UUID(byte[] uuid) 43 public UUID(byte[] uuid)
44 { 44 {
45 llUUID = new LLUUID(uuid, 0); 45 llUUID = new LLUUID(uuid, 0);
46 } 46 }
47 47
48 public UUID(byte[] uuid, int offset) 48 public UUID(byte[] uuid, int offset)
49 { 49 {
50 llUUID = new LLUUID(uuid, offset); 50 llUUID = new LLUUID(uuid, offset);
51 } 51 }
52 52
53 public UUID() 53 public UUID()
54 { 54 {
55 llUUID = LLUUID.Zero; 55 llUUID = LLUUID.Zero;
56 } 56 }
57 57
58 public UUID(ulong uuid) 58 public UUID(ulong uuid)
59 { 59 {
60 llUUID = new LLUUID(uuid); 60 llUUID = new LLUUID(uuid);
61 } 61 }
62 62
63 public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth) 63 public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth)
64 { 64 {
65 byte[] uuid = new byte[16]; 65 byte[] uuid = new byte[16];
66 66
67 byte[] n = BitConverter.GetBytes(first); 67 byte[] n = BitConverter.GetBytes(first);
68 n.CopyTo(uuid, 0); 68 n.CopyTo(uuid, 0);
69 n = BitConverter.GetBytes(second); 69 n = BitConverter.GetBytes(second);
70 n.CopyTo(uuid, 4); 70 n.CopyTo(uuid, 4);
71 n = BitConverter.GetBytes(third); 71 n = BitConverter.GetBytes(third);
72 n.CopyTo(uuid, 8); 72 n.CopyTo(uuid, 8);
73 n = BitConverter.GetBytes(fourth); 73 n = BitConverter.GetBytes(fourth);
74 n.CopyTo(uuid, 12); 74 n.CopyTo(uuid, 12);
75 75
76 llUUID = new LLUUID(uuid, 0); 76 llUUID = new LLUUID(uuid, 0);
77 } 77 }
78 78
79 public override string ToString() 79 public override string ToString()
80 { 80 {
81 return llUUID.ToString(); 81 return llUUID.ToString();
82 } 82 }
83 83
84 public string ToStringHyphenated() 84 public string ToStringHyphenated()
85 { 85 {
86 return llUUID.ToStringHyphenated(); 86 return llUUID.ToStringHyphenated();
87 } 87 }
88 88
89 public byte[] GetBytes() 89 public byte[] GetBytes()
90 { 90 {
91 return llUUID.GetBytes(); 91 return llUUID.GetBytes();
92 } 92 }
93 93
94 public UInt32[] GetInts() 94 public UInt32[] GetInts()
95 { 95 {
96 UInt32[] ints = new UInt32[4]; 96 UInt32[] ints = new UInt32[4];
97 ints[0] = BitConverter.ToUInt32(llUUID.Data, 0); 97 ints[0] = BitConverter.ToUInt32(llUUID.Data, 0);
98 ints[1] = BitConverter.ToUInt32(llUUID.Data, 4); 98 ints[1] = BitConverter.ToUInt32(llUUID.Data, 4);
99 ints[2] = BitConverter.ToUInt32(llUUID.Data, 8); 99 ints[2] = BitConverter.ToUInt32(llUUID.Data, 8);
100 ints[3] = BitConverter.ToUInt32(llUUID.Data, 12); 100 ints[3] = BitConverter.ToUInt32(llUUID.Data, 12);
101 101
102 return ints; 102 return ints;
103 } 103 }
104 104
105 public LLUUID GetLLUUID() 105 public LLUUID GetLLUUID()
106 { 106 {
107 return llUUID; 107 return llUUID;
108 } 108 }
109 109
110 public uint CRC() 110 public uint CRC()
111 { 111 {
112 return llUUID.CRC(); 112 return llUUID.CRC();
113 } 113 }
114 114
115 public override int GetHashCode() 115 public override int GetHashCode()
116 { 116 {
117 return llUUID.GetHashCode(); 117 return llUUID.GetHashCode();
118 } 118 }
119 119
120 public void Combine(UUID other) 120 public void Combine(UUID other)
121 { 121 {
122 llUUID.Combine(other.GetLLUUID()); 122 llUUID.Combine(other.GetLLUUID());
123 } 123 }
124 124
125 public void Combine(LLUUID other) 125 public void Combine(LLUUID other)
126 { 126 {
127 llUUID.Combine(other); 127 llUUID.Combine(other);
128 } 128 }
129 129
130 public override bool Equals(Object other) 130 public override bool Equals(Object other)
131 { 131 {
132 return llUUID.Equals(other); 132 return llUUID.Equals(other);
133 } 133 }
134 134
135 public static bool operator ==(UUID a, UUID b) 135 public static bool operator ==(UUID a, UUID b)
136 { 136 {
137 return a.llUUID.Equals(b.GetLLUUID()); 137 return a.llUUID.Equals(b.GetLLUUID());
138 } 138 }
139 139
140 public static bool operator !=(UUID a, UUID b) 140 public static bool operator !=(UUID a, UUID b)
141 { 141 {
142 return !a.llUUID.Equals(b.GetLLUUID()); 142 return !a.llUUID.Equals(b.GetLLUUID());
143 } 143 }
144 144
145 public static bool operator ==(UUID a, LLUUID b) 145 public static bool operator ==(UUID a, LLUUID b)
146 { 146 {
147 return a.Equals(b); 147 return a.Equals(b);
148 } 148 }
149 149
150 public static bool operator !=(UUID a, LLUUID b) 150 public static bool operator !=(UUID a, LLUUID b)
151 { 151 {
152 return !a.Equals(b); 152 return !a.Equals(b);
153 } 153 }
154 } 154 }
155} \ No newline at end of file 155} \ No newline at end of file