* 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.

Sugilite
Adam Frisby 2007-06-29 22:09:52 +00:00
parent 72cd28be1b
commit e4df6ea08e
2 changed files with 153 additions and 15 deletions

View File

@ -1,4 +1,4 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
@ -6,7 +6,8 @@
<ProjectGuid>{8ACA2445-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.Framework</AssemblyName>
@ -15,9 +16,11 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder></AppDesignerFolder>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.Framework</RootNamespace>
<StartupObject></StartupObject>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
@ -28,7 +31,8 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile></DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
@ -37,7 +41,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
<NoWarn>
</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -46,7 +51,8 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile></DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
@ -55,26 +61,28 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Db4objects.Db4o.dll" >
<Reference Include="Db4objects.Db4o.dll">
<HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="libsecondlife.dll" >
<Reference Include="libsecondlife.dll">
<HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" >
<Reference Include="System">
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml" >
<Reference Include="System.Data" />
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="XMLRPC.dll" >
<Reference Include="XMLRPC.dll">
<HintPath>..\..\..\bin\XMLRPC.dll</HintPath>
<Private>False</Private>
</Reference>
@ -84,7 +92,7 @@
<Name>OpenSim.Framework.Console</Name>
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@ -103,6 +111,7 @@
<Compile Include="IRegionCommsListener.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Types\UUID.cs" />
<Compile Include="Util.cs">
<SubType>Code</SubType>
</Compile>

View File

@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
namespace OpenSim.Framework.Types
{
class UUID
{
public LLUUID llUUID;
public UUID(string uuid)
{
llUUID = new LLUUID(uuid);
}
public UUID(byte[] uuid)
{
llUUID = new LLUUID(uuid, 0);
}
public UUID(byte[] uuid, int offset)
{
llUUID = new LLUUID(uuid, offset);
}
public UUID()
{
llUUID = LLUUID.Zero;
}
public UUID(ulong uuid)
{
llUUID = new LLUUID(uuid);
}
public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth)
{
byte[] uuid = new byte[16];
byte[] n = BitConverter.GetBytes(first);
n.CopyTo(uuid, 0);
n = BitConverter.GetBytes(second);
n.CopyTo(uuid, 4);
n = BitConverter.GetBytes(third);
n.CopyTo(uuid, 8);
n = BitConverter.GetBytes(fourth);
n.CopyTo(uuid, 12);
llUUID = new LLUUID(uuid,0);
}
public override string ToString()
{
return llUUID.ToString();
}
public string ToStringHyphenated()
{
return llUUID.ToStringHyphenated();
}
public byte[] GetBytes()
{
return llUUID.GetBytes();
}
public UInt32[] GetInts()
{
UInt32[] ints = new UInt32[4];
ints[0] = BitConverter.ToUInt32(llUUID.Data, 0);
ints[1] = BitConverter.ToUInt32(llUUID.Data, 4);
ints[2] = BitConverter.ToUInt32(llUUID.Data, 8);
ints[3] = BitConverter.ToUInt32(llUUID.Data, 12);
return ints;
}
public LLUUID GetLLUUID()
{
return llUUID;
}
public uint CRC()
{
return llUUID.CRC();
}
public override int GetHashCode()
{
return llUUID.GetHashCode();
}
public void Combine(UUID other)
{
llUUID.Combine(other.GetLLUUID());
}
public void Combine(LLUUID other)
{
llUUID.Combine(other);
}
public override bool Equals(Object other)
{
return llUUID.Equals(other);
}
public static bool operator ==(UUID a, UUID b)
{
return a.Equals(b);
}
public static bool operator !=(UUID a, UUID b)
{
return !a.Equals(b);
}
public static bool operator ==(UUID a, LLUUID b)
{
return a.Equals(b);
}
public static bool operator !=(UUID a, LLUUID b)
{
return !a.Equals(b);
}
}
}