diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index 9e547014ae..b2145988ef 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs @@ -1,8 +1,11 @@ using System; +using System.IO; using System.Collections.Generic; using System.Text; using libsecondlife; +using OpenSim.Framework.Utilities; using OpenSim.Framework.Data; +using Nini.Config; namespace OpenSim.Framework.Communications.Caches { @@ -18,7 +21,7 @@ namespace OpenSim.Framework.Communications.Caches this.name = "OpenSim Library"; this.parentID = LLUUID.Zero; this.type = (short)-1; - this.version = (ushort) 1; + this.version = (ushort)1; InventoryFolder folderInfo = new InventoryFolder(); folderInfo.agentID = libOwner; @@ -31,11 +34,15 @@ namespace OpenSim.Framework.Communications.Caches this.m_textureFolder = folderInfo; this.CreateLibraryItems(); + + string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); + XmlConfigSource source = new XmlConfigSource(filePath); + this.ReadItemsFromFile(source); } private void CreateLibraryItems() { - + InventoryItemBase item = new InventoryItemBase(); item.avatarID = libOwner; item.creatorsID = libOwner; @@ -167,6 +174,7 @@ namespace OpenSim.Framework.Communications.Caches item.inventoryNextPermissions = 0; this.Items.Add(item.inventoryID, item); + /* item = new InventoryItemBase(); item.avatarID = libOwner; item.creatorsID = libOwner; @@ -181,7 +189,38 @@ namespace OpenSim.Framework.Communications.Caches item.inventoryNextPermissions = (1 << 15); item.inventoryEveryOnePermissions = (1 << 15); item.inventoryBasePermissions = (1 << 15); - this.Items.Add(item.inventoryID, item); + this.Items.Add(item.inventoryID, item); + */ + } + + private void ReadItemsFromFile(IConfigSource source) + { + for (int i = 0; i < source.Configs.Count; i++) + { + InventoryItemBase item = new InventoryItemBase(); + item.avatarID = libOwner; + item.creatorsID = libOwner; + item.inventoryID = new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated())); + item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); + item.inventoryDescription = source.Configs[i].GetString("description", ""); + item.inventoryName = source.Configs[i].GetString("name", ""); + item.assetType = source.Configs[i].GetInt("assetType", 0); + item.invType = source.Configs[i].GetInt("inventoryType", 0); + item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); + item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); + item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); + item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); + if (item.assetType == 0) + { + item.parentFolderID = this.m_textureFolder.folderID; + this.m_textureFolder.Items.Add(item.inventoryID, item); + } + else + { + item.parentFolderID = this.folderID; + this.Items.Add(item.inventoryID, item); + } + } } } diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs index ea4824b8e8..17d2680919 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) diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine.Compiler.LSL/Engine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine.Compiler.LSL/Engine.cs index 81caf2d4f5..2db35c4bed 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine.Compiler.LSL/Engine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine.Compiler.LSL/Engine.cs @@ -30,7 +30,7 @@ using System; using System.Reflection; using System.Reflection.Emit; using System.Threading; -//using System.Windows.Forms; + namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { diff --git a/bin/OpenSimAssetSet.xml b/bin/OpenSimAssetSet.xml new file mode 100644 index 0000000000..d81b5b5508 --- /dev/null +++ b/bin/OpenSimAssetSet.xml @@ -0,0 +1,9 @@ + +
+ + + + + +
+
\ No newline at end of file diff --git a/bin/OpenSimLibrary.xml b/bin/OpenSimLibrary.xml new file mode 100644 index 0000000000..2b56696c39 --- /dev/null +++ b/bin/OpenSimLibrary.xml @@ -0,0 +1,14 @@ + +
+ + + + + + + + + + +
+
\ No newline at end of file diff --git a/prebuild.xml b/prebuild.xml index 119f545fad..e6b8013a3c 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -203,6 +203,7 @@ + @@ -452,6 +453,7 @@ +