0.8 here we come!

LIBOMV-576 Start of Abstracting library into two separate libraries. For now this means: There will be a new dependency for OpenMetaverse.dll named OpenMetaverseCore.dll, the new will be required for OpenMetaverse to operate properly, the inverse is not true. OpenMetaverseCore will eventually contain all packet and message related code. 
* Need to create a singleton logger instance (or move the current logger to Core.
* Currently only Packets, Helpers and some common types have been moved to Core.
* Helpers will need to be split and non-core required helpers moved back to OpenMetaverse.
* Lots more work to be done here, but these changes should not break anything (yet)

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3021 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
Jim Radford
2009-07-23 03:31:16 +00:00
parent 724033b1af
commit b80b974c77
15 changed files with 909 additions and 79 deletions

View File

@@ -25,7 +25,7 @@ using System.Runtime.CompilerServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.*")]
[assembly: AssemblyVersion("0.0.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the

View File

@@ -389,7 +389,7 @@ namespace OpenMetaverse.Imaging
public static ManagedImage LoadAlphaLayer(string fileName)
{
Stream stream = Helpers.GetResourceStream(fileName);
Stream stream = Helpers.GetResourceStream(fileName, Settings.RESOURCE_DIR);
if (stream != null)
{

View File

@@ -27,22 +27,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using OpenMetaverse;
namespace OpenMetaverse
{
/// <summary>
///
/// </summary>
public enum PacketFrequency : byte
{
/// <summary></summary>
Low,
/// <summary></summary>
Medium,
/// <summary></summary>
High
}
{
/// <summary>
///
/// </summary>

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenMetaverse Networking Core")]
[assembly: AssemblyDescription("The OpenMetaverse Network abstraction library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("OpenMetaverse")]
[assembly: AssemblyProduct("libOpenMetaverse")]
[assembly: AssemblyCopyright("2009 OpenMetaverse Foundation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("71acd58b-2794-4ba7-982c-f08568881067")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.0.0.*")]
[assembly: AssemblyFileVersion("0.0.0.0")]

View File

@@ -153,7 +153,7 @@ namespace OpenMetaverse.Packets
}
catch (Exception e)
{
Logger.Log(e.Message, Helpers.LogLevel.Error, e);
//FIXME Logger.Log(e.Message, Helpers.LogLevel.Error, e);
}
return packet;

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenMetaverse
{
/// <summary>
///
/// </summary>
public enum PacketFrequency : byte
{
/// <summary></summary>
Low,
/// <summary></summary>
Medium,
/// <summary></summary>
High
}
}

View File

@@ -301,11 +301,13 @@ namespace OpenMetaverse
}
catch (Exception ex)
{
Logger.Log(String.Format("Zerodecoding error: i={0}, srclen={1}, bodylen={2}, zerolen={3}\n{4}\n{5}",
i, srclen, bodylen, zerolen, Utils.BytesToHexString(src, srclen, null), ex), LogLevel.Error);
}
throw new IndexOutOfRangeException(String.Format("Zerodecoding error: i={0}, srclen={1}, bodylen={2}, zerolen={3}\n{4}\n{5}",
i, srclen, bodylen, zerolen, Utils.BytesToHexString(src, srclen, null)), ex.InnerException);
return 0;
//Logger.Log(String.Format("Zerodecoding error: i={0}, srclen={1}, bodylen={2}, zerolen={3}\n{4}\n{5}",
// i, srclen, bodylen, zerolen, Utils.BytesToHexString(src, srclen, null), ex), LogLevel.Error);
}
return 0;
}
/// <summary>
@@ -442,9 +444,9 @@ namespace OpenMetaverse
/// was not successfully loaded</returns>
public static System.IO.Stream GetResourceStream(string resourceName)
{
return GetResourceStream(resourceName, Settings.RESOURCE_DIR);
return GetResourceStream(resourceName, "openmetaverse_data");
}
/// <summary>
/// Attempts to load a file either embedded in the assembly or found in
/// a given search path
@@ -479,53 +481,6 @@ namespace OpenMetaverse
}
return null;
}
/// <summary>
/// Converts a list of primitives to an object that can be serialized
/// with the LLSD system
/// </summary>
/// <param name="prims">Primitives to convert to a serializable object</param>
/// <returns>An object that can be serialized with LLSD</returns>
public static StructuredData.OSD PrimListToOSD(List<Primitive> prims)
{
StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(prims.Count);
for (int i = 0; i < prims.Count; i++)
map.Add(prims[i].LocalID.ToString(), prims[i].GetOSD());
return map;
}
/// <summary>
/// Deserializes OSD in to a list of primitives
/// </summary>
/// <param name="osd">Structure holding the serialized primitive list,
/// must be of the SDMap type</param>
/// <returns>A list of deserialized primitives</returns>
public static List<Primitive> OSDToPrimList(StructuredData.OSD osd)
{
if (osd.Type != StructuredData.OSDType.Map)
throw new ArgumentException("LLSD must be in the Map structure");
StructuredData.OSDMap map = (StructuredData.OSDMap)osd;
List<Primitive> prims = new List<Primitive>(map.Count);
foreach (KeyValuePair<string, StructuredData.OSD> kvp in map)
{
Primitive prim = Primitive.FromOSD(kvp.Value);
prim.LocalID = UInt32.Parse(kvp.Key);
prims.Add(prim);
}
return prims;
}
public static AttachmentPoint StateToAttachmentPoint(uint state)
{
const uint ATTACHMENT_MASK = 0xF0;
uint fixedState = (((byte)state & ATTACHMENT_MASK) >> 4) | (((byte)state & ~ATTACHMENT_MASK) << 4);
return (AttachmentPoint)fixedState;
}
}
}
}

View File

@@ -328,7 +328,7 @@ namespace PrimWorkshop
textures = 0;
// Write the LLSD to the hard drive in XML format
string output = OSDParser.SerializeLLSDXmlString(Helpers.PrimListToOSD(primList));
string output = OSDParser.SerializeLLSDXmlString(ClientHelpers.PrimListToOSD(primList));
try
{
// Create a temporary directory
@@ -499,7 +499,7 @@ namespace PrimWorkshop
// Decode the .prims file
string raw = File.ReadAllText(primFile);
OSD osd = OSDParser.DeserializeLLSDXml(raw);
return Helpers.OSDToPrimList(osd);
return ClientHelpers.OSDToPrimList(osd);
}
catch (Exception e)
{

View File

@@ -275,7 +275,7 @@ namespace PrimWorkshop
if (osd != null && osd.Type == OSDType.Map)
{
List<Primitive> primList = Helpers.OSDToPrimList(osd);
List<Primitive> primList = ClientHelpers.OSDToPrimList(osd);
Prims = new List<FacetedMesh>(primList.Count);
for (int i = 0; i < primList.Count; i++)

View File

@@ -23,7 +23,7 @@ namespace OpenMetaverse.TestClient
for (int i = 0; i < attachments.Count; i++)
{
Primitive prim = attachments[i];
AttachmentPoint point = Helpers.StateToAttachmentPoint(prim.PrimData.State);
AttachmentPoint point = StateToAttachmentPoint(prim.PrimData.State);
// TODO: Fetch properties for the objects with missing property sets so we can show names
Logger.Log(String.Format("[Attachment @ {0}] LocalID: {1} UUID: {2} Offset: {3}",
@@ -32,5 +32,12 @@ namespace OpenMetaverse.TestClient
return "Found " + attachments.Count + " attachments";
}
public static AttachmentPoint StateToAttachmentPoint(uint state)
{
const uint ATTACHMENT_MASK = 0xF0;
uint fixedState = (((byte)state & ATTACHMENT_MASK) >> 4) | (((byte)state & ~ATTACHMENT_MASK) << 4);
return (AttachmentPoint)fixedState;
}
}
}

View File

@@ -100,7 +100,7 @@ namespace OpenMetaverse.TestClient
Logger.Log(uuid.ToString(), Helpers.LogLevel.Warning, Client);
}
string output = OSDParser.SerializeLLSDXmlString(Helpers.PrimListToOSD(prims));
string output = OSDParser.SerializeLLSDXmlString(ClientHelpers.PrimListToOSD(prims));
try { File.WriteAllText(file, output); }
catch (Exception e) { return e.Message; }

View File

@@ -63,7 +63,7 @@ namespace OpenMetaverse.TestClient
try { xml = File.ReadAllText(filename); }
catch (Exception e) { return e.Message; }
try { prims = Helpers.OSDToPrimList(OSDParser.DeserializeLLSDXml(xml)); }
try { prims = ClientHelpers.OSDToPrimList(OSDParser.DeserializeLLSDXml(xml)); }
catch (Exception e) { return "Failed to deserialize " + filename + ": " + e.Message; }
// Build an organized structure from the imported prims

View File

@@ -1 +1 @@
"bin/mapgenerator.exe" data/message_template.msg Programs/mapgenerator/template.cs Programs/mapgenerator/unusedpackets.txt OpenMetaverse/_Packets_.cs
"bin/mapgenerator.exe" data/message_template.msg Programs/mapgenerator/template.cs Programs/mapgenerator/unusedpackets.txt OpenMetaverseCore/_Packets_.cs

File diff suppressed because one or more lines are too long