- initial import. this library will be used to read, manipulate, and

write .prims files



git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@211 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
cjcollier
2006-09-21 23:28:44 +00:00
parent 9076dabbca
commit e6f1bdd263
6 changed files with 316 additions and 0 deletions

2
libprims/AUTHORS Normal file
View File

@@ -0,0 +1,2 @@
C.J. Adams-Collier <cjcollier@colliertech.org>
I do stuff.

3
libprims/ChangeLog Normal file
View File

@@ -0,0 +1,3 @@
2006-09-21 C.J. Collier <cjcollier@colliertech.org>
Initial check-in. This project will be used to read, manipulate
and write .prims files.

20
libprims/Makefile Normal file
View File

@@ -0,0 +1,20 @@
SOURCES = prims01.cs PrimsLoader.cs
RESOURCES = prims01.xsd
CSC = mcs
XSD = xsd
all: libprims.dll
libprims.dll: $(SOURCES) $(RESOURCES)
$(CSC) -resource:prims01.xsd \
$(SOURCES) \
-target:library \
-out:libprims.dll
prims01.cs: prims01.xsd
$(XSD) prims01.xsd /c
clean:
rm *.dll prims01.cs

75
libprims/PrimsLoader.cs Normal file
View File

@@ -0,0 +1,75 @@
using System;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Reflection;
namespace PrimsTest
{
public class PrimsLoader
{
public PrimsLoader()
{
}
public Schemas.primitives Load(System.IO.Stream stream)
{
System.Xml.XmlTextReader r =
new XmlTextReader( stream );
System.Xml.XmlValidatingReader vr =
new XmlValidatingReader(r);
System.IO.Stream schemaStream =
System.Reflection.Assembly.GetExecutingAssembly().
GetManifestResourceStream("prims01.xsd");
System.Xml.XmlTextReader schemaReader =
new System.Xml.XmlTextReader( schemaStream );
System.Xml.Schema.XmlSchema schema =
System.Xml.Schema.XmlSchema.Read(schemaReader, MyValidationEventHandler);
// Rewind the stream
//schemaStream.Seek(0,System.IO.SeekOrigin.Begin);
schemaStream = System.Reflection.Assembly.GetExecutingAssembly().
GetManifestResourceStream("prims01.xsd");
vr.Schemas.Add(schema.TargetNamespace,
new System.Xml.XmlTextReader( schemaStream )
);
vr.ValidationType = ValidationType.Schema;
vr.ValidationEventHandler +=
new ValidationEventHandler(MyValidationEventHandler);
System.Xml.Serialization.XmlSerializer s =
new System.Xml.Serialization.XmlSerializer(typeof(Schemas.primitives));
Schemas.primitives ps = (Schemas.primitives) s.Deserialize(vr);
return ps;
}
public Schemas.primitives Load(System.String fname)
{
System.IO.FileStream stream =
new System.IO.FileStream(fname, System.IO.FileMode.Open);
return this.Load(stream);
}
public static void MyValidationEventHandler(object sender,
ValidationEventArgs args)
{
Console.WriteLine("Validation event: " + args.Message);
}
}
}

26
libprims/libprims.mdp Normal file
View File

@@ -0,0 +1,26 @@
<Project name="libprims" fileversion="2.0" language="C#" clr-version="Net_1_1" ctype="DotNetProject">
<Configurations active="Debug">
<Configuration name="Debug" ctype="DotNetProjectConfiguration">
<Output directory="./bin/Debug" assembly="libprims" />
<Build debugmode="True" target="Library" />
<Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_1_1" />
<CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
</Configuration>
<Configuration name="Release" ctype="DotNetProjectConfiguration">
<Output directory="./bin/Release" assembly="libprims" />
<Build debugmode="False" target="Library" />
<Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_1_1" />
<CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
</Configuration>
</Configurations>
<DeployTargets />
<Contents>
<File name="./PrimsLoader.cs" subtype="Code" buildaction="Compile" />
<File name="./prims01.cs" subtype="Code" buildaction="Compile" />
<File name="../prims01.xsd" subtype="Code" buildaction="EmbedAsResource" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</References>
</Project>

190
libprims/prims01.xsd Normal file
View File

@@ -0,0 +1,190 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema version="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation>
First public revision of .prims schema
</xs:documentation>
</xs:annotation>
<xs:element name="primitives">
<xs:complexType>
<xs:sequence>
<xs:element ref="primitive" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="primitive">
<xs:complexType>
<xs:sequence>
<xs:element ref="states" />
<xs:element ref="properties" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="description" type="xs:string" />
<xs:attribute name="key" type="xs:string" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="states">
<xs:complexType>
<xs:sequence>
<xs:element name="physics" type="xs:string" default="false" />
<xs:element name="temporary" type="xs:string" default="false" />
<xs:element name="phantom" type="xs:string" default="false" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="properties">
<xs:complexType>
<xs:sequence>
<xs:element ref="levelofdetail" minOccurs="1" maxOccurs="1" />
<xs:element ref="type" minOccurs="1" maxOccurs="1" />
<xs:element ref="position" minOccurs="1" maxOccurs="1" />
<xs:element ref="rotation" minOccurs="1" maxOccurs="1" />
<xs:element ref="size" minOccurs="1" maxOccurs="1" />
<xs:element ref="cut" minOccurs="1" maxOccurs="1" />
<xs:element ref="dimple" minOccurs="1" maxOccurs="1" />
<xs:element ref="advancedcut" minOccurs="1" maxOccurs="1" />
<xs:element ref="hollow" minOccurs="1" maxOccurs="1" />
<xs:element ref="twist" minOccurs="1" maxOccurs="1" />
<xs:element ref="topsize" minOccurs="1" maxOccurs="1" />
<xs:element ref="holesize" minOccurs="1" maxOccurs="1" />
<xs:element ref="topshear" minOccurs="1" maxOccurs="1" />
<xs:element ref="taper" minOccurs="1" maxOccurs="1" />
<xs:element ref="revolutions" minOccurs="1" maxOccurs="1" />
<xs:element ref="radiusoffset" minOccurs="1" maxOccurs="1" />
<xs:element ref="skew" minOccurs="1" maxOccurs="1" />
<xs:element ref="material" minOccurs="1" maxOccurs="1" />
<xs:element ref="hollowshape" minOccurs="1" maxOccurs="1" />
<xs:element ref="textures" minOccurs="1" maxOccurs="1" />
<xs:element ref="scripts" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="levelofdetail">
<xs:complexType>
<xs:attribute name="val" type="xs:positiveInteger" />
</xs:complexType>
</xs:element>
<xs:element name="type">
<xs:complexType>
<xs:attribute name="val" type="xs:positiveInteger" />
</xs:complexType>
</xs:element>
<xs:element name="position">
<xs:complexType>
<xs:attribute name="x" type="xs:double" />
<xs:attribute name="y" type="xs:double" />
<xs:attribute name="z" type="xs:double" />
</xs:complexType>
</xs:element>
<xs:element name="rotation">
<xs:complexType>
<xs:attribute name="x" type="xs:double" />
<xs:attribute name="y" type="xs:double" />
<xs:attribute name="z" type="xs:double" />
<xs:attribute name="s" type="xs:double" />
</xs:complexType>
</xs:element>
<xs:element name="size">
<xs:complexType>
<xs:attribute name="x" type="xs:double" />
<xs:attribute name="y" type="xs:double" />
<xs:attribute name="z" type="xs:double" />
</xs:complexType>
</xs:element>
<xs:element name="cut">
<xs:complexType>
<xs:attribute name="x" type="xs:double" />
<xs:attribute name="y" type="xs:double" />
</xs:complexType>
</xs:element>
<xs:element name="dimple">
<xs:complexType>
<xs:attribute name="x" type="xs:double" />
<xs:attribute name="y" type="xs:double" />
</xs:complexType>
</xs:element>
<xs:element name="advancedcut">
<xs:complexType>
<xs:attribute name="x" type="xs:double" />
<xs:attribute name="y" type="xs:double" />
</xs:complexType>
</xs:element>
<xs:element name="hollow">
<xs:complexType>
<xs:attribute name="val" type="xs:decimal" />
</xs:complexType>
</xs:element>
<xs:element name="twist">
<xs:complexType>
<xs:attribute name="x" type="xs:decimal" />
<xs:attribute name="y" type="xs:decimal" />
</xs:complexType>
</xs:element>
<xs:element name="topsize">
<xs:complexType>
<xs:attribute name="x" type="xs:decimal" />
<xs:attribute name="y" type="xs:decimal" />
</xs:complexType>
</xs:element>
<xs:element name="holesize">
<xs:complexType>
<xs:attribute name="x" type="xs:decimal" />
<xs:attribute name="y" type="xs:decimal" />
</xs:complexType>
</xs:element>
<xs:element name="topshear">
<xs:complexType>
<xs:attribute name="x" type="xs:decimal" />
<xs:attribute name="y" type="xs:decimal" />
</xs:complexType>
</xs:element>
<xs:element name="taper">
<xs:complexType>
<xs:attribute name="x" type="xs:decimal" />
<xs:attribute name="y" type="xs:decimal" />
</xs:complexType>
</xs:element>
<xs:element name="revolutions">
<xs:complexType>
<xs:attribute name="val" type="xs:decimal" />
</xs:complexType>
</xs:element>
<xs:element name="radiusoffset">
<xs:complexType>
<xs:attribute name="val" type="xs:decimal" />
</xs:complexType>
</xs:element>
<xs:element name="skew">
<xs:complexType>
<xs:attribute name="val" type="xs:decimal" />
</xs:complexType>
</xs:element>
<xs:element name="material">
<xs:complexType>
<xs:attribute name="val" type="xs:positiveInteger" />
</xs:complexType>
</xs:element>
<xs:element name="hollowshape">
<xs:complexType>
<xs:attribute name="val" type="xs:positiveInteger" />
</xs:complexType>
</xs:element>
<xs:element name="textures">
<xs:complexType>
<xs:attribute name="params" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="scripts">
<xs:complexType>
<xs:attribute name="params" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>