aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/OSUUID.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/OSUUID.cs')
-rw-r--r--OpenSim/Framework/OSUUID.cs114
1 files changed, 0 insertions, 114 deletions
diff --git a/OpenSim/Framework/OSUUID.cs b/OpenSim/Framework/OSUUID.cs
index cb83ff2..e69de29 100644
--- a/OpenSim/Framework/OSUUID.cs
+++ b/OpenSim/Framework/OSUUID.cs
@@ -1,114 +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
28using System;
29using libsecondlife;
30
31namespace OpenSim.Framework
32{
33 [Serializable]
34 public class OSUUID : IComparable
35 {
36 public static readonly OSUUID Zero = new OSUUID();
37 public Guid UUID;
38
39 public OSUUID()
40 {
41 }
42
43 /* Constructors */
44
45 public OSUUID(string s)
46 {
47 if (s == null)
48 UUID = new Guid();
49 else
50 UUID = new Guid(s);
51 }
52
53 public OSUUID(Guid g)
54 {
55 UUID = g;
56 }
57
58 public OSUUID(LLUUID l)
59 {
60 UUID = l.UUID;
61 }
62
63 public OSUUID(ulong u)
64 {
65 UUID = new Guid(0, 0, 0, BitConverter.GetBytes(u));
66 }
67
68 #region IComparable Members
69
70 public int CompareTo(object obj)
71 {
72 if (obj is OSUUID)
73 {
74 OSUUID ID = (OSUUID) obj;
75 return UUID.CompareTo(ID.UUID);
76 }
77
78 throw new ArgumentException("object is not a OSUUID");
79 }
80
81 #endregion
82
83 // out conversion
84 public override string ToString()
85 {
86 return UUID.ToString();
87 }
88
89 public LLUUID ToLLUUID()
90 {
91 return new LLUUID(UUID);
92 }
93
94 // for comparison bits
95 public override int GetHashCode()
96 {
97 return UUID.GetHashCode();
98 }
99
100 public override bool Equals(object o)
101 {
102 if (!(o is LLUUID)) return false;
103
104 OSUUID uuid = (OSUUID) o;
105 return UUID == uuid.UUID;
106 }
107
108 // Static methods
109 public static OSUUID Random()
110 {
111 return new OSUUID(Guid.NewGuid());
112 }
113 }
114} \ No newline at end of file