diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 1b3bb1835f..3d31ba6940 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -72,7 +72,7 @@ namespace OpenSim.Framework.Communications.Caches /// public AssetCache(IAssetServer assetServer) { - Console.WriteLine("Creating Asset cache"); + System.Console.WriteLine("Creating Asset cache"); _assetServer = assetServer; _assetServer.SetReceiver(this); Assets = new Dictionary(); @@ -89,7 +89,7 @@ namespace OpenSim.Framework.Communications.Caches public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) { - Console.WriteLine("Creating Asset cache"); + System.Console.WriteLine("Creating Asset cache"); _assetServer = this.LoadAssetDll(assetServerDLLName); _assetServer.SetServerInfo(assetServerURL, assetServerKey); _assetServer.SetReceiver(this); @@ -119,7 +119,7 @@ namespace OpenSim.Framework.Communications.Caches } catch (Exception e) { - Console.WriteLine(e.Message + " : " + e.StackTrace); + System.Console.WriteLine(e.Message + " : " + e.StackTrace); } } } diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs similarity index 94% rename from OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs rename to OpenSim/Framework/Communications/Cache/AssetServer.cs index 835212e643..fd203f743c 100644 --- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs @@ -1,403 +1,392 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.IO; -using System.Threading; -using Db4objects.Db4o; -using Db4objects.Db4o.Query; -using libsecondlife; -using Nini.Config; -using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Utilities; - -namespace OpenSim.Region.GridInterfaces.Local -{ - public class LocalAssetPlugin : IAssetPlugin - { - public LocalAssetPlugin() - { - - } - - public IAssetServer GetAssetServer() - { - return (new LocalAssetServer()); - } - } - - public class LocalAssetServer : IAssetServer - { - private IAssetReceiver _receiver; - private BlockingQueue _assetRequests; - private IObjectContainer db; - private Thread _localAssetServerThread; - - public LocalAssetServer() - { - bool yapfile; - this._assetRequests = new BlockingQueue(); - yapfile = File.Exists(Path.Combine(Util.dataDir(),"regionassets.yap")); - - MainLog.Instance.Verbose("Local Asset Server class created"); - db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(),"regionassets.yap")); - MainLog.Instance.Verbose("Db4 Asset database creation"); - - if (!yapfile) - { - this.SetUpAssetDatabase(); - } - - this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); - this._localAssetServerThread.IsBackground = true; - this._localAssetServerThread.Start(); - - } - - public void SetReceiver(IAssetReceiver receiver) - { - this._receiver = receiver; - } - - public void RequestAsset(LLUUID assetID, bool isTexture) - { - ARequest req = new ARequest(); - req.AssetID = assetID; - req.IsTexture = isTexture; - this._assetRequests.Enqueue(req); - } - - public void UpdateAsset(AssetBase asset) - { - - } - - public void UploadNewAsset(AssetBase asset) - { - AssetStorage store = new AssetStorage(); - store.Data = asset.Data; - store.Name = asset.Name; - store.UUID = asset.FullID; - db.Set(store); - db.Commit(); - } - - public void SetServerInfo(string ServerUrl, string ServerKey) - { - - } - public void Close() - { - if (db != null) - { - MainLog.Instance.Verbose("Closing local asset server database"); - db.Close(); - } - } - - private void RunRequests() - { - while (true) - { - byte[] idata = null; - bool found = false; - AssetStorage foundAsset = null; - ARequest req = this._assetRequests.Dequeue(); - IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); - if (result.Count > 0) - { - foundAsset = (AssetStorage)result.Next(); - found = true; - } - - AssetBase asset = new AssetBase(); - if (found) - { - asset.FullID = foundAsset.UUID; - asset.Type = foundAsset.Type; - asset.InvType = foundAsset.Type; - asset.Name = foundAsset.Name; - idata = foundAsset.Data; - asset.Data = idata; - _receiver.AssetReceived(asset, req.IsTexture); - } - else - { - //asset.FullID = ; - _receiver.AssetNotFound(req.AssetID); - } - - } - - } - - private void SetUpAssetDatabase() - { - MainLog.Instance.Verbose("Setting up asset database"); - - AssetBase Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); - Image.Name = "Bricks"; - this.LoadAsset(Image, true, "bricks.jp2"); - AssetStorage store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); - Image.Name = "Plywood"; - this.LoadAsset(Image, true, "plywood.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); - Image.Name = "Rocks"; - this.LoadAsset(Image, true, "rocks.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); - Image.Name = "Granite"; - this.LoadAsset(Image, true, "granite.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); - Image.Name = "Hardwood"; - this.LoadAsset(Image, true, "hardwood.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); - Image.Name = "Prim Base Texture"; - this.LoadAsset(Image, true, "plywood.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); - Image.Name = "Map Base Texture"; - this.LoadAsset(Image, true, "map_base.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); - Image.Name = "Map Texture"; - this.LoadAsset(Image, true, "map1.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); - Image.Name = "Female Body Texture"; - this.LoadAsset(Image, true, "femalebody.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); - Image.Name = "Female Bottom Texture"; - this.LoadAsset(Image, true, "femalebottom.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); - Image.Name = "Female Face Texture"; - this.LoadAsset(Image, true, "femaleface.jp2"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); - Image.Name = "Skin"; - Image.Type = 13; - Image.InvType = 13; - this.LoadAsset(Image, false, "base_skin.dat"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - - Image = new AssetBase(); - Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); - Image.Name = "Shape"; - Image.Type = 13; - Image.InvType = 13; - this.LoadAsset(Image, false, "base_shape.dat"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); - Image.Name = "Shirt"; - Image.Type = 5; - Image.InvType = 18; - this.LoadAsset(Image, false, "newshirt.dat"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - Image = new AssetBase(); - Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); - Image.Name = "Shirt"; - Image.Type = 5; - Image.InvType = 18; - this.LoadAsset(Image, false, "newpants.dat"); - store = new AssetStorage(); - store.Data = Image.Data; - store.Name = Image.Name; - store.UUID = Image.FullID; - db.Set(store); - db.Commit(); - - string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); - if(File.Exists(filePath)) - { - XmlConfigSource source = new XmlConfigSource(filePath); - ReadAssetDetails(source); - } - } - - protected void ReadAssetDetails(IConfigSource source) - { - AssetBase newAsset = null; - for (int i = 0; i < source.Configs.Count; i++) - { - newAsset = new AssetBase(); - newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); - newAsset.Name = source.Configs[i].GetString("name", ""); - newAsset.Type =(sbyte) source.Configs[i].GetInt("assetType", 0); - newAsset.InvType =(sbyte) source.Configs[i].GetInt("inventoryType", 0); - string fileName = source.Configs[i].GetString("fileName", ""); - if (fileName != "") - { - this.LoadAsset(newAsset, false, fileName); - AssetStorage store = new AssetStorage(); - store.Data = newAsset.Data; - store.Name = newAsset.Name; - store.UUID = newAsset.FullID; - db.Set(store); - db.Commit(); - } - } - } - - private void LoadAsset(AssetBase info, bool image, string filename) - { - //should request Asset from storage manager - //but for now read from file - - string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; - string fileName = Path.Combine(dataPath, filename); - FileInfo fInfo = new FileInfo(fileName); - long numBytes = fInfo.Length; - FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); - byte[] idata = new byte[numBytes]; - BinaryReader br = new BinaryReader(fStream); - idata = br.ReadBytes((int)numBytes); - br.Close(); - fStream.Close(); - info.Data = idata; - //info.loaded=true; - } - } - public class AssetUUIDQuery : Predicate - { - private LLUUID _findID; - - public AssetUUIDQuery(LLUUID find) - { - _findID = find; - } - public bool Match(AssetStorage asset) - { - return (asset.UUID == _findID); - } - } - -} +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.IO; +using System.Threading; +using Db4objects.Db4o; +using Db4objects.Db4o.Query; +using libsecondlife; +using Nini.Config; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Utilities; + +namespace OpenSim.Framework.Communications.Caches +{ + + public class LocalAssetServer : IAssetServer + { + private IAssetReceiver _receiver; + private BlockingQueue _assetRequests; + private IObjectContainer db; + private Thread _localAssetServerThread; + + public LocalAssetServer() + { + bool yapfile; + this._assetRequests = new BlockingQueue(); + yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); + + MainLog.Instance.Verbose("Local Asset Server class created"); + db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); + MainLog.Instance.Verbose("Db4 Asset database creation"); + + if (!yapfile) + { + this.SetUpAssetDatabase(); + } + + this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); + this._localAssetServerThread.IsBackground = true; + this._localAssetServerThread.Start(); + + } + + public void SetReceiver(IAssetReceiver receiver) + { + this._receiver = receiver; + } + + public void RequestAsset(LLUUID assetID, bool isTexture) + { + ARequest req = new ARequest(); + req.AssetID = assetID; + req.IsTexture = isTexture; + this._assetRequests.Enqueue(req); + } + + public void UpdateAsset(AssetBase asset) + { + + } + + public void UploadNewAsset(AssetBase asset) + { + AssetStorage store = new AssetStorage(); + store.Data = asset.Data; + store.Name = asset.Name; + store.UUID = asset.FullID; + db.Set(store); + db.Commit(); + } + + public void SetServerInfo(string ServerUrl, string ServerKey) + { + + } + public void Close() + { + if (db != null) + { + MainLog.Instance.Verbose("Closing local asset server database"); + db.Close(); + } + } + + private void RunRequests() + { + while (true) + { + byte[] idata = null; + bool found = false; + AssetStorage foundAsset = null; + ARequest req = this._assetRequests.Dequeue(); + IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); + if (result.Count > 0) + { + foundAsset = (AssetStorage)result.Next(); + found = true; + } + + AssetBase asset = new AssetBase(); + if (found) + { + asset.FullID = foundAsset.UUID; + asset.Type = foundAsset.Type; + asset.InvType = foundAsset.Type; + asset.Name = foundAsset.Name; + idata = foundAsset.Data; + asset.Data = idata; + _receiver.AssetReceived(asset, req.IsTexture); + } + else + { + //asset.FullID = ; + _receiver.AssetNotFound(req.AssetID); + } + + } + + } + + private void SetUpAssetDatabase() + { + MainLog.Instance.Verbose("Setting up asset database"); + + AssetBase Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); + Image.Name = "Bricks"; + this.LoadAsset(Image, true, "bricks.jp2"); + AssetStorage store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); + Image.Name = "Plywood"; + this.LoadAsset(Image, true, "plywood.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); + Image.Name = "Rocks"; + this.LoadAsset(Image, true, "rocks.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); + Image.Name = "Granite"; + this.LoadAsset(Image, true, "granite.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); + Image.Name = "Hardwood"; + this.LoadAsset(Image, true, "hardwood.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); + Image.Name = "Prim Base Texture"; + this.LoadAsset(Image, true, "plywood.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); + Image.Name = "Map Base Texture"; + this.LoadAsset(Image, true, "map_base.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); + Image.Name = "Map Texture"; + this.LoadAsset(Image, true, "map1.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); + Image.Name = "Female Body Texture"; + this.LoadAsset(Image, true, "femalebody.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); + Image.Name = "Female Bottom Texture"; + this.LoadAsset(Image, true, "femalebottom.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); + Image.Name = "Female Face Texture"; + this.LoadAsset(Image, true, "femaleface.jp2"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); + Image.Name = "Skin"; + Image.Type = 13; + Image.InvType = 13; + this.LoadAsset(Image, false, "base_skin.dat"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + + Image = new AssetBase(); + Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); + Image.Name = "Shape"; + Image.Type = 13; + Image.InvType = 13; + this.LoadAsset(Image, false, "base_shape.dat"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); + Image.Name = "Shirt"; + Image.Type = 5; + Image.InvType = 18; + this.LoadAsset(Image, false, "newshirt.dat"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + Image = new AssetBase(); + Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); + Image.Name = "Shirt"; + Image.Type = 5; + Image.InvType = 18; + this.LoadAsset(Image, false, "newpants.dat"); + store = new AssetStorage(); + store.Data = Image.Data; + store.Name = Image.Name; + store.UUID = Image.FullID; + db.Set(store); + db.Commit(); + + string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); + if (File.Exists(filePath)) + { + XmlConfigSource source = new XmlConfigSource(filePath); + ReadAssetDetails(source); + } + } + + protected void ReadAssetDetails(IConfigSource source) + { + AssetBase newAsset = null; + for (int i = 0; i < source.Configs.Count; i++) + { + newAsset = new AssetBase(); + newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); + newAsset.Name = source.Configs[i].GetString("name", ""); + newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0); + newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); + string fileName = source.Configs[i].GetString("fileName", ""); + if (fileName != "") + { + this.LoadAsset(newAsset, false, fileName); + AssetStorage store = new AssetStorage(); + store.Data = newAsset.Data; + store.Name = newAsset.Name; + store.UUID = newAsset.FullID; + db.Set(store); + db.Commit(); + } + } + } + + private void LoadAsset(AssetBase info, bool image, string filename) + { + //should request Asset from storage manager + //but for now read from file + + string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; + string fileName = Path.Combine(dataPath, filename); + FileInfo fInfo = new FileInfo(fileName); + long numBytes = fInfo.Length; + FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); + byte[] idata = new byte[numBytes]; + BinaryReader br = new BinaryReader(fStream); + idata = br.ReadBytes((int)numBytes); + br.Close(); + fStream.Close(); + info.Data = idata; + //info.loaded=true; + } + } + public class AssetUUIDQuery : Predicate + { + private LLUUID _findID; + + public AssetUUIDQuery(LLUUID find) + { + _findID = find; + } + public bool Match(AssetStorage asset) + { + return (asset.UUID == _findID); + } + } + +} + diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs index a599a19a75..07d7cf4ed7 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs @@ -70,7 +70,7 @@ namespace OpenSim.Framework.Communications.Caches } else { - Console.WriteLine("CACHE", "User profile for user not found"); + System.Console.WriteLine("CACHE", "User profile for user not found"); } } } diff --git a/OpenSim/Framework/General/Types/PrimData.cs b/OpenSim/Framework/General/Types/PrimData.cs deleted file mode 100644 index 9b24c0f1b1..0000000000 --- a/OpenSim/Framework/General/Types/PrimData.cs +++ /dev/null @@ -1,228 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using libsecondlife; - -namespace OpenSim.Framework.Types -{ - public class PrimData - { - private const uint FULL_MASK_PERMISSIONS = 2147483647; - - public LLUUID OwnerID; - public byte PCode; - public ushort PathBegin; - public ushort PathEnd; - public byte PathScaleX; - public byte PathScaleY; - public byte PathShearX; - public byte PathShearY; - public sbyte PathSkew; - public ushort ProfileBegin; - public ushort ProfileEnd; - public LLVector3 Scale; - public byte PathCurve; - public byte ProfileCurve; - public uint ParentID = 0; - public ushort ProfileHollow; - public sbyte PathRadiusOffset; - public byte PathRevolutions; - public sbyte PathTaperX; - public sbyte PathTaperY; - public sbyte PathTwist; - public sbyte PathTwistBegin; - public byte[] TextureEntry; // a LL textureEntry in byte[] format - - public Int32 CreationDate; - public uint OwnerMask = FULL_MASK_PERMISSIONS; - public uint NextOwnerMask = FULL_MASK_PERMISSIONS; - public uint GroupMask = FULL_MASK_PERMISSIONS; - public uint EveryoneMask = FULL_MASK_PERMISSIONS; - public uint BaseMask = FULL_MASK_PERMISSIONS; - - //following only used during prim storage - public LLVector3 Position; - public LLQuaternion Rotation = new LLQuaternion(0, 1, 0, 0); - public uint LocalID; - public LLUUID FullID; - - public PrimData() - { - - } - - public PrimData(byte[] data) - { - int i = 0; - - this.OwnerID = new LLUUID(data, i); i += 16; - this.PCode = data[i++]; - this.PathBegin = (ushort)(data[i++] + (data[i++] << 8)); - this.PathEnd = (ushort)(data[i++] + (data[i++] << 8)); - this.PathScaleX = data[i++]; - this.PathScaleY = data[i++]; - this.PathShearX = data[i++]; - this.PathShearY = data[i++]; - this.PathSkew = (sbyte)data[i++]; - this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8)); - this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8)); - this.Scale = new LLVector3(data, i); i += 12; - this.PathCurve = data[i++]; - this.ProfileCurve = data[i++]; - this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); - this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8)); - this.PathRadiusOffset = (sbyte)data[i++]; - this.PathRevolutions = data[i++]; - this.PathTaperX = (sbyte)data[i++]; - this.PathTaperY = (sbyte)data[i++]; - this.PathTwist = (sbyte)data[i++]; - this.PathTwistBegin = (sbyte)data[i++]; - ushort length = (ushort)(data[i++] + (data[i++] << 8)); - this.TextureEntry = new byte[length]; - Array.Copy(data, i, TextureEntry, 0, length); i += length; - this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); - this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); - this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); - this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); - this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); - this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); - this.Position = new LLVector3(data, i); i += 12; - this.Rotation = new LLQuaternion(data, i, true); i += 12; - this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); - this.FullID = new LLUUID(data, i); i += 16; - - } - - public byte[] ToBytes() - { - int i = 0; - byte[] bytes = new byte[126 + TextureEntry.Length]; - Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; - bytes[i++] = this.PCode; - bytes[i++] = (byte)(this.PathBegin % 256); - bytes[i++] = (byte)((this.PathBegin >> 8) % 256); - bytes[i++] = (byte)(this.PathEnd % 256); - bytes[i++] = (byte)((this.PathEnd >> 8) % 256); - bytes[i++] = this.PathScaleX; - bytes[i++] = this.PathScaleY; - bytes[i++] = this.PathShearX; - bytes[i++] = this.PathShearY; - bytes[i++] = (byte)this.PathSkew; - bytes[i++] = (byte)(this.ProfileBegin % 256); - bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256); - bytes[i++] = (byte)(this.ProfileEnd % 256); - bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256); - Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12; - bytes[i++] = this.PathCurve; - bytes[i++] = this.ProfileCurve; - bytes[i++] = (byte)(ParentID % 256); - bytes[i++] = (byte)((ParentID >> 8) % 256); - bytes[i++] = (byte)((ParentID >> 16) % 256); - bytes[i++] = (byte)((ParentID >> 24) % 256); - bytes[i++] = (byte)(this.ProfileHollow % 256); - bytes[i++] = (byte)((this.ProfileHollow >> 8) % 256); - bytes[i++] = ((byte)this.PathRadiusOffset); - bytes[i++] = this.PathRevolutions; - bytes[i++] = ((byte)this.PathTaperX); - bytes[i++] = ((byte)this.PathTaperY); - bytes[i++] = ((byte)this.PathTwist); - bytes[i++] = ((byte)this.PathTwistBegin); - bytes[i++] = (byte)(TextureEntry.Length % 256); - bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256); - Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length; - bytes[i++] = (byte)(this.CreationDate % 256); - bytes[i++] = (byte)((this.CreationDate >> 8) % 256); - bytes[i++] = (byte)((this.CreationDate >> 16) % 256); - bytes[i++] = (byte)((this.CreationDate >> 24) % 256); - bytes[i++] = (byte)(this.OwnerMask % 256); - bytes[i++] = (byte)((this.OwnerMask >> 8) % 256); - bytes[i++] = (byte)((this.OwnerMask >> 16) % 256); - bytes[i++] = (byte)((this.OwnerMask >> 24) % 256); - bytes[i++] = (byte)(this.NextOwnerMask % 256); - bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256); - bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256); - bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256); - bytes[i++] = (byte)(this.GroupMask % 256); - bytes[i++] = (byte)((this.GroupMask >> 8) % 256); - bytes[i++] = (byte)((this.GroupMask >> 16) % 256); - bytes[i++] = (byte)((this.GroupMask >> 24) % 256); - bytes[i++] = (byte)(this.EveryoneMask % 256); - bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256); - bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256); - bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256); - bytes[i++] = (byte)(this.BaseMask % 256); - bytes[i++] = (byte)((this.BaseMask >> 8) % 256); - bytes[i++] = (byte)((this.BaseMask >> 16) % 256); - bytes[i++] = (byte)((this.BaseMask >> 24) % 256); - Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12; - if (this.Rotation == new LLQuaternion(0, 0, 0, 0)) - { - this.Rotation = new LLQuaternion(0, 1, 0, 0); - } - Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12; - bytes[i++] = (byte)(this.LocalID % 256); - bytes[i++] = (byte)((this.LocalID >> 8) % 256); - bytes[i++] = (byte)((this.LocalID >> 16) % 256); - bytes[i++] = (byte)((this.LocalID >> 24) % 256); - Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16; - - return bytes; - } - - //public static PrimData DefaultCube() - //{ - // PrimData primData = new PrimData(); - // primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - // primData.FullID = LLUUID.Random(); - // primData.Scale = new LLVector3(0.5f, 0.5f, 0.5f); - // primData.Rotation = new LLQuaternion(0, 0, 0, 1); - // primData.PCode = 9; - // primData.ParentID = 0; - // primData.PathBegin = 0; - // primData.PathEnd = 0; - // primData.PathScaleX = 0; - // primData.PathScaleY = 0; - // primData.PathShearX = 0; - // primData.PathShearY = 0; - // primData.PathSkew = 0; - // primData.ProfileBegin = 0; - // primData.ProfileEnd = 0; - // primData.PathCurve = 16; - // primData.ProfileCurve = 1; - // primData.ProfileHollow = 0; - // primData.PathRadiusOffset = 0; - // primData.PathRevolutions = 0; - // primData.PathTaperX = 0; - // primData.PathTaperY = 0; - // primData.PathTwist = 0; - // primData.PathTwistBegin = 0; - - // return primData; - //} - } -} diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs index c567aa6a94..b7dff17365 100644 --- a/OpenSim/Framework/General/Types/RegionInfo.cs +++ b/OpenSim/Framework/General/Types/RegionInfo.cs @@ -216,7 +216,7 @@ namespace OpenSim.Framework.Types configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Simulator Name", "OpenSim Test", false); configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); - configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "localworld.yap", false); + configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", "9000", false); configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); diff --git a/OpenSim/Framework/General/UserProfile.cs b/OpenSim/Framework/General/UserProfile.cs deleted file mode 100644 index ec5a485213..0000000000 --- a/OpenSim/Framework/General/UserProfile.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System.Collections.Generic; -using System.Security.Cryptography; -using libsecondlife; -using OpenSim.Framework.Inventory; - -namespace OpenSim.Framework.User -{ - public class UserProfile - { - - public string firstname; - public string lastname; - public ulong homeregionhandle; - public LLVector3 homepos; - public LLVector3 homelookat; - - public bool IsGridGod = false; - public bool IsLocal = true; // will be used in future for visitors from foreign grids - public string AssetURL; - public string MD5passwd; - - public LLUUID CurrentSessionID; - public LLUUID CurrentSecureSessionID; - public LLUUID UUID; - public Dictionary Circuits = new Dictionary(); // tracks circuit codes - - public AgentInventory Inventory; - - public UserProfile() - { - Circuits = new Dictionary(); - Inventory = new AgentInventory(); - homeregionhandle = Helpers.UIntsToLong((1000 * 256), (1000 * 256)); - homepos = new LLVector3(); - homelookat = new LLVector3(); - } - - public void InitSessionData() - { - RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); - - byte[] randDataS = new byte[16]; - byte[] randDataSS = new byte[16]; - - rand.GetBytes(randDataS); - rand.GetBytes(randDataSS); - - CurrentSecureSessionID = new LLUUID(randDataSS,0); - CurrentSessionID = new LLUUID(randDataS,0); - - } - - public void AddSimCircuit(uint circuitCode, LLUUID regionUUID) - { - if (this.Circuits.ContainsKey(regionUUID) == false) - this.Circuits.Add(regionUUID, circuitCode); - } - - } -} diff --git a/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs deleted file mode 100644 index 989df26e93..0000000000 --- a/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs +++ /dev/null @@ -1,138 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System.Collections; -using libsecondlife; -using Nwc.XmlRpc; -using OpenSim.Framework.Servers; - -namespace OpenSim.Framework.Manager -{ - /// - /// Used to pass messages to the gridserver - /// - /// Pass this argument - public delegate void GridManagerCallback(string param); - - /// - /// Serverside listener for grid commands - /// - public class GridManagementAgent - { - /// - /// Passes grid server messages - /// - private GridManagerCallback thecallback; - - /// - /// Security keys - /// - private string sendkey; - private string recvkey; - - /// - /// Our component type - /// - private string component_type; - - /// - /// List of active sessions - /// - private static ArrayList Sessions; - - /// - /// Initialises a new GridManagementAgent - /// - /// HTTP Daemon for this server - /// What component type are we? - /// Security send key - /// Security recieve key - /// Message callback - public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) - { - this.sendkey = sendkey; - this.recvkey = recvkey; - this.component_type = component_type; - this.thecallback = thecallback; - Sessions = new ArrayList(); - - app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod); - - switch (component_type) - { - case "gridserver": - GridServerManager.sendkey = this.sendkey; - GridServerManager.recvkey = this.recvkey; - GridServerManager.thecallback = thecallback; - app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); - break; - } - } - - /// - /// Checks if a session exists - /// - /// The session ID - /// Exists? - public static bool SessionExists(LLUUID sessionID) - { - return Sessions.Contains(sessionID); - } - - /// - /// Logs a new session to the grid manager - /// - /// the XMLRPC request - /// An XMLRPC reply - public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - // TODO: Switch this over to using OpenSim.Framework.Data - if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) - { - response.IsFault = false; - LLUUID new_session = LLUUID.Random(); - Sessions.Add(new_session); - responseData["session_id"] = new_session.ToString(); - responseData["msg"] = "Login OK"; - } - else - { - response.IsFault = true; - responseData["error"] = "Invalid username or password"; - } - - response.Value = responseData; - return response; - - } - - } -} diff --git a/OpenSim/Grid/Framework.Manager/GridServerManager.cs b/OpenSim/Grid/Framework.Manager/GridServerManager.cs deleted file mode 100644 index 729e42b637..0000000000 --- a/OpenSim/Grid/Framework.Manager/GridServerManager.cs +++ /dev/null @@ -1,93 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using System; -using System.Collections; -using System.Threading; -using libsecondlife; -using Nwc.XmlRpc; - -namespace OpenSim.Framework.Manager { - - /// - /// A remote management system for the grid server - /// - public class GridServerManager - { - /// - /// Triggers events from the grid manager - /// - public static GridManagerCallback thecallback; - - /// - /// Security keys - /// - public static string sendkey; - public static string recvkey; - - /// - /// Disconnects the grid server and shuts it down - /// - /// XmlRpc Request - /// An XmlRpc response containing either a "msg" or an "error" - public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - if(requestData.ContainsKey("session_id")) { - if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { - responseData["msg"]="Shutdown command accepted"; - (new Thread(new ThreadStart(ShutdownServer))).Start(); - } else { - response.IsFault=true; - responseData["error"]="bad session ID"; - } - } else { - response.IsFault=true; - responseData["error"]="no session ID"; - } - - response.Value = responseData; - return response; - } - - /// - /// Shuts down the grid server - /// - public static void ShutdownServer() - { - Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); - Console.WriteLine("Terminating in three seconds..."); - Thread.Sleep(3000); - thecallback("shutdown"); - } - } -} - diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 82bbd57593..289f77a47d 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -34,7 +34,6 @@ using libsecondlife; using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; -using OpenSim.Framework.User; using OpenSim.Framework.Utilities; using OpenSim.Framework.Configuration; @@ -49,8 +48,6 @@ namespace OpenSim.Grid.UserServer public UserManager m_userManager; public UserLoginService m_loginService; - public Dictionary UserSessions = new Dictionary(); - LogBase m_console; [STAThread] diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 955f17952a..ec660f3ae9 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -231,7 +231,11 @@ namespace OpenSim protected override void Initialize() { m_httpServerPort = m_networkServersInfo.HttpListenerPort; - m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); + + LocalAssetServer assetServer = new LocalAssetServer(); + assetServer.SetServerInfo(m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); + m_assetCache = new AssetCache(assetServer); + // m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); } protected override LogBase CreateLog() diff --git a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs deleted file mode 100644 index 6a05ba2d31..0000000000 --- a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs +++ /dev/null @@ -1,357 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Utilities; -using OpenSim.Framework.Communications.Caches; - - -namespace OpenSim.Region.ClientStack -{ - partial class ClientView - { - public class AgentAssetUpload - { - private Dictionary transactions = new Dictionary(); - private ClientView ourClient; - private AssetCache m_assetCache; - // private InventoryCache m_inventoryCache; - - public AgentAssetUpload(ClientView client, AssetCache assetCache ) - { - this.ourClient = client; - m_assetCache = assetCache; - // m_inventoryCache = inventoryCache; - } - - public void AddUpload(LLUUID transactionID, AssetBase asset) - { - AssetTransaction upload = new AssetTransaction(); - lock (this.transactions) - { - upload.Asset = asset; - upload.TransactionID = transactionID; - this.transactions.Add(transactionID, upload); - } - if (upload.Asset.Data.Length > 2) - { - //is complete - upload.UploadComplete = true; - AssetUploadCompletePacket response = new AssetUploadCompletePacket(); - response.AssetBlock.Type = asset.Type; - response.AssetBlock.Success = true; - response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID); - this.ourClient.OutPacket(response); - m_assetCache.AddAsset(asset); - } - else - { - upload.UploadComplete = false; - upload.XferID = Util.GetNextXferID(); - RequestXferPacket xfer = new RequestXferPacket(); - xfer.XferID.ID = upload.XferID; - xfer.XferID.VFileType = upload.Asset.Type; - xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID); - xfer.XferID.FilePath = 0; - xfer.XferID.Filename = new byte[0]; - this.ourClient.OutPacket(xfer); - } - - } - - public AssetBase GetUpload(LLUUID transactionID) - { - if (this.transactions.ContainsKey(transactionID)) - { - return this.transactions[transactionID].Asset; - } - - return null; - } - - public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID) - { - // Console.Write("asset upload request , type = " + pack.AssetBlock.Type.ToString()); - AssetBase asset = null; - if (pack.AssetBlock.Type == 0) - { - - //first packet for transaction - asset = new AssetBase(); - asset.FullID = assetID; - asset.Type = pack.AssetBlock.Type; - asset.InvType = asset.Type; - asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); - asset.Data = pack.AssetBlock.AssetData; - - - } - else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7) - { - - asset = new AssetBase(); - asset.FullID = assetID; - // Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated()); - asset.Type = pack.AssetBlock.Type; - asset.InvType = asset.Type; - asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000"); - asset.Data = pack.AssetBlock.AssetData; - - - } - - if (asset != null) - { - this.AddUpload(pack.AssetBlock.TransactionID, asset); - } - else - { - - //currently we don't support this asset type - //so lets just tell the client that the upload is complete - AssetUploadCompletePacket response = new AssetUploadCompletePacket(); - response.AssetBlock.Type = pack.AssetBlock.Type; - response.AssetBlock.Success = true; - response.AssetBlock.UUID = pack.AssetBlock.TransactionID.Combine(this.ourClient.SecureSessionID); - this.ourClient.OutPacket(response); - } - - } - - #region Xfer packet system for larger uploads - - public void HandleXferPacket(SendXferPacketPacket xferPacket) - { - lock (this.transactions) - { - foreach (AssetTransaction trans in this.transactions.Values) - { - if (trans.XferID == xferPacket.XferID.ID) - { - if (trans.Asset.Data.Length > 1) - { - byte[] newArray = new byte[trans.Asset.Data.Length + xferPacket.DataPacket.Data.Length]; - Array.Copy(trans.Asset.Data, 0, newArray, 0, trans.Asset.Data.Length); - Array.Copy(xferPacket.DataPacket.Data, 0, newArray, trans.Asset.Data.Length, xferPacket.DataPacket.Data.Length); - trans.Asset.Data = newArray; - } - else - { - byte[] newArray = new byte[xferPacket.DataPacket.Data.Length - 4]; - Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length - 4); - trans.Asset.Data = newArray; - } - - if ((xferPacket.XferID.Packet & 2147483648) != 0) - { - //end of transfer - trans.UploadComplete = true; - AssetUploadCompletePacket response = new AssetUploadCompletePacket(); - response.AssetBlock.Type = trans.Asset.Type; - response.AssetBlock.Success = true; - response.AssetBlock.UUID = trans.TransactionID.Combine(this.ourClient.SecureSessionID); - this.ourClient.OutPacket(response); - - m_assetCache.AddAsset(trans.Asset); - //check if we should add it to inventory - if (trans.AddToInventory) - { - // m_assetCache.AddAsset(trans.Asset); - //m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); - } - - - } - break; - } - - } - } - - ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket(); - confirmXfer.XferID.ID = xferPacket.XferID.ID; - confirmXfer.XferID.Packet = xferPacket.XferID.Packet; - this.ourClient.OutPacket(confirmXfer); - } - - #endregion - - public AssetBase AddUploadToAssetCache(LLUUID transactionID) - { - AssetBase asset = null; - if (this.transactions.ContainsKey(transactionID)) - { - AssetTransaction trans = this.transactions[transactionID]; - if (trans.UploadComplete) - { - m_assetCache.AddAsset(trans.Asset); - asset = trans.Asset; - } - } - - return asset; - } - - public void CreateInventoryItem(CreateInventoryItemPacket packet) - { - if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID)) - { - AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID]; - trans.Asset.Description = Util.FieldToString(packet.InventoryBlock.Description); - trans.Asset.Name = Util.FieldToString(packet.InventoryBlock.Name); - trans.Asset.Type = packet.InventoryBlock.Type; - trans.Asset.InvType = packet.InventoryBlock.InvType; - if (trans.UploadComplete) - { - //already complete so we can add it to the inventory - //m_assetCache.AddAsset(trans.Asset); - // m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset); - } - else - { - trans.AddToInventory = true; - trans.InventFolder = packet.InventoryBlock.FolderID; - } - } - } - - private class AssetTransaction - { - public uint XferID; - public AssetBase Asset; - public bool AddToInventory; - public LLUUID InventFolder = LLUUID.Zero; - public bool UploadComplete = false; - public LLUUID TransactionID = LLUUID.Zero; - - public AssetTransaction() - { - - } - } - - //new class , not currently used. - public class AssetXferUploader - { - private IClientAPI ourClient; - - public bool UploadComplete = false; - - public bool AddToInventory; - public LLUUID InventFolder = LLUUID.Zero; - - public uint XferID; - public AssetBase Asset; - public LLUUID TransactionID = LLUUID.Zero; - - - public AssetXferUploader(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data) - { - ourClient = remoteClient; - Asset = new AssetBase(); - Asset.FullID = assetID; - Asset.InvType = type; - Asset.Type = type; - Asset.Data = data; - Asset.Name = "blank"; - Asset.Description = "empty"; - TransactionID = transaction; - - if (Asset.Data.Length > 2) - { - //data block should only have data in it, if there is no more data to be uploaded - this.SendCompleteMessage(); - } - else - { - this.ReqestStartXfer(); - } - } - - protected void SendCompleteMessage() - { - UploadComplete = true; - AssetUploadCompletePacket response = new AssetUploadCompletePacket(); - response.AssetBlock.Type = Asset.Type; - response.AssetBlock.Success = true; - response.AssetBlock.UUID = Asset.FullID; - this.ourClient.OutPacket(response); - - //TODO trigger event - } - - protected void ReqestStartXfer() - { - UploadComplete = false; - XferID = Util.GetNextXferID(); - RequestXferPacket xfer = new RequestXferPacket(); - xfer.XferID.ID = XferID; - xfer.XferID.VFileType = Asset.Type; - xfer.XferID.VFileID = Asset.FullID; - xfer.XferID.FilePath = 0; - xfer.XferID.Filename = new byte[0]; - this.ourClient.OutPacket(xfer); - } - - public void HandleXferPacket(uint xferID, uint packetID, byte[] data) - { - if (XferID == xferID) - { - if (Asset.Data.Length > 1) - { - byte[] newArray = new byte[Asset.Data.Length + data.Length]; - Array.Copy(Asset.Data, 0, newArray, 0, Asset.Data.Length); - Array.Copy(data, 0, newArray, Asset.Data.Length, data.Length); - Asset.Data = newArray; - } - else - { - byte[] newArray = new byte[data.Length - 4]; - Array.Copy(data, 4, newArray, 0, data.Length - 4); - Asset.Data = newArray; - } - - ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket(); - confirmXfer.XferID.ID = xferID; - confirmXfer.XferID.Packet = packetID; - this.ourClient.OutPacket(confirmXfer); - - if ((packetID & 2147483648) != 0) - { - this.SendCompleteMessage(); - } - } - } - } - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs b/OpenSim/Region/Environment/Scenes/Primitive(Old).cs deleted file mode 100644 index 0efa570acd..0000000000 --- a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs +++ /dev/null @@ -1,724 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml; -using System.Xml.Serialization; -using Axiom.Math; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Inventory; -using OpenSim.Framework.Types; - -using InventoryItem = OpenSim.Framework.Inventory.InventoryItem; - -namespace OpenSim.Region.Environment.Scenes -{ - public delegate void PrimCountTaintedDelegate(); - - public class Primitive : EntityBase - { - private const uint FULL_MASK_PERMISSIONS = 2147483647; - - private LLVector3 m_positionLastFrame = new LLVector3(0, 0, 0); - private ulong m_regionHandle; - private byte m_updateFlag; - private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; - - private Dictionary m_inventoryItems; - - private string m_description = ""; - - public LLUUID CreatorID; - public LLUUID OwnerID; - public LLUUID LastOwnerID; - - public Int32 CreationDate; - - public uint ParentID = 0; - - public uint OwnerMask = FULL_MASK_PERMISSIONS; - public uint NextOwnerMask = FULL_MASK_PERMISSIONS; - public uint GroupMask = 0;// FULL_MASK_PERMISSIONS; - public uint EveryoneMask = 0;//FULL_MASK_PERMISSIONS; - public uint BaseMask = 0;//FULL_MASK_PERMISSIONS; - - private PrimitiveBaseShape m_shape; - private byte[] m_particleSystem = new byte[0]; - - public SceneObjectOLD m_RootParent; - public bool m_isRootPrim; - public EntityBase m_Parent; - - public event PrimCountTaintedDelegate OnPrimCountTainted; - - #region Properties - - /// - /// If rootprim, will return world position - /// otherwise will return local offset from rootprim - /// - public override LLVector3 AbsolutePosition - { - get - { - if (m_isRootPrim) - { - //if we are rootprim then our offset should be zero - return m_pos + m_Parent.AbsolutePosition; - } - else - { - return m_pos; - } - } - set - { - if (m_isRootPrim) - { - m_Parent.AbsolutePosition = value; - } - m_pos = value - m_Parent.AbsolutePosition; - } - } - - public PrimitiveBaseShape Shape - { - get { return m_shape; } - } - - public LLVector3 WorldPos - { - get - { - if (!m_isRootPrim) - { - Primitive parentPrim = (Primitive)m_Parent; - Vector3 offsetPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z); - offsetPos = parentPrim.Rotation * offsetPos; - return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z); - } - else - { - return AbsolutePosition; - } - } - } - - public string Description - { - get { return m_description; } - set { m_description = value; } - } - - public LLVector3 Scale - { - set { m_shape.Scale = value; } - get { return m_shape.Scale; } - } - - private string m_sitName = ""; - public string SitName - { - get { return m_sitName; } - } - - private string m_touchName = ""; - public string TouchName - { - get { return m_touchName; } - } - - private string m_text = ""; - public string Text - { - get { return m_text; } - set - { - m_text = value; - ScheduleFullUpdate(); - } - } - - #endregion - - #region Constructors - - public Primitive(ulong regionHandle, Scene scene, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, - SceneObjectOLD rootObject, PrimitiveBaseShape shape, LLVector3 pos) - { - m_regionHandle = regionHandle; - m_scene = scene; - m_inventoryItems = new Dictionary(); - m_Parent = parent; - m_isRootPrim = isRoot; - m_RootParent = rootObject; - ClearUpdateSchedule(); - CreateFromShape(ownerID, localID, pos, shape); - - Rotation = Quaternion.Identity; - - m_scene.AcknowledgeNewPrim(this); - - OnPrimCountTainted(); - } - - /// - /// - /// - /// Empty constructor for duplication - public Primitive() - { - } - - #endregion - - #region Destructors - - ~Primitive() - { - if (OnPrimCountTainted != null) - OnPrimCountTainted(); - } - - #endregion - - #region Duplication - - public Primitive Copy(EntityBase parent, SceneObjectOLD rootParent) - { - Primitive dupe = (Primitive)MemberwiseClone(); - - dupe.m_Parent = parent; - dupe.m_RootParent = rootParent; - - // TODO: Copy this properly. - - dupe.m_inventoryItems = m_inventoryItems; - dupe.m_children = new List(); - dupe.m_shape = m_shape.Copy(); - dupe.m_regionHandle = m_regionHandle; - dupe.m_scene = m_scene; - - - uint newLocalID = m_scene.PrimIDAllocate(); - dupe.m_uuid = LLUUID.Random(); - dupe.LocalId = newLocalID; - - if (parent is SceneObjectGroup) - { - dupe.m_isRootPrim = true; - dupe.ParentID = 0; - } - else - { - dupe.m_isRootPrim = false; - dupe.ParentID = ((Primitive)parent).LocalId; - } - - dupe.Scale = new LLVector3(Scale.X, Scale.Y, Scale.Z); - dupe.Rotation = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z); - dupe.m_pos = new LLVector3(m_pos.X, m_pos.Y, m_pos.Z); - - rootParent.AddChildToList(dupe); - m_scene.AcknowledgeNewPrim(dupe); - dupe.TriggerOnPrimCountTainted(); - - - foreach (Primitive prim in m_children) - { - Primitive primClone = prim.Copy(dupe, rootParent); - - dupe.m_children.Add(primClone); - } - - return dupe; - } - - #endregion - - #region Override from EntityBase - - /// - /// - /// - public override void Update() - { - if (m_updateFlag == 1) //some change has been made so update the clients - { - SendTerseUpdateToALLClients(); - ClearUpdateSchedule(); - } - else - { - if (m_updateFlag == 2) // is a new prim just been created/reloaded or has major changes - { - SendFullUpdateToAllClients(); - ClearUpdateSchedule(); - } - } - - foreach (EntityBase child in m_children) - { - child.Update(); - } - } - - private void ClearUpdateSchedule() - { - m_updateFlag = 0; - } - - #endregion - - #region Setup - - /// - /// - /// - /// - /// - /// - public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) - { - CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - OwnerID = ownerID; - CreatorID = OwnerID; - LastOwnerID = LLUUID.Zero; - AbsolutePosition = pos; - m_uuid = LLUUID.Random(); - m_localId = (uint)(localID); - - m_shape = shape; - - ScheduleFullUpdate(); - } - - private void ScheduleFullUpdate() - { - m_updateFlag = 2; - } - - private void ScheduleTerseUpdate() - { - if (m_updateFlag < 1) - { - m_updateFlag = 1; - } - } - - #endregion - - #region Linking / unlinking - - /// - /// - /// - /// - public void AddNewChildren(SceneObjectOLD linkObject) - { - // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); - //TODO check permissions - - m_children.Add(linkObject.rootPrimitive); - linkObject.rootPrimitive.SetNewParent(this, m_RootParent); - - m_scene.DeleteEntity(linkObject.rootUUID); - linkObject.DeleteAllChildren(); - - OnPrimCountTainted(); - } - - /// - /// - /// - /// - /// - public void SetNewParent(Primitive newParent, SceneObjectOLD rootParent) - { - LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); - m_isRootPrim = false; - m_Parent = newParent; - ParentID = newParent.LocalId; - m_RootParent = rootParent; - m_RootParent.AddChildToList(this); - AbsolutePosition = oldPos; - Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z); - axPos = m_Parent.Rotation.Inverse() * axPos; - m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); - Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z); - Rotation = m_Parent.Rotation.Inverse() * Rotation; - ScheduleFullUpdate(); - - - foreach (Primitive child in m_children) - { - child.SetRootParent(rootParent, newParent, oldPos, oldRot); - } - - m_children.Clear(); - - } - - /// - /// - /// - /// - public void SetRootParent(SceneObjectOLD newRoot, Primitive newParent, LLVector3 oldParentPosition, - Quaternion oldParentRotation) - { - LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); - Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z); - axOldPos = oldParentRotation * axOldPos; - oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); - oldPos += oldParentPosition; - Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z); - m_isRootPrim = false; - m_Parent = newParent; - ParentID = newParent.LocalId; - newParent.AddToChildrenList(this); - - m_RootParent = newRoot; - m_RootParent.AddChildToList(this); - AbsolutePosition = oldPos; - Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z); - axPos = m_Parent.Rotation.Inverse() * axPos; - m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); - Rotation = oldParentRotation * Rotation; - Rotation = m_Parent.Rotation.Inverse() * Rotation; - ScheduleFullUpdate(); - foreach (Primitive child in m_children) - { - child.SetRootParent(newRoot, newParent, oldPos, oldRot); - } - - m_children.Clear(); - - } - - /// - /// - /// - /// - public void AddOffsetToChildren(LLVector3 offset) - { - foreach (Primitive prim in m_children) - { - prim.m_pos += offset; - prim.ScheduleTerseUpdate(); - } - OnPrimCountTainted(); - } - - /// - /// - /// - /// - public void AddToChildrenList(Primitive prim) - { - m_children.Add(prim); - } - - #endregion - - #region Resizing/Scale - - /// - /// - /// - /// - public void ResizeGoup(LLVector3 scale) - { - m_shape.Scale = scale; - - ScheduleFullUpdate(); - } - - #endregion - - #region Position - - /// - /// - /// - /// - public void UpdateGroupPosition(LLVector3 pos) - { - LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); - - AbsolutePosition = newPos; - ScheduleTerseUpdate(); - - OnPrimCountTainted(); - } - - /// - /// - /// - /// - public void UpdateSinglePosition(LLVector3 pos) - { - // Console.WriteLine("updating single prim position"); - if (m_isRootPrim) - { - LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); - LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); - LLVector3 diff = oldPos - newPos; - Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); - axDiff = Rotation.Inverse() * axDiff; - diff.X = axDiff.x; - diff.Y = axDiff.y; - diff.Z = axDiff.z; - AbsolutePosition = newPos; - - foreach (Primitive prim in m_children) - { - prim.m_pos += diff; - prim.ScheduleTerseUpdate(); - } - ScheduleTerseUpdate(); - } - else - { - LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); - m_pos = newPos; - ScheduleTerseUpdate(); - } - } - - #endregion - - #region Rotation - - /// - /// - /// - /// - public void UpdateGroupRotation(LLQuaternion rot) - { - Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); - ScheduleTerseUpdate(); - } - - /// - /// - /// - /// - /// - public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) - { - Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); - AbsolutePosition = pos; - ScheduleTerseUpdate(); - } - - /// - /// - /// - /// - public void UpdateSingleRotation(LLQuaternion rot) - { - //Console.WriteLine("updating single prim rotation"); - - Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); - Quaternion oldParentRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z); - Rotation = axRot; - foreach (Primitive prim in m_children) - { - Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z); - axPos = oldParentRot * axPos; - axPos = axRot.Inverse() * axPos; - prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); - prim.Rotation = oldParentRot * prim.Rotation; - prim.Rotation = axRot.Inverse() * prim.Rotation; - prim.ScheduleTerseUpdate(); - } - ScheduleTerseUpdate(); - } - - #endregion - - #region Shape - - /// - /// - /// - /// - public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) - { - m_shape.PathBegin = shapeBlock.PathBegin; - m_shape.PathEnd = shapeBlock.PathEnd; - m_shape.PathScaleX = shapeBlock.PathScaleX; - m_shape.PathScaleY = shapeBlock.PathScaleY; - m_shape.PathShearX = shapeBlock.PathShearX; - m_shape.PathShearY = shapeBlock.PathShearY; - m_shape.PathSkew = shapeBlock.PathSkew; - m_shape.ProfileBegin = shapeBlock.ProfileBegin; - m_shape.ProfileEnd = shapeBlock.ProfileEnd; - m_shape.PathCurve = shapeBlock.PathCurve; - m_shape.ProfileCurve = shapeBlock.ProfileCurve; - m_shape.ProfileHollow = shapeBlock.ProfileHollow; - m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; - m_shape.PathRevolutions = shapeBlock.PathRevolutions; - m_shape.PathTaperX = shapeBlock.PathTaperX; - m_shape.PathTaperY = shapeBlock.PathTaperY; - m_shape.PathTwist = shapeBlock.PathTwist; - m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; - ScheduleFullUpdate(); - } - - #endregion - - #region Inventory - public void GetInventory(IClientAPI client, uint localID) - { - if (localID == this.m_localId) - { - client.SendTaskInventory(this.m_uuid, 0, new byte[0]); - } - } - #endregion - - public void UpdateExtraParam(ushort type, bool inUse, byte[] data) - { - this.m_shape.ExtraParams = new byte[data.Length + 7]; - int i =0; - uint length = (uint) data.Length; - this.m_shape.ExtraParams[i++] = 1; - this.m_shape.ExtraParams[i++] = (byte)(type % 256); - this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256); - - this.m_shape.ExtraParams[i++] = (byte)(length % 256); - this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256); - this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256); - this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256); - Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length); - - this.ScheduleFullUpdate(); - } - - #region Texture - - /// - /// - /// - /// - public void UpdateTextureEntry(byte[] textureEntry) - { - m_shape.TextureEntry = textureEntry; - ScheduleFullUpdate(); - } - - #endregion - - public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem) - { - this.m_particleSystem = pSystem.GetBytes(); - ScheduleFullUpdate(); - } - - #region Client Update Methods - - /// - /// - /// - /// - public void SendFullUpdateForAllChildren(IClientAPI remoteClient) - { - - SendFullUpdateToClient(remoteClient); - for (int i = 0; i < m_children.Count; i++) - - { - - if (m_children[i] is Primitive) - { - ((Primitive)m_children[i]).SendFullUpdateForAllChildren(remoteClient); - } - } - } - - /// - /// - /// - /// - public void SendFullUpdateToClient(IClientAPI remoteClient) - { - LLVector3 lPos; - lPos = AbsolutePosition; - LLQuaternion lRot; - lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w); - - remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalId, m_shape, lPos, m_flags, m_uuid, OwnerID, - m_text, ParentID, this.m_particleSystem, lRot); - } - - /// - /// - /// - public void SendFullUpdateToAllClients() - { - List avatars = m_scene.RequestAvatarList(); - for (int i = 0; i < avatars.Count; i++) - { - SendFullUpdateToClient(avatars[i].ControllingClient); - } - } - - /// - /// - /// - /// - public void SendTerseUpdateForAllChildren(IClientAPI remoteClient) - { - - SendTerseUpdateToClient(remoteClient); - for (int i = 0; i < m_children.Count; i++) - { - if (m_children[i] is Primitive) - { - ((Primitive)m_children[i]).SendTerseUpdateForAllChildren(remoteClient); - } - } - } - - /// - /// - /// - /// - public void SendTerseUpdateToClient(IClientAPI RemoteClient) - { - LLVector3 lPos; - Quaternion lRot; - - lPos = AbsolutePosition; - lRot = Rotation; - - LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); - RemoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalId, lPos, mRot); - } - - /// - /// - /// - public void SendTerseUpdateToALLClients() - { - List avatars = m_scene.RequestAvatarList(); - for (int i = 0; i < avatars.Count; i++) - { - SendTerseUpdateToClient(avatars[i].ControllingClient); - } - } - - #endregion - - public void TriggerOnPrimCountTainted() - { - OnPrimCountTainted(); - } - - public override void SetText(string text, Vector3 color, double alpha) - { - throw new Exception("The method or operation is not implemented."); - } - } -} \ No newline at end of file diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index e0fd4596b4..16cd484a52 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -281,11 +281,9 @@ namespace OpenSim.Region.Environment.Scenes bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); ((SceneObjectGroup)ent).GetProperites(remoteClient); - } } } - } } } @@ -301,7 +299,6 @@ namespace OpenSim.Region.Environment.Scenes { DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; - if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) { //currently following code not used (or don't know of any case of destination being zero @@ -421,8 +418,6 @@ namespace OpenSim.Region.Environment.Scenes new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); } - - } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 49ba655518..1fca71973d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -513,13 +513,7 @@ namespace OpenSim.Region.Environment.Scenes MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); } - /// - /// Loads a specific object from storage - /// - /// The object to load - public void PrimFromStorage(PrimData prim) - { - } + /// /// Returns a new unallocated primitive ID @@ -603,7 +597,7 @@ namespace OpenSim.Region.Environment.Scenes /// Called by a prim when it has been created/cloned, so that its events can be subscribed to /// /// - public void AcknowledgeNewPrim(Primitive prim) + public void AcknowledgeNewPrim(SceneObjectGroup prim) { prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; } diff --git a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs deleted file mode 100644 index 6f06b5a7ef..0000000000 --- a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs +++ /dev/null @@ -1,319 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using System.Xml.Serialization; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Physics.Manager; - -namespace OpenSim.Region.Environment.Scenes -{ - public class SceneObjectOLD : EntityBase - { - private Encoding enc = Encoding.ASCII; - private Dictionary ChildPrimitives = new Dictionary(); //list of all primitive id's that are part of this group - public Primitive rootPrimitive; - protected ulong m_regionHandle; - - private EventManager m_eventManager; - - public bool isSelected = false; - - public LLUUID rootUUID - { - get - { - this.m_uuid = this.rootPrimitive.m_uuid; - return this.m_uuid; - } - } - - public uint rootLocalID - { - get - { - this.m_localId = this.rootPrimitive.LocalId; - return this.LocalId; - } - } - - public int primCount - { - get - { - return this.ChildPrimitives.Count; - } - } - - public Dictionary Children - { - get - { - return this.ChildPrimitives; - } - } - - /// - /// - /// - public SceneObjectOLD(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) - { - m_regionHandle = world.RegionInfo.RegionHandle; - m_scene = world; - m_eventManager = eventManager; - - this.AbsolutePosition = pos; - this.CreateRootFromShape(ownerID, localID, shape, pos); - - registerEvents(); - } - - /// - /// - /// - /// Need a null constructor for duplication - public SceneObjectOLD() - { - - } - - public void registerEvents() - { - m_eventManager.OnBackup += new EventManager.OnBackupDelegate(ProcessBackup); - m_eventManager.OnParcelPrimCountUpdate += new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate); - } - - public void unregisterEvents() - { - m_eventManager.OnBackup -= new EventManager.OnBackupDelegate(ProcessBackup); - m_eventManager.OnParcelPrimCountUpdate -= new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate); - } - - /// - /// Processes backup - /// - /// - public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore) - { - // datastore.StoreObject(this); - } - - /// - /// Sends my primitive info to the land manager for it to keep tally of all of the prims! - /// - private void ProcessParcelPrimCountUpdate() - { - - // m_eventManager.TriggerParcelPrimCountAdd(this); - } - - /// - /// - /// - /// - /// - /// - public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) - { - - // this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_scene, agentID, localID, true, this, this, shape, pos); - this.m_children.Add(rootPrimitive); - - this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); - } - - /// - /// - /// - /// - public void CreateFromBytes(byte[] data) - { - - } - - /// - /// Makes a copy of this SceneObject (and child primitives) - /// - /// A complete copy of the object - public new SceneObjectOLD Copy() - { - SceneObjectOLD dupe = new SceneObjectOLD(); - - dupe.m_scene = this.m_scene; - dupe.m_eventManager = this.m_eventManager; - dupe.m_regionHandle = this.m_regionHandle; - Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe); - dupe.rootPrimitive = newRoot; - - dupe.m_children.Add(dupe.rootPrimitive); - dupe.rootPrimitive.AbsolutePosition = this.AbsolutePosition; - dupe.Rotation = this.Rotation; - dupe.LocalId = m_scene.PrimIDAllocate(); - - dupe.registerEvents(); - return dupe; - } - - /// - /// - /// - public void Serialise() - { - - } - - /// - /// - /// - public void DeleteAllChildren() - { - this.m_children.Clear(); - this.ChildPrimitives.Clear(); - this.rootPrimitive = null; - unregisterEvents(); - } - - /// - /// - /// - /// - public void AddNewChildPrims(SceneObjectOLD primObject) - { - this.rootPrimitive.AddNewChildren(primObject); - } - - public void AddChildToList(Primitive prim) - { - if (!this.ChildPrimitives.ContainsKey(prim.m_uuid)) - { - this.ChildPrimitives.Add(prim.m_uuid, prim); - } - } - /// - /// - /// - /// - /// - public Primitive HasChildPrim(LLUUID primID) - { - if (this.ChildPrimitives.ContainsKey(primID)) - { - return this.ChildPrimitives[primID]; - } - - return null; - } - - /// - /// - /// - /// - /// - public Primitive HasChildPrim(uint localID) - { - Primitive returnPrim = null; - foreach (Primitive prim in this.ChildPrimitives.Values) - { - if (prim.LocalId == localID) - { - returnPrim = prim; - break; - } - } - return returnPrim; - } - - public void SendAllChildPrimsToClient(IClientAPI client) - { - this.rootPrimitive.SendFullUpdateForAllChildren(client); - } - - /// - /// - /// - public override void BackUp() - { - - } - - /// - /// - /// - /// - /// - /// - public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) - { - this.rootPrimitive.AbsolutePosition = pos; - this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); - } - - /// - /// - /// - /// - public void GetProperites(IClientAPI client) - { - ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); - proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; - proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); - proper.ObjectData[0].ItemID = LLUUID.Zero; - proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate; - proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID; - proper.ObjectData[0].FolderID = LLUUID.Zero; - proper.ObjectData[0].FromTaskID = LLUUID.Zero; - proper.ObjectData[0].GroupID = LLUUID.Zero; - proper.ObjectData[0].InventorySerial = 0; - proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID; - proper.ObjectData[0].ObjectID = this.rootUUID; - proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID; - proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0"); - proper.ObjectData[0].TextureID = new byte[0]; - proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName + "\0"); - proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name + "\0"); - proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description + "\0"); - proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask; - proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask; - proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask; - proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask; - proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask; - - client.OutPacket(proper); - } - - public override void SetText(string text, Axiom.Math.Vector3 color, double alpha) - { - throw new System.Exception("The method or operation is not implemented."); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index b3e3fe32a8..2fd7b578c8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -14,7 +14,7 @@ using OpenSim.Framework.Data; namespace OpenSim.Region.Environment.Scenes { - // public delegate void PrimCountTaintedDelegate(); + public delegate void PrimCountTaintedDelegate(); public class SceneObjectGroup : EntityBase { diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs b/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs index 97b1ada6ac..80d77f28a5 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Scripting.Examples }*/ } - string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim) + string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim) { /*string desc = prim.Description; string name = prim.Name; diff --git a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs index 7cfdb46174..9c950f8988 100644 --- a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs @@ -7,7 +7,6 @@ using OpenSim.Framework.Types; using System.Timers; using System.Diagnostics; using System.IO; -using Primitive = OpenSim.Region.Environment.Scenes.Primitive; namespace SimpleApp { diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index daa420383e..23461098e1 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -12,7 +12,6 @@ using OpenSim.Region.Capabilities; using OpenSim.Region.ClientStack; using OpenSim.Region.Communications.Local; using OpenSim.Framework.Communications.Caches; -using OpenSim.Region.GridInterfaces.Local; using System.Timers; using OpenSim.Region.Environment.Scenes; using OpenSim.Framework.Data; diff --git a/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs deleted file mode 100644 index 61adf804b0..0000000000 --- a/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs +++ /dev/null @@ -1,56 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System.Reflection; -using System.Runtime.InteropServices; -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("LocalGridServers")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LocalGridServers")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs deleted file mode 100644 index a658f2f8b9..0000000000 --- a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs +++ /dev/null @@ -1,56 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System.Reflection; -using System.Runtime.InteropServices; -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("RemoteGridServers")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("RemoteGridServers")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs deleted file mode 100644 index f81bb8d44e..0000000000 --- a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs +++ /dev/null @@ -1,133 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System.IO; -using System.Net; -using System.Text; -using System.Threading; -using libsecondlife; -using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Utilities; - -namespace OpenSim.Region.GridInterfaces.Remote -{ - public class RemoteAssetServer : IAssetServer - { - private IAssetReceiver _receiver; - private BlockingQueue _assetRequests; - private Thread _remoteAssetServerThread; - private string AssetServerUrl; - private string AssetSendKey; - - public RemoteAssetServer() - { - this._assetRequests = new BlockingQueue(); - this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); - this._remoteAssetServerThread.IsBackground = true; - this._remoteAssetServerThread.Start(); - MainLog.Instance.Verbose("Remote Asset Server class created"); - } - - public void SetReceiver(IAssetReceiver receiver) - { - this._receiver = receiver; - } - - public void RequestAsset(LLUUID assetID, bool isTexture) - { - ARequest req = new ARequest(); - req.AssetID = assetID; - req.IsTexture = isTexture; - this._assetRequests.Enqueue(req); - } - - public void UpdateAsset(AssetBase asset) - { - - } - - public void UploadNewAsset(AssetBase asset) - { - Encoding Windows1252Encoding = Encoding.GetEncoding(1252); - string ret = Windows1252Encoding.GetString(asset.Data); - byte[] buffer = Windows1252Encoding.GetBytes(ret); - WebClient client = new WebClient(); - client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer); - - } - - public void SetServerInfo(string ServerUrl, string ServerKey) - { - this.AssetServerUrl = ServerUrl; - this.AssetSendKey = ServerKey; - } - - private void RunRequests() - { - while (true) - { - //we need to add support for the asset server not knowing about a requested asset - // 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 - ARequest req = this._assetRequests.Dequeue(); - LLUUID assetID = req.AssetID; - // OpenSim.Framework.Console.MainLog.Instance.Verbose(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID); - WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID); - WebResponse AssetResponse = AssetLoad.GetResponse(); - byte[] idata = new byte[(int)AssetResponse.ContentLength]; - BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); - idata = br.ReadBytes((int)AssetResponse.ContentLength); - br.Close(); - - AssetBase asset = new AssetBase(); - asset.FullID = assetID; - asset.Data = idata; - _receiver.AssetReceived(asset, req.IsTexture); - } - } - - public void Close() - { - - } - } - - public class RemoteAssetPlugin : IAssetPlugin - { - public RemoteAssetPlugin() - { - - } - - public IAssetServer GetAssetServer() - { - return (new RemoteAssetServer()); - } - } - -} diff --git a/prebuild.xml b/prebuild.xml index 71d996b6c9..3beb051eea 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -185,56 +185,6 @@ - - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - @@ -454,7 +404,9 @@ + + @@ -615,30 +567,6 @@ - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - @@ -733,7 +661,6 @@ - @@ -823,30 +750,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - -