diff options
author | Adam Frisby | 2007-07-11 08:02:47 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:02:47 +0000 |
commit | 5c7ffdde0b9642a42e8f5987e06eb01220ff7776 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /OpenSim | |
parent | Who would have known that the only way of specifying utf-8 without preamble, ... (diff) | |
download | opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.zip opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.gz opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.bz2 opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.xz |
* Wiping trunk in prep for Sugilite
Diffstat (limited to 'OpenSim')
120 files changed, 0 insertions, 19641 deletions
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/AssemblyInfo.cs b/OpenSim/OpenSim.GridInterfaces/Local/AssemblyInfo.cs deleted file mode 100644 index 52ecd6b..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Local/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System.Reflection; | ||
29 | using System.Runtime.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("LocalGridServers")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("LocalGridServers")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs deleted file mode 100644 index ea4cbc7..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Local/LocalAssetServer.cs +++ /dev/null | |||
@@ -1,298 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Threading; | ||
32 | using System.IO; | ||
33 | using OpenSim.Framework.Interfaces; | ||
34 | using OpenSim.Framework.Types; | ||
35 | using OpenSim.Framework.Utilities; | ||
36 | using OpenSim.Framework.Console; | ||
37 | using libsecondlife; | ||
38 | using Db4objects.Db4o; | ||
39 | using Db4objects.Db4o.Query; | ||
40 | |||
41 | namespace OpenSim.GridInterfaces.Local | ||
42 | { | ||
43 | public class LocalAssetPlugin : IAssetPlugin | ||
44 | { | ||
45 | public LocalAssetPlugin() | ||
46 | { | ||
47 | |||
48 | } | ||
49 | |||
50 | public IAssetServer GetAssetServer() | ||
51 | { | ||
52 | return (new LocalAssetServer()); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | public class LocalAssetServer : IAssetServer | ||
57 | { | ||
58 | private IAssetReceiver _receiver; | ||
59 | private BlockingQueue<ARequest> _assetRequests; | ||
60 | private IObjectContainer db; | ||
61 | private Thread _localAssetServerThread; | ||
62 | |||
63 | public LocalAssetServer() | ||
64 | { | ||
65 | bool yapfile; | ||
66 | this._assetRequests = new BlockingQueue<ARequest>(); | ||
67 | yapfile = System.IO.File.Exists("assets.yap"); | ||
68 | |||
69 | MainConsole.Instance.Verbose("Local Asset Server class created"); | ||
70 | try | ||
71 | { | ||
72 | db = Db4oFactory.OpenFile("assets.yap"); | ||
73 | MainConsole.Instance.Verbose("Db4 Asset database creation"); | ||
74 | } | ||
75 | catch (Exception e) | ||
76 | { | ||
77 | db.Close(); | ||
78 | MainConsole.Instance.Warn("Db4 Asset server :Constructor - Exception occured"); | ||
79 | MainConsole.Instance.Warn(e.ToString()); | ||
80 | } | ||
81 | if (!yapfile) | ||
82 | { | ||
83 | this.SetUpAssetDatabase(); | ||
84 | } | ||
85 | this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); | ||
86 | this._localAssetServerThread.IsBackground = true; | ||
87 | this._localAssetServerThread.Start(); | ||
88 | |||
89 | } | ||
90 | |||
91 | public void SetReceiver(IAssetReceiver receiver) | ||
92 | { | ||
93 | this._receiver = receiver; | ||
94 | } | ||
95 | |||
96 | public void RequestAsset(LLUUID assetID, bool isTexture) | ||
97 | { | ||
98 | ARequest req = new ARequest(); | ||
99 | req.AssetID = assetID; | ||
100 | req.IsTexture = isTexture; | ||
101 | this._assetRequests.Enqueue(req); | ||
102 | } | ||
103 | |||
104 | public void UpdateAsset(AssetBase asset) | ||
105 | { | ||
106 | |||
107 | } | ||
108 | |||
109 | public void UploadNewAsset(AssetBase asset) | ||
110 | { | ||
111 | AssetStorage store = new AssetStorage(); | ||
112 | store.Data = asset.Data; | ||
113 | store.Name = asset.Name; | ||
114 | store.UUID = asset.FullID; | ||
115 | db.Set(store); | ||
116 | db.Commit(); | ||
117 | } | ||
118 | |||
119 | public void SetServerInfo(string ServerUrl, string ServerKey) | ||
120 | { | ||
121 | |||
122 | } | ||
123 | public void Close() | ||
124 | { | ||
125 | if (db != null) | ||
126 | { | ||
127 | MainConsole.Instance.Verbose( "Closing local asset server database"); | ||
128 | db.Close(); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | private void RunRequests() | ||
133 | { | ||
134 | while (true) | ||
135 | { | ||
136 | byte[] idata = null; | ||
137 | bool found = false; | ||
138 | AssetStorage foundAsset = null; | ||
139 | ARequest req = this._assetRequests.Dequeue(); | ||
140 | IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); | ||
141 | if (result.Count > 0) | ||
142 | { | ||
143 | foundAsset = (AssetStorage)result.Next(); | ||
144 | found = true; | ||
145 | } | ||
146 | |||
147 | AssetBase asset = new AssetBase(); | ||
148 | if (found) | ||
149 | { | ||
150 | asset.FullID = foundAsset.UUID; | ||
151 | asset.Type = foundAsset.Type; | ||
152 | asset.InvType = foundAsset.Type; | ||
153 | asset.Name = foundAsset.Name; | ||
154 | idata = foundAsset.Data; | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | asset.FullID = LLUUID.Zero; | ||
159 | } | ||
160 | asset.Data = idata; | ||
161 | _receiver.AssetReceived(asset, req.IsTexture); | ||
162 | } | ||
163 | |||
164 | } | ||
165 | |||
166 | private void SetUpAssetDatabase() | ||
167 | { | ||
168 | try | ||
169 | { | ||
170 | |||
171 | MainConsole.Instance.Verbose( "Setting up asset database"); | ||
172 | |||
173 | AssetBase Image = new AssetBase(); | ||
174 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); | ||
175 | Image.Name = "Bricks"; | ||
176 | this.LoadAsset(Image, true, "bricks.jp2"); | ||
177 | AssetStorage store = new AssetStorage(); | ||
178 | store.Data = Image.Data; | ||
179 | store.Name = Image.Name; | ||
180 | store.UUID = Image.FullID; | ||
181 | db.Set(store); | ||
182 | db.Commit(); | ||
183 | |||
184 | Image = new AssetBase(); | ||
185 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); | ||
186 | Image.Name = "Plywood"; | ||
187 | this.LoadAsset(Image, true, "plywood.jp2"); | ||
188 | store = new AssetStorage(); | ||
189 | store.Data = Image.Data; | ||
190 | store.Name = Image.Name; | ||
191 | store.UUID = Image.FullID; | ||
192 | db.Set(store); | ||
193 | db.Commit(); | ||
194 | |||
195 | Image = new AssetBase(); | ||
196 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); | ||
197 | Image.Name = "Rocks"; | ||
198 | this.LoadAsset(Image, true, "rocks.jp2"); | ||
199 | store = new AssetStorage(); | ||
200 | store.Data = Image.Data; | ||
201 | store.Name = Image.Name; | ||
202 | store.UUID = Image.FullID; | ||
203 | db.Set(store); | ||
204 | db.Commit(); | ||
205 | |||
206 | Image = new AssetBase(); | ||
207 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); | ||
208 | Image.Name = "Granite"; | ||
209 | this.LoadAsset(Image, true, "granite.jp2"); | ||
210 | store = new AssetStorage(); | ||
211 | store.Data = Image.Data; | ||
212 | store.Name = Image.Name; | ||
213 | store.UUID = Image.FullID; | ||
214 | db.Set(store); | ||
215 | db.Commit(); | ||
216 | |||
217 | Image = new AssetBase(); | ||
218 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); | ||
219 | Image.Name = "Hardwood"; | ||
220 | this.LoadAsset(Image, true, "hardwood.jp2"); | ||
221 | store = new AssetStorage(); | ||
222 | store.Data = Image.Data; | ||
223 | store.Name = Image.Name; | ||
224 | store.UUID = Image.FullID; | ||
225 | db.Set(store); | ||
226 | db.Commit(); | ||
227 | |||
228 | Image = new AssetBase(); | ||
229 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); | ||
230 | Image.Name = "Prim Base Texture"; | ||
231 | this.LoadAsset(Image, true, "plywood.jp2"); | ||
232 | store = new AssetStorage(); | ||
233 | store.Data = Image.Data; | ||
234 | store.Name = Image.Name; | ||
235 | store.UUID = Image.FullID; | ||
236 | db.Set(store); | ||
237 | db.Commit(); | ||
238 | |||
239 | Image = new AssetBase(); | ||
240 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); | ||
241 | Image.Name = "Map Base Texture"; | ||
242 | this.LoadAsset(Image, true, "map_base.jp2"); | ||
243 | store = new AssetStorage(); | ||
244 | store.Data = Image.Data; | ||
245 | store.Name = Image.Name; | ||
246 | store.UUID = Image.FullID; | ||
247 | db.Set(store); | ||
248 | db.Commit(); | ||
249 | |||
250 | Image = new AssetBase(); | ||
251 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); | ||
252 | Image.Name = "Map Texture"; | ||
253 | this.LoadAsset(Image, true, "map1.jp2"); | ||
254 | store = new AssetStorage(); | ||
255 | store.Data = Image.Data; | ||
256 | store.Name = Image.Name; | ||
257 | store.UUID = Image.FullID; | ||
258 | db.Set(store); | ||
259 | db.Commit(); | ||
260 | |||
261 | Image = new AssetBase(); | ||
262 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
263 | Image.Name = "Shape"; | ||
264 | this.LoadAsset(Image, false, "base_shape.dat"); | ||
265 | store = new AssetStorage(); | ||
266 | store.Data = Image.Data; | ||
267 | store.Name = Image.Name; | ||
268 | store.UUID = Image.FullID; | ||
269 | db.Set(store); | ||
270 | db.Commit(); | ||
271 | } | ||
272 | catch (Exception e) | ||
273 | { | ||
274 | MainConsole.Instance.Error(e.Message); | ||
275 | } | ||
276 | |||
277 | } | ||
278 | |||
279 | private void LoadAsset(AssetBase info, bool image, string filename) | ||
280 | { | ||
281 | //should request Asset from storage manager | ||
282 | //but for now read from file | ||
283 | |||
284 | string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; | ||
285 | string fileName = Path.Combine(dataPath, filename); | ||
286 | FileInfo fInfo = new FileInfo(fileName); | ||
287 | long numBytes = fInfo.Length; | ||
288 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); | ||
289 | byte[] idata = new byte[numBytes]; | ||
290 | BinaryReader br = new BinaryReader(fStream); | ||
291 | idata = br.ReadBytes((int)numBytes); | ||
292 | br.Close(); | ||
293 | fStream.Close(); | ||
294 | info.Data = idata; | ||
295 | //info.loaded=true; | ||
296 | } | ||
297 | } | ||
298 | } | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs b/OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs deleted file mode 100644 index 9b6a9ff..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Local/LocalGridServer.cs +++ /dev/null | |||
@@ -1,158 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Threading; | ||
31 | using System.IO; | ||
32 | using OpenSim.Framework.Interfaces; | ||
33 | using OpenSim.Framework.Types; | ||
34 | using OpenSim.Framework.Console; | ||
35 | using libsecondlife; | ||
36 | using Db4objects.Db4o; | ||
37 | using Db4objects.Db4o.Query; | ||
38 | using System.Collections; | ||
39 | |||
40 | namespace OpenSim.GridInterfaces.Local | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// | ||
44 | /// </summary> | ||
45 | /// | ||
46 | public class LocalGridPlugin : IGridPlugin | ||
47 | { | ||
48 | public LocalGridPlugin() | ||
49 | { | ||
50 | |||
51 | } | ||
52 | |||
53 | public IGridServer GetGridServer() | ||
54 | { | ||
55 | return(new LocalGridServer()); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | public class LocalGridServer : LocalGridBase | ||
60 | { | ||
61 | public List<Login> Sessions = new List<Login>(); | ||
62 | |||
63 | public LocalGridServer() | ||
64 | { | ||
65 | Sessions = new List<Login>(); | ||
66 | MainConsole.Instance.Verbose("Local Grid Server class created"); | ||
67 | } | ||
68 | |||
69 | public override bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port) | ||
70 | { | ||
71 | return true; | ||
72 | } | ||
73 | |||
74 | public override string GetName() | ||
75 | { | ||
76 | return "Local"; | ||
77 | } | ||
78 | |||
79 | public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
80 | { | ||
81 | //we are running local | ||
82 | AuthenticateResponse user = new AuthenticateResponse(); | ||
83 | |||
84 | lock(this.Sessions) | ||
85 | { | ||
86 | |||
87 | for(int i = 0; i < Sessions.Count; i++) | ||
88 | { | ||
89 | if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID)) | ||
90 | { | ||
91 | user.Authorised = true; | ||
92 | user.LoginInfo = Sessions[i]; | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | return(user); | ||
97 | } | ||
98 | |||
99 | public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
100 | { | ||
101 | return(true); | ||
102 | } | ||
103 | |||
104 | public override UUIDBlock RequestUUIDBlock() | ||
105 | { | ||
106 | UUIDBlock uuidBlock = new UUIDBlock(); | ||
107 | return(uuidBlock); | ||
108 | } | ||
109 | |||
110 | public override NeighbourInfo[] RequestNeighbours() | ||
111 | { | ||
112 | return null; | ||
113 | } | ||
114 | |||
115 | public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey) | ||
116 | { | ||
117 | |||
118 | } | ||
119 | |||
120 | public override IList RequestMapBlocks(int minX, int minY, int maxX, int maxY) | ||
121 | { | ||
122 | return new ArrayList(); | ||
123 | } | ||
124 | |||
125 | |||
126 | public override void Close() | ||
127 | { | ||
128 | |||
129 | } | ||
130 | |||
131 | /// <summary> | ||
132 | /// used by the local login server to inform us of new sessions | ||
133 | /// </summary> | ||
134 | /// <param name="session"></param> | ||
135 | public override void AddNewSession(Login session) | ||
136 | { | ||
137 | lock(this.Sessions) | ||
138 | { | ||
139 | this.Sessions.Add(session); | ||
140 | } | ||
141 | } | ||
142 | } | ||
143 | |||
144 | public class AssetUUIDQuery : Predicate | ||
145 | { | ||
146 | private LLUUID _findID; | ||
147 | |||
148 | public AssetUUIDQuery(LLUUID find) | ||
149 | { | ||
150 | _findID = find; | ||
151 | } | ||
152 | public bool Match(AssetStorage asset) | ||
153 | { | ||
154 | return (asset.UUID == _findID); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | } | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj deleted file mode 100644 index 1acd1b5..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{546099CD-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.GridInterfaces.Local</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.GridInterfaces.Local</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System" > | ||
70 | <HintPath>System.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Xml" > | ||
74 | <HintPath>System.Xml.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
80 | <Name>OpenSim.Framework</Name> | ||
81 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
82 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
83 | <Private>False</Private> | ||
84 | </ProjectReference> | ||
85 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
86 | <Name>OpenSim.Framework.Console</Name> | ||
87 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
88 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
89 | <Private>False</Private> | ||
90 | </ProjectReference> | ||
91 | </ItemGroup> | ||
92 | <ItemGroup> | ||
93 | <Compile Include="AssemblyInfo.cs"> | ||
94 | <SubType>Code</SubType> | ||
95 | </Compile> | ||
96 | <Compile Include="LocalAssetServer.cs"> | ||
97 | <SubType>Code</SubType> | ||
98 | </Compile> | ||
99 | <Compile Include="LocalGridServer.cs"> | ||
100 | <SubType>Code</SubType> | ||
101 | </Compile> | ||
102 | </ItemGroup> | ||
103 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
104 | <PropertyGroup> | ||
105 | <PreBuildEvent> | ||
106 | </PreBuildEvent> | ||
107 | <PostBuildEvent> | ||
108 | </PostBuildEvent> | ||
109 | </PropertyGroup> | ||
110 | </Project> | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build b/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build deleted file mode 100644 index c3c4ae4..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.GridInterfaces.Local" 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.GridInterfaces.Local" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="LocalAssetServer.cs" /> | ||
16 | <include name="LocalGridServer.cs" /> | ||
17 | </sources> | ||
18 | <references basedir="${project::get-base-directory()}"> | ||
19 | <lib> | ||
20 | <include name="${project::get-base-directory()}" /> | ||
21 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
22 | </lib> | ||
23 | <include name="../../../bin/Db4objects.Db4o.dll" /> | ||
24 | <include name="../../../bin/libsecondlife.dll" /> | ||
25 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
26 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> | ||
27 | <include name="System.dll" /> | ||
28 | <include name="System.Xml.dll" /> | ||
29 | </references> | ||
30 | </csc> | ||
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
32 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
33 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
34 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
35 | <include name="*.dll"/> | ||
36 | <include name="*.exe"/> | ||
37 | </fileset> | ||
38 | </copy> | ||
39 | </target> | ||
40 | <target name="clean"> | ||
41 | <delete dir="${bin.dir}" failonerror="false" /> | ||
42 | <delete dir="${obj.dir}" failonerror="false" /> | ||
43 | </target> | ||
44 | <target name="doc" description="Creates documentation."> | ||
45 | </target> | ||
46 | </project> | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs deleted file mode 100644 index 51596d0..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System.Reflection; | ||
29 | using System.Runtime.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("RemoteGridServers")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("RemoteGridServers")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj deleted file mode 100644 index 11aacac..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{B55C0B5D-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.GridInterfaces.Remote</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.GridInterfaces.Remote</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libsecondlife.dll" > | ||
62 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Xml" > | ||
70 | <HintPath>System.Xml.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | </ItemGroup> | ||
74 | <ItemGroup> | ||
75 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
76 | <Name>OpenSim.Framework</Name> | ||
77 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
79 | <Private>False</Private> | ||
80 | </ProjectReference> | ||
81 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
82 | <Name>OpenSim.Framework.Console</Name> | ||
83 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
84 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
85 | <Private>False</Private> | ||
86 | </ProjectReference> | ||
87 | <ProjectReference Include="..\..\..\Common\XmlRpcCS\XMLRPC.csproj"> | ||
88 | <Name>XMLRPC</Name> | ||
89 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | ||
90 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
91 | <Private>False</Private> | ||
92 | </ProjectReference> | ||
93 | </ItemGroup> | ||
94 | <ItemGroup> | ||
95 | <Compile Include="AssemblyInfo.cs"> | ||
96 | <SubType>Code</SubType> | ||
97 | </Compile> | ||
98 | <Compile Include="RemoteAssetServer.cs"> | ||
99 | <SubType>Code</SubType> | ||
100 | </Compile> | ||
101 | <Compile Include="RemoteGridServer.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | </ItemGroup> | ||
105 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
106 | <PropertyGroup> | ||
107 | <PreBuildEvent> | ||
108 | </PreBuildEvent> | ||
109 | <PostBuildEvent> | ||
110 | </PostBuildEvent> | ||
111 | </PropertyGroup> | ||
112 | </Project> | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build b/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build deleted file mode 100644 index 860251f..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.GridInterfaces.Remote" 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.GridInterfaces.Remote" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="RemoteAssetServer.cs" /> | ||
16 | <include name="RemoteGridServer.cs" /> | ||
17 | </sources> | ||
18 | <references basedir="${project::get-base-directory()}"> | ||
19 | <lib> | ||
20 | <include name="${project::get-base-directory()}" /> | ||
21 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
22 | </lib> | ||
23 | <include name="../../../bin/libsecondlife.dll" /> | ||
24 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
25 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> | ||
26 | <include name="System.dll" /> | ||
27 | <include name="System.Xml.dll" /> | ||
28 | <include name="../../../bin/XMLRPC.dll" /> | ||
29 | </references> | ||
30 | </csc> | ||
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
32 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
33 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
34 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
35 | <include name="*.dll"/> | ||
36 | <include name="*.exe"/> | ||
37 | </fileset> | ||
38 | </copy> | ||
39 | </target> | ||
40 | <target name="clean"> | ||
41 | <delete dir="${bin.dir}" failonerror="false" /> | ||
42 | <delete dir="${obj.dir}" failonerror="false" /> | ||
43 | </target> | ||
44 | <target name="doc" description="Creates documentation."> | ||
45 | </target> | ||
46 | </project> | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs deleted file mode 100644 index 550fec6..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Threading; | ||
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
34 | using System.IO; | ||
35 | using libsecondlife; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework.Types; | ||
38 | using OpenSim.Framework.Utilities; | ||
39 | |||
40 | namespace OpenSim.GridInterfaces.Remote | ||
41 | { | ||
42 | public class RemoteAssetServer : IAssetServer | ||
43 | { | ||
44 | private IAssetReceiver _receiver; | ||
45 | private BlockingQueue<ARequest> _assetRequests; | ||
46 | private Thread _remoteAssetServerThread; | ||
47 | private string AssetServerUrl; | ||
48 | private string AssetSendKey; | ||
49 | |||
50 | public RemoteAssetServer() | ||
51 | { | ||
52 | this._assetRequests = new BlockingQueue<ARequest>(); | ||
53 | this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); | ||
54 | this._remoteAssetServerThread.IsBackground = true; | ||
55 | this._remoteAssetServerThread.Start(); | ||
56 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Remote Asset Server class created"); | ||
57 | } | ||
58 | |||
59 | public void SetReceiver(IAssetReceiver receiver) | ||
60 | { | ||
61 | this._receiver = receiver; | ||
62 | } | ||
63 | |||
64 | public void RequestAsset(LLUUID assetID, bool isTexture) | ||
65 | { | ||
66 | ARequest req = new ARequest(); | ||
67 | req.AssetID = assetID; | ||
68 | req.IsTexture = isTexture; | ||
69 | this._assetRequests.Enqueue(req); | ||
70 | } | ||
71 | |||
72 | public void UpdateAsset(AssetBase asset) | ||
73 | { | ||
74 | |||
75 | } | ||
76 | |||
77 | public void UploadNewAsset(AssetBase asset) | ||
78 | { | ||
79 | Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | ||
80 | string ret = Windows1252Encoding.GetString(asset.Data); | ||
81 | byte[] buffer = Windows1252Encoding.GetBytes(ret); | ||
82 | WebClient client = new WebClient(); | ||
83 | client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer); | ||
84 | |||
85 | } | ||
86 | |||
87 | public void SetServerInfo(string ServerUrl, string ServerKey) | ||
88 | { | ||
89 | this.AssetServerUrl = ServerUrl; | ||
90 | this.AssetSendKey = ServerKey; | ||
91 | } | ||
92 | |||
93 | private void RunRequests() | ||
94 | { | ||
95 | while (true) | ||
96 | { | ||
97 | //we need to add support for the asset server not knowing about a requested asset | ||
98 | // 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM | ||
99 | ARequest req = this._assetRequests.Dequeue(); | ||
100 | LLUUID assetID = req.AssetID; | ||
101 | // OpenSim.Framework.Console.MainConsole.Instance.Verbose(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID); | ||
102 | WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID); | ||
103 | WebResponse AssetResponse = AssetLoad.GetResponse(); | ||
104 | byte[] idata = new byte[(int)AssetResponse.ContentLength]; | ||
105 | BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); | ||
106 | idata = br.ReadBytes((int)AssetResponse.ContentLength); | ||
107 | br.Close(); | ||
108 | |||
109 | AssetBase asset = new AssetBase(); | ||
110 | asset.FullID = assetID; | ||
111 | asset.Data = idata; | ||
112 | _receiver.AssetReceived(asset, req.IsTexture); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | public void Close() | ||
117 | { | ||
118 | |||
119 | } | ||
120 | } | ||
121 | |||
122 | public class RemoteAssetPlugin : IAssetPlugin | ||
123 | { | ||
124 | public RemoteAssetPlugin() | ||
125 | { | ||
126 | |||
127 | } | ||
128 | |||
129 | public IAssetServer GetAssetServer() | ||
130 | { | ||
131 | return (new RemoteAssetServer()); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | } | ||
diff --git a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs b/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs deleted file mode 100644 index 7c93d43..0000000 --- a/OpenSim/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Threading; | ||
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
34 | using System.IO; | ||
35 | using libsecondlife; | ||
36 | using Nwc.XmlRpc; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework.Types; | ||
39 | using OpenSim.Framework.Console; | ||
40 | |||
41 | namespace OpenSim.GridInterfaces.Remote | ||
42 | { | ||
43 | public class RemoteGridServer : RemoteGridBase | ||
44 | { | ||
45 | private string GridServerUrl; | ||
46 | private string GridSendKey; | ||
47 | private string GridRecvKey; | ||
48 | private Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>(); | ||
49 | private ArrayList simneighbours = new ArrayList(); | ||
50 | private Hashtable griddatahash; | ||
51 | |||
52 | public override Dictionary<uint, AgentCircuitData> agentcircuits | ||
53 | { | ||
54 | get { return AgentCircuits; } | ||
55 | set { AgentCircuits = value; } | ||
56 | } | ||
57 | |||
58 | public override ArrayList neighbours | ||
59 | { | ||
60 | get { return simneighbours; } | ||
61 | set { simneighbours = value; } | ||
62 | } | ||
63 | |||
64 | public override Hashtable GridData | ||
65 | { | ||
66 | get { return griddatahash; } | ||
67 | set { griddatahash = value; } | ||
68 | } | ||
69 | |||
70 | |||
71 | public RemoteGridServer() | ||
72 | { | ||
73 | MainConsole.Instance.Notice("Remote Grid Server class created"); | ||
74 | } | ||
75 | |||
76 | public override bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port) | ||
77 | { | ||
78 | Hashtable GridParams = new Hashtable(); | ||
79 | GridParams["authkey"] = GridSendKey; | ||
80 | GridParams["UUID"] = SimUUID.ToString(); | ||
81 | GridParams["sim_ip"] = sim_ip; | ||
82 | GridParams["sim_port"] = sim_port.ToString(); | ||
83 | ArrayList SendParams = new ArrayList(); | ||
84 | SendParams.Add(GridParams); | ||
85 | |||
86 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | ||
87 | XmlRpcResponse GridResp = GridReq.Send(this.GridServerUrl, 3000); | ||
88 | Hashtable GridRespData = (Hashtable)GridResp.Value; | ||
89 | this.griddatahash = GridRespData; | ||
90 | |||
91 | if (GridRespData.ContainsKey("error")) | ||
92 | { | ||
93 | string errorstring = (string)GridRespData["error"]; | ||
94 | MainConsole.Instance.Warn("Error connecting to grid:"); | ||
95 | MainConsole.Instance.Warn(errorstring); | ||
96 | return false; | ||
97 | } | ||
98 | this.neighbours = (ArrayList)GridRespData["neighbours"]; | ||
99 | Console.WriteLine(simneighbours.Count); | ||
100 | return true; | ||
101 | } | ||
102 | |||
103 | public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) | ||
104 | { | ||
105 | AgentCircuitData validcircuit = null; | ||
106 | if (this.AgentCircuits.ContainsKey(circuitcode)) | ||
107 | { | ||
108 | validcircuit = this.AgentCircuits[circuitcode]; | ||
109 | } | ||
110 | AuthenticateResponse user = new AuthenticateResponse(); | ||
111 | if (validcircuit == null) | ||
112 | { | ||
113 | //don't have this circuit code in our list | ||
114 | user.Authorised = false; | ||
115 | return (user); | ||
116 | } | ||
117 | |||
118 | if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) | ||
119 | { | ||
120 | // YAY! Valid login | ||
121 | user.Authorised = true; | ||
122 | user.LoginInfo = new Login(); | ||
123 | user.LoginInfo.Agent = agentID; | ||
124 | user.LoginInfo.Session = sessionID; | ||
125 | user.LoginInfo.SecureSession = validcircuit.SecureSessionID; | ||
126 | user.LoginInfo.First = validcircuit.firstname; | ||
127 | user.LoginInfo.Last = validcircuit.lastname; | ||
128 | } | ||
129 | else | ||
130 | { | ||
131 | // Invalid | ||
132 | user.Authorised = false; | ||
133 | } | ||
134 | |||
135 | return (user); | ||
136 | } | ||
137 | |||
138 | public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
139 | { | ||
140 | WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString()); | ||
141 | DeleteSession.Method = "DELETE"; | ||
142 | DeleteSession.ContentType = "text/plaintext"; | ||
143 | DeleteSession.ContentLength = 0; | ||
144 | |||
145 | StreamWriter stOut = new StreamWriter(DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII); | ||
146 | stOut.Write(""); | ||
147 | stOut.Close(); | ||
148 | |||
149 | StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream()); | ||
150 | string GridResponse = stIn.ReadToEnd(); | ||
151 | stIn.Close(); | ||
152 | return (true); | ||
153 | } | ||
154 | |||
155 | public override UUIDBlock RequestUUIDBlock() | ||
156 | { | ||
157 | UUIDBlock uuidBlock = new UUIDBlock(); | ||
158 | return (uuidBlock); | ||
159 | } | ||
160 | |||
161 | public override NeighbourInfo[] RequestNeighbours() | ||
162 | { | ||
163 | return null; | ||
164 | } | ||
165 | |||
166 | public override IList RequestMapBlocks(int minX, int minY, int maxX, int maxY) | ||
167 | { | ||
168 | Hashtable param = new Hashtable(); | ||
169 | param["xmin"] = minX; | ||
170 | param["ymin"] = minY; | ||
171 | param["xmax"] = maxX; | ||
172 | param["ymax"] = maxY; | ||
173 | IList parameters = new ArrayList(); | ||
174 | parameters.Add(param); | ||
175 | XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); | ||
176 | XmlRpcResponse resp = req.Send(GridServerUrl, 3000); | ||
177 | Hashtable respData = (Hashtable)resp.Value; | ||
178 | return (IList)respData["sim-profiles"]; | ||
179 | } | ||
180 | |||
181 | public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey) | ||
182 | { | ||
183 | this.GridServerUrl = ServerUrl; | ||
184 | this.GridSendKey = SendKey; | ||
185 | this.GridRecvKey = RecvKey; | ||
186 | } | ||
187 | |||
188 | public override string GetName() | ||
189 | { | ||
190 | return "Remote"; | ||
191 | } | ||
192 | |||
193 | public override void Close() | ||
194 | { | ||
195 | |||
196 | } | ||
197 | } | ||
198 | |||
199 | public class RemoteGridPlugin : IGridPlugin | ||
200 | { | ||
201 | public RemoteGridPlugin() | ||
202 | { | ||
203 | |||
204 | } | ||
205 | |||
206 | public IGridServer GetGridServer() | ||
207 | { | ||
208 | return (new RemoteGridServer()); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | } | ||
diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs deleted file mode 100644 index 177c49d..0000000 --- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System.Reflection; | ||
29 | using System.Runtime.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("PhysXplugin")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("PhysXplugin")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs deleted file mode 100644 index 3d8c9aa..0000000 --- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ /dev/null | |||
@@ -1,278 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Physics.Manager; | ||
31 | |||
32 | namespace OpenSim.Physics.BasicPhysicsPlugin | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Will be the PhysX plugin but for now will be a very basic physics engine | ||
36 | /// </summary> | ||
37 | public class BasicPhysicsPlugin : IPhysicsPlugin | ||
38 | { | ||
39 | private BasicScene _mScene; | ||
40 | |||
41 | public BasicPhysicsPlugin() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | public bool Init() | ||
47 | { | ||
48 | return true; | ||
49 | } | ||
50 | |||
51 | public PhysicsScene GetScene() | ||
52 | { | ||
53 | if(_mScene == null) | ||
54 | { | ||
55 | _mScene = new BasicScene(); | ||
56 | } | ||
57 | return(_mScene); | ||
58 | } | ||
59 | |||
60 | public string GetName() | ||
61 | { | ||
62 | return("basicphysics"); | ||
63 | } | ||
64 | |||
65 | public void Dispose() | ||
66 | { | ||
67 | |||
68 | } | ||
69 | } | ||
70 | |||
71 | public class BasicScene :PhysicsScene | ||
72 | { | ||
73 | private List<BasicActor> _actors = new List<BasicActor>(); | ||
74 | private float[] _heightMap; | ||
75 | |||
76 | public BasicScene() | ||
77 | { | ||
78 | |||
79 | } | ||
80 | |||
81 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
82 | { | ||
83 | BasicActor act = new BasicActor(); | ||
84 | act.Position = position; | ||
85 | _actors.Add(act); | ||
86 | return act; | ||
87 | } | ||
88 | |||
89 | public override void RemoveAvatar(PhysicsActor actor) | ||
90 | { | ||
91 | BasicActor act = (BasicActor)actor; | ||
92 | if(_actors.Contains(act)) | ||
93 | { | ||
94 | _actors.Remove(act); | ||
95 | } | ||
96 | |||
97 | } | ||
98 | |||
99 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
100 | { | ||
101 | return null; | ||
102 | } | ||
103 | |||
104 | public override void Simulate(float timeStep) | ||
105 | { | ||
106 | foreach (BasicActor actor in _actors) | ||
107 | { | ||
108 | actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); | ||
109 | actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); | ||
110 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); | ||
111 | /*if(actor.Flying) | ||
112 | { | ||
113 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); | ||
114 | } | ||
115 | else | ||
116 | { | ||
117 | actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep); | ||
118 | } | ||
119 | if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1)) | ||
120 | {*/ | ||
121 | if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256)) | ||
122 | { | ||
123 | actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1; | ||
124 | } | ||
125 | //} | ||
126 | |||
127 | |||
128 | |||
129 | // This code needs sorting out - border crossings etc | ||
130 | /* if(actor.Position.X<0) | ||
131 | { | ||
132 | ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); | ||
133 | actor.Position.X = 0; | ||
134 | actor.Velocity.X = 0; | ||
135 | } | ||
136 | if(actor.Position.Y < 0) | ||
137 | { | ||
138 | ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); | ||
139 | actor.Position.Y = 0; | ||
140 | actor.Velocity.Y = 0; | ||
141 | } | ||
142 | if(actor.Position.X > 255) | ||
143 | { | ||
144 | ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); | ||
145 | actor.Position.X = 255; | ||
146 | actor.Velocity.X = 0; | ||
147 | } | ||
148 | if(actor.Position.Y > 255) | ||
149 | { | ||
150 | ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); | ||
151 | actor.Position.Y = 255; | ||
152 | actor.Velocity.X = 0; | ||
153 | }*/ | ||
154 | } | ||
155 | } | ||
156 | |||
157 | public override void GetResults() | ||
158 | { | ||
159 | |||
160 | } | ||
161 | |||
162 | public override bool IsThreaded | ||
163 | { | ||
164 | get | ||
165 | { | ||
166 | return(false); // for now we won't be multithreaded | ||
167 | } | ||
168 | } | ||
169 | |||
170 | public override void SetTerrain(float[] heightMap) | ||
171 | { | ||
172 | this._heightMap = heightMap; | ||
173 | } | ||
174 | |||
175 | public override void DeleteTerrain() | ||
176 | { | ||
177 | |||
178 | } | ||
179 | } | ||
180 | |||
181 | public class BasicActor : PhysicsActor | ||
182 | { | ||
183 | private PhysicsVector _position; | ||
184 | private PhysicsVector _velocity; | ||
185 | private PhysicsVector _acceleration; | ||
186 | private bool flying; | ||
187 | public BasicActor() | ||
188 | { | ||
189 | _velocity = new PhysicsVector(); | ||
190 | _position = new PhysicsVector(); | ||
191 | _acceleration = new PhysicsVector(); | ||
192 | } | ||
193 | |||
194 | public override bool Flying | ||
195 | { | ||
196 | get | ||
197 | { | ||
198 | return false; | ||
199 | } | ||
200 | set | ||
201 | { | ||
202 | flying= value; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | public override PhysicsVector Position | ||
207 | { | ||
208 | get | ||
209 | { | ||
210 | return _position; | ||
211 | } | ||
212 | set | ||
213 | { | ||
214 | _position = value; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | public override PhysicsVector Velocity | ||
219 | { | ||
220 | get | ||
221 | { | ||
222 | return _velocity; | ||
223 | } | ||
224 | set | ||
225 | { | ||
226 | _velocity = value; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | public override Axiom.MathLib.Quaternion Orientation | ||
231 | { | ||
232 | get | ||
233 | { | ||
234 | return Axiom.MathLib.Quaternion.Identity; | ||
235 | } | ||
236 | set | ||
237 | { | ||
238 | |||
239 | } | ||
240 | } | ||
241 | |||
242 | public override PhysicsVector Acceleration | ||
243 | { | ||
244 | get | ||
245 | { | ||
246 | return _acceleration; | ||
247 | } | ||
248 | |||
249 | } | ||
250 | |||
251 | public override bool Kinematic | ||
252 | { | ||
253 | get | ||
254 | { | ||
255 | return true; | ||
256 | } | ||
257 | set | ||
258 | { | ||
259 | |||
260 | } | ||
261 | } | ||
262 | public void SetAcceleration (PhysicsVector accel) | ||
263 | { | ||
264 | this._acceleration = accel; | ||
265 | } | ||
266 | |||
267 | public override void AddForce(PhysicsVector force) | ||
268 | { | ||
269 | |||
270 | } | ||
271 | |||
272 | public override void SetMomentum(PhysicsVector momentum) | ||
273 | { | ||
274 | |||
275 | } | ||
276 | } | ||
277 | |||
278 | } | ||
diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj deleted file mode 100644 index f88eb32..0000000 --- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{4F874463-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Physics.BasicPhysicsPlugin</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Physics.BasicPhysicsPlugin</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\Physics\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\Physics\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Axiom.MathLib.dll" > | ||
62 | <HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | </ItemGroup> | ||
70 | <ItemGroup> | ||
71 | <ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj"> | ||
72 | <Name>OpenSim.Physics.Manager</Name> | ||
73 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
74 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
75 | <Private>False</Private> | ||
76 | </ProjectReference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | <Compile Include="AssemblyInfo.cs"> | ||
80 | <SubType>Code</SubType> | ||
81 | </Compile> | ||
82 | <Compile Include="BasicPhysicsPlugin.cs"> | ||
83 | <SubType>Code</SubType> | ||
84 | </Compile> | ||
85 | </ItemGroup> | ||
86 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
87 | <PropertyGroup> | ||
88 | <PreBuildEvent> | ||
89 | </PreBuildEvent> | ||
90 | <PostBuildEvent> | ||
91 | </PostBuildEvent> | ||
92 | </PropertyGroup> | ||
93 | </Project> | ||
diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build deleted file mode 100644 index 00ca3f9..0000000 --- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Physics.BasicPhysicsPlugin" 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.Physics.BasicPhysicsPlugin" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="BasicPhysicsPlugin.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="../../../bin/Axiom.MathLib.dll" /> | ||
23 | <include name="../../../bin/OpenSim.Physics.Manager.dll" /> | ||
24 | <include name="System.dll" /> | ||
25 | </references> | ||
26 | </csc> | ||
27 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/Physics/" /> | ||
28 | <mkdir dir="${project::get-base-directory()}/../../../bin/Physics/"/> | ||
29 | <copy todir="${project::get-base-directory()}/../../../bin/Physics/"> | ||
30 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
31 | <include name="*.dll"/> | ||
32 | <include name="*.exe"/> | ||
33 | </fileset> | ||
34 | </copy> | ||
35 | </target> | ||
36 | <target name="clean"> | ||
37 | <delete dir="${bin.dir}" failonerror="false" /> | ||
38 | <delete dir="${obj.dir}" failonerror="false" /> | ||
39 | </target> | ||
40 | <target name="doc" description="Creates documentation."> | ||
41 | </target> | ||
42 | </project> | ||
diff --git a/OpenSim/OpenSim.Physics/Manager/AssemblyInfo.cs b/OpenSim/OpenSim.Physics/Manager/AssemblyInfo.cs deleted file mode 100644 index 132f64a..0000000 --- a/OpenSim/OpenSim.Physics/Manager/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System.Reflection; | ||
29 | using System.Runtime.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("PhysicsManager")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("PhysicsManager")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj b/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj deleted file mode 100644 index 347a649..0000000 --- a/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{8BE16150-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Physics.Manager</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Physics.Manager</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Axiom.MathLib.dll" > | ||
62 | <HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Xml" > | ||
70 | <HintPath>System.Xml.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | </ItemGroup> | ||
74 | <ItemGroup> | ||
75 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
76 | <Name>OpenSim.Framework</Name> | ||
77 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
79 | <Private>False</Private> | ||
80 | </ProjectReference> | ||
81 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
82 | <Name>OpenSim.Framework.Console</Name> | ||
83 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
84 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
85 | <Private>False</Private> | ||
86 | </ProjectReference> | ||
87 | </ItemGroup> | ||
88 | <ItemGroup> | ||
89 | <Compile Include="AssemblyInfo.cs"> | ||
90 | <SubType>Code</SubType> | ||
91 | </Compile> | ||
92 | <Compile Include="PhysicsActor.cs"> | ||
93 | <SubType>Code</SubType> | ||
94 | </Compile> | ||
95 | <Compile Include="PhysicsManager.cs"> | ||
96 | <SubType>Code</SubType> | ||
97 | </Compile> | ||
98 | <Compile Include="PhysicsScene.cs"> | ||
99 | <SubType>Code</SubType> | ||
100 | </Compile> | ||
101 | <Compile Include="PhysicsVector.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | </ItemGroup> | ||
105 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
106 | <PropertyGroup> | ||
107 | <PreBuildEvent> | ||
108 | </PreBuildEvent> | ||
109 | <PostBuildEvent> | ||
110 | </PostBuildEvent> | ||
111 | </PropertyGroup> | ||
112 | </Project> | ||
diff --git a/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build b/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build deleted file mode 100644 index fc3e1e6..0000000 --- a/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Physics.Manager" 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.Physics.Manager" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="PhysicsActor.cs" /> | ||
16 | <include name="PhysicsManager.cs" /> | ||
17 | <include name="PhysicsScene.cs" /> | ||
18 | <include name="PhysicsVector.cs" /> | ||
19 | </sources> | ||
20 | <references basedir="${project::get-base-directory()}"> | ||
21 | <lib> | ||
22 | <include name="${project::get-base-directory()}" /> | ||
23 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
24 | </lib> | ||
25 | <include name="../../../bin/Axiom.MathLib.dll" /> | ||
26 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
27 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> | ||
28 | <include name="System.dll" /> | ||
29 | <include name="System.Xml.dll" /> | ||
30 | </references> | ||
31 | </csc> | ||
32 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
33 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
34 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
35 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
36 | <include name="*.dll"/> | ||
37 | <include name="*.exe"/> | ||
38 | </fileset> | ||
39 | </copy> | ||
40 | </target> | ||
41 | <target name="clean"> | ||
42 | <delete dir="${bin.dir}" failonerror="false" /> | ||
43 | <delete dir="${obj.dir}" failonerror="false" /> | ||
44 | </target> | ||
45 | <target name="doc" description="Creates documentation."> | ||
46 | </target> | ||
47 | </project> | ||
diff --git a/OpenSim/OpenSim.Physics/Manager/PhysicsActor.cs b/OpenSim/OpenSim.Physics/Manager/PhysicsActor.cs deleted file mode 100644 index 9ff94c4..0000000 --- a/OpenSim/OpenSim.Physics/Manager/PhysicsActor.cs +++ /dev/null | |||
@@ -1,162 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Physics.Manager | ||
34 | { | ||
35 | public abstract class PhysicsActor | ||
36 | { | ||
37 | public static PhysicsActor Null | ||
38 | { | ||
39 | get | ||
40 | { | ||
41 | return new NullPhysicsActor(); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | public abstract PhysicsVector Position | ||
46 | { | ||
47 | get; | ||
48 | set; | ||
49 | } | ||
50 | |||
51 | public abstract PhysicsVector Velocity | ||
52 | { | ||
53 | get; | ||
54 | set; | ||
55 | } | ||
56 | |||
57 | public abstract PhysicsVector Acceleration | ||
58 | { | ||
59 | get; | ||
60 | } | ||
61 | |||
62 | public abstract Axiom.MathLib.Quaternion Orientation | ||
63 | { | ||
64 | get; | ||
65 | set; | ||
66 | } | ||
67 | |||
68 | public abstract bool Flying | ||
69 | { | ||
70 | get; | ||
71 | set; | ||
72 | } | ||
73 | |||
74 | public abstract bool Kinematic | ||
75 | { | ||
76 | get; | ||
77 | set; | ||
78 | } | ||
79 | |||
80 | public abstract void AddForce(PhysicsVector force); | ||
81 | |||
82 | public abstract void SetMomentum(PhysicsVector momentum); | ||
83 | } | ||
84 | |||
85 | public class NullPhysicsActor : PhysicsActor | ||
86 | { | ||
87 | public override PhysicsVector Position | ||
88 | { | ||
89 | get | ||
90 | { | ||
91 | return PhysicsVector.Zero; | ||
92 | } | ||
93 | set | ||
94 | { | ||
95 | return; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | public override PhysicsVector Velocity | ||
100 | { | ||
101 | get | ||
102 | { | ||
103 | return PhysicsVector.Zero; | ||
104 | } | ||
105 | set | ||
106 | { | ||
107 | return; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | public override Axiom.MathLib.Quaternion Orientation | ||
112 | { | ||
113 | get | ||
114 | { | ||
115 | return Axiom.MathLib.Quaternion.Identity; | ||
116 | } | ||
117 | set | ||
118 | { | ||
119 | |||
120 | } | ||
121 | } | ||
122 | |||
123 | public override PhysicsVector Acceleration | ||
124 | { | ||
125 | get { return PhysicsVector.Zero; } | ||
126 | } | ||
127 | |||
128 | public override bool Flying | ||
129 | { | ||
130 | get | ||
131 | { | ||
132 | return false; | ||
133 | } | ||
134 | set | ||
135 | { | ||
136 | return; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | public override bool Kinematic | ||
141 | { | ||
142 | get | ||
143 | { | ||
144 | return true; | ||
145 | } | ||
146 | set | ||
147 | { | ||
148 | return; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | public override void AddForce(PhysicsVector force) | ||
153 | { | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | public override void SetMomentum(PhysicsVector momentum) | ||
158 | { | ||
159 | return; | ||
160 | } | ||
161 | } | ||
162 | } | ||
diff --git a/OpenSim/OpenSim.Physics/Manager/PhysicsManager.cs b/OpenSim/OpenSim.Physics/Manager/PhysicsManager.cs deleted file mode 100644 index f85c098..0000000 --- a/OpenSim/OpenSim.Physics/Manager/PhysicsManager.cs +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Collections; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using Axiom.MathLib; | ||
34 | using OpenSim.Framework.Console; | ||
35 | |||
36 | namespace OpenSim.Physics.Manager | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Description of MyClass. | ||
40 | /// </summary> | ||
41 | public class PhysicsManager | ||
42 | { | ||
43 | private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>(); | ||
44 | |||
45 | public PhysicsManager() | ||
46 | { | ||
47 | |||
48 | } | ||
49 | |||
50 | public PhysicsScene GetPhysicsScene(string engineName) | ||
51 | { | ||
52 | if (String.IsNullOrEmpty(engineName)) | ||
53 | { | ||
54 | return new NullPhysicsScene(); | ||
55 | } | ||
56 | |||
57 | if(_plugins.ContainsKey(engineName)) | ||
58 | { | ||
59 | MainConsole.Instance.Notice("creating "+engineName); | ||
60 | return _plugins[engineName].GetScene(); | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | MainConsole.Instance.Warn("couldn't find physicsEngine: {0}",engineName); | ||
65 | throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName)); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | public void LoadPlugins() | ||
70 | { | ||
71 | string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics"); | ||
72 | string[] pluginFiles = Directory.GetFiles(path, "*.dll"); | ||
73 | |||
74 | |||
75 | for(int i= 0; i<pluginFiles.Length; i++) | ||
76 | { | ||
77 | this.AddPlugin(pluginFiles[i]); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | private void AddPlugin(string FileName) | ||
82 | { | ||
83 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
84 | |||
85 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
86 | { | ||
87 | if (pluginType.IsPublic) | ||
88 | { | ||
89 | if (!pluginType.IsAbstract) | ||
90 | { | ||
91 | Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); | ||
92 | |||
93 | if (typeInterface != null) | ||
94 | { | ||
95 | IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
96 | plug.Init(); | ||
97 | this._plugins.Add(plug.GetName(),plug); | ||
98 | |||
99 | } | ||
100 | |||
101 | typeInterface = null; | ||
102 | } | ||
103 | } | ||
104 | } | ||
105 | |||
106 | pluginAssembly = null; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | public interface IPhysicsPlugin | ||
111 | { | ||
112 | bool Init(); | ||
113 | PhysicsScene GetScene(); | ||
114 | string GetName(); | ||
115 | void Dispose(); | ||
116 | } | ||
117 | } | ||
diff --git a/OpenSim/OpenSim.Physics/Manager/PhysicsScene.cs b/OpenSim/OpenSim.Physics/Manager/PhysicsScene.cs deleted file mode 100644 index 8128457..0000000 --- a/OpenSim/OpenSim.Physics/Manager/PhysicsScene.cs +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Framework.Console; | ||
33 | |||
34 | namespace OpenSim.Physics.Manager | ||
35 | { | ||
36 | public abstract class PhysicsScene | ||
37 | { | ||
38 | public static PhysicsScene Null | ||
39 | { | ||
40 | get | ||
41 | { | ||
42 | return new NullPhysicsScene(); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | public abstract PhysicsActor AddAvatar(PhysicsVector position); | ||
47 | |||
48 | public abstract void RemoveAvatar(PhysicsActor actor); | ||
49 | |||
50 | public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); | ||
51 | |||
52 | public abstract void Simulate(float timeStep); | ||
53 | |||
54 | public abstract void GetResults(); | ||
55 | |||
56 | public abstract void SetTerrain(float[] heightMap); | ||
57 | |||
58 | public abstract void DeleteTerrain(); | ||
59 | |||
60 | public abstract bool IsThreaded | ||
61 | { | ||
62 | get; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | public class NullPhysicsScene : PhysicsScene | ||
67 | { | ||
68 | private static int m_workIndicator; | ||
69 | |||
70 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
71 | { | ||
72 | MainConsole.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position); | ||
73 | return PhysicsActor.Null; | ||
74 | } | ||
75 | |||
76 | public override void RemoveAvatar(PhysicsActor actor) | ||
77 | { | ||
78 | |||
79 | } | ||
80 | |||
81 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
82 | { | ||
83 | MainConsole.Instance.Verbose( "NullPhysicsScene : AddPrim({0},{1})", position, size); | ||
84 | return PhysicsActor.Null; | ||
85 | } | ||
86 | |||
87 | public override void Simulate(float timeStep) | ||
88 | { | ||
89 | m_workIndicator = (m_workIndicator + 1) % 10; | ||
90 | |||
91 | //OpenSim.Framework.Console.MainConsole.Instance.SetStatus(m_workIndicator.ToString()); | ||
92 | } | ||
93 | |||
94 | public override void GetResults() | ||
95 | { | ||
96 | MainConsole.Instance.Verbose( "NullPhysicsScene : GetResults()"); | ||
97 | } | ||
98 | |||
99 | public override void SetTerrain(float[] heightMap) | ||
100 | { | ||
101 | MainConsole.Instance.Verbose( "NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); | ||
102 | } | ||
103 | |||
104 | public override void DeleteTerrain() | ||
105 | { | ||
106 | |||
107 | } | ||
108 | |||
109 | public override bool IsThreaded | ||
110 | { | ||
111 | get { return false; } | ||
112 | } | ||
113 | } | ||
114 | } | ||
diff --git a/OpenSim/OpenSim.Physics/Manager/PhysicsVector.cs b/OpenSim/OpenSim.Physics/Manager/PhysicsVector.cs deleted file mode 100644 index 8f3514f..0000000 --- a/OpenSim/OpenSim.Physics/Manager/PhysicsVector.cs +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Physics.Manager | ||
34 | { | ||
35 | public class PhysicsVector | ||
36 | { | ||
37 | public float X; | ||
38 | public float Y; | ||
39 | public float Z; | ||
40 | |||
41 | public PhysicsVector() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | public PhysicsVector(float x, float y, float z) | ||
47 | { | ||
48 | X = x; | ||
49 | Y = y; | ||
50 | Z = z; | ||
51 | } | ||
52 | |||
53 | public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/OpenSim.Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/OpenSim.Physics/OdePlugin/AssemblyInfo.cs deleted file mode 100644 index b49c8da..0000000 --- a/OpenSim/OpenSim.Physics/OdePlugin/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System.Reflection; | ||
29 | using System.Runtime.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("RealPhysXplugin")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("RealPhysXplugin")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/OpenSim.Physics/OdePlugin/OdePlugin.cs b/OpenSim/OpenSim.Physics/OdePlugin/OdePlugin.cs deleted file mode 100644 index 6758f76..0000000 --- a/OpenSim/OpenSim.Physics/OdePlugin/OdePlugin.cs +++ /dev/null | |||
@@ -1,457 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Physics.Manager; | ||
31 | using Ode.NET; | ||
32 | |||
33 | namespace OpenSim.Physics.OdePlugin | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// ODE plugin | ||
37 | /// </summary> | ||
38 | public class OdePlugin : IPhysicsPlugin | ||
39 | { | ||
40 | private OdeScene _mScene; | ||
41 | |||
42 | public OdePlugin() | ||
43 | { | ||
44 | |||
45 | } | ||
46 | |||
47 | public bool Init() | ||
48 | { | ||
49 | return true; | ||
50 | } | ||
51 | |||
52 | public PhysicsScene GetScene() | ||
53 | { | ||
54 | if (_mScene == null) | ||
55 | { | ||
56 | _mScene = new OdeScene(); | ||
57 | } | ||
58 | return (_mScene); | ||
59 | } | ||
60 | |||
61 | public string GetName() | ||
62 | { | ||
63 | return ("OpenDynamicsEngine"); | ||
64 | } | ||
65 | |||
66 | public void Dispose() | ||
67 | { | ||
68 | |||
69 | } | ||
70 | } | ||
71 | |||
72 | public class OdeScene : PhysicsScene | ||
73 | { | ||
74 | static public IntPtr world; | ||
75 | static public IntPtr space; | ||
76 | static private IntPtr contactgroup; | ||
77 | static private IntPtr LandGeom; | ||
78 | //static private IntPtr Land; | ||
79 | private double[] _heightmap; | ||
80 | static private d.NearCallback nearCallback = near; | ||
81 | private List<OdeCharacter> _characters = new List<OdeCharacter>(); | ||
82 | private static d.ContactGeom[] contacts = new d.ContactGeom[30]; | ||
83 | private static d.Contact contact; | ||
84 | |||
85 | public OdeScene() | ||
86 | { | ||
87 | contact.surface.mode |= d.ContactFlags.Approx1 | d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP; | ||
88 | contact.surface.mu = 10.0f; | ||
89 | contact.surface.bounce = 0.9f; | ||
90 | contact.surface.soft_erp = 0.005f; | ||
91 | contact.surface.soft_cfm = 0.00003f; | ||
92 | |||
93 | world = d.WorldCreate(); | ||
94 | space = d.HashSpaceCreate(IntPtr.Zero); | ||
95 | contactgroup = d.JointGroupCreate(0); | ||
96 | d.WorldSetGravity(world, 0.0f, 0.0f, -10.0f); | ||
97 | d.WorldSetAutoDisableFlag(world, false); | ||
98 | d.WorldSetContactSurfaceLayer(world, 0.001f); | ||
99 | this._heightmap = new double[65536]; | ||
100 | } | ||
101 | |||
102 | // This function blatantly ripped off from BoxStack.cs | ||
103 | static private void near(IntPtr space, IntPtr g1, IntPtr g2) | ||
104 | { | ||
105 | IntPtr b1 = d.GeomGetBody(g1); | ||
106 | IntPtr b2 = d.GeomGetBody(g2); | ||
107 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) | ||
108 | return; | ||
109 | |||
110 | int count = d.Collide(g1, g2, 500, contacts, d.ContactGeom.SizeOf); | ||
111 | for (int i = 0; i < count; ++i) | ||
112 | { | ||
113 | contact.geom = contacts[i]; | ||
114 | IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact); | ||
115 | d.JointAttach(joint, b1, b2); | ||
116 | } | ||
117 | |||
118 | } | ||
119 | |||
120 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
121 | { | ||
122 | PhysicsVector pos = new PhysicsVector(); | ||
123 | pos.X = position.X; | ||
124 | pos.Y = position.Y; | ||
125 | pos.Z = position.Z + 20; | ||
126 | OdeCharacter newAv = new OdeCharacter(this, pos); | ||
127 | this._characters.Add(newAv); | ||
128 | return newAv; | ||
129 | } | ||
130 | |||
131 | public override void RemoveAvatar(PhysicsActor actor) | ||
132 | { | ||
133 | |||
134 | } | ||
135 | |||
136 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
137 | { | ||
138 | PhysicsVector pos = new PhysicsVector(); | ||
139 | pos.X = position.X; | ||
140 | pos.Y = position.Y; | ||
141 | pos.Z = position.Z; | ||
142 | PhysicsVector siz = new PhysicsVector(); | ||
143 | siz.X = size.X; | ||
144 | siz.Y = size.Y; | ||
145 | siz.Z = size.Z; | ||
146 | return new OdePrim(); | ||
147 | } | ||
148 | |||
149 | public override void Simulate(float timeStep) | ||
150 | { | ||
151 | foreach (OdeCharacter actor in _characters) | ||
152 | { | ||
153 | actor.Move(timeStep); | ||
154 | } | ||
155 | d.SpaceCollide(space, IntPtr.Zero, nearCallback); | ||
156 | for (int i = 0; i < 50; i++) | ||
157 | { | ||
158 | d.WorldQuickStep(world, timeStep * 0.02f); | ||
159 | } | ||
160 | |||
161 | d.JointGroupEmpty(contactgroup); | ||
162 | foreach (OdeCharacter actor in _characters) | ||
163 | { | ||
164 | actor.UpdatePosition(); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | public override void GetResults() | ||
169 | { | ||
170 | |||
171 | } | ||
172 | |||
173 | public override bool IsThreaded | ||
174 | { | ||
175 | get | ||
176 | { | ||
177 | return (false); // for now we won't be multithreaded | ||
178 | } | ||
179 | } | ||
180 | |||
181 | public override void SetTerrain(float[] heightMap) | ||
182 | { | ||
183 | for (int i = 0; i < 65536; i++) | ||
184 | { | ||
185 | // this._heightmap[i] = (double)heightMap[i]; | ||
186 | // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...) | ||
187 | int x = i & 0xff; | ||
188 | int y = i >> 8; | ||
189 | this._heightmap[i] = (double)heightMap[x * 256 + y]; | ||
190 | } | ||
191 | IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); | ||
192 | d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0); | ||
193 | d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); | ||
194 | LandGeom = d.CreateHeightfield(space, HeightmapData, 1); | ||
195 | d.Matrix3 R = new d.Matrix3(); | ||
196 | |||
197 | Axiom.MathLib.Quaternion q1 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(1,0,0)); | ||
198 | Axiom.MathLib.Quaternion q2 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(0,1,0)); | ||
199 | //Axiom.MathLib.Quaternion q3 = Axiom.MathLib.Quaternion.FromAngleAxis(3.14f, new Axiom.MathLib.Vector3(0, 0, 1)); | ||
200 | |||
201 | q1 = q1 * q2; | ||
202 | //q1 = q1 * q3; | ||
203 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(); | ||
204 | float angle = 0; | ||
205 | q1.ToAngleAxis(ref angle, ref v3); | ||
206 | |||
207 | d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle); | ||
208 | d.GeomSetRotation(LandGeom, ref R); | ||
209 | d.GeomSetPosition(LandGeom, 128, 128, 0); | ||
210 | } | ||
211 | |||
212 | public override void DeleteTerrain() | ||
213 | { | ||
214 | |||
215 | } | ||
216 | } | ||
217 | |||
218 | public class OdeCharacter : PhysicsActor | ||
219 | { | ||
220 | private PhysicsVector _position; | ||
221 | private PhysicsVector _velocity; | ||
222 | private PhysicsVector _acceleration; | ||
223 | private bool flying = false; | ||
224 | //private float gravityAccel; | ||
225 | private IntPtr BoundingCapsule; | ||
226 | IntPtr capsule_geom; | ||
227 | d.Mass capsule_mass; | ||
228 | |||
229 | public OdeCharacter(OdeScene parent_scene, PhysicsVector pos) | ||
230 | { | ||
231 | _velocity = new PhysicsVector(); | ||
232 | _position = pos; | ||
233 | _acceleration = new PhysicsVector(); | ||
234 | d.MassSetCapsule(out capsule_mass, 50.0f, 3, 0.5f, 2f); | ||
235 | capsule_geom = d.CreateSphere(OdeScene.space, 1.0f); /// not a typo! Spheres roll, capsules tumble | ||
236 | this.BoundingCapsule = d.BodyCreate(OdeScene.world); | ||
237 | d.BodySetMass(BoundingCapsule, ref capsule_mass); | ||
238 | d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z); | ||
239 | d.GeomSetBody(capsule_geom, BoundingCapsule); | ||
240 | } | ||
241 | |||
242 | public override bool Flying | ||
243 | { | ||
244 | get | ||
245 | { | ||
246 | return flying; | ||
247 | } | ||
248 | set | ||
249 | { | ||
250 | flying = value; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | public override PhysicsVector Position | ||
255 | { | ||
256 | get | ||
257 | { | ||
258 | return _position; | ||
259 | } | ||
260 | set | ||
261 | { | ||
262 | _position = value; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | public override PhysicsVector Velocity | ||
267 | { | ||
268 | get | ||
269 | { | ||
270 | return _velocity; | ||
271 | } | ||
272 | set | ||
273 | { | ||
274 | _velocity = value; | ||
275 | } | ||
276 | } | ||
277 | |||
278 | public override bool Kinematic | ||
279 | { | ||
280 | get | ||
281 | { | ||
282 | return false; | ||
283 | } | ||
284 | set | ||
285 | { | ||
286 | |||
287 | } | ||
288 | } | ||
289 | |||
290 | public override Axiom.MathLib.Quaternion Orientation | ||
291 | { | ||
292 | get | ||
293 | { | ||
294 | return Axiom.MathLib.Quaternion.Identity; | ||
295 | } | ||
296 | set | ||
297 | { | ||
298 | |||
299 | } | ||
300 | } | ||
301 | |||
302 | public override PhysicsVector Acceleration | ||
303 | { | ||
304 | get | ||
305 | { | ||
306 | return _acceleration; | ||
307 | } | ||
308 | |||
309 | } | ||
310 | public void SetAcceleration(PhysicsVector accel) | ||
311 | { | ||
312 | this._acceleration = accel; | ||
313 | } | ||
314 | |||
315 | public override void AddForce(PhysicsVector force) | ||
316 | { | ||
317 | |||
318 | } | ||
319 | |||
320 | public override void SetMomentum(PhysicsVector momentum) | ||
321 | { | ||
322 | |||
323 | } | ||
324 | |||
325 | public void Move(float timeStep) | ||
326 | { | ||
327 | PhysicsVector vec = new PhysicsVector(); | ||
328 | d.Vector3 vel = d.BodyGetLinearVel(BoundingCapsule); | ||
329 | vec.X = (vel.X - this._velocity.X) * -75000.0f; | ||
330 | vec.Y = (vel.Y - this._velocity.Y) * -75000.0f; | ||
331 | if (flying) | ||
332 | { | ||
333 | vec.Z = (vel.Z - this._velocity.Z) * -75000.0f; | ||
334 | } | ||
335 | d.BodyAddForce(this.BoundingCapsule, vec.X, vec.Y, vec.Z); | ||
336 | } | ||
337 | |||
338 | public void UpdatePosition() | ||
339 | { | ||
340 | d.Vector3 vec = d.BodyGetPosition(BoundingCapsule); | ||
341 | this._position.X = vec.X; | ||
342 | this._position.Y = vec.Y; | ||
343 | this._position.Z = vec.Z; | ||
344 | } | ||
345 | } | ||
346 | |||
347 | public class OdePrim : PhysicsActor | ||
348 | { | ||
349 | private PhysicsVector _position; | ||
350 | private PhysicsVector _velocity; | ||
351 | private PhysicsVector _acceleration; | ||
352 | |||
353 | public OdePrim() | ||
354 | { | ||
355 | _velocity = new PhysicsVector(); | ||
356 | _position = new PhysicsVector(); | ||
357 | _acceleration = new PhysicsVector(); | ||
358 | } | ||
359 | public override bool Flying | ||
360 | { | ||
361 | get | ||
362 | { | ||
363 | return false; //no flying prims for you | ||
364 | } | ||
365 | set | ||
366 | { | ||
367 | |||
368 | } | ||
369 | } | ||
370 | public override PhysicsVector Position | ||
371 | { | ||
372 | get | ||
373 | { | ||
374 | PhysicsVector pos = new PhysicsVector(); | ||
375 | // PhysicsVector vec = this._prim.Position; | ||
376 | //pos.X = vec.X; | ||
377 | //pos.Y = vec.Y; | ||
378 | //pos.Z = vec.Z; | ||
379 | return pos; | ||
380 | |||
381 | } | ||
382 | set | ||
383 | { | ||
384 | /*PhysicsVector vec = value; | ||
385 | PhysicsVector pos = new PhysicsVector(); | ||
386 | pos.X = vec.X; | ||
387 | pos.Y = vec.Y; | ||
388 | pos.Z = vec.Z; | ||
389 | this._prim.Position = pos;*/ | ||
390 | } | ||
391 | } | ||
392 | |||
393 | public override PhysicsVector Velocity | ||
394 | { | ||
395 | get | ||
396 | { | ||
397 | return _velocity; | ||
398 | } | ||
399 | set | ||
400 | { | ||
401 | _velocity = value; | ||
402 | } | ||
403 | } | ||
404 | |||
405 | public override bool Kinematic | ||
406 | { | ||
407 | get | ||
408 | { | ||
409 | return false; | ||
410 | //return this._prim.Kinematic; | ||
411 | } | ||
412 | set | ||
413 | { | ||
414 | //this._prim.Kinematic = value; | ||
415 | } | ||
416 | } | ||
417 | |||
418 | public override Axiom.MathLib.Quaternion Orientation | ||
419 | { | ||
420 | get | ||
421 | { | ||
422 | Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); | ||
423 | return res; | ||
424 | } | ||
425 | set | ||
426 | { | ||
427 | |||
428 | } | ||
429 | } | ||
430 | |||
431 | public override PhysicsVector Acceleration | ||
432 | { | ||
433 | get | ||
434 | { | ||
435 | return _acceleration; | ||
436 | } | ||
437 | |||
438 | } | ||
439 | public void SetAcceleration(PhysicsVector accel) | ||
440 | { | ||
441 | this._acceleration = accel; | ||
442 | } | ||
443 | |||
444 | public override void AddForce(PhysicsVector force) | ||
445 | { | ||
446 | |||
447 | } | ||
448 | |||
449 | public override void SetMomentum(PhysicsVector momentum) | ||
450 | { | ||
451 | |||
452 | } | ||
453 | |||
454 | |||
455 | } | ||
456 | |||
457 | } | ||
diff --git a/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj b/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj deleted file mode 100644 index 08f54aa..0000000 --- a/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{63A05FE9-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Physics.OdePlugin</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Physics.OdePlugin</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\Physics\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\Physics\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Axiom.MathLib.dll" > | ||
62 | <HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="Ode.NET.dll" > | ||
66 | <HintPath>..\..\..\bin\Ode.NET.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System" > | ||
70 | <HintPath>System.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | </ItemGroup> | ||
74 | <ItemGroup> | ||
75 | <ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj"> | ||
76 | <Name>OpenSim.Physics.Manager</Name> | ||
77 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
79 | <Private>False</Private> | ||
80 | </ProjectReference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <Compile Include="AssemblyInfo.cs"> | ||
84 | <SubType>Code</SubType> | ||
85 | </Compile> | ||
86 | <Compile Include="OdePlugin.cs"> | ||
87 | <SubType>Code</SubType> | ||
88 | </Compile> | ||
89 | </ItemGroup> | ||
90 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
91 | <PropertyGroup> | ||
92 | <PreBuildEvent> | ||
93 | </PreBuildEvent> | ||
94 | <PostBuildEvent> | ||
95 | </PostBuildEvent> | ||
96 | </PropertyGroup> | ||
97 | </Project> | ||
diff --git a/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build b/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build deleted file mode 100644 index c93c0c2..0000000 --- a/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Physics.OdePlugin" 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.Physics.OdePlugin" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="OdePlugin.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="../../../bin/Axiom.MathLib.dll" /> | ||
23 | <include name="../../../bin/Ode.NET.dll" /> | ||
24 | <include name="../../../bin/OpenSim.Physics.Manager.dll" /> | ||
25 | <include name="System.dll" /> | ||
26 | </references> | ||
27 | </csc> | ||
28 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/Physics/" /> | ||
29 | <mkdir dir="${project::get-base-directory()}/../../../bin/Physics/"/> | ||
30 | <copy todir="${project::get-base-directory()}/../../../bin/Physics/"> | ||
31 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
32 | <include name="*.dll"/> | ||
33 | <include name="*.exe"/> | ||
34 | </fileset> | ||
35 | </copy> | ||
36 | </target> | ||
37 | <target name="clean"> | ||
38 | <delete dir="${bin.dir}" failonerror="false" /> | ||
39 | <delete dir="${obj.dir}" failonerror="false" /> | ||
40 | </target> | ||
41 | <target name="doc" description="Creates documentation."> | ||
42 | </target> | ||
43 | </project> | ||
diff --git a/OpenSim/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs deleted file mode 100644 index b49c8da..0000000 --- a/OpenSim/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System.Reflection; | ||
29 | using System.Runtime.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("RealPhysXplugin")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("RealPhysXplugin")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj b/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj deleted file mode 100644 index aa89cc1..0000000 --- a/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{988F0AC4-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Physics.PhysXPlugin</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Physics.PhysXPlugin</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\Physics\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\Physics\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Axiom.MathLib.dll" > | ||
62 | <HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="PhysX_Wrapper_Dotnet.dll" > | ||
66 | <HintPath>..\..\..\bin\PhysX_Wrapper_Dotnet.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System" > | ||
70 | <HintPath>System.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | </ItemGroup> | ||
74 | <ItemGroup> | ||
75 | <ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj"> | ||
76 | <Name>OpenSim.Physics.Manager</Name> | ||
77 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
79 | <Private>False</Private> | ||
80 | </ProjectReference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <Compile Include="AssemblyInfo.cs"> | ||
84 | <SubType>Code</SubType> | ||
85 | </Compile> | ||
86 | <Compile Include="PhysXPlugin.cs"> | ||
87 | <SubType>Code</SubType> | ||
88 | </Compile> | ||
89 | </ItemGroup> | ||
90 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
91 | <PropertyGroup> | ||
92 | <PreBuildEvent> | ||
93 | </PreBuildEvent> | ||
94 | <PostBuildEvent> | ||
95 | </PostBuildEvent> | ||
96 | </PropertyGroup> | ||
97 | </Project> | ||
diff --git a/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build b/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build deleted file mode 100644 index be7a847..0000000 --- a/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Physics.PhysXPlugin" 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.Physics.PhysXPlugin" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="PhysXPlugin.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="../../../bin/Axiom.MathLib.dll" /> | ||
23 | <include name="../../../bin/OpenSim.Physics.Manager.dll" /> | ||
24 | <include name="../../../bin/PhysX_Wrapper_Dotnet.dll" /> | ||
25 | <include name="System.dll" /> | ||
26 | </references> | ||
27 | </csc> | ||
28 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/Physics/" /> | ||
29 | <mkdir dir="${project::get-base-directory()}/../../../bin/Physics/"/> | ||
30 | <copy todir="${project::get-base-directory()}/../../../bin/Physics/"> | ||
31 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
32 | <include name="*.dll"/> | ||
33 | <include name="*.exe"/> | ||
34 | </fileset> | ||
35 | </copy> | ||
36 | </target> | ||
37 | <target name="clean"> | ||
38 | <delete dir="${bin.dir}" failonerror="false" /> | ||
39 | <delete dir="${obj.dir}" failonerror="false" /> | ||
40 | </target> | ||
41 | <target name="doc" description="Creates documentation."> | ||
42 | </target> | ||
43 | </project> | ||
diff --git a/OpenSim/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs deleted file mode 100644 index 802f983..0000000 --- a/OpenSim/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs +++ /dev/null | |||
@@ -1,424 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Physics.Manager; | ||
31 | using PhysXWrapper; | ||
32 | |||
33 | namespace OpenSim.Physics.PhysXPlugin | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Will be the PhysX plugin but for now will be a very basic physics engine | ||
37 | /// </summary> | ||
38 | public class PhysXPlugin : IPhysicsPlugin | ||
39 | { | ||
40 | private PhysXScene _mScene; | ||
41 | |||
42 | public PhysXPlugin() | ||
43 | { | ||
44 | |||
45 | } | ||
46 | |||
47 | public bool Init() | ||
48 | { | ||
49 | return true; | ||
50 | } | ||
51 | |||
52 | public PhysicsScene GetScene() | ||
53 | { | ||
54 | if(_mScene == null) | ||
55 | { | ||
56 | _mScene = new PhysXScene(); | ||
57 | } | ||
58 | return(_mScene); | ||
59 | } | ||
60 | |||
61 | public string GetName() | ||
62 | { | ||
63 | return("RealPhysX"); | ||
64 | } | ||
65 | |||
66 | public void Dispose() | ||
67 | { | ||
68 | |||
69 | } | ||
70 | } | ||
71 | |||
72 | public class PhysXScene :PhysicsScene | ||
73 | { | ||
74 | private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); | ||
75 | private List<PhysXPrim> _prims = new List<PhysXPrim>(); | ||
76 | private float[] _heightMap = null; | ||
77 | private NxPhysicsSDK mySdk; | ||
78 | private NxScene scene; | ||
79 | |||
80 | public PhysXScene() | ||
81 | { | ||
82 | mySdk = NxPhysicsSDK.CreateSDK(); | ||
83 | Console.WriteLine("Sdk created - now creating scene"); | ||
84 | scene = mySdk.CreateScene(); | ||
85 | |||
86 | } | ||
87 | |||
88 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
89 | { | ||
90 | Vec3 pos = new Vec3(); | ||
91 | pos.X = position.X; | ||
92 | pos.Y = position.Y; | ||
93 | pos.Z = position.Z; | ||
94 | PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos)); | ||
95 | act.Position = position; | ||
96 | _characters.Add(act); | ||
97 | return act; | ||
98 | } | ||
99 | |||
100 | public override void RemoveAvatar(PhysicsActor actor) | ||
101 | { | ||
102 | |||
103 | } | ||
104 | |||
105 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
106 | { | ||
107 | Vec3 pos = new Vec3(); | ||
108 | pos.X = position.X; | ||
109 | pos.Y = position.Y; | ||
110 | pos.Z = position.Z; | ||
111 | Vec3 siz = new Vec3(); | ||
112 | siz.X = size.X; | ||
113 | siz.Y = size.Y; | ||
114 | siz.Z = size.Z; | ||
115 | PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz)); | ||
116 | _prims.Add(act); | ||
117 | return act; | ||
118 | } | ||
119 | public override void Simulate(float timeStep) | ||
120 | { | ||
121 | try | ||
122 | { | ||
123 | foreach (PhysXCharacter actor in _characters) | ||
124 | { | ||
125 | actor.Move(timeStep); | ||
126 | } | ||
127 | scene.Simulate(timeStep); | ||
128 | scene.FetchResults(); | ||
129 | scene.UpdateControllers(); | ||
130 | |||
131 | foreach (PhysXCharacter actor in _characters) | ||
132 | { | ||
133 | actor.UpdatePosition(); | ||
134 | } | ||
135 | } | ||
136 | catch (Exception e) | ||
137 | { | ||
138 | Console.WriteLine(e.Message); | ||
139 | } | ||
140 | |||
141 | } | ||
142 | |||
143 | public override void GetResults() | ||
144 | { | ||
145 | |||
146 | } | ||
147 | |||
148 | public override bool IsThreaded | ||
149 | { | ||
150 | get | ||
151 | { | ||
152 | return(false); // for now we won't be multithreaded | ||
153 | } | ||
154 | } | ||
155 | |||
156 | public override void SetTerrain(float[] heightMap) | ||
157 | { | ||
158 | if (this._heightMap != null) | ||
159 | { | ||
160 | Console.WriteLine("PhysX - deleting old terrain"); | ||
161 | this.scene.DeleteTerrain(); | ||
162 | } | ||
163 | this._heightMap = heightMap; | ||
164 | this.scene.AddTerrain(heightMap); | ||
165 | } | ||
166 | |||
167 | public override void DeleteTerrain() | ||
168 | { | ||
169 | this.scene.DeleteTerrain(); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | public class PhysXCharacter : PhysicsActor | ||
174 | { | ||
175 | private PhysicsVector _position; | ||
176 | private PhysicsVector _velocity; | ||
177 | private PhysicsVector _acceleration; | ||
178 | private NxCharacter _character; | ||
179 | private bool flying; | ||
180 | private float gravityAccel; | ||
181 | |||
182 | public PhysXCharacter(NxCharacter character) | ||
183 | { | ||
184 | _velocity = new PhysicsVector(); | ||
185 | _position = new PhysicsVector(); | ||
186 | _acceleration = new PhysicsVector(); | ||
187 | _character = character; | ||
188 | } | ||
189 | |||
190 | public override bool Flying | ||
191 | { | ||
192 | get | ||
193 | { | ||
194 | return flying; | ||
195 | } | ||
196 | set | ||
197 | { | ||
198 | flying = value; | ||
199 | } | ||
200 | } | ||
201 | |||
202 | public override PhysicsVector Position | ||
203 | { | ||
204 | get | ||
205 | { | ||
206 | return _position; | ||
207 | } | ||
208 | set | ||
209 | { | ||
210 | _position = value; | ||
211 | Vec3 ps = new Vec3(); | ||
212 | ps.X = value.X; | ||
213 | ps.Y = value.Y; | ||
214 | ps.Z = value.Z; | ||
215 | this._character.Position = ps; | ||
216 | } | ||
217 | } | ||
218 | |||
219 | public override PhysicsVector Velocity | ||
220 | { | ||
221 | get | ||
222 | { | ||
223 | return _velocity; | ||
224 | } | ||
225 | set | ||
226 | { | ||
227 | _velocity = value; | ||
228 | } | ||
229 | } | ||
230 | |||
231 | public override bool Kinematic | ||
232 | { | ||
233 | get | ||
234 | { | ||
235 | return false; | ||
236 | } | ||
237 | set | ||
238 | { | ||
239 | |||
240 | } | ||
241 | } | ||
242 | |||
243 | public override Axiom.MathLib.Quaternion Orientation | ||
244 | { | ||
245 | get | ||
246 | { | ||
247 | return Axiom.MathLib.Quaternion.Identity; | ||
248 | } | ||
249 | set | ||
250 | { | ||
251 | |||
252 | } | ||
253 | } | ||
254 | |||
255 | public override PhysicsVector Acceleration | ||
256 | { | ||
257 | get | ||
258 | { | ||
259 | return _acceleration; | ||
260 | } | ||
261 | |||
262 | } | ||
263 | public void SetAcceleration (PhysicsVector accel) | ||
264 | { | ||
265 | this._acceleration = accel; | ||
266 | } | ||
267 | |||
268 | public override void AddForce(PhysicsVector force) | ||
269 | { | ||
270 | |||
271 | } | ||
272 | |||
273 | public override void SetMomentum(PhysicsVector momentum) | ||
274 | { | ||
275 | |||
276 | } | ||
277 | |||
278 | public void Move(float timeStep) | ||
279 | { | ||
280 | Vec3 vec = new Vec3(); | ||
281 | vec.X = this._velocity.X * timeStep; | ||
282 | vec.Y = this._velocity.Y * timeStep; | ||
283 | if(flying) | ||
284 | { | ||
285 | vec.Z = ( this._velocity.Z) * timeStep; | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | gravityAccel+= -9.8f; | ||
290 | vec.Z = (gravityAccel + this._velocity.Z) * timeStep; | ||
291 | } | ||
292 | int res = this._character.Move(vec); | ||
293 | if(res == 1) | ||
294 | { | ||
295 | gravityAccel = 0; | ||
296 | } | ||
297 | } | ||
298 | |||
299 | public void UpdatePosition() | ||
300 | { | ||
301 | Vec3 vec = this._character.Position; | ||
302 | this._position.X = vec.X; | ||
303 | this._position.Y = vec.Y; | ||
304 | this._position.Z = vec.Z; | ||
305 | } | ||
306 | } | ||
307 | |||
308 | public class PhysXPrim : PhysicsActor | ||
309 | { | ||
310 | private PhysicsVector _position; | ||
311 | private PhysicsVector _velocity; | ||
312 | private PhysicsVector _acceleration; | ||
313 | private NxActor _prim; | ||
314 | |||
315 | public PhysXPrim(NxActor prim) | ||
316 | { | ||
317 | _velocity = new PhysicsVector(); | ||
318 | _position = new PhysicsVector(); | ||
319 | _acceleration = new PhysicsVector(); | ||
320 | _prim = prim; | ||
321 | } | ||
322 | public override bool Flying | ||
323 | { | ||
324 | get | ||
325 | { | ||
326 | return false; //no flying prims for you | ||
327 | } | ||
328 | set | ||
329 | { | ||
330 | |||
331 | } | ||
332 | } | ||
333 | public override PhysicsVector Position | ||
334 | { | ||
335 | get | ||
336 | { | ||
337 | PhysicsVector pos = new PhysicsVector(); | ||
338 | Vec3 vec = this._prim.Position; | ||
339 | pos.X = vec.X; | ||
340 | pos.Y = vec.Y; | ||
341 | pos.Z = vec.Z; | ||
342 | return pos; | ||
343 | |||
344 | } | ||
345 | set | ||
346 | { | ||
347 | PhysicsVector vec = value; | ||
348 | Vec3 pos = new Vec3(); | ||
349 | pos.X = vec.X; | ||
350 | pos.Y = vec.Y; | ||
351 | pos.Z = vec.Z; | ||
352 | this._prim.Position = pos; | ||
353 | } | ||
354 | } | ||
355 | |||
356 | public override PhysicsVector Velocity | ||
357 | { | ||
358 | get | ||
359 | { | ||
360 | return _velocity; | ||
361 | } | ||
362 | set | ||
363 | { | ||
364 | _velocity = value; | ||
365 | } | ||
366 | } | ||
367 | |||
368 | public override bool Kinematic | ||
369 | { | ||
370 | get | ||
371 | { | ||
372 | return this._prim.Kinematic; | ||
373 | } | ||
374 | set | ||
375 | { | ||
376 | this._prim.Kinematic = value; | ||
377 | } | ||
378 | } | ||
379 | |||
380 | public override Axiom.MathLib.Quaternion Orientation | ||
381 | { | ||
382 | get | ||
383 | { | ||
384 | Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); | ||
385 | PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); | ||
386 | res.w = quat.W; | ||
387 | res.x = quat.X; | ||
388 | res.y = quat.Y; | ||
389 | res.z = quat.Z; | ||
390 | return res; | ||
391 | } | ||
392 | set | ||
393 | { | ||
394 | |||
395 | } | ||
396 | } | ||
397 | |||
398 | public override PhysicsVector Acceleration | ||
399 | { | ||
400 | get | ||
401 | { | ||
402 | return _acceleration; | ||
403 | } | ||
404 | |||
405 | } | ||
406 | public void SetAcceleration (PhysicsVector accel) | ||
407 | { | ||
408 | this._acceleration = accel; | ||
409 | } | ||
410 | |||
411 | public override void AddForce(PhysicsVector force) | ||
412 | { | ||
413 | |||
414 | } | ||
415 | |||
416 | public override void SetMomentum(PhysicsVector momentum) | ||
417 | { | ||
418 | |||
419 | } | ||
420 | |||
421 | |||
422 | } | ||
423 | |||
424 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim/OpenSim.RegionServer/AgentAssetUpload.cs deleted file mode 100644 index 6781781..0000000 --- a/OpenSim/OpenSim.RegionServer/AgentAssetUpload.cs +++ /dev/null | |||
@@ -1,259 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.RegionServer.Assets; | ||
32 | using OpenSim.RegionServer.Client; | ||
33 | using OpenSim.Framework.Types; | ||
34 | using OpenSim.Framework.Utilities; | ||
35 | using libsecondlife; | ||
36 | using libsecondlife.Packets; | ||
37 | |||
38 | namespace OpenSim.RegionServer | ||
39 | { | ||
40 | public class AgentAssetUpload | ||
41 | { | ||
42 | private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>(); | ||
43 | private ClientView ourClient; | ||
44 | private AssetCache m_assetCache; | ||
45 | private InventoryCache m_inventoryCache; | ||
46 | |||
47 | public AgentAssetUpload(ClientView client, AssetCache assetCache, InventoryCache inventoryCache) | ||
48 | { | ||
49 | this.ourClient = client; | ||
50 | m_assetCache = assetCache; | ||
51 | m_inventoryCache = inventoryCache; | ||
52 | } | ||
53 | |||
54 | public void AddUpload(LLUUID transactionID, AssetBase asset) | ||
55 | { | ||
56 | AssetTransaction upload = new AssetTransaction(); | ||
57 | lock (this.transactions) | ||
58 | { | ||
59 | upload.Asset = asset; | ||
60 | upload.TransactionID = transactionID; | ||
61 | this.transactions.Add(transactionID, upload); | ||
62 | } | ||
63 | if (upload.Asset.Data.Length > 2) | ||
64 | { | ||
65 | //is complete | ||
66 | upload.UploadComplete = true; | ||
67 | AssetUploadCompletePacket response = new AssetUploadCompletePacket(); | ||
68 | response.AssetBlock.Type = asset.Type; | ||
69 | response.AssetBlock.Success = true; | ||
70 | response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID); | ||
71 | this.ourClient.OutPacket(response); | ||
72 | m_assetCache.AddAsset(asset); | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | upload.UploadComplete = false; | ||
77 | upload.XferID = Util.GetNextXferID(); | ||
78 | RequestXferPacket xfer = new RequestXferPacket(); | ||
79 | xfer.XferID.ID = upload.XferID; | ||
80 | xfer.XferID.VFileType = upload.Asset.Type; | ||
81 | xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID); | ||
82 | xfer.XferID.FilePath = 0; | ||
83 | xfer.XferID.Filename = new byte[0]; | ||
84 | this.ourClient.OutPacket(xfer); | ||
85 | } | ||
86 | |||
87 | } | ||
88 | |||
89 | public AssetBase GetUpload(LLUUID transactionID) | ||
90 | { | ||
91 | if (this.transactions.ContainsKey(transactionID)) | ||
92 | { | ||
93 | return this.transactions[transactionID].Asset; | ||
94 | } | ||
95 | |||
96 | return null; | ||
97 | } | ||
98 | |||
99 | public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID) | ||
100 | { | ||
101 | // Console.Write("asset upload request , type = " + pack.AssetBlock.Type.ToString()); | ||
102 | AssetBase asset = null; | ||
103 | if (pack.AssetBlock.Type == 0) | ||
104 | { | ||
105 | |||
106 | //first packet for transaction | ||
107 | asset = new AssetBase(); | ||
108 | asset.FullID = assetID; | ||
109 | asset.Type = pack.AssetBlock.Type; | ||
110 | asset.InvType = asset.Type; | ||
111 | asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); | ||
112 | asset.Data = pack.AssetBlock.AssetData; | ||
113 | |||
114 | |||
115 | } | ||
116 | else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7) | ||
117 | { | ||
118 | |||
119 | asset = new AssetBase(); | ||
120 | asset.FullID = assetID; | ||
121 | asset.Type = pack.AssetBlock.Type; | ||
122 | asset.InvType = asset.Type; | ||
123 | asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000"); | ||
124 | asset.Data = pack.AssetBlock.AssetData; | ||
125 | |||
126 | |||
127 | } | ||
128 | |||
129 | if (asset != null) | ||
130 | { | ||
131 | this.AddUpload(pack.AssetBlock.TransactionID, asset); | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | |||
136 | //currently we don't support this asset type | ||
137 | //so lets just tell the client that the upload is complete | ||
138 | AssetUploadCompletePacket response = new AssetUploadCompletePacket(); | ||
139 | response.AssetBlock.Type = pack.AssetBlock.Type; | ||
140 | response.AssetBlock.Success = true; | ||
141 | response.AssetBlock.UUID = pack.AssetBlock.TransactionID.Combine(this.ourClient.SecureSessionID); | ||
142 | this.ourClient.OutPacket(response); | ||
143 | } | ||
144 | |||
145 | } | ||
146 | |||
147 | #region Xfer packet system for larger uploads | ||
148 | |||
149 | public void HandleXferPacket(SendXferPacketPacket xferPacket) | ||
150 | { | ||
151 | lock (this.transactions) | ||
152 | { | ||
153 | foreach (AssetTransaction trans in this.transactions.Values) | ||
154 | { | ||
155 | if (trans.XferID == xferPacket.XferID.ID) | ||
156 | { | ||
157 | if (trans.Asset.Data.Length > 1) | ||
158 | { | ||
159 | byte[] newArray = new byte[trans.Asset.Data.Length + xferPacket.DataPacket.Data.Length]; | ||
160 | Array.Copy(trans.Asset.Data, 0, newArray, 0, trans.Asset.Data.Length); | ||
161 | Array.Copy(xferPacket.DataPacket.Data, 0, newArray, trans.Asset.Data.Length, xferPacket.DataPacket.Data.Length); | ||
162 | trans.Asset.Data = newArray; | ||
163 | } | ||
164 | else | ||
165 | { | ||
166 | byte[] newArray = new byte[xferPacket.DataPacket.Data.Length - 4]; | ||
167 | Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length - 4); | ||
168 | trans.Asset.Data = newArray; | ||
169 | } | ||
170 | |||
171 | if ((xferPacket.XferID.Packet & 2147483648) != 0) | ||
172 | { | ||
173 | //end of transfer | ||
174 | trans.UploadComplete = true; | ||
175 | AssetUploadCompletePacket response = new AssetUploadCompletePacket(); | ||
176 | response.AssetBlock.Type = trans.Asset.Type; | ||
177 | response.AssetBlock.Success = true; | ||
178 | response.AssetBlock.UUID = trans.TransactionID.Combine(this.ourClient.SecureSessionID); | ||
179 | this.ourClient.OutPacket(response); | ||
180 | |||
181 | m_assetCache.AddAsset(trans.Asset); | ||
182 | //check if we should add it to inventory | ||
183 | if (trans.AddToInventory) | ||
184 | { | ||
185 | // m_assetCache.AddAsset(trans.Asset); | ||
186 | m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); | ||
187 | } | ||
188 | |||
189 | |||
190 | } | ||
191 | break; | ||
192 | } | ||
193 | |||
194 | } | ||
195 | } | ||
196 | |||
197 | ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket(); | ||
198 | confirmXfer.XferID.ID = xferPacket.XferID.ID; | ||
199 | confirmXfer.XferID.Packet = xferPacket.XferID.Packet; | ||
200 | this.ourClient.OutPacket(confirmXfer); | ||
201 | } | ||
202 | |||
203 | #endregion | ||
204 | |||
205 | public AssetBase AddUploadToAssetCache(LLUUID transactionID) | ||
206 | { | ||
207 | AssetBase asset = null; | ||
208 | if (this.transactions.ContainsKey(transactionID)) | ||
209 | { | ||
210 | AssetTransaction trans = this.transactions[transactionID]; | ||
211 | if (trans.UploadComplete) | ||
212 | { | ||
213 | m_assetCache.AddAsset(trans.Asset); | ||
214 | asset = trans.Asset; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | return asset; | ||
219 | } | ||
220 | |||
221 | public void CreateInventoryItem(CreateInventoryItemPacket packet) | ||
222 | { | ||
223 | if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID)) | ||
224 | { | ||
225 | AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID]; | ||
226 | trans.Asset.Description = Util.FieldToString(packet.InventoryBlock.Description); | ||
227 | trans.Asset.Name = Util.FieldToString(packet.InventoryBlock.Name); | ||
228 | trans.Asset.Type = packet.InventoryBlock.Type; | ||
229 | trans.Asset.InvType = packet.InventoryBlock.InvType; | ||
230 | if (trans.UploadComplete) | ||
231 | { | ||
232 | //already complete so we can add it to the inventory | ||
233 | //m_assetCache.AddAsset(trans.Asset); | ||
234 | m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset); | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | trans.AddToInventory = true; | ||
239 | trans.InventFolder = packet.InventoryBlock.FolderID; | ||
240 | } | ||
241 | } | ||
242 | } | ||
243 | |||
244 | private class AssetTransaction | ||
245 | { | ||
246 | public uint XferID; | ||
247 | public AssetBase Asset; | ||
248 | public bool AddToInventory; | ||
249 | public LLUUID InventFolder = LLUUID.Zero; | ||
250 | public bool UploadComplete = false; | ||
251 | public LLUUID TransactionID = LLUUID.Zero; | ||
252 | |||
253 | public AssetTransaction() | ||
254 | { | ||
255 | |||
256 | } | ||
257 | } | ||
258 | } | ||
259 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs deleted file mode 100644 index 466f9f9..0000000 --- a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs +++ /dev/null | |||
@@ -1,572 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Threading; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using OpenSim.Framework.Utilities; | ||
37 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.RegionServer.Client; | ||
39 | |||
40 | namespace OpenSim.RegionServer.Assets | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// Manages local cache of assets and their sending to viewers. | ||
44 | /// </summary> | ||
45 | public class AssetCache : IAssetReceiver | ||
46 | { | ||
47 | public Dictionary<libsecondlife.LLUUID, AssetInfo> Assets; | ||
48 | public Dictionary<libsecondlife.LLUUID, TextureImage> Textures; | ||
49 | |||
50 | public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers | ||
51 | public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent | ||
52 | |||
53 | public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server | ||
54 | public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server | ||
55 | |||
56 | private IAssetServer _assetServer; | ||
57 | private Thread _assetCacheThread; | ||
58 | private LLUUID[] textureList = new LLUUID[5]; | ||
59 | |||
60 | /// <summary> | ||
61 | /// | ||
62 | /// </summary> | ||
63 | public AssetCache(IAssetServer assetServer) | ||
64 | { | ||
65 | MainConsole.Instance.Verbose("Creating Asset cache"); | ||
66 | _assetServer = assetServer; | ||
67 | _assetServer.SetReceiver(this); | ||
68 | Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>(); | ||
69 | Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>(); | ||
70 | this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); | ||
71 | this._assetCacheThread.IsBackground = true; | ||
72 | this._assetCacheThread.Start(); | ||
73 | |||
74 | } | ||
75 | |||
76 | /// <summary> | ||
77 | /// | ||
78 | /// </summary> | ||
79 | public void RunAssetManager() | ||
80 | { | ||
81 | while (true) | ||
82 | { | ||
83 | try | ||
84 | { | ||
85 | this.ProcessAssetQueue(); | ||
86 | this.ProcessTextureQueue(); | ||
87 | Thread.Sleep(500); | ||
88 | } | ||
89 | catch (Exception e) | ||
90 | { | ||
91 | MainConsole.Instance.Error(e.Message); | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public void LoadDefaultTextureSet() | ||
97 | { | ||
98 | //hack: so we can give each user a set of textures | ||
99 | textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001"); | ||
100 | textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002"); | ||
101 | textureList[2] = new LLUUID("00000000-0000-0000-9999-000000000003"); | ||
102 | textureList[3] = new LLUUID("00000000-0000-0000-9999-000000000004"); | ||
103 | textureList[4] = new LLUUID("00000000-0000-0000-9999-000000000005"); | ||
104 | |||
105 | for (int i = 0; i < textureList.Length; i++) | ||
106 | { | ||
107 | this._assetServer.RequestAsset(textureList[i], true); | ||
108 | } | ||
109 | |||
110 | } | ||
111 | |||
112 | public AssetBase[] CreateNewInventorySet(LLUUID agentID) | ||
113 | { | ||
114 | AssetBase[] inventorySet = new AssetBase[this.textureList.Length]; | ||
115 | for (int i = 0; i < textureList.Length; i++) | ||
116 | { | ||
117 | if (this.Textures.ContainsKey(textureList[i])) | ||
118 | { | ||
119 | inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]); | ||
120 | TextureImage image = new TextureImage(inventorySet[i]); | ||
121 | this.Textures.Add(image.FullID, image); | ||
122 | this._assetServer.UploadNewAsset(image); //save the asset to the asset server | ||
123 | } | ||
124 | } | ||
125 | return inventorySet; | ||
126 | } | ||
127 | |||
128 | public AssetBase GetAsset(LLUUID assetID) | ||
129 | { | ||
130 | AssetBase asset = null; | ||
131 | if(this.Textures.ContainsKey(assetID)) | ||
132 | { | ||
133 | asset = this.Textures[assetID]; | ||
134 | } | ||
135 | else if (this.Assets.ContainsKey(assetID)) | ||
136 | { | ||
137 | asset = this.Assets[assetID]; | ||
138 | } | ||
139 | return asset; | ||
140 | } | ||
141 | |||
142 | public void AddAsset(AssetBase asset) | ||
143 | { | ||
144 | if (asset.Type == 0) | ||
145 | { | ||
146 | if (!this.Textures.ContainsKey(asset.FullID)) | ||
147 | { //texture | ||
148 | TextureImage textur = new TextureImage(asset); | ||
149 | this.Textures.Add(textur.FullID, textur); | ||
150 | this._assetServer.UploadNewAsset(asset); | ||
151 | } | ||
152 | } | ||
153 | else | ||
154 | { | ||
155 | if (!this.Assets.ContainsKey(asset.FullID)) | ||
156 | { | ||
157 | AssetInfo assetInf = new AssetInfo(asset); | ||
158 | this.Assets.Add(assetInf.FullID, assetInf); | ||
159 | this._assetServer.UploadNewAsset(asset); | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | |||
164 | /// <summary> | ||
165 | /// | ||
166 | /// </summary> | ||
167 | private void ProcessTextureQueue() | ||
168 | { | ||
169 | if (this.TextureRequests.Count == 0) | ||
170 | { | ||
171 | //no requests waiting | ||
172 | return; | ||
173 | } | ||
174 | int num; | ||
175 | |||
176 | if (this.TextureRequests.Count < 5) | ||
177 | { | ||
178 | //lower than 5 so do all of them | ||
179 | num = this.TextureRequests.Count; | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | num = 5; | ||
184 | } | ||
185 | AssetRequest req; | ||
186 | for (int i = 0; i < num; i++) | ||
187 | { | ||
188 | req = (AssetRequest)this.TextureRequests[i]; | ||
189 | if (req.PacketCounter != req.NumPackets) | ||
190 | { | ||
191 | // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005")) | ||
192 | if (req.PacketCounter == 0) | ||
193 | { | ||
194 | //first time for this request so send imagedata packet | ||
195 | if (req.NumPackets == 1) | ||
196 | { | ||
197 | //only one packet so send whole file | ||
198 | ImageDataPacket im = new ImageDataPacket(); | ||
199 | im.ImageID.Packets = 1; | ||
200 | im.ImageID.ID = req.ImageInfo.FullID; | ||
201 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | ||
202 | im.ImageData.Data = req.ImageInfo.Data; | ||
203 | im.ImageID.Codec = 2; | ||
204 | req.RequestUser.OutPacket(im); | ||
205 | req.PacketCounter++; | ||
206 | //req.ImageInfo.l= time; | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | //more than one packet so split file up | ||
211 | ImageDataPacket im = new ImageDataPacket(); | ||
212 | im.ImageID.Packets = (ushort)req.NumPackets; | ||
213 | im.ImageID.ID = req.ImageInfo.FullID; | ||
214 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | ||
215 | im.ImageData.Data = new byte[600]; | ||
216 | Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); | ||
217 | im.ImageID.Codec = 2; | ||
218 | req.RequestUser.OutPacket(im); | ||
219 | req.PacketCounter++; | ||
220 | //req.ImageInfo.last_used = time; | ||
221 | } | ||
222 | } | ||
223 | else | ||
224 | { | ||
225 | //send imagepacket | ||
226 | //more than one packet so split file up | ||
227 | ImagePacketPacket im = new ImagePacketPacket(); | ||
228 | im.ImageID.Packet = (ushort)req.PacketCounter; | ||
229 | im.ImageID.ID = req.ImageInfo.FullID; | ||
230 | int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1); | ||
231 | if (size > 1000) size = 1000; | ||
232 | im.ImageData.Data = new byte[size]; | ||
233 | Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size); | ||
234 | req.RequestUser.OutPacket(im); | ||
235 | req.PacketCounter++; | ||
236 | //req.ImageInfo.last_used = time; | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | |||
241 | //remove requests that have been completed | ||
242 | int count = 0; | ||
243 | for (int i = 0; i < num; i++) | ||
244 | { | ||
245 | if (this.TextureRequests.Count > count) | ||
246 | { | ||
247 | req = (AssetRequest)this.TextureRequests[count]; | ||
248 | if (req.PacketCounter == req.NumPackets) | ||
249 | { | ||
250 | this.TextureRequests.Remove(req); | ||
251 | } | ||
252 | else | ||
253 | { | ||
254 | count++; | ||
255 | } | ||
256 | } | ||
257 | } | ||
258 | |||
259 | } | ||
260 | public void AssetReceived(AssetBase asset, bool IsTexture) | ||
261 | { | ||
262 | if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server | ||
263 | { | ||
264 | //check if it is a texture or not | ||
265 | //then add to the correct cache list | ||
266 | //then check for waiting requests for this asset/texture (in the Requested lists) | ||
267 | //and move those requests into the Requests list. | ||
268 | if (IsTexture) | ||
269 | { | ||
270 | TextureImage image = new TextureImage(asset); | ||
271 | this.Textures.Add(image.FullID, image); | ||
272 | if (this.RequestedTextures.ContainsKey(image.FullID)) | ||
273 | { | ||
274 | AssetRequest req = this.RequestedTextures[image.FullID]; | ||
275 | req.ImageInfo = image; | ||
276 | if (image.Data.LongLength > 600) | ||
277 | { | ||
278 | //over 600 bytes so split up file | ||
279 | req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000; | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | req.NumPackets = 1; | ||
284 | } | ||
285 | this.RequestedTextures.Remove(image.FullID); | ||
286 | this.TextureRequests.Add(req); | ||
287 | } | ||
288 | } | ||
289 | else | ||
290 | { | ||
291 | AssetInfo assetInf = new AssetInfo(asset); | ||
292 | this.Assets.Add(assetInf.FullID, assetInf); | ||
293 | if (this.RequestedAssets.ContainsKey(assetInf.FullID)) | ||
294 | { | ||
295 | AssetRequest req = this.RequestedAssets[assetInf.FullID]; | ||
296 | req.AssetInf = assetInf; | ||
297 | if (assetInf.Data.LongLength > 600) | ||
298 | { | ||
299 | //over 600 bytes so split up file | ||
300 | req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; | ||
301 | } | ||
302 | else | ||
303 | { | ||
304 | req.NumPackets = 1; | ||
305 | } | ||
306 | this.RequestedAssets.Remove(assetInf.FullID); | ||
307 | this.AssetRequests.Add(req); | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | } | ||
312 | |||
313 | public void AssetNotFound(AssetBase asset) | ||
314 | { | ||
315 | //the asset server had no knowledge of requested asset | ||
316 | |||
317 | } | ||
318 | |||
319 | #region Assets | ||
320 | /// <summary> | ||
321 | /// | ||
322 | /// </summary> | ||
323 | /// <param name="userInfo"></param> | ||
324 | /// <param name="transferRequest"></param> | ||
325 | public void AddAssetRequest(ClientView userInfo, TransferRequestPacket transferRequest) | ||
326 | { | ||
327 | LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); | ||
328 | //check to see if asset is in local cache, if not we need to request it from asset server. | ||
329 | if (!this.Assets.ContainsKey(requestID)) | ||
330 | { | ||
331 | //not found asset | ||
332 | // so request from asset server | ||
333 | if (!this.RequestedAssets.ContainsKey(requestID)) | ||
334 | { | ||
335 | AssetRequest request = new AssetRequest(); | ||
336 | request.RequestUser = userInfo; | ||
337 | request.RequestAssetID = requestID; | ||
338 | request.TransferRequestID = transferRequest.TransferInfo.TransferID; | ||
339 | this.RequestedAssets.Add(requestID, request); | ||
340 | this._assetServer.RequestAsset(requestID, false); | ||
341 | } | ||
342 | return; | ||
343 | } | ||
344 | //it is in our cache | ||
345 | AssetInfo asset = this.Assets[requestID]; | ||
346 | |||
347 | //work out how many packets it should be sent in | ||
348 | // and add to the AssetRequests list | ||
349 | AssetRequest req = new AssetRequest(); | ||
350 | req.RequestUser = userInfo; | ||
351 | req.RequestAssetID = requestID; | ||
352 | req.TransferRequestID = transferRequest.TransferInfo.TransferID; | ||
353 | req.AssetInf = asset; | ||
354 | |||
355 | if (asset.Data.LongLength > 600) | ||
356 | { | ||
357 | //over 600 bytes so split up file | ||
358 | req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; | ||
359 | } | ||
360 | else | ||
361 | { | ||
362 | req.NumPackets = 1; | ||
363 | } | ||
364 | |||
365 | this.AssetRequests.Add(req); | ||
366 | } | ||
367 | |||
368 | /// <summary> | ||
369 | /// | ||
370 | /// </summary> | ||
371 | private void ProcessAssetQueue() | ||
372 | { | ||
373 | if (this.AssetRequests.Count == 0) | ||
374 | { | ||
375 | //no requests waiting | ||
376 | return; | ||
377 | } | ||
378 | int num; | ||
379 | |||
380 | if (this.AssetRequests.Count < 5) | ||
381 | { | ||
382 | //lower than 5 so do all of them | ||
383 | num = this.AssetRequests.Count; | ||
384 | } | ||
385 | else | ||
386 | { | ||
387 | num = 5; | ||
388 | } | ||
389 | AssetRequest req; | ||
390 | for (int i = 0; i < num; i++) | ||
391 | { | ||
392 | req = (AssetRequest)this.AssetRequests[i]; | ||
393 | |||
394 | TransferInfoPacket Transfer = new TransferInfoPacket(); | ||
395 | Transfer.TransferInfo.ChannelType = 2; | ||
396 | Transfer.TransferInfo.Status = 0; | ||
397 | Transfer.TransferInfo.TargetType = 0; | ||
398 | Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes(); | ||
399 | Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; | ||
400 | Transfer.TransferInfo.TransferID = req.TransferRequestID; | ||
401 | req.RequestUser.OutPacket(Transfer); | ||
402 | |||
403 | if (req.NumPackets == 1) | ||
404 | { | ||
405 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); | ||
406 | TransferPacket.TransferData.Packet = 0; | ||
407 | TransferPacket.TransferData.ChannelType = 2; | ||
408 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
409 | TransferPacket.TransferData.Data = req.AssetInf.Data; | ||
410 | TransferPacket.TransferData.Status = 1; | ||
411 | req.RequestUser.OutPacket(TransferPacket); | ||
412 | } | ||
413 | else | ||
414 | { | ||
415 | //more than one packet so split file up , for now it can't be bigger than 2000 bytes | ||
416 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); | ||
417 | TransferPacket.TransferData.Packet = 0; | ||
418 | TransferPacket.TransferData.ChannelType = 2; | ||
419 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
420 | byte[] chunk = new byte[1000]; | ||
421 | Array.Copy(req.AssetInf.Data, chunk, 1000); | ||
422 | TransferPacket.TransferData.Data = chunk; | ||
423 | TransferPacket.TransferData.Status = 0; | ||
424 | req.RequestUser.OutPacket(TransferPacket); | ||
425 | |||
426 | TransferPacket = new TransferPacketPacket(); | ||
427 | TransferPacket.TransferData.Packet = 1; | ||
428 | TransferPacket.TransferData.ChannelType = 2; | ||
429 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
430 | byte[] chunk1 = new byte[(req.AssetInf.Data.Length - 1000)]; | ||
431 | Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length); | ||
432 | TransferPacket.TransferData.Data = chunk1; | ||
433 | TransferPacket.TransferData.Status = 1; | ||
434 | req.RequestUser.OutPacket(TransferPacket); | ||
435 | } | ||
436 | |||
437 | } | ||
438 | |||
439 | //remove requests that have been completed | ||
440 | for (int i = 0; i < num; i++) | ||
441 | { | ||
442 | this.AssetRequests.RemoveAt(0); | ||
443 | } | ||
444 | |||
445 | } | ||
446 | |||
447 | public AssetInfo CloneAsset(LLUUID newOwner, AssetInfo sourceAsset) | ||
448 | { | ||
449 | AssetInfo newAsset = new AssetInfo(); | ||
450 | newAsset.Data = new byte[sourceAsset.Data.Length]; | ||
451 | Array.Copy(sourceAsset.Data, newAsset.Data, sourceAsset.Data.Length); | ||
452 | newAsset.FullID = LLUUID.Random(); | ||
453 | newAsset.Type = sourceAsset.Type; | ||
454 | newAsset.InvType = sourceAsset.InvType; | ||
455 | return (newAsset); | ||
456 | } | ||
457 | #endregion | ||
458 | |||
459 | #region Textures | ||
460 | /// <summary> | ||
461 | /// | ||
462 | /// </summary> | ||
463 | /// <param name="userInfo"></param> | ||
464 | /// <param name="imageID"></param> | ||
465 | public void AddTextureRequest(ClientView userInfo, LLUUID imageID) | ||
466 | { | ||
467 | //check to see if texture is in local cache, if not request from asset server | ||
468 | if (!this.Textures.ContainsKey(imageID)) | ||
469 | { | ||
470 | if (!this.RequestedTextures.ContainsKey(imageID)) | ||
471 | { | ||
472 | //not is cache so request from asset server | ||
473 | AssetRequest request = new AssetRequest(); | ||
474 | request.RequestUser = userInfo; | ||
475 | request.RequestAssetID = imageID; | ||
476 | request.IsTextureRequest = true; | ||
477 | this.RequestedTextures.Add(imageID, request); | ||
478 | this._assetServer.RequestAsset(imageID, true); | ||
479 | } | ||
480 | return; | ||
481 | } | ||
482 | |||
483 | TextureImage imag = this.Textures[imageID]; | ||
484 | AssetRequest req = new AssetRequest(); | ||
485 | req.RequestUser = userInfo; | ||
486 | req.RequestAssetID = imageID; | ||
487 | req.IsTextureRequest = true; | ||
488 | req.ImageInfo = imag; | ||
489 | |||
490 | if (imag.Data.LongLength > 600) | ||
491 | { | ||
492 | //over 600 bytes so split up file | ||
493 | req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000; | ||
494 | } | ||
495 | else | ||
496 | { | ||
497 | req.NumPackets = 1; | ||
498 | } | ||
499 | this.TextureRequests.Add(req); | ||
500 | } | ||
501 | |||
502 | public TextureImage CloneImage(LLUUID newOwner, TextureImage source) | ||
503 | { | ||
504 | TextureImage newImage = new TextureImage(); | ||
505 | newImage.Data = new byte[source.Data.Length]; | ||
506 | Array.Copy(source.Data, newImage.Data, source.Data.Length); | ||
507 | //newImage.filename = source.filename; | ||
508 | newImage.FullID = LLUUID.Random(); | ||
509 | newImage.Name = source.Name; | ||
510 | return (newImage); | ||
511 | } | ||
512 | #endregion | ||
513 | |||
514 | } | ||
515 | |||
516 | public class AssetRequest | ||
517 | { | ||
518 | public ClientView RequestUser; | ||
519 | public LLUUID RequestAssetID; | ||
520 | public AssetInfo AssetInf; | ||
521 | public TextureImage ImageInfo; | ||
522 | public LLUUID TransferRequestID; | ||
523 | public long DataPointer = 0; | ||
524 | public int NumPackets = 0; | ||
525 | public int PacketCounter = 0; | ||
526 | public bool IsTextureRequest; | ||
527 | //public bool AssetInCache; | ||
528 | //public int TimeRequested; | ||
529 | |||
530 | public AssetRequest() | ||
531 | { | ||
532 | |||
533 | } | ||
534 | } | ||
535 | |||
536 | public class AssetInfo : AssetBase | ||
537 | { | ||
538 | public AssetInfo() | ||
539 | { | ||
540 | |||
541 | } | ||
542 | |||
543 | public AssetInfo(AssetBase aBase) | ||
544 | { | ||
545 | Data = aBase.Data; | ||
546 | FullID = aBase.FullID; | ||
547 | Type = aBase.Type; | ||
548 | InvType = aBase.InvType; | ||
549 | Name = aBase.Name; | ||
550 | Description = aBase.Description; | ||
551 | } | ||
552 | } | ||
553 | |||
554 | public class TextureImage : AssetBase | ||
555 | { | ||
556 | public TextureImage() | ||
557 | { | ||
558 | |||
559 | } | ||
560 | |||
561 | public TextureImage(AssetBase aBase) | ||
562 | { | ||
563 | Data = aBase.Data; | ||
564 | FullID = aBase.FullID; | ||
565 | Type = aBase.Type; | ||
566 | InvType = aBase.InvType; | ||
567 | Name = aBase.Name; | ||
568 | Description = aBase.Description; | ||
569 | } | ||
570 | } | ||
571 | |||
572 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim/OpenSim.RegionServer/Assets/InventoryCache.cs deleted file mode 100644 index 9ed5dcb..0000000 --- a/OpenSim/OpenSim.RegionServer/Assets/InventoryCache.cs +++ /dev/null | |||
@@ -1,338 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using libsecondlife; | ||
32 | using OpenSim; | ||
33 | using libsecondlife.Packets; | ||
34 | |||
35 | using OpenSim.Framework.Inventory; | ||
36 | using OpenSim.Framework.Types; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.RegionServer.Client; | ||
39 | |||
40 | namespace OpenSim.RegionServer.Assets | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// Description of InventoryManager. | ||
44 | /// </summary> | ||
45 | public class InventoryCache | ||
46 | { | ||
47 | private Dictionary<LLUUID, AgentInventory> _agentsInventory; | ||
48 | private List<UserServerRequest> _serverRequests; //list of requests made to user server. | ||
49 | private System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
50 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
51 | |||
52 | public InventoryCache() | ||
53 | { | ||
54 | _agentsInventory = new Dictionary<LLUUID, AgentInventory>(); | ||
55 | _serverRequests = new List<UserServerRequest>(); | ||
56 | } | ||
57 | |||
58 | public void AddNewAgentsInventory(AgentInventory agentInventory) | ||
59 | { | ||
60 | if (!this._agentsInventory.ContainsKey(agentInventory.AgentID)) | ||
61 | { | ||
62 | this._agentsInventory.Add(agentInventory.AgentID, agentInventory); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | public AgentInventory FetchAgentsInventory(LLUUID agentID, IUserServer userserver) | ||
67 | { | ||
68 | AgentInventory res = null; | ||
69 | if (!this._agentsInventory.ContainsKey(agentID)) | ||
70 | { | ||
71 | res = userserver.RequestAgentsInventory(agentID); | ||
72 | this._agentsInventory.Add(agentID,res); | ||
73 | } | ||
74 | return res; | ||
75 | } | ||
76 | |||
77 | public AgentInventory GetAgentsInventory(LLUUID agentID) | ||
78 | { | ||
79 | if (this._agentsInventory.ContainsKey(agentID)) | ||
80 | { | ||
81 | return this._agentsInventory[agentID]; | ||
82 | } | ||
83 | |||
84 | return null; | ||
85 | } | ||
86 | |||
87 | public void ClientLeaving(LLUUID clientID, IUserServer userserver) | ||
88 | { | ||
89 | if (this._agentsInventory.ContainsKey(clientID)) | ||
90 | { | ||
91 | if (userserver != null) | ||
92 | { | ||
93 | userserver.UpdateAgentsInventory(clientID, this._agentsInventory[clientID]); | ||
94 | } | ||
95 | this._agentsInventory.Remove(clientID); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID) | ||
100 | { | ||
101 | return this.CreateNewInventoryFolder(remoteClient, folderID, 0); | ||
102 | } | ||
103 | |||
104 | public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type) | ||
105 | { | ||
106 | bool res = false; | ||
107 | if (folderID != LLUUID.Zero) //don't create a folder with a zero id | ||
108 | { | ||
109 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | ||
110 | { | ||
111 | res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type); | ||
112 | } | ||
113 | } | ||
114 | return res; | ||
115 | } | ||
116 | |||
117 | public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent) | ||
118 | { | ||
119 | bool res = false; | ||
120 | if (folderID != LLUUID.Zero) //don't create a folder with a zero id | ||
121 | { | ||
122 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | ||
123 | { | ||
124 | res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent); | ||
125 | } | ||
126 | } | ||
127 | return res; | ||
128 | } | ||
129 | |||
130 | public LLUUID AddNewInventoryItem(ClientView remoteClient, LLUUID folderID, OpenSim.Framework.Types.AssetBase asset) | ||
131 | { | ||
132 | LLUUID newItem = null; | ||
133 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | ||
134 | { | ||
135 | newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset); | ||
136 | if (newItem != null) | ||
137 | { | ||
138 | InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[newItem]; | ||
139 | this.SendItemUpdateCreate(remoteClient, Item); | ||
140 | } | ||
141 | } | ||
142 | |||
143 | return newItem; | ||
144 | } | ||
145 | public bool DeleteInventoryItem(ClientView remoteClient, LLUUID itemID) | ||
146 | { | ||
147 | bool res = false; | ||
148 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | ||
149 | { | ||
150 | res = this._agentsInventory[remoteClient.AgentID].DeleteFromInventory(itemID); | ||
151 | if (res) | ||
152 | { | ||
153 | RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); | ||
154 | remove.AgentData.AgentID = remoteClient.AgentID; | ||
155 | remove.AgentData.SessionID = remoteClient.SessionID; | ||
156 | remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; | ||
157 | remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); | ||
158 | remove.InventoryData[0].ItemID = itemID; | ||
159 | remoteClient.OutPacket(remove); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | return res; | ||
164 | } | ||
165 | |||
166 | public bool UpdateInventoryItemAsset(ClientView remoteClient, LLUUID itemID, OpenSim.Framework.Types.AssetBase asset) | ||
167 | { | ||
168 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | ||
169 | { | ||
170 | bool res = _agentsInventory[remoteClient.AgentID].UpdateItemAsset(itemID, asset); | ||
171 | if (res) | ||
172 | { | ||
173 | InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; | ||
174 | this.SendItemUpdateCreate(remoteClient, Item); | ||
175 | } | ||
176 | return res; | ||
177 | } | ||
178 | |||
179 | return false; | ||
180 | } | ||
181 | |||
182 | public bool UpdateInventoryItemDetails(ClientView remoteClient, LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) | ||
183 | { | ||
184 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | ||
185 | { | ||
186 | bool res = _agentsInventory[remoteClient.AgentID].UpdateItemDetails(itemID, packet); | ||
187 | if (res) | ||
188 | { | ||
189 | InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; | ||
190 | this.SendItemUpdateCreate(remoteClient, Item); | ||
191 | } | ||
192 | return res; | ||
193 | } | ||
194 | |||
195 | return false; | ||
196 | } | ||
197 | |||
198 | public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend) | ||
199 | { | ||
200 | if (this._agentsInventory.ContainsKey(userInfo.AgentID)) | ||
201 | { | ||
202 | AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; | ||
203 | if (FetchDescend.InventoryData.FetchItems) | ||
204 | { | ||
205 | if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID)) | ||
206 | { | ||
207 | InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID]; | ||
208 | InventoryDescendentsPacket Descend = new InventoryDescendentsPacket(); | ||
209 | Descend.AgentData.AgentID = userInfo.AgentID; | ||
210 | Descend.AgentData.OwnerID = Folder.OwnerID; | ||
211 | Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID; | ||
212 | Descend.AgentData.Descendents = Folder.Items.Count; | ||
213 | Descend.AgentData.Version = Folder.Items.Count; | ||
214 | |||
215 | |||
216 | Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count]; | ||
217 | for (int i = 0; i < Folder.Items.Count; i++) | ||
218 | { | ||
219 | |||
220 | InventoryItem Item = Folder.Items[i]; | ||
221 | Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); | ||
222 | Descend.ItemData[i].ItemID = Item.ItemID; | ||
223 | Descend.ItemData[i].AssetID = Item.AssetID; | ||
224 | Descend.ItemData[i].CreatorID = Item.CreatorID; | ||
225 | Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS; | ||
226 | Descend.ItemData[i].CreationDate = 1000; | ||
227 | Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0"); | ||
228 | Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS; | ||
229 | Descend.ItemData[i].Flags = 1; | ||
230 | Descend.ItemData[i].FolderID = Item.FolderID; | ||
231 | Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
232 | Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS; | ||
233 | Descend.ItemData[i].InvType = Item.InvType; | ||
234 | Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0"); | ||
235 | Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
236 | Descend.ItemData[i].OwnerID = Item.OwnerID; | ||
237 | Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS; | ||
238 | Descend.ItemData[i].SalePrice = 100; | ||
239 | Descend.ItemData[i].SaleType = 0; | ||
240 | Descend.ItemData[i].Type = Item.Type; | ||
241 | Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | ||
242 | } | ||
243 | |||
244 | userInfo.OutPacket(Descend); | ||
245 | |||
246 | } | ||
247 | } | ||
248 | else | ||
249 | { | ||
250 | Console.WriteLine("fetch subfolders"); | ||
251 | } | ||
252 | } | ||
253 | } | ||
254 | |||
255 | public void FetchInventory(ClientView userInfo, FetchInventoryPacket FetchItems) | ||
256 | { | ||
257 | if (this._agentsInventory.ContainsKey(userInfo.AgentID)) | ||
258 | { | ||
259 | AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; | ||
260 | |||
261 | for (int i = 0; i < FetchItems.InventoryData.Length; i++) | ||
262 | { | ||
263 | if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID)) | ||
264 | { | ||
265 | InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID]; | ||
266 | FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket(); | ||
267 | InventoryReply.AgentData.AgentID = userInfo.AgentID; | ||
268 | InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; | ||
269 | InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); | ||
270 | InventoryReply.InventoryData[0].ItemID = Item.ItemID; | ||
271 | InventoryReply.InventoryData[0].AssetID = Item.AssetID; | ||
272 | InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; | ||
273 | InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; | ||
274 | InventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
275 | InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); | ||
276 | InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; | ||
277 | InventoryReply.InventoryData[0].Flags = 0; | ||
278 | InventoryReply.InventoryData[0].FolderID = Item.FolderID; | ||
279 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
280 | InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; | ||
281 | InventoryReply.InventoryData[0].InvType = Item.InvType; | ||
282 | InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); | ||
283 | InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
284 | InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; | ||
285 | InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; | ||
286 | InventoryReply.InventoryData[0].SalePrice = 100; | ||
287 | InventoryReply.InventoryData[0].SaleType = 0; | ||
288 | InventoryReply.InventoryData[0].Type = Item.Type; | ||
289 | InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | ||
290 | userInfo.OutPacket(InventoryReply); | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | } | ||
295 | |||
296 | private void SendItemUpdateCreate(ClientView remoteClient, InventoryItem Item) | ||
297 | { | ||
298 | |||
299 | UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); | ||
300 | InventoryReply.AgentData.AgentID = remoteClient.AgentID; | ||
301 | InventoryReply.AgentData.SimApproved = true; | ||
302 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | ||
303 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | ||
304 | InventoryReply.InventoryData[0].ItemID = Item.ItemID; | ||
305 | InventoryReply.InventoryData[0].AssetID = Item.AssetID; | ||
306 | InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; | ||
307 | InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; | ||
308 | InventoryReply.InventoryData[0].CreationDate = 1000; | ||
309 | InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); | ||
310 | InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; | ||
311 | InventoryReply.InventoryData[0].Flags = 0; | ||
312 | InventoryReply.InventoryData[0].FolderID = Item.FolderID; | ||
313 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
314 | InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; | ||
315 | InventoryReply.InventoryData[0].InvType = Item.InvType; | ||
316 | InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); | ||
317 | InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
318 | InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; | ||
319 | InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; | ||
320 | InventoryReply.InventoryData[0].SalePrice = 100; | ||
321 | InventoryReply.InventoryData[0].SaleType = 0; | ||
322 | InventoryReply.InventoryData[0].Type = Item.Type; | ||
323 | InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | ||
324 | |||
325 | remoteClient.OutPacket(InventoryReply); | ||
326 | } | ||
327 | } | ||
328 | |||
329 | |||
330 | |||
331 | public class UserServerRequest | ||
332 | { | ||
333 | public UserServerRequest() | ||
334 | { | ||
335 | |||
336 | } | ||
337 | } | ||
338 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsBase.cs b/OpenSim/OpenSim.RegionServer/AuthenticateSessionsBase.cs deleted file mode 100644 index 6f80210..0000000 --- a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsBase.cs +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using OpenSim.Framework.Interfaces; | ||
33 | using OpenSim.Framework.Types; | ||
34 | |||
35 | namespace OpenSim.RegionServer | ||
36 | { | ||
37 | public class AuthenticateSessionsBase | ||
38 | { | ||
39 | public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>(); | ||
40 | |||
41 | public AuthenticateSessionsBase() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) | ||
47 | { | ||
48 | AgentCircuitData validcircuit = null; | ||
49 | if (this.AgentCircuits.ContainsKey(circuitcode)) | ||
50 | { | ||
51 | validcircuit = this.AgentCircuits[circuitcode]; | ||
52 | } | ||
53 | AuthenticateResponse user = new AuthenticateResponse(); | ||
54 | if (validcircuit == null) | ||
55 | { | ||
56 | //don't have this circuit code in our list | ||
57 | user.Authorised = false; | ||
58 | return (user); | ||
59 | } | ||
60 | |||
61 | if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) | ||
62 | { | ||
63 | user.Authorised = true; | ||
64 | user.LoginInfo = new Login(); | ||
65 | user.LoginInfo.Agent = agentID; | ||
66 | user.LoginInfo.Session = sessionID; | ||
67 | user.LoginInfo.SecureSession = validcircuit.SecureSessionID; | ||
68 | user.LoginInfo.First = validcircuit.firstname; | ||
69 | user.LoginInfo.Last = validcircuit.lastname; | ||
70 | user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder; | ||
71 | user.LoginInfo.BaseFolder = validcircuit.BaseFolder; | ||
72 | } | ||
73 | else | ||
74 | { | ||
75 | // Invalid | ||
76 | user.Authorised = false; | ||
77 | } | ||
78 | |||
79 | return (user); | ||
80 | } | ||
81 | |||
82 | public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) | ||
83 | { | ||
84 | if (this.AgentCircuits.ContainsKey(circuitCode)) | ||
85 | { | ||
86 | this.AgentCircuits[circuitCode] = agentData; | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | this.AgentCircuits.Add(circuitCode, agentData); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public LLVector3 GetPosition(uint circuitCode) | ||
95 | { | ||
96 | LLVector3 vec = new LLVector3(); | ||
97 | if (this.AgentCircuits.ContainsKey(circuitCode)) | ||
98 | { | ||
99 | vec = this.AgentCircuits[circuitCode].startpos; | ||
100 | } | ||
101 | return vec; | ||
102 | } | ||
103 | |||
104 | public void UpdateAgentData(AgentCircuitData agentData) | ||
105 | { | ||
106 | if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode)) | ||
107 | { | ||
108 | this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname; | ||
109 | this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname; | ||
110 | this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) | ||
115 | { | ||
116 | if (this.AgentCircuits.ContainsKey(circuitcode)) | ||
117 | { | ||
118 | this.AgentCircuits[circuitcode].child = childstatus; | ||
119 | } | ||
120 | } | ||
121 | |||
122 | public bool GetAgentChildStatus(uint circuitcode) | ||
123 | { | ||
124 | if (this.AgentCircuits.ContainsKey(circuitcode)) | ||
125 | { | ||
126 | return this.AgentCircuits[circuitcode].child; | ||
127 | } | ||
128 | return false; | ||
129 | } | ||
130 | } | ||
131 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsLocal.cs b/OpenSim/OpenSim.RegionServer/AuthenticateSessionsLocal.cs deleted file mode 100644 index e0ffd71..0000000 --- a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsLocal.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using OpenSim.Framework.Types; | ||
33 | |||
34 | namespace OpenSim.RegionServer | ||
35 | { | ||
36 | public class AuthenticateSessionsLocal : AuthenticateSessionsBase | ||
37 | { | ||
38 | public AuthenticateSessionsLocal() | ||
39 | { | ||
40 | |||
41 | } | ||
42 | |||
43 | public void AddNewSession(Login loginData) | ||
44 | { | ||
45 | AgentCircuitData agent = new AgentCircuitData(); | ||
46 | agent.AgentID = loginData.Agent; | ||
47 | agent.firstname = loginData.First; | ||
48 | agent.lastname = loginData.Last; | ||
49 | agent.SessionID = loginData.Session; | ||
50 | agent.SecureSessionID = loginData.SecureSession; | ||
51 | agent.circuitcode = loginData.CircuitCode; | ||
52 | agent.BaseFolder = loginData.BaseFolder; | ||
53 | agent.InventoryFolder = loginData.InventoryFolder; | ||
54 | agent.startpos = new LLVector3(128,128,70); | ||
55 | this.AddNewCircuit(agent.circuitcode, agent); | ||
56 | } | ||
57 | } | ||
58 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsRemote.cs b/OpenSim/OpenSim.RegionServer/AuthenticateSessionsRemote.cs deleted file mode 100644 index 5747f8a..0000000 --- a/OpenSim/OpenSim.RegionServer/AuthenticateSessionsRemote.cs +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.Xml; | ||
33 | using libsecondlife; | ||
34 | using OpenSim.Framework.Types; | ||
35 | using Nwc.XmlRpc; | ||
36 | |||
37 | namespace OpenSim.RegionServer | ||
38 | { | ||
39 | public class AuthenticateSessionsRemote : AuthenticateSessionsBase | ||
40 | { | ||
41 | public AuthenticateSessionsRemote() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | public XmlRpcResponse ExpectUser(XmlRpcRequest request) | ||
47 | { | ||
48 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
49 | AgentCircuitData agentData = new AgentCircuitData(); | ||
50 | agentData.SessionID = new LLUUID((string)requestData["session_id"]); | ||
51 | agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); | ||
52 | agentData.firstname = (string)requestData["firstname"]; | ||
53 | agentData.lastname = (string)requestData["lastname"]; | ||
54 | agentData.AgentID = new LLUUID((string)requestData["agent_id"]); | ||
55 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | ||
56 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | ||
57 | { | ||
58 | agentData.child = true; | ||
59 | } | ||
60 | else | ||
61 | { | ||
62 | agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); | ||
63 | agentData.child = false; | ||
64 | |||
65 | } | ||
66 | |||
67 | this.AddNewCircuit(agentData.circuitcode, agentData); | ||
68 | |||
69 | return new XmlRpcResponse(); | ||
70 | } | ||
71 | } | ||
72 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs deleted file mode 100644 index ead902d..0000000 --- a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs +++ /dev/null | |||
@@ -1,281 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.IO; | ||
32 | using OpenSim.RegionServer.Simulator; | ||
33 | using OpenSim.UserServer; | ||
34 | using OpenSim.Servers; | ||
35 | using OpenSim.RegionServer.Assets; | ||
36 | using OpenSim.Framework.Inventory; | ||
37 | using libsecondlife; | ||
38 | using OpenSim.RegionServer.Scripting; | ||
39 | using Avatar=libsecondlife.Avatar; | ||
40 | |||
41 | namespace OpenSim.RegionServer.CAPS | ||
42 | { | ||
43 | public class AdminWebFront | ||
44 | { | ||
45 | private string AdminPage; | ||
46 | private string NewAccountForm; | ||
47 | private string LoginForm; | ||
48 | private string passWord = "Admin"; | ||
49 | private World m_world; | ||
50 | private LoginServer _userServer; | ||
51 | private InventoryCache _inventoryCache; | ||
52 | |||
53 | public AdminWebFront(string password, World world, InventoryCache inventoryCache, LoginServer userserver) | ||
54 | { | ||
55 | _inventoryCache = inventoryCache; | ||
56 | _userServer = userserver; | ||
57 | m_world = world; | ||
58 | passWord = password; | ||
59 | LoadAdminPage(); | ||
60 | } | ||
61 | |||
62 | public void LoadMethods( BaseHttpServer server ) | ||
63 | { | ||
64 | server.AddRestHandler("GET", "/Admin", GetAdminPage); | ||
65 | server.AddRestHandler("GET", "/Admin/Welcome", GetWelcomePage); | ||
66 | server.AddRestHandler("GET", "/Admin/Accounts", GetAccountsPage ); | ||
67 | server.AddRestHandler("GET", "/Admin/Clients", GetConnectedClientsPage); | ||
68 | server.AddRestHandler("GET", "/Admin/Entities", GetEntitiesPage); | ||
69 | server.AddRestHandler("GET", "/Admin/Scripts", GetScriptsPage); | ||
70 | server.AddRestHandler("GET", "/Admin/AddTestScript", AddTestScript ); | ||
71 | server.AddRestHandler("GET", "/ClientInventory", GetClientsInventory); | ||
72 | |||
73 | server.AddRestHandler("POST", "/Admin/NewAccount", PostNewAccount ); | ||
74 | server.AddRestHandler("POST", "/Admin/Login", PostLogin ); | ||
75 | } | ||
76 | |||
77 | private string GetWelcomePage(string request, string path, string param) | ||
78 | { | ||
79 | string responseString; | ||
80 | responseString = "Welcome to the OpenSim Admin Page"; | ||
81 | responseString += "<br><br><br> " + LoginForm; | ||
82 | return responseString; | ||
83 | } | ||
84 | |||
85 | private string PostLogin(string requestBody, string path, string param) | ||
86 | { | ||
87 | string responseString; | ||
88 | if (requestBody == passWord) | ||
89 | { | ||
90 | responseString = "<p> Login Successful </p>"; | ||
91 | } | ||
92 | else | ||
93 | { | ||
94 | responseString = "<p> Password Error </p>"; | ||
95 | responseString += "<p> Please Login with the correct password </p>"; | ||
96 | responseString += "<br><br> " + LoginForm; | ||
97 | } | ||
98 | return responseString; | ||
99 | } | ||
100 | |||
101 | private string PostNewAccount(string requestBody, string path, string param) | ||
102 | { | ||
103 | string responseString; | ||
104 | string firstName = ""; | ||
105 | string secondName = ""; | ||
106 | string userPasswd = ""; | ||
107 | string[] comp; | ||
108 | string[] passw; | ||
109 | string[] line; | ||
110 | string delimStr = "&"; | ||
111 | char[] delimiter = delimStr.ToCharArray(); | ||
112 | string delimStr2 = "="; | ||
113 | char[] delimiter2 = delimStr2.ToCharArray(); | ||
114 | |||
115 | comp = requestBody.Split(delimiter); | ||
116 | passw = comp[3].Split(delimiter2); | ||
117 | if (passw[1] == passWord) // check admin password is correct | ||
118 | { | ||
119 | |||
120 | line = comp[0].Split(delimiter2); //split firstname | ||
121 | if (line.Length > 1) | ||
122 | { | ||
123 | firstName = line[1]; | ||
124 | } | ||
125 | line = comp[1].Split(delimiter2); //split secondname | ||
126 | if (line.Length > 1) | ||
127 | { | ||
128 | secondName = line[1]; | ||
129 | } | ||
130 | line = comp[2].Split(delimiter2); //split user password | ||
131 | if (line.Length > 1) | ||
132 | { | ||
133 | userPasswd = line[1]; | ||
134 | } | ||
135 | if (this._userServer != null) | ||
136 | { | ||
137 | this._userServer.CreateUserAccount(firstName, secondName, userPasswd); | ||
138 | } | ||
139 | responseString = "<p> New Account created </p>"; | ||
140 | } | ||
141 | else | ||
142 | { | ||
143 | responseString = "<p> Admin password is incorrect, please login with the correct password</p>"; | ||
144 | responseString += "<br><br>" + LoginForm; | ||
145 | } | ||
146 | return responseString; | ||
147 | } | ||
148 | |||
149 | private string GetConnectedClientsPage(string request, string path, string param) | ||
150 | { | ||
151 | string responseString; | ||
152 | responseString = " <p> Listing connected Clients </p>"; | ||
153 | OpenSim.RegionServer.Simulator.Avatar TempAv; | ||
154 | foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys) | ||
155 | { | ||
156 | if (m_world.Entities[UUID].ToString() == "OpenSim.RegionServer.Simulator.Avatar") | ||
157 | { | ||
158 | TempAv = (OpenSim.RegionServer.Simulator.Avatar)m_world.Entities[UUID]; | ||
159 | responseString += "<p> Client: "; | ||
160 | responseString += TempAv.firstname + " , " + TempAv.lastname + " , <A HREF=\"javascript:loadXMLDoc('ClientInventory/" + UUID.ToString() + "')\">" + UUID + "</A> , " + TempAv.ControllingClient.SessionID + " , " + TempAv.ControllingClient.CircuitCode + " , " + TempAv.ControllingClient.userEP.ToString(); | ||
161 | responseString += "</p>"; | ||
162 | } | ||
163 | } | ||
164 | return responseString; | ||
165 | } | ||
166 | |||
167 | private string AddTestScript(string request, string path, string param) | ||
168 | { | ||
169 | int index = path.LastIndexOf('/'); | ||
170 | |||
171 | string lluidStr = path.Substring(index+1); | ||
172 | |||
173 | LLUUID id; | ||
174 | |||
175 | if( LLUUID.TryParse( lluidStr, out id ) ) | ||
176 | { | ||
177 | // This is just here for concept purposes... Remove! | ||
178 | m_world.AddScript( m_world.Entities[id], new FollowRandomAvatar()); | ||
179 | return String.Format("Added new script to object [{0}]", id); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | return String.Format("Couldn't parse [{0}]", lluidStr ); | ||
184 | } | ||
185 | } | ||
186 | |||
187 | private string GetScriptsPage(string request, string path, string param) | ||
188 | { | ||
189 | return String.Empty; | ||
190 | } | ||
191 | |||
192 | private string GetEntitiesPage(string request, string path, string param) | ||
193 | { | ||
194 | string responseString; | ||
195 | responseString = " <p> Listing current entities</p><ul>"; | ||
196 | |||
197 | foreach (Entity entity in m_world.Entities.Values) | ||
198 | { | ||
199 | string testScriptLink = "javascript:loadXMLDoc('Admin/AddTestScript/" + entity.uuid.ToString() + "');"; | ||
200 | responseString += String.Format( "<li>[{0}] \"{1}\" @ {2} <a href=\"{3}\">add test script</a></li>", entity.uuid, entity.Name, entity.Pos, testScriptLink ); | ||
201 | } | ||
202 | responseString += "</ul>"; | ||
203 | return responseString; | ||
204 | } | ||
205 | |||
206 | private string GetClientsInventory(string request, string path, string param) | ||
207 | { | ||
208 | string[] line; | ||
209 | string delimStr = "/"; | ||
210 | char[] delimiter = delimStr.ToCharArray(); | ||
211 | string responseString; | ||
212 | responseString = " <p> Listing Inventory </p>"; | ||
213 | |||
214 | line = path.Split(delimiter); | ||
215 | if (line.Length > 2) | ||
216 | { | ||
217 | if (line[1] == "ClientInventory") | ||
218 | { | ||
219 | AgentInventory inven = this._inventoryCache.GetAgentsInventory(new libsecondlife.LLUUID(line[2])); | ||
220 | responseString += " <p> Client: " + inven.AgentID.ToStringHyphenated() +" </p>"; | ||
221 | if (inven != null) | ||
222 | { | ||
223 | foreach (InventoryItem item in inven.InventoryItems.Values) | ||
224 | { | ||
225 | responseString += "<p> InventoryItem: "; | ||
226 | responseString += item.Name +" , "+ item.ItemID +" , "+ item.Type +" , "+ item.FolderID +" , "+ item.AssetID +" , "+ item.Description ; | ||
227 | responseString += "</p>"; | ||
228 | } | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | return responseString; | ||
233 | } | ||
234 | |||
235 | private string GetCachedAssets(string request, string path, string param) | ||
236 | { | ||
237 | return ""; | ||
238 | } | ||
239 | |||
240 | private string GetAccountsPage(string request, string path, string param) | ||
241 | { | ||
242 | string responseString; | ||
243 | responseString = "<p> Account management </p>"; | ||
244 | responseString += "<br> "; | ||
245 | responseString += "<p> Create New Account </p>"; | ||
246 | responseString += NewAccountForm; | ||
247 | return responseString; | ||
248 | } | ||
249 | |||
250 | private string GetAdminPage(string request, string path, string param) | ||
251 | { | ||
252 | return AdminPage; | ||
253 | } | ||
254 | |||
255 | private void LoadAdminPage() | ||
256 | { | ||
257 | try | ||
258 | { | ||
259 | StreamReader SR; | ||
260 | |||
261 | SR = File.OpenText("testadmin.htm"); | ||
262 | AdminPage = SR.ReadToEnd(); | ||
263 | SR.Close(); | ||
264 | |||
265 | SR = File.OpenText("newaccountform.htm"); | ||
266 | NewAccountForm = SR.ReadToEnd(); | ||
267 | SR.Close(); | ||
268 | |||
269 | SR = File.OpenText("login.htm"); | ||
270 | LoginForm = SR.ReadToEnd(); | ||
271 | SR.Close(); | ||
272 | } | ||
273 | catch (Exception e) | ||
274 | { | ||
275 | Console.WriteLine(e.ToString()); | ||
276 | } | ||
277 | |||
278 | } | ||
279 | |||
280 | } | ||
281 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Client/ClientView.Grid.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.Grid.cs deleted file mode 100644 index 0bccbc2..0000000 --- a/OpenSim/OpenSim.RegionServer/Client/ClientView.Grid.cs +++ /dev/null | |||
@@ -1,192 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using Nwc.XmlRpc; | ||
34 | using System.Net; | ||
35 | using System.Net.Sockets; | ||
36 | using System.IO; | ||
37 | using System.Threading; | ||
38 | using System.Timers; | ||
39 | using OpenSim.Framework.Interfaces; | ||
40 | using OpenSim.Framework.Types; | ||
41 | using OpenSim.Framework.Inventory; | ||
42 | using OpenSim.Framework.Utilities; | ||
43 | using OpenSim.RegionServer.Simulator; | ||
44 | using OpenSim.RegionServer.Assets; | ||
45 | using OpenSim.Framework.Console; | ||
46 | |||
47 | namespace OpenSim.RegionServer.Client | ||
48 | { | ||
49 | public partial class ClientView | ||
50 | { | ||
51 | |||
52 | public void EnableNeighbours() | ||
53 | { | ||
54 | if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child)) | ||
55 | { | ||
56 | Hashtable SimParams; | ||
57 | ArrayList SendParams; | ||
58 | XmlRpcRequest GridReq; | ||
59 | XmlRpcResponse GridResp; | ||
60 | List<Packet> enablePackets = new List<Packet>(); | ||
61 | |||
62 | RemoteGridBase gridServer = (RemoteGridBase)this.m_gridServer; | ||
63 | |||
64 | foreach (Hashtable neighbour in gridServer.neighbours) | ||
65 | { | ||
66 | try | ||
67 | { | ||
68 | string neighbourIPStr = (string)neighbour["sim_ip"]; | ||
69 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse(neighbourIPStr); | ||
70 | ushort neighbourPort = (ushort)Convert.ToInt32(neighbour["sim_port"]); | ||
71 | string reqUrl = "http://" + neighbourIPStr + ":" + neighbourPort.ToString(); | ||
72 | |||
73 | MainConsole.Instance.Verbose("Requesting " + reqUrl); | ||
74 | |||
75 | SimParams = new Hashtable(); | ||
76 | SimParams["session_id"] = this.SessionID.ToString(); | ||
77 | SimParams["secure_session_id"] = this.SecureSessionID.ToString(); | ||
78 | SimParams["firstname"] = this.ClientAvatar.firstname; | ||
79 | SimParams["lastname"] = this.ClientAvatar.lastname; | ||
80 | SimParams["agent_id"] = this.AgentID.ToString(); | ||
81 | SimParams["circuit_code"] = (Int32)this.CircuitCode; | ||
82 | SimParams["child_agent"] = "1"; | ||
83 | SendParams = new ArrayList(); | ||
84 | SendParams.Add(SimParams); | ||
85 | |||
86 | GridReq = new XmlRpcRequest("expect_user", SendParams); | ||
87 | GridResp = GridReq.Send(reqUrl, 3000); | ||
88 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | ||
89 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | ||
90 | enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256)); | ||
91 | |||
92 | |||
93 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
94 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | ||
95 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | ||
96 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | ||
97 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | ||
98 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | ||
99 | enablePackets.Add(enablesimpacket); | ||
100 | } | ||
101 | catch | ||
102 | { | ||
103 | MainConsole.Instance.Notice("Could not connect to neighbour " + neighbour["sim_ip"] + ":" + neighbour["sim_port"] + ", continuing."); | ||
104 | } | ||
105 | } | ||
106 | Thread.Sleep(3000); | ||
107 | foreach (Packet enable in enablePackets) | ||
108 | { | ||
109 | this.OutPacket(enable); | ||
110 | } | ||
111 | enablePackets.Clear(); | ||
112 | |||
113 | } | ||
114 | } | ||
115 | |||
116 | public void CrossSimBorder(LLVector3 avatarpos) | ||
117 | { // VERY VERY BASIC | ||
118 | |||
119 | LLVector3 newpos = avatarpos; | ||
120 | uint neighbourx = this.m_regionData.RegionLocX; | ||
121 | uint neighboury = this.m_regionData.RegionLocY; | ||
122 | |||
123 | if (avatarpos.X < 0) | ||
124 | { | ||
125 | neighbourx -= 1; | ||
126 | newpos.X = 254; | ||
127 | } | ||
128 | if (avatarpos.X > 255) | ||
129 | { | ||
130 | neighbourx += 1; | ||
131 | newpos.X = 1; | ||
132 | } | ||
133 | if (avatarpos.Y < 0) | ||
134 | { | ||
135 | neighboury -= 1; | ||
136 | newpos.Y = 254; | ||
137 | } | ||
138 | if (avatarpos.Y > 255) | ||
139 | { | ||
140 | neighboury += 1; | ||
141 | newpos.Y = 1; | ||
142 | } | ||
143 | MainConsole.Instance.Notice("SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]"); | ||
144 | |||
145 | Hashtable SimParams; | ||
146 | ArrayList SendParams; | ||
147 | XmlRpcRequest GridReq; | ||
148 | XmlRpcResponse GridResp; | ||
149 | foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) | ||
150 | { | ||
151 | if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) | ||
152 | { | ||
153 | SimParams = new Hashtable(); | ||
154 | SimParams["firstname"] = this.ClientAvatar.firstname; | ||
155 | SimParams["lastname"] = this.ClientAvatar.lastname; | ||
156 | SimParams["circuit_code"] = this.CircuitCode.ToString(); | ||
157 | SimParams["pos_x"] = newpos.X.ToString(); | ||
158 | SimParams["pos_y"] = newpos.Y.ToString(); | ||
159 | SimParams["pos_z"] = newpos.Z.ToString(); | ||
160 | SendParams = new ArrayList(); | ||
161 | SendParams.Add(SimParams); | ||
162 | |||
163 | GridReq = new XmlRpcRequest("agent_crossing", SendParams); | ||
164 | GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000); | ||
165 | |||
166 | CrossedRegionPacket NewSimPack = new CrossedRegionPacket(); | ||
167 | NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); | ||
168 | NewSimPack.AgentData.AgentID = this.AgentID; | ||
169 | NewSimPack.AgentData.SessionID = this.SessionID; | ||
170 | NewSimPack.Info = new CrossedRegionPacket.InfoBlock(); | ||
171 | NewSimPack.Info.Position = newpos; | ||
172 | NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! | ||
173 | NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); | ||
174 | NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256)); | ||
175 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]); | ||
176 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
177 | NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; | ||
178 | NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; | ||
179 | NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; | ||
180 | NewSimPack.RegionData.SimIP += (uint)byteIP[0]; | ||
181 | NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]); | ||
182 | NewSimPack.RegionData.SeedCapability = new byte[0]; | ||
183 | lock (PacketQueue) | ||
184 | { | ||
185 | ProcessOutPacket(NewSimPack); | ||
186 | DowngradeClient(); | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | } | ||
192 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Client/ClientView.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.PacketHandlers.cs deleted file mode 100644 index 4af0485..0000000 --- a/OpenSim/OpenSim.RegionServer/Client/ClientView.PacketHandlers.cs +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using Nwc.XmlRpc; | ||
34 | using System.Net; | ||
35 | using System.Net.Sockets; | ||
36 | using System.IO; | ||
37 | using System.Threading; | ||
38 | using System.Timers; | ||
39 | using OpenSim.Framework.Interfaces; | ||
40 | using OpenSim.Framework.Types; | ||
41 | using OpenSim.Framework.Inventory; | ||
42 | using OpenSim.Framework.Utilities; | ||
43 | using OpenSim.RegionServer.Simulator; | ||
44 | using OpenSim.RegionServer.Assets; | ||
45 | using OpenSim.Framework.Console; | ||
46 | |||
47 | namespace OpenSim.RegionServer.Client | ||
48 | { | ||
49 | public partial class ClientView | ||
50 | { | ||
51 | protected virtual void RegisterLocalPacketHandlers() | ||
52 | { | ||
53 | this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); | ||
54 | this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); | ||
55 | this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); | ||
56 | } | ||
57 | |||
58 | protected virtual bool Logout(ClientView simClient, Packet packet) | ||
59 | { | ||
60 | MainConsole.Instance.Notice("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); | ||
61 | //send reply to let the client logout | ||
62 | LogoutReplyPacket logReply = new LogoutReplyPacket(); | ||
63 | logReply.AgentData.AgentID = this.AgentID; | ||
64 | logReply.AgentData.SessionID = this.SessionID; | ||
65 | logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1]; | ||
66 | logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); | ||
67 | logReply.InventoryData[0].ItemID = LLUUID.Zero; | ||
68 | OutPacket(logReply); | ||
69 | //tell all clients to kill our object | ||
70 | KillObjectPacket kill = new KillObjectPacket(); | ||
71 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | ||
72 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | ||
73 | kill.ObjectData[0].ID = this.ClientAvatar.localid; | ||
74 | foreach (ClientView client in m_clientThreads.Values) | ||
75 | { | ||
76 | client.OutPacket(kill); | ||
77 | } | ||
78 | if (this.m_userServer != null) | ||
79 | { | ||
80 | this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | this.m_inventoryCache.ClientLeaving(this.AgentID, null); | ||
85 | } | ||
86 | |||
87 | m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); | ||
88 | /*lock (m_world.Entities) | ||
89 | { | ||
90 | m_world.Entities.Remove(this.AgentID); | ||
91 | }*/ | ||
92 | m_world.RemoveViewerAgent(this); | ||
93 | //need to do other cleaning up here too | ||
94 | m_clientThreads.Remove(this.CircuitCode); | ||
95 | m_networkServer.RemoveClientCircuit(this.CircuitCode); | ||
96 | this.ClientThread.Abort(); | ||
97 | return true; | ||
98 | } | ||
99 | |||
100 | protected bool AgentTextureCached(ClientView simclient, Packet packet) | ||
101 | { | ||
102 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet; | ||
103 | AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); | ||
104 | cachedresp.AgentData.AgentID = this.AgentID; | ||
105 | cachedresp.AgentData.SessionID = this.SessionID; | ||
106 | cachedresp.AgentData.SerialNum = this.cachedtextureserial; | ||
107 | this.cachedtextureserial++; | ||
108 | cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; | ||
109 | for (int i = 0; i < chechedtex.WearableData.Length; i++) | ||
110 | { | ||
111 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
112 | cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex; | ||
113 | cachedresp.WearableData[i].TextureID = LLUUID.Zero; | ||
114 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
115 | } | ||
116 | this.OutPacket(cachedresp); | ||
117 | return true; | ||
118 | } | ||
119 | |||
120 | protected bool MultipleObjUpdate(ClientView simClient, Packet packet) | ||
121 | { | ||
122 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; | ||
123 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) | ||
124 | { | ||
125 | if (multipleupdate.ObjectData[i].Type == 9) //change position | ||
126 | { | ||
127 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | ||
128 | OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | ||
129 | //should update stored position of the prim | ||
130 | } | ||
131 | else if (multipleupdate.ObjectData[i].Type == 10)//rotation | ||
132 | { | ||
133 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | ||
134 | OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | ||
135 | } | ||
136 | else if (multipleupdate.ObjectData[i].Type == 13)//scale | ||
137 | { | ||
138 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | ||
139 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | ||
140 | } | ||
141 | } | ||
142 | return true; | ||
143 | } | ||
144 | |||
145 | public void RequestMapLayer() //should be getting the map layer from the grid server | ||
146 | { | ||
147 | //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) | ||
148 | MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); | ||
149 | mapReply.AgentData.AgentID = this.AgentID; | ||
150 | mapReply.AgentData.Flags = 0; | ||
151 | mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; | ||
152 | mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); | ||
153 | mapReply.LayerData[0].Bottom = this.m_regionData.RegionLocY - 50; | ||
154 | mapReply.LayerData[0].Left = this.m_regionData.RegionLocX - 50; | ||
155 | mapReply.LayerData[0].Top = this.m_regionData.RegionLocY + 50; | ||
156 | mapReply.LayerData[0].Right = this.m_regionData.RegionLocX + 50; | ||
157 | mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000005"); | ||
158 | this.OutPacket(mapReply); | ||
159 | } | ||
160 | |||
161 | public void RequestMapBlocks(int minX, int minY, int maxX, int maxY) | ||
162 | { | ||
163 | IList simMapProfiles = m_gridServer.RequestMapBlocks(minX, minY, maxX, maxY); | ||
164 | int len; | ||
165 | if (simMapProfiles == null) | ||
166 | len = 0; | ||
167 | else | ||
168 | len = simMapProfiles.Count; | ||
169 | |||
170 | int i; | ||
171 | int mtu = 24; // Number of regions to send per packet. Will be more precise in future. ( TODO ) | ||
172 | for (i = 0; i < len; i += mtu) | ||
173 | { | ||
174 | MapBlockReplyPacket mbReply = new MapBlockReplyPacket(); | ||
175 | mbReply.AgentData.AgentID = this.AgentID; | ||
176 | |||
177 | mbReply.Data = new MapBlockReplyPacket.DataBlock[Math.Min(mtu, len - i)]; | ||
178 | int j; | ||
179 | for (j = 0; (j < mtu) && ((i + j) < len); j++) | ||
180 | { | ||
181 | Hashtable mp = (Hashtable)simMapProfiles[j]; | ||
182 | mbReply.Data[j] = new MapBlockReplyPacket.DataBlock(); | ||
183 | mbReply.Data[j].Name = libsecondlife.Helpers.StringToField((string)mp["name"]); | ||
184 | mbReply.Data[j].Access = System.Convert.ToByte(mp["access"]); | ||
185 | mbReply.Data[j].Agents = System.Convert.ToByte(mp["agents"]); | ||
186 | mbReply.Data[j].MapImageID = new LLUUID((string)mp["map-image-id"]); | ||
187 | mbReply.Data[j].RegionFlags = System.Convert.ToUInt32(mp["region-flags"]); | ||
188 | mbReply.Data[j].WaterHeight = System.Convert.ToByte(mp["water-height"]); | ||
189 | mbReply.Data[j].X = System.Convert.ToUInt16(mp["x"]); | ||
190 | mbReply.Data[j].Y = System.Convert.ToUInt16(mp["y"]); | ||
191 | } | ||
192 | this.OutPacket(mbReply); | ||
193 | } | ||
194 | } | ||
195 | } | ||
196 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs deleted file mode 100644 index 306bf63..0000000 --- a/OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs +++ /dev/null | |||
@@ -1,523 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using Nwc.XmlRpc; | ||
34 | using System.Net; | ||
35 | using System.Net.Sockets; | ||
36 | using System.IO; | ||
37 | using System.Threading; | ||
38 | using System.Timers; | ||
39 | using OpenSim.Framework.Interfaces; | ||
40 | using OpenSim.Framework.Types; | ||
41 | using OpenSim.Framework.Inventory; | ||
42 | using OpenSim.Framework.Utilities; | ||
43 | using OpenSim.RegionServer.Simulator; | ||
44 | using OpenSim.RegionServer.Assets; | ||
45 | using OpenSim.Framework.Console; | ||
46 | |||
47 | namespace OpenSim.RegionServer.Client | ||
48 | { | ||
49 | public partial class ClientView | ||
50 | { | ||
51 | public delegate void GenericCall(ClientView remoteClient); | ||
52 | public delegate void GenericCall2(); | ||
53 | public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary. | ||
54 | public delegate void GenericCall4(Packet packet, ClientView remoteClient); | ||
55 | public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); | ||
56 | public delegate void ObjectSelect(uint localID, ClientView remoteClient); | ||
57 | public delegate void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient); | ||
58 | public delegate void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient); | ||
59 | public delegate void UpdatePrimVector(uint localID, LLVector3 pos, ClientView remoteClient); | ||
60 | public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient); | ||
61 | public delegate void StatusChange(bool status); | ||
62 | |||
63 | |||
64 | public event ChatFromViewer OnChatFromViewer; | ||
65 | public event RezObject OnRezObject; | ||
66 | public event GenericCall4 OnDeRezObject; | ||
67 | public event ModifyTerrain OnModifyTerrain; | ||
68 | public event GenericCall OnRegionHandShakeReply; | ||
69 | public event GenericCall OnRequestWearables; | ||
70 | public event SetAppearance OnSetAppearance; | ||
71 | public event GenericCall2 OnCompleteMovementToRegion; | ||
72 | public event GenericCall3 OnAgentUpdate; | ||
73 | public event StartAnim OnStartAnim; | ||
74 | public event GenericCall OnRequestAvatarsData; | ||
75 | public event LinkObjects OnLinkObjects; | ||
76 | public event GenericCall4 OnAddPrim; | ||
77 | public event UpdateShape OnUpdatePrimShape; | ||
78 | public event ObjectSelect OnObjectSelect; | ||
79 | public event UpdatePrimFlags OnUpdatePrimFlags; | ||
80 | public event UpdatePrimTexture OnUpdatePrimTexture; | ||
81 | public event UpdatePrimVector OnUpdatePrimPosition; | ||
82 | public event UpdatePrimRotation OnUpdatePrimRotation; | ||
83 | public event UpdatePrimVector OnUpdatePrimScale; | ||
84 | public event StatusChange OnChildAgentStatus; | ||
85 | |||
86 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | ||
87 | public event ParcelDivideRequest OnParcelDivideRequest; | ||
88 | public event ParcelJoinRequest OnParcelJoinRequest; | ||
89 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | ||
90 | |||
91 | protected override void ProcessInPacket(Packet Pack) | ||
92 | { | ||
93 | ack_pack(Pack); | ||
94 | if (debug) | ||
95 | { | ||
96 | if (Pack.Type != PacketType.AgentUpdate) | ||
97 | { | ||
98 | Console.WriteLine("IN: " + Pack.Type.ToString()); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | |||
103 | if (this.ProcessPacketMethod(Pack)) | ||
104 | { | ||
105 | //there is a handler registered that handled this packet type | ||
106 | return; | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
111 | |||
112 | switch (Pack.Type) | ||
113 | { | ||
114 | case PacketType.ViewerEffect: | ||
115 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; | ||
116 | foreach (ClientView client in m_clientThreads.Values) | ||
117 | { | ||
118 | if (client.AgentID != this.AgentID) | ||
119 | { | ||
120 | viewer.AgentData.AgentID = client.AgentID; | ||
121 | viewer.AgentData.SessionID = client.SessionID; | ||
122 | client.OutPacket(viewer); | ||
123 | } | ||
124 | } | ||
125 | break; | ||
126 | |||
127 | #region New Event System - World/Avatar | ||
128 | case PacketType.ChatFromViewer: | ||
129 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | ||
130 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") | ||
131 | { | ||
132 | //empty message so don't bother with it | ||
133 | break; | ||
134 | } | ||
135 | string fromName = ClientAvatar.firstname + " " + ClientAvatar.lastname; | ||
136 | byte[] message = inchatpack.ChatData.Message; | ||
137 | byte type = inchatpack.ChatData.Type; | ||
138 | LLVector3 fromPos = ClientAvatar.Pos; | ||
139 | LLUUID fromAgentID = AgentID; | ||
140 | this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); | ||
141 | break; | ||
142 | case PacketType.RezObject: | ||
143 | RezObjectPacket rezPacket = (RezObjectPacket)Pack; | ||
144 | AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID); | ||
145 | if (inven != null) | ||
146 | { | ||
147 | if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) | ||
148 | { | ||
149 | AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID); | ||
150 | if (asset != null) | ||
151 | { | ||
152 | this.OnRezObject(asset, rezPacket.RezData.RayEnd); | ||
153 | this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID); | ||
154 | } | ||
155 | } | ||
156 | } | ||
157 | break; | ||
158 | case PacketType.DeRezObject: | ||
159 | OnDeRezObject(Pack, this); | ||
160 | break; | ||
161 | case PacketType.ModifyLand: | ||
162 | ModifyLandPacket modify = (ModifyLandPacket)Pack; | ||
163 | if (modify.ParcelData.Length > 0) | ||
164 | { | ||
165 | OnModifyTerrain(modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West); | ||
166 | } | ||
167 | break; | ||
168 | case PacketType.RegionHandshakeReply: | ||
169 | OnRegionHandShakeReply(this); | ||
170 | break; | ||
171 | case PacketType.AgentWearablesRequest: | ||
172 | OnRequestWearables(this); | ||
173 | OnRequestAvatarsData(this); | ||
174 | break; | ||
175 | case PacketType.AgentSetAppearance: | ||
176 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; | ||
177 | OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); | ||
178 | break; | ||
179 | case PacketType.CompleteAgentMovement: | ||
180 | if (this.m_child) this.UpgradeClient(); | ||
181 | OnCompleteMovementToRegion(); | ||
182 | this.EnableNeighbours(); | ||
183 | break; | ||
184 | case PacketType.AgentUpdate: | ||
185 | OnAgentUpdate(Pack); | ||
186 | break; | ||
187 | case PacketType.AgentAnimation: | ||
188 | if (!m_child) | ||
189 | { | ||
190 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; | ||
191 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | ||
192 | { | ||
193 | if (AgentAni.AnimationList[i].StartAnim) | ||
194 | { | ||
195 | OnStartAnim(AgentAni.AnimationList[i].AnimID, 1); | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | break; | ||
200 | |||
201 | #endregion | ||
202 | |||
203 | #region New Event System - Objects/Prims | ||
204 | case PacketType.ObjectLink: | ||
205 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; | ||
206 | uint parentprimid = 0; | ||
207 | List<uint> childrenprims = new List<uint>(); | ||
208 | if (link.ObjectData.Length > 1) | ||
209 | { | ||
210 | parentprimid = link.ObjectData[0].ObjectLocalID; | ||
211 | |||
212 | for (int i = 1; i < link.ObjectData.Length; i++) | ||
213 | { | ||
214 | childrenprims.Add(link.ObjectData[i].ObjectLocalID); | ||
215 | } | ||
216 | } | ||
217 | OnLinkObjects(parentprimid, childrenprims); | ||
218 | break; | ||
219 | case PacketType.ObjectAdd: | ||
220 | m_world.AddNewPrim((ObjectAddPacket)Pack, this); | ||
221 | OnAddPrim(Pack, this); | ||
222 | break; | ||
223 | case PacketType.ObjectShape: | ||
224 | ObjectShapePacket shape = (ObjectShapePacket)Pack; | ||
225 | for (int i = 0; i < shape.ObjectData.Length; i++) | ||
226 | { | ||
227 | OnUpdatePrimShape(shape.ObjectData[i].ObjectLocalID, shape.ObjectData[i]); | ||
228 | } | ||
229 | break; | ||
230 | case PacketType.ObjectSelect: | ||
231 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | ||
232 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | ||
233 | { | ||
234 | OnObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this); | ||
235 | } | ||
236 | break; | ||
237 | case PacketType.ObjectFlagUpdate: | ||
238 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; | ||
239 | OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); | ||
240 | break; | ||
241 | case PacketType.ObjectImage: | ||
242 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; | ||
243 | for (int i = 0; i < imagePack.ObjectData.Length; i++) | ||
244 | { | ||
245 | OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); | ||
246 | |||
247 | } | ||
248 | break; | ||
249 | #endregion | ||
250 | |||
251 | #region Inventory/Asset/Other related packets | ||
252 | case PacketType.RequestImage: | ||
253 | RequestImagePacket imageRequest = (RequestImagePacket)Pack; | ||
254 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) | ||
255 | { | ||
256 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); | ||
257 | } | ||
258 | break; | ||
259 | case PacketType.TransferRequest: | ||
260 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | ||
261 | m_assetCache.AddAssetRequest(this, transfer); | ||
262 | break; | ||
263 | case PacketType.AssetUploadRequest: | ||
264 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | ||
265 | this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); | ||
266 | break; | ||
267 | case PacketType.RequestXfer: | ||
268 | break; | ||
269 | case PacketType.SendXferPacket: | ||
270 | this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); | ||
271 | break; | ||
272 | case PacketType.CreateInventoryFolder: | ||
273 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | ||
274 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | ||
275 | break; | ||
276 | case PacketType.CreateInventoryItem: | ||
277 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; | ||
278 | if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) | ||
279 | { | ||
280 | this.UploadAssets.CreateInventoryItem(createItem); | ||
281 | } | ||
282 | else | ||
283 | { | ||
284 | this.CreateInventoryItem(createItem); | ||
285 | } | ||
286 | break; | ||
287 | case PacketType.FetchInventory: | ||
288 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; | ||
289 | m_inventoryCache.FetchInventory(this, FetchInventory); | ||
290 | break; | ||
291 | case PacketType.FetchInventoryDescendents: | ||
292 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | ||
293 | m_inventoryCache.FetchInventoryDescendents(this, Fetch); | ||
294 | break; | ||
295 | case PacketType.UpdateInventoryItem: | ||
296 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | ||
297 | for (int i = 0; i < update.InventoryData.Length; i++) | ||
298 | { | ||
299 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) | ||
300 | { | ||
301 | AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); | ||
302 | if (asset != null) | ||
303 | { | ||
304 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); | ||
309 | if (asset != null) | ||
310 | { | ||
311 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); | ||
312 | } | ||
313 | else | ||
314 | { | ||
315 | |||
316 | } | ||
317 | } | ||
318 | } | ||
319 | else | ||
320 | { | ||
321 | m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; | ||
322 | } | ||
323 | } | ||
324 | break; | ||
325 | case PacketType.RequestTaskInventory: | ||
326 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; | ||
327 | ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); | ||
328 | bool foundent = false; | ||
329 | foreach (Entity ent in m_world.Entities.Values) | ||
330 | { | ||
331 | if (ent.localid == requesttask.InventoryData.LocalID) | ||
332 | { | ||
333 | replytask.InventoryData.TaskID = ent.uuid; | ||
334 | replytask.InventoryData.Serial = 0; | ||
335 | replytask.InventoryData.Filename = new byte[0]; | ||
336 | foundent = true; | ||
337 | } | ||
338 | } | ||
339 | if (foundent) | ||
340 | { | ||
341 | this.OutPacket(replytask); | ||
342 | } | ||
343 | break; | ||
344 | case PacketType.UpdateTaskInventory: | ||
345 | UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; | ||
346 | AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID); | ||
347 | if (myinventory != null) | ||
348 | { | ||
349 | if (updatetask.UpdateData.Key == 0) | ||
350 | { | ||
351 | if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null) | ||
352 | { | ||
353 | if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7) | ||
354 | { | ||
355 | LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID; | ||
356 | AssetBase assBase = this.m_assetCache.GetAsset(noteaid); | ||
357 | if (assBase != null) | ||
358 | { | ||
359 | foreach (Entity ent in m_world.Entities.Values) | ||
360 | { | ||
361 | if (ent.localid == updatetask.UpdateData.LocalID) | ||
362 | { | ||
363 | if (ent is OpenSim.RegionServer.Simulator.Primitive) | ||
364 | { | ||
365 | this.m_world.AddScript(ent, Util.FieldToString(assBase.Data)); | ||
366 | } | ||
367 | } | ||
368 | } | ||
369 | } | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | } | ||
374 | break; | ||
375 | case PacketType.MapLayerRequest: | ||
376 | // This be busted. | ||
377 | MapLayerRequestPacket MapRequest = (MapLayerRequestPacket)Pack; | ||
378 | this.RequestMapLayer(); | ||
379 | this.RequestMapBlocks((int)this.m_regionData.RegionLocX - 5, (int)this.m_regionData.RegionLocY - 5, (int)this.m_regionData.RegionLocX + 5, (int)this.m_regionData.RegionLocY + 5); | ||
380 | break; | ||
381 | |||
382 | case PacketType.MapBlockRequest: | ||
383 | MapBlockRequestPacket MapBRequest = (MapBlockRequestPacket)Pack; | ||
384 | this.RequestMapBlocks(MapBRequest.PositionData.MinX, MapBRequest.PositionData.MinY, MapBRequest.PositionData.MaxX, MapBRequest.PositionData.MaxY); | ||
385 | break; | ||
386 | |||
387 | case PacketType.MapNameRequest: | ||
388 | // TODO. | ||
389 | break; | ||
390 | |||
391 | case PacketType.TeleportLandmarkRequest: | ||
392 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; | ||
393 | |||
394 | TeleportStartPacket tpStart = new TeleportStartPacket(); | ||
395 | tpStart.Info.TeleportFlags = 8; // tp via lm | ||
396 | this.OutPacket(tpStart); | ||
397 | |||
398 | TeleportProgressPacket tpProgress = new TeleportProgressPacket(); | ||
399 | tpProgress.Info.Message = (new System.Text.ASCIIEncoding()).GetBytes("sending_landmark"); | ||
400 | tpProgress.Info.TeleportFlags = 8; | ||
401 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; | ||
402 | this.OutPacket(tpProgress); | ||
403 | |||
404 | // Fetch landmark | ||
405 | LLUUID lmid = tpReq.Info.LandmarkID; | ||
406 | AssetBase lma = this.m_assetCache.GetAsset(lmid); | ||
407 | if (lma != null) | ||
408 | { | ||
409 | AssetLandmark lm = new AssetLandmark(lma); | ||
410 | |||
411 | if (lm.RegionID == m_regionData.SimUUID) | ||
412 | { | ||
413 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | ||
414 | |||
415 | tpLocal.Info.AgentID = tpReq.Info.AgentID; | ||
416 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark | ||
417 | tpLocal.Info.LocationID = 2; | ||
418 | tpLocal.Info.Position = lm.Position; | ||
419 | OutPacket(tpLocal); | ||
420 | } | ||
421 | else | ||
422 | { | ||
423 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | ||
424 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | ||
425 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | ||
426 | OutPacket(tpCancel); | ||
427 | } | ||
428 | } | ||
429 | else | ||
430 | { | ||
431 | Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); | ||
432 | |||
433 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | ||
434 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | ||
435 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | ||
436 | OutPacket(tpCancel); | ||
437 | } | ||
438 | break; | ||
439 | case PacketType.TeleportLocationRequest: | ||
440 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; | ||
441 | Console.WriteLine(tpLocReq.ToString()); | ||
442 | |||
443 | tpStart = new TeleportStartPacket(); | ||
444 | tpStart.Info.TeleportFlags = 16; // Teleport via location | ||
445 | Console.WriteLine(tpStart.ToString()); | ||
446 | OutPacket(tpStart); | ||
447 | |||
448 | if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle) | ||
449 | { | ||
450 | /* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */ | ||
451 | Console.WriteLine("Inter-sim teleport not yet implemented"); | ||
452 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | ||
453 | tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; | ||
454 | tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; | ||
455 | |||
456 | OutPacket(tpCancel); | ||
457 | } | ||
458 | else | ||
459 | { | ||
460 | Console.WriteLine("Local teleport"); | ||
461 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | ||
462 | tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID; | ||
463 | tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags; | ||
464 | tpLocal.Info.LocationID = 2; | ||
465 | tpLocal.Info.LookAt = tpLocReq.Info.LookAt; | ||
466 | tpLocal.Info.Position = tpLocReq.Info.Position; | ||
467 | OutPacket(tpLocal); | ||
468 | |||
469 | } | ||
470 | break; | ||
471 | #endregion | ||
472 | |||
473 | #region Parcel Packets | ||
474 | case PacketType.ParcelPropertiesRequest: | ||
475 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; | ||
476 | OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North),propertiesRequest.ParcelData.SequenceID,propertiesRequest.ParcelData.SnapSelection, this); | ||
477 | break; | ||
478 | case PacketType.ParcelDivide: | ||
479 | ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack; | ||
480 | OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this); | ||
481 | break; | ||
482 | case PacketType.ParcelJoin: | ||
483 | ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack; | ||
484 | OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this); | ||
485 | break; | ||
486 | case PacketType.ParcelPropertiesUpdate: | ||
487 | ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; | ||
488 | OnParcelPropertiesUpdateRequest(updatePacket, this); | ||
489 | break; | ||
490 | #endregion | ||
491 | |||
492 | #region Estate Packets | ||
493 | case PacketType.EstateOwnerMessage: | ||
494 | this.m_world.estateManager.handleEstateOwnerMessage((EstateOwnerMessagePacket)Pack, this); | ||
495 | break; | ||
496 | #endregion | ||
497 | #region unimplemented handlers | ||
498 | case PacketType.AgentIsNowWearing: | ||
499 | // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; | ||
500 | break; | ||
501 | case PacketType.ObjectScale: | ||
502 | break; | ||
503 | case PacketType.MoneyBalanceRequest: | ||
504 | //This need to be actually done and not thrown back with fake infos | ||
505 | break; | ||
506 | |||
507 | case PacketType.EstateCovenantRequest: | ||
508 | //This should be actually done and not thrown back with fake info | ||
509 | EstateCovenantRequestPacket estateCovenantRequest = (EstateCovenantRequestPacket)Pack; | ||
510 | EstateCovenantReplyPacket estateCovenantReply = new EstateCovenantReplyPacket(); | ||
511 | estateCovenantReply.Data.EstateName = libsecondlife.Helpers.StringToField("Leet Estate"); | ||
512 | estateCovenantReply.Data.EstateOwnerID = LLUUID.Zero; | ||
513 | estateCovenantReply.Data.CovenantID = LLUUID.Zero; | ||
514 | estateCovenantReply.Data.CovenantTimestamp = (uint)0; | ||
515 | this.OutPacket((Packet)estateCovenantReply); | ||
516 | MainConsole.Instance.Notice("Sent Temporary Estate packet (they are in leet estate)"); | ||
517 | break; | ||
518 | #endregion | ||
519 | } | ||
520 | } | ||
521 | } | ||
522 | } | ||
523 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Client/ClientView.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.cs deleted file mode 100644 index 29efcc9..0000000 --- a/OpenSim/OpenSim.RegionServer/Client/ClientView.cs +++ /dev/null | |||
@@ -1,461 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections; | ||
31 | using System.Collections.Generic; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using Nwc.XmlRpc; | ||
35 | using System.Net; | ||
36 | using System.Net.Sockets; | ||
37 | using System.IO; | ||
38 | using System.Threading; | ||
39 | using System.Timers; | ||
40 | using OpenSim.Framework.Interfaces; | ||
41 | using OpenSim.Framework.Types; | ||
42 | using OpenSim.Framework.Inventory; | ||
43 | using OpenSim.Framework.Utilities; | ||
44 | using OpenSim.RegionServer.Simulator; | ||
45 | using OpenSim.RegionServer.Assets; | ||
46 | using OpenSim.Framework.Console; | ||
47 | |||
48 | namespace OpenSim.RegionServer.Client | ||
49 | { | ||
50 | public delegate bool PacketMethod(ClientView simClient, Packet packet); | ||
51 | |||
52 | /// <summary> | ||
53 | /// Handles new client connections | ||
54 | /// Constructor takes a single Packet and authenticates everything | ||
55 | /// </summary> | ||
56 | public partial class ClientView : ClientViewBase, IClientAPI | ||
57 | { | ||
58 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients | ||
59 | protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); //local handlers for this instance | ||
60 | |||
61 | public LLUUID AgentID; | ||
62 | public LLUUID SessionID; | ||
63 | public LLUUID SecureSessionID = LLUUID.Zero; | ||
64 | public bool m_child; | ||
65 | public Simulator.Avatar ClientAvatar; | ||
66 | private UseCircuitCodePacket cirpack; | ||
67 | public Thread ClientThread; | ||
68 | public LLVector3 startpos; | ||
69 | |||
70 | private AgentAssetUpload UploadAssets; | ||
71 | private LLUUID newAssetFolder = LLUUID.Zero; | ||
72 | private bool debug = false; | ||
73 | private World m_world; | ||
74 | private Dictionary<uint, ClientView> m_clientThreads; | ||
75 | private AssetCache m_assetCache; | ||
76 | private IGridServer m_gridServer; | ||
77 | private IUserServer m_userServer = null; | ||
78 | private InventoryCache m_inventoryCache; | ||
79 | public bool m_sandboxMode; | ||
80 | private int cachedtextureserial = 0; | ||
81 | private RegionInfo m_regionData; | ||
82 | protected AuthenticateSessionsBase m_authenticateSessionsHandler; | ||
83 | |||
84 | public IUserServer UserServer | ||
85 | { | ||
86 | set | ||
87 | { | ||
88 | this.m_userServer = value; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | public LLVector3 StartPos | ||
93 | { | ||
94 | get | ||
95 | { | ||
96 | return startpos; | ||
97 | } | ||
98 | set | ||
99 | { | ||
100 | startpos = value; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, ClientView> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat, AuthenticateSessionsBase authenSessions) | ||
105 | { | ||
106 | m_world = world; | ||
107 | m_clientThreads = clientThreads; | ||
108 | m_assetCache = assetCache; | ||
109 | m_gridServer = gridServer; | ||
110 | m_networkServer = application; | ||
111 | m_inventoryCache = inventoryCache; | ||
112 | m_sandboxMode = sandboxMode; | ||
113 | m_child = child; | ||
114 | m_regionData = regionDat; | ||
115 | m_authenticateSessionsHandler = authenSessions; | ||
116 | MainConsole.Instance.Notice("OpenSimClient.cs - Started up new client thread to handle incoming request"); | ||
117 | cirpack = initialcirpack; | ||
118 | userEP = remoteEP; | ||
119 | |||
120 | if (m_gridServer.GetName() == "Remote") | ||
121 | { | ||
122 | this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code); | ||
123 | this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); | ||
124 | |||
125 | // Dont rez new users underground | ||
126 | float aboveGround = 3.0f; // rez at least 3 meters above ground | ||
127 | if (this.startpos.Z < (m_world.Terrain[(int)this.startpos.X, (int)this.startpos.Y] + aboveGround)) | ||
128 | this.startpos.Z = m_world.Terrain[(int)this.startpos.X, (int)this.startpos.Y] + aboveGround; | ||
129 | |||
130 | } | ||
131 | else | ||
132 | { | ||
133 | this.startpos = new LLVector3(128, 128, m_world.Terrain[(int)128, (int)128] + 15.0f); // new LLVector3(128.0f, 128.0f, 60f); | ||
134 | } | ||
135 | |||
136 | PacketQueue = new BlockingQueue<QueItem>(); | ||
137 | |||
138 | this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); | ||
139 | AckTimer = new System.Timers.Timer(500); | ||
140 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | ||
141 | AckTimer.Start(); | ||
142 | |||
143 | this.RegisterLocalPacketHandlers(); | ||
144 | |||
145 | |||
146 | |||
147 | ClientThread = new Thread(new ThreadStart(AuthUser)); | ||
148 | ClientThread.IsBackground = true; | ||
149 | ClientThread.Start(); | ||
150 | } | ||
151 | |||
152 | # region Client Methods | ||
153 | public void UpgradeClient() | ||
154 | { | ||
155 | MainConsole.Instance.Notice("SimClient.cs:UpgradeClient() - upgrading child to full agent"); | ||
156 | this.m_child = false; | ||
157 | //this.m_world.RemoveViewerAgent(this); | ||
158 | if (!this.m_sandboxMode) | ||
159 | { | ||
160 | this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); | ||
161 | m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); | ||
162 | } | ||
163 | OnChildAgentStatus(this.m_child); | ||
164 | //this.InitNewClient(); | ||
165 | } | ||
166 | |||
167 | public void DowngradeClient() | ||
168 | { | ||
169 | MainConsole.Instance.Notice("SimClient.cs:UpgradeClient() - changing full agent to child"); | ||
170 | this.m_child = true; | ||
171 | OnChildAgentStatus(this.m_child); | ||
172 | //this.m_world.RemoveViewerAgent(this); | ||
173 | //this.m_world.AddViewerAgent(this); | ||
174 | } | ||
175 | |||
176 | public void KillClient() | ||
177 | { | ||
178 | KillObjectPacket kill = new KillObjectPacket(); | ||
179 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | ||
180 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | ||
181 | kill.ObjectData[0].ID = this.ClientAvatar.localid; | ||
182 | foreach (ClientView client in m_clientThreads.Values) | ||
183 | { | ||
184 | client.OutPacket(kill); | ||
185 | } | ||
186 | if (this.m_userServer != null) | ||
187 | { | ||
188 | this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); | ||
189 | } | ||
190 | else | ||
191 | { | ||
192 | this.m_inventoryCache.ClientLeaving(this.AgentID, null); | ||
193 | } | ||
194 | |||
195 | m_world.RemoveViewerAgent(this); | ||
196 | |||
197 | m_clientThreads.Remove(this.CircuitCode); | ||
198 | m_networkServer.RemoveClientCircuit(this.CircuitCode); | ||
199 | this.ClientThread.Abort(); | ||
200 | } | ||
201 | #endregion | ||
202 | |||
203 | # region Packet Handling | ||
204 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) | ||
205 | { | ||
206 | bool result = false; | ||
207 | lock (PacketHandlers) | ||
208 | { | ||
209 | if (!PacketHandlers.ContainsKey(packetType)) | ||
210 | { | ||
211 | PacketHandlers.Add(packetType, handler); | ||
212 | result = true; | ||
213 | } | ||
214 | } | ||
215 | return result; | ||
216 | } | ||
217 | |||
218 | public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler) | ||
219 | { | ||
220 | bool result = false; | ||
221 | lock (m_packetHandlers) | ||
222 | { | ||
223 | if (!m_packetHandlers.ContainsKey(packetType)) | ||
224 | { | ||
225 | m_packetHandlers.Add(packetType, handler); | ||
226 | result = true; | ||
227 | } | ||
228 | } | ||
229 | return result; | ||
230 | } | ||
231 | |||
232 | protected virtual bool ProcessPacketMethod(Packet packet) | ||
233 | { | ||
234 | bool result = false; | ||
235 | bool found = false; | ||
236 | PacketMethod method; | ||
237 | if (m_packetHandlers.TryGetValue(packet.Type, out method)) | ||
238 | { | ||
239 | //there is a local handler for this packet type | ||
240 | result = method(this, packet); | ||
241 | } | ||
242 | else | ||
243 | { | ||
244 | //there is not a local handler so see if there is a Global handler | ||
245 | lock (PacketHandlers) | ||
246 | { | ||
247 | found = PacketHandlers.TryGetValue(packet.Type, out method); | ||
248 | } | ||
249 | if (found) | ||
250 | { | ||
251 | result = method(this, packet); | ||
252 | } | ||
253 | } | ||
254 | return result; | ||
255 | } | ||
256 | |||
257 | protected virtual void ClientLoop() | ||
258 | { | ||
259 | MainConsole.Instance.Notice("OpenSimClient.cs:ClientLoop() - Entered loop"); | ||
260 | while (true) | ||
261 | { | ||
262 | QueItem nextPacket = PacketQueue.Dequeue(); | ||
263 | if (nextPacket.Incoming) | ||
264 | { | ||
265 | //is a incoming packet | ||
266 | ProcessInPacket(nextPacket.Packet); | ||
267 | } | ||
268 | else | ||
269 | { | ||
270 | //is a out going packet | ||
271 | ProcessOutPacket(nextPacket.Packet); | ||
272 | } | ||
273 | } | ||
274 | } | ||
275 | # endregion | ||
276 | |||
277 | # region Setup | ||
278 | |||
279 | protected virtual void InitNewClient() | ||
280 | { | ||
281 | MainConsole.Instance.Notice("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); | ||
282 | this.ClientAvatar = m_world.AddViewerAgent(this); | ||
283 | } | ||
284 | |||
285 | protected virtual void AuthUser() | ||
286 | { | ||
287 | // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); | ||
288 | AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); | ||
289 | if (!sessionInfo.Authorised) | ||
290 | { | ||
291 | //session/circuit not authorised | ||
292 | OpenSim.Framework.Console.MainConsole.Instance.Notice("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); | ||
293 | ClientThread.Abort(); | ||
294 | } | ||
295 | else | ||
296 | { | ||
297 | OpenSim.Framework.Console.MainConsole.Instance.Notice("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); | ||
298 | //session is authorised | ||
299 | this.AgentID = cirpack.CircuitCode.ID; | ||
300 | this.SessionID = cirpack.CircuitCode.SessionID; | ||
301 | this.CircuitCode = cirpack.CircuitCode.Code; | ||
302 | InitNewClient(); | ||
303 | this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; | ||
304 | this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; | ||
305 | if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) | ||
306 | { | ||
307 | this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; | ||
308 | } | ||
309 | |||
310 | // Create Inventory, currently only works for sandbox mode | ||
311 | if (m_sandboxMode) | ||
312 | { | ||
313 | this.SetupInventory(sessionInfo); | ||
314 | } | ||
315 | |||
316 | //m_world.parcelManager.sendParcelOverlay(this); | ||
317 | m_world.estateManager.sendRegionInfoPacket(this); | ||
318 | |||
319 | ClientLoop(); | ||
320 | } | ||
321 | } | ||
322 | # endregion | ||
323 | |||
324 | |||
325 | protected override void KillThread() | ||
326 | { | ||
327 | this.ClientThread.Abort(); | ||
328 | } | ||
329 | |||
330 | #region World/Avatar To Viewer Methods | ||
331 | |||
332 | public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | ||
333 | { | ||
334 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
335 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | ||
336 | reply.ChatData.Audible = 1; | ||
337 | reply.ChatData.Message = message; | ||
338 | reply.ChatData.ChatType = type; | ||
339 | reply.ChatData.SourceType = 1; | ||
340 | reply.ChatData.Position = fromPos; | ||
341 | reply.ChatData.FromName = enc.GetBytes(fromName + "\0"); | ||
342 | reply.ChatData.OwnerID = fromAgentID; | ||
343 | reply.ChatData.SourceID = fromAgentID; | ||
344 | |||
345 | this.OutPacket(reply); | ||
346 | } | ||
347 | |||
348 | public void SendAppearance(AvatarWearable[] wearables) | ||
349 | { | ||
350 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | ||
351 | aw.AgentData.AgentID = this.AgentID; | ||
352 | aw.AgentData.SerialNum = 0; | ||
353 | aw.AgentData.SessionID = this.SessionID; | ||
354 | |||
355 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | ||
356 | AgentWearablesUpdatePacket.WearableDataBlock awb; | ||
357 | for (int i = 0; i < wearables.Length; i++) | ||
358 | { | ||
359 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
360 | awb.WearableType = (byte)i; | ||
361 | awb.AssetID = wearables[i].AssetID; | ||
362 | awb.ItemID = wearables[i].ItemID; | ||
363 | aw.WearableData[i] = awb; | ||
364 | } | ||
365 | |||
366 | this.OutPacket(aw); | ||
367 | } | ||
368 | #endregion | ||
369 | |||
370 | #region Inventory Creation | ||
371 | private void SetupInventory(AuthenticateResponse sessionInfo) | ||
372 | { | ||
373 | AgentInventory inventory = null; | ||
374 | if (sessionInfo.LoginInfo.InventoryFolder != null) | ||
375 | { | ||
376 | inventory = this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder); | ||
377 | if (sessionInfo.LoginInfo.BaseFolder != null) | ||
378 | { | ||
379 | if (!inventory.HasFolder(sessionInfo.LoginInfo.BaseFolder)) | ||
380 | { | ||
381 | m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder); | ||
382 | } | ||
383 | this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder; | ||
384 | AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID); | ||
385 | if (inventorySet != null) | ||
386 | { | ||
387 | for (int i = 0; i < inventorySet.Length; i++) | ||
388 | { | ||
389 | if (inventorySet[i] != null) | ||
390 | { | ||
391 | m_inventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]); | ||
392 | } | ||
393 | } | ||
394 | } | ||
395 | } | ||
396 | } | ||
397 | } | ||
398 | private AgentInventory CreateInventory(LLUUID baseFolder) | ||
399 | { | ||
400 | AgentInventory inventory = null; | ||
401 | if (this.m_userServer != null) | ||
402 | { | ||
403 | // a user server is set so request the inventory from it | ||
404 | MainConsole.Instance.Verbose("getting inventory from user server"); | ||
405 | inventory = m_inventoryCache.FetchAgentsInventory(this.AgentID, m_userServer); | ||
406 | } | ||
407 | else | ||
408 | { | ||
409 | inventory = new AgentInventory(); | ||
410 | inventory.AgentID = this.AgentID; | ||
411 | inventory.CreateRootFolder(this.AgentID, false); | ||
412 | m_inventoryCache.AddNewAgentsInventory(inventory); | ||
413 | m_inventoryCache.CreateNewInventoryFolder(this, baseFolder); | ||
414 | } | ||
415 | return inventory; | ||
416 | } | ||
417 | |||
418 | private void CreateInventoryItem(CreateInventoryItemPacket packet) | ||
419 | { | ||
420 | if (!(packet.InventoryBlock.Type == 3 || packet.InventoryBlock.Type == 7)) | ||
421 | { | ||
422 | MainConsole.Instance.Warn("Attempted to create " + Util.FieldToString(packet.InventoryBlock.Name) + " in inventory. Unsupported type"); | ||
423 | return; | ||
424 | } | ||
425 | |||
426 | //lets try this out with creating a notecard | ||
427 | AssetBase asset = new AssetBase(); | ||
428 | |||
429 | asset.Name = Util.FieldToString(packet.InventoryBlock.Name); | ||
430 | asset.Description = Util.FieldToString(packet.InventoryBlock.Description); | ||
431 | asset.InvType = packet.InventoryBlock.InvType; | ||
432 | asset.Type = packet.InventoryBlock.Type; | ||
433 | asset.FullID = LLUUID.Random(); | ||
434 | |||
435 | switch (packet.InventoryBlock.Type) | ||
436 | { | ||
437 | case 7: // Notecard | ||
438 | asset.Data = new byte[0]; | ||
439 | break; | ||
440 | |||
441 | case 3: // Landmark | ||
442 | String content; | ||
443 | content = "Landmark version 2\n"; | ||
444 | content += "region_id " + m_regionData.SimUUID + "\n"; | ||
445 | String strPos = String.Format("%.2f %.2f %.2f>", | ||
446 | this.ClientAvatar.Pos.X, | ||
447 | this.ClientAvatar.Pos.Y, | ||
448 | this.ClientAvatar.Pos.Z); | ||
449 | content += "local_pos " + strPos + "\n"; | ||
450 | asset.Data = (new System.Text.ASCIIEncoding()).GetBytes(content); | ||
451 | break; | ||
452 | default: | ||
453 | break; | ||
454 | } | ||
455 | m_assetCache.AddAsset(asset); | ||
456 | m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset); | ||
457 | } | ||
458 | #endregion | ||
459 | |||
460 | } | ||
461 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Client/ClientViewBase.cs b/OpenSim/OpenSim.RegionServer/Client/ClientViewBase.cs deleted file mode 100644 index 2ff245f..0000000 --- a/OpenSim/OpenSim.RegionServer/Client/ClientViewBase.cs +++ /dev/null | |||
@@ -1,326 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using System.Net; | ||
34 | using System.Net.Sockets; | ||
35 | using System.IO; | ||
36 | using System.Threading; | ||
37 | using System.Timers; | ||
38 | using OpenSim.Framework.Utilities; | ||
39 | using OpenSim.Framework.Interfaces; | ||
40 | using OpenSim.Framework.Console; | ||
41 | |||
42 | namespace OpenSim.RegionServer.Client | ||
43 | { | ||
44 | public class ClientViewBase | ||
45 | { | ||
46 | protected BlockingQueue<QueItem> PacketQueue; | ||
47 | protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); | ||
48 | protected Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); | ||
49 | |||
50 | protected System.Timers.Timer AckTimer; | ||
51 | protected uint Sequence = 0; | ||
52 | protected object SequenceLock = new object(); | ||
53 | protected const int MAX_APPENDED_ACKS = 10; | ||
54 | protected const int RESEND_TIMEOUT = 4000; | ||
55 | protected const int MAX_SEQUENCE = 0xFFFFFF; | ||
56 | |||
57 | public uint CircuitCode; | ||
58 | public EndPoint userEP; | ||
59 | |||
60 | protected OpenSimNetworkHandler m_networkServer; | ||
61 | |||
62 | public ClientViewBase() | ||
63 | { | ||
64 | |||
65 | } | ||
66 | |||
67 | protected virtual void ProcessInPacket(Packet Pack) | ||
68 | { | ||
69 | |||
70 | } | ||
71 | |||
72 | protected virtual void ProcessOutPacket(Packet Pack) | ||
73 | { | ||
74 | // Keep track of when this packet was sent out | ||
75 | Pack.TickCount = Environment.TickCount; | ||
76 | |||
77 | |||
78 | if (!Pack.Header.Resent) | ||
79 | { | ||
80 | // Set the sequence number | ||
81 | lock (SequenceLock) | ||
82 | { | ||
83 | if (Sequence >= MAX_SEQUENCE) | ||
84 | Sequence = 1; | ||
85 | else | ||
86 | Sequence++; | ||
87 | Pack.Header.Sequence = Sequence; | ||
88 | } | ||
89 | |||
90 | if (Pack.Header.Reliable) //DIRTY HACK | ||
91 | { | ||
92 | lock (NeedAck) | ||
93 | { | ||
94 | if (!NeedAck.ContainsKey(Pack.Header.Sequence)) | ||
95 | { | ||
96 | try | ||
97 | { | ||
98 | NeedAck.Add(Pack.Header.Sequence, Pack); | ||
99 | } | ||
100 | catch (Exception e) // HACKY | ||
101 | { | ||
102 | e.ToString(); | ||
103 | // Ignore | ||
104 | // Seems to throw a exception here occasionally | ||
105 | // of 'duplicate key' despite being locked. | ||
106 | // !?!?!? | ||
107 | } | ||
108 | } | ||
109 | else | ||
110 | { | ||
111 | // Client.Log("Attempted to add a duplicate sequence number (" + | ||
112 | // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " + | ||
113 | // packet.Type.ToString(), Helpers.LogLevel.Warning); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | // Don't append ACKs to resent packets, in case that's what was causing the | ||
118 | // delivery to fail | ||
119 | if (!Pack.Header.Resent) | ||
120 | { | ||
121 | // Append any ACKs that need to be sent out to this packet | ||
122 | lock (PendingAcks) | ||
123 | { | ||
124 | if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS && | ||
125 | Pack.Type != PacketType.PacketAck && | ||
126 | Pack.Type != PacketType.LogoutRequest) | ||
127 | { | ||
128 | Pack.Header.AckList = new uint[PendingAcks.Count]; | ||
129 | int i = 0; | ||
130 | |||
131 | foreach (uint ack in PendingAcks.Values) | ||
132 | { | ||
133 | Pack.Header.AckList[i] = ack; | ||
134 | i++; | ||
135 | } | ||
136 | |||
137 | PendingAcks.Clear(); | ||
138 | Pack.Header.AppendedAcks = true; | ||
139 | } | ||
140 | } | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | |||
145 | byte[] ZeroOutBuffer = new byte[4096]; | ||
146 | byte[] sendbuffer; | ||
147 | sendbuffer = Pack.ToBytes(); | ||
148 | |||
149 | try | ||
150 | { | ||
151 | if (Pack.Header.Zerocoded) | ||
152 | { | ||
153 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); | ||
154 | m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP); | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP); | ||
159 | } | ||
160 | } | ||
161 | catch (Exception) | ||
162 | { | ||
163 | MainConsole.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); | ||
164 | this.KillThread(); | ||
165 | } | ||
166 | |||
167 | } | ||
168 | |||
169 | public virtual void InPacket(Packet NewPack) | ||
170 | { | ||
171 | // Handle appended ACKs | ||
172 | if (NewPack.Header.AppendedAcks) | ||
173 | { | ||
174 | lock (NeedAck) | ||
175 | { | ||
176 | foreach (uint ack in NewPack.Header.AckList) | ||
177 | { | ||
178 | NeedAck.Remove(ack); | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | |||
183 | // Handle PacketAck packets | ||
184 | if (NewPack.Type == PacketType.PacketAck) | ||
185 | { | ||
186 | PacketAckPacket ackPacket = (PacketAckPacket)NewPack; | ||
187 | |||
188 | lock (NeedAck) | ||
189 | { | ||
190 | foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) | ||
191 | { | ||
192 | NeedAck.Remove(block.ID); | ||
193 | } | ||
194 | } | ||
195 | } | ||
196 | else if ((NewPack.Type == PacketType.StartPingCheck)) | ||
197 | { | ||
198 | //reply to pingcheck | ||
199 | libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack; | ||
200 | libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket(); | ||
201 | endPing.PingID.PingID = startPing.PingID.PingID; | ||
202 | OutPacket(endPing); | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | QueItem item = new QueItem(); | ||
207 | item.Packet = NewPack; | ||
208 | item.Incoming = true; | ||
209 | this.PacketQueue.Enqueue(item); | ||
210 | } | ||
211 | |||
212 | } | ||
213 | |||
214 | public virtual void OutPacket(Packet NewPack) | ||
215 | { | ||
216 | QueItem item = new QueItem(); | ||
217 | item.Packet = NewPack; | ||
218 | item.Incoming = false; | ||
219 | this.PacketQueue.Enqueue(item); | ||
220 | } | ||
221 | |||
222 | # region Low Level Packet Methods | ||
223 | |||
224 | protected void ack_pack(Packet Pack) | ||
225 | { | ||
226 | if (Pack.Header.Reliable) | ||
227 | { | ||
228 | libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); | ||
229 | ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; | ||
230 | ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); | ||
231 | ack_it.Packets[0].ID = Pack.Header.Sequence; | ||
232 | ack_it.Header.Reliable = false; | ||
233 | |||
234 | OutPacket(ack_it); | ||
235 | |||
236 | } | ||
237 | /* | ||
238 | if (Pack.Header.Reliable) | ||
239 | { | ||
240 | lock (PendingAcks) | ||
241 | { | ||
242 | uint sequence = (uint)Pack.Header.Sequence; | ||
243 | if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; } | ||
244 | } | ||
245 | }*/ | ||
246 | } | ||
247 | |||
248 | protected void ResendUnacked() | ||
249 | { | ||
250 | int now = Environment.TickCount; | ||
251 | |||
252 | lock (NeedAck) | ||
253 | { | ||
254 | foreach (Packet packet in NeedAck.Values) | ||
255 | { | ||
256 | if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) | ||
257 | { | ||
258 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Resending " + packet.Type.ToString() + " packet, " + | ||
259 | (now - packet.TickCount) + "ms have passed"); | ||
260 | |||
261 | packet.Header.Resent = true; | ||
262 | OutPacket(packet); | ||
263 | } | ||
264 | } | ||
265 | } | ||
266 | } | ||
267 | |||
268 | protected void SendAcks() | ||
269 | { | ||
270 | lock (PendingAcks) | ||
271 | { | ||
272 | if (PendingAcks.Count > 0) | ||
273 | { | ||
274 | if (PendingAcks.Count > 250) | ||
275 | { | ||
276 | // FIXME: Handle the odd case where we have too many pending ACKs queued up | ||
277 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Too many ACKs queued up!"); | ||
278 | return; | ||
279 | } | ||
280 | |||
281 | |||
282 | int i = 0; | ||
283 | PacketAckPacket acks = new PacketAckPacket(); | ||
284 | acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count]; | ||
285 | |||
286 | foreach (uint ack in PendingAcks.Values) | ||
287 | { | ||
288 | acks.Packets[i] = new PacketAckPacket.PacketsBlock(); | ||
289 | acks.Packets[i].ID = ack; | ||
290 | i++; | ||
291 | } | ||
292 | |||
293 | acks.Header.Reliable = false; | ||
294 | OutPacket(acks); | ||
295 | |||
296 | PendingAcks.Clear(); | ||
297 | } | ||
298 | } | ||
299 | } | ||
300 | |||
301 | protected void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) | ||
302 | { | ||
303 | SendAcks(); | ||
304 | ResendUnacked(); | ||
305 | } | ||
306 | #endregion | ||
307 | |||
308 | protected virtual void KillThread() | ||
309 | { | ||
310 | |||
311 | } | ||
312 | |||
313 | #region Nested Classes | ||
314 | |||
315 | public class QueItem | ||
316 | { | ||
317 | public QueItem() | ||
318 | { | ||
319 | } | ||
320 | |||
321 | public Packet Packet; | ||
322 | public bool Incoming; | ||
323 | } | ||
324 | #endregion | ||
325 | } | ||
326 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs b/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs deleted file mode 100644 index 0bf0615..0000000 --- a/OpenSim/OpenSim.RegionServer/Estate/EstateManager.cs +++ /dev/null | |||
@@ -1,293 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | using OpenSim.Framework.Types; | ||
6 | using OpenSim.RegionServer.Simulator; | ||
7 | using OpenSim.RegionServer.Client; | ||
8 | |||
9 | using libsecondlife; | ||
10 | using libsecondlife.Packets; | ||
11 | |||
12 | namespace OpenSim.RegionServer.Estate | ||
13 | { | ||
14 | |||
15 | /// <summary> | ||
16 | /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings | ||
17 | /// </summary> | ||
18 | public class EstateManager | ||
19 | { | ||
20 | private World m_world; | ||
21 | |||
22 | public EstateManager(World world) | ||
23 | { | ||
24 | m_world = world; //Estate settings found at world.m_regInfo.estateSettings | ||
25 | } | ||
26 | |||
27 | private bool convertParamStringToBool(byte[] field) | ||
28 | { | ||
29 | string s = Helpers.FieldToUTF8String(field); | ||
30 | if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true") | ||
31 | { | ||
32 | return true; | ||
33 | } | ||
34 | return false; | ||
35 | } | ||
36 | |||
37 | public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, ClientView remote_client) | ||
38 | { | ||
39 | if (remote_client.AgentID == m_world.m_regInfo.MasterAvatarAssignedUUID) | ||
40 | { | ||
41 | switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) | ||
42 | { | ||
43 | case "getinfo": | ||
44 | Console.WriteLine("GETINFO Requested"); | ||
45 | this.sendRegionInfoPacketToAll(); | ||
46 | |||
47 | break; | ||
48 | case "setregioninfo": | ||
49 | if (packet.ParamList.Length != 9) | ||
50 | { | ||
51 | OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); | ||
52 | } | ||
53 | else | ||
54 | { | ||
55 | m_world.m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None; | ||
56 | |||
57 | if (convertParamStringToBool(packet.ParamList[0].Parameter)) | ||
58 | { | ||
59 | m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform; | ||
60 | } | ||
61 | |||
62 | if (convertParamStringToBool(packet.ParamList[1].Parameter)) | ||
63 | { | ||
64 | m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly; | ||
65 | } | ||
66 | |||
67 | if (convertParamStringToBool(packet.ParamList[2].Parameter)) | ||
68 | { | ||
69 | m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowDamage; | ||
70 | } | ||
71 | |||
72 | if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) | ||
73 | { | ||
74 | m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockLandResell; | ||
75 | } | ||
76 | |||
77 | |||
78 | int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); | ||
79 | m_world.m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents; | ||
80 | |||
81 | float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); | ||
82 | m_world.m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; | ||
83 | |||
84 | int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); | ||
85 | m_world.m_regInfo.estateSettings.simAccess = (libsecondlife.Simulator.SimAccess)tempMatureLevel; | ||
86 | |||
87 | |||
88 | if (convertParamStringToBool(packet.ParamList[7].Parameter)) | ||
89 | { | ||
90 | m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.RestrictPushObject; | ||
91 | } | ||
92 | |||
93 | if (convertParamStringToBool(packet.ParamList[8].Parameter)) | ||
94 | { | ||
95 | m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowParcelChanges; | ||
96 | } | ||
97 | |||
98 | sendRegionInfoPacketToAll(); | ||
99 | |||
100 | } | ||
101 | break; | ||
102 | case "texturebase": | ||
103 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | ||
104 | { | ||
105 | string s = Helpers.FieldToUTF8String(block.Parameter); | ||
106 | string[] splitField = s.Split(' '); | ||
107 | if (splitField.Length == 2) | ||
108 | { | ||
109 | LLUUID tempUUID = new LLUUID(splitField[1]); | ||
110 | switch (Convert.ToInt16(splitField[0])) | ||
111 | { | ||
112 | case 0: | ||
113 | m_world.m_regInfo.estateSettings.terrainBase0 = tempUUID; | ||
114 | break; | ||
115 | case 1: | ||
116 | m_world.m_regInfo.estateSettings.terrainBase1 = tempUUID; | ||
117 | break; | ||
118 | case 2: | ||
119 | m_world.m_regInfo.estateSettings.terrainBase2 = tempUUID; | ||
120 | break; | ||
121 | case 3: | ||
122 | m_world.m_regInfo.estateSettings.terrainBase3 = tempUUID; | ||
123 | break; | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | break; | ||
128 | case "texturedetail": | ||
129 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | ||
130 | { | ||
131 | |||
132 | string s = Helpers.FieldToUTF8String(block.Parameter); | ||
133 | string[] splitField = s.Split(' '); | ||
134 | if (splitField.Length == 2) | ||
135 | { | ||
136 | LLUUID tempUUID = new LLUUID(splitField[1]); | ||
137 | switch (Convert.ToInt16(splitField[0])) | ||
138 | { | ||
139 | case 0: | ||
140 | m_world.m_regInfo.estateSettings.terrainDetail0 = tempUUID; | ||
141 | break; | ||
142 | case 1: | ||
143 | m_world.m_regInfo.estateSettings.terrainDetail1 = tempUUID; | ||
144 | break; | ||
145 | case 2: | ||
146 | m_world.m_regInfo.estateSettings.terrainDetail2 = tempUUID; | ||
147 | break; | ||
148 | case 3: | ||
149 | m_world.m_regInfo.estateSettings.terrainDetail3 = tempUUID; | ||
150 | break; | ||
151 | } | ||
152 | } | ||
153 | } | ||
154 | break; | ||
155 | case "textureheights": | ||
156 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | ||
157 | { | ||
158 | |||
159 | string s = Helpers.FieldToUTF8String(block.Parameter); | ||
160 | string[] splitField = s.Split(' '); | ||
161 | if (splitField.Length == 3) | ||
162 | { | ||
163 | |||
164 | float tempHeightLow = (float)Convert.ToDecimal(splitField[1]); | ||
165 | float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]); | ||
166 | |||
167 | switch (Convert.ToInt16(splitField[0])) | ||
168 | { | ||
169 | case 0: | ||
170 | m_world.m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow; | ||
171 | m_world.m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh; | ||
172 | break; | ||
173 | case 1: | ||
174 | m_world.m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow; | ||
175 | m_world.m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh; | ||
176 | break; | ||
177 | case 2: | ||
178 | m_world.m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow; | ||
179 | m_world.m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh; | ||
180 | break; | ||
181 | case 3: | ||
182 | m_world.m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow; | ||
183 | m_world.m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh; | ||
184 | break; | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | break; | ||
189 | case "texturecommit": | ||
190 | sendRegionHandshakeToAll(); | ||
191 | break; | ||
192 | case "setregionterrain": | ||
193 | if (packet.ParamList.Length != 9) | ||
194 | { | ||
195 | OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); | ||
196 | } | ||
197 | else | ||
198 | { | ||
199 | m_world.m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); | ||
200 | m_world.m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); | ||
201 | m_world.m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); | ||
202 | m_world.m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); | ||
203 | m_world.m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); | ||
204 | |||
205 | sendRegionInfoPacketToAll(); | ||
206 | } | ||
207 | break; | ||
208 | default: | ||
209 | OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); | ||
210 | break; | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | |||
215 | public void sendRegionInfoPacketToAll() | ||
216 | { | ||
217 | foreach (OpenSim.RegionServer.Simulator.Avatar av in m_world.Avatars.Values) | ||
218 | { | ||
219 | this.sendRegionInfoPacket(av.ControllingClient); | ||
220 | } | ||
221 | } | ||
222 | |||
223 | public void sendRegionHandshakeToAll() | ||
224 | { | ||
225 | foreach (OpenSim.RegionServer.Simulator.Avatar av in m_world.Avatars.Values) | ||
226 | { | ||
227 | this.sendRegionHandshake(av.ControllingClient); | ||
228 | } | ||
229 | } | ||
230 | |||
231 | public void sendRegionInfoPacket(ClientView remote_client) | ||
232 | { | ||
233 | |||
234 | RegionInfoPacket regionInfoPacket = new RegionInfoPacket(); | ||
235 | regionInfoPacket.AgentData.AgentID = remote_client.AgentID; | ||
236 | regionInfoPacket.AgentData.SessionID = remote_client.SessionID; | ||
237 | regionInfoPacket.RegionInfo.BillableFactor = m_world.m_regInfo.estateSettings.billableFactor; | ||
238 | regionInfoPacket.RegionInfo.EstateID = m_world.m_regInfo.estateSettings.estateID; | ||
239 | regionInfoPacket.RegionInfo.MaxAgents = m_world.m_regInfo.estateSettings.maxAgents; | ||
240 | regionInfoPacket.RegionInfo.ObjectBonusFactor = m_world.m_regInfo.estateSettings.objectBonusFactor; | ||
241 | regionInfoPacket.RegionInfo.ParentEstateID = m_world.m_regInfo.estateSettings.parentEstateID; | ||
242 | regionInfoPacket.RegionInfo.PricePerMeter = m_world.m_regInfo.estateSettings.pricePerMeter; | ||
243 | regionInfoPacket.RegionInfo.RedirectGridX = m_world.m_regInfo.estateSettings.redirectGridX; | ||
244 | regionInfoPacket.RegionInfo.RedirectGridY = m_world.m_regInfo.estateSettings.redirectGridY; | ||
245 | regionInfoPacket.RegionInfo.RegionFlags = (uint)m_world.m_regInfo.estateSettings.regionFlags; | ||
246 | regionInfoPacket.RegionInfo.SimAccess = (byte)m_world.m_regInfo.estateSettings.simAccess; | ||
247 | regionInfoPacket.RegionInfo.SimName = Helpers.StringToField(m_world.m_regInfo.RegionName); | ||
248 | regionInfoPacket.RegionInfo.SunHour = m_world.m_regInfo.estateSettings.sunHour; | ||
249 | regionInfoPacket.RegionInfo.TerrainLowerLimit = m_world.m_regInfo.estateSettings.terrainLowerLimit; | ||
250 | regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_world.m_regInfo.estateSettings.terrainRaiseLimit; | ||
251 | regionInfoPacket.RegionInfo.UseEstateSun = !m_world.m_regInfo.estateSettings.useFixedSun; | ||
252 | regionInfoPacket.RegionInfo.WaterHeight = m_world.m_regInfo.estateSettings.waterHeight; | ||
253 | |||
254 | remote_client.OutPacket(regionInfoPacket); | ||
255 | } | ||
256 | |||
257 | public void sendRegionHandshake(ClientView remote_client) | ||
258 | { | ||
259 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
260 | RegionHandshakePacket handshake = new RegionHandshakePacket(); | ||
261 | |||
262 | handshake.RegionInfo.BillableFactor = m_world.m_regInfo.estateSettings.billableFactor; | ||
263 | handshake.RegionInfo.IsEstateManager = false; | ||
264 | handshake.RegionInfo.TerrainHeightRange00 = m_world.m_regInfo.estateSettings.terrainHeightRange0; | ||
265 | handshake.RegionInfo.TerrainHeightRange01 = m_world.m_regInfo.estateSettings.terrainHeightRange1; | ||
266 | handshake.RegionInfo.TerrainHeightRange10 = m_world.m_regInfo.estateSettings.terrainHeightRange2; | ||
267 | handshake.RegionInfo.TerrainHeightRange11 = m_world.m_regInfo.estateSettings.terrainHeightRange3; | ||
268 | handshake.RegionInfo.TerrainStartHeight00 = m_world.m_regInfo.estateSettings.terrainStartHeight0; | ||
269 | handshake.RegionInfo.TerrainStartHeight01 = m_world.m_regInfo.estateSettings.terrainStartHeight1; | ||
270 | handshake.RegionInfo.TerrainStartHeight10 = m_world.m_regInfo.estateSettings.terrainStartHeight2; | ||
271 | handshake.RegionInfo.TerrainStartHeight11 = m_world.m_regInfo.estateSettings.terrainStartHeight3; | ||
272 | handshake.RegionInfo.SimAccess = (byte)m_world.m_regInfo.estateSettings.simAccess; | ||
273 | handshake.RegionInfo.WaterHeight = m_world.m_regInfo.estateSettings.waterHeight; | ||
274 | |||
275 | |||
276 | handshake.RegionInfo.RegionFlags = (uint)m_world.m_regInfo.estateSettings.regionFlags; | ||
277 | |||
278 | handshake.RegionInfo.SimName = _enc.GetBytes(m_world.m_regInfo.RegionName + "\0"); | ||
279 | handshake.RegionInfo.SimOwner = m_world.m_regInfo.MasterAvatarAssignedUUID; | ||
280 | handshake.RegionInfo.TerrainBase0 = m_world.m_regInfo.estateSettings.terrainBase0; | ||
281 | handshake.RegionInfo.TerrainBase1 = m_world.m_regInfo.estateSettings.terrainBase1; | ||
282 | handshake.RegionInfo.TerrainBase2 = m_world.m_regInfo.estateSettings.terrainBase2; | ||
283 | handshake.RegionInfo.TerrainBase3 = m_world.m_regInfo.estateSettings.terrainBase3; | ||
284 | handshake.RegionInfo.TerrainDetail0 = m_world.m_regInfo.estateSettings.terrainDetail0; | ||
285 | handshake.RegionInfo.TerrainDetail1 = m_world.m_regInfo.estateSettings.terrainDetail1; | ||
286 | handshake.RegionInfo.TerrainDetail2 = m_world.m_regInfo.estateSettings.terrainDetail2; | ||
287 | handshake.RegionInfo.TerrainDetail3 = m_world.m_regInfo.estateSettings.terrainDetail3; | ||
288 | handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? | ||
289 | |||
290 | remote_client.OutPacket(handshake); | ||
291 | } | ||
292 | } | ||
293 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Grid.cs b/OpenSim/OpenSim.RegionServer/Grid.cs deleted file mode 100644 index 844bb71..0000000 --- a/OpenSim/OpenSim.RegionServer/Grid.cs +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Reflection; | ||
32 | using OpenSim.Framework.Interfaces; | ||
33 | using OpenSim.UserServer; | ||
34 | |||
35 | namespace OpenSim.RegionServer | ||
36 | { | ||
37 | public class Grid | ||
38 | { | ||
39 | public IAssetServer AssetServer; | ||
40 | public IGridServer GridServer; | ||
41 | public IUserServer UserServer; | ||
42 | public string AssetDll = ""; | ||
43 | public string GridDll = ""; | ||
44 | |||
45 | public Grid() | ||
46 | { | ||
47 | } | ||
48 | |||
49 | public virtual void Initialise() | ||
50 | { | ||
51 | //load the dlls | ||
52 | this.AssetServer = this.LoadAssetDll(this.AssetDll); | ||
53 | this.GridServer = this.LoadGridDll(this.GridDll); | ||
54 | } | ||
55 | public virtual void Close() | ||
56 | { | ||
57 | this.AssetServer.Close(); | ||
58 | this.GridServer.Close(); | ||
59 | } | ||
60 | |||
61 | private IAssetServer LoadAssetDll(string dllName) | ||
62 | { | ||
63 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
64 | IAssetServer server = null; | ||
65 | |||
66 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
67 | { | ||
68 | if (pluginType.IsPublic) | ||
69 | { | ||
70 | if (!pluginType.IsAbstract) | ||
71 | { | ||
72 | Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); | ||
73 | |||
74 | if (typeInterface != null) | ||
75 | { | ||
76 | IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
77 | server = plug.GetAssetServer(); | ||
78 | break; | ||
79 | } | ||
80 | |||
81 | typeInterface = null; | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | pluginAssembly = null; | ||
86 | return server; | ||
87 | } | ||
88 | |||
89 | private IGridServer LoadGridDll(string dllName) | ||
90 | { | ||
91 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
92 | IGridServer server = null; | ||
93 | |||
94 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
95 | { | ||
96 | if (pluginType.IsPublic) | ||
97 | { | ||
98 | if (!pluginType.IsAbstract) | ||
99 | { | ||
100 | Type typeInterface = pluginType.GetInterface("IGridPlugin", true); | ||
101 | |||
102 | if (typeInterface != null) | ||
103 | { | ||
104 | IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
105 | server = plug.GetGridServer(); | ||
106 | break; | ||
107 | } | ||
108 | |||
109 | typeInterface = null; | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | pluginAssembly = null; | ||
114 | return server; | ||
115 | } | ||
116 | } | ||
117 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj deleted file mode 100644 index 889135b..0000000 --- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ /dev/null | |||
@@ -1,264 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.RegionServer</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.RegionServer</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Axiom.MathLib.dll" > | ||
62 | <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="Db4objects.Db4o.dll" > | ||
66 | <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="libsecondlife.dll" > | ||
70 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System" > | ||
74 | <HintPath>System.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
84 | <Name>OpenSim.Framework</Name> | ||
85 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
87 | <Private>False</Private> | ||
88 | </ProjectReference> | ||
89 | <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
90 | <Name>OpenSim.Framework.Console</Name> | ||
91 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
92 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
93 | <Private>False</Private> | ||
94 | </ProjectReference> | ||
95 | <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> | ||
96 | <Name>OpenSim.GenericConfig.Xml</Name> | ||
97 | <Project>{E88EF749-0000-0000-0000-000000000000}</Project> | ||
98 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
99 | <Private>False</Private> | ||
100 | </ProjectReference> | ||
101 | <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> | ||
102 | <Name>OpenSim.Physics.Manager</Name> | ||
103 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
104 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
105 | <Private>False</Private> | ||
106 | </ProjectReference> | ||
107 | <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> | ||
108 | <Name>OpenSim.Servers</Name> | ||
109 | <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> | ||
110 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
111 | <Private>False</Private> | ||
112 | </ProjectReference> | ||
113 | <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj"> | ||
114 | <Name>OpenSim.Terrain.BasicTerrain</Name> | ||
115 | <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> | ||
116 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
117 | <Private>False</Private> | ||
118 | </ProjectReference> | ||
119 | <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj"> | ||
120 | <Name>XMLRPC</Name> | ||
121 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | ||
122 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
123 | <Private>False</Private> | ||
124 | </ProjectReference> | ||
125 | </ItemGroup> | ||
126 | <ItemGroup> | ||
127 | <Compile Include="AgentAssetUpload.cs"> | ||
128 | <SubType>Code</SubType> | ||
129 | </Compile> | ||
130 | <Compile Include="AuthenticateSessionsBase.cs"> | ||
131 | <SubType>Code</SubType> | ||
132 | </Compile> | ||
133 | <Compile Include="AuthenticateSessionsLocal.cs"> | ||
134 | <SubType>Code</SubType> | ||
135 | </Compile> | ||
136 | <Compile Include="AuthenticateSessionsRemote.cs"> | ||
137 | <SubType>Code</SubType> | ||
138 | </Compile> | ||
139 | <Compile Include="Grid.cs"> | ||
140 | <SubType>Code</SubType> | ||
141 | </Compile> | ||
142 | <Compile Include="OpenSimMain.cs"> | ||
143 | <SubType>Code</SubType> | ||
144 | </Compile> | ||
145 | <Compile Include="OpenSimNetworkHandler.cs"> | ||
146 | <SubType>Code</SubType> | ||
147 | </Compile> | ||
148 | <Compile Include="PacketServer.cs"> | ||
149 | <SubType>Code</SubType> | ||
150 | </Compile> | ||
151 | <Compile Include="RegionInfo.cs"> | ||
152 | <SubType>Code</SubType> | ||
153 | </Compile> | ||
154 | <Compile Include="RegionInfoBase.cs"> | ||
155 | <SubType>Code</SubType> | ||
156 | </Compile> | ||
157 | <Compile Include="RegionServerBase.cs"> | ||
158 | <SubType>Code</SubType> | ||
159 | </Compile> | ||
160 | <Compile Include="UDPServer.cs"> | ||
161 | <SubType>Code</SubType> | ||
162 | </Compile> | ||
163 | <Compile Include="VersionInfo.cs"> | ||
164 | <SubType>Code</SubType> | ||
165 | </Compile> | ||
166 | <Compile Include="Assets\AssetCache.cs"> | ||
167 | <SubType>Code</SubType> | ||
168 | </Compile> | ||
169 | <Compile Include="Assets\InventoryCache.cs"> | ||
170 | <SubType>Code</SubType> | ||
171 | </Compile> | ||
172 | <Compile Include="CAPS\AdminWebFront.cs"> | ||
173 | <SubType>Code</SubType> | ||
174 | </Compile> | ||
175 | <Compile Include="Client\ClientView.cs"> | ||
176 | <SubType>Code</SubType> | ||
177 | </Compile> | ||
178 | <Compile Include="Client\ClientView.Grid.cs"> | ||
179 | <SubType>Code</SubType> | ||
180 | </Compile> | ||
181 | <Compile Include="Client\ClientView.PacketHandlers.cs"> | ||
182 | <SubType>Code</SubType> | ||
183 | </Compile> | ||
184 | <Compile Include="Client\ClientView.ProcessPackets.cs"> | ||
185 | <SubType>Code</SubType> | ||
186 | </Compile> | ||
187 | <Compile Include="Client\ClientViewBase.cs"> | ||
188 | <SubType>Code</SubType> | ||
189 | </Compile> | ||
190 | <Compile Include="Estate\EstateManager.cs"> | ||
191 | <SubType>Code</SubType> | ||
192 | </Compile> | ||
193 | <Compile Include="Scripting\IScriptContext.cs"> | ||
194 | <SubType>Code</SubType> | ||
195 | </Compile> | ||
196 | <Compile Include="Scripting\IScriptEntity.cs"> | ||
197 | <SubType>Code</SubType> | ||
198 | </Compile> | ||
199 | <Compile Include="Scripting\IScriptHandler.cs"> | ||
200 | <SubType>Code</SubType> | ||
201 | </Compile> | ||
202 | <Compile Include="Scripting\Script.cs"> | ||
203 | <SubType>Code</SubType> | ||
204 | </Compile> | ||
205 | <Compile Include="Scripting\ScriptFactory.cs"> | ||
206 | <SubType>Code</SubType> | ||
207 | </Compile> | ||
208 | <Compile Include="Scripting\Scripts\FollowRandomAvatar.cs"> | ||
209 | <SubType>Code</SubType> | ||
210 | </Compile> | ||
211 | <Compile Include="Simulator\Avatar.Client.cs"> | ||
212 | <SubType>Code</SubType> | ||
213 | </Compile> | ||
214 | <Compile Include="Simulator\Avatar.cs"> | ||
215 | <SubType>Code</SubType> | ||
216 | </Compile> | ||
217 | <Compile Include="Simulator\Avatar.Update.cs"> | ||
218 | <SubType>Code</SubType> | ||
219 | </Compile> | ||
220 | <Compile Include="Simulator\AvatarAnimations.cs"> | ||
221 | <SubType>Code</SubType> | ||
222 | </Compile> | ||
223 | <Compile Include="Simulator\Entity.cs"> | ||
224 | <SubType>Code</SubType> | ||
225 | </Compile> | ||
226 | <Compile Include="Simulator\ParcelManager.cs"> | ||
227 | <SubType>Code</SubType> | ||
228 | </Compile> | ||
229 | <Compile Include="Simulator\Primitive.cs"> | ||
230 | <SubType>Code</SubType> | ||
231 | </Compile> | ||
232 | <Compile Include="Simulator\Primitive2.cs"> | ||
233 | <SubType>Code</SubType> | ||
234 | </Compile> | ||
235 | <Compile Include="Simulator\SceneObject.cs"> | ||
236 | <SubType>Code</SubType> | ||
237 | </Compile> | ||
238 | <Compile Include="Simulator\World.cs"> | ||
239 | <SubType>Code</SubType> | ||
240 | </Compile> | ||
241 | <Compile Include="Simulator\World.PacketHandlers.cs"> | ||
242 | <SubType>Code</SubType> | ||
243 | </Compile> | ||
244 | <Compile Include="Simulator\World.Scripting.cs"> | ||
245 | <SubType>Code</SubType> | ||
246 | </Compile> | ||
247 | <Compile Include="Simulator\WorldBase.cs"> | ||
248 | <SubType>Code</SubType> | ||
249 | </Compile> | ||
250 | <Compile Include="Types\Mesh.cs"> | ||
251 | <SubType>Code</SubType> | ||
252 | </Compile> | ||
253 | <Compile Include="Types\Triangle.cs"> | ||
254 | <SubType>Code</SubType> | ||
255 | </Compile> | ||
256 | </ItemGroup> | ||
257 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
258 | <PropertyGroup> | ||
259 | <PreBuildEvent> | ||
260 | </PreBuildEvent> | ||
261 | <PostBuildEvent> | ||
262 | </PostBuildEvent> | ||
263 | </PropertyGroup> | ||
264 | </Project> | ||
diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build deleted file mode 100644 index 13341b3..0000000 --- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.RegionServer" 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.RegionServer" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AgentAssetUpload.cs" /> | ||
15 | <include name="AuthenticateSessionsBase.cs" /> | ||
16 | <include name="AuthenticateSessionsLocal.cs" /> | ||
17 | <include name="AuthenticateSessionsRemote.cs" /> | ||
18 | <include name="Grid.cs" /> | ||
19 | <include name="OpenSimMain.cs" /> | ||
20 | <include name="OpenSimNetworkHandler.cs" /> | ||
21 | <include name="PacketServer.cs" /> | ||
22 | <include name="RegionInfo.cs" /> | ||
23 | <include name="RegionInfoBase.cs" /> | ||
24 | <include name="RegionServerBase.cs" /> | ||
25 | <include name="UDPServer.cs" /> | ||
26 | <include name="VersionInfo.cs" /> | ||
27 | <include name="Assets/AssetCache.cs" /> | ||
28 | <include name="Assets/InventoryCache.cs" /> | ||
29 | <include name="CAPS/AdminWebFront.cs" /> | ||
30 | <include name="Client/ClientView.cs" /> | ||
31 | <include name="Client/ClientView.Grid.cs" /> | ||
32 | <include name="Client/ClientView.PacketHandlers.cs" /> | ||
33 | <include name="Client/ClientView.ProcessPackets.cs" /> | ||
34 | <include name="Client/ClientViewBase.cs" /> | ||
35 | <include name="Estate/EstateManager.cs" /> | ||
36 | <include name="Scripting/IScriptContext.cs" /> | ||
37 | <include name="Scripting/IScriptEntity.cs" /> | ||
38 | <include name="Scripting/IScriptHandler.cs" /> | ||
39 | <include name="Scripting/Script.cs" /> | ||
40 | <include name="Scripting/ScriptFactory.cs" /> | ||
41 | <include name="Scripting/Scripts/FollowRandomAvatar.cs" /> | ||
42 | <include name="Simulator/Avatar.Client.cs" /> | ||
43 | <include name="Simulator/Avatar.cs" /> | ||
44 | <include name="Simulator/Avatar.Update.cs" /> | ||
45 | <include name="Simulator/AvatarAnimations.cs" /> | ||
46 | <include name="Simulator/Entity.cs" /> | ||
47 | <include name="Simulator/ParcelManager.cs" /> | ||
48 | <include name="Simulator/Primitive.cs" /> | ||
49 | <include name="Simulator/Primitive2.cs" /> | ||
50 | <include name="Simulator/SceneObject.cs" /> | ||
51 | <include name="Simulator/World.cs" /> | ||
52 | <include name="Simulator/World.PacketHandlers.cs" /> | ||
53 | <include name="Simulator/World.Scripting.cs" /> | ||
54 | <include name="Simulator/WorldBase.cs" /> | ||
55 | <include name="Types/Mesh.cs" /> | ||
56 | <include name="Types/Triangle.cs" /> | ||
57 | </sources> | ||
58 | <references basedir="${project::get-base-directory()}"> | ||
59 | <lib> | ||
60 | <include name="${project::get-base-directory()}" /> | ||
61 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
62 | </lib> | ||
63 | <include name="../../bin/Axiom.MathLib.dll" /> | ||
64 | <include name="../../bin/Db4objects.Db4o.dll" /> | ||
65 | <include name="../../bin/libsecondlife.dll" /> | ||
66 | <include name="../../bin/OpenSim.Framework.dll" /> | ||
67 | <include name="../../bin/OpenSim.Framework.Console.dll" /> | ||
68 | <include name="../../bin/OpenSim.GenericConfig.Xml.dll" /> | ||
69 | <include name="../../bin/OpenSim.Physics.Manager.dll" /> | ||
70 | <include name="../../bin/OpenSim.Servers.dll" /> | ||
71 | <include name="../../bin/OpenSim.Terrain.BasicTerrain.dll" /> | ||
72 | <include name="System.dll" /> | ||
73 | <include name="System.Xml.dll" /> | ||
74 | <include name="../../bin/XMLRPC.dll" /> | ||
75 | </references> | ||
76 | </csc> | ||
77 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
78 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
79 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
80 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
81 | <include name="*.dll"/> | ||
82 | <include name="*.exe"/> | ||
83 | </fileset> | ||
84 | </copy> | ||
85 | </target> | ||
86 | <target name="clean"> | ||
87 | <delete dir="${bin.dir}" failonerror="false" /> | ||
88 | <delete dir="${obj.dir}" failonerror="false" /> | ||
89 | </target> | ||
90 | <target name="doc" description="Creates documentation."> | ||
91 | </target> | ||
92 | </project> | ||
diff --git a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim/OpenSim.RegionServer/OpenSimMain.cs deleted file mode 100644 index 5aba625..0000000 --- a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs +++ /dev/null | |||
@@ -1,531 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Text; | ||
31 | using System.IO; | ||
32 | using System.Threading; | ||
33 | using System.Net; | ||
34 | using System.Net.Sockets; | ||
35 | using System.Timers; | ||
36 | using System.Reflection; | ||
37 | using System.Collections; | ||
38 | using System.Collections.Generic; | ||
39 | using libsecondlife; | ||
40 | using libsecondlife.Packets; | ||
41 | using OpenSim.RegionServer.Simulator; | ||
42 | using OpenSim.Terrain; | ||
43 | using OpenSim.Framework.Interfaces; | ||
44 | using OpenSim.Framework.Types; | ||
45 | using OpenSim.UserServer; | ||
46 | using OpenSim.RegionServer.Assets; | ||
47 | using OpenSim.RegionServer.CAPS; | ||
48 | using OpenSim.Framework.Console; | ||
49 | using OpenSim.Physics.Manager; | ||
50 | using Nwc.XmlRpc; | ||
51 | using OpenSim.Servers; | ||
52 | using OpenSim.GenericConfig; | ||
53 | |||
54 | namespace OpenSim | ||
55 | { | ||
56 | //moved to the opensim main application project (do we want it there or here?) | ||
57 | /* | ||
58 | public class OpenSimMain : OpenSimApplicationBase , conscmd_callback | ||
59 | { | ||
60 | |||
61 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) | ||
62 | { | ||
63 | this.configFileSetup = useConfigFile; | ||
64 | m_sandbox = sandBoxMode; | ||
65 | m_loginserver = startLoginServer; | ||
66 | m_physicsEngine = physicsEngine; | ||
67 | m_config = configFile; | ||
68 | |||
69 | m_console = new ConsoleBase("region-console-" + Guid.NewGuid().ToString() + ".log", "Region", this, silent); | ||
70 | OpenSim.Framework.Console.MainConsole.Instance = m_console; | ||
71 | } | ||
72 | |||
73 | /// <summary> | ||
74 | /// Performs initialisation of the world, such as loading configuration from disk. | ||
75 | /// </summary> | ||
76 | public override void StartUp() | ||
77 | { | ||
78 | this.regionData = new RegionInfo(); | ||
79 | try | ||
80 | { | ||
81 | this.localConfig = new XmlConfig(m_config); | ||
82 | this.localConfig.LoadData(); | ||
83 | } | ||
84 | catch (Exception e) | ||
85 | { | ||
86 | Console.WriteLine(e.Message); | ||
87 | } | ||
88 | if (this.configFileSetup) | ||
89 | { | ||
90 | this.SetupFromConfigFile(this.localConfig); | ||
91 | } | ||
92 | m_console.Notice("Main.cs:Startup() - Loading configuration"); | ||
93 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); | ||
94 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change | ||
95 | |||
96 | GridServers = new Grid(); | ||
97 | if (m_sandbox) | ||
98 | { | ||
99 | this.SetupLocalGridServers(); | ||
100 | //Authenticate Session Handler | ||
101 | AuthenticateSessionsLocal authen = new AuthenticateSessionsLocal(); | ||
102 | this.AuthenticateSessionsHandler = authen; | ||
103 | } | ||
104 | else | ||
105 | { | ||
106 | this.SetupRemoteGridServers(); | ||
107 | //Authenticate Session Handler | ||
108 | AuthenticateSessionsRemote authen = new AuthenticateSessionsRemote(); | ||
109 | this.AuthenticateSessionsHandler = authen; | ||
110 | } | ||
111 | |||
112 | startuptime = DateTime.Now; | ||
113 | |||
114 | try | ||
115 | { | ||
116 | AssetCache = new AssetCache(GridServers.AssetServer); | ||
117 | InventoryCache = new InventoryCache(); | ||
118 | } | ||
119 | catch (Exception e) | ||
120 | { | ||
121 | m_console.Error(e.Message + "\nSorry, could not setup local cache"); | ||
122 | Environment.Exit(1); | ||
123 | } | ||
124 | |||
125 | m_udpServer = new UDPServer(this.regionData.IPListenPort, this.GridServers, this.AssetCache, this.InventoryCache, this.regionData, this.m_sandbox, this.user_accounts, this.m_console, this.AuthenticateSessionsHandler); | ||
126 | |||
127 | //should be passing a IGenericConfig object to these so they can read the config data they want from it | ||
128 | GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); | ||
129 | IGridServer gridServer = GridServers.GridServer; | ||
130 | gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey); | ||
131 | |||
132 | if (!m_sandbox) | ||
133 | { | ||
134 | this.ConnectToRemoteGridServer(); | ||
135 | } | ||
136 | |||
137 | this.SetupLocalWorld(); | ||
138 | |||
139 | if (m_sandbox) | ||
140 | { | ||
141 | AssetCache.LoadDefaultTextureSet(); | ||
142 | } | ||
143 | |||
144 | m_console.Notice("Main.cs:Startup() - Initialising HTTP server"); | ||
145 | |||
146 | this.SetupHttpListener(); | ||
147 | |||
148 | LoginServer loginServer = null; | ||
149 | LoginServer adminLoginServer = null; | ||
150 | |||
151 | bool sandBoxWithLoginServer = m_loginserver && m_sandbox; | ||
152 | if (sandBoxWithLoginServer) | ||
153 | { | ||
154 | loginServer = new LoginServer( regionData.IPListenAddr, regionData.IPListenPort, regionData.RegionLocX, regionData.RegionLocY, this.user_accounts); | ||
155 | loginServer.Startup(); | ||
156 | loginServer.SetSessionHandler(((AuthenticateSessionsLocal) this.AuthenticateSessionsHandler).AddNewSession); | ||
157 | |||
158 | if (user_accounts) | ||
159 | { | ||
160 | //sandbox mode with loginserver using accounts | ||
161 | this.GridServers.UserServer = loginServer; | ||
162 | adminLoginServer = loginServer; | ||
163 | |||
164 | httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod); | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | //sandbox mode with loginserver not using accounts | ||
169 | httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer); | ||
174 | adminWebFront.LoadMethods(httpServer); | ||
175 | |||
176 | m_console.Notice("Main.cs:Startup() - Starting HTTP server"); | ||
177 | httpServer.Start(); | ||
178 | |||
179 | //MainServerListener(); | ||
180 | this.m_udpServer.ServerListener(); | ||
181 | |||
182 | m_heartbeatTimer.Enabled = true; | ||
183 | m_heartbeatTimer.Interval = 100; | ||
184 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | ||
185 | } | ||
186 | |||
187 | # region Setup methods | ||
188 | protected virtual void SetupLocalGridServers() | ||
189 | { | ||
190 | GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; | ||
191 | GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll"; | ||
192 | |||
193 | m_console.Notice("Starting in Sandbox mode"); | ||
194 | |||
195 | try | ||
196 | { | ||
197 | GridServers.Initialise(); | ||
198 | } | ||
199 | catch (Exception e) | ||
200 | { | ||
201 | m_console.Error(e.Message + "\nSorry, could not setup the grid interface"); | ||
202 | Environment.Exit(1); | ||
203 | } | ||
204 | } | ||
205 | |||
206 | protected virtual void SetupRemoteGridServers() | ||
207 | { | ||
208 | if (this.gridLocalAsset) | ||
209 | { | ||
210 | GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; | ||
211 | } | ||
212 | else | ||
213 | { | ||
214 | GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
215 | } | ||
216 | GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
217 | |||
218 | m_console.Notice("Starting in Grid mode"); | ||
219 | |||
220 | try | ||
221 | { | ||
222 | GridServers.Initialise(); | ||
223 | } | ||
224 | catch (Exception e) | ||
225 | { | ||
226 | m_console.Error(e.Message + "\nSorry, could not setup the grid interface"); | ||
227 | Environment.Exit(1); | ||
228 | } | ||
229 | } | ||
230 | |||
231 | protected virtual void SetupLocalWorld() | ||
232 | { | ||
233 | m_console.Notice("Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); | ||
234 | m_console.Notice("Initialising world"); | ||
235 | m_console.componentname = "Region " + regionData.RegionName; | ||
236 | |||
237 | m_localWorld = new World(this.m_udpServer.PacketServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); | ||
238 | LocalWorld.InventoryCache = InventoryCache; | ||
239 | LocalWorld.AssetCache = AssetCache; | ||
240 | |||
241 | this.m_udpServer.LocalWorld = LocalWorld; | ||
242 | this.m_udpServer.PacketServer.RegisterClientPacketHandlers(); | ||
243 | |||
244 | this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); | ||
245 | this.physManager.LoadPlugins(); | ||
246 | |||
247 | LocalWorld.m_datastore = this.regionData.DataStore; | ||
248 | |||
249 | LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. | ||
250 | LocalWorld.LoadWorldMap(); | ||
251 | |||
252 | m_console.Notice("Main.cs:Startup() - Starting up messaging system"); | ||
253 | LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); | ||
254 | LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); | ||
255 | LocalWorld.LoadPrimsFromStorage(); | ||
256 | } | ||
257 | |||
258 | protected virtual void SetupHttpListener() | ||
259 | { | ||
260 | httpServer = new BaseHttpServer(regionData.IPListenPort); | ||
261 | |||
262 | if (this.GridServers.GridServer.GetName() == "Remote") | ||
263 | { | ||
264 | |||
265 | // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server | ||
266 | httpServer.AddXmlRPCHandler("expect_user", ((AuthenticateSessionsRemote)this.AuthenticateSessionsHandler).ExpectUser ); | ||
267 | |||
268 | httpServer.AddXmlRPCHandler("agent_crossing", | ||
269 | delegate(XmlRpcRequest request) | ||
270 | { | ||
271 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
272 | AgentCircuitData agent_data = new AgentCircuitData(); | ||
273 | agent_data.firstname = (string)requestData["firstname"]; | ||
274 | agent_data.lastname = (string)requestData["lastname"]; | ||
275 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | ||
276 | agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"])); | ||
277 | |||
278 | if (((RemoteGridBase)this.GridServers.GridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) | ||
279 | { | ||
280 | ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname; | ||
281 | ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname; | ||
282 | ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; | ||
283 | } | ||
284 | |||
285 | return new XmlRpcResponse(); | ||
286 | }); | ||
287 | |||
288 | httpServer.AddRestHandler("GET", "/simstatus/", | ||
289 | delegate(string request, string path, string param) | ||
290 | { | ||
291 | return "OK"; | ||
292 | }); | ||
293 | } | ||
294 | } | ||
295 | |||
296 | protected virtual void ConnectToRemoteGridServer() | ||
297 | { | ||
298 | if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort)) | ||
299 | { | ||
300 | m_console.Notice("Main.cs:Startup() - Success: Got a grid connection OK!"); | ||
301 | } | ||
302 | else | ||
303 | { | ||
304 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "Main.cs:Startup() - FAILED: Unable to get connection to grid. Shutting down."); | ||
305 | Shutdown(); | ||
306 | } | ||
307 | |||
308 | GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]); | ||
309 | |||
310 | // If we are being told to load a file, load it. | ||
311 | string dataUri = (string)((RemoteGridBase)GridServers.GridServer).GridData["data_uri"]; | ||
312 | |||
313 | if (!String.IsNullOrEmpty(dataUri)) | ||
314 | { | ||
315 | this.LocalWorld.m_datastore = dataUri; | ||
316 | } | ||
317 | |||
318 | if (((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString() != "") | ||
319 | { | ||
320 | // The grid server has told us who we are | ||
321 | // We must obey the grid server. | ||
322 | try | ||
323 | { | ||
324 | regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); | ||
325 | regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); | ||
326 | regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); | ||
327 | } | ||
328 | catch (Exception e) | ||
329 | { | ||
330 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!"); | ||
331 | Environment.Exit(1); | ||
332 | } | ||
333 | } | ||
334 | } | ||
335 | |||
336 | #endregion | ||
337 | |||
338 | private void SetupFromConfigFile(IGenericConfig configData) | ||
339 | { | ||
340 | try | ||
341 | { | ||
342 | // SandBoxMode | ||
343 | string attri = ""; | ||
344 | attri = configData.GetAttribute("SandBox"); | ||
345 | if ((attri == "") || ((attri != "false") && (attri != "true"))) | ||
346 | { | ||
347 | this.m_sandbox = false; | ||
348 | configData.SetAttribute("SandBox", "false"); | ||
349 | } | ||
350 | else | ||
351 | { | ||
352 | this.m_sandbox = Convert.ToBoolean(attri); | ||
353 | } | ||
354 | |||
355 | // LoginServer | ||
356 | attri = ""; | ||
357 | attri = configData.GetAttribute("LoginServer"); | ||
358 | if ((attri == "") || ((attri != "false") && (attri != "true"))) | ||
359 | { | ||
360 | this.m_loginserver = false; | ||
361 | configData.SetAttribute("LoginServer", "false"); | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | this.m_loginserver = Convert.ToBoolean(attri); | ||
366 | } | ||
367 | |||
368 | // Sandbox User accounts | ||
369 | attri = ""; | ||
370 | attri = configData.GetAttribute("UserAccount"); | ||
371 | if ((attri == "") || ((attri != "false") && (attri != "true"))) | ||
372 | { | ||
373 | this.user_accounts = false; | ||
374 | configData.SetAttribute("UserAccounts", "false"); | ||
375 | } | ||
376 | else if (attri == "true") | ||
377 | { | ||
378 | this.user_accounts = Convert.ToBoolean(attri); | ||
379 | } | ||
380 | |||
381 | // Grid mode hack to use local asset server | ||
382 | attri = ""; | ||
383 | attri = configData.GetAttribute("LocalAssets"); | ||
384 | if ((attri == "") || ((attri != "false") && (attri != "true"))) | ||
385 | { | ||
386 | this.gridLocalAsset = false; | ||
387 | configData.SetAttribute("LocalAssets", "false"); | ||
388 | } | ||
389 | else if (attri == "true") | ||
390 | { | ||
391 | this.gridLocalAsset = Convert.ToBoolean(attri); | ||
392 | } | ||
393 | |||
394 | |||
395 | attri = ""; | ||
396 | attri = configData.GetAttribute("PhysicsEngine"); | ||
397 | switch (attri) | ||
398 | { | ||
399 | default: | ||
400 | m_console.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); | ||
401 | Environment.Exit(1); | ||
402 | break; | ||
403 | |||
404 | case "": | ||
405 | this.m_physicsEngine = "basicphysics"; | ||
406 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
407 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false; | ||
408 | break; | ||
409 | |||
410 | case "basicphysics": | ||
411 | this.m_physicsEngine = "basicphysics"; | ||
412 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
413 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false; | ||
414 | break; | ||
415 | |||
416 | case "RealPhysX": | ||
417 | this.m_physicsEngine = "RealPhysX"; | ||
418 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true; | ||
419 | break; | ||
420 | |||
421 | case "OpenDynamicsEngine": | ||
422 | this.m_physicsEngine = "OpenDynamicsEngine"; | ||
423 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true; | ||
424 | break; | ||
425 | } | ||
426 | |||
427 | configData.Commit(); | ||
428 | } | ||
429 | catch (Exception e) | ||
430 | { | ||
431 | Console.WriteLine(e.Message); | ||
432 | Console.WriteLine("\nSorry, a fatal error occurred while trying to initialise the configuration data"); | ||
433 | Console.WriteLine("Can not continue starting up"); | ||
434 | Environment.Exit(1); | ||
435 | } | ||
436 | } | ||
437 | |||
438 | /// <summary> | ||
439 | /// Performs any last-minute sanity checking and shuts down the region server | ||
440 | /// </summary> | ||
441 | public virtual void Shutdown() | ||
442 | { | ||
443 | m_console.Notice("Main.cs:Shutdown() - Closing all threads"); | ||
444 | m_console.Notice("Main.cs:Shutdown() - Killing listener thread"); | ||
445 | m_console.Notice("Main.cs:Shutdown() - Killing clients"); | ||
446 | // IMPLEMENT THIS | ||
447 | m_console.Notice("Main.cs:Shutdown() - Closing console and terminating"); | ||
448 | LocalWorld.Close(); | ||
449 | GridServers.Close(); | ||
450 | m_console.Close(); | ||
451 | Environment.Exit(0); | ||
452 | } | ||
453 | |||
454 | /// <summary> | ||
455 | /// Performs per-frame updates regularly | ||
456 | /// </summary> | ||
457 | /// <param name="sender"></param> | ||
458 | /// <param name="e"></param> | ||
459 | void Heartbeat(object sender, System.EventArgs e) | ||
460 | { | ||
461 | LocalWorld.Update(); | ||
462 | } | ||
463 | |||
464 | #region Console Commands | ||
465 | /// <summary> | ||
466 | /// Runs commands issued by the server console from the operator | ||
467 | /// </summary> | ||
468 | /// <param name="command">The first argument of the parameter (the command)</param> | ||
469 | /// <param name="cmdparams">Additional arguments passed to the command</param> | ||
470 | public void RunCmd(string command, string[] cmdparams) | ||
471 | { | ||
472 | switch (command) | ||
473 | { | ||
474 | case "help": | ||
475 | m_console.Error("show users - show info about connected users"); | ||
476 | m_console.Error("shutdown - disconnect all clients and shutdown"); | ||
477 | break; | ||
478 | |||
479 | case "show": | ||
480 | Show(cmdparams[0]); | ||
481 | break; | ||
482 | |||
483 | case "terrain": | ||
484 | string result = ""; | ||
485 | if (!LocalWorld.Terrain.RunTerrainCmd(cmdparams, ref result)) | ||
486 | { | ||
487 | m_console.Error(result); | ||
488 | } | ||
489 | break; | ||
490 | |||
491 | case "shutdown": | ||
492 | Shutdown(); | ||
493 | break; | ||
494 | |||
495 | default: | ||
496 | m_console.Error("Unknown command"); | ||
497 | break; | ||
498 | } | ||
499 | } | ||
500 | |||
501 | /// <summary> | ||
502 | /// Outputs to the console information about the region | ||
503 | /// </summary> | ||
504 | /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param> | ||
505 | public void Show(string ShowWhat) | ||
506 | { | ||
507 | switch (ShowWhat) | ||
508 | { | ||
509 | case "uptime": | ||
510 | m_console.Error("OpenSim has been running since " + startuptime.ToString()); | ||
511 | m_console.Error("That is " + (DateTime.Now - startuptime).ToString()); | ||
512 | break; | ||
513 | case "users": | ||
514 | OpenSim.RegionServer.Simulator.Avatar TempAv; | ||
515 | m_console.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); | ||
516 | foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) | ||
517 | { | ||
518 | if (LocalWorld.Entities[UUID].ToString() == "OpenSim.RegionServer.Simulator.Avatar") | ||
519 | { | ||
520 | TempAv = (OpenSim.RegionServer.Simulator.Avatar)LocalWorld.Entities[UUID]; | ||
521 | m_console.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); | ||
522 | } | ||
523 | } | ||
524 | break; | ||
525 | } | ||
526 | } | ||
527 | #endregion | ||
528 | } | ||
529 | |||
530 | */ | ||
531 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs b/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs deleted file mode 100644 index bc85cdb..0000000 --- a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using libsecondlife; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | |||
36 | namespace OpenSim.RegionServer | ||
37 | { | ||
38 | public interface OpenSimNetworkHandler | ||
39 | { | ||
40 | void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); | ||
41 | void RemoveClientCircuit(uint circuitcode); | ||
42 | void RegisterPacketServer(PacketServer server); | ||
43 | AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/PacketServer.cs b/OpenSim/OpenSim.RegionServer/PacketServer.cs deleted file mode 100644 index 7267ae8..0000000 --- a/OpenSim/OpenSim.RegionServer/PacketServer.cs +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.RegionServer.Simulator; | ||
32 | using OpenSim.RegionServer.Client; | ||
33 | using libsecondlife.Packets; | ||
34 | |||
35 | namespace OpenSim.RegionServer | ||
36 | { | ||
37 | public class PacketServer | ||
38 | { | ||
39 | private OpenSimNetworkHandler _networkHandler; | ||
40 | private World _localWorld; | ||
41 | public Dictionary<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>(); | ||
42 | |||
43 | public PacketServer(OpenSimNetworkHandler networkHandler) | ||
44 | { | ||
45 | _networkHandler = networkHandler; | ||
46 | _networkHandler.RegisterPacketServer(this); | ||
47 | } | ||
48 | |||
49 | public World LocalWorld | ||
50 | { | ||
51 | set | ||
52 | { | ||
53 | this._localWorld = value; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | public virtual void ClientInPacket(uint circuitCode, Packet packet) | ||
58 | { | ||
59 | if (this.ClientThreads.ContainsKey(circuitCode)) | ||
60 | { | ||
61 | ClientThreads[circuitCode].InPacket(packet); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | public virtual bool AddNewCircuitCodeClient(uint circuitCode) | ||
66 | { | ||
67 | return false; | ||
68 | } | ||
69 | |||
70 | public virtual void SendPacketToAllClients(Packet packet) | ||
71 | { | ||
72 | |||
73 | } | ||
74 | |||
75 | public virtual void SendPacketToAllExcept(Packet packet, ClientView simClient) | ||
76 | { | ||
77 | |||
78 | } | ||
79 | |||
80 | public virtual void AddClientPacketHandler(PacketType packetType, PacketMethod handler) | ||
81 | { | ||
82 | |||
83 | } | ||
84 | |||
85 | public virtual void RegisterClientPacketHandlers() | ||
86 | { | ||
87 | if (this._localWorld != null) | ||
88 | { | ||
89 | ClientView.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName); | ||
90 | } | ||
91 | } | ||
92 | |||
93 | #region Client Packet Handlers | ||
94 | |||
95 | public bool RequestUUIDName(ClientView simClient, Packet packet) | ||
96 | { | ||
97 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
98 | Console.WriteLine(packet.ToString()); | ||
99 | UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)packet; | ||
100 | UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket(); | ||
101 | nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length]; | ||
102 | |||
103 | for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++) | ||
104 | { | ||
105 | nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); | ||
106 | nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID; | ||
107 | nameReply.UUIDNameBlock[i].FirstName = enc.GetBytes("Who\0"); //for now send any name | ||
108 | nameReply.UUIDNameBlock[i].LastName = enc.GetBytes("Knows\0"); //in future need to look it up | ||
109 | } | ||
110 | simClient.OutPacket(nameReply); | ||
111 | return true; | ||
112 | } | ||
113 | |||
114 | #endregion | ||
115 | } | ||
116 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs deleted file mode 100644 index de1750c..0000000 --- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs +++ /dev/null | |||
@@ -1,380 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Globalization; | ||
32 | using System.Net; | ||
33 | using System.Web; | ||
34 | using System.IO; | ||
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework.Utilities; | ||
37 | using libsecondlife; | ||
38 | |||
39 | namespace OpenSim.RegionServer | ||
40 | { | ||
41 | public class RegionInfo : RegionInfoBase | ||
42 | { | ||
43 | //following should be removed and the GenericConfig object passed around, | ||
44 | //so each class (AssetServer, GridServer etc) can access what config data they want | ||
45 | public string AssetURL = "http://127.0.0.1:8003/"; | ||
46 | public string AssetSendKey = ""; | ||
47 | |||
48 | public string GridURL = ""; | ||
49 | public string GridSendKey = ""; | ||
50 | public string GridRecvKey = ""; | ||
51 | public string UserURL = ""; | ||
52 | public string UserSendKey = ""; | ||
53 | public string UserRecvKey = ""; | ||
54 | private bool isSandbox; | ||
55 | |||
56 | public string MasterAvatarFirstName = ""; | ||
57 | public string MasterAvatarLastName = ""; | ||
58 | public string MasterAvatarSandboxPassword = ""; | ||
59 | public LLUUID MasterAvatarAssignedUUID = LLUUID.Zero; | ||
60 | |||
61 | public string DataStore; | ||
62 | |||
63 | public RegionInfo() | ||
64 | { | ||
65 | |||
66 | } | ||
67 | |||
68 | public void SaveToGrid() | ||
69 | { | ||
70 | //we really want to keep any server connection code out of here and out of the code code | ||
71 | // and put it in the server connection classes (those inheriting from IGridServer etc) | ||
72 | string reqtext; | ||
73 | reqtext = "<Root>"; | ||
74 | reqtext += "<authkey>" + this.GridSendKey + "</authkey>"; | ||
75 | reqtext += "<sim>"; | ||
76 | reqtext += "<uuid>" + this.SimUUID.ToString() + "</uuid>"; | ||
77 | reqtext += "<regionname>" + this.RegionName + "</regionname>"; | ||
78 | reqtext += "<sim_ip>" + this.IPListenAddr + "</sim_ip>"; | ||
79 | reqtext += "<sim_port>" + this.IPListenPort.ToString() + "</sim_port>"; | ||
80 | reqtext += "<region_locx>" + this.RegionLocX.ToString() + "</region_locx>"; | ||
81 | reqtext += "<region_locy>" + this.RegionLocY.ToString() + "</region_locy>"; | ||
82 | reqtext += "<estate_id>1</estate_id>"; | ||
83 | reqtext += "</sim>"; | ||
84 | reqtext += "</Root>"; | ||
85 | |||
86 | byte[] reqdata = (new System.Text.ASCIIEncoding()).GetBytes(reqtext); | ||
87 | string newpath = ""; | ||
88 | if (this.GridURL.EndsWith("/")) | ||
89 | { | ||
90 | newpath = this.GridURL + "sims/"; | ||
91 | } | ||
92 | else | ||
93 | { | ||
94 | newpath = this.GridURL + "/sims/"; | ||
95 | } | ||
96 | |||
97 | WebRequest GridSaveReq = WebRequest.Create(newpath + this.SimUUID.ToString()); | ||
98 | GridSaveReq.Method = "POST"; | ||
99 | GridSaveReq.ContentType = "application/x-www-form-urlencoded"; | ||
100 | GridSaveReq.ContentLength = reqdata.Length; | ||
101 | |||
102 | Stream stOut = GridSaveReq.GetRequestStream(); | ||
103 | stOut.Write(reqdata, 0, reqdata.Length); | ||
104 | stOut.Close(); | ||
105 | |||
106 | WebResponse gridresp = GridSaveReq.GetResponse(); | ||
107 | StreamReader stIn = new StreamReader(gridresp.GetResponseStream(), Encoding.ASCII); | ||
108 | string GridResponse = stIn.ReadToEnd(); | ||
109 | stIn.Close(); | ||
110 | gridresp.Close(); | ||
111 | |||
112 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse); | ||
113 | } | ||
114 | |||
115 | public void InitConfig(bool sandboxMode, IGenericConfig configData) | ||
116 | { | ||
117 | this.isSandbox = sandboxMode; | ||
118 | try | ||
119 | { | ||
120 | // Sim UUID | ||
121 | string attri = ""; | ||
122 | attri = configData.GetAttribute("SimUUID"); | ||
123 | if (attri == "") | ||
124 | { | ||
125 | this.SimUUID = LLUUID.Random(); | ||
126 | configData.SetAttribute("SimUUID", this.SimUUID.ToString()); | ||
127 | } | ||
128 | else | ||
129 | { | ||
130 | this.SimUUID = new LLUUID(attri); | ||
131 | } | ||
132 | |||
133 | // Sim name | ||
134 | attri = ""; | ||
135 | attri = configData.GetAttribute("SimName"); | ||
136 | if (attri == "") | ||
137 | { | ||
138 | this.RegionName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Simulator Name", "OpenSim Island"); | ||
139 | configData.SetAttribute("SimName", this.RegionName); | ||
140 | } | ||
141 | else | ||
142 | { | ||
143 | this.RegionName = attri; | ||
144 | } | ||
145 | // Sim/Grid location X | ||
146 | attri = ""; | ||
147 | attri = configData.GetAttribute("SimLocationX"); | ||
148 | if (attri == "") | ||
149 | { | ||
150 | string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Grid Location X", "997"); | ||
151 | configData.SetAttribute("SimLocationX", location); | ||
152 | this.RegionLocX = (uint)Convert.ToUInt32(location); | ||
153 | } | ||
154 | else | ||
155 | { | ||
156 | this.RegionLocX = (uint)Convert.ToUInt32(attri); | ||
157 | } | ||
158 | // Sim/Grid location Y | ||
159 | attri = ""; | ||
160 | attri = configData.GetAttribute("SimLocationY"); | ||
161 | if (attri == "") | ||
162 | { | ||
163 | string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Grid Location Y", "996"); | ||
164 | configData.SetAttribute("SimLocationY", location); | ||
165 | this.RegionLocY = (uint)Convert.ToUInt32(location); | ||
166 | } | ||
167 | else | ||
168 | { | ||
169 | this.RegionLocY = (uint)Convert.ToUInt32(attri); | ||
170 | } | ||
171 | |||
172 | // Local storage datastore | ||
173 | attri = ""; | ||
174 | attri = configData.GetAttribute("Datastore"); | ||
175 | if (attri == "") | ||
176 | { | ||
177 | string datastore = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Filename for local world storage", "localworld.yap"); | ||
178 | configData.SetAttribute("Datastore", datastore); | ||
179 | this.DataStore = datastore; | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | this.DataStore = attri; | ||
184 | } | ||
185 | |||
186 | //Sim Listen Port | ||
187 | attri = ""; | ||
188 | attri = configData.GetAttribute("SimListenPort"); | ||
189 | if (attri == "") | ||
190 | { | ||
191 | string port = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: UDP port for client connections", "9000"); | ||
192 | configData.SetAttribute("SimListenPort", port); | ||
193 | this.IPListenPort = Convert.ToInt32(port); | ||
194 | } | ||
195 | else | ||
196 | { | ||
197 | this.IPListenPort = Convert.ToInt32(attri); | ||
198 | } | ||
199 | //Sim Listen Address | ||
200 | attri = ""; | ||
201 | attri = configData.GetAttribute("SimListenAddress"); | ||
202 | if (attri == "") | ||
203 | { | ||
204 | this.IPListenAddr = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: IP Address to listen on for client connections", "127.0.0.1"); | ||
205 | configData.SetAttribute("SimListenAddress", this.IPListenAddr); | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | // Probably belongs elsewhere, but oh well. | ||
210 | if (attri.Trim().StartsWith("SYSTEMIP")) | ||
211 | { | ||
212 | string localhostname = System.Net.Dns.GetHostName(); | ||
213 | System.Net.IPAddress[] ips = System.Net.Dns.GetHostAddresses(localhostname); | ||
214 | try | ||
215 | { | ||
216 | this.IPListenAddr = ips[0].ToString(); | ||
217 | } | ||
218 | catch (Exception e) | ||
219 | { | ||
220 | e.ToString(); | ||
221 | this.IPListenAddr = "127.0.0.1"; // Use the default if we fail | ||
222 | } | ||
223 | } | ||
224 | else | ||
225 | { | ||
226 | this.IPListenAddr = attri; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | // Terrain Default File | ||
231 | attri = ""; | ||
232 | attri = configData.GetAttribute("TerrainFile"); | ||
233 | if (attri == "") | ||
234 | { | ||
235 | this.estateSettings.terrainFile = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Default Terrain File", "default.r32"); | ||
236 | configData.SetAttribute("TerrainFile", this.estateSettings.terrainFile); | ||
237 | } | ||
238 | else | ||
239 | { | ||
240 | this.estateSettings.terrainFile = attri; | ||
241 | } | ||
242 | |||
243 | attri = ""; | ||
244 | attri = configData.GetAttribute("TerrainMultiplier"); | ||
245 | if (attri == "") | ||
246 | { | ||
247 | string re = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0"); | ||
248 | this.estateSettings.terrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture); | ||
249 | configData.SetAttribute("TerrainMultiplier", this.estateSettings.terrainMultiplier.ToString()); | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | this.estateSettings.terrainMultiplier = Convert.ToDouble(attri); | ||
254 | } | ||
255 | |||
256 | attri = ""; | ||
257 | attri = configData.GetAttribute("MasterAvatarFirstName"); | ||
258 | if (attri == "") | ||
259 | { | ||
260 | this.MasterAvatarFirstName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: First name of Master Avatar", "Test"); | ||
261 | |||
262 | configData.SetAttribute("MasterAvatarFirstName", this.MasterAvatarFirstName); | ||
263 | } | ||
264 | else | ||
265 | { | ||
266 | this.MasterAvatarFirstName = attri; | ||
267 | } | ||
268 | |||
269 | attri = ""; | ||
270 | attri = configData.GetAttribute("MasterAvatarLastName"); | ||
271 | if (attri == "") | ||
272 | { | ||
273 | this.MasterAvatarLastName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Last name of Master Avatar", "User"); | ||
274 | |||
275 | configData.SetAttribute("MasterAvatarLastName", this.MasterAvatarLastName); | ||
276 | } | ||
277 | else | ||
278 | { | ||
279 | this.MasterAvatarLastName = attri; | ||
280 | } | ||
281 | |||
282 | if (isSandbox) //Sandbox Mode Settings | ||
283 | { | ||
284 | attri = ""; | ||
285 | attri = configData.GetAttribute("MasterAvatarSandboxPassword"); | ||
286 | if (attri == "") | ||
287 | { | ||
288 | this.MasterAvatarSandboxPassword = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("SANDBOX MODE SETTING: Password of Master Avatar", "test"); | ||
289 | |||
290 | configData.SetAttribute("MasterAvatarSandboxPassword", this.MasterAvatarSandboxPassword); | ||
291 | } | ||
292 | else | ||
293 | { | ||
294 | this.MasterAvatarSandboxPassword = attri; | ||
295 | } | ||
296 | } | ||
297 | else //Grid Mode Settings | ||
298 | { | ||
299 | //shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object | ||
300 | |||
301 | //Grid Server URL | ||
302 | attri = ""; | ||
303 | attri = configData.GetAttribute("GridServerURL"); | ||
304 | if (attri == "") | ||
305 | { | ||
306 | this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GRID MODE SETTING: Grid server URL", "http://127.0.0.1:8001/"); | ||
307 | configData.SetAttribute("GridServerURL", this.GridURL); | ||
308 | } | ||
309 | else | ||
310 | { | ||
311 | this.GridURL = attri; | ||
312 | } | ||
313 | |||
314 | //Grid Send Key | ||
315 | attri = ""; | ||
316 | attri = configData.GetAttribute("GridSendKey"); | ||
317 | if (attri == "") | ||
318 | { | ||
319 | this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GRID MODE SETTING: Key to send to grid server", "null"); | ||
320 | configData.SetAttribute("GridSendKey", this.GridSendKey); | ||
321 | } | ||
322 | else | ||
323 | { | ||
324 | this.GridSendKey = attri; | ||
325 | } | ||
326 | |||
327 | //Grid Receive Key | ||
328 | attri = ""; | ||
329 | attri = configData.GetAttribute("GridRecvKey"); | ||
330 | if (attri == "") | ||
331 | { | ||
332 | this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GRID MODE SETTING: Key to expect from grid server", "null"); | ||
333 | configData.SetAttribute("GridRecvKey", this.GridRecvKey); | ||
334 | } | ||
335 | else | ||
336 | { | ||
337 | this.GridRecvKey = attri; | ||
338 | } | ||
339 | |||
340 | attri = ""; | ||
341 | attri = configData.GetAttribute("AssetServerURL"); | ||
342 | if (attri == "") | ||
343 | { | ||
344 | this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GRID MODE SETTING: Asset server URL", "http://127.0.0.1:8003/"); | ||
345 | configData.SetAttribute("AssetServerURL", this.AssetURL); | ||
346 | } | ||
347 | else | ||
348 | { | ||
349 | this.AssetURL = attri; | ||
350 | } | ||
351 | |||
352 | } | ||
353 | |||
354 | this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
355 | if (!this.isSandbox) | ||
356 | { | ||
357 | this.SaveToGrid(); | ||
358 | } | ||
359 | configData.Commit(); | ||
360 | } | ||
361 | catch (Exception e) | ||
362 | { | ||
363 | OpenSim.Framework.Console.MainConsole.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | ||
364 | OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString()); | ||
365 | } | ||
366 | |||
367 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Simulator Settings Loaded"); | ||
368 | /* MainConsole.Instance.Notice("UUID: " + this.SimUUID.ToStringHyphenated()); | ||
369 | MainConsole.Instance.Notice("Name: " + this.RegionName); | ||
370 | MainConsole.Instance.Notice("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); | ||
371 | MainConsole.Instance.Notice("Region Handle: " + this.RegionHandle.ToString()); | ||
372 | MainConsole.Instance.Notice("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); | ||
373 | MainConsole.Instance.Notice("Sandbox Mode? " + isSandbox.ToString()); | ||
374 | MainConsole.Instance.Notice("Asset URL: " + this.AssetURL); | ||
375 | MainConsole.Instance.Notice("Asset key: " + this.AssetSendKey); | ||
376 | MainConsole.Instance.Notice("Grid URL: " + this.GridURL); | ||
377 | MainConsole.Instance.Notice("Grid key: " + this.GridSendKey); */ | ||
378 | } | ||
379 | } | ||
380 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs deleted file mode 100644 index 481b865..0000000 --- a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Net; | ||
32 | using System.Web; | ||
33 | using System.IO; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Utilities; | ||
36 | using OpenSim.Framework.Types; | ||
37 | using libsecondlife; | ||
38 | |||
39 | namespace OpenSim.RegionServer | ||
40 | { | ||
41 | public class RegionInfoBase | ||
42 | { | ||
43 | public LLUUID SimUUID = new LLUUID(); | ||
44 | public string RegionName = ""; | ||
45 | public uint RegionLocX = 0; | ||
46 | public uint RegionLocY = 0; | ||
47 | public ulong RegionHandle = 0; | ||
48 | |||
49 | |||
50 | public int IPListenPort = 0; | ||
51 | public string IPListenAddr = ""; | ||
52 | |||
53 | |||
54 | public EstateSettings estateSettings; | ||
55 | |||
56 | public RegionInfoBase() | ||
57 | { | ||
58 | estateSettings = new EstateSettings(); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs deleted file mode 100644 index 2d99bb3..0000000 --- a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs +++ /dev/null | |||
@@ -1,130 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Text; | ||
30 | using System.IO; | ||
31 | using System.Threading; | ||
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
34 | using System.Timers; | ||
35 | using System.Reflection; | ||
36 | using System.Collections; | ||
37 | using System.Collections.Generic; | ||
38 | using libsecondlife; | ||
39 | using libsecondlife.Packets; | ||
40 | using OpenSim.RegionServer.Simulator; | ||
41 | using OpenSim.Terrain; | ||
42 | using OpenSim.Framework.Interfaces; | ||
43 | using OpenSim.Framework.Types; | ||
44 | using OpenSim.UserServer; | ||
45 | using OpenSim.RegionServer.Assets; | ||
46 | using OpenSim.RegionServer.CAPS; | ||
47 | using OpenSim.Framework.Console; | ||
48 | using OpenSim.Physics.Manager; | ||
49 | using Nwc.XmlRpc; | ||
50 | using OpenSim.Servers; | ||
51 | using OpenSim.GenericConfig; | ||
52 | |||
53 | namespace OpenSim.RegionServer | ||
54 | { | ||
55 | public class RegionServerBase | ||
56 | { | ||
57 | protected IGenericConfig localConfig; | ||
58 | protected PhysicsManager physManager; | ||
59 | protected Grid GridServers; | ||
60 | protected AssetCache AssetCache; | ||
61 | protected InventoryCache InventoryCache; | ||
62 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); | ||
63 | protected DateTime startuptime; | ||
64 | protected RegionInfo regionData; | ||
65 | |||
66 | protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); | ||
67 | public string m_physicsEngine; | ||
68 | public bool m_sandbox = false; | ||
69 | public bool m_loginserver; | ||
70 | public bool user_accounts = false; | ||
71 | public bool gridLocalAsset = false; | ||
72 | protected bool configFileSetup = false; | ||
73 | public string m_config; | ||
74 | |||
75 | protected UDPServer m_udpServer; | ||
76 | protected BaseHttpServer httpServer; | ||
77 | protected AuthenticateSessionsBase AuthenticateSessionsHandler; | ||
78 | |||
79 | protected ConsoleBase m_console; | ||
80 | |||
81 | public RegionServerBase() | ||
82 | { | ||
83 | |||
84 | } | ||
85 | |||
86 | public RegionServerBase(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) | ||
87 | { | ||
88 | this.configFileSetup = useConfigFile; | ||
89 | m_sandbox = sandBoxMode; | ||
90 | m_loginserver = startLoginServer; | ||
91 | m_physicsEngine = physicsEngine; | ||
92 | m_config = configFile; | ||
93 | } | ||
94 | |||
95 | protected World m_localWorld; | ||
96 | public World LocalWorld | ||
97 | { | ||
98 | get { return m_localWorld; } | ||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// Performs initialisation of the world, such as loading configuration from disk. | ||
103 | /// </summary> | ||
104 | public virtual void StartUp() | ||
105 | { | ||
106 | } | ||
107 | |||
108 | protected virtual void SetupLocalGridServers() | ||
109 | { | ||
110 | } | ||
111 | |||
112 | protected virtual void SetupRemoteGridServers() | ||
113 | { | ||
114 | |||
115 | } | ||
116 | |||
117 | protected virtual void SetupLocalWorld() | ||
118 | { | ||
119 | } | ||
120 | |||
121 | protected virtual void SetupHttpListener() | ||
122 | { | ||
123 | } | ||
124 | |||
125 | protected virtual void ConnectToRemoteGridServer() | ||
126 | { | ||
127 | |||
128 | } | ||
129 | } | ||
130 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Scripting/IScriptContext.cs b/OpenSim/OpenSim.RegionServer/Scripting/IScriptContext.cs deleted file mode 100644 index 2ac0a2e..0000000 --- a/OpenSim/OpenSim.RegionServer/Scripting/IScriptContext.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.RegionServer.Scripting | ||
34 | { | ||
35 | public interface IScriptContext | ||
36 | { | ||
37 | IScriptEntity Entity { get; } | ||
38 | bool TryGetRandomAvatar(out IScriptReadonlyEntity avatar); | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Scripting/IScriptEntity.cs b/OpenSim/OpenSim.RegionServer/Scripting/IScriptEntity.cs deleted file mode 100644 index 05a1237..0000000 --- a/OpenSim/OpenSim.RegionServer/Scripting/IScriptEntity.cs +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.RegionServer.Scripting | ||
34 | { | ||
35 | public interface IScriptReadonlyEntity | ||
36 | { | ||
37 | LLVector3 Pos { get; } | ||
38 | string Name { get; } | ||
39 | } | ||
40 | |||
41 | public interface IScriptEntity | ||
42 | { | ||
43 | LLVector3 Pos { get; set; } | ||
44 | string Name { get; } | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Scripting/IScriptHandler.cs b/OpenSim/OpenSim.RegionServer/Scripting/IScriptHandler.cs deleted file mode 100644 index 7431799..0000000 --- a/OpenSim/OpenSim.RegionServer/Scripting/IScriptHandler.cs +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using OpenSim.Physics.Manager; | ||
33 | using OpenSim.RegionServer.Simulator; | ||
34 | using Avatar=OpenSim.RegionServer.Simulator.Avatar; | ||
35 | using Primitive = OpenSim.RegionServer.Simulator.Primitive; | ||
36 | |||
37 | namespace OpenSim.RegionServer.Scripting | ||
38 | { | ||
39 | public delegate void ScriptEventHandler(IScriptContext context); | ||
40 | |||
41 | public class ScriptHandler : IScriptContext, IScriptEntity, IScriptReadonlyEntity | ||
42 | { | ||
43 | private World m_world; | ||
44 | private Script m_script; | ||
45 | private Entity m_entity; | ||
46 | |||
47 | public LLUUID ScriptId | ||
48 | { | ||
49 | get | ||
50 | { | ||
51 | return m_script.ScriptId; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | public void OnFrame() | ||
56 | { | ||
57 | m_script.OnFrame(this); | ||
58 | } | ||
59 | |||
60 | public ScriptHandler(Script script, Entity entity, World world) | ||
61 | { | ||
62 | m_script = script; | ||
63 | m_entity = entity; | ||
64 | m_world = world; | ||
65 | } | ||
66 | |||
67 | #region IScriptContext Members | ||
68 | |||
69 | IScriptEntity IScriptContext.Entity | ||
70 | { | ||
71 | get | ||
72 | { | ||
73 | return this; | ||
74 | } | ||
75 | } | ||
76 | |||
77 | bool IScriptContext.TryGetRandomAvatar(out IScriptReadonlyEntity avatar) | ||
78 | { | ||
79 | foreach (Entity entity in m_world.Entities.Values ) | ||
80 | { | ||
81 | if( entity is Avatar ) | ||
82 | { | ||
83 | avatar = entity; | ||
84 | return true; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | avatar = null; | ||
89 | return false; | ||
90 | } | ||
91 | |||
92 | #endregion | ||
93 | |||
94 | #region IScriptEntity and IScriptReadonlyEntity Members | ||
95 | |||
96 | public string Name | ||
97 | { | ||
98 | get | ||
99 | { | ||
100 | return m_entity.Name; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public LLVector3 Pos | ||
105 | { | ||
106 | get | ||
107 | { | ||
108 | return m_entity.Pos; | ||
109 | } | ||
110 | |||
111 | set | ||
112 | { | ||
113 | if (m_entity is Primitive) | ||
114 | { | ||
115 | Primitive prim = m_entity as Primitive; | ||
116 | // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. | ||
117 | prim.UpdatePosition( value ); | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
122 | #endregion | ||
123 | } | ||
124 | |||
125 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Scripting/Script.cs b/OpenSim/OpenSim.RegionServer/Scripting/Script.cs deleted file mode 100644 index e6732a6..0000000 --- a/OpenSim/OpenSim.RegionServer/Scripting/Script.cs +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.RegionServer.Scripting | ||
34 | { | ||
35 | public class Script | ||
36 | { | ||
37 | private LLUUID m_scriptId; | ||
38 | public virtual LLUUID ScriptId | ||
39 | { | ||
40 | get | ||
41 | { | ||
42 | return m_scriptId; | ||
43 | } | ||
44 | } | ||
45 | |||
46 | public Script( LLUUID scriptId ) | ||
47 | { | ||
48 | m_scriptId = scriptId; | ||
49 | } | ||
50 | |||
51 | public ScriptEventHandler OnFrame; | ||
52 | } | ||
53 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Scripting/ScriptFactory.cs b/OpenSim/OpenSim.RegionServer/Scripting/ScriptFactory.cs deleted file mode 100644 index 525f63d..0000000 --- a/OpenSim/OpenSim.RegionServer/Scripting/ScriptFactory.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.RegionServer.Scripting | ||
33 | { | ||
34 | public delegate Script ScriptFactory(); | ||
35 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/OpenSim.RegionServer/Scripting/Scripts/FollowRandomAvatar.cs deleted file mode 100644 index 55ea795..0000000 --- a/OpenSim/OpenSim.RegionServer/Scripting/Scripts/FollowRandomAvatar.cs +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.RegionServer.Scripting | ||
34 | { | ||
35 | public class FollowRandomAvatar : Script | ||
36 | { | ||
37 | public FollowRandomAvatar() | ||
38 | : base(LLUUID.Random()) | ||
39 | { | ||
40 | OnFrame += MyOnFrame; | ||
41 | } | ||
42 | |||
43 | private void MyOnFrame(IScriptContext context) | ||
44 | { | ||
45 | LLVector3 pos = context.Entity.Pos; | ||
46 | |||
47 | IScriptReadonlyEntity avatar; | ||
48 | |||
49 | if (context.TryGetRandomAvatar(out avatar)) | ||
50 | { | ||
51 | LLVector3 avatarPos = avatar.Pos; | ||
52 | |||
53 | float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2; | ||
54 | float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2; | ||
55 | |||
56 | LLVector3 newPos = new LLVector3(x, y, pos.Z); | ||
57 | |||
58 | context.Entity.Pos = newPos; | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | |||
63 | |||
64 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/Avatar.Client.cs b/OpenSim/OpenSim.RegionServer/Simulator/Avatar.Client.cs deleted file mode 100644 index c6ce258..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/Avatar.Client.cs +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife.Packets; | ||
32 | |||
33 | namespace OpenSim.RegionServer.Simulator | ||
34 | { | ||
35 | partial class Avatar | ||
36 | { | ||
37 | private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> updateList = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); | ||
38 | private List<Entity> interestList = new List<Entity>(); | ||
39 | |||
40 | public void SendPacketToViewer(Packet packet) | ||
41 | { | ||
42 | this.ControllingClient.OutPacket(packet); | ||
43 | } | ||
44 | |||
45 | public void AddTerseUpdateToViewersList(ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock) | ||
46 | { | ||
47 | |||
48 | } | ||
49 | |||
50 | public void SendUpdateListToViewer() | ||
51 | { | ||
52 | |||
53 | } | ||
54 | |||
55 | private void UpdateInterestList() | ||
56 | { | ||
57 | |||
58 | } | ||
59 | } | ||
60 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/Avatar.Update.cs b/OpenSim/OpenSim.RegionServer/Simulator/Avatar.Update.cs deleted file mode 100644 index 03da861..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/Avatar.Update.cs +++ /dev/null | |||
@@ -1,371 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using OpenSim.RegionServer.Client; | ||
34 | |||
35 | namespace OpenSim.RegionServer.Simulator | ||
36 | { | ||
37 | partial class Avatar | ||
38 | { | ||
39 | public override void update() | ||
40 | { | ||
41 | if (!this.childAvatar) | ||
42 | { | ||
43 | if (this._physActor == null) | ||
44 | { | ||
45 | //HACKHACK: Note to work out why this entity does not have a physics actor | ||
46 | // and prehaps create one. | ||
47 | return; | ||
48 | } | ||
49 | libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); | ||
50 | if (this.updateflag) | ||
51 | { | ||
52 | //need to send movement info | ||
53 | //so create the improvedterseobjectupdate packet | ||
54 | //use CreateTerseBlock() | ||
55 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | ||
56 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
57 | terse.RegionData.RegionHandle = m_world.m_regInfo.RegionHandle; | ||
58 | terse.RegionData.TimeDilation = 64096; | ||
59 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
60 | terse.ObjectData[0] = terseBlock; | ||
61 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
62 | foreach (Avatar client in avList) | ||
63 | { | ||
64 | client.SendPacketToViewer(terse); | ||
65 | } | ||
66 | |||
67 | updateflag = false; | ||
68 | //this._updateCount = 0; | ||
69 | } | ||
70 | else | ||
71 | { | ||
72 | |||
73 | if ((pos2 != this.positionLastFrame) || (this.movementflag == 16)) | ||
74 | { | ||
75 | _updateCount++; | ||
76 | if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) | ||
77 | { | ||
78 | //It has been a while since last update was sent so lets send one. | ||
79 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | ||
80 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
81 | terse.RegionData.RegionHandle = m_world.m_regInfo.RegionHandle; | ||
82 | terse.RegionData.TimeDilation = 64096; | ||
83 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
84 | terse.ObjectData[0] = terseBlock; | ||
85 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
86 | foreach (Avatar client in avList) | ||
87 | { | ||
88 | client.SendPacketToViewer(terse); | ||
89 | } | ||
90 | _updateCount = 0; | ||
91 | } | ||
92 | |||
93 | if (this.movementflag == 16) | ||
94 | { | ||
95 | movementflag = 0; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | } | ||
100 | |||
101 | if (positionFrameBeforeLast != pos2) | ||
102 | { | ||
103 | this.positionFrameBeforeLast = this.positionLastFrame; | ||
104 | this.positionLastFrame = pos2; | ||
105 | int tempRoundedX = (int)Math.Round(positionLastFrame.X); | ||
106 | int tempRoundedY = (int)Math.Round(positionLastFrame.Y); | ||
107 | if (this.positionRoundedX != tempRoundedX || this.positionRoundedY != tempRoundedY) | ||
108 | { | ||
109 | |||
110 | this.positionRoundedX = tempRoundedX; | ||
111 | this.positionRoundedY = tempRoundedY; | ||
112 | int currentParcelLocalID = m_world.parcelManager.getParcel(tempRoundedX, tempRoundedY).parcelData.localID; | ||
113 | if(currentParcelLocalID != this.positionParcelHoverLocalID) | ||
114 | { | ||
115 | |||
116 | Console.WriteLine("NEW PARCEL: " + m_world.parcelManager.getParcel(tempRoundedX, tempRoundedY).parcelData.parcelName); | ||
117 | m_world.parcelManager.getParcel(tempRoundedX, tempRoundedY).sendParcelProperties(this.parcelUpdateSequenceIncrement, false, 0,this.ControllingClient); | ||
118 | this.positionParcelHoverLocalID = currentParcelLocalID; | ||
119 | this.parcelUpdateSequenceIncrement++; | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | |||
124 | if (!this.ControllingClient.m_sandboxMode) | ||
125 | { | ||
126 | if (pos2.X < 0) | ||
127 | { | ||
128 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); | ||
129 | } | ||
130 | |||
131 | if (pos2.Y < 0) | ||
132 | { | ||
133 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); | ||
134 | } | ||
135 | |||
136 | if (pos2.X > 255) | ||
137 | { | ||
138 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); | ||
139 | } | ||
140 | |||
141 | if (pos2.Y > 255) | ||
142 | { | ||
143 | ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | |||
148 | } | ||
149 | |||
150 | public void SendUpdateToOtherClient(Avatar remoteAvatar) | ||
151 | { | ||
152 | ObjectUpdatePacket objupdate = CreateUpdatePacket(); | ||
153 | remoteAvatar.SendPacketToViewer(objupdate); | ||
154 | } | ||
155 | |||
156 | public ObjectUpdatePacket CreateUpdatePacket() | ||
157 | { | ||
158 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
159 | //send a objectupdate packet with information about the clients avatar | ||
160 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
161 | objupdate.RegionData.RegionHandle = m_world.m_regInfo.RegionHandle; | ||
162 | objupdate.RegionData.TimeDilation = 64096; | ||
163 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
164 | |||
165 | objupdate.ObjectData[0] = AvatarTemplate; | ||
166 | //give this avatar object a local id and assign the user a name | ||
167 | objupdate.ObjectData[0].ID = this.localid; | ||
168 | objupdate.ObjectData[0].FullID = ControllingClient.AgentID; | ||
169 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); | ||
170 | |||
171 | libsecondlife.LLVector3 pos2 = new LLVector3((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z); | ||
172 | |||
173 | byte[] pb = pos2.GetBytes(); | ||
174 | |||
175 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
176 | return objupdate; | ||
177 | } | ||
178 | |||
179 | public void SendInitialPosition() | ||
180 | { | ||
181 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
182 | //send a objectupdate packet with information about the clients avatar | ||
183 | |||
184 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
185 | objupdate.RegionData.RegionHandle = m_world.m_regInfo.RegionHandle; | ||
186 | objupdate.RegionData.TimeDilation = 64096; | ||
187 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
188 | objupdate.ObjectData[0] = AvatarTemplate; | ||
189 | //give this avatar object a local id and assign the user a name | ||
190 | |||
191 | objupdate.ObjectData[0].ID = this.localid; | ||
192 | this.uuid = objupdate.ObjectData[0].FullID = ControllingClient.AgentID; | ||
193 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); | ||
194 | libsecondlife.LLVector3 pos2 = new LLVector3((float)this.Pos.X, (float)this.Pos.Y, (float)this.Pos.Z); | ||
195 | byte[] pb = pos2.GetBytes(); | ||
196 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
197 | m_world._localNumber++; | ||
198 | |||
199 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
200 | foreach (Avatar client in avList) | ||
201 | { | ||
202 | client.SendPacketToViewer(objupdate); | ||
203 | if (client.ControllingClient.AgentID != this.ControllingClient.AgentID) | ||
204 | { | ||
205 | SendAppearanceToOtherAgent(client); | ||
206 | } | ||
207 | } | ||
208 | } | ||
209 | |||
210 | public void SendOurAppearance() | ||
211 | { | ||
212 | ControllingClient.SendAppearance(this.Wearables); | ||
213 | } | ||
214 | |||
215 | public void SendOurAppearance(ClientView OurClient) | ||
216 | { | ||
217 | //event handler for wearables request | ||
218 | this.SendOurAppearance(); | ||
219 | } | ||
220 | |||
221 | public void SendAppearanceToOtherAgent(Avatar avatarInfo) | ||
222 | { | ||
223 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); | ||
224 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | ||
225 | avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes(); | ||
226 | |||
227 | AvatarAppearancePacket.VisualParamBlock avblock = null; | ||
228 | for (int i = 0; i < 218; i++) | ||
229 | { | ||
230 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | ||
231 | avblock.ParamValue = visualParams[i]; | ||
232 | avp.VisualParam[i] = avblock; | ||
233 | } | ||
234 | |||
235 | avp.Sender.IsTrial = false; | ||
236 | avp.Sender.ID = ControllingClient.AgentID; | ||
237 | avatarInfo.SendPacketToViewer(avp); | ||
238 | } | ||
239 | |||
240 | public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) | ||
241 | { | ||
242 | LLObject.TextureEntry tex = new LLObject.TextureEntry(texture, 0, texture.Length); | ||
243 | this.avatarAppearanceTexture = tex; | ||
244 | |||
245 | for (int i = 0; i < visualParam.Length; i++) | ||
246 | { | ||
247 | this.visualParams[i] = visualParam[i].ParamValue; | ||
248 | } | ||
249 | |||
250 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
251 | foreach (Avatar client in avList) | ||
252 | { | ||
253 | if (client.ControllingClient.AgentID != this.ControllingClient.AgentID) | ||
254 | { | ||
255 | SendAppearanceToOtherAgent(client); | ||
256 | } | ||
257 | } | ||
258 | } | ||
259 | |||
260 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() | ||
261 | { | ||
262 | byte[] bytes = new byte[60]; | ||
263 | int i = 0; | ||
264 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
265 | |||
266 | dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; | ||
267 | libsecondlife.LLVector3 pos2 = new LLVector3(0, 0, 0); | ||
268 | lock (m_world.LockPhysicsEngine) | ||
269 | { | ||
270 | pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); | ||
271 | } | ||
272 | |||
273 | uint ID = this.localid; | ||
274 | |||
275 | bytes[i++] = (byte)(ID % 256); | ||
276 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
277 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
278 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
279 | bytes[i++] = 0; | ||
280 | bytes[i++] = 1; | ||
281 | i += 14; | ||
282 | bytes[i++] = 128; | ||
283 | bytes[i++] = 63; | ||
284 | |||
285 | byte[] pb = pos2.GetBytes(); | ||
286 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
287 | i += 12; | ||
288 | ushort InternVelocityX; | ||
289 | ushort InternVelocityY; | ||
290 | ushort InternVelocityZ; | ||
291 | Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0); | ||
292 | lock (m_world.LockPhysicsEngine) | ||
293 | { | ||
294 | internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z); | ||
295 | } | ||
296 | internDirec = internDirec / 128.0f; | ||
297 | internDirec.x += 1; | ||
298 | internDirec.y += 1; | ||
299 | internDirec.z += 1; | ||
300 | |||
301 | InternVelocityX = (ushort)(32768 * internDirec.x); | ||
302 | InternVelocityY = (ushort)(32768 * internDirec.y); | ||
303 | InternVelocityZ = (ushort)(32768 * internDirec.z); | ||
304 | |||
305 | ushort ac = 32767; | ||
306 | bytes[i++] = (byte)(InternVelocityX % 256); | ||
307 | bytes[i++] = (byte)((InternVelocityX >> 8) % 256); | ||
308 | bytes[i++] = (byte)(InternVelocityY % 256); | ||
309 | bytes[i++] = (byte)((InternVelocityY >> 8) % 256); | ||
310 | bytes[i++] = (byte)(InternVelocityZ % 256); | ||
311 | bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); | ||
312 | |||
313 | //accel | ||
314 | bytes[i++] = (byte)(ac % 256); | ||
315 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
316 | bytes[i++] = (byte)(ac % 256); | ||
317 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
318 | bytes[i++] = (byte)(ac % 256); | ||
319 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
320 | |||
321 | //rot | ||
322 | bytes[i++] = (byte)(ac % 256); | ||
323 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
324 | bytes[i++] = (byte)(ac % 256); | ||
325 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
326 | bytes[i++] = (byte)(ac % 256); | ||
327 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
328 | bytes[i++] = (byte)(ac % 256); | ||
329 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
330 | |||
331 | //rotation vel | ||
332 | bytes[i++] = (byte)(ac % 256); | ||
333 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
334 | bytes[i++] = (byte)(ac % 256); | ||
335 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
336 | bytes[i++] = (byte)(ac % 256); | ||
337 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
338 | |||
339 | dat.Data = bytes; | ||
340 | return (dat); | ||
341 | } | ||
342 | |||
343 | // Sends animation update | ||
344 | public void SendAnimPack(LLUUID animID, int seq) | ||
345 | { | ||
346 | AvatarAnimationPacket ani = new AvatarAnimationPacket(); | ||
347 | ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; | ||
348 | ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); | ||
349 | ani.AnimationSourceList[0].ObjectID = ControllingClient.AgentID; | ||
350 | ani.Sender = new AvatarAnimationPacket.SenderBlock(); | ||
351 | ani.Sender.ID = ControllingClient.AgentID; | ||
352 | ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; | ||
353 | ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); | ||
354 | ani.AnimationList[0].AnimID = this.current_anim = animID; | ||
355 | ani.AnimationList[0].AnimSequenceID = this.anim_seq = seq; | ||
356 | |||
357 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
358 | foreach (Avatar client in avList) | ||
359 | { | ||
360 | client.SendPacketToViewer(ani); | ||
361 | } | ||
362 | |||
363 | } | ||
364 | |||
365 | public void SendAnimPack() | ||
366 | { | ||
367 | this.SendAnimPack(this.current_anim, this.anim_seq); | ||
368 | } | ||
369 | |||
370 | } | ||
371 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/Avatar.cs b/OpenSim/OpenSim.RegionServer/Simulator/Avatar.cs deleted file mode 100644 index a64ee9e..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/Avatar.cs +++ /dev/null | |||
@@ -1,435 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using OpenSim.Physics.Manager; | ||
35 | using OpenSim.Framework.Inventory; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.RegionServer.Client; | ||
38 | |||
39 | using Axiom.MathLib; | ||
40 | |||
41 | namespace OpenSim.RegionServer.Simulator | ||
42 | { | ||
43 | public partial class Avatar : Entity | ||
44 | { | ||
45 | public static bool PhysicsEngineFlying = false; | ||
46 | public static AvatarAnimations Animations; | ||
47 | public string firstname; | ||
48 | public string lastname; | ||
49 | public ClientView ControllingClient; | ||
50 | public LLUUID current_anim; | ||
51 | public int anim_seq; | ||
52 | private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; | ||
53 | private bool updateflag = false; | ||
54 | private byte movementflag = 0; | ||
55 | private List<NewForce> forcesList = new List<NewForce>(); | ||
56 | private short _updateCount = 0; | ||
57 | private Axiom.MathLib.Quaternion bodyRot; | ||
58 | private LLObject.TextureEntry avatarAppearanceTexture = null; | ||
59 | private byte[] visualParams; | ||
60 | private AvatarWearable[] Wearables; | ||
61 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | ||
62 | private LLVector3 positionFrameBeforeLast = new LLVector3(0, 0, 0); | ||
63 | |||
64 | private int positionRoundedX = 0; | ||
65 | private int positionRoundedY = 0; | ||
66 | |||
67 | private int positionParcelHoverLocalID = -1; //Local ID of the last parcel they were over | ||
68 | private int parcelUpdateSequenceIncrement = 1; | ||
69 | |||
70 | private bool childAvatar = false; | ||
71 | |||
72 | public Avatar(ClientView TheClient, World world) | ||
73 | { | ||
74 | m_world = world; | ||
75 | ControllingClient = TheClient; | ||
76 | |||
77 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs - Loading details from grid (DUMMY)"); | ||
78 | localid = 8880000 + (this.m_world._localNumber++); | ||
79 | Pos = ControllingClient.startpos; | ||
80 | visualParams = new byte[218]; | ||
81 | for (int i = 0; i < 218; i++) | ||
82 | { | ||
83 | visualParams[i] = 100; | ||
84 | } | ||
85 | Wearables = new AvatarWearable[13]; //should be 13 of these | ||
86 | for (int i = 0; i < 13; i++) | ||
87 | { | ||
88 | Wearables[i] = new AvatarWearable(); | ||
89 | } | ||
90 | this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
91 | this.Wearables[0].ItemID = LLUUID.Random(); | ||
92 | |||
93 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
94 | |||
95 | //register for events | ||
96 | ControllingClient.OnRequestWearables += new ClientView.GenericCall(this.SendOurAppearance); | ||
97 | ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); | ||
98 | ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.CompleteMovement); | ||
99 | ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition); | ||
100 | ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate); | ||
101 | ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); | ||
102 | ControllingClient.OnChildAgentStatus += new ClientView.StatusChange(this.ChildStatusChange); | ||
103 | |||
104 | } | ||
105 | |||
106 | public PhysicsActor PhysActor | ||
107 | { | ||
108 | set | ||
109 | { | ||
110 | this._physActor = value; | ||
111 | } | ||
112 | get | ||
113 | { | ||
114 | return _physActor; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | public void ChildStatusChange(bool status) | ||
119 | { | ||
120 | this.childAvatar = status; | ||
121 | |||
122 | if (this.childAvatar == true) | ||
123 | { | ||
124 | this._physActor.Velocity = new PhysicsVector(0, 0, 0); | ||
125 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | ||
126 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
127 | terse.RegionData.RegionHandle = m_world.m_regInfo.RegionHandle; | ||
128 | terse.RegionData.TimeDilation = 64096; | ||
129 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
130 | terse.ObjectData[0] = terseBlock; | ||
131 | List<Avatar> avList = this.m_world.RequestAvatarList(); | ||
132 | foreach (Avatar client in avList) | ||
133 | { | ||
134 | client.SendPacketToViewer(terse); | ||
135 | } | ||
136 | } | ||
137 | else | ||
138 | { | ||
139 | LLVector3 startp = ControllingClient.StartPos; | ||
140 | lock (m_world.LockPhysicsEngine) | ||
141 | { | ||
142 | this._physActor.Position = new PhysicsVector(startp.X, startp.Y, startp.Z); | ||
143 | } | ||
144 | } | ||
145 | } | ||
146 | |||
147 | public override void addForces() | ||
148 | { | ||
149 | lock (this.forcesList) | ||
150 | { | ||
151 | if (this.forcesList.Count > 0) | ||
152 | { | ||
153 | for (int i = 0; i < this.forcesList.Count; i++) | ||
154 | { | ||
155 | NewForce force = this.forcesList[i]; | ||
156 | PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); | ||
157 | lock (m_world.LockPhysicsEngine) | ||
158 | { | ||
159 | this._physActor.Velocity = phyVector; | ||
160 | } | ||
161 | this.updateflag = true; | ||
162 | this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this | ||
163 | // but as we are setting the velocity (rather than using real forces) at the moment it is okay. | ||
164 | } | ||
165 | for (int i = 0; i < this.forcesList.Count; i++) | ||
166 | { | ||
167 | this.forcesList.RemoveAt(0); | ||
168 | } | ||
169 | } | ||
170 | } | ||
171 | } | ||
172 | |||
173 | public static void SetupTemplate(string name) | ||
174 | { | ||
175 | FileInfo fInfo = new FileInfo(name); | ||
176 | long numBytes = fInfo.Length; | ||
177 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | ||
178 | BinaryReader br = new BinaryReader(fStream); | ||
179 | byte[] data1 = br.ReadBytes((int)numBytes); | ||
180 | br.Close(); | ||
181 | fStream.Close(); | ||
182 | |||
183 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | ||
184 | |||
185 | SetDefaultPacketValues(objdata); | ||
186 | objdata.TextureEntry = data1; | ||
187 | objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); | ||
188 | objdata.PathCurve = 16; | ||
189 | objdata.ProfileCurve = 1; | ||
190 | objdata.PathScaleX = 100; | ||
191 | objdata.PathScaleY = 100; | ||
192 | objdata.ParentID = 0; | ||
193 | objdata.OwnerID = LLUUID.Zero; | ||
194 | objdata.Scale = new LLVector3(1, 1, 1); | ||
195 | objdata.PCode = 47; | ||
196 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
197 | libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); | ||
198 | pos.X = 100f; | ||
199 | objdata.ID = 8880000; | ||
200 | objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); | ||
201 | libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100f, 23f); | ||
202 | //objdata.FullID=user.AgentID; | ||
203 | byte[] pb = pos.GetBytes(); | ||
204 | Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); | ||
205 | |||
206 | Avatar.AvatarTemplate = objdata; | ||
207 | } | ||
208 | |||
209 | protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) | ||
210 | { | ||
211 | objdata.PSBlock = new byte[0]; | ||
212 | objdata.ExtraParams = new byte[1]; | ||
213 | objdata.MediaURL = new byte[0]; | ||
214 | objdata.NameValue = new byte[0]; | ||
215 | objdata.Text = new byte[0]; | ||
216 | objdata.TextColor = new byte[4]; | ||
217 | objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
218 | objdata.JointPivot = new LLVector3(0, 0, 0); | ||
219 | objdata.Material = 4; | ||
220 | objdata.TextureAnim = new byte[0]; | ||
221 | objdata.Sound = LLUUID.Zero; | ||
222 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
223 | objdata.TextureEntry = ntex.ToBytes(); | ||
224 | objdata.State = 0; | ||
225 | objdata.Data = new byte[0]; | ||
226 | |||
227 | objdata.ObjectData = new byte[76]; | ||
228 | objdata.ObjectData[15] = 128; | ||
229 | objdata.ObjectData[16] = 63; | ||
230 | objdata.ObjectData[56] = 128; | ||
231 | objdata.ObjectData[61] = 102; | ||
232 | objdata.ObjectData[62] = 40; | ||
233 | objdata.ObjectData[63] = 61; | ||
234 | objdata.ObjectData[64] = 189; | ||
235 | |||
236 | |||
237 | } | ||
238 | |||
239 | public void CompleteMovement() | ||
240 | { | ||
241 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); | ||
242 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | ||
243 | mov.AgentData.SessionID = this.ControllingClient.SessionID; | ||
244 | mov.AgentData.AgentID = this.ControllingClient.AgentID; | ||
245 | mov.Data.RegionHandle = this.m_world.m_regInfo.RegionHandle; | ||
246 | // TODO - dynamicalise this stuff | ||
247 | mov.Data.Timestamp = 1172750370; | ||
248 | mov.Data.Position = this.ControllingClient.startpos; | ||
249 | mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); | ||
250 | |||
251 | ControllingClient.OutPacket(mov); | ||
252 | } | ||
253 | |||
254 | public void HandleAgentUpdate(Packet pack) | ||
255 | { | ||
256 | this.HandleUpdate((AgentUpdatePacket)pack); | ||
257 | } | ||
258 | |||
259 | public void HandleUpdate(AgentUpdatePacket pack) | ||
260 | { | ||
261 | if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0) | ||
262 | { | ||
263 | if (this._physActor.Flying == false) | ||
264 | { | ||
265 | this.current_anim = Animations.AnimsLLUUID["FLY"]; | ||
266 | this.anim_seq = 1; | ||
267 | this.SendAnimPack(); | ||
268 | } | ||
269 | this._physActor.Flying = true; | ||
270 | |||
271 | } | ||
272 | else | ||
273 | { | ||
274 | if (this._physActor.Flying == true) | ||
275 | { | ||
276 | this.current_anim = Animations.AnimsLLUUID["STAND"]; | ||
277 | this.anim_seq = 1; | ||
278 | this.SendAnimPack(); | ||
279 | } | ||
280 | this._physActor.Flying = false; | ||
281 | } | ||
282 | if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) | ||
283 | { | ||
284 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | ||
285 | if (((movementflag & 1) == 0) || (q != this.bodyRot)) | ||
286 | { | ||
287 | |||
288 | if (((movementflag & 1) == 0) && (!this._physActor.Flying)) | ||
289 | { | ||
290 | this.current_anim = Animations.AnimsLLUUID["WALK"]; | ||
291 | this.anim_seq = 1; | ||
292 | this.SendAnimPack(); | ||
293 | } | ||
294 | |||
295 | |||
296 | //we should add a new force to the list | ||
297 | // but for now we will deal with velocities | ||
298 | NewForce newVelocity = new NewForce(); | ||
299 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); | ||
300 | Axiom.MathLib.Vector3 direc = q * v3; | ||
301 | direc.Normalize(); | ||
302 | |||
303 | //work out velocity for sim physics system | ||
304 | direc = direc * ((0.03f) * 128f); | ||
305 | if (this._physActor.Flying) | ||
306 | direc *= 4; | ||
307 | |||
308 | newVelocity.X = direc.x; | ||
309 | newVelocity.Y = direc.y; | ||
310 | newVelocity.Z = direc.z; | ||
311 | this.forcesList.Add(newVelocity); | ||
312 | movementflag = 1; | ||
313 | this.bodyRot = q; | ||
314 | } | ||
315 | } | ||
316 | else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0) && (PhysicsEngineFlying)) | ||
317 | { | ||
318 | if (((movementflag & 2) == 0) && this._physActor.Flying) | ||
319 | { | ||
320 | //we should add a new force to the list | ||
321 | // but for now we will deal with velocities | ||
322 | NewForce newVelocity = new NewForce(); | ||
323 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, 1); | ||
324 | Axiom.MathLib.Vector3 direc = v3; | ||
325 | direc.Normalize(); | ||
326 | |||
327 | //work out velocity for sim physics system | ||
328 | direc = direc * ((0.03f) * 128f * 2); | ||
329 | newVelocity.X = direc.x; | ||
330 | newVelocity.Y = direc.y; | ||
331 | newVelocity.Z = direc.z; | ||
332 | this.forcesList.Add(newVelocity); | ||
333 | movementflag = 2; | ||
334 | } | ||
335 | } | ||
336 | else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && (PhysicsEngineFlying)) | ||
337 | { | ||
338 | if (((movementflag & 4) == 0) && this._physActor.Flying) | ||
339 | { | ||
340 | //we should add a new force to the list | ||
341 | // but for now we will deal with velocities | ||
342 | NewForce newVelocity = new NewForce(); | ||
343 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, -1); | ||
344 | //Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | ||
345 | Axiom.MathLib.Vector3 direc = v3; | ||
346 | direc.Normalize(); | ||
347 | |||
348 | //work out velocity for sim physics system | ||
349 | direc = direc * ((0.03f) * 128f * 2); | ||
350 | newVelocity.X = direc.x; | ||
351 | newVelocity.Y = direc.y; | ||
352 | newVelocity.Z = direc.z; | ||
353 | this.forcesList.Add(newVelocity); | ||
354 | movementflag = 4; | ||
355 | } | ||
356 | } | ||
357 | else if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) | ||
358 | { | ||
359 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | ||
360 | if (((movementflag & 8) == 0) || (q != this.bodyRot)) | ||
361 | { | ||
362 | //we should add a new force to the list | ||
363 | // but for now we will deal with velocities | ||
364 | NewForce newVelocity = new NewForce(); | ||
365 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); | ||
366 | Axiom.MathLib.Vector3 direc = q * v3; | ||
367 | direc.Normalize(); | ||
368 | |||
369 | //work out velocity for sim physics system | ||
370 | direc = direc * ((0.03f) * 128f); | ||
371 | if (this._physActor.Flying) | ||
372 | direc *= 2; | ||
373 | |||
374 | newVelocity.X = direc.x; | ||
375 | newVelocity.Y = direc.y; | ||
376 | newVelocity.Z = direc.z; | ||
377 | this.forcesList.Add(newVelocity); | ||
378 | movementflag = 8; | ||
379 | this.bodyRot = q; | ||
380 | } | ||
381 | } | ||
382 | else | ||
383 | { | ||
384 | if (movementflag == 16) | ||
385 | { | ||
386 | movementflag = 0; | ||
387 | } | ||
388 | if ((movementflag) != 0) | ||
389 | { | ||
390 | NewForce newVelocity = new NewForce(); | ||
391 | newVelocity.X = 0; | ||
392 | newVelocity.Y = 0; | ||
393 | newVelocity.Z = 0; | ||
394 | this.forcesList.Add(newVelocity); | ||
395 | movementflag = 0; | ||
396 | // We're standing still, so make it show! | ||
397 | if (this._physActor.Flying == false) | ||
398 | { | ||
399 | this.current_anim = Animations.AnimsLLUUID["STAND"]; | ||
400 | this.anim_seq = 1; | ||
401 | this.SendAnimPack(); | ||
402 | } | ||
403 | this.movementflag = 16; | ||
404 | |||
405 | } | ||
406 | } | ||
407 | } | ||
408 | |||
409 | |||
410 | |||
411 | public static void LoadAnims() | ||
412 | { | ||
413 | Avatar.Animations = new AvatarAnimations(); | ||
414 | Avatar.Animations.LoadAnims(); | ||
415 | } | ||
416 | |||
417 | public override void LandRenegerated() | ||
418 | { | ||
419 | Pos = new LLVector3(100.0f, 100.0f, m_world.Terrain[(int)Pos.X, (int)Pos.Y] + 50.0f); | ||
420 | } | ||
421 | } | ||
422 | |||
423 | public class NewForce | ||
424 | { | ||
425 | public float X; | ||
426 | public float Y; | ||
427 | public float Z; | ||
428 | |||
429 | public NewForce() | ||
430 | { | ||
431 | |||
432 | } | ||
433 | } | ||
434 | |||
435 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/AvatarAnimations.cs b/OpenSim/OpenSim.RegionServer/Simulator/AvatarAnimations.cs deleted file mode 100644 index c7557dc..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/AvatarAnimations.cs +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using System.Xml; | ||
33 | |||
34 | namespace OpenSim.RegionServer.Simulator | ||
35 | { | ||
36 | public class AvatarAnimations | ||
37 | { | ||
38 | |||
39 | public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>(); | ||
40 | public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>(); | ||
41 | |||
42 | public AvatarAnimations() | ||
43 | { | ||
44 | } | ||
45 | |||
46 | public void LoadAnims() | ||
47 | { | ||
48 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); | ||
49 | XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"); | ||
50 | |||
51 | XmlDocument doc = new XmlDocument(); | ||
52 | doc.Load(reader); | ||
53 | foreach (XmlNode nod in doc.DocumentElement.ChildNodes) | ||
54 | { | ||
55 | |||
56 | if ( nod.Attributes["name"] != null) | ||
57 | { | ||
58 | AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); | ||
59 | } | ||
60 | |||
61 | } | ||
62 | |||
63 | reader.Close(); | ||
64 | |||
65 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); | ||
66 | |||
67 | foreach (KeyValuePair<string, LLUUID> kp in OpenSim.RegionServer.Simulator.Avatar.Animations.AnimsLLUUID) | ||
68 | { | ||
69 | AnimsNames.Add(kp.Value, kp.Key); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/Entity.cs b/OpenSim/OpenSim.RegionServer/Simulator/Entity.cs deleted file mode 100644 index 6d25c81..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/Entity.cs +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using Axiom.MathLib; | ||
32 | using OpenSim.Physics.Manager; | ||
33 | using OpenSim.RegionServer.Types; | ||
34 | using libsecondlife; | ||
35 | using OpenSim.RegionServer.Scripting; | ||
36 | |||
37 | namespace OpenSim.RegionServer.Simulator | ||
38 | { | ||
39 | public abstract class Entity : IScriptReadonlyEntity | ||
40 | { | ||
41 | public libsecondlife.LLUUID uuid; | ||
42 | public uint localid; | ||
43 | public LLVector3 velocity; | ||
44 | public Quaternion rotation; | ||
45 | protected List<Entity> children; | ||
46 | |||
47 | protected string m_name; | ||
48 | public virtual string Name | ||
49 | { | ||
50 | get { return m_name; } | ||
51 | } | ||
52 | |||
53 | protected LLVector3 m_pos; | ||
54 | protected PhysicsActor _physActor; | ||
55 | protected World m_world; | ||
56 | |||
57 | public virtual LLVector3 Pos | ||
58 | { | ||
59 | get | ||
60 | { | ||
61 | if (this._physActor != null) | ||
62 | { | ||
63 | m_pos.X = _physActor.Position.X; | ||
64 | m_pos.Y = _physActor.Position.Y; | ||
65 | m_pos.Z = _physActor.Position.Z; | ||
66 | } | ||
67 | |||
68 | return m_pos; | ||
69 | } | ||
70 | set | ||
71 | { | ||
72 | if (this._physActor != null) | ||
73 | { | ||
74 | try | ||
75 | { | ||
76 | lock (this.m_world.LockPhysicsEngine) | ||
77 | { | ||
78 | |||
79 | this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z); | ||
80 | } | ||
81 | } | ||
82 | catch (Exception e) | ||
83 | { | ||
84 | Console.WriteLine(e.Message); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | m_pos = value; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | /// <summary> | ||
93 | /// Creates a new Entity (should not occur on it's own) | ||
94 | /// </summary> | ||
95 | public Entity() | ||
96 | { | ||
97 | uuid = new libsecondlife.LLUUID(); | ||
98 | localid = 0; | ||
99 | m_pos = new LLVector3(); | ||
100 | velocity = new LLVector3(); | ||
101 | rotation = new Quaternion(); | ||
102 | m_name = "(basic entity)"; | ||
103 | children = new List<Entity>(); | ||
104 | } | ||
105 | |||
106 | public virtual void addForces() | ||
107 | { | ||
108 | foreach (Entity child in children) | ||
109 | { | ||
110 | child.addForces(); | ||
111 | } | ||
112 | } | ||
113 | |||
114 | /// <summary> | ||
115 | /// Performs any updates that need to be done at each frame. This function is overridable from it's children. | ||
116 | /// </summary> | ||
117 | public virtual void update() { | ||
118 | // Do any per-frame updates needed that are applicable to every type of entity | ||
119 | foreach (Entity child in children) | ||
120 | { | ||
121 | child.update(); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | /// <summary> | ||
126 | /// Returns a mesh for this object and any dependents | ||
127 | /// </summary> | ||
128 | /// <returns>The mesh of this entity tree</returns> | ||
129 | public virtual Mesh getMesh() | ||
130 | { | ||
131 | Mesh mesh = new Mesh(); | ||
132 | |||
133 | foreach (Entity child in children) | ||
134 | { | ||
135 | mesh += child.getMesh(); | ||
136 | } | ||
137 | |||
138 | return mesh; | ||
139 | } | ||
140 | |||
141 | public virtual void BackUp() | ||
142 | { | ||
143 | |||
144 | } | ||
145 | |||
146 | public virtual void LandRenegerated() | ||
147 | { | ||
148 | |||
149 | } | ||
150 | } | ||
151 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/ParcelManager.cs b/OpenSim/OpenSim.RegionServer/Simulator/ParcelManager.cs deleted file mode 100644 index 21b783f..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/ParcelManager.cs +++ /dev/null | |||
@@ -1,837 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using OpenSim.RegionServer.Simulator; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using OpenSim.RegionServer.Client; | ||
37 | |||
38 | namespace OpenSim.RegionServer.Simulator | ||
39 | { | ||
40 | public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, ClientView remote_client); | ||
41 | public delegate void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client); | ||
42 | public delegate void ParcelJoinRequest(int west, int south, int east, int north, ClientView remote_client); | ||
43 | public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, ClientView remote_client); | ||
44 | |||
45 | #region ParcelManager Class | ||
46 | /// <summary> | ||
47 | /// Handles Parcel objects and operations requiring information from other Parcel objects (divide, join, etc) | ||
48 | /// </summary> | ||
49 | public class ParcelManager : OpenSim.Framework.Interfaces.ILocalStorageParcelReceiver | ||
50 | { | ||
51 | |||
52 | #region Constants | ||
53 | //Parcel types set with flags in ParcelOverlay. | ||
54 | //Only one of these can be used. | ||
55 | public const byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000 | ||
56 | public const byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 | ||
57 | public const byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 | ||
58 | public const byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 | ||
59 | public const byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 | ||
60 | public const byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 | ||
61 | |||
62 | |||
63 | //Flags that when set, a border on the given side will be placed | ||
64 | //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc) | ||
65 | //This took forever to figure out -- jeesh. /blame LL for even having to send these | ||
66 | public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 | ||
67 | public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 | ||
68 | |||
69 | //RequestResults (I think these are right, they seem to work): | ||
70 | public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel | ||
71 | public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel | ||
72 | |||
73 | //These are other constants. Yay! | ||
74 | public const int START_PARCEL_LOCAL_ID = 1; | ||
75 | #endregion | ||
76 | |||
77 | #region Member Variables | ||
78 | public Dictionary<int, Parcel> parcelList = new Dictionary<int, Parcel>(); | ||
79 | private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; | ||
80 | private int[,] parcelIDList = new int[64, 64]; | ||
81 | |||
82 | private static World m_world; | ||
83 | #endregion | ||
84 | |||
85 | #region Constructors | ||
86 | public ParcelManager(World world) | ||
87 | { | ||
88 | |||
89 | m_world = world; | ||
90 | parcelIDList.Initialize(); | ||
91 | |||
92 | } | ||
93 | #endregion | ||
94 | |||
95 | #region Member Functions | ||
96 | |||
97 | #region Parcel From Storage Functions | ||
98 | public void ParcelFromStorage(ParcelData data) | ||
99 | { | ||
100 | Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world); | ||
101 | new_parcel.parcelData = data.Copy(); | ||
102 | new_parcel.setParcelBitmapFromByteArray(); | ||
103 | addParcel(new_parcel); | ||
104 | |||
105 | } | ||
106 | |||
107 | public void NoParcelDataFromStorage() | ||
108 | { | ||
109 | resetSimParcels(); | ||
110 | } | ||
111 | #endregion | ||
112 | |||
113 | #region Parcel Add/Remove/Get/Create | ||
114 | /// <summary> | ||
115 | /// Creates a basic Parcel object without an owner (a zeroed key) | ||
116 | /// </summary> | ||
117 | /// <returns></returns> | ||
118 | public Parcel createBaseParcel() | ||
119 | { | ||
120 | return new Parcel(new LLUUID(), false, m_world); | ||
121 | } | ||
122 | |||
123 | /// <summary> | ||
124 | /// Adds a parcel to the stored list and adds them to the parcelIDList to what they own | ||
125 | /// </summary> | ||
126 | /// <param name="new_parcel">The parcel being added</param> | ||
127 | public void addParcel(Parcel new_parcel) | ||
128 | { | ||
129 | lastParcelLocalID++; | ||
130 | new_parcel.parcelData.localID = lastParcelLocalID; | ||
131 | parcelList.Add(lastParcelLocalID, new_parcel.Copy()); | ||
132 | |||
133 | |||
134 | bool[,] parcelBitmap = new_parcel.getParcelBitmap(); | ||
135 | int x, y; | ||
136 | for (x = 0; x < 64; x++) | ||
137 | { | ||
138 | for (y = 0; y < 64; y++) | ||
139 | { | ||
140 | if (parcelBitmap[x, y]) | ||
141 | { | ||
142 | parcelIDList[x, y] = lastParcelLocalID; | ||
143 | } | ||
144 | } | ||
145 | } | ||
146 | parcelList[lastParcelLocalID].forceUpdateParcelInfo(); | ||
147 | |||
148 | |||
149 | } | ||
150 | /// <summary> | ||
151 | /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList | ||
152 | /// </summary> | ||
153 | /// <param name="local_id">Parcel.localID of the parcel to remove.</param> | ||
154 | public void removeParcel(int local_id) | ||
155 | { | ||
156 | int x, y; | ||
157 | for (x = 0; x < 64; x++) | ||
158 | { | ||
159 | for (y = 0; y < 64; y++) | ||
160 | { | ||
161 | if (parcelIDList[x, y] == local_id) | ||
162 | { | ||
163 | throw new Exception("Could not remove parcel. Still being used at " + x + ", " + y); | ||
164 | } | ||
165 | } | ||
166 | } | ||
167 | m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData); | ||
168 | parcelList.Remove(local_id); | ||
169 | } | ||
170 | |||
171 | public void performFinalParcelJoin(Parcel master, Parcel slave) | ||
172 | { | ||
173 | int x, y; | ||
174 | bool[,] parcelBitmapSlave = slave.getParcelBitmap(); | ||
175 | for (x = 0; x < 64; x++) | ||
176 | { | ||
177 | for (y = 0; y < 64; y++) | ||
178 | { | ||
179 | if (parcelBitmapSlave[x, y]) | ||
180 | { | ||
181 | parcelIDList[x, y] = master.parcelData.localID; | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | removeParcel(slave.parcelData.localID); | ||
186 | } | ||
187 | /// <summary> | ||
188 | /// Get the parcel at the specified point | ||
189 | /// </summary> | ||
190 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> | ||
191 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> | ||
192 | /// <returns>Parcel at the point supplied</returns> | ||
193 | public Parcel getParcel(int x, int y) | ||
194 | { | ||
195 | if (x > 256 || y > 256 || x < 0 || y < 0) | ||
196 | { | ||
197 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | ||
198 | } | ||
199 | else | ||
200 | { | ||
201 | return parcelList[parcelIDList[x / 4, y / 4]]; | ||
202 | } | ||
203 | |||
204 | } | ||
205 | #endregion | ||
206 | |||
207 | #region Parcel Modification | ||
208 | /// <summary> | ||
209 | /// Subdivides a parcel | ||
210 | /// </summary> | ||
211 | /// <param name="start_x">West Point</param> | ||
212 | /// <param name="start_y">South Point</param> | ||
213 | /// <param name="end_x">East Point</param> | ||
214 | /// <param name="end_y">North Point</param> | ||
215 | /// <param name="attempting_user_id">LLUUID of user who is trying to subdivide</param> | ||
216 | /// <returns>Returns true if successful</returns> | ||
217 | public bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) | ||
218 | { | ||
219 | //First, lets loop through the points and make sure they are all in the same parcel | ||
220 | //Get the parcel at start | ||
221 | Parcel startParcel = getParcel(start_x, start_y); | ||
222 | if (startParcel == null) return false; //No such parcel at the beginning | ||
223 | |||
224 | //Loop through the points | ||
225 | try | ||
226 | { | ||
227 | int totalX = end_x - start_x; | ||
228 | int totalY = end_y - start_y; | ||
229 | int x, y; | ||
230 | for (y = 0; y < totalY; y++) | ||
231 | { | ||
232 | for (x = 0; x < totalX; x++) | ||
233 | { | ||
234 | Parcel tempParcel = getParcel(start_x + x, start_y + y); | ||
235 | if (tempParcel == null) return false; //No such parcel at that point | ||
236 | if (tempParcel != startParcel) return false; //Subdividing over 2 parcels; no-no | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | catch | ||
241 | { | ||
242 | return false; //Exception. For now, lets skip subdivision | ||
243 | } | ||
244 | |||
245 | //If we are still here, then they are subdividing within one parcel | ||
246 | //Check owner | ||
247 | if (startParcel.parcelData.ownerID != attempting_user_id) | ||
248 | { | ||
249 | return false; //They cant do this! | ||
250 | } | ||
251 | |||
252 | //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info) | ||
253 | Parcel newParcel = startParcel.Copy(); | ||
254 | newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName; | ||
255 | newParcel.parcelData.globalID = LLUUID.Random(); | ||
256 | |||
257 | newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y)); | ||
258 | |||
259 | //Now, lets set the subdivision area of the original to false | ||
260 | int startParcelIndex = startParcel.parcelData.localID; | ||
261 | parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false)); | ||
262 | parcelList[startParcelIndex].forceUpdateParcelInfo(); | ||
263 | |||
264 | |||
265 | //Now add the new parcel | ||
266 | addParcel(newParcel); | ||
267 | |||
268 | |||
269 | |||
270 | |||
271 | |||
272 | return true; | ||
273 | } | ||
274 | /// <summary> | ||
275 | /// Join 2 parcels together | ||
276 | /// </summary> | ||
277 | /// <param name="start_x">x value in first parcel</param> | ||
278 | /// <param name="start_y">y value in first parcel</param> | ||
279 | /// <param name="end_x">x value in second parcel</param> | ||
280 | /// <param name="end_y">y value in second parcel</param> | ||
281 | /// <param name="attempting_user_id">LLUUID of the avatar trying to join the parcels</param> | ||
282 | /// <returns>Returns true if successful</returns> | ||
283 | public bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) | ||
284 | { | ||
285 | end_x -= 4; | ||
286 | end_y -= 4; | ||
287 | |||
288 | //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! | ||
289 | //This should be fixed later -- somewhat "incomplete code" --Ming | ||
290 | Parcel startParcel, endParcel; | ||
291 | |||
292 | try | ||
293 | { | ||
294 | startParcel = getParcel(start_x, start_y); | ||
295 | endParcel = getParcel(end_x, end_y); | ||
296 | } | ||
297 | catch | ||
298 | { | ||
299 | return false; //Error occured when trying to get the start and end parcels | ||
300 | } | ||
301 | if (startParcel == endParcel) | ||
302 | { | ||
303 | return false; //Subdivision of the same parcel is not allowed | ||
304 | } | ||
305 | |||
306 | //Check the parcel owners: | ||
307 | if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID) | ||
308 | { | ||
309 | return false; | ||
310 | } | ||
311 | if (startParcel.parcelData.ownerID != attempting_user_id) | ||
312 | { | ||
313 | //TODO: Group editing stuff. Avatar owner support for now | ||
314 | return false; | ||
315 | } | ||
316 | |||
317 | //Same owners! Lets join them | ||
318 | //Merge them to startParcel | ||
319 | parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap())); | ||
320 | performFinalParcelJoin(startParcel, endParcel); | ||
321 | |||
322 | return true; | ||
323 | |||
324 | |||
325 | |||
326 | } | ||
327 | #endregion | ||
328 | |||
329 | #region Parcel Updating | ||
330 | /// <summary> | ||
331 | /// Where we send the ParcelOverlay packet to the client | ||
332 | /// </summary> | ||
333 | /// <param name="remote_client">The object representing the client</param> | ||
334 | public void sendParcelOverlay(ClientView remote_client) | ||
335 | { | ||
336 | const int PARCEL_BLOCKS_PER_PACKET = 1024; | ||
337 | int x, y = 0; | ||
338 | byte[] byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; | ||
339 | int byteArrayCount = 0; | ||
340 | int sequenceID = 0; | ||
341 | ParcelOverlayPacket packet; | ||
342 | |||
343 | for (y = 0; y < 64; y++) | ||
344 | { | ||
345 | for (x = 0; x < 64; x++) | ||
346 | { | ||
347 | byte tempByte = (byte)0; //This represents the byte for the current 4x4 | ||
348 | Parcel currentParcelBlock = getParcel(x * 4, y * 4); | ||
349 | |||
350 | if (currentParcelBlock.parcelData.ownerID == remote_client.AgentID) | ||
351 | { | ||
352 | //Owner Flag | ||
353 | tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_REQUESTER); | ||
354 | } | ||
355 | else if (currentParcelBlock.parcelData.salePrice > 0 && (currentParcelBlock.parcelData.authBuyerID == LLUUID.Zero || currentParcelBlock.parcelData.authBuyerID == remote_client.AgentID)) | ||
356 | { | ||
357 | //Sale Flag | ||
358 | tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_IS_FOR_SALE); | ||
359 | } | ||
360 | else if (currentParcelBlock.parcelData.ownerID == LLUUID.Zero) | ||
361 | { | ||
362 | //Public Flag | ||
363 | tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_PUBLIC); | ||
364 | } | ||
365 | else | ||
366 | { | ||
367 | //Other Flag | ||
368 | tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_OTHER); | ||
369 | } | ||
370 | |||
371 | |||
372 | //Now for border control | ||
373 | if (x == 0) | ||
374 | { | ||
375 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); | ||
376 | } | ||
377 | else if (getParcel((x - 1) * 4, y * 4) != currentParcelBlock) | ||
378 | { | ||
379 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); | ||
380 | } | ||
381 | |||
382 | if (y == 0) | ||
383 | { | ||
384 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); | ||
385 | } | ||
386 | else if (getParcel(x * 4, (y - 1) * 4) != currentParcelBlock) | ||
387 | { | ||
388 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); | ||
389 | } | ||
390 | |||
391 | byteArray[byteArrayCount] = tempByte; | ||
392 | byteArrayCount++; | ||
393 | if (byteArrayCount >= PARCEL_BLOCKS_PER_PACKET) | ||
394 | { | ||
395 | byteArrayCount = 0; | ||
396 | packet = new ParcelOverlayPacket(); | ||
397 | packet.ParcelData.Data = byteArray; | ||
398 | packet.ParcelData.SequenceID = sequenceID; | ||
399 | //remote_client.OutPacket((Packet)packet); | ||
400 | sequenceID++; | ||
401 | byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; | ||
402 | } | ||
403 | } | ||
404 | } | ||
405 | |||
406 | packet = new ParcelOverlayPacket(); | ||
407 | packet.ParcelData.Data = byteArray; | ||
408 | packet.ParcelData.SequenceID = sequenceID; //Eh? | ||
409 | //remote_client.OutPacket((Packet)packet); | ||
410 | } | ||
411 | #endregion | ||
412 | |||
413 | /// <summary> | ||
414 | /// Resets the sim to the default parcel (full sim parcel owned by the default user) | ||
415 | /// </summary> | ||
416 | public void resetSimParcels() | ||
417 | { | ||
418 | //Remove all the parcels in the sim and add a blank, full sim parcel set to public | ||
419 | parcelList.Clear(); | ||
420 | lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; | ||
421 | parcelIDList.Initialize(); | ||
422 | |||
423 | Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world); | ||
424 | |||
425 | fullSimParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(0, 0, 256, 256)); | ||
426 | fullSimParcel.parcelData.parcelName = "Your Sim Parcel"; | ||
427 | fullSimParcel.parcelData.parcelDesc = ""; | ||
428 | |||
429 | fullSimParcel.parcelData.ownerID = m_world.m_regInfo.MasterAvatarAssignedUUID; | ||
430 | fullSimParcel.parcelData.salePrice = 1; | ||
431 | fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale; | ||
432 | fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased; | ||
433 | |||
434 | addParcel(fullSimParcel); | ||
435 | |||
436 | } | ||
437 | #endregion | ||
438 | } | ||
439 | #endregion | ||
440 | |||
441 | |||
442 | #region Parcel Class | ||
443 | /// <summary> | ||
444 | /// Keeps track of a specific parcel's information | ||
445 | /// </summary> | ||
446 | public class Parcel | ||
447 | { | ||
448 | #region Member Variables | ||
449 | public ParcelData parcelData = new ParcelData(); | ||
450 | public World m_world; | ||
451 | |||
452 | private bool[,] parcelBitmap = new bool[64, 64]; | ||
453 | |||
454 | #endregion | ||
455 | |||
456 | |||
457 | #region Constructors | ||
458 | public Parcel(LLUUID owner_id, bool is_group_owned, World world) | ||
459 | { | ||
460 | m_world = world; | ||
461 | parcelData.ownerID = owner_id; | ||
462 | parcelData.isGroupOwned = is_group_owned; | ||
463 | |||
464 | } | ||
465 | #endregion | ||
466 | |||
467 | |||
468 | #region Member Functions | ||
469 | |||
470 | #region General Functions | ||
471 | /// <summary> | ||
472 | /// Checks to see if this parcel contains a point | ||
473 | /// </summary> | ||
474 | /// <param name="x"></param> | ||
475 | /// <param name="y"></param> | ||
476 | /// <returns>Returns true if the parcel contains the specified point</returns> | ||
477 | public bool containsPoint(int x, int y) | ||
478 | { | ||
479 | if (x >= 0 && y >= 0 && x <= 256 && x <= 256) | ||
480 | { | ||
481 | return (parcelBitmap[x / 4, y / 4] == true); | ||
482 | } | ||
483 | else | ||
484 | { | ||
485 | return false; | ||
486 | } | ||
487 | } | ||
488 | |||
489 | public Parcel Copy() | ||
490 | { | ||
491 | Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world); | ||
492 | |||
493 | //Place all new variables here! | ||
494 | newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone()); | ||
495 | newParcel.parcelData = parcelData.Copy(); | ||
496 | |||
497 | return newParcel; | ||
498 | } | ||
499 | |||
500 | #endregion | ||
501 | |||
502 | |||
503 | #region Packet Request Handling | ||
504 | /// <summary> | ||
505 | /// Sends parcel properties as requested | ||
506 | /// </summary> | ||
507 | /// <param name="sequence_id">ID sent by client for them to keep track of</param> | ||
508 | /// <param name="snap_selection">Bool sent by client for them to use</param> | ||
509 | /// <param name="remote_client">Object representing the client</param> | ||
510 | public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, ClientView remote_client) | ||
511 | { | ||
512 | |||
513 | /*ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); | ||
514 | updatePacket.ParcelData.AABBMax = parcelData.AABBMax; | ||
515 | updatePacket.ParcelData.AABBMin = parcelData.AABBMin; | ||
516 | updatePacket.ParcelData.Area = parcelData.area; | ||
517 | updatePacket.ParcelData.AuctionID = parcelData.auctionID; | ||
518 | updatePacket.ParcelData.AuthBuyerID =parcelData.authBuyerID; //unemplemented | ||
519 | |||
520 | updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray; | ||
521 | |||
522 | updatePacket.ParcelData.Desc = libsecondlife.Helpers.StringToField(parcelData.parcelDesc); | ||
523 | updatePacket.ParcelData.Category = (byte)parcelData.category; | ||
524 | updatePacket.ParcelData.ClaimDate = parcelData.claimDate; | ||
525 | updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice; | ||
526 | updatePacket.ParcelData.GroupID = parcelData.groupID; | ||
527 | updatePacket.ParcelData.GroupPrims = parcelData.groupPrims; | ||
528 | updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; | ||
529 | updatePacket.ParcelData.LandingType = (byte)parcelData.landingType; | ||
530 | updatePacket.ParcelData.LocalID = parcelData.localID; | ||
531 | updatePacket.ParcelData.MaxPrims = 1000; //unemplemented | ||
532 | updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale; | ||
533 | updatePacket.ParcelData.MediaID = parcelData.mediaID; | ||
534 | updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL); | ||
535 | updatePacket.ParcelData.MusicURL = Helpers.StringToField(parcelData.musicURL); | ||
536 | updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName); | ||
537 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented | ||
538 | updatePacket.ParcelData.OtherCount = 0; //unemplemented | ||
539 | updatePacket.ParcelData.OtherPrims = 0; //unemplented | ||
540 | updatePacket.ParcelData.OwnerID = parcelData.ownerID; | ||
541 | updatePacket.ParcelData.OwnerPrims = 0; //unemplemented | ||
542 | updatePacket.ParcelData.ParcelFlags = (uint)parcelData.parcelFlags; //unemplemented | ||
543 | updatePacket.ParcelData.ParcelPrimBonus = (float)1.0; //unemplemented | ||
544 | updatePacket.ParcelData.PassHours = parcelData.passHours; | ||
545 | updatePacket.ParcelData.PassPrice = parcelData.passPrice; | ||
546 | updatePacket.ParcelData.PublicCount = 0; //unemplemented | ||
547 | updatePacket.ParcelData.RegionDenyAnonymous = false; //unemplemented | ||
548 | updatePacket.ParcelData.RegionDenyIdentified = false; //unemplemented | ||
549 | updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented | ||
550 | updatePacket.ParcelData.RegionPushOverride = true; //unemplemented | ||
551 | updatePacket.ParcelData.RentPrice = 0; //?? | ||
552 | updatePacket.ParcelData.RequestResult = request_result; | ||
553 | updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented | ||
554 | updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented | ||
555 | updatePacket.ParcelData.SelfCount = 0;//unemplemented | ||
556 | updatePacket.ParcelData.SequenceID = sequence_id; | ||
557 | updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented | ||
558 | updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented | ||
559 | updatePacket.ParcelData.SnapSelection = snap_selection; | ||
560 | updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; | ||
561 | updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; | ||
562 | updatePacket.ParcelData.TotalPrims = 0; //unemplemented | ||
563 | updatePacket.ParcelData.UserLocation = parcelData.userLocation; | ||
564 | updatePacket.ParcelData.UserLookAt = parcelData.userLookAt; | ||
565 | remote_client.OutPacket((Packet)updatePacket); */ | ||
566 | } | ||
567 | |||
568 | public void updateParcelProperties(ParcelPropertiesUpdatePacket packet, ClientView remote_client) | ||
569 | { | ||
570 | if (remote_client.AgentID == parcelData.ownerID) | ||
571 | { | ||
572 | //Needs later group support | ||
573 | parcelData.authBuyerID = packet.ParcelData.AuthBuyerID; | ||
574 | parcelData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category; | ||
575 | parcelData.parcelDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); | ||
576 | parcelData.groupID = packet.ParcelData.GroupID; | ||
577 | parcelData.landingType = packet.ParcelData.LandingType; | ||
578 | parcelData.mediaAutoScale = packet.ParcelData.MediaAutoScale; | ||
579 | parcelData.mediaID = packet.ParcelData.MediaID; | ||
580 | parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); | ||
581 | parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); | ||
582 | parcelData.parcelName = libsecondlife.Helpers.FieldToUTF8String(packet.ParcelData.Name); | ||
583 | parcelData.parcelFlags = (libsecondlife.Parcel.ParcelFlags)packet.ParcelData.ParcelFlags; | ||
584 | parcelData.passHours = packet.ParcelData.PassHours; | ||
585 | parcelData.passPrice = packet.ParcelData.PassPrice; | ||
586 | parcelData.salePrice = packet.ParcelData.SalePrice; | ||
587 | parcelData.snapshotID = packet.ParcelData.SnapshotID; | ||
588 | parcelData.userLocation = packet.ParcelData.UserLocation; | ||
589 | parcelData.userLookAt = packet.ParcelData.UserLookAt; | ||
590 | |||
591 | foreach (Avatar av in m_world.Avatars.Values) | ||
592 | { | ||
593 | Parcel over = m_world.parcelManager.getParcel((int)Math.Round(av.Pos.X), (int)Math.Round(av.Pos.Y)); | ||
594 | if (over == this) | ||
595 | { | ||
596 | sendParcelProperties(0, false, 0, av.ControllingClient); | ||
597 | } | ||
598 | } | ||
599 | } | ||
600 | } | ||
601 | #endregion | ||
602 | |||
603 | |||
604 | #region Update Functions | ||
605 | /// <summary> | ||
606 | /// Updates the AABBMin and AABBMax values after area/shape modification of parcel | ||
607 | /// </summary> | ||
608 | private void updateAABBAndAreaValues() | ||
609 | { | ||
610 | int min_x = 64; | ||
611 | int min_y = 64; | ||
612 | int max_x = 0; | ||
613 | int max_y = 0; | ||
614 | int tempArea = 0; | ||
615 | int x, y; | ||
616 | for (x = 0; x < 64; x++) | ||
617 | { | ||
618 | for (y = 0; y < 64; y++) | ||
619 | { | ||
620 | if (parcelBitmap[x, y] == true) | ||
621 | { | ||
622 | if (min_x > x) min_x = x; | ||
623 | if (min_y > y) min_y = y; | ||
624 | if (max_x < x) max_x = x; | ||
625 | if (max_y < y) max_y = y; | ||
626 | tempArea += 16; //16sqm parcel | ||
627 | } | ||
628 | } | ||
629 | } | ||
630 | parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), m_world.Terrain[(min_x * 4), (min_y * 4)]); | ||
631 | parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), m_world.Terrain[(max_x * 4), (max_y * 4)]); | ||
632 | parcelData.area = tempArea; | ||
633 | } | ||
634 | |||
635 | public void updateParcelBitmapByteArray() | ||
636 | { | ||
637 | parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes(); | ||
638 | } | ||
639 | |||
640 | /// <summary> | ||
641 | /// Update all settings in parcel such as area, bitmap byte array, etc | ||
642 | /// </summary> | ||
643 | public void forceUpdateParcelInfo() | ||
644 | { | ||
645 | this.updateAABBAndAreaValues(); | ||
646 | this.updateParcelBitmapByteArray(); | ||
647 | } | ||
648 | |||
649 | public void setParcelBitmapFromByteArray() | ||
650 | { | ||
651 | parcelBitmap = convertBytesToParcelBitmap(); | ||
652 | } | ||
653 | #endregion | ||
654 | |||
655 | |||
656 | #region Parcel Bitmap Functions | ||
657 | /// <summary> | ||
658 | /// Sets the parcel's bitmap manually | ||
659 | /// </summary> | ||
660 | /// <param name="bitmap">64x64 block representing where this parcel is on a map</param> | ||
661 | public void setParcelBitmap(bool[,] bitmap) | ||
662 | { | ||
663 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) | ||
664 | { | ||
665 | //Throw an exception - The bitmap is not 64x64 | ||
666 | throw new Exception("Error: Invalid Parcel Bitmap"); | ||
667 | } | ||
668 | else | ||
669 | { | ||
670 | //Valid: Lets set it | ||
671 | parcelBitmap = bitmap; | ||
672 | forceUpdateParcelInfo(); | ||
673 | |||
674 | } | ||
675 | } | ||
676 | /// <summary> | ||
677 | /// Gets the parcels bitmap manually | ||
678 | /// </summary> | ||
679 | /// <returns></returns> | ||
680 | public bool[,] getParcelBitmap() | ||
681 | { | ||
682 | return parcelBitmap; | ||
683 | } | ||
684 | /// <summary> | ||
685 | /// Converts the parcel bitmap to a packet friendly byte array | ||
686 | /// </summary> | ||
687 | /// <returns></returns> | ||
688 | private byte[] convertParcelBitmapToBytes() | ||
689 | { | ||
690 | byte[] tempConvertArr = new byte[512]; | ||
691 | byte tempByte = 0; | ||
692 | int x, y, i, byteNum = 0; | ||
693 | i = 0; | ||
694 | for (y = 0; y < 64; y++) | ||
695 | { | ||
696 | for (x = 0; x < 64; x++) | ||
697 | { | ||
698 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(parcelBitmap[x, y]) << (i++ % 8)); | ||
699 | if (i % 8 == 0) | ||
700 | { | ||
701 | tempConvertArr[byteNum] = tempByte; | ||
702 | tempByte = (byte)0; | ||
703 | i = 0; | ||
704 | byteNum++; | ||
705 | } | ||
706 | } | ||
707 | } | ||
708 | return tempConvertArr; | ||
709 | } | ||
710 | |||
711 | private bool[,] convertBytesToParcelBitmap() | ||
712 | { | ||
713 | bool[,] tempConvertMap = new bool[64, 64]; | ||
714 | tempConvertMap.Initialize(); | ||
715 | byte tempByte = 0; | ||
716 | int x = 0, y = 0, i = 0, bitNum = 0; | ||
717 | for(i = 0; i < 512; i++) | ||
718 | { | ||
719 | tempByte = parcelData.parcelBitmapByteArray[i]; | ||
720 | for(bitNum = 0; bitNum < 8; bitNum++) | ||
721 | { | ||
722 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); | ||
723 | tempConvertMap[x, y] = bit; | ||
724 | x++; | ||
725 | if(x > 63) | ||
726 | { | ||
727 | x = 0; | ||
728 | y++; | ||
729 | } | ||
730 | |||
731 | } | ||
732 | |||
733 | } | ||
734 | return tempConvertMap; | ||
735 | } | ||
736 | /// <summary> | ||
737 | /// Full sim parcel creation | ||
738 | /// </summary> | ||
739 | /// <returns></returns> | ||
740 | public static bool[,] basicFullRegionParcelBitmap() | ||
741 | { | ||
742 | return getSquareParcelBitmap(0, 0, 256, 256); | ||
743 | } | ||
744 | |||
745 | /// <summary> | ||
746 | /// Used to modify the bitmap between the x and y points. Points use 64 scale | ||
747 | /// </summary> | ||
748 | /// <param name="start_x"></param> | ||
749 | /// <param name="start_y"></param> | ||
750 | /// <param name="end_x"></param> | ||
751 | /// <param name="end_y"></param> | ||
752 | /// <returns></returns> | ||
753 | public static bool[,] getSquareParcelBitmap(int start_x, int start_y, int end_x, int end_y) | ||
754 | { | ||
755 | |||
756 | bool[,] tempBitmap = new bool[64, 64]; | ||
757 | tempBitmap.Initialize(); | ||
758 | |||
759 | tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); | ||
760 | return tempBitmap; | ||
761 | } | ||
762 | |||
763 | /// <summary> | ||
764 | /// Change a parcel's bitmap at within a square and set those points to a specific value | ||
765 | /// </summary> | ||
766 | /// <param name="parcel_bitmap"></param> | ||
767 | /// <param name="start_x"></param> | ||
768 | /// <param name="start_y"></param> | ||
769 | /// <param name="end_x"></param> | ||
770 | /// <param name="end_y"></param> | ||
771 | /// <param name="set_value"></param> | ||
772 | /// <returns></returns> | ||
773 | public static bool[,] modifyParcelBitmapSquare(bool[,] parcel_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value) | ||
774 | { | ||
775 | if (parcel_bitmap.GetLength(0) != 64 || parcel_bitmap.GetLength(1) != 64 || parcel_bitmap.Rank != 2) | ||
776 | { | ||
777 | //Throw an exception - The bitmap is not 64x64 | ||
778 | throw new Exception("Error: Invalid Parcel Bitmap in modifyParcelBitmapSquare()"); | ||
779 | } | ||
780 | |||
781 | int x, y; | ||
782 | for (y = 0; y < 64; y++) | ||
783 | { | ||
784 | for (x = 0; x < 64; x++) | ||
785 | { | ||
786 | if (x >= start_x / 4 && x < end_x / 4 | ||
787 | && y >= start_y / 4 && y < end_y / 4) | ||
788 | { | ||
789 | parcel_bitmap[x, y] = set_value; | ||
790 | } | ||
791 | } | ||
792 | } | ||
793 | return parcel_bitmap; | ||
794 | } | ||
795 | /// <summary> | ||
796 | /// Join the true values of 2 bitmaps together | ||
797 | /// </summary> | ||
798 | /// <param name="bitmap_base"></param> | ||
799 | /// <param name="bitmap_add"></param> | ||
800 | /// <returns></returns> | ||
801 | public static bool[,] mergeParcelBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) | ||
802 | { | ||
803 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) | ||
804 | { | ||
805 | //Throw an exception - The bitmap is not 64x64 | ||
806 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeParcelBitmaps"); | ||
807 | } | ||
808 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) | ||
809 | { | ||
810 | //Throw an exception - The bitmap is not 64x64 | ||
811 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps"); | ||
812 | |||
813 | } | ||
814 | |||
815 | int x, y; | ||
816 | for (y = 0; y < 64; y++) | ||
817 | { | ||
818 | for (x = 0; x < 64; x++) | ||
819 | { | ||
820 | if (bitmap_add[x, y]) | ||
821 | { | ||
822 | bitmap_base[x, y] = true; | ||
823 | } | ||
824 | } | ||
825 | } | ||
826 | return bitmap_base; | ||
827 | } | ||
828 | #endregion | ||
829 | |||
830 | #endregion | ||
831 | |||
832 | |||
833 | } | ||
834 | #endregion | ||
835 | |||
836 | |||
837 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/Primitive.cs b/OpenSim/OpenSim.RegionServer/Simulator/Primitive.cs deleted file mode 100644 index f1417d0..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/Primitive.cs +++ /dev/null | |||
@@ -1,598 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.RegionServer.Types; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Physics.Manager; | ||
36 | using OpenSim.Framework.Types; | ||
37 | using OpenSim.RegionServer.Client; | ||
38 | |||
39 | namespace OpenSim.RegionServer.Simulator | ||
40 | { | ||
41 | public class Primitive : Entity | ||
42 | { | ||
43 | protected float mesh_cutbegin; | ||
44 | protected float mesh_cutend; | ||
45 | protected PrimData primData; | ||
46 | protected bool newPrimFlag = false; | ||
47 | protected bool updateFlag = false; | ||
48 | protected bool dirtyFlag = false; | ||
49 | private ObjectUpdatePacket OurPacket; | ||
50 | private bool physicsEnabled = false; | ||
51 | private bool physicstest = false; | ||
52 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | ||
53 | private Dictionary<uint, ClientView> m_clientThreads; | ||
54 | private ulong m_regionHandle; | ||
55 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
56 | |||
57 | public bool PhysicsEnabled | ||
58 | { | ||
59 | get | ||
60 | { | ||
61 | return physicsEnabled; | ||
62 | } | ||
63 | set | ||
64 | { | ||
65 | physicsEnabled = value; | ||
66 | } | ||
67 | } | ||
68 | public bool UpdateFlag | ||
69 | { | ||
70 | get | ||
71 | { | ||
72 | return updateFlag; | ||
73 | } | ||
74 | set | ||
75 | { | ||
76 | updateFlag = value; | ||
77 | } | ||
78 | } | ||
79 | public LLVector3 Scale | ||
80 | { | ||
81 | set | ||
82 | { | ||
83 | LLVector3 offset = (value - primData.Scale); | ||
84 | offset.X /= 2; | ||
85 | offset.Y /= 2; | ||
86 | offset.Z /= 2; | ||
87 | |||
88 | this.primData.Position += offset; | ||
89 | this.primData.Scale = value; | ||
90 | |||
91 | this.dirtyFlag = true; | ||
92 | } | ||
93 | get | ||
94 | { | ||
95 | return this.primData.Scale; | ||
96 | } | ||
97 | } | ||
98 | public PhysicsActor PhysActor | ||
99 | { | ||
100 | set | ||
101 | { | ||
102 | this._physActor = value; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | public Primitive(Dictionary<uint, ClientView> clientThreads, ulong regionHandle, World world) | ||
107 | { | ||
108 | mesh_cutbegin = 0.0f; | ||
109 | mesh_cutend = 1.0f; | ||
110 | |||
111 | m_clientThreads = clientThreads; | ||
112 | m_regionHandle = regionHandle; | ||
113 | m_world = world; | ||
114 | } | ||
115 | |||
116 | public override Mesh getMesh() | ||
117 | { | ||
118 | Mesh mesh = new Mesh(); | ||
119 | Triangle tri = new Triangle( | ||
120 | new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f), | ||
121 | new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f), | ||
122 | new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f)); | ||
123 | |||
124 | mesh.AddTri(tri); | ||
125 | mesh += base.getMesh(); | ||
126 | |||
127 | return mesh; | ||
128 | } | ||
129 | |||
130 | public byte[] GetByteArray() | ||
131 | { | ||
132 | return this.primData.ToBytes(); | ||
133 | } | ||
134 | |||
135 | public void GetProperites(ClientView client) | ||
136 | { | ||
137 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | ||
138 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | ||
139 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | ||
140 | proper.ObjectData[0].ItemID = LLUUID.Zero; // this.uuid; | ||
141 | proper.ObjectData[0].CreationDate = (ulong) this.primData.CreationDate; | ||
142 | proper.ObjectData[0].CreatorID = this.primData.OwnerID; | ||
143 | proper.ObjectData[0].FolderID = LLUUID.Zero; | ||
144 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | ||
145 | proper.ObjectData[0].GroupID = LLUUID.Zero; | ||
146 | proper.ObjectData[0].InventorySerial = 0; | ||
147 | proper.ObjectData[0].LastOwnerID = LLUUID.Zero; | ||
148 | proper.ObjectData[0].ObjectID = this.uuid; | ||
149 | proper.ObjectData[0].OwnerID = primData.OwnerID; | ||
150 | proper.ObjectData[0].TouchName = new byte[0]; | ||
151 | proper.ObjectData[0].TextureID = new byte[0]; | ||
152 | proper.ObjectData[0].SitName = new byte[0]; | ||
153 | proper.ObjectData[0].Name = new byte[0]; | ||
154 | proper.ObjectData[0].Description = new byte[0]; | ||
155 | proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; | ||
156 | proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; | ||
157 | proper.ObjectData[0].GroupMask = this.primData.GroupMask; | ||
158 | proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; | ||
159 | proper.ObjectData[0].BaseMask = this.primData.BaseMask; | ||
160 | |||
161 | client.OutPacket(proper); | ||
162 | } | ||
163 | |||
164 | public void UpdatePosition(LLVector3 pos) | ||
165 | { | ||
166 | this.Pos = pos; | ||
167 | if (this._physActor != null) // && this.physicsEnabled) | ||
168 | { | ||
169 | try | ||
170 | { | ||
171 | lock (m_world.LockPhysicsEngine) | ||
172 | { | ||
173 | this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z); | ||
174 | } | ||
175 | } | ||
176 | catch (Exception e) | ||
177 | { | ||
178 | Console.WriteLine(e.Message); | ||
179 | } | ||
180 | } | ||
181 | this.updateFlag = true; | ||
182 | } | ||
183 | |||
184 | public override void update() | ||
185 | { | ||
186 | LLVector3 pos2 = new LLVector3(0, 0, 0); | ||
187 | if (this._physActor != null && this.physicsEnabled) | ||
188 | { | ||
189 | |||
190 | PhysicsVector pPos = this._physActor.Position; | ||
191 | pos2 = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
192 | } | ||
193 | if (this.newPrimFlag) | ||
194 | { | ||
195 | foreach (ClientView client in m_clientThreads.Values) | ||
196 | { | ||
197 | client.OutPacket(OurPacket); | ||
198 | } | ||
199 | this.newPrimFlag = false; | ||
200 | } | ||
201 | else if (this.updateFlag) | ||
202 | { | ||
203 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
204 | terse.RegionData.RegionHandle = m_regionHandle; // FIXME | ||
205 | terse.RegionData.TimeDilation = 64096; | ||
206 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
207 | terse.ObjectData[0] = this.CreateImprovedBlock(); | ||
208 | foreach (ClientView client in m_clientThreads.Values) | ||
209 | { | ||
210 | client.OutPacket(terse); | ||
211 | } | ||
212 | this.updateFlag = false; | ||
213 | } | ||
214 | else if (this.dirtyFlag) | ||
215 | { | ||
216 | foreach (ClientView client in m_clientThreads.Values) | ||
217 | { | ||
218 | UpdateClient(client); | ||
219 | } | ||
220 | this.dirtyFlag = false; | ||
221 | } | ||
222 | else | ||
223 | { | ||
224 | if (this._physActor != null && this.physicsEnabled) | ||
225 | { | ||
226 | if (pos2 != this.positionLastFrame) | ||
227 | { | ||
228 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
229 | terse.RegionData.RegionHandle = m_regionHandle; // FIXME | ||
230 | terse.RegionData.TimeDilation = 64096; | ||
231 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
232 | terse.ObjectData[0] = this.CreateImprovedBlock(); | ||
233 | foreach (ClientView client in m_clientThreads.Values) | ||
234 | { | ||
235 | client.OutPacket(terse); | ||
236 | } | ||
237 | } | ||
238 | this.positionLastFrame = pos2; | ||
239 | } | ||
240 | } | ||
241 | |||
242 | if (this.physicstest) | ||
243 | { | ||
244 | LLVector3 pos = this.Pos; | ||
245 | pos.Z += 0.0001f; | ||
246 | this.UpdatePosition(pos); | ||
247 | this.physicstest = false; | ||
248 | } | ||
249 | } | ||
250 | |||
251 | public void UpdateClient(ClientView RemoteClient) | ||
252 | { | ||
253 | |||
254 | LLVector3 lPos; | ||
255 | if (this._physActor != null && this.physicsEnabled) | ||
256 | { | ||
257 | PhysicsVector pPos = this._physActor.Position; | ||
258 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
259 | } | ||
260 | else | ||
261 | { | ||
262 | lPos = this.Pos; | ||
263 | } | ||
264 | byte[] pb = lPos.GetBytes(); | ||
265 | Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
266 | |||
267 | // OurPacket should be update with the follwing in updateShape() rather than having to do it here | ||
268 | OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
269 | OurPacket.ObjectData[0].PCode = this.primData.PCode; | ||
270 | OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
271 | OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
272 | OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
273 | OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
274 | OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
275 | OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
276 | OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
277 | OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
278 | OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
279 | OurPacket.ObjectData[0].Scale = this.primData.Scale; | ||
280 | OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
281 | OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
282 | OurPacket.ObjectData[0].ParentID = this.primData.ParentID ; | ||
283 | OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
284 | //finish off copying rest of shape data | ||
285 | OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | ||
286 | OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | ||
287 | OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX; | ||
288 | OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY; | ||
289 | OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist; | ||
290 | OurPacket.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin; | ||
291 | |||
292 | RemoteClient.OutPacket(OurPacket); | ||
293 | } | ||
294 | |||
295 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | ||
296 | { | ||
297 | this.primData.PathBegin = addPacket.PathBegin; | ||
298 | this.primData.PathEnd = addPacket.PathEnd; | ||
299 | this.primData.PathScaleX = addPacket.PathScaleX; | ||
300 | this.primData.PathScaleY = addPacket.PathScaleY; | ||
301 | this.primData.PathShearX = addPacket.PathShearX; | ||
302 | this.primData.PathShearY = addPacket.PathShearY; | ||
303 | this.primData.PathSkew = addPacket.PathSkew; | ||
304 | this.primData.ProfileBegin = addPacket.ProfileBegin; | ||
305 | this.primData.ProfileEnd = addPacket.ProfileEnd; | ||
306 | this.primData.PathCurve = addPacket.PathCurve; | ||
307 | this.primData.ProfileCurve = addPacket.ProfileCurve; | ||
308 | this.primData.ProfileHollow = addPacket.ProfileHollow; | ||
309 | this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; | ||
310 | this.primData.PathRevolutions = addPacket.PathRevolutions; | ||
311 | this.primData.PathTaperX = addPacket.PathTaperX; | ||
312 | this.primData.PathTaperY = addPacket.PathTaperY; | ||
313 | this.primData.PathTwist = addPacket.PathTwist; | ||
314 | this.primData.PathTwistBegin = addPacket.PathTwistBegin; | ||
315 | this.dirtyFlag = true; | ||
316 | } | ||
317 | |||
318 | public void UpdateTexture(byte[] tex) | ||
319 | { | ||
320 | this.OurPacket.ObjectData[0].TextureEntry = tex; | ||
321 | this.primData.Texture = tex; | ||
322 | this.dirtyFlag = true; | ||
323 | } | ||
324 | |||
325 | public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) | ||
326 | { | ||
327 | if (this._physActor != null) | ||
328 | { | ||
329 | if (this._physActor.Kinematic == pack.AgentData.UsePhysics) | ||
330 | { | ||
331 | this._physActor.Kinematic = !pack.AgentData.UsePhysics; //if Usephysics = true, then Kinematic should = false | ||
332 | } | ||
333 | this.physicsEnabled = pack.AgentData.UsePhysics; | ||
334 | if (this._physActor.Kinematic == false) | ||
335 | { | ||
336 | LLVector3 pos = this.Pos; | ||
337 | this.UpdatePosition(pos); | ||
338 | pos.Z += 0.000001f; | ||
339 | this.UpdatePosition(pos); | ||
340 | this.physicstest = true; | ||
341 | } | ||
342 | else | ||
343 | { | ||
344 | PhysicsVector vec = this._physActor.Position; | ||
345 | LLVector3 pos = new LLVector3(vec.X, vec.Y, vec.Z); | ||
346 | this.Pos = pos; | ||
347 | this.updateFlag = true; | ||
348 | } | ||
349 | } | ||
350 | } | ||
351 | |||
352 | public void MakeParent(Primitive prim) | ||
353 | { | ||
354 | this.primData.ParentID = prim.localid; | ||
355 | this.Pos -= prim.Pos; | ||
356 | this.dirtyFlag = true; | ||
357 | } | ||
358 | |||
359 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) | ||
360 | { | ||
361 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
362 | objupdate.RegionData.RegionHandle = m_regionHandle; | ||
363 | objupdate.RegionData.TimeDilation = 64096; | ||
364 | |||
365 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
366 | PrimData PData = new PrimData(); | ||
367 | this.primData = PData; | ||
368 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
369 | |||
370 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
371 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
372 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
373 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
374 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
375 | objupdate.ObjectData[0].Text = new byte[0]; | ||
376 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
377 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
378 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); | ||
379 | objupdate.ObjectData[0].Material = 3; | ||
380 | objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | ||
381 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
382 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
383 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
384 | this.primData.Texture = objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
385 | objupdate.ObjectData[0].State = 0; | ||
386 | objupdate.ObjectData[0].Data = new byte[0]; | ||
387 | PData.OwnerID = objupdate.ObjectData[0].OwnerID = ownerID; | ||
388 | PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; | ||
389 | PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; | ||
390 | PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd; | ||
391 | PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX; | ||
392 | PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY; | ||
393 | PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX; | ||
394 | PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY; | ||
395 | PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew; | ||
396 | PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin; | ||
397 | PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd; | ||
398 | PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale; | ||
399 | PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve; | ||
400 | PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve; | ||
401 | PData.ParentID = objupdate.ObjectData[0].ParentID = 0; | ||
402 | PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow; | ||
403 | PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | ||
404 | PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions; | ||
405 | PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX; | ||
406 | PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY; | ||
407 | PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist; | ||
408 | PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | ||
409 | |||
410 | objupdate.ObjectData[0].ID = (uint)(localID); | ||
411 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000")); | ||
412 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
413 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
414 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
415 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; | ||
416 | //update position | ||
417 | byte[] pb = pos1.GetBytes(); | ||
418 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
419 | this.newPrimFlag = true; | ||
420 | this.primData.FullID = this.uuid = objupdate.ObjectData[0].FullID; | ||
421 | this.localid = objupdate.ObjectData[0].ID; | ||
422 | this.primData.Position = this.Pos = pos1; | ||
423 | this.OurPacket = objupdate; | ||
424 | } | ||
425 | |||
426 | public void CreateFromStorage(PrimData store) | ||
427 | { | ||
428 | this.CreateFromStorage(store, store.Position, store.LocalID, false); | ||
429 | } | ||
430 | |||
431 | public void CreateFromStorage(PrimData store, LLVector3 posi, uint localID, bool newprim) | ||
432 | { | ||
433 | //need to clean this up as it shares a lot of code with CreateFromPacket() | ||
434 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
435 | objupdate.RegionData.RegionHandle = m_regionHandle; | ||
436 | objupdate.RegionData.TimeDilation = 64096; | ||
437 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
438 | |||
439 | this.primData = store; | ||
440 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
441 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
442 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
443 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
444 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
445 | objupdate.ObjectData[0].Text = new byte[0]; | ||
446 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
447 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
448 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); | ||
449 | objupdate.ObjectData[0].Material = 3; | ||
450 | objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | ||
451 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
452 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
453 | |||
454 | if (store.Texture == null) | ||
455 | { | ||
456 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
457 | objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
458 | } | ||
459 | else | ||
460 | { | ||
461 | objupdate.ObjectData[0].TextureEntry = store.Texture; | ||
462 | } | ||
463 | |||
464 | objupdate.ObjectData[0].State = 0; | ||
465 | objupdate.ObjectData[0].Data = new byte[0]; | ||
466 | objupdate.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
467 | objupdate.ObjectData[0].PCode = this.primData.PCode; | ||
468 | objupdate.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
469 | objupdate.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
470 | objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
471 | objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
472 | objupdate.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
473 | objupdate.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
474 | objupdate.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
475 | objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
476 | objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
477 | objupdate.ObjectData[0].Scale = this.primData.Scale; | ||
478 | objupdate.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
479 | objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
480 | objupdate.ObjectData[0].ParentID = 0; | ||
481 | objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
482 | //finish off copying rest of shape data | ||
483 | objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | ||
484 | objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | ||
485 | objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX; | ||
486 | objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY; | ||
487 | objupdate.ObjectData[0].PathTwist = this.primData.PathTwist; | ||
488 | objupdate.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin; | ||
489 | |||
490 | objupdate.ObjectData[0].ID = localID; // (uint)store.LocalID; | ||
491 | objupdate.ObjectData[0].FullID = store.FullID; | ||
492 | |||
493 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
494 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
495 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
496 | LLVector3 pos1 = posi; // store.Position; | ||
497 | //update position | ||
498 | byte[] pb = pos1.GetBytes(); | ||
499 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
500 | |||
501 | this.uuid = objupdate.ObjectData[0].FullID; | ||
502 | this.localid = objupdate.ObjectData[0].ID; | ||
503 | this.Pos = pos1; | ||
504 | this.OurPacket = objupdate; | ||
505 | if (newprim) | ||
506 | { | ||
507 | this.newPrimFlag = true; | ||
508 | } | ||
509 | } | ||
510 | |||
511 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | ||
512 | { | ||
513 | uint ID = this.localid; | ||
514 | byte[] bytes = new byte[60]; | ||
515 | |||
516 | int i = 0; | ||
517 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
518 | //dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry; | ||
519 | dat.TextureEntry = new byte[0]; | ||
520 | bytes[i++] = (byte)(ID % 256); | ||
521 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
522 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
523 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
524 | bytes[i++] = 0; | ||
525 | bytes[i++] = 0; | ||
526 | |||
527 | LLVector3 lPos; | ||
528 | Axiom.MathLib.Quaternion lRot; | ||
529 | if (this._physActor != null && this.physicsEnabled) | ||
530 | { | ||
531 | PhysicsVector pPos = this._physActor.Position; | ||
532 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
533 | lRot = this._physActor.Orientation; | ||
534 | } | ||
535 | else | ||
536 | { | ||
537 | lPos = this.Pos; | ||
538 | lRot = this.rotation; | ||
539 | } | ||
540 | byte[] pb = lPos.GetBytes(); | ||
541 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
542 | i += 12; | ||
543 | ushort ac = 32767; | ||
544 | |||
545 | //vel | ||
546 | bytes[i++] = (byte)(ac % 256); | ||
547 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
548 | bytes[i++] = (byte)(ac % 256); | ||
549 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
550 | bytes[i++] = (byte)(ac % 256); | ||
551 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
552 | |||
553 | //accel | ||
554 | bytes[i++] = (byte)(ac % 256); | ||
555 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
556 | bytes[i++] = (byte)(ac % 256); | ||
557 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
558 | bytes[i++] = (byte)(ac % 256); | ||
559 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
560 | |||
561 | ushort rw, rx, ry, rz; | ||
562 | rw = (ushort)(32768 * (lRot.w + 1)); | ||
563 | rx = (ushort)(32768 * (lRot.x + 1)); | ||
564 | ry = (ushort)(32768 * (lRot.y + 1)); | ||
565 | rz = (ushort)(32768 * (lRot.z + 1)); | ||
566 | |||
567 | //rot | ||
568 | bytes[i++] = (byte)(rx % 256); | ||
569 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
570 | bytes[i++] = (byte)(ry % 256); | ||
571 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
572 | bytes[i++] = (byte)(rz % 256); | ||
573 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
574 | bytes[i++] = (byte)(rw % 256); | ||
575 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
576 | |||
577 | //rotation vel | ||
578 | bytes[i++] = (byte)(ac % 256); | ||
579 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
580 | bytes[i++] = (byte)(ac % 256); | ||
581 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
582 | bytes[i++] = (byte)(ac % 256); | ||
583 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
584 | |||
585 | dat.Data = bytes; | ||
586 | return dat; | ||
587 | } | ||
588 | |||
589 | public override void BackUp() | ||
590 | { | ||
591 | this.primData.FullID = this.uuid; | ||
592 | this.primData.LocalID = this.localid; | ||
593 | this.primData.Position = this.Pos; | ||
594 | this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); | ||
595 | this.m_world.localStorage.StorePrim(this.primData); | ||
596 | } | ||
597 | } | ||
598 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/Primitive2.cs b/OpenSim/OpenSim.RegionServer/Simulator/Primitive2.cs deleted file mode 100644 index 0286e54..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/Primitive2.cs +++ /dev/null | |||
@@ -1,519 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.RegionServer.Types; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Physics.Manager; | ||
36 | using OpenSim.Framework.Types; | ||
37 | using OpenSim.Framework.Inventory; | ||
38 | using OpenSim.RegionServer.Client; | ||
39 | |||
40 | namespace OpenSim.RegionServer.Simulator | ||
41 | { | ||
42 | public class Primitive2 : Entity | ||
43 | { | ||
44 | protected PrimData primData; | ||
45 | //private ObjectUpdatePacket OurPacket; | ||
46 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | ||
47 | private Dictionary<uint, ClientView> m_clientThreads; | ||
48 | private ulong m_regionHandle; | ||
49 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
50 | private bool physicsEnabled = false; | ||
51 | |||
52 | private Dictionary<LLUUID, InventoryItem> inventoryItems; | ||
53 | |||
54 | #region Properties | ||
55 | |||
56 | public LLVector3 Scale | ||
57 | { | ||
58 | set | ||
59 | { | ||
60 | this.primData.Scale = value; | ||
61 | //this.dirtyFlag = true; | ||
62 | } | ||
63 | get | ||
64 | { | ||
65 | return this.primData.Scale; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | public PhysicsActor PhysActor | ||
70 | { | ||
71 | set | ||
72 | { | ||
73 | this._physActor = value; | ||
74 | } | ||
75 | } | ||
76 | public override LLVector3 Pos | ||
77 | { | ||
78 | get | ||
79 | { | ||
80 | return base.Pos; | ||
81 | } | ||
82 | set | ||
83 | { | ||
84 | base.Pos = value; | ||
85 | } | ||
86 | } | ||
87 | #endregion | ||
88 | |||
89 | public Primitive2(Dictionary<uint, ClientView> clientThreads, ulong regionHandle, World world) | ||
90 | { | ||
91 | m_clientThreads = clientThreads; | ||
92 | m_regionHandle = regionHandle; | ||
93 | m_world = world; | ||
94 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | ||
95 | } | ||
96 | |||
97 | public Primitive2(Dictionary<uint, ClientView> clientThreads, ulong regionHandle, World world, LLUUID owner) | ||
98 | { | ||
99 | m_clientThreads = clientThreads; | ||
100 | m_regionHandle = regionHandle; | ||
101 | m_world = world; | ||
102 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | ||
103 | this.primData = new PrimData(); | ||
104 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
105 | this.primData.OwnerID = owner; | ||
106 | } | ||
107 | |||
108 | public byte[] GetByteArray() | ||
109 | { | ||
110 | byte[] result = null; | ||
111 | List<byte[]> dataArrays = new List<byte[]>(); | ||
112 | dataArrays.Add(primData.ToBytes()); | ||
113 | foreach (Entity child in children) | ||
114 | { | ||
115 | if (child is OpenSim.RegionServer.Simulator.Primitive2) | ||
116 | { | ||
117 | dataArrays.Add(((OpenSim.RegionServer.Simulator.Primitive2)child).GetByteArray()); | ||
118 | } | ||
119 | } | ||
120 | byte[] primstart = Helpers.StringToField("<Prim>"); | ||
121 | byte[] primend = Helpers.StringToField("</Prim>"); | ||
122 | int totalLength = primstart.Length + primend.Length; | ||
123 | for (int i = 0; i < dataArrays.Count; i++) | ||
124 | { | ||
125 | totalLength += dataArrays[i].Length; | ||
126 | } | ||
127 | |||
128 | result = new byte[totalLength]; | ||
129 | int arraypos = 0; | ||
130 | Array.Copy(primstart, 0, result, 0, primstart.Length); | ||
131 | arraypos += primstart.Length; | ||
132 | for (int i = 0; i < dataArrays.Count; i++) | ||
133 | { | ||
134 | Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); | ||
135 | arraypos += dataArrays[i].Length; | ||
136 | } | ||
137 | Array.Copy(primend, 0, result, arraypos, primend.Length); | ||
138 | |||
139 | return result; | ||
140 | } | ||
141 | |||
142 | #region Overridden Methods | ||
143 | |||
144 | public override void update() | ||
145 | { | ||
146 | LLVector3 pos2 = new LLVector3(0, 0, 0); | ||
147 | } | ||
148 | |||
149 | public override void BackUp() | ||
150 | { | ||
151 | |||
152 | } | ||
153 | |||
154 | #endregion | ||
155 | |||
156 | #region Packet handlers | ||
157 | |||
158 | public void UpdatePosition(LLVector3 pos) | ||
159 | { | ||
160 | |||
161 | } | ||
162 | |||
163 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | ||
164 | { | ||
165 | this.primData.PathBegin = addPacket.PathBegin; | ||
166 | this.primData.PathEnd = addPacket.PathEnd; | ||
167 | this.primData.PathScaleX = addPacket.PathScaleX; | ||
168 | this.primData.PathScaleY = addPacket.PathScaleY; | ||
169 | this.primData.PathShearX = addPacket.PathShearX; | ||
170 | this.primData.PathShearY = addPacket.PathShearY; | ||
171 | this.primData.PathSkew = addPacket.PathSkew; | ||
172 | this.primData.ProfileBegin = addPacket.ProfileBegin; | ||
173 | this.primData.ProfileEnd = addPacket.ProfileEnd; | ||
174 | this.primData.PathCurve = addPacket.PathCurve; | ||
175 | this.primData.ProfileCurve = addPacket.ProfileCurve; | ||
176 | this.primData.ProfileHollow = addPacket.ProfileHollow; | ||
177 | this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; | ||
178 | this.primData.PathRevolutions = addPacket.PathRevolutions; | ||
179 | this.primData.PathTaperX = addPacket.PathTaperX; | ||
180 | this.primData.PathTaperY = addPacket.PathTaperY; | ||
181 | this.primData.PathTwist = addPacket.PathTwist; | ||
182 | this.primData.PathTwistBegin = addPacket.PathTwistBegin; | ||
183 | } | ||
184 | |||
185 | public void UpdateTexture(byte[] tex) | ||
186 | { | ||
187 | this.primData.Texture = tex; | ||
188 | //this.dirtyFlag = true; | ||
189 | } | ||
190 | |||
191 | public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) | ||
192 | { | ||
193 | |||
194 | } | ||
195 | |||
196 | public void AssignToParent(Primitive prim) | ||
197 | { | ||
198 | |||
199 | } | ||
200 | |||
201 | public void GetProperites(ClientView client) | ||
202 | { | ||
203 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | ||
204 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | ||
205 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | ||
206 | proper.ObjectData[0].ItemID = LLUUID.Zero; | ||
207 | proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate; | ||
208 | proper.ObjectData[0].CreatorID = this.primData.OwnerID; | ||
209 | proper.ObjectData[0].FolderID = LLUUID.Zero; | ||
210 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | ||
211 | proper.ObjectData[0].GroupID = LLUUID.Zero; | ||
212 | proper.ObjectData[0].InventorySerial = 0; | ||
213 | proper.ObjectData[0].LastOwnerID = LLUUID.Zero; | ||
214 | proper.ObjectData[0].ObjectID = this.uuid; | ||
215 | proper.ObjectData[0].OwnerID = primData.OwnerID; | ||
216 | proper.ObjectData[0].TouchName = new byte[0]; | ||
217 | proper.ObjectData[0].TextureID = new byte[0]; | ||
218 | proper.ObjectData[0].SitName = new byte[0]; | ||
219 | proper.ObjectData[0].Name = new byte[0]; | ||
220 | proper.ObjectData[0].Description = new byte[0]; | ||
221 | proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; | ||
222 | proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; | ||
223 | proper.ObjectData[0].GroupMask = this.primData.GroupMask; | ||
224 | proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; | ||
225 | proper.ObjectData[0].BaseMask = this.primData.BaseMask; | ||
226 | |||
227 | client.OutPacket(proper); | ||
228 | } | ||
229 | |||
230 | #endregion | ||
231 | |||
232 | # region Inventory Methods | ||
233 | |||
234 | public bool AddToInventory(InventoryItem item) | ||
235 | { | ||
236 | return false; | ||
237 | } | ||
238 | |||
239 | public InventoryItem RemoveFromInventory(LLUUID itemID) | ||
240 | { | ||
241 | return null; | ||
242 | } | ||
243 | |||
244 | public void RequestInventoryInfo(ClientView simClient, RequestTaskInventoryPacket packet) | ||
245 | { | ||
246 | |||
247 | } | ||
248 | |||
249 | public void RequestXferInventory(ClientView simClient, ulong xferID) | ||
250 | { | ||
251 | //will only currently work if the total size of the inventory data array is under about 1000 bytes | ||
252 | SendXferPacketPacket send = new SendXferPacketPacket(); | ||
253 | |||
254 | send.XferID.ID = xferID; | ||
255 | send.XferID.Packet = 1 + 2147483648; | ||
256 | send.DataPacket.Data = this.ConvertInventoryToBytes(); | ||
257 | |||
258 | simClient.OutPacket(send); | ||
259 | } | ||
260 | |||
261 | public byte[] ConvertInventoryToBytes() | ||
262 | { | ||
263 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
264 | byte[] result = new byte[0]; | ||
265 | List<byte[]> inventoryData = new List<byte[]>(); | ||
266 | int totallength = 0; | ||
267 | foreach (InventoryItem invItem in inventoryItems.Values) | ||
268 | { | ||
269 | byte[] data = enc.GetBytes(invItem.ExportString()); | ||
270 | inventoryData.Add(data); | ||
271 | totallength += data.Length; | ||
272 | } | ||
273 | //TODO: copy arrays into the single result array | ||
274 | |||
275 | return result; | ||
276 | } | ||
277 | |||
278 | public void CreateInventoryFromBytes(byte[] data) | ||
279 | { | ||
280 | |||
281 | } | ||
282 | |||
283 | #endregion | ||
284 | |||
285 | #region Update viewers Methods | ||
286 | |||
287 | //should change these mehtods, so that outgoing packets are sent through the avatar class | ||
288 | public void SendFullUpdateToClient(ClientView remoteClient) | ||
289 | { | ||
290 | LLVector3 lPos; | ||
291 | if (this._physActor != null && this.physicsEnabled) | ||
292 | { | ||
293 | PhysicsVector pPos = this._physActor.Position; | ||
294 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
295 | } | ||
296 | else | ||
297 | { | ||
298 | lPos = this.Pos; | ||
299 | } | ||
300 | |||
301 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | ||
302 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
303 | outPacket.ObjectData[0] = this.CreateUpdateBlock(); | ||
304 | byte[] pb = lPos.GetBytes(); | ||
305 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
306 | |||
307 | remoteClient.OutPacket(outPacket); | ||
308 | } | ||
309 | |||
310 | public void SendFullUpdateToAllClients() | ||
311 | { | ||
312 | |||
313 | } | ||
314 | |||
315 | public void SendTerseUpdateToClient(ClientView RemoteClient) | ||
316 | { | ||
317 | |||
318 | } | ||
319 | |||
320 | public void SendTerseUpdateToALLClients() | ||
321 | { | ||
322 | |||
323 | } | ||
324 | |||
325 | #endregion | ||
326 | |||
327 | #region Create Methods | ||
328 | |||
329 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) | ||
330 | { | ||
331 | PrimData PData = new PrimData(); | ||
332 | this.primData = PData; | ||
333 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
334 | |||
335 | PData.OwnerID = ownerID; | ||
336 | PData.PCode = addPacket.ObjectData.PCode; | ||
337 | PData.PathBegin = addPacket.ObjectData.PathBegin; | ||
338 | PData.PathEnd = addPacket.ObjectData.PathEnd; | ||
339 | PData.PathScaleX = addPacket.ObjectData.PathScaleX; | ||
340 | PData.PathScaleY = addPacket.ObjectData.PathScaleY; | ||
341 | PData.PathShearX = addPacket.ObjectData.PathShearX; | ||
342 | PData.PathShearY = addPacket.ObjectData.PathShearY; | ||
343 | PData.PathSkew = addPacket.ObjectData.PathSkew; | ||
344 | PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; | ||
345 | PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; | ||
346 | PData.Scale = addPacket.ObjectData.Scale; | ||
347 | PData.PathCurve = addPacket.ObjectData.PathCurve; | ||
348 | PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; | ||
349 | PData.ParentID = 0; | ||
350 | PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; | ||
351 | PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | ||
352 | PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; | ||
353 | PData.PathTaperX = addPacket.ObjectData.PathTaperX; | ||
354 | PData.PathTaperY = addPacket.ObjectData.PathTaperY; | ||
355 | PData.PathTwist = addPacket.ObjectData.PathTwist; | ||
356 | PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | ||
357 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; | ||
358 | this.primData.FullID = this.uuid = LLUUID.Random(); | ||
359 | this.localid = (uint)(localID); | ||
360 | this.primData.Position = this.Pos = pos1; | ||
361 | } | ||
362 | |||
363 | public void CreateFromBytes(byte[] data) | ||
364 | { | ||
365 | |||
366 | } | ||
367 | |||
368 | public void CreateFromPrimData(PrimData primData) | ||
369 | { | ||
370 | this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); | ||
371 | } | ||
372 | |||
373 | public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) | ||
374 | { | ||
375 | |||
376 | } | ||
377 | |||
378 | #endregion | ||
379 | |||
380 | #region Packet Update Methods | ||
381 | protected void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) | ||
382 | { | ||
383 | objdata.PSBlock = new byte[0]; | ||
384 | objdata.ExtraParams = new byte[1]; | ||
385 | objdata.MediaURL = new byte[0]; | ||
386 | objdata.NameValue = new byte[0]; | ||
387 | objdata.Text = new byte[0]; | ||
388 | objdata.TextColor = new byte[4]; | ||
389 | objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
390 | objdata.JointPivot = new LLVector3(0, 0, 0); | ||
391 | objdata.Material = 3; | ||
392 | objdata.TextureAnim = new byte[0]; | ||
393 | objdata.Sound = LLUUID.Zero; | ||
394 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
395 | this.primData.Texture = objdata.TextureEntry = ntex.ToBytes(); | ||
396 | objdata.State = 0; | ||
397 | objdata.Data = new byte[0]; | ||
398 | |||
399 | objdata.ObjectData = new byte[60]; | ||
400 | objdata.ObjectData[46] = 128; | ||
401 | objdata.ObjectData[47] = 63; | ||
402 | } | ||
403 | |||
404 | protected void SetPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData) | ||
405 | { | ||
406 | objectData.OwnerID = this.primData.OwnerID; | ||
407 | objectData.PCode = this.primData.PCode; | ||
408 | objectData.PathBegin = this.primData.PathBegin; | ||
409 | objectData.PathEnd = this.primData.PathEnd; | ||
410 | objectData.PathScaleX = this.primData.PathScaleX; | ||
411 | objectData.PathScaleY = this.primData.PathScaleY; | ||
412 | objectData.PathShearX = this.primData.PathShearX; | ||
413 | objectData.PathShearY = this.primData.PathShearY; | ||
414 | objectData.PathSkew = this.primData.PathSkew; | ||
415 | objectData.ProfileBegin = this.primData.ProfileBegin; | ||
416 | objectData.ProfileEnd = this.primData.ProfileEnd; | ||
417 | objectData.Scale = this.primData.Scale; | ||
418 | objectData.PathCurve = this.primData.PathCurve; | ||
419 | objectData.ProfileCurve = this.primData.ProfileCurve; | ||
420 | objectData.ParentID = this.primData.ParentID; | ||
421 | objectData.ProfileHollow = this.primData.ProfileHollow; | ||
422 | objectData.PathRadiusOffset = this.primData.PathRadiusOffset; | ||
423 | objectData.PathRevolutions = this.primData.PathRevolutions; | ||
424 | objectData.PathTaperX = this.primData.PathTaperX; | ||
425 | objectData.PathTaperY = this.primData.PathTaperY; | ||
426 | objectData.PathTwist = this.primData.PathTwist; | ||
427 | objectData.PathTwistBegin = this.primData.PathTwistBegin; | ||
428 | } | ||
429 | |||
430 | #endregion | ||
431 | protected ObjectUpdatePacket.ObjectDataBlock CreateUpdateBlock() | ||
432 | { | ||
433 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); | ||
434 | this.SetDefaultPacketValues(objupdate); | ||
435 | objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | ||
436 | this.SetPacketShapeData(objupdate); | ||
437 | byte[] pb = this.Pos.GetBytes(); | ||
438 | Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length); | ||
439 | return objupdate; | ||
440 | } | ||
441 | |||
442 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | ||
443 | { | ||
444 | uint ID = this.localid; | ||
445 | byte[] bytes = new byte[60]; | ||
446 | |||
447 | int i = 0; | ||
448 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
449 | dat.TextureEntry = new byte[0]; | ||
450 | bytes[i++] = (byte)(ID % 256); | ||
451 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
452 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
453 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
454 | bytes[i++] = 0; | ||
455 | bytes[i++] = 0; | ||
456 | |||
457 | LLVector3 lPos; | ||
458 | Axiom.MathLib.Quaternion lRot; | ||
459 | if (this._physActor != null && this.physicsEnabled) | ||
460 | { | ||
461 | PhysicsVector pPos = this._physActor.Position; | ||
462 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
463 | lRot = this._physActor.Orientation; | ||
464 | } | ||
465 | else | ||
466 | { | ||
467 | lPos = this.Pos; | ||
468 | lRot = this.rotation; | ||
469 | } | ||
470 | byte[] pb = lPos.GetBytes(); | ||
471 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
472 | i += 12; | ||
473 | ushort ac = 32767; | ||
474 | |||
475 | //vel | ||
476 | bytes[i++] = (byte)(ac % 256); | ||
477 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
478 | bytes[i++] = (byte)(ac % 256); | ||
479 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
480 | bytes[i++] = (byte)(ac % 256); | ||
481 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
482 | |||
483 | //accel | ||
484 | bytes[i++] = (byte)(ac % 256); | ||
485 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
486 | bytes[i++] = (byte)(ac % 256); | ||
487 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
488 | bytes[i++] = (byte)(ac % 256); | ||
489 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
490 | |||
491 | ushort rw, rx, ry, rz; | ||
492 | rw = (ushort)(32768 * (lRot.w + 1)); | ||
493 | rx = (ushort)(32768 * (lRot.x + 1)); | ||
494 | ry = (ushort)(32768 * (lRot.y + 1)); | ||
495 | rz = (ushort)(32768 * (lRot.z + 1)); | ||
496 | |||
497 | //rot | ||
498 | bytes[i++] = (byte)(rx % 256); | ||
499 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
500 | bytes[i++] = (byte)(ry % 256); | ||
501 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
502 | bytes[i++] = (byte)(rz % 256); | ||
503 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
504 | bytes[i++] = (byte)(rw % 256); | ||
505 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
506 | |||
507 | //rotation vel | ||
508 | bytes[i++] = (byte)(ac % 256); | ||
509 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
510 | bytes[i++] = (byte)(ac % 256); | ||
511 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
512 | bytes[i++] = (byte)(ac % 256); | ||
513 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
514 | |||
515 | dat.Data = bytes; | ||
516 | return dat; | ||
517 | } | ||
518 | } | ||
519 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/SceneObject.cs b/OpenSim/OpenSim.RegionServer/Simulator/SceneObject.cs deleted file mode 100644 index ce2b50d..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/SceneObject.cs +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.RegionServer.Types; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Physics.Manager; | ||
36 | using OpenSim.Framework.Types; | ||
37 | using OpenSim.Framework.Inventory; | ||
38 | using OpenSim.RegionServer.Client; | ||
39 | |||
40 | namespace OpenSim.RegionServer.Simulator | ||
41 | { | ||
42 | public class SceneObject : Entity | ||
43 | { | ||
44 | private Dictionary<LLUUID, Primitive2> ChildPrimitives = new Dictionary<LLUUID, Primitive2>(); | ||
45 | |||
46 | public SceneObject() | ||
47 | { | ||
48 | |||
49 | } | ||
50 | |||
51 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) | ||
52 | { | ||
53 | } | ||
54 | |||
55 | public void CreateFromBytes(byte[] data) | ||
56 | { | ||
57 | |||
58 | } | ||
59 | |||
60 | public override void update() | ||
61 | { | ||
62 | |||
63 | } | ||
64 | |||
65 | public override void BackUp() | ||
66 | { | ||
67 | |||
68 | } | ||
69 | |||
70 | public void GetProperites(ClientView client) | ||
71 | { | ||
72 | /* | ||
73 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | ||
74 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | ||
75 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | ||
76 | proper.ObjectData[0].ItemID = LLUUID.Zero; | ||
77 | proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate; | ||
78 | proper.ObjectData[0].CreatorID = this.primData.OwnerID; | ||
79 | proper.ObjectData[0].FolderID = LLUUID.Zero; | ||
80 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | ||
81 | proper.ObjectData[0].GroupID = LLUUID.Zero; | ||
82 | proper.ObjectData[0].InventorySerial = 0; | ||
83 | proper.ObjectData[0].LastOwnerID = LLUUID.Zero; | ||
84 | proper.ObjectData[0].ObjectID = this.uuid; | ||
85 | proper.ObjectData[0].OwnerID = primData.OwnerID; | ||
86 | proper.ObjectData[0].TouchName = new byte[0]; | ||
87 | proper.ObjectData[0].TextureID = new byte[0]; | ||
88 | proper.ObjectData[0].SitName = new byte[0]; | ||
89 | proper.ObjectData[0].Name = new byte[0]; | ||
90 | proper.ObjectData[0].Description = new byte[0]; | ||
91 | proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; | ||
92 | proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; | ||
93 | proper.ObjectData[0].GroupMask = this.primData.GroupMask; | ||
94 | proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; | ||
95 | proper.ObjectData[0].BaseMask = this.primData.BaseMask; | ||
96 | |||
97 | client.OutPacket(proper); | ||
98 | * */ | ||
99 | } | ||
100 | |||
101 | } | ||
102 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/World.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/Simulator/World.PacketHandlers.cs deleted file mode 100644 index 2c5a05f..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/World.PacketHandlers.cs +++ /dev/null | |||
@@ -1,449 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using OpenSim.Physics.Manager; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using OpenSim.Framework.Terrain; | ||
37 | using OpenSim.Framework.Inventory; | ||
38 | using OpenSim.Framework.Utilities; | ||
39 | using OpenSim.RegionServer.Assets; | ||
40 | using OpenSim.RegionServer.Client; | ||
41 | |||
42 | namespace OpenSim.RegionServer.Simulator | ||
43 | { | ||
44 | public partial class World | ||
45 | { | ||
46 | public void ModifyTerrain(byte action, float north, float west) | ||
47 | { | ||
48 | switch (action) | ||
49 | { | ||
50 | case 1: | ||
51 | // raise terrain | ||
52 | Terrain.raise(north, west, 10.0, 0.001); | ||
53 | RegenerateTerrain(true, (int)north, (int)west); | ||
54 | break; | ||
55 | case 2: | ||
56 | //lower terrain | ||
57 | Terrain.lower(north, west, 10.0, 0.001); | ||
58 | RegenerateTerrain(true, (int)north, (int)west); | ||
59 | break; | ||
60 | } | ||
61 | return; | ||
62 | } | ||
63 | |||
64 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | ||
65 | { | ||
66 | foreach (ClientView client in m_clientThreads.Values) | ||
67 | { | ||
68 | // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | ||
69 | int dis = (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos); | ||
70 | |||
71 | switch (type) | ||
72 | { | ||
73 | case 0: // Whisper | ||
74 | if ((dis < 10) && (dis > -10)) | ||
75 | { | ||
76 | //should change so the message is sent through the avatar rather than direct to the ClientView | ||
77 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
78 | } | ||
79 | break; | ||
80 | case 1: // Say | ||
81 | if ((dis < 30) && (dis > -30)) | ||
82 | { | ||
83 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
84 | } | ||
85 | break; | ||
86 | case 2: // Shout | ||
87 | if ((dis < 100) && (dis > -100)) | ||
88 | { | ||
89 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
90 | } | ||
91 | break; | ||
92 | |||
93 | case 0xff: // Broadcast | ||
94 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
95 | break; | ||
96 | } | ||
97 | |||
98 | } | ||
99 | } | ||
100 | |||
101 | public void RezObject(AssetBase primAsset, LLVector3 pos) | ||
102 | { | ||
103 | PrimData primd = new PrimData(primAsset.Data); | ||
104 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
105 | nPrim.CreateFromStorage(primd, pos, this._primCount, true); | ||
106 | this.Entities.Add(nPrim.uuid, nPrim); | ||
107 | this._primCount++; | ||
108 | } | ||
109 | |||
110 | public void DeRezObject(Packet packet, ClientView simClient) | ||
111 | { | ||
112 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; | ||
113 | |||
114 | //Needs to delete object from physics at a later date | ||
115 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | ||
116 | { | ||
117 | //currently following code not used (or don't know of any case of destination being zero | ||
118 | libsecondlife.LLUUID[] DeRezEnts; | ||
119 | DeRezEnts = new libsecondlife.LLUUID[DeRezPacket.ObjectData.Length]; | ||
120 | int i = 0; | ||
121 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | ||
122 | { | ||
123 | |||
124 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | ||
125 | foreach (Entity ent in this.Entities.Values) | ||
126 | { | ||
127 | if (ent.localid == Data.ObjectLocalID) | ||
128 | { | ||
129 | DeRezEnts[i++] = ent.uuid; | ||
130 | this.localStorage.RemovePrim(ent.uuid); | ||
131 | KillObjectPacket kill = new KillObjectPacket(); | ||
132 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | ||
133 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | ||
134 | kill.ObjectData[0].ID = ent.localid; | ||
135 | foreach (ClientView client in m_clientThreads.Values) | ||
136 | { | ||
137 | client.OutPacket(kill); | ||
138 | } | ||
139 | //Uncommenting this means an old UUID will be re-used, thus crashing the asset server | ||
140 | //Uncomment when prim/object UUIDs are random or such | ||
141 | //2007-03-22 - Randomskk | ||
142 | //this._primCount--; | ||
143 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Deleted UUID " + ent.uuid); | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | foreach (libsecondlife.LLUUID uuid in DeRezEnts) | ||
148 | { | ||
149 | lock (Entities) | ||
150 | { | ||
151 | Entities.Remove(uuid); | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | ||
158 | { | ||
159 | Entity selectedEnt = null; | ||
160 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | ||
161 | foreach (Entity ent in this.Entities.Values) | ||
162 | { | ||
163 | if (ent.localid == Data.ObjectLocalID) | ||
164 | { | ||
165 | AssetBase primAsset = new AssetBase(); | ||
166 | primAsset.FullID = LLUUID.Random();//DeRezPacket.AgentBlock.TransactionID.Combine(LLUUID.Zero); //should be combining with securesessionid | ||
167 | primAsset.InvType = 6; | ||
168 | primAsset.Type = 6; | ||
169 | primAsset.Name = "Prim"; | ||
170 | primAsset.Description = ""; | ||
171 | primAsset.Data = ((Primitive)ent).GetByteArray(); | ||
172 | this._assetCache.AddAsset(primAsset); | ||
173 | this._inventoryCache.AddNewInventoryItem(simClient, DeRezPacket.AgentBlock.DestinationID, primAsset); | ||
174 | selectedEnt = ent; | ||
175 | break; | ||
176 | } | ||
177 | } | ||
178 | if (selectedEnt != null) | ||
179 | { | ||
180 | this.localStorage.RemovePrim(selectedEnt.uuid); | ||
181 | KillObjectPacket kill = new KillObjectPacket(); | ||
182 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | ||
183 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | ||
184 | kill.ObjectData[0].ID = selectedEnt.localid; | ||
185 | foreach (ClientView client in m_clientThreads.Values) | ||
186 | { | ||
187 | client.OutPacket(kill); | ||
188 | } | ||
189 | lock (Entities) | ||
190 | { | ||
191 | Entities.Remove(selectedEnt.uuid); | ||
192 | } | ||
193 | } | ||
194 | } | ||
195 | } | ||
196 | |||
197 | } | ||
198 | |||
199 | public void SendAvatarsToClient(ClientView remoteClient) | ||
200 | { | ||
201 | foreach (ClientView client in m_clientThreads.Values) | ||
202 | { | ||
203 | if (client.AgentID != remoteClient.AgentID) | ||
204 | { | ||
205 | // ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); | ||
206 | // RemoteClient.OutPacket(objupdate); | ||
207 | client.ClientAvatar.SendUpdateToOtherClient(remoteClient.ClientAvatar); | ||
208 | client.ClientAvatar.SendAppearanceToOtherAgent(remoteClient.ClientAvatar); | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | |||
213 | public void LinkObjects(uint parentPrim, List<uint> childPrims) | ||
214 | { | ||
215 | Primitive parentprim = null; | ||
216 | foreach (Entity ent in Entities.Values) | ||
217 | { | ||
218 | if (ent.localid == parentPrim) | ||
219 | { | ||
220 | parentprim = (OpenSim.RegionServer.Simulator.Primitive)ent; | ||
221 | |||
222 | } | ||
223 | } | ||
224 | |||
225 | for (int i = 0; i < childPrims.Count; i++) | ||
226 | { | ||
227 | uint childId = childPrims[i]; | ||
228 | foreach (Entity ent in Entities.Values) | ||
229 | { | ||
230 | if (ent.localid == childId) | ||
231 | { | ||
232 | ((OpenSim.RegionServer.Simulator.Primitive)ent).MakeParent(parentprim); | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | |||
237 | } | ||
238 | |||
239 | public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) | ||
240 | { | ||
241 | foreach (Entity ent in Entities.Values) | ||
242 | { | ||
243 | if (ent.localid == primLocalID) | ||
244 | { | ||
245 | ((OpenSim.RegionServer.Simulator.Primitive)ent).UpdateShape(shapeBlock); | ||
246 | break; | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | |||
251 | public void SelectPrim(uint primLocalID, ClientView remoteClient) | ||
252 | { | ||
253 | foreach (Entity ent in Entities.Values) | ||
254 | { | ||
255 | if (ent.localid == primLocalID) | ||
256 | { | ||
257 | ((OpenSim.RegionServer.Simulator.Primitive)ent).GetProperites(remoteClient); | ||
258 | break; | ||
259 | } | ||
260 | } | ||
261 | } | ||
262 | |||
263 | public void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient) | ||
264 | { | ||
265 | foreach (Entity ent in Entities.Values) | ||
266 | { | ||
267 | if (ent.localid == localID) | ||
268 | { | ||
269 | ((OpenSim.RegionServer.Simulator.Primitive)ent).UpdateObjectFlags((ObjectFlagUpdatePacket) packet); | ||
270 | break; | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | |||
275 | public void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient) | ||
276 | { | ||
277 | foreach (Entity ent in Entities.Values) | ||
278 | { | ||
279 | if (ent.localid == localID) | ||
280 | { | ||
281 | ((OpenSim.RegionServer.Simulator.Primitive)ent).UpdateTexture(texture); | ||
282 | break; | ||
283 | } | ||
284 | } | ||
285 | } | ||
286 | |||
287 | public void UpdatePrimPosition(uint localID, LLVector3 pos, ClientView remoteClient) | ||
288 | { | ||
289 | foreach (Entity ent in Entities.Values) | ||
290 | { | ||
291 | if (ent.localid == localID) | ||
292 | { | ||
293 | ((OpenSim.RegionServer.Simulator.Primitive)ent).UpdatePosition(pos); | ||
294 | break; | ||
295 | } | ||
296 | } | ||
297 | } | ||
298 | |||
299 | public void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient) | ||
300 | { | ||
301 | foreach (Entity ent in Entities.Values) | ||
302 | { | ||
303 | if (ent.localid == localID) | ||
304 | { | ||
305 | ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); | ||
306 | ((OpenSim.RegionServer.Simulator.Primitive)ent).UpdateFlag = true; | ||
307 | break; | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | |||
312 | public void UpdatePrimScale(uint localID, LLVector3 scale, ClientView remoteClient) | ||
313 | { | ||
314 | foreach (Entity ent in Entities.Values) | ||
315 | { | ||
316 | if (ent.localid == localID) | ||
317 | { | ||
318 | ((OpenSim.RegionServer.Simulator.Primitive)ent).Scale = scale; | ||
319 | break; | ||
320 | } | ||
321 | } | ||
322 | } | ||
323 | #region Parcel Packet Handlers | ||
324 | void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, ClientView remote_client) | ||
325 | { | ||
326 | //Get the parcels within the bounds | ||
327 | List<OpenSim.RegionServer.Simulator.Parcel> temp = new List<OpenSim.RegionServer.Simulator.Parcel>(); | ||
328 | int x, y, i; | ||
329 | int inc_x = end_x - start_x; | ||
330 | int inc_y = end_y - start_y; | ||
331 | for(x = 0; x < inc_x; x++) | ||
332 | { | ||
333 | for(y = 0; y < inc_y; y++) | ||
334 | { | ||
335 | OpenSim.RegionServer.Simulator.Parcel currentParcel = parcelManager.getParcel(start_x + x, start_y + y); | ||
336 | if(!temp.Contains(currentParcel)) | ||
337 | { | ||
338 | currentParcel. | ||
339 | forceUpdateParcelInfo(); | ||
340 | temp.Add(currentParcel); | ||
341 | } | ||
342 | } | ||
343 | } | ||
344 | |||
345 | int requestResult = OpenSim.RegionServer.Simulator.ParcelManager.PARCEL_RESULT_ONE_PARCEL; | ||
346 | if (temp.Count > 1) | ||
347 | { | ||
348 | requestResult = OpenSim.RegionServer.Simulator.ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS; | ||
349 | } | ||
350 | |||
351 | for (i = 0; i < temp.Count; i++) | ||
352 | { | ||
353 | temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client); | ||
354 | } | ||
355 | |||
356 | |||
357 | parcelManager.sendParcelOverlay(remote_client); | ||
358 | } | ||
359 | |||
360 | void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client) | ||
361 | { | ||
362 | parcelManager.subdivide(west, south, east, north, remote_client.AgentID); | ||
363 | } | ||
364 | void ParcelJoinRequest(int west, int south, int east, int north, ClientView remote_client) | ||
365 | { | ||
366 | parcelManager.join(west, south, east, north, remote_client.AgentID); | ||
367 | } | ||
368 | void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, ClientView remote_client) | ||
369 | { | ||
370 | if (parcelManager.parcelList.ContainsKey(packet.ParcelData.LocalID)) | ||
371 | { | ||
372 | parcelManager.parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client); | ||
373 | } | ||
374 | } | ||
375 | #endregion | ||
376 | |||
377 | /* | ||
378 | public void RequestMapBlock(ClientView simClient, int minX, int minY, int maxX, int maxY) | ||
379 | { | ||
380 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
381 | if (((m_regInfo.RegionLocX > minX) && (m_regInfo.RegionLocX < maxX)) && ((m_regInfo.RegionLocY > minY) && (m_regInfo.RegionLocY < maxY))) | ||
382 | { | ||
383 | MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); | ||
384 | mapReply.AgentData.AgentID = simClient.AgentID; | ||
385 | mapReply.AgentData.Flags = 0; | ||
386 | mapReply.Data = new MapBlockReplyPacket.DataBlock[1]; | ||
387 | mapReply.Data[0] = new MapBlockReplyPacket.DataBlock(); | ||
388 | mapReply.Data[0].MapImageID = new LLUUID("00000000-0000-0000-9999-000000000007"); | ||
389 | mapReply.Data[0].X = (ushort)m_regInfo.RegionLocX; | ||
390 | mapReply.Data[0].Y = (ushort)m_regInfo.RegionLocY; | ||
391 | mapReply.Data[0].WaterHeight = (byte)m_regInfo.RegionWaterHeight; | ||
392 | mapReply.Data[0].Name = _enc.GetBytes(this.m_regionName); | ||
393 | mapReply.Data[0].RegionFlags = 72458694; | ||
394 | mapReply.Data[0].Access = 13; | ||
395 | mapReply.Data[0].Agents = 1; //should send number of clients connected | ||
396 | simClient.OutPacket(mapReply); | ||
397 | } | ||
398 | } | ||
399 | public bool RezObjectHandler(ClientView simClient, Packet packet) | ||
400 | { | ||
401 | RezObjectPacket rezPacket = (RezObjectPacket)packet; | ||
402 | AgentInventory inven = this._inventoryCache.GetAgentsInventory(simClient.AgentID); | ||
403 | if (inven != null) | ||
404 | { | ||
405 | if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) | ||
406 | { | ||
407 | AssetBase asset = this._assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID); | ||
408 | if (asset != null) | ||
409 | { | ||
410 | PrimData primd = new PrimData(asset.Data); | ||
411 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
412 | nPrim.CreateFromStorage(primd, rezPacket.RezData.RayEnd, this._primCount, true); | ||
413 | this.Entities.Add(nPrim.uuid, nPrim); | ||
414 | this._primCount++; | ||
415 | this._inventoryCache.DeleteInventoryItem(simClient, rezPacket.InventoryData.ItemID); | ||
416 | } | ||
417 | } | ||
418 | } | ||
419 | return true; | ||
420 | } | ||
421 | public bool ModifyTerrain(ClientView simClient, Packet packet) | ||
422 | { | ||
423 | ModifyLandPacket modify = (ModifyLandPacket)packet; | ||
424 | |||
425 | switch (modify.ModifyBlock.Action) | ||
426 | { | ||
427 | case 1: | ||
428 | // raise terrain | ||
429 | if (modify.ParcelData.Length > 0) | ||
430 | { | ||
431 | Terrain.raise(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1); | ||
432 | RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West); | ||
433 | } | ||
434 | break; | ||
435 | case 2: | ||
436 | //lower terrain | ||
437 | if (modify.ParcelData.Length > 0) | ||
438 | { | ||
439 | Terrain.lower(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1); | ||
440 | RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West); | ||
441 | } | ||
442 | break; | ||
443 | } | ||
444 | return true; | ||
445 | } | ||
446 | */ | ||
447 | |||
448 | } | ||
449 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/World.Scripting.cs b/OpenSim/OpenSim.RegionServer/Simulator/World.Scripting.cs deleted file mode 100644 index 747730c..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/World.Scripting.cs +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using libsecondlife; | ||
37 | |||
38 | namespace OpenSim.RegionServer.Simulator | ||
39 | { | ||
40 | public partial class World | ||
41 | { | ||
42 | private Dictionary<string, IScriptEngine> scriptEngines = new Dictionary<string, IScriptEngine>(); | ||
43 | |||
44 | private void LoadScriptEngines() | ||
45 | { | ||
46 | this.LoadScriptPlugins(); | ||
47 | } | ||
48 | |||
49 | public void LoadScriptPlugins() | ||
50 | { | ||
51 | string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines"); | ||
52 | string[] pluginFiles = Directory.GetFiles(path, "*.dll"); | ||
53 | |||
54 | |||
55 | for (int i = 0; i < pluginFiles.Length; i++) | ||
56 | { | ||
57 | this.AddPlugin(pluginFiles[i]); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | private void AddPlugin(string FileName) | ||
62 | { | ||
63 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
64 | |||
65 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
66 | { | ||
67 | if (pluginType.IsPublic) | ||
68 | { | ||
69 | if (!pluginType.IsAbstract) | ||
70 | { | ||
71 | Type typeInterface = pluginType.GetInterface("IScriptEngine", true); | ||
72 | |||
73 | if (typeInterface != null) | ||
74 | { | ||
75 | IScriptEngine plug = (IScriptEngine)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
76 | plug.Init(this); | ||
77 | this.scriptEngines.Add(plug.GetName(), plug); | ||
78 | |||
79 | } | ||
80 | |||
81 | typeInterface = null; | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | |||
86 | pluginAssembly = null; | ||
87 | } | ||
88 | |||
89 | public void LoadScript(string scriptType, string scriptName, string script, Entity ent) | ||
90 | { | ||
91 | if(this.scriptEngines.ContainsKey(scriptType)) | ||
92 | { | ||
93 | this.scriptEngines[scriptType].LoadScript(script, scriptName, ent.localid); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | #region IScriptAPI Methods | ||
98 | |||
99 | public OSVector3 GetEntityPosition(uint localID) | ||
100 | { | ||
101 | OSVector3 res = new OSVector3(); | ||
102 | // Console.WriteLine("script- getting entity " + localID + " position"); | ||
103 | foreach (Entity entity in this.Entities.Values) | ||
104 | { | ||
105 | if (entity.localid == localID) | ||
106 | { | ||
107 | res.X = entity.Pos.X; | ||
108 | res.Y = entity.Pos.Y; | ||
109 | res.Z = entity.Pos.Z; | ||
110 | } | ||
111 | } | ||
112 | return res; | ||
113 | } | ||
114 | |||
115 | public void SetEntityPosition(uint localID, float x , float y, float z) | ||
116 | { | ||
117 | foreach (Entity entity in this.Entities.Values) | ||
118 | { | ||
119 | if (entity.localid == localID && entity is Primitive) | ||
120 | { | ||
121 | LLVector3 pos = entity.Pos; | ||
122 | pos.X = x; | ||
123 | pos.Y = y; | ||
124 | Primitive prim = entity as Primitive; | ||
125 | // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. | ||
126 | prim.UpdatePosition(pos); | ||
127 | // Console.WriteLine("script- setting entity " + localID + " positon"); | ||
128 | } | ||
129 | } | ||
130 | |||
131 | } | ||
132 | |||
133 | public uint GetRandomAvatarID() | ||
134 | { | ||
135 | //Console.WriteLine("script- getting random avatar id"); | ||
136 | uint res = 0; | ||
137 | foreach (Entity entity in this.Entities.Values) | ||
138 | { | ||
139 | if (entity is Avatar) | ||
140 | { | ||
141 | res = entity.localid; | ||
142 | } | ||
143 | } | ||
144 | return res; | ||
145 | } | ||
146 | |||
147 | #endregion | ||
148 | |||
149 | |||
150 | } | ||
151 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/World.cs b/OpenSim/OpenSim.RegionServer/Simulator/World.cs deleted file mode 100644 index ac64c79..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/World.cs +++ /dev/null | |||
@@ -1,737 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using libsecondlife; | ||
30 | using libsecondlife.Packets; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Text; | ||
33 | using System.Reflection; | ||
34 | using System.IO; | ||
35 | using System.Threading; | ||
36 | using OpenSim.Physics.Manager; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework.Types; | ||
39 | using OpenSim.Framework.Terrain; | ||
40 | using OpenSim.Framework.Inventory; | ||
41 | using OpenSim.RegionServer.Assets; | ||
42 | |||
43 | using OpenSim.RegionServer.Scripting; | ||
44 | using OpenSim.Terrain; | ||
45 | using OpenSim.Framework.Console; | ||
46 | using OpenSim.RegionServer.Client; | ||
47 | |||
48 | |||
49 | namespace OpenSim.RegionServer.Simulator | ||
50 | { | ||
51 | public partial class World : WorldBase, ILocalStorageReceiver, IScriptAPI | ||
52 | { | ||
53 | public object LockPhysicsEngine = new object(); | ||
54 | public Dictionary<libsecondlife.LLUUID, Avatar> Avatars; | ||
55 | public Dictionary<libsecondlife.LLUUID, Primitive> Prims; | ||
56 | //public ScriptEngine Scripts; | ||
57 | public uint _localNumber = 0; | ||
58 | private PhysicsScene phyScene; | ||
59 | private float timeStep = 0.1f; | ||
60 | public ILocalStorage localStorage; | ||
61 | private Random Rand = new Random(); | ||
62 | private uint _primCount = 702000; | ||
63 | private int storageCount; | ||
64 | private Dictionary<LLUUID, ScriptHandler> m_scriptHandlers; | ||
65 | private Dictionary<string, ScriptFactory> m_scripts; | ||
66 | private Mutex updateLock; | ||
67 | public string m_datastore; | ||
68 | public OpenSim.RegionServer.Simulator.ParcelManager parcelManager; | ||
69 | public OpenSim.RegionServer.Estate.EstateManager estateManager; | ||
70 | |||
71 | #region Properties | ||
72 | public PhysicsScene PhysScene | ||
73 | { | ||
74 | set | ||
75 | { | ||
76 | this.phyScene = value; | ||
77 | } | ||
78 | get | ||
79 | { | ||
80 | return (this.phyScene); | ||
81 | } | ||
82 | } | ||
83 | #endregion | ||
84 | |||
85 | #region Constructors | ||
86 | /// <summary> | ||
87 | /// Creates a new World class, and a region to go with it. | ||
88 | /// </summary> | ||
89 | /// <param name="clientThreads">Dictionary to contain client threads</param> | ||
90 | /// <param name="regionHandle">Region Handle for this region</param> | ||
91 | /// <param name="regionName">Region Name for this region</param> | ||
92 | public World(Dictionary<uint, ClientView> clientThreads, RegionInfo regInfo, ulong regionHandle, string regionName) | ||
93 | { | ||
94 | try | ||
95 | { | ||
96 | updateLock = new Mutex(false); | ||
97 | m_clientThreads = clientThreads; | ||
98 | m_regionHandle = regionHandle; | ||
99 | m_regionName = regionName; | ||
100 | m_regInfo = regInfo; | ||
101 | |||
102 | m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>(); | ||
103 | m_scripts = new Dictionary<string, ScriptFactory>(); | ||
104 | |||
105 | MainConsole.Instance.Notice("World.cs - creating new entitities instance"); | ||
106 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); | ||
107 | Avatars = new Dictionary<LLUUID, Avatar>(); | ||
108 | Prims = new Dictionary<LLUUID, Primitive>(); | ||
109 | |||
110 | MainConsole.Instance.Notice("World.cs - creating LandMap"); | ||
111 | TerrainManager = new TerrainManager(new SecondLife()); | ||
112 | Terrain = new TerrainEngine(); | ||
113 | Avatar.SetupTemplate("avatar-texture.dat"); | ||
114 | // MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); | ||
115 | // Initialise this only after the world has loaded | ||
116 | // Scripts = new ScriptEngine(this); | ||
117 | Avatar.LoadAnims(); | ||
118 | this.SetDefaultScripts(); | ||
119 | this.LoadScriptEngines(); | ||
120 | |||
121 | } | ||
122 | catch (Exception e) | ||
123 | { | ||
124 | OpenSim.Framework.Console.MainConsole.Instance.Error("World.cs: Constructor failed with exception " + e.ToString()); | ||
125 | } | ||
126 | } | ||
127 | #endregion | ||
128 | |||
129 | #region Script Methods | ||
130 | /// <summary> | ||
131 | /// Loads a new script into the specified entity | ||
132 | /// </summary> | ||
133 | /// <param name="entity">Entity to be scripted</param> | ||
134 | /// <param name="script">The script to load</param> | ||
135 | public void AddScript(Entity entity, Script script) | ||
136 | { | ||
137 | try | ||
138 | { | ||
139 | ScriptHandler scriptHandler = new ScriptHandler(script, entity, this); | ||
140 | m_scriptHandlers.Add(scriptHandler.ScriptId, scriptHandler); | ||
141 | } | ||
142 | catch (Exception e) | ||
143 | { | ||
144 | MainConsole.Instance.Warn("World.cs: AddScript() - Failed with exception " + e.ToString()); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | /// <summary> | ||
149 | /// Loads a new script into the specified entity, using a script loaded from a string. | ||
150 | /// </summary> | ||
151 | /// <param name="entity">The entity to be scripted</param> | ||
152 | /// <param name="scriptData">The string containing the script</param> | ||
153 | public void AddScript(Entity entity, string scriptData) | ||
154 | { | ||
155 | try | ||
156 | { | ||
157 | int scriptstart = 0; | ||
158 | int scriptend = 0; | ||
159 | string substring; | ||
160 | scriptstart = scriptData.LastIndexOf("<Script>"); | ||
161 | scriptend = scriptData.LastIndexOf("</Script>"); | ||
162 | substring = scriptData.Substring(scriptstart + 8, scriptend - scriptstart - 8); | ||
163 | substring = substring.Trim(); | ||
164 | //Console.WriteLine("searching for script to add: " + substring); | ||
165 | |||
166 | ScriptFactory scriptFactory; | ||
167 | //Console.WriteLine("script string is " + substring); | ||
168 | if (substring.StartsWith("<ScriptEngine:")) | ||
169 | { | ||
170 | string substring1 = ""; | ||
171 | string script = ""; | ||
172 | // Console.WriteLine("searching for script engine"); | ||
173 | substring1 = substring.Remove(0, 14); | ||
174 | int dev = substring1.IndexOf(','); | ||
175 | string sEngine = substring1.Substring(0, dev); | ||
176 | substring1 = substring1.Remove(0, dev + 1); | ||
177 | int end = substring1.IndexOf('>'); | ||
178 | string sName = substring1.Substring(0, end); | ||
179 | //Console.WriteLine(" script info : " + sEngine + " , " + sName); | ||
180 | int startscript = substring.IndexOf('>'); | ||
181 | script = substring.Remove(0, startscript + 1); | ||
182 | // Console.WriteLine("script data is " + script); | ||
183 | if (this.scriptEngines.ContainsKey(sEngine)) | ||
184 | { | ||
185 | this.scriptEngines[sEngine].LoadScript(script, sName, entity.localid); | ||
186 | } | ||
187 | } | ||
188 | else if (this.m_scripts.TryGetValue(substring, out scriptFactory)) | ||
189 | { | ||
190 | //Console.WriteLine("added script"); | ||
191 | this.AddScript(entity, scriptFactory()); | ||
192 | } | ||
193 | } | ||
194 | catch (Exception e) | ||
195 | { | ||
196 | MainConsole.Instance.Warn("World.cs: AddScript() - Failed with exception " + e.ToString()); | ||
197 | } | ||
198 | } | ||
199 | |||
200 | #endregion | ||
201 | |||
202 | #region Update Methods | ||
203 | /// <summary> | ||
204 | /// Performs per-frame updates on the world, this should be the central world loop | ||
205 | /// </summary> | ||
206 | public override void Update() | ||
207 | { | ||
208 | updateLock.WaitOne(); | ||
209 | try | ||
210 | { | ||
211 | if (this.phyScene.IsThreaded) | ||
212 | { | ||
213 | this.phyScene.GetResults(); | ||
214 | |||
215 | } | ||
216 | |||
217 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
218 | { | ||
219 | Entities[UUID].addForces(); | ||
220 | } | ||
221 | |||
222 | lock (this.LockPhysicsEngine) | ||
223 | { | ||
224 | this.phyScene.Simulate(timeStep); | ||
225 | } | ||
226 | |||
227 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
228 | { | ||
229 | Entities[UUID].update(); | ||
230 | } | ||
231 | |||
232 | foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) | ||
233 | { | ||
234 | scriptHandler.OnFrame(); | ||
235 | } | ||
236 | foreach (IScriptEngine scripteng in this.scriptEngines.Values) | ||
237 | { | ||
238 | scripteng.OnFrame(); | ||
239 | } | ||
240 | //backup world data | ||
241 | this.storageCount++; | ||
242 | if (storageCount > 1200) //set to how often you want to backup | ||
243 | { | ||
244 | this.Backup(); | ||
245 | storageCount = 0; | ||
246 | } | ||
247 | } | ||
248 | catch (Exception e) | ||
249 | { | ||
250 | MainConsole.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); | ||
251 | } | ||
252 | updateLock.ReleaseMutex(); | ||
253 | } | ||
254 | |||
255 | public bool Backup() | ||
256 | { | ||
257 | try | ||
258 | { | ||
259 | // Terrain backup routines | ||
260 | if (Terrain.tainted > 0) | ||
261 | { | ||
262 | Terrain.tainted = 0; | ||
263 | MainConsole.Instance.Notice("World.cs: Backup() - Terrain tainted, saving."); | ||
264 | localStorage.SaveMap(Terrain.getHeights1D()); | ||
265 | MainConsole.Instance.Notice("World.cs: Backup() - Rebuilding world map image."); | ||
266 | Terrain.exportImage("map_" + m_regInfo.RegionName.ToLower() + ".png", "defaultstripe.png"); | ||
267 | MainConsole.Instance.Notice("World.cs: Backup() - Terrain saved, informing Physics."); | ||
268 | phyScene.SetTerrain(Terrain.getHeights1D()); | ||
269 | |||
270 | // Needs optimising to just send patches which have changed. | ||
271 | MainConsole.Instance.Notice("World.cs: Backup() - Terrain changed, informing Clients."); | ||
272 | foreach (ClientView client in m_clientThreads.Values) | ||
273 | { | ||
274 | this.SendLayerData(client); | ||
275 | } | ||
276 | } | ||
277 | |||
278 | // Primitive backup routines -- should only do if there's been a change. | ||
279 | MainConsole.Instance.Notice("World.cs: Backup() - Backing up Primitives"); | ||
280 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
281 | { | ||
282 | Entities[UUID].BackUp(); | ||
283 | } | ||
284 | |||
285 | |||
286 | //Parcel backup routines. Yay! | ||
287 | ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; | ||
288 | int i = 0; | ||
289 | foreach(OpenSim.RegionServer.Simulator.Parcel parcel in parcelManager.parcelList.Values) | ||
290 | { | ||
291 | parcels[i] = parcel.parcelData; | ||
292 | i++; | ||
293 | } | ||
294 | localStorage.SaveParcels(parcels); | ||
295 | |||
296 | |||
297 | // Backup successful | ||
298 | return true; | ||
299 | } | ||
300 | catch (Exception e) | ||
301 | { | ||
302 | // Backup failed | ||
303 | OpenSim.Framework.Console.MainConsole.Instance.Error("World.cs: Backup() - Backup Failed with exception " + e.ToString()); | ||
304 | return false; | ||
305 | } | ||
306 | } | ||
307 | #endregion | ||
308 | |||
309 | #region Setup Methods | ||
310 | /// <summary> | ||
311 | /// Loads a new storage subsystem from a named library | ||
312 | /// </summary> | ||
313 | /// <param name="dllName">Storage Library</param> | ||
314 | /// <returns>Successful or not</returns> | ||
315 | public bool LoadStorageDLL(string dllName) | ||
316 | { | ||
317 | try | ||
318 | { | ||
319 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
320 | ILocalStorage store = null; | ||
321 | |||
322 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
323 | { | ||
324 | if (pluginType.IsPublic) | ||
325 | { | ||
326 | if (!pluginType.IsAbstract) | ||
327 | { | ||
328 | Type typeInterface = pluginType.GetInterface("ILocalStorage", true); | ||
329 | |||
330 | if (typeInterface != null) | ||
331 | { | ||
332 | ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
333 | store = plug; | ||
334 | |||
335 | store.Initialise(this.m_datastore); | ||
336 | break; | ||
337 | } | ||
338 | |||
339 | typeInterface = null; | ||
340 | } | ||
341 | } | ||
342 | } | ||
343 | pluginAssembly = null; | ||
344 | this.localStorage = store; | ||
345 | return (store == null); | ||
346 | } | ||
347 | catch (Exception e) | ||
348 | { | ||
349 | MainConsole.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); | ||
350 | return false; | ||
351 | } | ||
352 | } | ||
353 | |||
354 | public void SetDefaultScripts() | ||
355 | { | ||
356 | this.m_scripts.Add("FollowRandomAvatar", delegate() | ||
357 | { | ||
358 | return new OpenSim.RegionServer.Scripting.FollowRandomAvatar(); | ||
359 | }); | ||
360 | } | ||
361 | |||
362 | #endregion | ||
363 | |||
364 | #region Regenerate Terrain | ||
365 | |||
366 | /// <summary> | ||
367 | /// Rebuilds the terrain using a procedural algorithm | ||
368 | /// </summary> | ||
369 | public void RegenerateTerrain() | ||
370 | { | ||
371 | try | ||
372 | { | ||
373 | Terrain.hills(); | ||
374 | |||
375 | lock (this.LockPhysicsEngine) | ||
376 | { | ||
377 | this.phyScene.SetTerrain(Terrain.getHeights1D()); | ||
378 | } | ||
379 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | ||
380 | |||
381 | foreach (ClientView client in m_clientThreads.Values) | ||
382 | { | ||
383 | this.SendLayerData(client); | ||
384 | } | ||
385 | |||
386 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
387 | { | ||
388 | Entities[UUID].LandRenegerated(); | ||
389 | } | ||
390 | } | ||
391 | catch (Exception e) | ||
392 | { | ||
393 | MainConsole.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); | ||
394 | } | ||
395 | } | ||
396 | |||
397 | /// <summary> | ||
398 | /// Rebuilds the terrain using a 2D float array | ||
399 | /// </summary> | ||
400 | /// <param name="newMap">256,256 float array containing heights</param> | ||
401 | public void RegenerateTerrain(float[,] newMap) | ||
402 | { | ||
403 | try | ||
404 | { | ||
405 | this.Terrain.setHeights2D(newMap); | ||
406 | lock (this.LockPhysicsEngine) | ||
407 | { | ||
408 | this.phyScene.SetTerrain(this.Terrain.getHeights1D()); | ||
409 | } | ||
410 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | ||
411 | |||
412 | foreach (ClientView client in m_clientThreads.Values) | ||
413 | { | ||
414 | this.SendLayerData(client); | ||
415 | } | ||
416 | |||
417 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
418 | { | ||
419 | Entities[UUID].LandRenegerated(); | ||
420 | } | ||
421 | } | ||
422 | catch (Exception e) | ||
423 | { | ||
424 | MainConsole.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); | ||
425 | } | ||
426 | } | ||
427 | |||
428 | /// <summary> | ||
429 | /// Rebuilds the terrain assuming changes occured at a specified point[?] | ||
430 | /// </summary> | ||
431 | /// <param name="changes">???</param> | ||
432 | /// <param name="pointx">???</param> | ||
433 | /// <param name="pointy">???</param> | ||
434 | public void RegenerateTerrain(bool changes, int pointx, int pointy) | ||
435 | { | ||
436 | try | ||
437 | { | ||
438 | if (changes) | ||
439 | { | ||
440 | /* Dont save here, rely on tainting system instead */ | ||
441 | |||
442 | foreach (ClientView client in m_clientThreads.Values) | ||
443 | { | ||
444 | this.SendLayerData(pointx, pointy, client); | ||
445 | } | ||
446 | } | ||
447 | } | ||
448 | catch (Exception e) | ||
449 | { | ||
450 | MainConsole.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); | ||
451 | } | ||
452 | } | ||
453 | |||
454 | #endregion | ||
455 | |||
456 | #region Load Terrain | ||
457 | /// <summary> | ||
458 | /// Loads the World heightmap | ||
459 | /// </summary> | ||
460 | public override void LoadWorldMap() | ||
461 | { | ||
462 | try | ||
463 | { | ||
464 | float[] map = this.localStorage.LoadWorld(); | ||
465 | if (map == null) | ||
466 | { | ||
467 | if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) | ||
468 | { | ||
469 | Console.WriteLine("No default terrain, procedurally generating..."); | ||
470 | this.Terrain.hills(); | ||
471 | |||
472 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | ||
473 | } | ||
474 | else | ||
475 | { | ||
476 | try | ||
477 | { | ||
478 | this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile); | ||
479 | this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier; | ||
480 | } | ||
481 | catch | ||
482 | { | ||
483 | Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); | ||
484 | Terrain.hills(); | ||
485 | } | ||
486 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | ||
487 | } | ||
488 | } | ||
489 | else | ||
490 | { | ||
491 | this.Terrain.setHeights1D(map); | ||
492 | } | ||
493 | } | ||
494 | catch (Exception e) | ||
495 | { | ||
496 | MainConsole.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); | ||
497 | } | ||
498 | } | ||
499 | #endregion | ||
500 | |||
501 | #region Primitives Methods | ||
502 | |||
503 | /// <summary> | ||
504 | /// Sends prims to a client | ||
505 | /// </summary> | ||
506 | /// <param name="RemoteClient">Client to send to</param> | ||
507 | public void GetInitialPrims(ClientView RemoteClient) | ||
508 | { | ||
509 | try | ||
510 | { | ||
511 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
512 | { | ||
513 | if (Entities[UUID] is Primitive) | ||
514 | { | ||
515 | Primitive primitive = Entities[UUID] as Primitive; | ||
516 | primitive.UpdateClient(RemoteClient); | ||
517 | } | ||
518 | } | ||
519 | } | ||
520 | catch (Exception e) | ||
521 | { | ||
522 | MainConsole.Instance.Warn("World.cs: GetInitialPrims() - Failed with exception " + e.ToString()); | ||
523 | } | ||
524 | } | ||
525 | |||
526 | /// <summary> | ||
527 | /// Loads the World's objects | ||
528 | /// </summary> | ||
529 | public void LoadPrimsFromStorage() | ||
530 | { | ||
531 | try | ||
532 | { | ||
533 | MainConsole.Instance.Notice("World.cs: LoadPrimsFromStorage() - Loading primitives"); | ||
534 | this.localStorage.LoadPrimitives(this); | ||
535 | } | ||
536 | catch (Exception e) | ||
537 | { | ||
538 | MainConsole.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); | ||
539 | } | ||
540 | } | ||
541 | |||
542 | /// <summary> | ||
543 | /// Loads a specific object from storage | ||
544 | /// </summary> | ||
545 | /// <param name="prim">The object to load</param> | ||
546 | public void PrimFromStorage(PrimData prim) | ||
547 | { | ||
548 | try | ||
549 | { | ||
550 | if (prim.LocalID >= this._primCount) | ||
551 | { | ||
552 | _primCount = prim.LocalID + 1; | ||
553 | } | ||
554 | MainConsole.Instance.Notice("World.cs: PrimFromStorage() - Reloading prim (localId " + prim.LocalID + " ) from storage"); | ||
555 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
556 | nPrim.CreateFromStorage(prim); | ||
557 | this.Entities.Add(nPrim.uuid, nPrim); | ||
558 | } | ||
559 | catch (Exception e) | ||
560 | { | ||
561 | MainConsole.Instance.Warn("World.cs: PrimFromStorage() - Failed with exception " + e.ToString()); | ||
562 | } | ||
563 | } | ||
564 | |||
565 | public void AddNewPrim(Packet addPacket, ClientView agentClient) | ||
566 | { | ||
567 | AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentID); | ||
568 | } | ||
569 | |||
570 | public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) | ||
571 | { | ||
572 | try | ||
573 | { | ||
574 | MainConsole.Instance.Notice("World.cs: AddNewPrim() - Creating new prim"); | ||
575 | Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
576 | prim.CreateFromPacket(addPacket, ownerID, this._primCount); | ||
577 | PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z); | ||
578 | PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f); | ||
579 | if (OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying) | ||
580 | { | ||
581 | lock (this.LockPhysicsEngine) | ||
582 | { | ||
583 | prim.PhysActor = this.phyScene.AddPrim(pVec, pSize); | ||
584 | } | ||
585 | } | ||
586 | |||
587 | this.Entities.Add(prim.uuid, prim); | ||
588 | this._primCount++; | ||
589 | } | ||
590 | catch (Exception e) | ||
591 | { | ||
592 | MainConsole.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); | ||
593 | } | ||
594 | } | ||
595 | |||
596 | #endregion | ||
597 | |||
598 | #region Add/Remove Avatar Methods | ||
599 | |||
600 | public override Avatar AddViewerAgent(ClientView agentClient) | ||
601 | { | ||
602 | //register for events | ||
603 | agentClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); | ||
604 | agentClient.OnRezObject += new RezObject(this.RezObject); | ||
605 | agentClient.OnModifyTerrain += new ModifyTerrain(this.ModifyTerrain); | ||
606 | agentClient.OnRegionHandShakeReply += new ClientView.GenericCall(this.SendLayerData); | ||
607 | agentClient.OnRequestWearables += new ClientView.GenericCall(this.GetInitialPrims); | ||
608 | agentClient.OnRequestAvatarsData += new ClientView.GenericCall(this.SendAvatarsToClient); | ||
609 | agentClient.OnLinkObjects += new LinkObjects(this.LinkObjects); | ||
610 | agentClient.OnAddPrim += new ClientView.GenericCall4(this.AddNewPrim); | ||
611 | agentClient.OnUpdatePrimShape += new ClientView.UpdateShape(this.UpdatePrimShape); | ||
612 | |||
613 | agentClient.OnObjectSelect += new ClientView.ObjectSelect(this.SelectPrim); | ||
614 | agentClient.OnUpdatePrimFlags += new ClientView.UpdatePrimFlags(this.UpdatePrimFlags); | ||
615 | agentClient.OnUpdatePrimTexture += new ClientView.UpdatePrimTexture(this.UpdatePrimTexture); | ||
616 | agentClient.OnUpdatePrimPosition += new ClientView.UpdatePrimVector(this.UpdatePrimPosition); | ||
617 | agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation); | ||
618 | agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale); | ||
619 | agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); | ||
620 | |||
621 | agentClient.OnParcelPropertiesRequest += new OpenSim.RegionServer.Simulator.ParcelPropertiesRequest(ParcelPropertiesRequest); | ||
622 | agentClient.OnParcelDivideRequest += new OpenSim.RegionServer.Simulator.ParcelDivideRequest(ParcelDivideRequest); | ||
623 | agentClient.OnParcelJoinRequest+=new OpenSim.RegionServer.Simulator.ParcelJoinRequest(ParcelJoinRequest); | ||
624 | agentClient.OnParcelPropertiesUpdateRequest += new OpenSim.RegionServer.Simulator.ParcelPropertiesUpdateRequest(ParcelPropertiesUpdateRequest); | ||
625 | |||
626 | Avatar newAvatar = null; | ||
627 | try | ||
628 | { | ||
629 | MainConsole.Instance.Notice("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); | ||
630 | newAvatar = new Avatar(agentClient, this); | ||
631 | MainConsole.Instance.Notice("World.cs:AddViewerAgent() - Adding new avatar to world"); | ||
632 | MainConsole.Instance.Notice("World.cs:AddViewerAgent() - Starting RegionHandshake "); | ||
633 | estateManager.sendRegionHandshake(newAvatar.ControllingClient); | ||
634 | |||
635 | PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); | ||
636 | lock (this.LockPhysicsEngine) | ||
637 | { | ||
638 | newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); | ||
639 | } | ||
640 | |||
641 | |||
642 | lock (Entities) | ||
643 | { | ||
644 | if (!Entities.ContainsKey(agentClient.AgentID)) | ||
645 | { | ||
646 | this.Entities.Add(agentClient.AgentID, newAvatar); | ||
647 | } | ||
648 | else | ||
649 | { | ||
650 | Entities[agentClient.AgentID] = newAvatar; | ||
651 | } | ||
652 | } | ||
653 | lock (Avatars) | ||
654 | { | ||
655 | if (Avatars.ContainsKey(agentClient.AgentID)) | ||
656 | { | ||
657 | Avatars[agentClient.AgentID] = newAvatar; | ||
658 | } | ||
659 | else | ||
660 | { | ||
661 | this.Avatars.Add(agentClient.AgentID, newAvatar); | ||
662 | } | ||
663 | } | ||
664 | } | ||
665 | catch (Exception e) | ||
666 | { | ||
667 | MainConsole.Instance.Warn("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); | ||
668 | } | ||
669 | return newAvatar; | ||
670 | } | ||
671 | |||
672 | |||
673 | |||
674 | |||
675 | |||
676 | |||
677 | |||
678 | public override void RemoveViewerAgent(ClientView agentClient) | ||
679 | { | ||
680 | try | ||
681 | { | ||
682 | lock (Entities) | ||
683 | { | ||
684 | Entities.Remove(agentClient.AgentID); | ||
685 | } | ||
686 | lock (Avatars) | ||
687 | { | ||
688 | Avatars.Remove(agentClient.AgentID); | ||
689 | } | ||
690 | if (agentClient.ClientAvatar.PhysActor != null) | ||
691 | { | ||
692 | this.phyScene.RemoveAvatar(agentClient.ClientAvatar.PhysActor); | ||
693 | } | ||
694 | } | ||
695 | catch (Exception e) | ||
696 | { | ||
697 | MainConsole.Instance.Warn("World.cs: RemoveViewerAgent() - Failed with exception " + e.ToString()); | ||
698 | } | ||
699 | } | ||
700 | #endregion | ||
701 | |||
702 | #region Request Avatars List Methods | ||
703 | //The idea is to have a group of method that return a list of avatars meeting some requirement | ||
704 | // ie it could be all Avatars within a certain range of the calling prim/avatar. | ||
705 | |||
706 | public List<Avatar> RequestAvatarList() | ||
707 | { | ||
708 | List<Avatar> result = new List<Avatar>(); | ||
709 | |||
710 | foreach (Avatar avatar in Avatars.Values) | ||
711 | { | ||
712 | result.Add(avatar); | ||
713 | } | ||
714 | |||
715 | return result; | ||
716 | } | ||
717 | #endregion | ||
718 | |||
719 | #region ShutDown | ||
720 | /// <summary> | ||
721 | /// Tidy before shutdown | ||
722 | /// </summary> | ||
723 | public override void Close() | ||
724 | { | ||
725 | try | ||
726 | { | ||
727 | this.localStorage.ShutDown(); | ||
728 | } | ||
729 | catch (Exception e) | ||
730 | { | ||
731 | OpenSim.Framework.Console.MainConsole.Instance.Error("World.cs: Close() - Failed with exception " + e.ToString()); | ||
732 | } | ||
733 | } | ||
734 | #endregion | ||
735 | |||
736 | } | ||
737 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Simulator/WorldBase.cs b/OpenSim/OpenSim.RegionServer/Simulator/WorldBase.cs deleted file mode 100644 index c09ddd0..0000000 --- a/OpenSim/OpenSim.RegionServer/Simulator/WorldBase.cs +++ /dev/null | |||
@@ -1,205 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using libsecondlife; | ||
30 | using libsecondlife.Packets; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Text; | ||
33 | using System.Reflection; | ||
34 | using System.IO; | ||
35 | using System.Threading; | ||
36 | using OpenSim.Physics.Manager; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework.Types; | ||
39 | using OpenSim.Framework.Terrain; | ||
40 | using OpenSim.Framework.Inventory; | ||
41 | using OpenSim.RegionServer.Assets; | ||
42 | using OpenSim.RegionServer.Scripting; | ||
43 | using OpenSim.RegionServer.Client; | ||
44 | using OpenSim.Terrain; | ||
45 | using OpenSim.Framework.Console; | ||
46 | |||
47 | namespace OpenSim.RegionServer.Simulator | ||
48 | { | ||
49 | public class WorldBase | ||
50 | { | ||
51 | public Dictionary<libsecondlife.LLUUID, Entity> Entities; | ||
52 | protected Dictionary<uint, ClientView> m_clientThreads; | ||
53 | protected ulong m_regionHandle; | ||
54 | protected string m_regionName; | ||
55 | protected InventoryCache _inventoryCache; | ||
56 | protected AssetCache _assetCache; | ||
57 | public RegionInfo m_regInfo; | ||
58 | |||
59 | public TerrainEngine Terrain; //TODO: Replace TerrainManager with this. | ||
60 | protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine | ||
61 | |||
62 | #region Properties | ||
63 | public InventoryCache InventoryCache | ||
64 | { | ||
65 | set | ||
66 | { | ||
67 | this._inventoryCache = value; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | public AssetCache AssetCache | ||
72 | { | ||
73 | set | ||
74 | { | ||
75 | this._assetCache = value; | ||
76 | } | ||
77 | } | ||
78 | #endregion | ||
79 | |||
80 | #region Constructors | ||
81 | public WorldBase() | ||
82 | { | ||
83 | |||
84 | } | ||
85 | #endregion | ||
86 | |||
87 | #region Setup Methods | ||
88 | /// <summary> | ||
89 | /// Register Packet handler Methods with the packet server (which will register them with the SimClient) | ||
90 | /// </summary> | ||
91 | /// <param name="packetServer"></param> | ||
92 | public virtual void RegisterPacketHandlers(PacketServer packetServer) | ||
93 | { | ||
94 | |||
95 | } | ||
96 | #endregion | ||
97 | |||
98 | #region Update Methods | ||
99 | /// <summary> | ||
100 | /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) | ||
101 | /// </summary> | ||
102 | public virtual void Update() | ||
103 | { | ||
104 | |||
105 | } | ||
106 | #endregion | ||
107 | |||
108 | #region Terrain Methods | ||
109 | |||
110 | /// <summary> | ||
111 | /// Loads the World heightmap | ||
112 | /// </summary> | ||
113 | public virtual void LoadWorldMap() | ||
114 | { | ||
115 | |||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// Send the region heightmap to the client | ||
120 | /// </summary> | ||
121 | /// <param name="RemoteClient">Client to send to</param> | ||
122 | public virtual void SendLayerData(ClientView RemoteClient) | ||
123 | { | ||
124 | try | ||
125 | { | ||
126 | int[] patches = new int[4]; | ||
127 | |||
128 | for (int y = 0; y < 16; y++) | ||
129 | { | ||
130 | for (int x = 0; x < 16; x = x + 4) | ||
131 | { | ||
132 | patches[0] = x + 0 + y * 16; | ||
133 | patches[1] = x + 1 + y * 16; | ||
134 | patches[2] = x + 2 + y * 16; | ||
135 | patches[3] = x + 3 + y * 16; | ||
136 | |||
137 | Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches); | ||
138 | RemoteClient.OutPacket(layerpack); | ||
139 | } | ||
140 | } | ||
141 | } | ||
142 | catch (Exception e) | ||
143 | { | ||
144 | MainConsole.Instance.Warn("World.cs: SendLayerData() - Failed with exception " + e.ToString()); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | /// <summary> | ||
149 | /// Sends a specified patch to a client | ||
150 | /// </summary> | ||
151 | /// <param name="px">Patch coordinate (x) 0..16</param> | ||
152 | /// <param name="py">Patch coordinate (y) 0..16</param> | ||
153 | /// <param name="RemoteClient">The client to send to</param> | ||
154 | public void SendLayerData(int px, int py, ClientView RemoteClient) | ||
155 | { | ||
156 | try | ||
157 | { | ||
158 | int[] patches = new int[1]; | ||
159 | int patchx, patchy; | ||
160 | patchx = px / 16; | ||
161 | patchy = py / 16; | ||
162 | |||
163 | patches[0] = patchx + 0 + patchy * 16; | ||
164 | |||
165 | Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches); | ||
166 | RemoteClient.OutPacket(layerpack); | ||
167 | } | ||
168 | catch (Exception e) | ||
169 | { | ||
170 | MainConsole.Instance.Warn("World.cs: SendLayerData() - Failed with exception " + e.ToString()); | ||
171 | } | ||
172 | } | ||
173 | #endregion | ||
174 | |||
175 | #region Add/Remove Agent/Avatar | ||
176 | /// <summary> | ||
177 | /// Add a new Agent's avatar | ||
178 | /// </summary> | ||
179 | /// <param name="agentClient"></param> | ||
180 | public virtual Avatar AddViewerAgent(ClientView agentClient) | ||
181 | { | ||
182 | return null; | ||
183 | } | ||
184 | |||
185 | /// <summary> | ||
186 | /// Remove a Agent's avatar | ||
187 | /// </summary> | ||
188 | /// <param name="agentClient"></param> | ||
189 | public virtual void RemoveViewerAgent(ClientView agentClient) | ||
190 | { | ||
191 | |||
192 | } | ||
193 | #endregion | ||
194 | |||
195 | #region Shutdown | ||
196 | /// <summary> | ||
197 | /// Tidy before shutdown | ||
198 | /// </summary> | ||
199 | public virtual void Close() | ||
200 | { | ||
201 | |||
202 | } | ||
203 | #endregion | ||
204 | } | ||
205 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Types/Mesh.cs b/OpenSim/OpenSim.RegionServer/Types/Mesh.cs deleted file mode 100644 index 4c8acab..0000000 --- a/OpenSim/OpenSim.RegionServer/Types/Mesh.cs +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.RegionServer.Types | ||
33 | { | ||
34 | // TODO: This will need some performance tuning no doubt. | ||
35 | public class Mesh | ||
36 | { | ||
37 | public List<Triangle> mesh; | ||
38 | |||
39 | public Mesh() | ||
40 | { | ||
41 | mesh = new List<Triangle>(); | ||
42 | } | ||
43 | |||
44 | public void AddTri(Triangle tri) | ||
45 | { | ||
46 | mesh.Add(tri); | ||
47 | } | ||
48 | |||
49 | public static Mesh operator +(Mesh a, Mesh b) | ||
50 | { | ||
51 | a.mesh.AddRange(b.mesh); | ||
52 | return a; | ||
53 | } | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/Types/Triangle.cs b/OpenSim/OpenSim.RegionServer/Types/Triangle.cs deleted file mode 100644 index ffb62e5..0000000 --- a/OpenSim/OpenSim.RegionServer/Types/Triangle.cs +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using Axiom.MathLib; | ||
32 | |||
33 | namespace OpenSim.RegionServer.Types | ||
34 | { | ||
35 | public class Triangle | ||
36 | { | ||
37 | Vector3 a; | ||
38 | Vector3 b; | ||
39 | Vector3 c; | ||
40 | |||
41 | public Triangle() | ||
42 | { | ||
43 | a = new Vector3(); | ||
44 | b = new Vector3(); | ||
45 | c = new Vector3(); | ||
46 | } | ||
47 | |||
48 | public Triangle(Vector3 A, Vector3 B, Vector3 C) | ||
49 | { | ||
50 | a = A; | ||
51 | b = B; | ||
52 | c = C; | ||
53 | } | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs deleted file mode 100644 index ae62607..0000000 --- a/OpenSim/OpenSim.RegionServer/UDPServer.cs +++ /dev/null | |||
@@ -1,265 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Text; | ||
30 | using System.IO; | ||
31 | using System.Threading; | ||
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
34 | using System.Timers; | ||
35 | using System.Reflection; | ||
36 | using System.Collections; | ||
37 | using System.Collections.Generic; | ||
38 | using libsecondlife; | ||
39 | using libsecondlife.Packets; | ||
40 | using OpenSim.Terrain; | ||
41 | |||
42 | using OpenSim.Framework.Interfaces; | ||
43 | using OpenSim.Framework.Types; | ||
44 | using OpenSim.Framework.Console; | ||
45 | |||
46 | using OpenSim.UserServer; | ||
47 | |||
48 | using OpenSim.RegionServer.Simulator; | ||
49 | using OpenSim.RegionServer.Assets; | ||
50 | using OpenSim.RegionServer.CAPS; | ||
51 | using OpenSim.RegionServer.Client; | ||
52 | |||
53 | using Nwc.XmlRpc; | ||
54 | using OpenSim.Servers; | ||
55 | using OpenSim.GenericConfig; | ||
56 | |||
57 | namespace OpenSim.RegionServer | ||
58 | { | ||
59 | public delegate AuthenticateResponse AuthenticateSessionHandler(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
60 | |||
61 | public class UDPServer : OpenSimNetworkHandler | ||
62 | { | ||
63 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); | ||
64 | private Socket Server; | ||
65 | protected IPEndPoint ServerIncoming; | ||
66 | protected byte[] RecvBuffer = new byte[4096]; | ||
67 | protected byte[] ZeroBuffer = new byte[8192]; | ||
68 | protected IPEndPoint ipeSender; | ||
69 | protected EndPoint epSender; | ||
70 | protected AsyncCallback ReceivedData; | ||
71 | protected PacketServer _packetServer; | ||
72 | |||
73 | protected int listenPort; | ||
74 | protected Grid m_gridServers; | ||
75 | protected World m_localWorld; | ||
76 | protected AssetCache m_assetCache; | ||
77 | protected InventoryCache m_inventoryCache; | ||
78 | protected RegionInfo m_regionData; | ||
79 | protected bool m_sandbox = false; | ||
80 | protected bool user_accounts = false; | ||
81 | protected ConsoleBase m_console; | ||
82 | protected AuthenticateSessionsBase m_authenticateSessionsClass; | ||
83 | |||
84 | public AuthenticateSessionHandler AuthenticateHandler; | ||
85 | |||
86 | public PacketServer PacketServer | ||
87 | { | ||
88 | get | ||
89 | { | ||
90 | return _packetServer; | ||
91 | } | ||
92 | set | ||
93 | { | ||
94 | _packetServer = value; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | public World LocalWorld | ||
99 | { | ||
100 | set | ||
101 | { | ||
102 | this.m_localWorld = value; | ||
103 | this._packetServer.LocalWorld = this.m_localWorld; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | public UDPServer() | ||
108 | { | ||
109 | } | ||
110 | |||
111 | public UDPServer(int port, Grid gridServers, AssetCache assetCache, InventoryCache inventoryCache, RegionInfo _regionData, bool sandbox, bool accounts, ConsoleBase console, AuthenticateSessionsBase authenticateClass) | ||
112 | { | ||
113 | listenPort = port; | ||
114 | this.m_gridServers = gridServers; | ||
115 | this.m_assetCache = assetCache; | ||
116 | this.m_inventoryCache = inventoryCache; | ||
117 | this.m_regionData = _regionData; | ||
118 | this.m_sandbox = sandbox; | ||
119 | this.user_accounts = accounts; | ||
120 | this.m_console = console; | ||
121 | this.m_authenticateSessionsClass = authenticateClass; | ||
122 | this.CreatePacketServer(); | ||
123 | |||
124 | //set up delegate for authenticate sessions | ||
125 | this.AuthenticateHandler = new AuthenticateSessionHandler(this.m_authenticateSessionsClass.AuthenticateSession); | ||
126 | } | ||
127 | |||
128 | protected virtual void CreatePacketServer() | ||
129 | { | ||
130 | PacketServer packetServer = new PacketServer(this); | ||
131 | } | ||
132 | |||
133 | protected virtual void OnReceivedData(IAsyncResult result) | ||
134 | { | ||
135 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | ||
136 | epSender = (EndPoint)ipeSender; | ||
137 | Packet packet = null; | ||
138 | |||
139 | int numBytes; | ||
140 | |||
141 | try | ||
142 | { | ||
143 | numBytes = Server.EndReceiveFrom(result, ref epSender); | ||
144 | } | ||
145 | catch (SocketException e) | ||
146 | { | ||
147 | switch( e.SocketErrorCode ) | ||
148 | { | ||
149 | case SocketError.NotConnected: | ||
150 | case SocketError.ConnectionReset: | ||
151 | // At this point, we should clear the client connection altogether. | ||
152 | // The app should hook a disconnect event into the UDPServer. | ||
153 | // But for now, just ignore it. | ||
154 | return; | ||
155 | default: | ||
156 | throw; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | int packetEnd = numBytes - 1; | ||
161 | |||
162 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); | ||
163 | |||
164 | // do we already have a circuit for this endpoint | ||
165 | if (this.clientCircuits.ContainsKey(epSender)) | ||
166 | { | ||
167 | //if so then send packet to the packetserver | ||
168 | this._packetServer.ClientInPacket(this.clientCircuits[epSender], packet); | ||
169 | } | ||
170 | else if (packet.Type == PacketType.UseCircuitCode) | ||
171 | { | ||
172 | // new client | ||
173 | this.AddNewClient(packet); | ||
174 | } | ||
175 | else | ||
176 | { // invalid client | ||
177 | Console.Error.WriteLine("UDPServer.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); | ||
178 | } | ||
179 | |||
180 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
181 | } | ||
182 | |||
183 | protected virtual void AddNewClient(Packet packet) | ||
184 | { | ||
185 | UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; | ||
186 | this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); | ||
187 | bool isChildAgent = false; | ||
188 | |||
189 | ClientView newuser = new ClientView(epSender, useCircuit, m_localWorld, _packetServer.ClientThreads, m_assetCache, m_gridServers.GridServer, this, m_inventoryCache, m_sandbox, isChildAgent, this.m_regionData, m_authenticateSessionsClass); | ||
190 | if ((this.m_gridServers.UserServer != null) && (user_accounts)) | ||
191 | { | ||
192 | newuser.UserServer = this.m_gridServers.UserServer; | ||
193 | } | ||
194 | //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); | ||
195 | this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); | ||
196 | } | ||
197 | |||
198 | public void ServerListener() | ||
199 | { | ||
200 | m_console.Notice("UDPServer.cs:ServerListener() - Opening UDP socket on " + listenPort); | ||
201 | |||
202 | ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); | ||
203 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | ||
204 | |||
205 | /// Add this new socket to the list of sockets that was opened by the application. When the application | ||
206 | /// closes, either gracefully or not, all sockets can be cleaned up. Right now I am not aware of any method | ||
207 | /// to get all of the sockets for a process within .NET, but if so, this process can be refactored, as | ||
208 | /// socket registration would not be neccessary. | ||
209 | SocketRegistry.Register(Server); | ||
210 | |||
211 | Server.Bind(ServerIncoming); | ||
212 | |||
213 | m_console.Notice("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen"); | ||
214 | |||
215 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | ||
216 | epSender = (EndPoint)ipeSender; | ||
217 | ReceivedData = new AsyncCallback(this.OnReceivedData); | ||
218 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
219 | |||
220 | m_console.Notice("UDPServer.cs:ServerListener() - Listening..."); | ||
221 | |||
222 | } | ||
223 | |||
224 | public virtual void RegisterPacketServer(PacketServer server) | ||
225 | { | ||
226 | this._packetServer = server; | ||
227 | } | ||
228 | |||
229 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender) | ||
230 | { | ||
231 | // find the endpoint for this circuit | ||
232 | EndPoint sendto = null; | ||
233 | foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) | ||
234 | { | ||
235 | if (p.Value == circuitcode) | ||
236 | { | ||
237 | sendto = p.Key; | ||
238 | break; | ||
239 | } | ||
240 | } | ||
241 | if (sendto != null) | ||
242 | { | ||
243 | //we found the endpoint so send the packet to it | ||
244 | this.Server.SendTo(buffer, size, flags, sendto); | ||
245 | } | ||
246 | } | ||
247 | |||
248 | public virtual void RemoveClientCircuit(uint circuitcode) | ||
249 | { | ||
250 | foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) | ||
251 | { | ||
252 | if (p.Value == circuitcode) | ||
253 | { | ||
254 | this.clientCircuits.Remove(p.Key); | ||
255 | break; | ||
256 | } | ||
257 | } | ||
258 | } | ||
259 | |||
260 | public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
261 | { | ||
262 | return this.AuthenticateHandler(sessionID, agentID, circuitCode); | ||
263 | } | ||
264 | } | ||
265 | } | ||
diff --git a/OpenSim/OpenSim.RegionServer/VersionInfo.cs b/OpenSim/OpenSim.RegionServer/VersionInfo.cs deleted file mode 100644 index 5e0eed6..0000000 --- a/OpenSim/OpenSim.RegionServer/VersionInfo.cs +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | |||
31 | namespace OpenSim.RegionServer | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// </summary> | ||
35 | public class VersionInfo | ||
36 | { | ||
37 | public static string Version = "0.2, SVN build - please use releng if you desire any form of support"; | ||
38 | } | ||
39 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassInstance.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassInstance.cs deleted file mode 100644 index 1d93197..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassInstance.cs +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Scripting.EmbeddedJVM.Types; | ||
32 | |||
33 | namespace OpenSim.Scripting.EmbeddedJVM | ||
34 | { | ||
35 | public class ClassInstance : Object | ||
36 | { | ||
37 | public int size; | ||
38 | public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); | ||
39 | |||
40 | public ClassInstance() | ||
41 | { | ||
42 | |||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassRecord.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassRecord.cs deleted file mode 100644 index f4ab1a2..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassRecord.cs +++ /dev/null | |||
@@ -1,503 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Scripting.EmbeddedJVM.Types; | ||
33 | |||
34 | namespace OpenSim.Scripting.EmbeddedJVM | ||
35 | { | ||
36 | public class ClassRecord | ||
37 | { | ||
38 | private ushort _majorVersion; | ||
39 | private ushort _minorVersion; | ||
40 | private ushort _constantPoolCount; | ||
41 | private ushort _accessFlags; | ||
42 | private ushort _thisClass; | ||
43 | private ushort _supperClass; | ||
44 | private ushort _interfaceCount; | ||
45 | private ushort _fieldCount; | ||
46 | private ushort _methodCount; | ||
47 | //private ushort _attributeCount; | ||
48 | //private string _name; | ||
49 | public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); | ||
50 | public PoolClass mClass; | ||
51 | |||
52 | public List<PoolItem> _constantsPool = new List<PoolItem>(); | ||
53 | private List<MethodInfo> _methodsList = new List<MethodInfo>(); | ||
54 | private List<FieldInfo> _fieldList = new List<FieldInfo>(); | ||
55 | |||
56 | public ClassRecord() | ||
57 | { | ||
58 | |||
59 | } | ||
60 | |||
61 | public ClassInstance CreateNewInstance() | ||
62 | { | ||
63 | return new ClassInstance(); | ||
64 | } | ||
65 | |||
66 | public void LoadClassFromFile(string fileName) | ||
67 | { | ||
68 | Console.WriteLine("loading script " + fileName); | ||
69 | FileStream fs = File.OpenRead(fileName); | ||
70 | this.LoadClassFromBytes(ReadFully(fs)); | ||
71 | fs.Close(); | ||
72 | } | ||
73 | |||
74 | public void LoadClassFromBytes(byte[] data) | ||
75 | { | ||
76 | int i = 0; | ||
77 | i += 4; | ||
78 | _minorVersion = (ushort)((data[i++] << 8) + data[i++] ); | ||
79 | _majorVersion = (ushort)((data[i++] << 8) + data[i++] ); | ||
80 | _constantPoolCount = (ushort)((data[i++] << 8) + data[i++] ); | ||
81 | // Console.WriteLine("there should be " + _constantPoolCount + " items in the pool"); | ||
82 | for (int count = 0; count < _constantPoolCount -1 ; count++) | ||
83 | { | ||
84 | //read in the constant pool | ||
85 | byte pooltype = data[i++]; | ||
86 | //Console.WriteLine("#" +count +": new constant type = " +pooltype); | ||
87 | //Console.WriteLine("start position is: " + i); | ||
88 | switch (pooltype) | ||
89 | { | ||
90 | case 1: //Utf8 | ||
91 | ushort uLength = (ushort)((data[i++] << 8) + data[i++] ); | ||
92 | |||
93 | // Console.WriteLine("new utf8 type, length is " + uLength); | ||
94 | PoolUtf8 utf8 = new PoolUtf8(); | ||
95 | utf8.readValue(data, ref i, uLength); | ||
96 | this._constantsPool.Add(utf8); | ||
97 | break; | ||
98 | case 3: //Int | ||
99 | break; | ||
100 | case 7: //Class | ||
101 | PoolClass pClass = new PoolClass(this); | ||
102 | pClass.readValue(data, ref i); | ||
103 | this._constantsPool.Add(pClass); | ||
104 | break; | ||
105 | case 10: //Method | ||
106 | PoolMethodRef pMeth = new PoolMethodRef(this); | ||
107 | pMeth.readValue(data, ref i); | ||
108 | this._constantsPool.Add(pMeth); | ||
109 | break; | ||
110 | case 12: //NamedType | ||
111 | PoolNamedType pNamed = new PoolNamedType(this); | ||
112 | pNamed.readValue(data, ref i); | ||
113 | this._constantsPool.Add(pNamed); | ||
114 | break; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | _accessFlags = (ushort)((data[i++] << 8) + data[i++] ); | ||
119 | _thisClass = (ushort)((data[i++] << 8) + data[i++] ); | ||
120 | _supperClass = (ushort)((data[i++] << 8) + data[i++] ); | ||
121 | |||
122 | if (this._constantsPool[this._thisClass - 1] is PoolClass) | ||
123 | { | ||
124 | this.mClass = ((PoolClass)this._constantsPool[this._thisClass - 1]); | ||
125 | } | ||
126 | |||
127 | _interfaceCount = (ushort)((data[i++] << 8) + data[i++]); | ||
128 | //should now read in the info for each interface | ||
129 | _fieldCount = (ushort)((data[i++] << 8) + data[i++]); | ||
130 | //should now read in the info for each field | ||
131 | _methodCount = (ushort)((data[i++] << 8) + data[i++]); | ||
132 | for (int count = 0; count < _methodCount; count++) | ||
133 | { | ||
134 | MethodInfo methInf = new MethodInfo(this); | ||
135 | methInf.ReadData(data, ref i); | ||
136 | this._methodsList.Add(methInf); | ||
137 | } | ||
138 | } | ||
139 | |||
140 | public void AddMethodsToMemory(MethodMemory memory) | ||
141 | { | ||
142 | for (int count = 0; count < _methodCount; count++) | ||
143 | { | ||
144 | this._methodsList[count].AddMethodCode(memory); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | public bool StartMethod(Thread thread, string methodName) | ||
149 | { | ||
150 | for (int count = 0; count < _methodCount; count++) | ||
151 | { | ||
152 | if (this._constantsPool[this._methodsList[count].NameIndex-1] is PoolUtf8) | ||
153 | { | ||
154 | if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex-1]).Value == methodName) | ||
155 | { | ||
156 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); | ||
157 | thread.SetPC(this._methodsList[count].CodePointer); | ||
158 | return true; | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | return false; | ||
163 | } | ||
164 | |||
165 | public void PrintToConsole() | ||
166 | { | ||
167 | Console.WriteLine("Class File:"); | ||
168 | Console.WriteLine("Major version: " + _majorVersion); | ||
169 | Console.WriteLine("Minor version: " + _minorVersion); | ||
170 | Console.WriteLine("Pool size: " + _constantPoolCount); | ||
171 | |||
172 | for (int i = 0; i < _constantsPool.Count; i++) | ||
173 | { | ||
174 | this._constantsPool[i].Print(); | ||
175 | } | ||
176 | |||
177 | Console.WriteLine("Access flags: " + _accessFlags); | ||
178 | Console.WriteLine("This class: " + _thisClass ); | ||
179 | Console.WriteLine("Super class: " + _supperClass); | ||
180 | |||
181 | for (int count = 0; count < _methodCount; count++) | ||
182 | { | ||
183 | Console.WriteLine(); | ||
184 | this._methodsList[count].Print(); | ||
185 | } | ||
186 | |||
187 | Console.WriteLine("class name is " + this.mClass.Name.Value); | ||
188 | } | ||
189 | |||
190 | public static byte[] ReadFully(Stream stream) | ||
191 | { | ||
192 | byte[] buffer = new byte[1024]; | ||
193 | using (MemoryStream ms = new MemoryStream()) | ||
194 | { | ||
195 | while (true) | ||
196 | { | ||
197 | int read = stream.Read(buffer, 0, buffer.Length); | ||
198 | if (read <= 0) | ||
199 | return ms.ToArray(); | ||
200 | ms.Write(buffer, 0, read); | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | |||
205 | #region nested classes | ||
206 | public class PoolItem | ||
207 | { | ||
208 | public virtual void Print() | ||
209 | { | ||
210 | |||
211 | } | ||
212 | } | ||
213 | |||
214 | public class PoolUtf8 : PoolItem | ||
215 | { | ||
216 | public string Value = ""; | ||
217 | |||
218 | public void readValue(byte[] data,ref int pointer , int length) | ||
219 | { | ||
220 | for (int i = 0; i < length; i++) | ||
221 | { | ||
222 | int a =(int) data[pointer++]; | ||
223 | if ((a & 0x80) == 0) | ||
224 | { | ||
225 | Value = Value + (char)a; | ||
226 | } | ||
227 | else if ((a & 0x20) == 0) | ||
228 | { | ||
229 | int b = (int) data[pointer++]; | ||
230 | Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | int b = (int)data[pointer++]; | ||
235 | int c = (int)data[pointer++]; | ||
236 | Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | |||
241 | public override void Print() | ||
242 | { | ||
243 | Console.WriteLine("Utf8 type: " + Value); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | private class PoolInt : PoolItem | ||
248 | { | ||
249 | |||
250 | } | ||
251 | |||
252 | public class PoolClass : PoolItem | ||
253 | { | ||
254 | //public string name = ""; | ||
255 | public ushort namePointer = 0; | ||
256 | private ClassRecord parent; | ||
257 | public PoolUtf8 Name; | ||
258 | |||
259 | public PoolClass(ClassRecord paren) | ||
260 | { | ||
261 | parent = paren; | ||
262 | } | ||
263 | |||
264 | public void readValue(byte[] data, ref int pointer) | ||
265 | { | ||
266 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); | ||
267 | } | ||
268 | |||
269 | public override void Print() | ||
270 | { | ||
271 | this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]); | ||
272 | Console.Write("Class type: " + namePointer); | ||
273 | Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value); | ||
274 | |||
275 | } | ||
276 | } | ||
277 | |||
278 | public class PoolMethodRef : PoolItem | ||
279 | { | ||
280 | public ushort classPointer = 0; | ||
281 | public ushort nameTypePointer = 0; | ||
282 | public PoolNamedType mNameType; | ||
283 | public PoolClass mClass; | ||
284 | private ClassRecord parent; | ||
285 | |||
286 | public PoolMethodRef(ClassRecord paren) | ||
287 | { | ||
288 | parent = paren; | ||
289 | } | ||
290 | |||
291 | public void readValue(byte[] data, ref int pointer) | ||
292 | { | ||
293 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
294 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
295 | } | ||
296 | |||
297 | public override void Print() | ||
298 | { | ||
299 | this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]); | ||
300 | this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]); | ||
301 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); | ||
302 | } | ||
303 | } | ||
304 | |||
305 | public class PoolNamedType : PoolItem | ||
306 | { | ||
307 | public ushort namePointer = 0; | ||
308 | public ushort typePointer = 0; | ||
309 | private ClassRecord parent; | ||
310 | public PoolUtf8 Name; | ||
311 | public PoolUtf8 Type; | ||
312 | |||
313 | public PoolNamedType(ClassRecord paren) | ||
314 | { | ||
315 | parent = paren; | ||
316 | } | ||
317 | |||
318 | public void readValue(byte[] data, ref int pointer) | ||
319 | { | ||
320 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); | ||
321 | typePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); | ||
322 | } | ||
323 | |||
324 | public override void Print() | ||
325 | { | ||
326 | Name = ((PoolUtf8)this.parent._constantsPool[namePointer-1]); | ||
327 | Type = ((PoolUtf8)this.parent._constantsPool[typePointer-1]); | ||
328 | Console.Write("Named type: " + namePointer + " , " + typePointer ); | ||
329 | Console.WriteLine(" // "+ ((PoolUtf8)this.parent._constantsPool[namePointer-1]).Value); | ||
330 | } | ||
331 | } | ||
332 | |||
333 | //*********************** | ||
334 | public class MethodInfo | ||
335 | { | ||
336 | public ushort AccessFlags = 0; | ||
337 | public ushort NameIndex = 0; | ||
338 | public string Name = ""; | ||
339 | public ushort DescriptorIndex = 0; | ||
340 | public ushort AttributeCount = 0; | ||
341 | public List<MethodAttribute> Attributes = new List<MethodAttribute>(); | ||
342 | private ClassRecord parent; | ||
343 | public int CodePointer = 0; | ||
344 | |||
345 | public MethodInfo(ClassRecord paren) | ||
346 | { | ||
347 | parent = paren; | ||
348 | } | ||
349 | |||
350 | public void AddMethodCode(MethodMemory memory) | ||
351 | { | ||
352 | Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); | ||
353 | memory.Methodcount++; | ||
354 | this.CodePointer = memory.NextMethodPC; | ||
355 | memory.NextMethodPC += this.Attributes[0].Code.Length; | ||
356 | } | ||
357 | |||
358 | public void ReadData(byte[] data, ref int pointer) | ||
359 | { | ||
360 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
361 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
362 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
363 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
364 | for(int i =0; i< AttributeCount; i++) | ||
365 | { | ||
366 | MethodAttribute attri = new MethodAttribute(this.parent); | ||
367 | attri.ReadData(data, ref pointer); | ||
368 | this.Attributes.Add(attri); | ||
369 | } | ||
370 | } | ||
371 | |||
372 | public void Print() | ||
373 | { | ||
374 | Console.WriteLine("Method Info Struct: "); | ||
375 | Console.WriteLine("AccessFlags: " + AccessFlags); | ||
376 | Console.WriteLine("NameIndex: " + NameIndex +" // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); | ||
377 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[DescriptorIndex-1]).Value); | ||
378 | Console.WriteLine("Attribute Count:" + AttributeCount); | ||
379 | for (int i = 0; i < AttributeCount; i++) | ||
380 | { | ||
381 | this.Attributes[i].Print(); | ||
382 | } | ||
383 | } | ||
384 | |||
385 | public class MethodAttribute | ||
386 | { | ||
387 | public ushort NameIndex = 0; | ||
388 | public string Name = ""; | ||
389 | public Int32 Length = 0; | ||
390 | //for now only support code attribute | ||
391 | public ushort MaxStack = 0; | ||
392 | public ushort MaxLocals = 0; | ||
393 | public Int32 CodeLength = 0; | ||
394 | public byte[] Code; | ||
395 | public ushort ExceptionTableLength = 0; | ||
396 | public ushort SubAttributeCount = 0; | ||
397 | public List<SubAttribute> SubAttributes = new List<SubAttribute>(); | ||
398 | private ClassRecord parent; | ||
399 | |||
400 | public MethodAttribute(ClassRecord paren) | ||
401 | { | ||
402 | parent = paren; | ||
403 | } | ||
404 | |||
405 | public void ReadData(byte[] data, ref int pointer) | ||
406 | { | ||
407 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
408 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
409 | MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
410 | MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
411 | CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
412 | Code = new byte[CodeLength]; | ||
413 | for (int i = 0; i < CodeLength; i++) | ||
414 | { | ||
415 | Code[i] = data[pointer++]; | ||
416 | } | ||
417 | ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
418 | SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
419 | for (int i = 0; i < SubAttributeCount; i++) | ||
420 | { | ||
421 | SubAttribute subAttri = new SubAttribute(this.parent); | ||
422 | subAttri.ReadData(data, ref pointer); | ||
423 | this.SubAttributes.Add(subAttri); | ||
424 | } | ||
425 | } | ||
426 | |||
427 | public void Print() | ||
428 | { | ||
429 | Console.WriteLine("Method Attribute: "); | ||
430 | Console.WriteLine("Name Index: " + NameIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); | ||
431 | Console.WriteLine("Length: " + Length); | ||
432 | Console.WriteLine("MaxStack: " + MaxStack); | ||
433 | Console.WriteLine("MaxLocals: " + MaxLocals); | ||
434 | Console.WriteLine("CodeLength: " + CodeLength); | ||
435 | for (int i = 0; i < Code.Length; i++) | ||
436 | { | ||
437 | Console.WriteLine("OpCode #" + i + " is: " + Code[i]); | ||
438 | } | ||
439 | Console.WriteLine("SubAttributes: " + SubAttributeCount); | ||
440 | for (int i = 0; i < SubAttributeCount; i++) | ||
441 | { | ||
442 | this.SubAttributes[i].Print(); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | public class SubAttribute | ||
447 | { | ||
448 | public ushort NameIndex = 0; | ||
449 | public string Name = ""; | ||
450 | public Int32 Length = 0; | ||
451 | public byte[] Data; | ||
452 | private ClassRecord parent; | ||
453 | |||
454 | public SubAttribute(ClassRecord paren) | ||
455 | { | ||
456 | parent = paren; | ||
457 | } | ||
458 | |||
459 | public void ReadData(byte[] data, ref int pointer) | ||
460 | { | ||
461 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
462 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
463 | Data = new byte[Length]; | ||
464 | for (int i = 0; i < Length; i++) | ||
465 | { | ||
466 | Data[i] = data[pointer++]; | ||
467 | } | ||
468 | } | ||
469 | |||
470 | public void Print() | ||
471 | { | ||
472 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); | ||
473 | } | ||
474 | |||
475 | } | ||
476 | } | ||
477 | |||
478 | } | ||
479 | private class InterfaceInfo | ||
480 | { | ||
481 | public void ReadData(byte[] data, ref int i) | ||
482 | { | ||
483 | |||
484 | } | ||
485 | } | ||
486 | private class FieldInfo | ||
487 | { | ||
488 | public void ReadData(byte[] data, ref int i) | ||
489 | { | ||
490 | |||
491 | } | ||
492 | } | ||
493 | private class AttributeInfo | ||
494 | { | ||
495 | public void ReadData(byte[] data, ref int i) | ||
496 | { | ||
497 | |||
498 | } | ||
499 | } | ||
500 | #endregion | ||
501 | |||
502 | } | ||
503 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Heap.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Heap.cs deleted file mode 100644 index f213c36..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Heap.cs +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class Heap | ||
35 | { | ||
36 | public List<ClassInstance> ClassObjects = new List<ClassInstance>(); | ||
37 | |||
38 | public Heap() | ||
39 | { | ||
40 | |||
41 | } | ||
42 | } | ||
43 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs deleted file mode 100644 index c5995b2..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Scripting.EmbeddedJVM.Types; | ||
32 | using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | ||
33 | |||
34 | namespace OpenSim.Scripting.EmbeddedJVM | ||
35 | { | ||
36 | partial class Thread | ||
37 | { | ||
38 | private partial class Interpreter | ||
39 | { | ||
40 | private Thread _mThread; | ||
41 | |||
42 | public Interpreter(Thread parentThread) | ||
43 | { | ||
44 | _mThread = parentThread; | ||
45 | } | ||
46 | |||
47 | public bool Excute() | ||
48 | { | ||
49 | bool run = true; | ||
50 | byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++]; | ||
51 | // Console.WriteLine("opCode is: " + currentOpCode); | ||
52 | bool handled = false; | ||
53 | |||
54 | handled = this.IsLogicOpCode(currentOpCode); | ||
55 | if (!handled) | ||
56 | { | ||
57 | handled = this.IsMethodOpCode(currentOpCode); | ||
58 | } | ||
59 | if (!handled) | ||
60 | { | ||
61 | if (currentOpCode == 172) | ||
62 | { | ||
63 | if (this._mThread.stack.StackFrames.Count > 1) | ||
64 | { | ||
65 | Console.WriteLine("returning int from function"); | ||
66 | int retPC1 = this._mThread.currentFrame.ReturnPC; | ||
67 | BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); | ||
68 | this._mThread.stack.StackFrames.Pop(); | ||
69 | this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); | ||
70 | this._mThread.PC = retPC1; | ||
71 | if (bas1 is Int) | ||
72 | { | ||
73 | this._mThread.currentFrame.OpStack.Push((Int)bas1); | ||
74 | } | ||
75 | } | ||
76 | else | ||
77 | { | ||
78 | // Console.WriteLine("No parent function so ending program"); | ||
79 | this._mThread.stack.StackFrames.Pop(); | ||
80 | run = false; | ||
81 | } | ||
82 | handled = true; | ||
83 | } | ||
84 | if (currentOpCode == 174) | ||
85 | { | ||
86 | if (this._mThread.stack.StackFrames.Count > 1) | ||
87 | { | ||
88 | Console.WriteLine("returning float from function"); | ||
89 | int retPC1 = this._mThread.currentFrame.ReturnPC; | ||
90 | BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); | ||
91 | this._mThread.stack.StackFrames.Pop(); | ||
92 | this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); | ||
93 | this._mThread.PC = retPC1; | ||
94 | if (bas1 is Float) | ||
95 | { | ||
96 | this._mThread.currentFrame.OpStack.Push((Float)bas1); | ||
97 | } | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | // Console.WriteLine("No parent function so ending program"); | ||
102 | this._mThread.stack.StackFrames.Pop(); | ||
103 | run = false; | ||
104 | } | ||
105 | handled = true; | ||
106 | } | ||
107 | if (currentOpCode == 177) | ||
108 | { | ||
109 | if (this._mThread.stack.StackFrames.Count > 1) | ||
110 | { | ||
111 | Console.WriteLine("returning from function"); | ||
112 | int retPC = this._mThread.currentFrame.ReturnPC; | ||
113 | this._mThread.stack.StackFrames.Pop(); | ||
114 | this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); | ||
115 | this._mThread.PC = retPC; | ||
116 | } | ||
117 | else | ||
118 | { | ||
119 | // Console.WriteLine("No parent function so ending program"); | ||
120 | this._mThread.stack.StackFrames.Pop(); | ||
121 | run = false; | ||
122 | } | ||
123 | handled = true; | ||
124 | } | ||
125 | } | ||
126 | if (!handled) | ||
127 | { | ||
128 | Console.WriteLine("opcode " + currentOpCode + " not been handled "); | ||
129 | } | ||
130 | return run; | ||
131 | |||
132 | } | ||
133 | } | ||
134 | } | ||
135 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterLogic.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterLogic.cs deleted file mode 100644 index 2a11afd..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterLogic.cs +++ /dev/null | |||
@@ -1,427 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Scripting.EmbeddedJVM.Types; | ||
32 | using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | ||
33 | |||
34 | namespace OpenSim.Scripting.EmbeddedJVM | ||
35 | { | ||
36 | partial class Thread | ||
37 | { | ||
38 | private partial class Interpreter | ||
39 | { | ||
40 | private bool IsLogicOpCode(byte opcode) | ||
41 | { | ||
42 | bool result = false; | ||
43 | switch (opcode) | ||
44 | { | ||
45 | case 2: | ||
46 | Int m_int= new Int(); | ||
47 | m_int.mValue = -1; | ||
48 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
49 | result = true; | ||
50 | break; | ||
51 | case 3: | ||
52 | m_int= new Int(); | ||
53 | m_int.mValue = 0; | ||
54 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
55 | result = true; | ||
56 | break; | ||
57 | case 4: | ||
58 | m_int = new Int(); | ||
59 | m_int.mValue = 1; | ||
60 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
61 | result = true; | ||
62 | break; | ||
63 | case 5: | ||
64 | m_int = new Int(); | ||
65 | m_int.mValue = 2; | ||
66 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
67 | result = true; | ||
68 | break; | ||
69 | case 6: | ||
70 | m_int = new Int(); | ||
71 | m_int.mValue = 3; | ||
72 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
73 | break; | ||
74 | case 7: | ||
75 | m_int = new Int(); | ||
76 | m_int.mValue = 4; | ||
77 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
78 | result = true; | ||
79 | break; | ||
80 | case 8: | ||
81 | m_int = new Int(); | ||
82 | m_int.mValue = 5; | ||
83 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
84 | result = true; | ||
85 | break; | ||
86 | case 11: | ||
87 | Float m_float = new Float(); | ||
88 | m_float.mValue = 0.0f; | ||
89 | this._mThread.currentFrame.OpStack.Push(m_float); | ||
90 | result = true; | ||
91 | break; | ||
92 | case 12: | ||
93 | m_float = new Float(); | ||
94 | m_float.mValue = 1.0f; | ||
95 | this._mThread.currentFrame.OpStack.Push(m_float); | ||
96 | result = true; | ||
97 | break; | ||
98 | case 13: | ||
99 | m_float = new Float(); | ||
100 | m_float.mValue = 2.0f; | ||
101 | this._mThread.currentFrame.OpStack.Push(m_float); | ||
102 | result = true; | ||
103 | break; | ||
104 | case 16: | ||
105 | int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]; | ||
106 | Int pushInt = new Int(); | ||
107 | pushInt.mValue = pushvalue; | ||
108 | this._mThread.currentFrame.OpStack.Push(pushInt); | ||
109 | this._mThread.PC++; | ||
110 | result = true; | ||
111 | break; | ||
112 | case 17: | ||
113 | short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
114 | Int pushInt2 = new Int(); | ||
115 | pushInt2.mValue = pushvalue2; | ||
116 | this._mThread.currentFrame.OpStack.Push(pushInt2); | ||
117 | this._mThread.PC += 2; | ||
118 | result = true; | ||
119 | break; | ||
120 | case 23: | ||
121 | short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); | ||
122 | Float fload = new Float(); | ||
123 | if (this._mThread.currentFrame.LocalVariables[findex1] != null) | ||
124 | { | ||
125 | if (this._mThread.currentFrame.LocalVariables[findex1] is Float) | ||
126 | { | ||
127 | fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue; | ||
128 | this._mThread.currentFrame.OpStack.Push(fload); | ||
129 | } | ||
130 | } | ||
131 | this._mThread.PC++; | ||
132 | result = true; | ||
133 | break; | ||
134 | case 26: | ||
135 | if (this._mThread.currentFrame.LocalVariables[0] != null) | ||
136 | { | ||
137 | if (this._mThread.currentFrame.LocalVariables[0] is Int) | ||
138 | { | ||
139 | Int newInt = new Int(); | ||
140 | newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue; | ||
141 | this._mThread.currentFrame.OpStack.Push(newInt); | ||
142 | } | ||
143 | } | ||
144 | result = true; | ||
145 | break; | ||
146 | case 27: | ||
147 | if (this._mThread.currentFrame.LocalVariables[1] != null) | ||
148 | { | ||
149 | if (this._mThread.currentFrame.LocalVariables[1] is Int) | ||
150 | { | ||
151 | Int newInt = new Int(); | ||
152 | newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue; | ||
153 | this._mThread.currentFrame.OpStack.Push(newInt); | ||
154 | } | ||
155 | } | ||
156 | result = true; | ||
157 | break; | ||
158 | case 34: | ||
159 | if (this._mThread.currentFrame.LocalVariables[0] != null) | ||
160 | { | ||
161 | if (this._mThread.currentFrame.LocalVariables[0] is Float) | ||
162 | { | ||
163 | Float newfloat = new Float(); | ||
164 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue; | ||
165 | this._mThread.currentFrame.OpStack.Push(newfloat); | ||
166 | } | ||
167 | } | ||
168 | result = true; | ||
169 | break; | ||
170 | case 35: | ||
171 | if (this._mThread.currentFrame.LocalVariables[1] != null) | ||
172 | { | ||
173 | if (this._mThread.currentFrame.LocalVariables[1] is Float) | ||
174 | { | ||
175 | Float newfloat = new Float(); | ||
176 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue; | ||
177 | this._mThread.currentFrame.OpStack.Push(newfloat); | ||
178 | } | ||
179 | } | ||
180 | result = true; | ||
181 | break; | ||
182 | case 36: | ||
183 | if (this._mThread.currentFrame.LocalVariables[2] != null) | ||
184 | { | ||
185 | if (this._mThread.currentFrame.LocalVariables[2] is Float) | ||
186 | { | ||
187 | Float newfloat = new Float(); | ||
188 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue; | ||
189 | this._mThread.currentFrame.OpStack.Push(newfloat); | ||
190 | } | ||
191 | } | ||
192 | result = true; | ||
193 | break; | ||
194 | case 37: | ||
195 | if (this._mThread.currentFrame.LocalVariables[3] != null) | ||
196 | { | ||
197 | if (this._mThread.currentFrame.LocalVariables[3] is Float) | ||
198 | { | ||
199 | Float newfloat = new Float(); | ||
200 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue; | ||
201 | this._mThread.currentFrame.OpStack.Push(newfloat); | ||
202 | } | ||
203 | } | ||
204 | result = true; | ||
205 | break; | ||
206 | case 56: | ||
207 | short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] )); | ||
208 | BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); | ||
209 | if (fstor is Float) | ||
210 | { | ||
211 | this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor; | ||
212 | } | ||
213 | this._mThread.PC++; | ||
214 | result = true; | ||
215 | break; | ||
216 | case 59: | ||
217 | BaseType baset = this._mThread.currentFrame.OpStack.Pop(); | ||
218 | if (baset is Int) | ||
219 | { | ||
220 | this._mThread.currentFrame.LocalVariables[0] = (Int)baset; | ||
221 | } | ||
222 | result = true; | ||
223 | break; | ||
224 | case 60: | ||
225 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
226 | if (baset is Int) | ||
227 | { | ||
228 | this._mThread.currentFrame.LocalVariables[1] = (Int)baset; | ||
229 | } | ||
230 | result = true; | ||
231 | break; | ||
232 | case 67: | ||
233 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
234 | if (baset is Float) | ||
235 | { | ||
236 | this._mThread.currentFrame.LocalVariables[0] = (Float)baset; | ||
237 | } | ||
238 | result = true; | ||
239 | break; | ||
240 | case 68: | ||
241 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
242 | if (baset is Float) | ||
243 | { | ||
244 | this._mThread.currentFrame.LocalVariables[1] = (Float)baset; | ||
245 | } | ||
246 | result = true; | ||
247 | break; | ||
248 | case 69: | ||
249 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
250 | if (baset is Float) | ||
251 | { | ||
252 | this._mThread.currentFrame.LocalVariables[2] = (Float)baset; | ||
253 | } | ||
254 | result = true; | ||
255 | break; | ||
256 | case 70: | ||
257 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
258 | if (baset is Float) | ||
259 | { | ||
260 | this._mThread.currentFrame.LocalVariables[3] = (Float)baset; | ||
261 | } | ||
262 | result = true; | ||
263 | break; | ||
264 | case 87: | ||
265 | this._mThread.currentFrame.OpStack.Pop(); | ||
266 | result = true; | ||
267 | break; | ||
268 | case 98: | ||
269 | BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); | ||
270 | BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); | ||
271 | if (bf1 is Float && bf2 is Float) | ||
272 | { | ||
273 | Float nflt = new Float(); | ||
274 | nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; | ||
275 | this._mThread.currentFrame.OpStack.Push(nflt); | ||
276 | } | ||
277 | result = true; | ||
278 | break; | ||
279 | case 102: | ||
280 | BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); | ||
281 | BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); | ||
282 | if (bsf1 is Float && bsf2 is Float) | ||
283 | { | ||
284 | Float resf = new Float(); | ||
285 | resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; | ||
286 | this._mThread.currentFrame.OpStack.Push(resf); | ||
287 | } | ||
288 | result = true; | ||
289 | break; | ||
290 | case 104: //check the order of the two values off the stack is correct | ||
291 | BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); | ||
292 | BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); | ||
293 | if (bs1 is Int && bs2 is Int) | ||
294 | { | ||
295 | Int nInt = new Int(); | ||
296 | nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; | ||
297 | this._mThread.currentFrame.OpStack.Push(nInt); | ||
298 | } | ||
299 | result = true; | ||
300 | break; | ||
301 | case 132: | ||
302 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) | ||
303 | { | ||
304 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) | ||
305 | { | ||
306 | ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; | ||
307 | } | ||
308 | } | ||
309 | this._mThread.PC += 2; | ||
310 | result = true; | ||
311 | break; | ||
312 | case 139: | ||
313 | BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); | ||
314 | if (conv1 is Float) | ||
315 | { | ||
316 | Int newconv = new Int(); | ||
317 | newconv.mValue = (int)((Float)conv1).mValue; | ||
318 | this._mThread.currentFrame.OpStack.Push(newconv); | ||
319 | } | ||
320 | result = true; | ||
321 | break; | ||
322 | case 149: | ||
323 | BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); | ||
324 | BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); | ||
325 | if (flcom1 is Float && flcom2 is Float) | ||
326 | { | ||
327 | Int compres = new Int(); | ||
328 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) | ||
329 | { | ||
330 | compres.mValue = -1; | ||
331 | } | ||
332 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) | ||
333 | { | ||
334 | compres.mValue = 1; | ||
335 | } | ||
336 | else | ||
337 | { | ||
338 | compres.mValue = 0; | ||
339 | } | ||
340 | this._mThread.currentFrame.OpStack.Push(compres); | ||
341 | } | ||
342 | result = true; | ||
343 | break; | ||
344 | case 158: | ||
345 | short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
346 | BaseType comp1 = this._mThread.currentFrame.OpStack.Pop(); | ||
347 | if (comp1 is Int) | ||
348 | { | ||
349 | if (((Int)comp1).mValue <= 0) | ||
350 | { | ||
351 | this._mThread.PC += -1 + compareoffset1; | ||
352 | } | ||
353 | else | ||
354 | { | ||
355 | this._mThread.PC += 2; | ||
356 | } | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | this._mThread.PC += 2; | ||
361 | } | ||
362 | result = true; | ||
363 | break; | ||
364 | case 162: | ||
365 | short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
366 | BaseType bc2 = this._mThread.currentFrame.OpStack.Pop(); | ||
367 | BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); | ||
368 | if (bc1 is Int && bc2 is Int) | ||
369 | { | ||
370 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); | ||
371 | if (((Int)bc1).mValue >= ((Int)bc2).mValue) | ||
372 | { | ||
373 | // Console.WriteLine("branch compare true , offset is " +compareoffset); | ||
374 | // Console.WriteLine("current PC is " + this._mThread.PC); | ||
375 | this._mThread.PC += -1 + compareoffset; | ||
376 | //Console.WriteLine("new PC is " + this._mThread.PC); | ||
377 | } | ||
378 | else | ||
379 | { | ||
380 | //Console.WriteLine("branch compare false"); | ||
381 | this._mThread.PC += 2; | ||
382 | } | ||
383 | } | ||
384 | else | ||
385 | { | ||
386 | this._mThread.PC += 2; | ||
387 | } | ||
388 | result = true; | ||
389 | break; | ||
390 | case 164: | ||
391 | short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
392 | BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop(); | ||
393 | BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); | ||
394 | if (bcl1 is Int && bcl2 is Int) | ||
395 | { | ||
396 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); | ||
397 | if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) | ||
398 | { | ||
399 | // Console.WriteLine("branch compare true , offset is " + compareloffset); | ||
400 | // Console.WriteLine("current PC is " + this._mThread.PC); | ||
401 | this._mThread.PC += -1 + compareloffset; | ||
402 | // Console.WriteLine("new PC is " + this._mThread.PC); | ||
403 | } | ||
404 | else | ||
405 | { | ||
406 | //Console.WriteLine("branch compare false"); | ||
407 | this._mThread.PC += 2; | ||
408 | } | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | this._mThread.PC += 2; | ||
413 | } | ||
414 | result = true; | ||
415 | break; | ||
416 | case 167: | ||
417 | short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); | ||
418 | this._mThread.PC += -1 + offset; | ||
419 | result = true; | ||
420 | break; | ||
421 | } | ||
422 | |||
423 | return result; | ||
424 | } | ||
425 | } | ||
426 | } | ||
427 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs deleted file mode 100644 index 8e34de7..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs +++ /dev/null | |||
@@ -1,161 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Scripting.EmbeddedJVM.Types; | ||
32 | using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | ||
33 | using OpenSim.Framework.Interfaces; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Types; | ||
36 | |||
37 | namespace OpenSim.Scripting.EmbeddedJVM | ||
38 | { | ||
39 | partial class Thread | ||
40 | { | ||
41 | private partial class Interpreter | ||
42 | { | ||
43 | private bool IsMethodOpCode(byte opcode) | ||
44 | { | ||
45 | bool result = false; | ||
46 | switch (opcode) | ||
47 | { | ||
48 | case 184: | ||
49 | short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); | ||
50 | if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) | ||
51 | { | ||
52 | string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value; | ||
53 | string typeparam = ""; | ||
54 | string typereturn = ""; | ||
55 | int firstbrak = 0; | ||
56 | int secondbrak = 0; | ||
57 | firstbrak = typ.LastIndexOf('('); | ||
58 | secondbrak = typ.LastIndexOf(')'); | ||
59 | typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); | ||
60 | typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); | ||
61 | if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value) | ||
62 | { | ||
63 | //calling a method in this class | ||
64 | if (typeparam.Length == 0) | ||
65 | { | ||
66 | this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2)); | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2)); | ||
71 | } | ||
72 | } | ||
73 | else | ||
74 | { | ||
75 | //calling a method of a different class | ||
76 | |||
77 | //for now we will have a built in OpenSimAPI class, but this should be a java class that then calls native methods | ||
78 | if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") | ||
79 | { | ||
80 | switch (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value) | ||
81 | { | ||
82 | case "GetEntityID": | ||
83 | Int entityID = new Int(); | ||
84 | entityID.mValue =(int) this._mThread.EntityId; | ||
85 | this._mThread.currentFrame.OpStack.Push(entityID); | ||
86 | this._mThread.PC += 2; | ||
87 | break; | ||
88 | case "GetRandomAvatarID": | ||
89 | entityID = new Int(); | ||
90 | entityID.mValue = (int)Thread.OpenSimScriptAPI.GetRandomAvatarID(); | ||
91 | this._mThread.currentFrame.OpStack.Push(entityID); | ||
92 | this._mThread.PC += 2; | ||
93 | break; | ||
94 | case "GetEntityPositionX": | ||
95 | BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); | ||
96 | if (bs1 is Int) | ||
97 | { | ||
98 | //should get the position of the entity from the IScriptAPI | ||
99 | OSVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue); | ||
100 | Float pos = new Float(); | ||
101 | pos.mValue = vec3.X; | ||
102 | this._mThread.currentFrame.OpStack.Push(pos); | ||
103 | } | ||
104 | this._mThread.PC += 2; | ||
105 | break; | ||
106 | case "GetEntityPositionY": | ||
107 | bs1 = this._mThread.currentFrame.OpStack.Pop(); | ||
108 | if (bs1 is Int) | ||
109 | { | ||
110 | //should get the position of the entity from the IScriptAPI | ||
111 | OSVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue); | ||
112 | Float pos = new Float(); | ||
113 | pos.mValue = vec3.Y; | ||
114 | this._mThread.currentFrame.OpStack.Push(pos); | ||
115 | } | ||
116 | this._mThread.PC += 2; | ||
117 | break; | ||
118 | case "GetEntityPositionZ": | ||
119 | bs1 = this._mThread.currentFrame.OpStack.Pop(); | ||
120 | if (bs1 is Int) | ||
121 | { | ||
122 | //should get the position of the entity from the IScriptAPI | ||
123 | OSVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue); | ||
124 | Float pos = new Float(); | ||
125 | pos.mValue = vec3.Z; | ||
126 | this._mThread.currentFrame.OpStack.Push(pos); | ||
127 | } | ||
128 | this._mThread.PC += 2; | ||
129 | break; | ||
130 | case "SetEntityPosition": | ||
131 | //pop the three float values and the entity id | ||
132 | BaseType ft3 = this._mThread.currentFrame.OpStack.Pop(); | ||
133 | BaseType ft2 = this._mThread.currentFrame.OpStack.Pop(); | ||
134 | BaseType ft1 = this._mThread.currentFrame.OpStack.Pop(); | ||
135 | BaseType in1 = this._mThread.currentFrame.OpStack.Pop(); | ||
136 | if (ft1 is Float && ft2 is Float && ft3 is Float) | ||
137 | { | ||
138 | if(in1 is Int) | ||
139 | { | ||
140 | Thread.OpenSimScriptAPI.SetEntityPosition((uint)((Int) in1).mValue, ((Float)ft1).mValue, ((Float)ft2).mValue, ((Float)ft3).mValue); | ||
141 | } | ||
142 | } | ||
143 | this._mThread.PC += 2; | ||
144 | break; | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | this._mThread.PC += 2; | ||
152 | } | ||
153 | result = true; | ||
154 | break; | ||
155 | } | ||
156 | |||
157 | return result; | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterReturn.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterReturn.cs deleted file mode 100644 index cbedb71..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterReturn.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | partial class Thread | ||
35 | { | ||
36 | private partial class Interpreter | ||
37 | { | ||
38 | } | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/MainMemory.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/MainMemory.cs deleted file mode 100644 index 97d9fb6..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/MainMemory.cs +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class MainMemory | ||
35 | { | ||
36 | public Heap HeapArea; | ||
37 | public MethodMemory MethodArea; | ||
38 | |||
39 | public MainMemory() | ||
40 | { | ||
41 | MethodArea = new MethodMemory(); | ||
42 | HeapArea = new Heap(); | ||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/MethodMemory.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/MethodMemory.cs deleted file mode 100644 index 7e938b4..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/MethodMemory.cs +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class MethodMemory | ||
35 | { | ||
36 | public byte[] MethodBuffer; | ||
37 | public List<ClassRecord> Classes = new List<ClassRecord>(); | ||
38 | public int NextMethodPC = 0; | ||
39 | public int Methodcount = 0; | ||
40 | |||
41 | public MethodMemory() | ||
42 | { | ||
43 | MethodBuffer = new byte[20000]; | ||
44 | } | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Object.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Object.cs deleted file mode 100644 index 2c3bedd..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Object.cs +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class Object | ||
35 | { | ||
36 | } | ||
37 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.csproj b/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.csproj deleted file mode 100644 index bd1a332..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.csproj +++ /dev/null | |||
@@ -1,153 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{97A82740-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Scripting.EmbeddedJVM</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Scripting.EmbeddedJVM</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\ScriptEngines\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\ScriptEngines\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="System" > | ||
62 | <HintPath>System.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System.Xml" > | ||
66 | <HintPath>System.Xml.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | </ItemGroup> | ||
70 | <ItemGroup> | ||
71 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
72 | <Name>OpenSim.Framework</Name> | ||
73 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
74 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
75 | <Private>False</Private> | ||
76 | </ProjectReference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | <Compile Include="ClassInstance.cs"> | ||
80 | <SubType>Code</SubType> | ||
81 | </Compile> | ||
82 | <Compile Include="ClassRecord.cs"> | ||
83 | <SubType>Code</SubType> | ||
84 | </Compile> | ||
85 | <Compile Include="Heap.cs"> | ||
86 | <SubType>Code</SubType> | ||
87 | </Compile> | ||
88 | <Compile Include="Interpreter.cs"> | ||
89 | <SubType>Code</SubType> | ||
90 | </Compile> | ||
91 | <Compile Include="InterpreterLogic.cs"> | ||
92 | <SubType>Code</SubType> | ||
93 | </Compile> | ||
94 | <Compile Include="InterpreterMethods.cs"> | ||
95 | <SubType>Code</SubType> | ||
96 | </Compile> | ||
97 | <Compile Include="InterpreterReturn.cs"> | ||
98 | <SubType>Code</SubType> | ||
99 | </Compile> | ||
100 | <Compile Include="MainMemory.cs"> | ||
101 | <SubType>Code</SubType> | ||
102 | </Compile> | ||
103 | <Compile Include="MethodMemory.cs"> | ||
104 | <SubType>Code</SubType> | ||
105 | </Compile> | ||
106 | <Compile Include="Object.cs"> | ||
107 | <SubType>Code</SubType> | ||
108 | </Compile> | ||
109 | <Compile Include="OpenSimJVM.cs"> | ||
110 | <SubType>Code</SubType> | ||
111 | </Compile> | ||
112 | <Compile Include="Stack.cs"> | ||
113 | <SubType>Code</SubType> | ||
114 | </Compile> | ||
115 | <Compile Include="StackFrame.cs"> | ||
116 | <SubType>Code</SubType> | ||
117 | </Compile> | ||
118 | <Compile Include="Thread.cs"> | ||
119 | <SubType>Code</SubType> | ||
120 | </Compile> | ||
121 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
122 | <SubType>Code</SubType> | ||
123 | </Compile> | ||
124 | <Compile Include="Types\ArrayReference.cs"> | ||
125 | <SubType>Code</SubType> | ||
126 | </Compile> | ||
127 | <Compile Include="Types\BaseType.cs"> | ||
128 | <SubType>Code</SubType> | ||
129 | </Compile> | ||
130 | <Compile Include="Types\ObjectReference.cs"> | ||
131 | <SubType>Code</SubType> | ||
132 | </Compile> | ||
133 | <Compile Include="Types\PrimitiveTypes\Byte.cs"> | ||
134 | <SubType>Code</SubType> | ||
135 | </Compile> | ||
136 | <Compile Include="Types\PrimitiveTypes\Char.cs"> | ||
137 | <SubType>Code</SubType> | ||
138 | </Compile> | ||
139 | <Compile Include="Types\PrimitiveTypes\Float.cs"> | ||
140 | <SubType>Code</SubType> | ||
141 | </Compile> | ||
142 | <Compile Include="Types\PrimitiveTypes\Int.cs"> | ||
143 | <SubType>Code</SubType> | ||
144 | </Compile> | ||
145 | </ItemGroup> | ||
146 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
147 | <PropertyGroup> | ||
148 | <PreBuildEvent> | ||
149 | </PreBuildEvent> | ||
150 | <PostBuildEvent> | ||
151 | </PostBuildEvent> | ||
152 | </PropertyGroup> | ||
153 | </Project> | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.dll.build b/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.dll.build deleted file mode 100644 index cce2fef..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.dll.build +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Scripting.EmbeddedJVM" 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.Scripting.EmbeddedJVM" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="ClassInstance.cs" /> | ||
15 | <include name="ClassRecord.cs" /> | ||
16 | <include name="Heap.cs" /> | ||
17 | <include name="Interpreter.cs" /> | ||
18 | <include name="InterpreterLogic.cs" /> | ||
19 | <include name="InterpreterMethods.cs" /> | ||
20 | <include name="InterpreterReturn.cs" /> | ||
21 | <include name="MainMemory.cs" /> | ||
22 | <include name="MethodMemory.cs" /> | ||
23 | <include name="Object.cs" /> | ||
24 | <include name="OpenSimJVM.cs" /> | ||
25 | <include name="Stack.cs" /> | ||
26 | <include name="StackFrame.cs" /> | ||
27 | <include name="Thread.cs" /> | ||
28 | <include name="Properties/AssemblyInfo.cs" /> | ||
29 | <include name="Types/ArrayReference.cs" /> | ||
30 | <include name="Types/BaseType.cs" /> | ||
31 | <include name="Types/ObjectReference.cs" /> | ||
32 | <include name="Types/PrimitiveTypes/Byte.cs" /> | ||
33 | <include name="Types/PrimitiveTypes/Char.cs" /> | ||
34 | <include name="Types/PrimitiveTypes/Float.cs" /> | ||
35 | <include name="Types/PrimitiveTypes/Int.cs" /> | ||
36 | </sources> | ||
37 | <references basedir="${project::get-base-directory()}"> | ||
38 | <lib> | ||
39 | <include name="${project::get-base-directory()}" /> | ||
40 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
41 | </lib> | ||
42 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
43 | <include name="System.dll" /> | ||
44 | <include name="System.Xml.dll" /> | ||
45 | </references> | ||
46 | </csc> | ||
47 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/ScriptEngines/" /> | ||
48 | <mkdir dir="${project::get-base-directory()}/../../../bin/ScriptEngines/"/> | ||
49 | <copy todir="${project::get-base-directory()}/../../../bin/ScriptEngines/"> | ||
50 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
51 | <include name="*.dll"/> | ||
52 | <include name="*.exe"/> | ||
53 | </fileset> | ||
54 | </copy> | ||
55 | </target> | ||
56 | <target name="clean"> | ||
57 | <delete dir="${bin.dir}" failonerror="false" /> | ||
58 | <delete dir="${obj.dir}" failonerror="false" /> | ||
59 | </target> | ||
60 | <target name="doc" description="Creates documentation."> | ||
61 | </target> | ||
62 | </project> | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs deleted file mode 100644 index 2de8152..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs +++ /dev/null | |||
@@ -1,161 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.IO; | ||
32 | using System.Threading; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Utilities; | ||
36 | |||
37 | namespace OpenSim.Scripting.EmbeddedJVM | ||
38 | { | ||
39 | public class OpenSimJVM : IScriptEngine | ||
40 | { | ||
41 | private List<Thread> _threads = new List<Thread>(); | ||
42 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); | ||
43 | private MainMemory _mainMemory; | ||
44 | private System.Threading.Thread compileThread; | ||
45 | |||
46 | public OpenSimJVM() | ||
47 | { | ||
48 | |||
49 | } | ||
50 | |||
51 | public bool Init(IScriptAPI api) | ||
52 | { | ||
53 | Console.WriteLine("Creating OpenSim JVM scripting engine"); | ||
54 | _mainMemory = new MainMemory(); | ||
55 | Thread.GlobalMemory = this._mainMemory; | ||
56 | Thread.OpenSimScriptAPI = api; | ||
57 | compileThread = new System.Threading.Thread(new ThreadStart(CompileScript)); | ||
58 | compileThread.IsBackground = true; | ||
59 | compileThread.Start(); | ||
60 | return true; | ||
61 | } | ||
62 | |||
63 | public string GetName() | ||
64 | { | ||
65 | return "OpenSimJVM"; | ||
66 | } | ||
67 | |||
68 | public void LoadScript(string script, string scriptName, uint entityID) | ||
69 | { | ||
70 | Console.WriteLine("OpenSimJVM - loading new script: " + scriptName); | ||
71 | CompileInfo comp = new CompileInfo(); | ||
72 | comp.entityId = entityID; | ||
73 | comp.script = script; | ||
74 | comp.scriptName = scriptName; | ||
75 | this.CompileScripts.Enqueue(comp); | ||
76 | } | ||
77 | |||
78 | public void CompileScript() | ||
79 | { | ||
80 | while (true) | ||
81 | { | ||
82 | CompileInfo comp = this.CompileScripts.Dequeue(); | ||
83 | string script = comp.script; | ||
84 | string scriptName = comp.scriptName; | ||
85 | uint entityID = comp.entityId; | ||
86 | try | ||
87 | { | ||
88 | //need to compile the script into a java class file | ||
89 | |||
90 | //first save it to a java source file | ||
91 | TextWriter tw = new StreamWriter(scriptName + ".java"); | ||
92 | tw.WriteLine(script); | ||
93 | tw.Close(); | ||
94 | |||
95 | //now compile | ||
96 | System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); | ||
97 | // psi.RedirectStandardOutput = true; | ||
98 | psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; | ||
99 | psi.UseShellExecute = false; | ||
100 | |||
101 | System.Diagnostics.Process javacomp; | ||
102 | javacomp = System.Diagnostics.Process.Start(psi); | ||
103 | javacomp.WaitForExit(); | ||
104 | |||
105 | |||
106 | //now load in class file | ||
107 | ClassRecord class1 = new ClassRecord(); | ||
108 | class1.LoadClassFromFile(scriptName + ".class"); | ||
109 | class1.PrintToConsole(); | ||
110 | //Console.WriteLine(); | ||
111 | this._mainMemory.MethodArea.Classes.Add(class1); | ||
112 | class1.AddMethodsToMemory(this._mainMemory.MethodArea); | ||
113 | |||
114 | Thread newThread = new Thread(); | ||
115 | this._threads.Add(newThread); | ||
116 | newThread.EntityId = entityID; | ||
117 | newThread.currentClass = class1; | ||
118 | |||
119 | //now delete the created files | ||
120 | System.IO.File.Delete(scriptName + ".java"); | ||
121 | System.IO.File.Delete(scriptName + ".class"); | ||
122 | //this.OnFrame(); | ||
123 | } | ||
124 | catch (Exception e) | ||
125 | { | ||
126 | Console.WriteLine("exception"); | ||
127 | Console.WriteLine(e.StackTrace); | ||
128 | Console.WriteLine(e.Message); | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | |||
133 | public void OnFrame() | ||
134 | { | ||
135 | for (int i = 0; i < this._threads.Count; i++) | ||
136 | { | ||
137 | if (!this._threads[i].running) | ||
138 | { | ||
139 | this._threads[i].StartMethod("OnFrame"); | ||
140 | bool run = true; | ||
141 | while (run) | ||
142 | { | ||
143 | run = this._threads[i].Excute(); | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | |||
149 | private class CompileInfo | ||
150 | { | ||
151 | public string script; | ||
152 | public string scriptName; | ||
153 | public uint entityId; | ||
154 | |||
155 | public CompileInfo() | ||
156 | { | ||
157 | |||
158 | } | ||
159 | } | ||
160 | } | ||
161 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Properties/AssemblyInfo.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Properties/AssemblyInfo.cs deleted file mode 100644 index 53a0f08..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.Scripting.EmbeddedJVM")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenSim.Scripting.EmbeddedJVM")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("087c0917-5a6a-4b47-a4dd-0928dd85bd4b")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Stack.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Stack.cs deleted file mode 100644 index 69a274c..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Stack.cs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class Stack | ||
35 | { | ||
36 | public Stack<StackFrame> StackFrames = new Stack<StackFrame>(); | ||
37 | |||
38 | public Stack() | ||
39 | { | ||
40 | } | ||
41 | } | ||
42 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/StackFrame.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/StackFrame.cs deleted file mode 100644 index 3a2b58a..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/StackFrame.cs +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Scripting.EmbeddedJVM.Types; | ||
32 | |||
33 | namespace OpenSim.Scripting.EmbeddedJVM | ||
34 | { | ||
35 | public class StackFrame | ||
36 | { | ||
37 | public BaseType[] LocalVariables; | ||
38 | public Stack<BaseType> OpStack = new Stack<BaseType>(); | ||
39 | |||
40 | public int ReturnPC = 0; | ||
41 | public ClassRecord CallingClass = null; | ||
42 | |||
43 | public StackFrame() | ||
44 | { | ||
45 | LocalVariables = new BaseType[20]; | ||
46 | } | ||
47 | |||
48 | } | ||
49 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs deleted file mode 100644 index 6813a20..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Scripting.EmbeddedJVM.Types; | ||
32 | using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | |||
36 | namespace OpenSim.Scripting.EmbeddedJVM | ||
37 | { | ||
38 | public partial class Thread | ||
39 | { | ||
40 | public static MainMemory GlobalMemory; | ||
41 | public static IScriptAPI OpenSimScriptAPI; | ||
42 | private int PC = 0; | ||
43 | private Stack stack; | ||
44 | private Interpreter mInterpreter; | ||
45 | public ClassRecord currentClass; | ||
46 | public ClassInstance currentInstance; | ||
47 | private StackFrame currentFrame; | ||
48 | public int excutionCounter = 0; | ||
49 | public bool running = false; | ||
50 | public uint EntityId = 0; | ||
51 | |||
52 | public Thread() | ||
53 | { | ||
54 | this.mInterpreter = new Interpreter(this); | ||
55 | this.stack = new Stack(); | ||
56 | } | ||
57 | |||
58 | public void SetPC(int methodpointer) | ||
59 | { | ||
60 | //Console.WriteLine("Thread PC has been set to " + methodpointer); | ||
61 | PC = methodpointer; | ||
62 | } | ||
63 | |||
64 | public void StartMethod(ClassRecord rec, string methName) | ||
65 | { | ||
66 | currentFrame = new StackFrame(); | ||
67 | this.stack.StackFrames.Push(currentFrame); | ||
68 | this.currentClass = rec; | ||
69 | currentClass.StartMethod(this, methName); | ||
70 | } | ||
71 | |||
72 | public void StartMethod( string methName) | ||
73 | { | ||
74 | currentFrame = new StackFrame(); | ||
75 | this.stack.StackFrames.Push(currentFrame); | ||
76 | currentClass.StartMethod(this, methName); | ||
77 | } | ||
78 | |||
79 | public void JumpToStaticVoidMethod(string methName, int returnPC) | ||
80 | { | ||
81 | currentFrame = new StackFrame(); | ||
82 | currentFrame.ReturnPC = returnPC; | ||
83 | this.stack.StackFrames.Push(currentFrame); | ||
84 | currentClass.StartMethod(this, methName); | ||
85 | } | ||
86 | |||
87 | public void JumpToStaticParamMethod(string methName, string param, int returnPC) | ||
88 | { | ||
89 | if (param == "I") | ||
90 | { | ||
91 | BaseType bs1 = currentFrame.OpStack.Pop(); | ||
92 | currentFrame = new StackFrame(); | ||
93 | currentFrame.ReturnPC = returnPC; | ||
94 | this.stack.StackFrames.Push(currentFrame); | ||
95 | currentFrame.LocalVariables[0] = ((Int)bs1); | ||
96 | currentClass.StartMethod(this, methName); | ||
97 | } | ||
98 | if (param == "F") | ||
99 | { | ||
100 | |||
101 | } | ||
102 | } | ||
103 | |||
104 | public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) | ||
105 | { | ||
106 | |||
107 | } | ||
108 | |||
109 | public bool Excute() | ||
110 | { | ||
111 | excutionCounter++; | ||
112 | return this.mInterpreter.Excute(); | ||
113 | } | ||
114 | } | ||
115 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ArrayReference.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ArrayReference.cs deleted file mode 100644 index 2854eab..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ArrayReference.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types | ||
6 | { | ||
7 | public class ArrayReference :BaseType | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/BaseType.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/BaseType.cs deleted file mode 100644 index 270aa7b..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/BaseType.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types | ||
6 | { | ||
7 | public class BaseType : Object | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ObjectReference.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ObjectReference.cs deleted file mode 100644 index da28eaa..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ObjectReference.cs +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types | ||
6 | { | ||
7 | public class ObjectReference : BaseType | ||
8 | { | ||
9 | public ushort Reference; | ||
10 | |||
11 | public ObjectReference() | ||
12 | { | ||
13 | |||
14 | } | ||
15 | } | ||
16 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Byte.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Byte.cs deleted file mode 100644 index 1a3ecff..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Byte.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Byte : BaseType | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Char.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Char.cs deleted file mode 100644 index 19002d4..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Char.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Char : BaseType | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Float.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Float.cs deleted file mode 100644 index 91f1679..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Float.cs +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Float : BaseType | ||
8 | { | ||
9 | public float mValue = 0; | ||
10 | |||
11 | public Float() | ||
12 | { | ||
13 | |||
14 | } | ||
15 | } | ||
16 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Int.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Int.cs deleted file mode 100644 index 4ecd325..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Int.cs +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Int : BaseType | ||
8 | { | ||
9 | public int mValue = 0; | ||
10 | |||
11 | public Int() | ||
12 | { | ||
13 | |||
14 | } | ||
15 | } | ||
16 | } | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs deleted file mode 100644 index 1818e3a..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs +++ /dev/null | |||
@@ -1,118 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | // BDB Support | ||
30 | // Apparently broken on Mono | ||
31 | |||
32 | using System; | ||
33 | using System.Collections.Generic; | ||
34 | using System.Data; | ||
35 | using libsecondlife; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework.Types; | ||
38 | using OpenSim.Framework.Terrain; | ||
39 | using BerkeleyDb; | ||
40 | using Kds.Serialization; | ||
41 | using Kds.Serialization.Buffer; | ||
42 | |||
43 | namespace OpenSim.Storage.LocalStorageBDB | ||
44 | { | ||
45 | public class BDBLocalStorage : ILocalStorage | ||
46 | { | ||
47 | const string simDbName = "localsim.db"; | ||
48 | |||
49 | DbHash sim; | ||
50 | Db DB; | ||
51 | //BEFormatter formatter; | ||
52 | |||
53 | public BDBLocalStorage() | ||
54 | { | ||
55 | DB = new Db(DbCreateFlags.None); | ||
56 | sim = (DbHash)DB.Open(null, simDbName, null, BerkeleyDb.DbType.Hash, Db.OpenFlags.Create, 0); | ||
57 | //vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0); | ||
58 | } | ||
59 | |||
60 | public void Initialise(string file) | ||
61 | { | ||
62 | // Blank | ||
63 | } | ||
64 | |||
65 | public void StorePrim(PrimData prim) | ||
66 | { | ||
67 | DbEntry key = new DbEntry(); | ||
68 | DbEntry data = new DbEntry(); | ||
69 | lock (sim) | ||
70 | { | ||
71 | sim.PutUnique(null, ref key, ref data, DbFile.WriteFlags.AutoCommit); | ||
72 | } | ||
73 | } | ||
74 | public void RemovePrim(LLUUID primID) | ||
75 | { | ||
76 | |||
77 | } | ||
78 | public void LoadPrimitives(ILocalStorageReceiver receiver) | ||
79 | { | ||
80 | |||
81 | } | ||
82 | public float[] LoadWorld() | ||
83 | { | ||
84 | return new float[65536]; | ||
85 | } | ||
86 | public void SaveMap(float[] heightmap) | ||
87 | { | ||
88 | |||
89 | } | ||
90 | |||
91 | public void SaveParcels(ParcelData[] parcel_data) | ||
92 | { | ||
93 | } | ||
94 | |||
95 | public void SaveParcel(ParcelData parcel) | ||
96 | { | ||
97 | } | ||
98 | |||
99 | public void RemoveParcel(ParcelData parcel) | ||
100 | { | ||
101 | } | ||
102 | |||
103 | public void RemoveAllParcels() | ||
104 | { | ||
105 | } | ||
106 | |||
107 | public void LoadParcels(ILocalStorageParcelReceiver recv) | ||
108 | { | ||
109 | recv.NoParcelDataFromStorage(); | ||
110 | } | ||
111 | |||
112 | public void ShutDown() | ||
113 | { | ||
114 | sim.GetDb().Close(); | ||
115 | DB.Close(); | ||
116 | } | ||
117 | } | ||
118 | } \ No newline at end of file | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj deleted file mode 100644 index 417643f..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.csproj +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{EE9E5D96-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Storage.LocalStorageBerkeleyDB</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Storage.LocalStorageBerkeleyDB</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Kds.Serialization.dll" > | ||
62 | <HintPath>..\..\..\bin\Kds.Serialization.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libdb_dotNET43.dll" > | ||
66 | <HintPath>..\..\..\bin\libdb_dotNET43.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="libsecondlife.dll" > | ||
70 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System" > | ||
74 | <HintPath>System.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Data" > | ||
78 | <HintPath>System.Data.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="System.Xml" > | ||
82 | <HintPath>System.Xml.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | </ItemGroup> | ||
86 | <ItemGroup> | ||
87 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
88 | <Name>OpenSim.Framework</Name> | ||
89 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
90 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
91 | <Private>False</Private> | ||
92 | </ProjectReference> | ||
93 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
94 | <Name>OpenSim.Framework.Console</Name> | ||
95 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
96 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
97 | <Private>False</Private> | ||
98 | </ProjectReference> | ||
99 | </ItemGroup> | ||
100 | <ItemGroup> | ||
101 | <Compile Include="BDBLocalStorage.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | </ItemGroup> | ||
105 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
106 | <PropertyGroup> | ||
107 | <PreBuildEvent> | ||
108 | </PreBuildEvent> | ||
109 | <PostBuildEvent> | ||
110 | </PostBuildEvent> | ||
111 | </PropertyGroup> | ||
112 | </Project> | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build deleted file mode 100644 index bc2d8ec..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Storage.LocalStorageBerkeleyDB" 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.Storage.LocalStorageBerkeleyDB" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="BDBLocalStorage.cs" /> | ||
15 | </sources> | ||
16 | <references basedir="${project::get-base-directory()}"> | ||
17 | <lib> | ||
18 | <include name="${project::get-base-directory()}" /> | ||
19 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
20 | </lib> | ||
21 | <include name="../../../bin/Kds.Serialization.dll" /> | ||
22 | <include name="../../../bin/libdb_dotNET43.dll" /> | ||
23 | <include name="../../../bin/libsecondlife.dll" /> | ||
24 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
25 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> | ||
26 | <include name="System.dll" /> | ||
27 | <include name="System.Data.dll" /> | ||
28 | <include name="System.Xml.dll" /> | ||
29 | </references> | ||
30 | </csc> | ||
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
32 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
33 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
34 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
35 | <include name="*.dll"/> | ||
36 | <include name="*.exe"/> | ||
37 | </fileset> | ||
38 | </copy> | ||
39 | </target> | ||
40 | <target name="clean"> | ||
41 | <delete dir="${bin.dir}" failonerror="false" /> | ||
42 | <delete dir="${obj.dir}" failonerror="false" /> | ||
43 | </target> | ||
44 | <target name="doc" description="Creates documentation."> | ||
45 | </target> | ||
46 | </project> | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs deleted file mode 100644 index ea2b62e..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System.Reflection; | ||
29 | using System.Runtime.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("Db4LocalStorage")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("Db4LocalStorage")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs deleted file mode 100644 index 46fecd0..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs +++ /dev/null | |||
@@ -1,271 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using Db4objects.Db4o; | ||
31 | using Db4objects.Db4o.Query; | ||
32 | |||
33 | using libsecondlife; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using OpenSim.Framework.Terrain; | ||
37 | using OpenSim.Framework.Console; | ||
38 | |||
39 | |||
40 | namespace OpenSim.Storage.LocalStorageDb4o | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// | ||
44 | /// </summary> | ||
45 | public class Db4LocalStorage : ILocalStorage | ||
46 | { | ||
47 | private IObjectContainer db; | ||
48 | private string datastore; | ||
49 | |||
50 | public Db4LocalStorage() | ||
51 | { | ||
52 | |||
53 | } | ||
54 | |||
55 | public void Initialise(string dfile) | ||
56 | { | ||
57 | OpenSim.Framework.Console.MainConsole.Instance.Warn("Db4LocalStorage Opening " + dfile); | ||
58 | datastore = dfile; | ||
59 | try | ||
60 | { | ||
61 | db = Db4oFactory.OpenFile(datastore); | ||
62 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Db4LocalStorage creation"); | ||
63 | } | ||
64 | catch (Exception e) | ||
65 | { | ||
66 | db.Close(); | ||
67 | OpenSim.Framework.Console.MainConsole.Instance.Warn("Db4LocalStorage :Constructor - Exception occured"); | ||
68 | OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString()); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | public void StorePrim(PrimData prim) | ||
73 | { | ||
74 | IObjectSet result = db.Query(new UUIDPrimQuery(prim.FullID)); | ||
75 | if(result.Count>0) | ||
76 | { | ||
77 | //prim already in storage | ||
78 | //so update it | ||
79 | PrimData found = (PrimData) result.Next(); | ||
80 | found.PathBegin = prim.PathBegin; | ||
81 | found.PathCurve= prim.PathCurve; | ||
82 | found.PathEnd = prim.PathEnd; | ||
83 | found.PathRadiusOffset = prim.PathRadiusOffset; | ||
84 | found.PathRevolutions = prim.PathRevolutions; | ||
85 | found.PathScaleX= prim.PathScaleX; | ||
86 | found.PathScaleY = prim.PathScaleY; | ||
87 | found.PathShearX = prim.PathShearX; | ||
88 | found.PathShearY = prim.PathShearY; | ||
89 | found.PathSkew = prim.PathSkew; | ||
90 | found.PathTaperX = prim.PathTaperX; | ||
91 | found.PathTaperY = prim.PathTaperY; | ||
92 | found.PathTwist = prim.PathTwist; | ||
93 | found.PathTwistBegin = prim.PathTwistBegin; | ||
94 | found.PCode = prim.PCode; | ||
95 | found.ProfileBegin = prim.ProfileBegin; | ||
96 | found.ProfileCurve = prim.ProfileCurve; | ||
97 | found.ProfileEnd = prim.ProfileEnd; | ||
98 | found.ProfileHollow = prim.ProfileHollow; | ||
99 | found.Position = prim.Position; | ||
100 | found.Rotation = prim.Rotation; | ||
101 | found.Texture = prim.Texture; | ||
102 | db.Set(found); | ||
103 | db.Commit(); | ||
104 | } | ||
105 | else | ||
106 | { | ||
107 | //not in storage | ||
108 | db.Set(prim); | ||
109 | db.Commit(); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | public void RemovePrim(LLUUID primID) | ||
114 | { | ||
115 | IObjectSet result = db.Query(new UUIDPrimQuery(primID)); | ||
116 | if(result.Count>0) | ||
117 | { | ||
118 | PrimData found = (PrimData) result.Next(); | ||
119 | db.Delete(found); | ||
120 | } | ||
121 | } | ||
122 | |||
123 | |||
124 | public void LoadPrimitives(ILocalStorageReceiver receiver) | ||
125 | { | ||
126 | IObjectSet result = db.Get(typeof(PrimData)); | ||
127 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is "+result.Count); | ||
128 | foreach (PrimData prim in result) { | ||
129 | receiver.PrimFromStorage(prim); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | public float[] LoadWorld() | ||
134 | { | ||
135 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world...."); | ||
136 | float[] heightmap = null; | ||
137 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB"); | ||
138 | IObjectSet world_result = db.Get(typeof(MapStorage)); | ||
139 | if (world_result.Count > 0) | ||
140 | { | ||
141 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Found a heightmap in local database, loading"); | ||
142 | MapStorage map = (MapStorage)world_result.Next(); | ||
143 | //blank.LandMap = map.Map; | ||
144 | heightmap = map.Map; | ||
145 | } | ||
146 | return heightmap; | ||
147 | } | ||
148 | |||
149 | public void SaveMap(float[] heightmap) | ||
150 | { | ||
151 | IObjectSet world_result = db.Get(typeof(MapStorage)); | ||
152 | if (world_result.Count > 0) | ||
153 | { | ||
154 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("SaveWorld() - updating saved copy of heightmap in local database"); | ||
155 | MapStorage map = (MapStorage)world_result.Next(); | ||
156 | db.Delete(map); | ||
157 | } | ||
158 | MapStorage map1 = new MapStorage(); | ||
159 | map1.Map = heightmap; //OpenSim_Main.local_world.LandMap; | ||
160 | db.Set(map1); | ||
161 | db.Commit(); | ||
162 | } | ||
163 | |||
164 | public void SaveParcel(ParcelData parcel) | ||
165 | { | ||
166 | IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID)); | ||
167 | if (result.Count > 0) | ||
168 | { | ||
169 | //Old Parcel | ||
170 | ParcelData updateParcel = (ParcelData)result.Next(); | ||
171 | updateParcel.AABBMax = parcel.AABBMax; | ||
172 | updateParcel.AABBMin = parcel.AABBMin; | ||
173 | updateParcel.area = parcel.area; | ||
174 | updateParcel.auctionID = parcel.auctionID; | ||
175 | updateParcel.authBuyerID = parcel.authBuyerID; | ||
176 | updateParcel.category = parcel.category; | ||
177 | updateParcel.claimDate = parcel.claimDate; | ||
178 | updateParcel.claimPrice = parcel.claimPrice; | ||
179 | updateParcel.groupID = parcel.groupID; | ||
180 | updateParcel.groupPrims = parcel.groupPrims; | ||
181 | updateParcel.isGroupOwned = parcel.isGroupOwned; | ||
182 | updateParcel.landingType = parcel.landingType; | ||
183 | updateParcel.mediaAutoScale = parcel.mediaAutoScale; | ||
184 | updateParcel.mediaID = parcel.mediaID; | ||
185 | updateParcel.mediaURL = parcel.mediaURL; | ||
186 | updateParcel.musicURL = parcel.musicURL; | ||
187 | updateParcel.localID = parcel.localID; | ||
188 | updateParcel.ownerID = parcel.ownerID; | ||
189 | updateParcel.passHours = parcel.passHours; | ||
190 | updateParcel.passPrice = parcel.passPrice; | ||
191 | updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone(); | ||
192 | updateParcel.parcelDesc = parcel.parcelDesc; | ||
193 | updateParcel.parcelFlags = parcel.parcelFlags; | ||
194 | updateParcel.parcelName = parcel.parcelName; | ||
195 | updateParcel.parcelStatus = parcel.parcelStatus; | ||
196 | updateParcel.salePrice = parcel.salePrice; | ||
197 | updateParcel.snapshotID = parcel.snapshotID; | ||
198 | updateParcel.userLocation = parcel.userLocation; | ||
199 | updateParcel.userLookAt = parcel.userLookAt; | ||
200 | |||
201 | db.Set(updateParcel); | ||
202 | } | ||
203 | else | ||
204 | { | ||
205 | db.Set(parcel); | ||
206 | } | ||
207 | db.Commit(); | ||
208 | } | ||
209 | |||
210 | public void SaveParcels(ParcelData[] parcel_data) | ||
211 | { | ||
212 | MainConsole.Instance.Notice("Parcel Backup: Saving Parcels..."); | ||
213 | int i; | ||
214 | for (i = 0; i < parcel_data.GetLength(0); i++) | ||
215 | { | ||
216 | |||
217 | SaveParcel(parcel_data[i]); | ||
218 | |||
219 | } | ||
220 | MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete"); | ||
221 | } | ||
222 | |||
223 | public void RemoveParcel(ParcelData parcel) | ||
224 | { | ||
225 | IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID)); | ||
226 | if (result.Count > 0) | ||
227 | { | ||
228 | db.Delete(result[0]); | ||
229 | } | ||
230 | db.Commit(); | ||
231 | } | ||
232 | public void RemoveAllParcels() | ||
233 | { | ||
234 | MainConsole.Instance.Notice("Parcel Backup: Removing all parcels..."); | ||
235 | IObjectSet result = db.Get(typeof(ParcelData)); | ||
236 | if (result.Count > 0) | ||
237 | { | ||
238 | foreach (ParcelData parcelData in result) | ||
239 | { | ||
240 | RemoveParcel(parcelData); | ||
241 | } | ||
242 | } | ||
243 | } | ||
244 | |||
245 | public void LoadParcels(ILocalStorageParcelReceiver recv) | ||
246 | { | ||
247 | MainConsole.Instance.Notice("Parcel Backup: Loading Parcels..."); | ||
248 | IObjectSet result = db.Get(typeof(ParcelData)); | ||
249 | if (result.Count > 0) | ||
250 | { | ||
251 | MainConsole.Instance.Notice("Parcel Backup: Parcels exist in database."); | ||
252 | foreach (ParcelData parcelData in result) | ||
253 | { | ||
254 | |||
255 | recv.ParcelFromStorage(parcelData); | ||
256 | } | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | MainConsole.Instance.Notice("Parcel Backup: No parcels exist. Creating basic parcel."); | ||
261 | recv.NoParcelDataFromStorage(); | ||
262 | } | ||
263 | MainConsole.Instance.Notice("Parcel Backup: Parcels Restored"); | ||
264 | } | ||
265 | public void ShutDown() | ||
266 | { | ||
267 | db.Commit(); | ||
268 | db.Close(); | ||
269 | } | ||
270 | } | ||
271 | } \ No newline at end of file | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs deleted file mode 100644 index 56387ac..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Storage.LocalStorageDb4o | ||
33 | { | ||
34 | public class MapStorage | ||
35 | { | ||
36 | public float[] Map; | ||
37 | |||
38 | public MapStorage() | ||
39 | { | ||
40 | |||
41 | } | ||
42 | } | ||
43 | } \ No newline at end of file | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj deleted file mode 100644 index 5b8f1c1..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{E1B79ECF-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System" > | ||
70 | <HintPath>System.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Xml" > | ||
74 | <HintPath>System.Xml.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
80 | <Name>OpenSim.Framework</Name> | ||
81 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
82 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
83 | <Private>False</Private> | ||
84 | </ProjectReference> | ||
85 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
86 | <Name>OpenSim.Framework.Console</Name> | ||
87 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
88 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
89 | <Private>False</Private> | ||
90 | </ProjectReference> | ||
91 | </ItemGroup> | ||
92 | <ItemGroup> | ||
93 | <Compile Include="AssemblyInfo.cs"> | ||
94 | <SubType>Code</SubType> | ||
95 | </Compile> | ||
96 | <Compile Include="Db4LocalStorage.cs"> | ||
97 | <SubType>Code</SubType> | ||
98 | </Compile> | ||
99 | <Compile Include="MapStorage.cs"> | ||
100 | <SubType>Code</SubType> | ||
101 | </Compile> | ||
102 | <Compile Include="UUIDParcelQuery.cs"> | ||
103 | <SubType>Code</SubType> | ||
104 | </Compile> | ||
105 | <Compile Include="UUIDPrimQuery.cs"> | ||
106 | <SubType>Code</SubType> | ||
107 | </Compile> | ||
108 | </ItemGroup> | ||
109 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
110 | <PropertyGroup> | ||
111 | <PreBuildEvent> | ||
112 | </PreBuildEvent> | ||
113 | <PostBuildEvent> | ||
114 | </PostBuildEvent> | ||
115 | </PropertyGroup> | ||
116 | </Project> | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build deleted file mode 100644 index 739b98c..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Storage.LocalStorageDb4o" 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.Storage.LocalStorageDb4o" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="Db4LocalStorage.cs" /> | ||
16 | <include name="MapStorage.cs" /> | ||
17 | <include name="UUIDParcelQuery.cs" /> | ||
18 | <include name="UUIDPrimQuery.cs" /> | ||
19 | </sources> | ||
20 | <references basedir="${project::get-base-directory()}"> | ||
21 | <lib> | ||
22 | <include name="${project::get-base-directory()}" /> | ||
23 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
24 | </lib> | ||
25 | <include name="../../../bin/Db4objects.Db4o.dll" /> | ||
26 | <include name="../../../bin/libsecondlife.dll" /> | ||
27 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
28 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> | ||
29 | <include name="System.dll" /> | ||
30 | <include name="System.Xml.dll" /> | ||
31 | </references> | ||
32 | </csc> | ||
33 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
34 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
35 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
36 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
37 | <include name="*.dll"/> | ||
38 | <include name="*.exe"/> | ||
39 | </fileset> | ||
40 | </copy> | ||
41 | </target> | ||
42 | <target name="clean"> | ||
43 | <delete dir="${bin.dir}" failonerror="false" /> | ||
44 | <delete dir="${obj.dir}" failonerror="false" /> | ||
45 | </target> | ||
46 | <target name="doc" description="Creates documentation."> | ||
47 | </target> | ||
48 | </project> | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDParcelQuery.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDParcelQuery.cs deleted file mode 100644 index d24fb5f..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDParcelQuery.cs +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using Db4objects.Db4o; | ||
32 | using Db4objects.Db4o.Query; | ||
33 | using libsecondlife; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | |||
37 | namespace OpenSim.Storage.LocalStorageDb4o | ||
38 | { | ||
39 | public class UUIDParcelQuery : Predicate | ||
40 | { | ||
41 | private LLUUID globalIDSearch; | ||
42 | |||
43 | public UUIDParcelQuery(LLUUID find) | ||
44 | { | ||
45 | globalIDSearch = find; | ||
46 | } | ||
47 | public bool Match(ParcelData parcel) | ||
48 | { | ||
49 | return (parcel.globalID == globalIDSearch); | ||
50 | } | ||
51 | } | ||
52 | } | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDPrimQuery.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDPrimQuery.cs deleted file mode 100644 index b2e8a91..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDPrimQuery.cs +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using Db4objects.Db4o; | ||
32 | using Db4objects.Db4o.Query; | ||
33 | using libsecondlife; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | |||
37 | namespace OpenSim.Storage.LocalStorageDb4o | ||
38 | { | ||
39 | public class UUIDPrimQuery : Predicate | ||
40 | { | ||
41 | private LLUUID _findID; | ||
42 | |||
43 | public UUIDPrimQuery(LLUUID find) | ||
44 | { | ||
45 | _findID = find; | ||
46 | } | ||
47 | public bool Match(PrimData prim) | ||
48 | { | ||
49 | return (prim.FullID == _findID); | ||
50 | } | ||
51 | } | ||
52 | } | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj b/OpenSim/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj deleted file mode 100644 index ff93a8f..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.csproj +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{6B20B603-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Storage.LocalStorageSQLite</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Storage.LocalStorageSQLite</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libsecondlife.dll" > | ||
62 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Data" > | ||
70 | <HintPath>System.Data.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Data.SQLite.dll" > | ||
74 | <HintPath>..\..\..\bin\System.Data.SQLite.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
84 | <Name>OpenSim.Framework</Name> | ||
85 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
87 | <Private>False</Private> | ||
88 | </ProjectReference> | ||
89 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
90 | <Name>OpenSim.Framework.Console</Name> | ||
91 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
92 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
93 | <Private>False</Private> | ||
94 | </ProjectReference> | ||
95 | </ItemGroup> | ||
96 | <ItemGroup> | ||
97 | <Compile Include="SQLiteLocalStorage.cs"> | ||
98 | <SubType>Code</SubType> | ||
99 | </Compile> | ||
100 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
101 | <SubType>Code</SubType> | ||
102 | </Compile> | ||
103 | </ItemGroup> | ||
104 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
105 | <PropertyGroup> | ||
106 | <PreBuildEvent> | ||
107 | </PreBuildEvent> | ||
108 | <PostBuildEvent> | ||
109 | </PostBuildEvent> | ||
110 | </PropertyGroup> | ||
111 | </Project> | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build b/OpenSim/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build deleted file mode 100644 index bd4c731..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/OpenSim.Storage.LocalStorageSQLite.dll.build +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Storage.LocalStorageSQLite" 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.Storage.LocalStorageSQLite" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="SQLiteLocalStorage.cs" /> | ||
15 | <include name="Properties/AssemblyInfo.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="../../../bin/libsecondlife.dll" /> | ||
23 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
24 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> | ||
25 | <include name="System.dll" /> | ||
26 | <include name="System.Data.dll" /> | ||
27 | <include name="../../../bin/System.Data.SQLite.dll" /> | ||
28 | <include name="System.Xml.dll" /> | ||
29 | </references> | ||
30 | </csc> | ||
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
32 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
33 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
34 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
35 | <include name="*.dll"/> | ||
36 | <include name="*.exe"/> | ||
37 | </fileset> | ||
38 | </copy> | ||
39 | </target> | ||
40 | <target name="clean"> | ||
41 | <delete dir="${bin.dir}" failonerror="false" /> | ||
42 | <delete dir="${obj.dir}" failonerror="false" /> | ||
43 | </target> | ||
44 | <target name="doc" description="Creates documentation."> | ||
45 | </target> | ||
46 | </project> | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs b/OpenSim/OpenSim.Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs deleted file mode 100644 index fe81f8a..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.Storage.LocalStorageSQLite")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenSim.Storage.LocalStorageSQLite")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("ecd6e0c1-7909-413e-9e3f-659678ac3bc3")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.*")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.*")] | ||
diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs deleted file mode 100644 index 8106727..0000000 --- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs +++ /dev/null | |||
@@ -1,199 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | // SQLite Support | ||
30 | // A bad idea, but the IRC people told me to! | ||
31 | |||
32 | using System; | ||
33 | using System.Collections.Generic; | ||
34 | using System.Data; | ||
35 | using System.Data.SQLite; | ||
36 | using libsecondlife; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework.Types; | ||
39 | using OpenSim.Framework.Terrain; | ||
40 | |||
41 | namespace OpenSim.Storage.LocalStorageSQLite | ||
42 | { | ||
43 | public class SQLiteLocalStorage : ILocalStorage | ||
44 | { | ||
45 | IDbConnection db; | ||
46 | |||
47 | public SQLiteLocalStorage() | ||
48 | { | ||
49 | try | ||
50 | { | ||
51 | string connectionstring = "URI=file:localsim.sdb"; | ||
52 | db = (IDbConnection)new SQLiteConnection(connectionstring); | ||
53 | db.Open(); | ||
54 | } | ||
55 | catch (Exception e) | ||
56 | { | ||
57 | db.Close(); | ||
58 | OpenSim.Framework.Console.MainConsole.Instance.Warn("SQLiteLocalStorage :Constructor - Exception occured"); | ||
59 | OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString()); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | public void Initialise(string file) | ||
64 | { | ||
65 | // Blank | ||
66 | } | ||
67 | |||
68 | public void StorePrim(PrimData prim) | ||
69 | { | ||
70 | IDbCommand cmd = db.CreateCommand(); | ||
71 | |||
72 | //SECURITY WARNING: | ||
73 | // These parameters wont produce SQL injections since they are all integer based, however. | ||
74 | // if inserting strings such as name or description, you will need to use appropriate | ||
75 | // measures to prevent SQL injection (although the value of SQL injection in this is limited). | ||
76 | |||
77 | string sql = "REPLACE INTO prim (OwnerID,PCode,PathBegin,PathEnd,PathScaleX,PathScaleY,PathShearX,PathShearY,PathSkew,ProfileBegin,ProfileEnd,Scale,PathCurve,ProfileCurve,ParentID,ProfileHollow,PathRadiusOffset,PathRevolutions,PathTaperX,PathTaperY,PathTwist,PathTwistBegin,Texture,CreationDate,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,Position,Rotation,LocalID,FullID) "; | ||
78 | sql += "VALUES ("; | ||
79 | sql += "\"" + prim.OwnerID.ToStringHyphenated() + "\","; // KILL ME NOW! | ||
80 | sql += "\"" + prim.PCode.ToString() + "\","; | ||
81 | sql += "\"" + prim.PathBegin.ToString() + "\","; | ||
82 | sql += "\"" + prim.PathEnd.ToString() + "\","; | ||
83 | sql += "\"" + prim.PathScaleX.ToString() + "\","; | ||
84 | sql += "\"" + prim.PathScaleY.ToString() + "\","; | ||
85 | sql += "\"" + prim.PathShearX.ToString() + "\","; | ||
86 | sql += "\"" + prim.PathShearY.ToString() + "\","; | ||
87 | sql += "\"" + prim.PathSkew.ToString() + "\","; | ||
88 | sql += "\"" + prim.ProfileBegin.ToString() + "\","; | ||
89 | sql += "\"" + prim.ProfileEnd.ToString() + "\","; | ||
90 | sql += "\"" + prim.Scale.ToString() + "\","; | ||
91 | sql += "\"" + prim.PathCurve.ToString() + "\","; | ||
92 | sql += "\"" + prim.ProfileCurve.ToString() + "\","; | ||
93 | sql += "\"" + prim.ParentID.ToString() + "\","; | ||
94 | sql += "\"" + prim.ProfileHollow.ToString() + "\","; | ||
95 | sql += "\"" + prim.PathRadiusOffset.ToString() + "\","; | ||
96 | sql += "\"" + prim.PathRevolutions.ToString() + "\","; | ||
97 | sql += "\"" + prim.PathTaperX.ToString() + "\","; | ||
98 | sql += "\"" + prim.PathTaperY.ToString() + "\","; | ||
99 | sql += "\"" + prim.PathTwist.ToString() + "\","; | ||
100 | sql += "\"" + prim.PathTwistBegin.ToString() + "\","; | ||
101 | sql += "\"" + prim.Texture.ToString() + "\","; | ||
102 | sql += "\"" + prim.CreationDate.ToString() + "\","; | ||
103 | sql += "\"" + prim.OwnerMask.ToString() + "\","; | ||
104 | sql += "\"" + prim.NextOwnerMask.ToString() + "\","; | ||
105 | sql += "\"" + prim.GroupMask.ToString() + "\","; | ||
106 | sql += "\"" + prim.EveryoneMask.ToString() + "\","; | ||
107 | sql += "\"" + prim.BaseMask.ToString() + "\","; | ||
108 | sql += "\"" + prim.Position.ToString() + "\","; | ||
109 | sql += "\"" + prim.Rotation.ToString() + "\","; | ||
110 | sql += "\"" + prim.LocalID.ToString() + "\","; | ||
111 | sql += "\"" + prim.FullID.ToString() + "\")"; | ||
112 | |||
113 | cmd.CommandText = sql; | ||
114 | |||
115 | try | ||
116 | { | ||
117 | cmd.ExecuteNonQuery(); | ||
118 | } | ||
119 | catch (Exception e) | ||
120 | { | ||
121 | OpenSim.Framework.Console.MainConsole.Instance.Warn("SQLiteLocalStorage :StorePrim - Exception occured"); | ||
122 | OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString()); | ||
123 | } | ||
124 | |||
125 | cmd.Dispose(); | ||
126 | cmd = null; | ||
127 | } | ||
128 | |||
129 | public void RemovePrim(LLUUID primID) | ||
130 | { | ||
131 | IDbCommand cmd = db.CreateCommand(); | ||
132 | |||
133 | //SECURITY WARNING: | ||
134 | // These parameters wont produce SQL injections since they are all integer based, however. | ||
135 | // if inserting strings such as name or description, you will need to use appropriate | ||
136 | // measures to prevent SQL injection (although the value of SQL injection in this is limited). | ||
137 | |||
138 | string sql = "DELETE FROM prim WHERE FullID = \"" + primID.ToStringHyphenated() + "\""; | ||
139 | |||
140 | cmd.CommandText = sql; | ||
141 | |||
142 | try | ||
143 | { | ||
144 | cmd.ExecuteNonQuery(); | ||
145 | } | ||
146 | catch (Exception e) | ||
147 | { | ||
148 | OpenSim.Framework.Console.MainConsole.Instance.Warn("SQLiteLocalStorage :RemovePrim - Exception occured"); | ||
149 | OpenSim.Framework.Console.MainConsole.Instance.Warn(e.ToString()); | ||
150 | } | ||
151 | |||
152 | cmd.Dispose(); | ||
153 | cmd = null; | ||
154 | } | ||
155 | |||
156 | public void LoadPrimitives(ILocalStorageReceiver receiver) | ||
157 | { | ||
158 | |||
159 | } | ||
160 | |||
161 | public float[] LoadWorld() | ||
162 | { | ||
163 | return new float[65536]; | ||
164 | } | ||
165 | |||
166 | public void SaveMap(float[] heightmap) | ||
167 | { | ||
168 | |||
169 | } | ||
170 | |||
171 | public void SaveParcels(ParcelData[] parcel_manager) | ||
172 | { | ||
173 | |||
174 | } | ||
175 | |||
176 | public void SaveParcel(ParcelData parcel) | ||
177 | { | ||
178 | } | ||
179 | |||
180 | public void RemoveParcel(ParcelData parcel) | ||
181 | { | ||
182 | } | ||
183 | |||
184 | public void RemoveAllParcels() | ||
185 | { | ||
186 | } | ||
187 | |||
188 | public void LoadParcels(ILocalStorageParcelReceiver recv) | ||
189 | { | ||
190 | recv.NoParcelDataFromStorage(); | ||
191 | } | ||
192 | |||
193 | public void ShutDown() | ||
194 | { | ||
195 | db.Close(); | ||
196 | db = null; | ||
197 | } | ||
198 | } | ||
199 | } \ No newline at end of file | ||
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj b/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj deleted file mode 100644 index aae0ab8..0000000 --- a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{2270B8FE-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Terrain.BasicTerrain</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Terrain.BasicTerrain</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libTerrain-BSD.dll" > | ||
62 | <HintPath>..\..\bin\libTerrain-BSD.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Data" > | ||
70 | <HintPath>System.Data.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Drawing" > | ||
74 | <HintPath>System.Drawing.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | </ItemGroup> | ||
84 | <ItemGroup> | ||
85 | <Compile Include="TerrainEngine.cs"> | ||
86 | <SubType>Code</SubType> | ||
87 | </Compile> | ||
88 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
89 | <SubType>Code</SubType> | ||
90 | </Compile> | ||
91 | </ItemGroup> | ||
92 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
93 | <PropertyGroup> | ||
94 | <PreBuildEvent> | ||
95 | </PreBuildEvent> | ||
96 | <PostBuildEvent> | ||
97 | </PostBuildEvent> | ||
98 | </PropertyGroup> | ||
99 | </Project> | ||
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build b/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build deleted file mode 100644 index 6526648..0000000 --- a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Terrain.BasicTerrain" 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.Terrain.BasicTerrain" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="TerrainEngine.cs" /> | ||
15 | <include name="Properties/AssemblyInfo.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="../../bin/libTerrain-BSD.dll" /> | ||
23 | <include name="System.dll" /> | ||
24 | <include name="System.Data.dll" /> | ||
25 | <include name="System.Drawing.dll" /> | ||
26 | <include name="System.Xml.dll" /> | ||
27 | </references> | ||
28 | </csc> | ||
29 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
30 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
31 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
32 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
33 | <include name="*.dll"/> | ||
34 | <include name="*.exe"/> | ||
35 | </fileset> | ||
36 | </copy> | ||
37 | </target> | ||
38 | <target name="clean"> | ||
39 | <delete dir="${bin.dir}" failonerror="false" /> | ||
40 | <delete dir="${obj.dir}" failonerror="false" /> | ||
41 | </target> | ||
42 | <target name="doc" description="Creates documentation."> | ||
43 | </target> | ||
44 | </project> | ||
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/Properties/AssemblyInfo.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/Properties/AssemblyInfo.cs deleted file mode 100644 index bd74993..0000000 --- a/OpenSim/OpenSim.Terrain.BasicTerrain/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.Terrain.BasicTerrain")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenSim.Terrain.BasicTerrain")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("3263f5b5-0a41-4ed5-91a2-9baaaeecc849")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs deleted file mode 100644 index 373d6ad..0000000 --- a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs +++ /dev/null | |||
@@ -1,533 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Drawing; | ||
32 | using libTerrain; | ||
33 | |||
34 | namespace OpenSim.Terrain | ||
35 | { | ||
36 | public class TerrainEngine | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// A [normally] 256x256 heightmap | ||
40 | /// </summary> | ||
41 | public Channel heightmap; | ||
42 | |||
43 | /// <summary> | ||
44 | /// Whether or not the terrain has been modified since it was last saved and sent to the Physics engine. | ||
45 | /// Counts the number of modifications since the last save. (0 = Untainted) | ||
46 | /// </summary> | ||
47 | public int tainted; | ||
48 | |||
49 | int w, h; | ||
50 | |||
51 | /// <summary> | ||
52 | /// Generate a new TerrainEngine instance and creates a new heightmap | ||
53 | /// </summary> | ||
54 | public TerrainEngine() | ||
55 | { | ||
56 | w = 256; | ||
57 | h = 256; | ||
58 | heightmap = new Channel(w, h); | ||
59 | |||
60 | tainted++; | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// Converts the heightmap to a 65536 value 1D floating point array | ||
65 | /// </summary> | ||
66 | /// <returns>A float[65536] array containing the heightmap</returns> | ||
67 | public float[] getHeights1D() | ||
68 | { | ||
69 | float[] heights = new float[w * h]; | ||
70 | int i; | ||
71 | |||
72 | for (i = 0; i < w * h; i++) | ||
73 | { | ||
74 | heights[i] = (float)heightmap.map[i / w, i % w]; | ||
75 | } | ||
76 | |||
77 | return heights; | ||
78 | } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Converts the heightmap to a 256x256 value 2D floating point array. | ||
82 | /// </summary> | ||
83 | /// <returns>An array of 256,256 values containing the heightmap</returns> | ||
84 | public float[,] getHeights2D() | ||
85 | { | ||
86 | float[,] heights = new float[w, h]; | ||
87 | int x, y; | ||
88 | for (x = 0; x < w; x++) | ||
89 | { | ||
90 | for (y = 0; y < h; y++) | ||
91 | { | ||
92 | heights[x, y] = (float)heightmap.map[x, y]; | ||
93 | } | ||
94 | } | ||
95 | return heights; | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Imports a 1D floating point array into the 2D heightmap array | ||
100 | /// </summary> | ||
101 | /// <param name="heights">The array to import (must have 65536 members)</param> | ||
102 | public void setHeights1D(float[] heights) | ||
103 | { | ||
104 | int i; | ||
105 | for (i = 0; i < w * h; i++) | ||
106 | { | ||
107 | heightmap.map[i / w, i % w] = heights[i]; | ||
108 | } | ||
109 | |||
110 | tainted++; | ||
111 | } | ||
112 | |||
113 | /// <summary> | ||
114 | /// Loads a 2D array of values into the heightmap | ||
115 | /// </summary> | ||
116 | /// <param name="heights">An array of 256,256 float values</param> | ||
117 | public void setHeights2D(float[,] heights) | ||
118 | { | ||
119 | int x, y; | ||
120 | for (x = 0; x < w; x++) | ||
121 | { | ||
122 | for (y = 0; y < h; y++) | ||
123 | { | ||
124 | heightmap.set(x, y, (double)heights[x, y]); | ||
125 | } | ||
126 | } | ||
127 | tainted++; | ||
128 | } | ||
129 | |||
130 | /// <summary> | ||
131 | /// Processes a terrain-specific command | ||
132 | /// </summary> | ||
133 | /// <param name="args">Commandline arguments (space seperated)</param> | ||
134 | /// <param name="resultText">Reference that returns error or help text if returning false</param> | ||
135 | /// <returns>If the operation was successful (if not, the error is placed into resultText)</returns> | ||
136 | public bool RunTerrainCmd(string[] args, ref string resultText) | ||
137 | { | ||
138 | string command = args[0]; | ||
139 | |||
140 | try | ||
141 | { | ||
142 | |||
143 | switch (command) | ||
144 | { | ||
145 | case "help": | ||
146 | resultText += "terrain regenerate - rebuilds the sims terrain using a default algorithm\n"; | ||
147 | resultText += "terrain seed <seed> - sets the random seed value to <seed>\n"; | ||
148 | resultText += "terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64', 'RAW' or 'IMG'\n"; | ||
149 | resultText += "terrain save <type> <filename> - saves a terrain to disk, type can be 'F32' or 'F64'\n"; | ||
150 | resultText += "terrain save grdmap <filename> <gradient map> - creates a PNG snapshot of the region using a named gradient map\n"; | ||
151 | resultText += "terrain rescale <min> <max> - rescales a terrain to be between <min> and <max> meters high\n"; | ||
152 | resultText += "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest>\n"; | ||
153 | resultText += "terrain erode thermal <talus> <rounds> <carry>\n"; | ||
154 | resultText += "terrain multiply <val> - multiplies a terrain by <val>\n"; | ||
155 | return false; | ||
156 | |||
157 | case "seed": | ||
158 | setSeed(Convert.ToInt32(args[1])); | ||
159 | break; | ||
160 | |||
161 | case "erode": | ||
162 | switch (args[1].ToLower()) | ||
163 | { | ||
164 | case "aerobic": | ||
165 | // WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest | ||
166 | heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7])); | ||
167 | break; | ||
168 | case "thermal": | ||
169 | heightmap.thermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4])); | ||
170 | break; | ||
171 | default: | ||
172 | resultText = "Unknown erosion type"; | ||
173 | return false; | ||
174 | } | ||
175 | break; | ||
176 | |||
177 | case "regenerate": | ||
178 | hills(); | ||
179 | break; | ||
180 | |||
181 | case "rescale": | ||
182 | setRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2])); | ||
183 | break; | ||
184 | |||
185 | case "multiply": | ||
186 | heightmap *= Convert.ToDouble(args[1]); | ||
187 | break; | ||
188 | |||
189 | case "load": | ||
190 | switch (args[1].ToLower()) | ||
191 | { | ||
192 | case "f32": | ||
193 | loadFromFileF32(args[2]); | ||
194 | break; | ||
195 | |||
196 | case "f64": | ||
197 | loadFromFileF64(args[2]); | ||
198 | break; | ||
199 | |||
200 | case "raw": | ||
201 | loadFromFileSLRAW(args[2]); | ||
202 | break; | ||
203 | |||
204 | case "img": | ||
205 | loadFromFileIMG(args[2]); | ||
206 | return false; | ||
207 | |||
208 | default: | ||
209 | resultText = "Unknown image or data format"; | ||
210 | return false; | ||
211 | } | ||
212 | break; | ||
213 | |||
214 | case "save": | ||
215 | switch (args[1].ToLower()) | ||
216 | { | ||
217 | case "f32": | ||
218 | writeToFileF32(args[2]); | ||
219 | break; | ||
220 | |||
221 | case "f64": | ||
222 | writeToFileF64(args[2]); | ||
223 | break; | ||
224 | |||
225 | case "grdmap": | ||
226 | exportImage(args[2], args[3]); | ||
227 | break; | ||
228 | |||
229 | default: | ||
230 | resultText = "Unknown image or data format"; | ||
231 | return false; | ||
232 | } | ||
233 | break; | ||
234 | |||
235 | default: | ||
236 | resultText = "Unknown terrain command"; | ||
237 | return false; | ||
238 | } | ||
239 | return true; | ||
240 | } | ||
241 | catch (Exception e) | ||
242 | { | ||
243 | resultText = "Error running terrain command: " + e.ToString(); | ||
244 | return false; | ||
245 | } | ||
246 | } | ||
247 | |||
248 | /// <summary> | ||
249 | /// Renormalises the array between min and max | ||
250 | /// </summary> | ||
251 | /// <param name="min">Minimum value of the new array</param> | ||
252 | /// <param name="max">Maximum value of the new array</param> | ||
253 | public void setRange(float min, float max) | ||
254 | { | ||
255 | heightmap.normalise((double)min, (double)max); | ||
256 | tainted++; | ||
257 | } | ||
258 | |||
259 | /// <summary> | ||
260 | /// Loads a file from an image compatible with System.Drawing | ||
261 | /// </summary> | ||
262 | /// <param name="filename">File to load</param> | ||
263 | public void loadFromFileIMG(string filename) | ||
264 | { | ||
265 | System.Drawing.Bitmap bmp = new Bitmap(filename); | ||
266 | |||
267 | if (bmp.Width != heightmap.w && bmp.Height != heightmap.h) | ||
268 | throw new Exception("Wrong image size! Images for this region must be " + heightmap.w.ToString() + " by " + heightmap.h.ToString() + " pixels in dimension"); | ||
269 | |||
270 | int x, y; | ||
271 | |||
272 | for (x = 0; x < w; x++) | ||
273 | { | ||
274 | for (y = 0; y < h; y++) | ||
275 | { | ||
276 | Color c = bmp.GetPixel(x, y); | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | |||
281 | /// <summary> | ||
282 | /// Loads a file consisting of 256x256 doubles and imports it as an array into the map. | ||
283 | /// </summary> | ||
284 | /// <remarks>TODO: Move this to libTerrain itself</remarks> | ||
285 | /// <param name="filename">The filename of the double array to import</param> | ||
286 | public void loadFromFileF64(string filename) | ||
287 | { | ||
288 | System.IO.FileInfo file = new System.IO.FileInfo(filename); | ||
289 | System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read); | ||
290 | System.IO.BinaryReader bs = new System.IO.BinaryReader(s); | ||
291 | int x, y; | ||
292 | for (x = 0; x < w; x++) | ||
293 | { | ||
294 | for (y = 0; y < h; y++) | ||
295 | { | ||
296 | heightmap.map[x, y] = bs.ReadDouble(); | ||
297 | } | ||
298 | } | ||
299 | |||
300 | bs.Close(); | ||
301 | s.Close(); | ||
302 | |||
303 | tainted++; | ||
304 | } | ||
305 | |||
306 | /// <summary> | ||
307 | /// Loads a file consisting of 256x256 floats and imports it as an array into the map. | ||
308 | /// </summary> | ||
309 | /// <remarks>TODO: Move this to libTerrain itself</remarks> | ||
310 | /// <param name="filename">The filename of the float array to import</param> | ||
311 | public void loadFromFileF32(string filename) | ||
312 | { | ||
313 | System.IO.FileInfo file = new System.IO.FileInfo(filename); | ||
314 | System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read); | ||
315 | System.IO.BinaryReader bs = new System.IO.BinaryReader(s); | ||
316 | int x, y; | ||
317 | for (x = 0; x < w; x++) | ||
318 | { | ||
319 | for (y = 0; y < h; y++) | ||
320 | { | ||
321 | heightmap.map[x, y] = (double)bs.ReadSingle(); | ||
322 | } | ||
323 | } | ||
324 | |||
325 | bs.Close(); | ||
326 | s.Close(); | ||
327 | |||
328 | tainted++; | ||
329 | } | ||
330 | |||
331 | /// <summary> | ||
332 | /// Loads a file formatted in the SL .RAW Format used on the main grid | ||
333 | /// </summary> | ||
334 | /// <remarks>This file format stinks and is best avoided.</remarks> | ||
335 | /// <param name="filename">A path to the .RAW format</param> | ||
336 | public void loadFromFileSLRAW(string filename) | ||
337 | { | ||
338 | System.IO.FileInfo file = new System.IO.FileInfo(filename); | ||
339 | System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read); | ||
340 | System.IO.BinaryReader bs = new System.IO.BinaryReader(s); | ||
341 | int x, y; | ||
342 | for (x = 0; x < w; x++) | ||
343 | { | ||
344 | for (y = 0; y < h; y++) | ||
345 | { | ||
346 | heightmap.map[x, y] = (double)bs.ReadByte() * ((double)bs.ReadByte() / 127.0); | ||
347 | bs.ReadBytes(11); // Advance the stream to next bytes. | ||
348 | } | ||
349 | } | ||
350 | |||
351 | bs.Close(); | ||
352 | s.Close(); | ||
353 | |||
354 | tainted++; | ||
355 | } | ||
356 | |||
357 | /// <summary> | ||
358 | /// Writes the current terrain heightmap to disk, in the format of a 65536 entry double[] array. | ||
359 | /// </summary> | ||
360 | /// <param name="filename">The desired output filename</param> | ||
361 | public void writeToFileF64(string filename) | ||
362 | { | ||
363 | System.IO.FileInfo file = new System.IO.FileInfo(filename); | ||
364 | System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); | ||
365 | System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); | ||
366 | |||
367 | int x, y; | ||
368 | for (x = 0; x < w; x++) | ||
369 | { | ||
370 | for (y = 0; y < h; y++) | ||
371 | { | ||
372 | bs.Write(heightmap.get(x, y)); | ||
373 | } | ||
374 | } | ||
375 | |||
376 | bs.Close(); | ||
377 | s.Close(); | ||
378 | } | ||
379 | |||
380 | /// <summary> | ||
381 | /// Writes the current terrain heightmap to disk, in the format of a 65536 entry float[] array | ||
382 | /// </summary> | ||
383 | /// <param name="filename">The desired output filename</param> | ||
384 | public void writeToFileF32(string filename) | ||
385 | { | ||
386 | System.IO.FileInfo file = new System.IO.FileInfo(filename); | ||
387 | System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write); | ||
388 | System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s); | ||
389 | |||
390 | int x, y; | ||
391 | for (x = 0; x < w; x++) | ||
392 | { | ||
393 | for (y = 0; y < h; y++) | ||
394 | { | ||
395 | bs.Write((float)heightmap.get(x, y)); | ||
396 | } | ||
397 | } | ||
398 | |||
399 | bs.Close(); | ||
400 | s.Close(); | ||
401 | } | ||
402 | |||
403 | /// <summary> | ||
404 | /// Sets the random seed to be used by procedural functions which involve random numbers. | ||
405 | /// </summary> | ||
406 | /// <param name="val">The desired seed</param> | ||
407 | public void setSeed(int val) | ||
408 | { | ||
409 | heightmap.seed = val; | ||
410 | } | ||
411 | |||
412 | /// <summary> | ||
413 | /// Raises land in a sphere around the specified coordinates | ||
414 | /// </summary> | ||
415 | /// <param name="rx">Center of the sphere on the X axis</param> | ||
416 | /// <param name="ry">Center of the sphere on the Y axis</param> | ||
417 | /// <param name="size">The radius of the sphere</param> | ||
418 | /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> | ||
419 | public void raise(double rx, double ry, double size, double amount) | ||
420 | { | ||
421 | lock (heightmap) | ||
422 | { | ||
423 | heightmap.raise(rx, ry, size, amount); | ||
424 | } | ||
425 | |||
426 | tainted++; | ||
427 | } | ||
428 | |||
429 | /// <summary> | ||
430 | /// Lowers the land in a sphere around the specified coordinates | ||
431 | /// </summary> | ||
432 | /// <param name="rx">The center of the sphere at the X axis</param> | ||
433 | /// <param name="ry">The center of the sphere at the Y axis</param> | ||
434 | /// <param name="size">The radius of the sphere in meters</param> | ||
435 | /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> | ||
436 | public void lower(double rx, double ry, double size, double amount) | ||
437 | { | ||
438 | lock (heightmap) | ||
439 | { | ||
440 | heightmap.lower(rx, ry, size, amount); | ||
441 | } | ||
442 | |||
443 | tainted++; | ||
444 | } | ||
445 | |||
446 | /// <summary> | ||
447 | /// Generates a simple set of hills in the shape of an island | ||
448 | /// </summary> | ||
449 | public void hills() | ||
450 | { | ||
451 | lock (heightmap) | ||
452 | { | ||
453 | heightmap.hillsSpheres(200, 20, 40, true, true, false); | ||
454 | heightmap.normalise(); | ||
455 | heightmap *= 60.0; // Raise to 60m | ||
456 | } | ||
457 | |||
458 | tainted++; | ||
459 | } | ||
460 | |||
461 | /// <summary> | ||
462 | /// Multiplies the heightfield by val | ||
463 | /// </summary> | ||
464 | /// <param name="meep">The heightfield</param> | ||
465 | /// <param name="val">The multiplier</param> | ||
466 | /// <returns></returns> | ||
467 | public static TerrainEngine operator *(TerrainEngine meep, Double val) | ||
468 | { | ||
469 | meep.heightmap *= val; | ||
470 | meep.tainted++; | ||
471 | return meep; | ||
472 | } | ||
473 | |||
474 | /// <summary> | ||
475 | /// Returns the height at the coordinates x,y | ||
476 | /// </summary> | ||
477 | /// <param name="x">X Coordinate</param> | ||
478 | /// <param name="y">Y Coordinate</param> | ||
479 | /// <returns></returns> | ||
480 | public float this[int x, int y] | ||
481 | { | ||
482 | get | ||
483 | { | ||
484 | return (float)heightmap.get(x, y); | ||
485 | } | ||
486 | set | ||
487 | { | ||
488 | tainted++; | ||
489 | heightmap.set(x, y, (double)value); | ||
490 | } | ||
491 | } | ||
492 | |||
493 | /// <summary> | ||
494 | /// Exports the current heightmap to a PNG file | ||
495 | /// </summary> | ||
496 | /// <param name="filename">The destination filename for the image</param> | ||
497 | /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> | ||
498 | public void exportImage(string filename, string gradientmap) | ||
499 | { | ||
500 | try | ||
501 | { | ||
502 | Bitmap gradientmapLd = new Bitmap(gradientmap); | ||
503 | |||
504 | int pallete = gradientmapLd.Height; | ||
505 | |||
506 | Bitmap bmp = new Bitmap(heightmap.w, heightmap.h); | ||
507 | Color[] colours = new Color[pallete]; | ||
508 | |||
509 | for (int i = 0; i < pallete; i++) | ||
510 | { | ||
511 | colours[i] = gradientmapLd.GetPixel(0, i); | ||
512 | } | ||
513 | |||
514 | Channel copy = heightmap.copy(); | ||
515 | for (int x = 0; x < copy.w; x++) | ||
516 | { | ||
517 | for (int y = 0; y < copy.h; y++) | ||
518 | { | ||
519 | // 512 is the largest possible height before colours clamp | ||
520 | int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(x, y) / 512.0), 0.0) * pallete); | ||
521 | bmp.SetPixel(y, 255 - x, colours[colorindex]); | ||
522 | } | ||
523 | } | ||
524 | |||
525 | bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png); | ||
526 | } | ||
527 | catch (Exception e) | ||
528 | { | ||
529 | Console.WriteLine("Failed generating terrain map: " + e.ToString()); | ||
530 | } | ||
531 | } | ||
532 | } | ||
533 | } \ No newline at end of file | ||
diff --git a/OpenSim/OpenSim/Application.cs b/OpenSim/OpenSim/Application.cs deleted file mode 100644 index dec0029..0000000 --- a/OpenSim/OpenSim/Application.cs +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.UserServer; | ||
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.RegionServer; | ||
35 | |||
36 | namespace OpenSim | ||
37 | { | ||
38 | public class Application | ||
39 | { | ||
40 | //could move our main function into OpenSimMain and kill this class | ||
41 | [STAThread] | ||
42 | public static void Main(string[] args) | ||
43 | { | ||
44 | try | ||
45 | { | ||
46 | Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); | ||
47 | Console.WriteLine("Starting...\n"); | ||
48 | |||
49 | bool sandBoxMode = false; | ||
50 | bool startLoginServer = false; | ||
51 | string physicsEngine = "basicphysics"; | ||
52 | bool allowFlying = false; | ||
53 | bool userAccounts = false; | ||
54 | bool gridLocalAsset = false; | ||
55 | bool useConfigFile = false; | ||
56 | bool silent = false; | ||
57 | string configFile = "simconfig.xml"; | ||
58 | |||
59 | for (int i = 0; i < args.Length; i++) | ||
60 | { | ||
61 | if (args[i] == "-sandbox") | ||
62 | { | ||
63 | sandBoxMode = true; | ||
64 | userAccounts = true; | ||
65 | startLoginServer = true; | ||
66 | } | ||
67 | /* | ||
68 | if (args[i] == "-loginserver") | ||
69 | { | ||
70 | startLoginServer = true; | ||
71 | }*/ | ||
72 | if (args[i] == "-accounts") | ||
73 | { | ||
74 | userAccounts = true; | ||
75 | } | ||
76 | if (args[i] == "-realphysx") | ||
77 | { | ||
78 | physicsEngine = "RealPhysX"; | ||
79 | allowFlying = true; | ||
80 | } | ||
81 | if (args[i] == "-ode") | ||
82 | { | ||
83 | physicsEngine = "OpenDynamicsEngine"; | ||
84 | allowFlying = true; | ||
85 | } | ||
86 | if (args[i] == "-localasset") | ||
87 | { | ||
88 | gridLocalAsset = true; | ||
89 | } | ||
90 | if (args[i] == "-configfile") | ||
91 | { | ||
92 | useConfigFile = true; | ||
93 | } | ||
94 | if (args[i] == "-noverbose") | ||
95 | { | ||
96 | silent = true; | ||
97 | } | ||
98 | if (args[i] == "-config") | ||
99 | { | ||
100 | try | ||
101 | { | ||
102 | i++; | ||
103 | configFile = args[i]; | ||
104 | } | ||
105 | catch (Exception e) | ||
106 | { | ||
107 | Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")"); | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | |||
112 | OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile); | ||
113 | // OpenSimRoot.Instance.Application = sim; | ||
114 | sim.m_sandbox = sandBoxMode; | ||
115 | sim.user_accounts = userAccounts; | ||
116 | sim.gridLocalAsset = gridLocalAsset; | ||
117 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = allowFlying; | ||
118 | |||
119 | sim.StartUp(); | ||
120 | |||
121 | while (true) | ||
122 | { | ||
123 | OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt(); | ||
124 | } | ||
125 | } | ||
126 | finally | ||
127 | { | ||
128 | /// Ensure that all sockets have been closed before the process closes. This helps ensure that no | ||
129 | /// open ports are left open on process that '<do not exist>'. This is in the finally block, as it | ||
130 | /// should be done regardless of whether a exception closes the application, or if the application | ||
131 | /// is closed normally. | ||
132 | |||
133 | OpenSim.Servers.SocketRegistry.UnregisterAllAndClose(); | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | } | ||
diff --git a/OpenSim/OpenSim/OpenSim.csproj b/OpenSim/OpenSim/OpenSim.csproj deleted file mode 100644 index f55735f..0000000 --- a/OpenSim/OpenSim/OpenSim.csproj +++ /dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{438A9556-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Exe</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Axiom.MathLib.dll" > | ||
62 | <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="Db4objects.Db4o.dll" > | ||
66 | <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="libsecondlife.dll" > | ||
70 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System" > | ||
74 | <HintPath>System.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
84 | <Name>OpenSim.Framework</Name> | ||
85 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
87 | <Private>False</Private> | ||
88 | </ProjectReference> | ||
89 | <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
90 | <Name>OpenSim.Framework.Console</Name> | ||
91 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
92 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
93 | <Private>False</Private> | ||
94 | </ProjectReference> | ||
95 | <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> | ||
96 | <Name>OpenSim.GenericConfig.Xml</Name> | ||
97 | <Project>{E88EF749-0000-0000-0000-000000000000}</Project> | ||
98 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
99 | <Private>False</Private> | ||
100 | </ProjectReference> | ||
101 | <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> | ||
102 | <Name>OpenSim.Physics.Manager</Name> | ||
103 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
104 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
105 | <Private>False</Private> | ||
106 | </ProjectReference> | ||
107 | <ProjectReference Include="..\OpenSim.RegionServer\OpenSim.RegionServer.csproj"> | ||
108 | <Name>OpenSim.RegionServer</Name> | ||
109 | <Project>{632E1BFD-0000-0000-0000-000000000000}</Project> | ||
110 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
111 | <Private>False</Private> | ||
112 | </ProjectReference> | ||
113 | <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> | ||
114 | <Name>OpenSim.Servers</Name> | ||
115 | <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> | ||
116 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
117 | <Private>False</Private> | ||
118 | </ProjectReference> | ||
119 | <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj"> | ||
120 | <Name>OpenSim.Terrain.BasicTerrain</Name> | ||
121 | <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> | ||
122 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
123 | <Private>False</Private> | ||
124 | </ProjectReference> | ||
125 | <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj"> | ||
126 | <Name>XMLRPC</Name> | ||
127 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | ||
128 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
129 | <Private>False</Private> | ||
130 | </ProjectReference> | ||
131 | </ItemGroup> | ||
132 | <ItemGroup> | ||
133 | <Compile Include="Application.cs"> | ||
134 | <SubType>Code</SubType> | ||
135 | </Compile> | ||
136 | <Compile Include="OpenSimMain.cs"> | ||
137 | <SubType>Code</SubType> | ||
138 | </Compile> | ||
139 | </ItemGroup> | ||
140 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
141 | <PropertyGroup> | ||
142 | <PreBuildEvent> | ||
143 | </PreBuildEvent> | ||
144 | <PostBuildEvent> | ||
145 | </PostBuildEvent> | ||
146 | </PropertyGroup> | ||
147 | </Project> | ||
diff --git a/OpenSim/OpenSim/OpenSim.exe.build b/OpenSim/OpenSim/OpenSim.exe.build deleted file mode 100644 index 784c9ca..0000000 --- a/OpenSim/OpenSim/OpenSim.exe.build +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim" 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="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe"> | ||
11 | <resources prefix="OpenSim" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="Application.cs" /> | ||
15 | <include name="OpenSimMain.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="../../bin/Axiom.MathLib.dll" /> | ||
23 | <include name="../../bin/Db4objects.Db4o.dll" /> | ||
24 | <include name="../../bin/libsecondlife.dll" /> | ||
25 | <include name="../../bin/OpenSim.Framework.dll" /> | ||
26 | <include name="../../bin/OpenSim.Framework.Console.dll" /> | ||
27 | <include name="../../bin/OpenSim.GenericConfig.Xml.dll" /> | ||
28 | <include name="../../bin/OpenSim.Physics.Manager.dll" /> | ||
29 | <include name="../../bin/OpenSim.RegionServer.dll" /> | ||
30 | <include name="../../bin/OpenSim.Servers.dll" /> | ||
31 | <include name="../../bin/OpenSim.Terrain.BasicTerrain.dll" /> | ||
32 | <include name="System.dll" /> | ||
33 | <include name="System.Xml.dll" /> | ||
34 | <include name="../../bin/XMLRPC.dll" /> | ||
35 | </references> | ||
36 | </csc> | ||
37 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
38 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
39 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
40 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
41 | <include name="*.dll"/> | ||
42 | <include name="*.exe"/> | ||
43 | </fileset> | ||
44 | </copy> | ||
45 | </target> | ||
46 | <target name="clean"> | ||
47 | <delete dir="${bin.dir}" failonerror="false" /> | ||
48 | <delete dir="${obj.dir}" failonerror="false" /> | ||
49 | </target> | ||
50 | <target name="doc" description="Creates documentation."> | ||
51 | </target> | ||
52 | </project> | ||
diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs deleted file mode 100644 index 0a316bd..0000000 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ /dev/null | |||
@@ -1,552 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Text; | ||
31 | using System.IO; | ||
32 | using System.Threading; | ||
33 | using System.Net; | ||
34 | using System.Net.Sockets; | ||
35 | using System.Timers; | ||
36 | using System.Reflection; | ||
37 | using System.Collections; | ||
38 | using System.Collections.Generic; | ||
39 | using libsecondlife; | ||
40 | using libsecondlife.Packets; | ||
41 | using OpenSim.RegionServer; | ||
42 | |||
43 | using OpenSim.RegionServer.Simulator; | ||
44 | using OpenSim.Terrain; | ||
45 | using OpenSim.Framework.Interfaces; | ||
46 | using OpenSim.Framework.Types; | ||
47 | using OpenSim.UserServer; | ||
48 | using OpenSim.RegionServer.Assets; | ||
49 | using OpenSim.RegionServer.CAPS; | ||
50 | using OpenSim.Framework.Console; | ||
51 | using OpenSim.Physics.Manager; | ||
52 | using Nwc.XmlRpc; | ||
53 | using OpenSim.Servers; | ||
54 | using OpenSim.GenericConfig; | ||
55 | |||
56 | namespace OpenSim | ||
57 | { | ||
58 | |||
59 | public class OpenSimMain : OpenSim.RegionServer.RegionServerBase, conscmd_callback | ||
60 | { | ||
61 | private CheckSumServer checkServer; | ||
62 | |||
63 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) | ||
64 | { | ||
65 | this.configFileSetup = useConfigFile; | ||
66 | m_sandbox = sandBoxMode; | ||
67 | m_loginserver = startLoginServer; | ||
68 | m_physicsEngine = physicsEngine; | ||
69 | m_config = configFile; | ||
70 | |||
71 | m_console = new ConsoleBase("region-console-" + Guid.NewGuid().ToString() + ".log", "Region", this, silent); | ||
72 | OpenSim.Framework.Console.MainConsole.Instance = m_console; | ||
73 | } | ||
74 | |||
75 | /// <summary> | ||
76 | /// Performs initialisation of the world, such as loading configuration from disk. | ||
77 | /// </summary> | ||
78 | public override void StartUp() | ||
79 | { | ||
80 | this.regionData = new RegionInfo(); | ||
81 | |||
82 | this.localConfig = new XmlConfig(m_config); | ||
83 | this.localConfig.LoadData(); | ||
84 | |||
85 | if (this.configFileSetup) | ||
86 | { | ||
87 | this.SetupFromConfigFile(this.localConfig); | ||
88 | } | ||
89 | m_console.Notice("Main.cs:Startup() - Loading configuration"); | ||
90 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); | ||
91 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change | ||
92 | |||
93 | GridServers = new Grid(); | ||
94 | if (m_sandbox) | ||
95 | { | ||
96 | this.SetupLocalGridServers(); | ||
97 | //Authenticate Session Handler | ||
98 | AuthenticateSessionsLocal authen = new AuthenticateSessionsLocal(); | ||
99 | this.AuthenticateSessionsHandler = authen; | ||
100 | this.checkServer = new CheckSumServer(12036); | ||
101 | this.checkServer.ServerListener(); | ||
102 | } | ||
103 | else | ||
104 | { | ||
105 | this.SetupRemoteGridServers(); | ||
106 | //Authenticate Session Handler | ||
107 | AuthenticateSessionsRemote authen = new AuthenticateSessionsRemote(); | ||
108 | this.AuthenticateSessionsHandler = authen; | ||
109 | } | ||
110 | |||
111 | startuptime = DateTime.Now; | ||
112 | |||
113 | |||
114 | AssetCache = new AssetCache(GridServers.AssetServer); | ||
115 | InventoryCache = new InventoryCache(); | ||
116 | |||
117 | |||
118 | m_udpServer = new UDPServer(this.regionData.IPListenPort, this.GridServers, this.AssetCache, this.InventoryCache, this.regionData, this.m_sandbox, this.user_accounts, this.m_console, this.AuthenticateSessionsHandler); | ||
119 | |||
120 | //should be passing a IGenericConfig object to these so they can read the config data they want from it | ||
121 | GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); | ||
122 | IGridServer gridServer = GridServers.GridServer; | ||
123 | gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey); | ||
124 | |||
125 | if (!m_sandbox) | ||
126 | { | ||
127 | this.ConnectToRemoteGridServer(); | ||
128 | } | ||
129 | |||
130 | this.SetupLocalWorld(); | ||
131 | |||
132 | if (m_sandbox) | ||
133 | { | ||
134 | AssetCache.LoadDefaultTextureSet(); | ||
135 | } | ||
136 | |||
137 | m_console.Notice("Main.cs:Startup() - Initialising HTTP server"); | ||
138 | |||
139 | this.SetupHttpListener(); | ||
140 | |||
141 | //Login server setup | ||
142 | LoginServer loginServer = null; | ||
143 | LoginServer adminLoginServer = null; | ||
144 | |||
145 | bool sandBoxWithLoginServer = m_loginserver && m_sandbox; | ||
146 | if (sandBoxWithLoginServer) | ||
147 | { | ||
148 | loginServer = new LoginServer(regionData.IPListenAddr, regionData.IPListenPort, regionData.RegionLocX, regionData.RegionLocY, this.user_accounts); | ||
149 | loginServer.Startup(); | ||
150 | loginServer.SetSessionHandler(((AuthenticateSessionsLocal)this.AuthenticateSessionsHandler).AddNewSession); | ||
151 | |||
152 | if (user_accounts) | ||
153 | { | ||
154 | //sandbox mode with loginserver using accounts | ||
155 | this.GridServers.UserServer = loginServer; | ||
156 | adminLoginServer = loginServer; | ||
157 | |||
158 | httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod); | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | //sandbox mode with loginserver not using accounts | ||
163 | httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); | ||
164 | } | ||
165 | } | ||
166 | |||
167 | //Web front end setup | ||
168 | AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer); | ||
169 | adminWebFront.LoadMethods(httpServer); | ||
170 | |||
171 | //Start http server | ||
172 | m_console.Notice("Main.cs:Startup() - Starting HTTP server"); | ||
173 | httpServer.Start(); | ||
174 | |||
175 | // Start UDP server | ||
176 | this.m_udpServer.ServerListener(); | ||
177 | |||
178 | //Setup Master Avatar | ||
179 | m_console.Notice("Main.cs:Startup() - Setting up Master Avatar"); | ||
180 | if (this.m_sandbox) | ||
181 | { | ||
182 | OpenSim.Framework.User.UserProfile masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName); | ||
183 | if (masterUser == null) | ||
184 | { | ||
185 | m_console.Notice("Main.cs:Startup() - Sandbox Mode; Master Avatar is a new user; creating account."); | ||
186 | adminLoginServer.CreateUserAccount(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName, this.regionData.MasterAvatarSandboxPassword); | ||
187 | masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName); | ||
188 | if (masterUser == null) //Still NULL?!!?! OMG FAIL! | ||
189 | { | ||
190 | throw new Exception("Failure to create master user account"); | ||
191 | } | ||
192 | } | ||
193 | m_console.Notice("Main.cs:Startup() - Master User UUID: " + masterUser.UUID.ToStringHyphenated()); | ||
194 | regionData.MasterAvatarAssignedUUID = masterUser.UUID; | ||
195 | |||
196 | } | ||
197 | else | ||
198 | { | ||
199 | m_console.Warn("Main.cs:Startup() - Grid Mode; Do not know how to get the user's master key yet!"); | ||
200 | } | ||
201 | |||
202 | m_console.Notice("Creating Estate Manager"); | ||
203 | LocalWorld.estateManager = new OpenSim.RegionServer.Estate.EstateManager(this.LocalWorld); | ||
204 | |||
205 | m_console.Notice("Creating Parcel Manager"); | ||
206 | LocalWorld.parcelManager = new OpenSim.RegionServer.Simulator.ParcelManager(this.LocalWorld); | ||
207 | |||
208 | m_console.Notice("Loading Parcels from DB..."); | ||
209 | LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); | ||
210 | |||
211 | m_heartbeatTimer.Enabled = true; | ||
212 | m_heartbeatTimer.Interval = 100; | ||
213 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | ||
214 | } | ||
215 | |||
216 | # region Setup methods | ||
217 | protected override void SetupLocalGridServers() | ||
218 | { | ||
219 | GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; | ||
220 | GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll"; | ||
221 | |||
222 | m_console.Notice("Starting in Sandbox mode"); | ||
223 | |||
224 | GridServers.Initialise(); | ||
225 | } | ||
226 | |||
227 | protected override void SetupRemoteGridServers() | ||
228 | { | ||
229 | if (this.gridLocalAsset) | ||
230 | { | ||
231 | GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; | ||
232 | } | ||
233 | else | ||
234 | { | ||
235 | GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
236 | } | ||
237 | GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
238 | |||
239 | m_console.Notice("Starting in Grid mode"); | ||
240 | |||
241 | |||
242 | GridServers.Initialise(); | ||
243 | |||
244 | } | ||
245 | |||
246 | protected override void SetupLocalWorld() | ||
247 | { | ||
248 | m_console.Status("Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); | ||
249 | m_console.Notice("Initialising world"); | ||
250 | m_console.componentname = "Region " + regionData.RegionName; | ||
251 | |||
252 | m_localWorld = new World(this.m_udpServer.PacketServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); | ||
253 | LocalWorld.InventoryCache = InventoryCache; | ||
254 | LocalWorld.AssetCache = AssetCache; | ||
255 | |||
256 | this.m_udpServer.LocalWorld = LocalWorld; | ||
257 | this.m_udpServer.PacketServer.RegisterClientPacketHandlers(); | ||
258 | |||
259 | this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); | ||
260 | this.physManager.LoadPlugins(); | ||
261 | |||
262 | LocalWorld.m_datastore = this.regionData.DataStore; | ||
263 | |||
264 | LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. | ||
265 | LocalWorld.LoadWorldMap(); | ||
266 | |||
267 | m_console.Notice("Main.cs:Startup() - Starting up messaging system"); | ||
268 | LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); | ||
269 | LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); | ||
270 | LocalWorld.LoadPrimsFromStorage(); | ||
271 | } | ||
272 | |||
273 | protected override void SetupHttpListener() | ||
274 | { | ||
275 | httpServer = new BaseHttpServer(regionData.IPListenPort); | ||
276 | |||
277 | if (this.GridServers.GridServer.GetName() == "Remote") | ||
278 | { | ||
279 | |||
280 | // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server | ||
281 | httpServer.AddXmlRPCHandler("expect_user", ((AuthenticateSessionsRemote)this.AuthenticateSessionsHandler).ExpectUser); | ||
282 | |||
283 | httpServer.AddXmlRPCHandler("agent_crossing", | ||
284 | delegate(XmlRpcRequest request) | ||
285 | { | ||
286 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
287 | uint circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | ||
288 | |||
289 | AgentCircuitData agent_data = new AgentCircuitData(); | ||
290 | agent_data.firstname = (string)requestData["firstname"]; | ||
291 | agent_data.lastname = (string)requestData["lastname"]; | ||
292 | agent_data.circuitcode = circuitcode; | ||
293 | agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"])); | ||
294 | |||
295 | AuthenticateSessionsHandler.UpdateAgentData(agent_data); | ||
296 | |||
297 | return new XmlRpcResponse(); | ||
298 | }); | ||
299 | |||
300 | httpServer.AddRestHandler("GET", "/simstatus/", | ||
301 | delegate(string request, string path, string param) | ||
302 | { | ||
303 | return "OK"; | ||
304 | }); | ||
305 | } | ||
306 | } | ||
307 | |||
308 | protected override void ConnectToRemoteGridServer() | ||
309 | { | ||
310 | if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort)) | ||
311 | { | ||
312 | m_console.Notice("Main.cs:Startup() - Success: Got a grid connection OK!"); | ||
313 | } | ||
314 | else | ||
315 | { | ||
316 | m_console.Error("Main.cs:Startup() - FAILED: Unable to get connection to grid. Shutting down."); | ||
317 | Shutdown(); | ||
318 | } | ||
319 | |||
320 | GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]); | ||
321 | |||
322 | // If we are being told to load a file, load it. | ||
323 | string dataUri = (string)((RemoteGridBase)GridServers.GridServer).GridData["data_uri"]; | ||
324 | |||
325 | if (!String.IsNullOrEmpty(dataUri)) | ||
326 | { | ||
327 | this.LocalWorld.m_datastore = dataUri; | ||
328 | } | ||
329 | |||
330 | if (((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString() != "") | ||
331 | { | ||
332 | // The grid server has told us who we are | ||
333 | // We must obey the grid server. | ||
334 | |||
335 | regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); | ||
336 | regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); | ||
337 | regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); | ||
338 | |||
339 | |||
340 | } | ||
341 | } | ||
342 | |||
343 | #endregion | ||
344 | |||
345 | private void SetupFromConfigFile(IGenericConfig configData) | ||
346 | { | ||
347 | |||
348 | // SandBoxMode | ||
349 | string attri = ""; | ||
350 | attri = configData.GetAttribute("SandBox"); | ||
351 | if ((attri == "") || ((attri != "false") && (attri != "true"))) | ||
352 | { | ||
353 | this.m_sandbox = false; | ||
354 | configData.SetAttribute("SandBox", "false"); | ||
355 | } | ||
356 | else | ||
357 | { | ||
358 | this.m_sandbox = Convert.ToBoolean(attri); | ||
359 | } | ||
360 | |||
361 | // LoginServer | ||
362 | attri = ""; | ||
363 | attri = configData.GetAttribute("LoginServer"); | ||
364 | if ((attri == "") || ((attri != "false") && (attri != "true"))) | ||
365 | { | ||
366 | this.m_loginserver = false; | ||
367 | configData.SetAttribute("LoginServer", "false"); | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | this.m_loginserver = Convert.ToBoolean(attri); | ||
372 | } | ||
373 | |||
374 | // Sandbox User accounts | ||
375 | attri = ""; | ||
376 | attri = configData.GetAttribute("UserAccount"); | ||
377 | if ((attri == "") || ((attri != "false") && (attri != "true"))) | ||
378 | { | ||
379 | this.user_accounts = false; | ||
380 | configData.SetAttribute("UserAccounts", "false"); | ||
381 | } | ||
382 | else if (attri == "true") | ||
383 | { | ||
384 | this.user_accounts = Convert.ToBoolean(attri); | ||
385 | } | ||
386 | |||
387 | // Grid mode hack to use local asset server | ||
388 | attri = ""; | ||
389 | attri = configData.GetAttribute("LocalAssets"); | ||
390 | if ((attri == "") || ((attri != "false") && (attri != "true"))) | ||
391 | { | ||
392 | this.gridLocalAsset = false; | ||
393 | configData.SetAttribute("LocalAssets", "false"); | ||
394 | } | ||
395 | else if (attri == "true") | ||
396 | { | ||
397 | this.gridLocalAsset = Convert.ToBoolean(attri); | ||
398 | } | ||
399 | |||
400 | |||
401 | attri = ""; | ||
402 | attri = configData.GetAttribute("PhysicsEngine"); | ||
403 | switch (attri) | ||
404 | { | ||
405 | default: | ||
406 | m_console.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); | ||
407 | Environment.Exit(1); | ||
408 | break; | ||
409 | |||
410 | case "": | ||
411 | this.m_physicsEngine = "basicphysics"; | ||
412 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
413 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false; | ||
414 | break; | ||
415 | |||
416 | case "basicphysics": | ||
417 | this.m_physicsEngine = "basicphysics"; | ||
418 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
419 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false; | ||
420 | break; | ||
421 | |||
422 | case "RealPhysX": | ||
423 | this.m_physicsEngine = "RealPhysX"; | ||
424 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true; | ||
425 | break; | ||
426 | |||
427 | case "OpenDynamicsEngine": | ||
428 | this.m_physicsEngine = "OpenDynamicsEngine"; | ||
429 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true; | ||
430 | break; | ||
431 | } | ||
432 | |||
433 | configData.Commit(); | ||
434 | } | ||
435 | |||
436 | /// <summary> | ||
437 | /// Performs any last-minute sanity checking and shuts down the region server | ||
438 | /// </summary> | ||
439 | public virtual void Shutdown() | ||
440 | { | ||
441 | m_console.Notice("Main.cs:Shutdown() - Closing all threads"); | ||
442 | m_console.Notice("Main.cs:Shutdown() - Killing listener thread"); | ||
443 | m_console.Notice("Main.cs:Shutdown() - Killing clients"); | ||
444 | // IMPLEMENT THIS | ||
445 | m_console.Notice("Main.cs:Shutdown() - Closing console and terminating"); | ||
446 | LocalWorld.Close(); | ||
447 | GridServers.Close(); | ||
448 | m_console.Close(); | ||
449 | Environment.Exit(0); | ||
450 | } | ||
451 | |||
452 | /// <summary> | ||
453 | /// Performs per-frame updates regularly | ||
454 | /// </summary> | ||
455 | /// <param name="sender"></param> | ||
456 | /// <param name="e"></param> | ||
457 | void Heartbeat(object sender, System.EventArgs e) | ||
458 | { | ||
459 | LocalWorld.Update(); | ||
460 | } | ||
461 | |||
462 | #region Console Commands | ||
463 | /// <summary> | ||
464 | /// Runs commands issued by the server console from the operator | ||
465 | /// </summary> | ||
466 | /// <param name="command">The first argument of the parameter (the command)</param> | ||
467 | /// <param name="cmdparams">Additional arguments passed to the command</param> | ||
468 | public void RunCmd(string command, string[] cmdparams) | ||
469 | { | ||
470 | switch (command) | ||
471 | { | ||
472 | case "help": | ||
473 | m_console.Error("show users - show info about connected users"); | ||
474 | m_console.Error("shutdown - disconnect all clients and shutdown"); | ||
475 | m_console.Error("backup - start a backup manually"); | ||
476 | break; | ||
477 | |||
478 | case "show": | ||
479 | Show(cmdparams[0]); | ||
480 | break; | ||
481 | |||
482 | case "terrain": | ||
483 | string result = ""; | ||
484 | if (!LocalWorld.Terrain.RunTerrainCmd(cmdparams, ref result)) | ||
485 | { | ||
486 | m_console.Error(result); | ||
487 | } | ||
488 | break; | ||
489 | |||
490 | case "shutdown": | ||
491 | Shutdown(); | ||
492 | break; | ||
493 | |||
494 | case "backup": | ||
495 | LocalWorld.Backup(); | ||
496 | break; | ||
497 | |||
498 | case "reset": | ||
499 | if (cmdparams[0] == "parcels") | ||
500 | { | ||
501 | LocalWorld.localStorage.RemoveAllParcels(); | ||
502 | LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); | ||
503 | } | ||
504 | break; | ||
505 | |||
506 | default: | ||
507 | m_console.Error("Unknown command"); | ||
508 | break; | ||
509 | } | ||
510 | } | ||
511 | |||
512 | /// <summary> | ||
513 | /// Outputs to the console information about the region | ||
514 | /// </summary> | ||
515 | /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param> | ||
516 | public void Show(string ShowWhat) | ||
517 | { | ||
518 | switch (ShowWhat) | ||
519 | { | ||
520 | case "uptime": | ||
521 | m_console.Error("OpenSim has been running since " + startuptime.ToString()); | ||
522 | m_console.Error("That is " + (DateTime.Now - startuptime).ToString()); | ||
523 | break; | ||
524 | case "users": | ||
525 | OpenSim.RegionServer.Simulator.Avatar TempAv; | ||
526 | m_console.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); | ||
527 | foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) | ||
528 | { | ||
529 | if (LocalWorld.Entities[UUID].ToString() == "OpenSim.RegionServer.Simulator.Avatar") | ||
530 | { | ||
531 | TempAv = (OpenSim.RegionServer.Simulator.Avatar)LocalWorld.Entities[UUID]; | ||
532 | m_console.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); | ||
533 | } | ||
534 | } | ||
535 | break; | ||
536 | case "parcels": | ||
537 | foreach (OpenSim.RegionServer.Simulator.Parcel parcel in LocalWorld.parcelManager.parcelList.Values) | ||
538 | { | ||
539 | m_console.Error("Parcel ID#" + parcel.parcelData.localID + "(Global UUID: " + parcel.parcelData.globalID + "):"); | ||
540 | m_console.Error("\tParcel Name: " + parcel.parcelData.parcelName); | ||
541 | m_console.Error("\tParcel Owner UUID: " + parcel.parcelData.ownerID); | ||
542 | m_console.Error("\tParcel Area: " + parcel.parcelData.area + "sqm"); | ||
543 | m_console.Error(" "); | ||
544 | } | ||
545 | break; | ||
546 | } | ||
547 | } | ||
548 | #endregion | ||
549 | } | ||
550 | |||
551 | |||
552 | } \ No newline at end of file | ||