diff options
author | Adam Frisby | 2007-06-29 22:09:52 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-29 22:09:52 +0000 |
commit | e4df6ea08e75294cf47f7f99ea5a3751f9aa0c8e (patch) | |
tree | 51f33a33410fac3811ab464cc4aa60defe1e32a8 | |
parent | * Experimental patch: Replaced IPAddress.Any with IPAddress.Parse("0.0.0.0") ... (diff) | |
download | opensim-SC-e4df6ea08e75294cf47f7f99ea5a3751f9aa0c8e.zip opensim-SC-e4df6ea08e75294cf47f7f99ea5a3751f9aa0c8e.tar.gz opensim-SC-e4df6ea08e75294cf47f7f99ea5a3751f9aa0c8e.tar.bz2 opensim-SC-e4df6ea08e75294cf47f7f99ea5a3751f9aa0c8e.tar.xz |
* Created new "UUID" class to override LLUUID in general. (Unable to inherit from LLUUID, so written as a wrapper + extra functions), 1:1 Feature compatible with LLUUID designed as "Drop In" replacement.
-rw-r--r-- | OpenSim/Framework/General/OpenSim.Framework.csproj | 39 | ||||
-rw-r--r-- | OpenSim/Framework/General/Types/UUID.cs | 129 |
2 files changed, 153 insertions, 15 deletions
diff --git a/OpenSim/Framework/General/OpenSim.Framework.csproj b/OpenSim/Framework/General/OpenSim.Framework.csproj index c12d436..57076a1 100644 --- a/OpenSim/Framework/General/OpenSim.Framework.csproj +++ b/OpenSim/Framework/General/OpenSim.Framework.csproj | |||
@@ -1,4 +1,4 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{8ACA2445-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{8ACA2445-0000-0000-0000-000000000000}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenSim.Framework</AssemblyName> | 13 | <AssemblyName>OpenSim.Framework</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 18 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Framework</RootNamespace> | 21 | <RootNamespace>OpenSim.Framework</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,26 +61,28 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="Db4objects.Db4o.dll" > | 68 | <Reference Include="Db4objects.Db4o.dll"> |
62 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | 69 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="libsecondlife.dll" > | 72 | <Reference Include="libsecondlife.dll"> |
66 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | 73 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> |
67 | <Private>False</Private> | 74 | <Private>False</Private> |
68 | </Reference> | 75 | </Reference> |
69 | <Reference Include="System" > | 76 | <Reference Include="System"> |
70 | <HintPath>System.dll</HintPath> | 77 | <HintPath>System.dll</HintPath> |
71 | <Private>False</Private> | 78 | <Private>False</Private> |
72 | </Reference> | 79 | </Reference> |
73 | <Reference Include="System.Xml" > | 80 | <Reference Include="System.Data" /> |
81 | <Reference Include="System.Xml"> | ||
74 | <HintPath>System.Xml.dll</HintPath> | 82 | <HintPath>System.Xml.dll</HintPath> |
75 | <Private>False</Private> | 83 | <Private>False</Private> |
76 | </Reference> | 84 | </Reference> |
77 | <Reference Include="XMLRPC.dll" > | 85 | <Reference Include="XMLRPC.dll"> |
78 | <HintPath>..\..\..\bin\XMLRPC.dll</HintPath> | 86 | <HintPath>..\..\..\bin\XMLRPC.dll</HintPath> |
79 | <Private>False</Private> | 87 | <Private>False</Private> |
80 | </Reference> | 88 | </Reference> |
@@ -84,7 +92,7 @@ | |||
84 | <Name>OpenSim.Framework.Console</Name> | 92 | <Name>OpenSim.Framework.Console</Name> |
85 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | 93 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> |
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 94 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
87 | <Private>False</Private> | 95 | <Private>False</Private> |
88 | </ProjectReference> | 96 | </ProjectReference> |
89 | </ItemGroup> | 97 | </ItemGroup> |
90 | <ItemGroup> | 98 | <ItemGroup> |
@@ -103,6 +111,7 @@ | |||
103 | <Compile Include="IRegionCommsListener.cs"> | 111 | <Compile Include="IRegionCommsListener.cs"> |
104 | <SubType>Code</SubType> | 112 | <SubType>Code</SubType> |
105 | </Compile> | 113 | </Compile> |
114 | <Compile Include="Types\UUID.cs" /> | ||
106 | <Compile Include="Util.cs"> | 115 | <Compile Include="Util.cs"> |
107 | <SubType>Code</SubType> | 116 | <SubType>Code</SubType> |
108 | </Compile> | 117 | </Compile> |
@@ -198,4 +207,4 @@ | |||
198 | <PostBuildEvent> | 207 | <PostBuildEvent> |
199 | </PostBuildEvent> | 208 | </PostBuildEvent> |
200 | </PropertyGroup> | 209 | </PropertyGroup> |
201 | </Project> | 210 | </Project> \ No newline at end of file |
diff --git a/OpenSim/Framework/General/Types/UUID.cs b/OpenSim/Framework/General/Types/UUID.cs new file mode 100644 index 0000000..8d47c30 --- /dev/null +++ b/OpenSim/Framework/General/Types/UUID.cs | |||
@@ -0,0 +1,129 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Types | ||
7 | { | ||
8 | class UUID | ||
9 | { | ||
10 | public LLUUID llUUID; | ||
11 | |||
12 | public UUID(string uuid) | ||
13 | { | ||
14 | llUUID = new LLUUID(uuid); | ||
15 | } | ||
16 | |||
17 | public UUID(byte[] uuid) | ||
18 | { | ||
19 | llUUID = new LLUUID(uuid, 0); | ||
20 | } | ||
21 | |||
22 | public UUID(byte[] uuid, int offset) | ||
23 | { | ||
24 | llUUID = new LLUUID(uuid, offset); | ||
25 | } | ||
26 | |||
27 | public UUID() | ||
28 | { | ||
29 | llUUID = LLUUID.Zero; | ||
30 | } | ||
31 | |||
32 | public UUID(ulong uuid) | ||
33 | { | ||
34 | llUUID = new LLUUID(uuid); | ||
35 | } | ||
36 | |||
37 | public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth) | ||
38 | { | ||
39 | byte[] uuid = new byte[16]; | ||
40 | |||
41 | byte[] n = BitConverter.GetBytes(first); | ||
42 | n.CopyTo(uuid, 0); | ||
43 | n = BitConverter.GetBytes(second); | ||
44 | n.CopyTo(uuid, 4); | ||
45 | n = BitConverter.GetBytes(third); | ||
46 | n.CopyTo(uuid, 8); | ||
47 | n = BitConverter.GetBytes(fourth); | ||
48 | n.CopyTo(uuid, 12); | ||
49 | |||
50 | llUUID = new LLUUID(uuid,0); | ||
51 | } | ||
52 | |||
53 | public override string ToString() | ||
54 | { | ||
55 | return llUUID.ToString(); | ||
56 | } | ||
57 | |||
58 | public string ToStringHyphenated() | ||
59 | { | ||
60 | return llUUID.ToStringHyphenated(); | ||
61 | } | ||
62 | |||
63 | public byte[] GetBytes() | ||
64 | { | ||
65 | return llUUID.GetBytes(); | ||
66 | } | ||
67 | |||
68 | public UInt32[] GetInts() | ||
69 | { | ||
70 | UInt32[] ints = new UInt32[4]; | ||
71 | ints[0] = BitConverter.ToUInt32(llUUID.Data, 0); | ||
72 | ints[1] = BitConverter.ToUInt32(llUUID.Data, 4); | ||
73 | ints[2] = BitConverter.ToUInt32(llUUID.Data, 8); | ||
74 | ints[3] = BitConverter.ToUInt32(llUUID.Data, 12); | ||
75 | |||
76 | return ints; | ||
77 | } | ||
78 | |||
79 | public LLUUID GetLLUUID() | ||
80 | { | ||
81 | return llUUID; | ||
82 | } | ||
83 | |||
84 | public uint CRC() | ||
85 | { | ||
86 | return llUUID.CRC(); | ||
87 | } | ||
88 | |||
89 | public override int GetHashCode() | ||
90 | { | ||
91 | return llUUID.GetHashCode(); | ||
92 | } | ||
93 | |||
94 | public void Combine(UUID other) | ||
95 | { | ||
96 | llUUID.Combine(other.GetLLUUID()); | ||
97 | } | ||
98 | |||
99 | public void Combine(LLUUID other) | ||
100 | { | ||
101 | llUUID.Combine(other); | ||
102 | } | ||
103 | |||
104 | public override bool Equals(Object other) | ||
105 | { | ||
106 | return llUUID.Equals(other); | ||
107 | } | ||
108 | |||
109 | public static bool operator ==(UUID a, UUID b) | ||
110 | { | ||
111 | return a.Equals(b); | ||
112 | } | ||
113 | |||
114 | public static bool operator !=(UUID a, UUID b) | ||
115 | { | ||
116 | return !a.Equals(b); | ||
117 | } | ||
118 | |||
119 | public static bool operator ==(UUID a, LLUUID b) | ||
120 | { | ||
121 | return a.Equals(b); | ||
122 | } | ||
123 | |||
124 | public static bool operator !=(UUID a, LLUUID b) | ||
125 | { | ||
126 | return !a.Equals(b); | ||
127 | } | ||
128 | } | ||
129 | } | ||