diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Framework/General/Types/UUID.cs | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Framework/General/Types/UUID.cs')
-rw-r--r-- | OpenSim/Framework/General/Types/UUID.cs | 254 |
1 files changed, 127 insertions, 127 deletions
diff --git a/OpenSim/Framework/General/Types/UUID.cs b/OpenSim/Framework/General/Types/UUID.cs index 9cde18e..9e9654d 100644 --- a/OpenSim/Framework/General/Types/UUID.cs +++ b/OpenSim/Framework/General/Types/UUID.cs | |||
@@ -1,127 +1,127 @@ | |||
1 | using System; | 1 | using System; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | 3 | ||
4 | namespace OpenSim.Framework.Types | 4 | namespace OpenSim.Framework.Types |
5 | { | 5 | { |
6 | class UUID | 6 | class UUID |
7 | { | 7 | { |
8 | public LLUUID llUUID; | 8 | public LLUUID llUUID; |
9 | 9 | ||
10 | public UUID(string uuid) | 10 | public UUID(string uuid) |
11 | { | 11 | { |
12 | llUUID = new LLUUID(uuid); | 12 | llUUID = new LLUUID(uuid); |
13 | } | 13 | } |
14 | 14 | ||
15 | public UUID(byte[] uuid) | 15 | public UUID(byte[] uuid) |
16 | { | 16 | { |
17 | llUUID = new LLUUID(uuid, 0); | 17 | llUUID = new LLUUID(uuid, 0); |
18 | } | 18 | } |
19 | 19 | ||
20 | public UUID(byte[] uuid, int offset) | 20 | public UUID(byte[] uuid, int offset) |
21 | { | 21 | { |
22 | llUUID = new LLUUID(uuid, offset); | 22 | llUUID = new LLUUID(uuid, offset); |
23 | } | 23 | } |
24 | 24 | ||
25 | public UUID() | 25 | public UUID() |
26 | { | 26 | { |
27 | llUUID = LLUUID.Zero; | 27 | llUUID = LLUUID.Zero; |
28 | } | 28 | } |
29 | 29 | ||
30 | public UUID(ulong uuid) | 30 | public UUID(ulong uuid) |
31 | { | 31 | { |
32 | llUUID = new LLUUID(uuid); | 32 | llUUID = new LLUUID(uuid); |
33 | } | 33 | } |
34 | 34 | ||
35 | public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth) | 35 | public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth) |
36 | { | 36 | { |
37 | byte[] uuid = new byte[16]; | 37 | byte[] uuid = new byte[16]; |
38 | 38 | ||
39 | byte[] n = BitConverter.GetBytes(first); | 39 | byte[] n = BitConverter.GetBytes(first); |
40 | n.CopyTo(uuid, 0); | 40 | n.CopyTo(uuid, 0); |
41 | n = BitConverter.GetBytes(second); | 41 | n = BitConverter.GetBytes(second); |
42 | n.CopyTo(uuid, 4); | 42 | n.CopyTo(uuid, 4); |
43 | n = BitConverter.GetBytes(third); | 43 | n = BitConverter.GetBytes(third); |
44 | n.CopyTo(uuid, 8); | 44 | n.CopyTo(uuid, 8); |
45 | n = BitConverter.GetBytes(fourth); | 45 | n = BitConverter.GetBytes(fourth); |
46 | n.CopyTo(uuid, 12); | 46 | n.CopyTo(uuid, 12); |
47 | 47 | ||
48 | llUUID = new LLUUID(uuid,0); | 48 | llUUID = new LLUUID(uuid,0); |
49 | } | 49 | } |
50 | 50 | ||
51 | public override string ToString() | 51 | public override string ToString() |
52 | { | 52 | { |
53 | return llUUID.ToString(); | 53 | return llUUID.ToString(); |
54 | } | 54 | } |
55 | 55 | ||
56 | public string ToStringHyphenated() | 56 | public string ToStringHyphenated() |
57 | { | 57 | { |
58 | return llUUID.ToStringHyphenated(); | 58 | return llUUID.ToStringHyphenated(); |
59 | } | 59 | } |
60 | 60 | ||
61 | public byte[] GetBytes() | 61 | public byte[] GetBytes() |
62 | { | 62 | { |
63 | return llUUID.GetBytes(); | 63 | return llUUID.GetBytes(); |
64 | } | 64 | } |
65 | 65 | ||
66 | public UInt32[] GetInts() | 66 | public UInt32[] GetInts() |
67 | { | 67 | { |
68 | UInt32[] ints = new UInt32[4]; | 68 | UInt32[] ints = new UInt32[4]; |
69 | ints[0] = BitConverter.ToUInt32(llUUID.Data, 0); | 69 | ints[0] = BitConverter.ToUInt32(llUUID.Data, 0); |
70 | ints[1] = BitConverter.ToUInt32(llUUID.Data, 4); | 70 | ints[1] = BitConverter.ToUInt32(llUUID.Data, 4); |
71 | ints[2] = BitConverter.ToUInt32(llUUID.Data, 8); | 71 | ints[2] = BitConverter.ToUInt32(llUUID.Data, 8); |
72 | ints[3] = BitConverter.ToUInt32(llUUID.Data, 12); | 72 | ints[3] = BitConverter.ToUInt32(llUUID.Data, 12); |
73 | 73 | ||
74 | return ints; | 74 | return ints; |
75 | } | 75 | } |
76 | 76 | ||
77 | public LLUUID GetLLUUID() | 77 | public LLUUID GetLLUUID() |
78 | { | 78 | { |
79 | return llUUID; | 79 | return llUUID; |
80 | } | 80 | } |
81 | 81 | ||
82 | public uint CRC() | 82 | public uint CRC() |
83 | { | 83 | { |
84 | return llUUID.CRC(); | 84 | return llUUID.CRC(); |
85 | } | 85 | } |
86 | 86 | ||
87 | public override int GetHashCode() | 87 | public override int GetHashCode() |
88 | { | 88 | { |
89 | return llUUID.GetHashCode(); | 89 | return llUUID.GetHashCode(); |
90 | } | 90 | } |
91 | 91 | ||
92 | public void Combine(UUID other) | 92 | public void Combine(UUID other) |
93 | { | 93 | { |
94 | llUUID.Combine(other.GetLLUUID()); | 94 | llUUID.Combine(other.GetLLUUID()); |
95 | } | 95 | } |
96 | 96 | ||
97 | public void Combine(LLUUID other) | 97 | public void Combine(LLUUID other) |
98 | { | 98 | { |
99 | llUUID.Combine(other); | 99 | llUUID.Combine(other); |
100 | } | 100 | } |
101 | 101 | ||
102 | public override bool Equals(Object other) | 102 | public override bool Equals(Object other) |
103 | { | 103 | { |
104 | return llUUID.Equals(other); | 104 | return llUUID.Equals(other); |
105 | } | 105 | } |
106 | 106 | ||
107 | public static bool operator ==(UUID a, UUID b) | 107 | public static bool operator ==(UUID a, UUID b) |
108 | { | 108 | { |
109 | return a.llUUID.Equals(b.GetLLUUID()); | 109 | return a.llUUID.Equals(b.GetLLUUID()); |
110 | } | 110 | } |
111 | 111 | ||
112 | public static bool operator !=(UUID a, UUID b) | 112 | public static bool operator !=(UUID a, UUID b) |
113 | { | 113 | { |
114 | return !a.llUUID.Equals(b.GetLLUUID()); | 114 | return !a.llUUID.Equals(b.GetLLUUID()); |
115 | } | 115 | } |
116 | 116 | ||
117 | public static bool operator ==(UUID a, LLUUID b) | 117 | public static bool operator ==(UUID a, LLUUID b) |
118 | { | 118 | { |
119 | return a.Equals(b); | 119 | return a.Equals(b); |
120 | } | 120 | } |
121 | 121 | ||
122 | public static bool operator !=(UUID a, LLUUID b) | 122 | public static bool operator !=(UUID a, LLUUID b) |
123 | { | 123 | { |
124 | return !a.Equals(b); | 124 | return !a.Equals(b); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | } | 127 | } |