From cf203cf5ee809d3832daafbed12eb130bd590f5c Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 8 Aug 2007 17:11:02 +0000 Subject: The startup set of assets in the local asset server can now be set from a xml file (OpenSimAssetSet.xml). (remember to make changes to the set, you will also need to delete the old asset .yap file, so that it is recreated). Also the set of items in the OpenSim inventory Library can also now be set from a xml file (OpenSimLibrary.xml). --- .../GridInterfaces/Local/LocalAssetServer.cs | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/GridInterfaces') diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs index ea4824b..17d2680 100644 --- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs +++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs @@ -31,6 +31,7 @@ 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; @@ -345,7 +346,7 @@ namespace OpenSim.Region.GridInterfaces.Local db.Set(store); db.Commit(); - Image = new AssetBase(); + /*Image = new AssetBase(); Image.FullID = new LLUUID("00000000-0000-2222-3333-000000000001"); Image.Name = "WelcomeNote"; Image.Type = 7; @@ -357,7 +358,35 @@ namespace OpenSim.Region.GridInterfaces.Local store.UUID = Image.FullID; db.Set(store); db.Commit(); - + */ + + string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); + 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) -- cgit v1.1