aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General
diff options
context:
space:
mode:
authorMW2007-06-28 13:13:17 +0000
committerMW2007-06-28 13:13:17 +0000
commit3456d951d89fbc83f742d40ca8ca2a1a79d414eb (patch)
treecc5a53b8edd4ac4cc99e6178fb70c98672f3c168 /OpenSim/Framework/General
parentshould now work. (diff)
downloadopensim-SC_OLD-3456d951d89fbc83f742d40ca8ca2a1a79d414eb.zip
opensim-SC_OLD-3456d951d89fbc83f742d40ca8ca2a1a79d414eb.tar.gz
opensim-SC_OLD-3456d951d89fbc83f742d40ca8ca2a1a79d414eb.tar.bz2
opensim-SC_OLD-3456d951d89fbc83f742d40ca8ca2a1a79d414eb.tar.xz
Imported the scripting changes, so now should be up to date with sugilite.
Diffstat (limited to 'OpenSim/Framework/General')
-rw-r--r--OpenSim/Framework/General/LLSDHelpers.cs246
-rw-r--r--OpenSim/Framework/General/OpenSim.Framework.csproj63
-rw-r--r--OpenSim/Framework/General/OpenSim.Framework.dll.build80
3 files changed, 110 insertions, 279 deletions
diff --git a/OpenSim/Framework/General/LLSDHelpers.cs b/OpenSim/Framework/General/LLSDHelpers.cs
deleted file mode 100644
index 051520c..0000000
--- a/OpenSim/Framework/General/LLSDHelpers.cs
+++ /dev/null
@@ -1,246 +0,0 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using System.IO;
6using System.Xml;
7using libsecondlife;
8
9namespace OpenSim.Framework
10{
11 public class LLSDHelpers
12 {
13 public static string SerialiseLLSDReply(object obj)
14 {
15 StringWriter sw = new StringWriter();
16 XmlTextWriter writer = new XmlTextWriter(sw);
17 writer.Formatting = Formatting.None;
18 writer.WriteStartElement(String.Empty, "llsd", String.Empty);
19 LLSDHelpers.SerializeLLSDType(writer, obj);
20 writer.WriteEndElement();
21 writer.Close();
22 return sw.ToString();
23 }
24
25 public static void SerializeLLSDType(XmlTextWriter writer, object obj)
26 {
27 Type myType = obj.GetType();
28 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false);
29 if (llsdattributes.Length > 0)
30 {
31 switch (llsdattributes[0].ObjectType)
32 {
33 case "MAP":
34 writer.WriteStartElement(String.Empty, "map", String.Empty);
35 System.Reflection.FieldInfo[] fields = myType.GetFields();
36 for (int i = 0; i < fields.Length; i++)
37 {
38 object fieldValue = fields[i].GetValue(obj);
39 LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false);
40 if (fieldAttributes.Length > 0)
41 {
42 writer.WriteStartElement(String.Empty, "key", String.Empty);
43 writer.WriteString(fields[i].Name);
44 writer.WriteEndElement();
45 SerializeLLSDType(writer, fieldValue);
46 }
47 else
48 {
49 //Console.WriteLine("LLSD field name" + fields[i].Name + " , " + fields[i].GetValue(obj).GetType());
50 writer.WriteStartElement(String.Empty, "key", String.Empty);
51 writer.WriteString(fields[i].Name);
52 writer.WriteEndElement();
53 LLSD.LLSDWriteOne(writer, fieldValue);
54 }
55 }
56 writer.WriteEndElement();
57 break;
58 case "ARRAY":
59 // LLSDArray arrayObject = obj as LLSDArray;
60 // ArrayList a = arrayObject.Array;
61 ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj);
62 writer.WriteStartElement(String.Empty, "array", String.Empty);
63 foreach (object item in a)
64 {
65 SerializeLLSDType(writer, item);
66 }
67 writer.WriteEndElement();
68 break;
69 }
70 }
71 else
72 {
73 LLSD.LLSDWriteOne(writer, obj);
74 }
75 }
76
77 public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
78 {
79 Type myType = obj.GetType();
80 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false);
81 if (llsdattributes.Length > 0)
82 {
83 switch (llsdattributes[0].ObjectType)
84 {
85 case "MAP":
86 IDictionaryEnumerator enumerator = llsd.GetEnumerator();
87 while (enumerator.MoveNext())
88 {
89 System.Reflection.FieldInfo field = myType.GetField((string)enumerator.Key);
90 if (field != null)
91 {
92 if (enumerator.Value is Hashtable)
93 {
94 object fieldValue = field.GetValue(obj);
95 DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue);
96 }
97 else if (enumerator.Value is ArrayList)
98 {
99 object fieldValue = field.GetValue(obj);
100 fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value);
101 //TODO
102 // the LLSD map/array types in the array need to be deserialised
103 // but first we need to know the right class to deserialise them into.
104 }
105 else
106 {
107 field.SetValue(obj, enumerator.Value);
108 }
109 }
110 }
111 break;
112 }
113 }
114 return obj;
115 }
116 }
117
118 [LLSDType("MAP")]
119 public class LLSDMapLayerResponse
120 {
121 public LLSDMapRequest AgentData = new LLSDMapRequest();
122 public LLSDArray LayerData = new LLSDArray();
123
124 public LLSDMapLayerResponse()
125 {
126
127 }
128 }
129
130 [LLSDType("MAP")]
131 public class LLSDCapsDetails
132 {
133 public string MapLayer = "";
134 public string NewFileAgentInventory = "";
135 //public string EventQueueGet = "";
136
137 public LLSDCapsDetails()
138 {
139
140 }
141 }
142
143 [LLSDType("MAP")]
144 public class LLSDMapLayer
145 {
146 public int Left = 0;
147 public int Right = 0;
148 public int Top = 0;
149 public int Bottom = 0;
150 public LLUUID ImageID = LLUUID.Zero;
151
152 public LLSDMapLayer()
153 {
154
155 }
156 }
157
158 [LLSDType("ARRAY")]
159 public class LLSDArray
160 {
161 public ArrayList Array = new ArrayList();
162
163 public LLSDArray()
164 {
165
166 }
167 }
168
169 [LLSDType("MAP")]
170 public class LLSDMapRequest
171 {
172 public int Flags = 0;
173
174 public LLSDMapRequest()
175 {
176
177 }
178 }
179
180 [LLSDType("MAP")]
181 public class LLSDUploadReply
182 {
183 public string new_asset = "";
184 public LLUUID new_inventory_item = LLUUID.Zero;
185 public string state = "";
186
187 public LLSDUploadReply()
188 {
189
190 }
191 }
192
193 [LLSDType("MAP")]
194 public class LLSDCapEvent
195 {
196 public int id = 0;
197 public LLSDArray events = new LLSDArray();
198
199 public LLSDCapEvent()
200 {
201
202 }
203 }
204
205 [LLSDType("MAP")]
206 public class LLSDEmpty
207 {
208 public LLSDEmpty()
209 {
210
211 }
212 }
213
214 [LLSDType("MAP")]
215 public class LLSDTest
216 {
217 public int Test1 = 20;
218 public int Test2 = 10;
219
220 public LLSDTest()
221 {
222
223 }
224 }
225
226
227 [AttributeUsage(AttributeTargets.Class)]
228 public class LLSDType : Attribute
229 {
230 private string myType;
231
232 public LLSDType(string type)
233 {
234 myType = type;
235
236 }
237
238 public string ObjectType
239 {
240 get
241 {
242 return myType;
243 }
244 }
245 }
246}
diff --git a/OpenSim/Framework/General/OpenSim.Framework.csproj b/OpenSim/Framework/General/OpenSim.Framework.csproj
index 3e77f1e..d18e583 100644
--- a/OpenSim/Framework/General/OpenSim.Framework.csproj
+++ b/OpenSim/Framework/General/OpenSim.Framework.csproj
@@ -91,115 +91,112 @@
91 <Compile Include="AgentInventory.cs"> 91 <Compile Include="AgentInventory.cs">
92 <SubType>Code</SubType> 92 <SubType>Code</SubType>
93 </Compile> 93 </Compile>
94 <Compile Include="Util.cs"> 94 <Compile Include="AuthenticateSessionBase.cs">
95 <SubType>Code</SubType> 95 <SubType>Code</SubType>
96 </Compile> 96 </Compile>
97 <Compile Include="AuthenticateSessionBase.cs"> 97 <Compile Include="BlockingQueue.cs">
98 <SubType>Code</SubType> 98 <SubType>Code</SubType>
99 </Compile> 99 </Compile>
100 <Compile Include="Logger.cs"> 100 <Compile Include="IRegionCommsListener.cs">
101 <SubType>Code</SubType> 101 <SubType>Code</SubType>
102 </Compile> 102 </Compile>
103 <Compile Include="LLSDHelpers.cs"> 103 <Compile Include="Logger.cs">
104 <SubType>Code</SubType> 104 <SubType>Code</SubType>
105 </Compile> 105 </Compile>
106 <Compile Include="Remoting.cs"> 106 <Compile Include="LoginService.cs">
107 <SubType>Code</SubType> 107 <SubType>Code</SubType>
108 </Compile> 108 </Compile>
109 <Compile Include="RegionCommsListener.cs"> 109 <Compile Include="RegionCommsListener.cs">
110 <SubType>Code</SubType> 110 <SubType>Code</SubType>
111 </Compile> 111 </Compile>
112 <Compile Include="LoginService.cs"> 112 <Compile Include="Remoting.cs">
113 <SubType>Code</SubType> 113 <SubType>Code</SubType>
114 </Compile> 114 </Compile>
115 <Compile Include="BlockingQueue.cs"> 115 <Compile Include="SimProfile.cs">
116 <SubType>Code</SubType> 116 <SubType>Code</SubType>
117 </Compile> 117 </Compile>
118 <Compile Include="UserProfile.cs"> 118 <Compile Include="UserProfile.cs">
119 <SubType>Code</SubType> 119 <SubType>Code</SubType>
120 </Compile> 120 </Compile>
121 <Compile Include="IRegionCommsListener.cs"> 121 <Compile Include="Util.cs">
122 <SubType>Code</SubType>
123 </Compile>
124 <Compile Include="SimProfile.cs">
125 <SubType>Code</SubType> 122 <SubType>Code</SubType>
126 </Compile> 123 </Compile>
127 <Compile Include="Interfaces\AuthenticateResponse.cs"> 124 <Compile Include="Interfaces\AuthenticateResponse.cs">
128 <SubType>Code</SubType> 125 <SubType>Code</SubType>
129 </Compile> 126 </Compile>
130 <Compile Include="Interfaces\IUserServer.cs">
131 <SubType>Code</SubType>
132 </Compile>
133 <Compile Include="Interfaces\IAssetServer.cs"> 127 <Compile Include="Interfaces\IAssetServer.cs">
134 <SubType>Code</SubType> 128 <SubType>Code</SubType>
135 </Compile> 129 </Compile>
136 <Compile Include="Interfaces\IWorld.cs">
137 <SubType>Code</SubType>
138 </Compile>
139 <Compile Include="Interfaces\IClientAPI.cs"> 130 <Compile Include="Interfaces\IClientAPI.cs">
140 <SubType>Code</SubType> 131 <SubType>Code</SubType>
141 </Compile> 132 </Compile>
142 <Compile Include="Interfaces\ILocalStorage.cs"> 133 <Compile Include="Interfaces\ILocalStorage.cs">
143 <SubType>Code</SubType> 134 <SubType>Code</SubType>
144 </Compile> 135 </Compile>
145 <Compile Include="Interfaces\Scripting\IScriptEngine.cs"> 136 <Compile Include="Interfaces\IUserServer.cs">
146 <SubType>Code</SubType> 137 <SubType>Code</SubType>
147 </Compile> 138 </Compile>
148 <Compile Include="Interfaces\Scripting\IScriptAPI.cs"> 139 <Compile Include="Interfaces\IWorld.cs">
149 <SubType>Code</SubType> 140 <SubType>Code</SubType>
150 </Compile> 141 </Compile>
151 <Compile Include="Interfaces\Config\IGenericConfig.cs"> 142 <Compile Include="Interfaces\Config\IGenericConfig.cs">
152 <SubType>Code</SubType> 143 <SubType>Code</SubType>
153 </Compile> 144 </Compile>
145 <Compile Include="Interfaces\Config\IGridConfig.cs">
146 <SubType>Code</SubType>
147 </Compile>
154 <Compile Include="Interfaces\Config\IUserConfig.cs"> 148 <Compile Include="Interfaces\Config\IUserConfig.cs">
155 <SubType>Code</SubType> 149 <SubType>Code</SubType>
156 </Compile> 150 </Compile>
157 <Compile Include="Interfaces\Config\IGridConfig.cs"> 151 <Compile Include="Interfaces\Scripting\IScriptAPI.cs">
152 <SubType>Code</SubType>
153 </Compile>
154 <Compile Include="Interfaces\Scripting\IScriptEngine.cs">
158 <SubType>Code</SubType> 155 <SubType>Code</SubType>
159 </Compile> 156 </Compile>
160 <Compile Include="Properties\AssemblyInfo.cs"> 157 <Compile Include="Properties\AssemblyInfo.cs">
161 <SubType>Code</SubType> 158 <SubType>Code</SubType>
162 </Compile> 159 </Compile>
163 <Compile Include="Types\NeighbourInfo.cs"> 160 <Compile Include="Types\AgentCiruitData.cs">
164 <SubType>Code</SubType> 161 <SubType>Code</SubType>
165 </Compile> 162 </Compile>
166 <Compile Include="Types\NetworkServersInfo.cs"> 163 <Compile Include="Types\AgentWearable.cs">
167 <SubType>Code</SubType> 164 <SubType>Code</SubType>
168 </Compile> 165 </Compile>
169 <Compile Include="Types\RegionHandle.cs"> 166 <Compile Include="Types\AssetBase.cs">
170 <SubType>Code</SubType> 167 <SubType>Code</SubType>
171 </Compile> 168 </Compile>
172 <Compile Include="Types\RegionInfo.cs"> 169 <Compile Include="Types\AssetLandmark.cs">
173 <SubType>Code</SubType> 170 <SubType>Code</SubType>
174 </Compile> 171 </Compile>
175 <Compile Include="Types\ParcelData.cs"> 172 <Compile Include="Types\AssetStorage.cs">
176 <SubType>Code</SubType> 173 <SubType>Code</SubType>
177 </Compile> 174 </Compile>
178 <Compile Include="Types\AgentWearable.cs"> 175 <Compile Include="Types\EstateSettings.cs">
179 <SubType>Code</SubType> 176 <SubType>Code</SubType>
180 </Compile> 177 </Compile>
181 <Compile Include="Types\PrimData.cs"> 178 <Compile Include="Types\Login.cs">
182 <SubType>Code</SubType> 179 <SubType>Code</SubType>
183 </Compile> 180 </Compile>
184 <Compile Include="Types\MapBlockData.cs"> 181 <Compile Include="Types\MapBlockData.cs">
185 <SubType>Code</SubType> 182 <SubType>Code</SubType>
186 </Compile> 183 </Compile>
187 <Compile Include="Types\AssetStorage.cs"> 184 <Compile Include="Types\NeighbourInfo.cs">
188 <SubType>Code</SubType> 185 <SubType>Code</SubType>
189 </Compile> 186 </Compile>
190 <Compile Include="Types\EstateSettings.cs"> 187 <Compile Include="Types\NetworkServersInfo.cs">
191 <SubType>Code</SubType> 188 <SubType>Code</SubType>
192 </Compile> 189 </Compile>
193 <Compile Include="Types\AgentCiruitData.cs"> 190 <Compile Include="Types\ParcelData.cs">
194 <SubType>Code</SubType> 191 <SubType>Code</SubType>
195 </Compile> 192 </Compile>
196 <Compile Include="Types\Login.cs"> 193 <Compile Include="Types\PrimData.cs">
197 <SubType>Code</SubType> 194 <SubType>Code</SubType>
198 </Compile> 195 </Compile>
199 <Compile Include="Types\AssetLandmark.cs"> 196 <Compile Include="Types\RegionHandle.cs">
200 <SubType>Code</SubType> 197 <SubType>Code</SubType>
201 </Compile> 198 </Compile>
202 <Compile Include="Types\AssetBase.cs"> 199 <Compile Include="Types\RegionInfo.cs">
203 <SubType>Code</SubType> 200 <SubType>Code</SubType>
204 </Compile> 201 </Compile>
205 </ItemGroup> 202 </ItemGroup>
diff --git a/OpenSim/Framework/General/OpenSim.Framework.dll.build b/OpenSim/Framework/General/OpenSim.Framework.dll.build
new file mode 100644
index 0000000..04e3382
--- /dev/null
+++ b/OpenSim/Framework/General/OpenSim.Framework.dll.build
@@ -0,0 +1,80 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Framework" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Framework" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AgentInventory.cs" />
15 <include name="AuthenticateSessionBase.cs" />
16 <include name="BlockingQueue.cs" />
17 <include name="IRegionCommsListener.cs" />
18 <include name="Logger.cs" />
19 <include name="LoginService.cs" />
20 <include name="RegionCommsListener.cs" />
21 <include name="Remoting.cs" />
22 <include name="SimProfile.cs" />
23 <include name="UserProfile.cs" />
24 <include name="Util.cs" />
25 <include name="Interfaces/AuthenticateResponse.cs" />
26 <include name="Interfaces/IAssetServer.cs" />
27 <include name="Interfaces/IClientAPI.cs" />
28 <include name="Interfaces/ILocalStorage.cs" />
29 <include name="Interfaces/IUserServer.cs" />
30 <include name="Interfaces/IWorld.cs" />
31 <include name="Interfaces/Config/IGenericConfig.cs" />
32 <include name="Interfaces/Config/IGridConfig.cs" />
33 <include name="Interfaces/Config/IUserConfig.cs" />
34 <include name="Interfaces/Scripting/IScriptAPI.cs" />
35 <include name="Interfaces/Scripting/IScriptEngine.cs" />
36 <include name="Properties/AssemblyInfo.cs" />
37 <include name="Types/AgentCiruitData.cs" />
38 <include name="Types/AgentWearable.cs" />
39 <include name="Types/AssetBase.cs" />
40 <include name="Types/AssetLandmark.cs" />
41 <include name="Types/AssetStorage.cs" />
42 <include name="Types/EstateSettings.cs" />
43 <include name="Types/Login.cs" />
44 <include name="Types/MapBlockData.cs" />
45 <include name="Types/NeighbourInfo.cs" />
46 <include name="Types/NetworkServersInfo.cs" />
47 <include name="Types/ParcelData.cs" />
48 <include name="Types/PrimData.cs" />
49 <include name="Types/RegionHandle.cs" />
50 <include name="Types/RegionInfo.cs" />
51 </sources>
52 <references basedir="${project::get-base-directory()}">
53 <lib>
54 <include name="${project::get-base-directory()}" />
55 <include name="${project::get-base-directory()}/${build.dir}" />
56 </lib>
57 <include name="../../../bin/Db4objects.Db4o.dll" />
58 <include name="../../../bin/libsecondlife.dll" />
59 <include name="../../../bin/OpenSim.Framework.Console.dll" />
60 <include name="System.dll" />
61 <include name="System.Xml.dll" />
62 <include name="../../../bin/XMLRPC.dll" />
63 </references>
64 </csc>
65 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />
66 <mkdir dir="${project::get-base-directory()}/../../../bin/"/>
67 <copy todir="${project::get-base-directory()}/../../../bin/">
68 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
69 <include name="*.dll"/>
70 <include name="*.exe"/>
71 </fileset>
72 </copy>
73 </target>
74 <target name="clean">
75 <delete dir="${bin.dir}" failonerror="false" />
76 <delete dir="${obj.dir}" failonerror="false" />
77 </target>
78 <target name="doc" description="Creates documentation.">
79 </target>
80</project>