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