diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index ba9e5b166d..241bc9099a 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs @@ -195,7 +195,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory #endregion Interface /// - /// The only parameter we recognize is a UUID.If an asset with this identification is + /// The only parameter we recognize is a UUID.If an asset with this identification is /// found, it's content, base-64 encoded, is returned to the client. /// @@ -218,12 +218,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory rdata.writer.WriteStartElement(String.Empty,"Asset",String.Empty); - rdata.writer.WriteAttributeString("id", asset.ID.ToString()); - rdata.writer.WriteAttributeString("name", asset.Name); - rdata.writer.WriteAttributeString("desc", asset.Description); - rdata.writer.WriteAttributeString("type", asset.Type.ToString()); - rdata.writer.WriteAttributeString("local", asset.Local.ToString()); - rdata.writer.WriteAttributeString("temporary", asset.Temporary.ToString()); + rdata.writer.WriteAttributeString("id", asset.Metadata.ID); + rdata.writer.WriteAttributeString("name", asset.Metadata.Name); + rdata.writer.WriteAttributeString("desc", asset.Metadata.Description); + rdata.writer.WriteAttributeString("type", asset.Metadata.Type.ToString()); + rdata.writer.WriteAttributeString("local", asset.Metadata.Local.ToString()); + rdata.writer.WriteAttributeString("temporary", asset.Metadata.Temporary.ToString()); rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length); @@ -274,19 +274,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory modified = (asset != null); created = !modified; - asset = new AssetBase(); - asset.FullID = uuid; - asset.Name = xml.GetAttribute("name"); - asset.Description = xml.GetAttribute("desc"); - asset.Type = SByte.Parse(xml.GetAttribute("type")); - asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; - asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; - asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); + asset = new AssetBase(); + asset.Metadata.FullID = uuid; + asset.Metadata.Name = xml.GetAttribute("name"); + asset.Metadata.Description = xml.GetAttribute("desc"); + asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type")); + asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0; + asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; + asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); - if (asset.ID != rdata.Parameters[0]) + if (asset.Metadata.ID != rdata.Parameters[0]) { - Rest.Log.WarnFormat("{0} URI and payload disagree on UUID U:{1} vs P:{2}", - MsgId, rdata.Parameters[0], asset.ID); + Rest.Log.WarnFormat("{0} URI and payload disagree on UUID U:{1} vs P:{2}", + MsgId, rdata.Parameters[0], asset.Metadata.ID); } Rest.AssetServices.AddAsset(asset); @@ -300,14 +300,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory if (created) { - rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Name, asset.FullID)); + rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.FullID)); rdata.Complete(Rest.HttpStatusCodeCreated); } else { if (modified) { - rdata.appendStatus(String.Format("

Modified asset {0}, UUID {1}

", asset.Name, asset.FullID)); + rdata.appendStatus(String.Format("

Modified asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.FullID)); rdata.Complete(Rest.HttpStatusCodeOK); } else @@ -354,27 +354,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory modified = (asset != null); created = !modified; - asset = new AssetBase(); - asset.FullID = uuid; - asset.Name = xml.GetAttribute("name"); - asset.Description = xml.GetAttribute("desc"); - asset.Type = SByte.Parse(xml.GetAttribute("type")); - asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; - asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; - asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); + asset = new AssetBase(); + asset.Metadata.FullID = uuid; + asset.Metadata.Name = xml.GetAttribute("name"); + asset.Metadata.Description = xml.GetAttribute("desc"); + asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type")); + asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0; + asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; + asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); Rest.AssetServices.AddAsset(asset); if (created) { - rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Name, asset.FullID)); + rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.FullID)); rdata.Complete(Rest.HttpStatusCodeCreated); } else { if (modified) { - rdata.appendStatus(String.Format("

Modified asset {0}, UUID {1}

", asset.Name, asset.FullID)); + rdata.appendStatus(String.Format("

Modified asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.FullID)); rdata.Complete(Rest.HttpStatusCodeOK); } else diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 2dce70635d..aa222bb4e8 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -353,7 +353,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory default : Rest.Log.WarnFormat("{0} Method {1} not supported for {2}", MsgId, rdata.method, rdata.path); - rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, + rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, String.Format("{0} not supported", rdata.method)); break; } @@ -488,12 +488,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory foreach (AssetBase asset in entity.Assets) { Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", - MsgId, asset.ID, asset.Type, asset.Name); + MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name); Rest.AssetServices.AddAsset(asset); created = true; rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", - asset.Name, asset.ID)); + asset.Metadata.Name, asset.Metadata.ID)); if (Rest.DEBUG && Rest.DumpAsset) { @@ -691,14 +691,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory foreach (AssetBase asset in entity.Assets) { Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", - MsgId, asset.ID, asset.Type, asset.Name); + MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name); // The asset was validated during the collection process Rest.AssetServices.AddAsset(asset); created = true; - rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Name, asset.ID)); + rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.ID)); if (Rest.DEBUG && Rest.DumpAsset) { @@ -1083,7 +1083,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory Rest.Log.DebugFormat("{0} {1}: Resource {2} not found", MsgId, rdata.method, rdata.path); - rdata.Fail(Rest.HttpStatusCodeNotFound, + rdata.Fail(Rest.HttpStatusCodeNotFound, String.Format("resource {0}:{1} not found", rdata.method, rdata.path)); return null; /* Never reached */ @@ -1324,7 +1324,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory rdata.writer.WriteAttributeString("everyone", String.Empty, i.EveryOnePermissions.ToString("X")); rdata.writer.WriteAttributeString("base", String.Empty, i.BasePermissions.ToString("X")); rdata.writer.WriteEndElement(); - + rdata.writer.WriteElementString("Asset", i.AssetID.ToString()); rdata.writer.WriteEndElement(); @@ -1458,7 +1458,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory case XmlNodeType.Element: Rest.Log.DebugFormat("{0} StartElement: <{1}>", MsgId, ic.xml.Name); - + switch (ic.xml.Name) { case "Folder": @@ -1486,7 +1486,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory MsgId, ic.xml.Name); break; } - + // This stinks, but the ReadElement call above not only reads // the imbedded data, but also consumes the end tag for Asset // and moves the element pointer on to the containing Item's @@ -1498,7 +1498,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory Validate(ic); } break; - + case XmlNodeType.EndElement : switch (ic.xml.Name) { @@ -1526,7 +1526,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory break; } break; - + default: Rest.Log.DebugFormat("{0} Ignoring: <{1}>:<{2}>", MsgId, ic.xml.NodeType, ic.xml.Value); @@ -1868,7 +1868,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // only if the size is non-zero. else - { + { AssetBase asset = null; string b64string = null; @@ -1884,10 +1884,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory asset = new AssetBase(uuid, name); - asset.Description = desc; - asset.Type = type; // type == 0 == texture - asset.Local = local; - asset.Temporary = temp; + asset.Metadata.Description = desc; + asset.Metadata.Type = type; // type == 0 == texture + asset.Metadata.Local = local; + asset.Metadata.Temporary = temp; b64string = ic.xml.ReadElementContentAsString(); @@ -1911,8 +1911,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory { ic.Item.AssetID = uuid; } - - ic.Push(asset); + + ic.Push(asset); } } @@ -2039,10 +2039,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory if (ic.Asset != null) { - if (ic.Asset.Name == String.Empty) - ic.Asset.Name = ic.Item.Name; - if (ic.Asset.Description == String.Empty) - ic.Asset.Description = ic.Item.Description; + if (ic.Asset.Metadata.Name == String.Empty) + ic.Asset.Metadata.Name = ic.Item.Name; + if (ic.Asset.Metadata.Description == String.Empty) + ic.Asset.Metadata.Description = ic.Item.Description; } // Assign permissions @@ -2139,7 +2139,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory try { ic.Asset.Data = OpenJPEG.EncodeFromImage(temp, true); - } + } catch (DllNotFoundException) { Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", ic.Item.Name); @@ -2201,7 +2201,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory ///

/// This is the callback method required by the inventory watchdog. The - /// requestor issues an inventory request and then blocks until the + /// requestor issues an inventory request and then blocks until the /// request completes, or this method signals the monitor. /// diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 3eaae125e3..425e233280 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -132,12 +132,12 @@ namespace OpenSim.Data.MSSQL { AssetBase asset = new AssetBase(); // Region Main - asset.FullID = new UUID((string)reader["id"]); - asset.Name = (string)reader["name"]; - asset.Description = (string)reader["description"]; - asset.Type = Convert.ToSByte(reader["assetType"]); - asset.Local = Convert.ToBoolean(reader["local"]); - asset.Temporary = Convert.ToBoolean(reader["temporary"]); + asset.Metadata.FullID = new UUID((string)reader["id"]); + asset.Metadata.Name = (string)reader["name"]; + asset.Metadata.Description = (string)reader["description"]; + asset.Metadata.Type = Convert.ToSByte(reader["assetType"]); + asset.Metadata.Local = Convert.ToBoolean(reader["local"]); + asset.Metadata.Temporary = Convert.ToBoolean(reader["temporary"]); asset.Data = (byte[])reader["data"]; return asset; } @@ -152,7 +152,7 @@ namespace OpenSim.Data.MSSQL /// the asset override public void CreateAsset(AssetBase asset) { - if (ExistsAsset(asset.FullID)) + if (ExistsAsset(asset.Metadata.FullID)) { return; } @@ -163,12 +163,12 @@ namespace OpenSim.Data.MSSQL "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)")) { int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); - command.Parameters.Add(database.CreateParameter("id", asset.FullID)); - command.Parameters.Add(database.CreateParameter("name", asset.Name)); - command.Parameters.Add(database.CreateParameter("description", asset.Description)); - command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); - command.Parameters.Add(database.CreateParameter("local", asset.Local)); - command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); + command.Parameters.Add(database.CreateParameter("id", asset.Metadata.FullID)); + command.Parameters.Add(database.CreateParameter("name", asset.Metadata.Name)); + command.Parameters.Add(database.CreateParameter("description", asset.Metadata.Description)); + command.Parameters.Add(database.CreateParameter("assetType", asset.Metadata.Type)); + command.Parameters.Add(database.CreateParameter("local", asset.Metadata.Local)); + command.Parameters.Add(database.CreateParameter("temporary", asset.Metadata.Temporary)); command.Parameters.Add(database.CreateParameter("access_time", now)); command.Parameters.Add(database.CreateParameter("create_time", now)); command.Parameters.Add(database.CreateParameter("data", asset.Data)); @@ -192,14 +192,14 @@ namespace OpenSim.Data.MSSQL "data = @data where " + "id = @keyId;")) { - command.Parameters.Add(database.CreateParameter("id", asset.FullID)); - command.Parameters.Add(database.CreateParameter("name", asset.Name)); - command.Parameters.Add(database.CreateParameter("description", asset.Description)); - command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); - command.Parameters.Add(database.CreateParameter("local", asset.Local)); - command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); + command.Parameters.Add(database.CreateParameter("id", asset.Metadata.FullID)); + command.Parameters.Add(database.CreateParameter("name", asset.Metadata.Name)); + command.Parameters.Add(database.CreateParameter("description", asset.Metadata.Description)); + command.Parameters.Add(database.CreateParameter("assetType", asset.Metadata.Type)); + command.Parameters.Add(database.CreateParameter("local", asset.Metadata.Local)); + command.Parameters.Add(database.CreateParameter("temporary", asset.Metadata.Temporary)); command.Parameters.Add(database.CreateParameter("data", asset.Data)); - command.Parameters.Add(database.CreateParameter("@keyId", asset.FullID)); + command.Parameters.Add(database.CreateParameter("@keyId", asset.Metadata.FullID)); try { diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 3ff2a1a988..823fa787cc 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -139,18 +139,18 @@ namespace OpenSim.Data.MySQL { asset = new AssetBase(); asset.Data = (byte[]) dbReader["data"]; - asset.Description = (string) dbReader["description"]; - asset.FullID = assetID; + asset.Metadata.Description = (string) dbReader["description"]; + asset.Metadata.FullID = assetID; try { - asset.Local = (bool)dbReader["local"]; + asset.Metadata.Local = (bool)dbReader["local"]; } catch (System.InvalidCastException) { - asset.Local = false; + asset.Metadata.Local = false; } - asset.Name = (string) dbReader["name"]; - asset.Type = (sbyte) dbReader["assetType"]; + asset.Metadata.Name = (string) dbReader["name"]; + asset.Metadata.Type = (sbyte) dbReader["assetType"]; } dbReader.Close(); cmd.Dispose(); @@ -178,8 +178,8 @@ namespace OpenSim.Data.MySQL { lock (_dbConnection) { - //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); - if (ExistsAsset(asset.FullID)) + //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.Metadata.FullID)); + if (ExistsAsset(asset.Metadata.FullID)) { //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); return; @@ -200,12 +200,12 @@ namespace OpenSim.Data.MySQL { // create unix epoch time int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); - cmd.Parameters.AddWithValue("?id", asset.FullID.ToString()); - cmd.Parameters.AddWithValue("?name", asset.Name); - cmd.Parameters.AddWithValue("?description", asset.Description); - cmd.Parameters.AddWithValue("?assetType", asset.Type); - cmd.Parameters.AddWithValue("?local", asset.Local); - cmd.Parameters.AddWithValue("?temporary", asset.Temporary); + cmd.Parameters.AddWithValue("?id", asset.Metadata.ID); + cmd.Parameters.AddWithValue("?name", asset.Metadata.Name); + cmd.Parameters.AddWithValue("?description", asset.Metadata.Description); + cmd.Parameters.AddWithValue("?assetType", asset.Metadata.Type); + cmd.Parameters.AddWithValue("?local", asset.Metadata.Local); + cmd.Parameters.AddWithValue("?temporary", asset.Metadata.Temporary); cmd.Parameters.AddWithValue("?create_time", now); cmd.Parameters.AddWithValue("?access_time", now); cmd.Parameters.AddWithValue("?data", asset.Data); @@ -218,7 +218,7 @@ namespace OpenSim.Data.MySQL m_log.ErrorFormat( "[ASSETS DB]: " + "MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString() - + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); + + Environment.NewLine + "Attempting reconnection", asset.Metadata.FullID, asset.Metadata.Name); _dbConnection.Reconnect(); } } @@ -241,7 +241,7 @@ namespace OpenSim.Data.MySQL { // create unix epoch time int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); - cmd.Parameters.AddWithValue("?id", asset.FullID.ToString()); + cmd.Parameters.AddWithValue("?id", asset.Metadata.ID); cmd.Parameters.AddWithValue("?access_time", now); cmd.ExecuteNonQuery(); cmd.Dispose(); @@ -252,7 +252,7 @@ namespace OpenSim.Data.MySQL m_log.ErrorFormat( "[ASSETS DB]: " + "MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString() - + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); + + Environment.NewLine + "Attempting reconnection", asset.Metadata.FullID, asset.Metadata.Name); _dbConnection.Reconnect(); } } diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index fab39b1eee..d0046c6e98 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs @@ -69,7 +69,7 @@ namespace OpenSim.Data.NHibernate private void Save(AssetBase asset) { - AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.FullID); + AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.Metadata.FullID); if (temp == null) { manager.Save(asset); @@ -78,13 +78,13 @@ namespace OpenSim.Data.NHibernate override public void CreateAsset(AssetBase asset) { - m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.FullID); + m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.Metadata.FullID); Save(asset); } override public void UpdateAsset(AssetBase asset) { - m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID); + m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.Metadata.FullID); manager.Update(asset); } diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 30ba642ab3..d28956f6b1 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -125,8 +125,8 @@ namespace OpenSim.Data.SQLite /// Asset Base override public void CreateAsset(AssetBase asset) { - //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); - if (ExistsAsset(asset.FullID)) + //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.Metadata.FullID)); + if (ExistsAsset(asset.Metadata.FullID)) { //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); } @@ -136,12 +136,12 @@ namespace OpenSim.Data.SQLite { using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) { - cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); - cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); - cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); - cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); - cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); - cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); + cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.Metadata.FullID))); + cmd.Parameters.Add(new SqliteParameter(":Name", asset.Metadata.Name)); + cmd.Parameters.Add(new SqliteParameter(":Description", asset.Metadata.Description)); + cmd.Parameters.Add(new SqliteParameter(":Type", asset.Metadata.Type)); + cmd.Parameters.Add(new SqliteParameter(":Local", asset.Metadata.Local)); + cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Metadata.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.ExecuteNonQuery(); @@ -162,12 +162,12 @@ namespace OpenSim.Data.SQLite { using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) { - cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); - cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); - cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); - cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); - cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); - cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); + cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.Metadata.FullID))); + cmd.Parameters.Add(new SqliteParameter(":Name", asset.Metadata.Name)); + cmd.Parameters.Add(new SqliteParameter(":Description", asset.Metadata.Description)); + cmd.Parameters.Add(new SqliteParameter(":Type", asset.Metadata.Type)); + cmd.Parameters.Add(new SqliteParameter(":Local", asset.Metadata.Local)); + cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Metadata.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.ExecuteNonQuery(); @@ -181,14 +181,14 @@ namespace OpenSim.Data.SQLite /// private static void LogAssetLoad(AssetBase asset) { - string temporary = asset.Temporary ? "Temporary" : "Stored"; - string local = asset.Local ? "Local" : "Remote"; + string temporary = asset.Metadata.Temporary ? "Temporary" : "Stored"; + string local = asset.Metadata.Local ? "Local" : "Remote"; int assetLength = (asset.Data != null) ? asset.Data.Length : 0; m_log.Info("[ASSET DB]: " + string.Format("Loaded {6} {5} Asset: [{0}][{3}] \"{1}\":{2} ({7} bytes)", - asset.FullID, asset.Name, asset.Description, asset.Type, + asset.Metadata.FullID, asset.Metadata.Name, asset.Metadata.Description, asset.Metadata.Type, temporary, local, assetLength)); } @@ -246,12 +246,12 @@ namespace OpenSim.Data.SQLite // back out. Not enough time to figure it out yet. AssetBase asset = new AssetBase(); - asset.FullID = new UUID((String) row["UUID"]); - asset.Name = (String) row["Name"]; - asset.Description = (String) row["Description"]; - asset.Type = Convert.ToSByte(row["Type"]); - asset.Local = Convert.ToBoolean(row["Local"]); - asset.Temporary = Convert.ToBoolean(row["Temporary"]); + asset.Metadata.FullID = new UUID((String) row["UUID"]); + asset.Metadata.Name = (String) row["Name"]; + asset.Metadata.Description = (String) row["Description"]; + asset.Metadata.Type = Convert.ToSByte(row["Type"]); + asset.Metadata.Local = Convert.ToBoolean(row["Local"]); + asset.Metadata.Temporary = Convert.ToBoolean(row["Temporary"]); asset.Data = (byte[]) row["Data"]; return asset; } diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index 65464729cb..5993f961da 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs @@ -61,7 +61,7 @@ namespace OpenSim.Data.Tests asset1 = new byte[100]; asset1.Initialize(); } - + [Test] public void T001_LoadEmpty() { @@ -69,7 +69,7 @@ namespace OpenSim.Data.Tests Assert.That(db.ExistsAsset(uuid2), Is.False); Assert.That(db.ExistsAsset(uuid3), Is.False); } - + [Test] public void T010_StoreSimpleAsset() { @@ -79,22 +79,22 @@ namespace OpenSim.Data.Tests a1.Data = asset1; a2.Data = asset1; a3.Data = asset1; - + db.CreateAsset(a1); db.CreateAsset(a2); db.CreateAsset(a3); AssetBase a1a = db.FetchAsset(uuid1); - Assert.That(a1.ID, Is.EqualTo(a1a.ID)); - Assert.That(a1.Name, Is.EqualTo(a1a.Name)); + Assert.That(a1.Metadata.ID, Is.EqualTo(a1a.Metadata.ID)); + Assert.That(a1.Metadata.Name, Is.EqualTo(a1a.Metadata.Name)); AssetBase a2a = db.FetchAsset(uuid2); - Assert.That(a2.ID, Is.EqualTo(a2a.ID)); - Assert.That(a2.Name, Is.EqualTo(a2a.Name)); + Assert.That(a2.Metadata.ID, Is.EqualTo(a2a.Metadata.ID)); + Assert.That(a2.Metadata.Name, Is.EqualTo(a2a.Metadata.Name)); AssetBase a3a = db.FetchAsset(uuid3); - Assert.That(a3.ID, Is.EqualTo(a3a.ID)); - Assert.That(a3.Name, Is.EqualTo(a3a.Name)); + Assert.That(a3.Metadata.ID, Is.EqualTo(a3a.Metadata.ID)); + Assert.That(a3.Metadata.Name, Is.EqualTo(a3a.Metadata.Name)); } [Test] @@ -117,4 +117,4 @@ namespace OpenSim.Data.Tests // Assert.That(db.ExistsAsset(uuid3), Is.False); // } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 48ef2ffdab..f9c94574f4 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -26,7 +26,9 @@ */ using System; +using System.Collections.Generic; using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace OpenSim.Framework { @@ -34,33 +36,18 @@ namespace OpenSim.Framework public class AssetBase { private byte[] _data; - private string _description = String.Empty; - private UUID _fullid; - private bool _local = false; - private string _name = String.Empty; - private bool _temporary = false; - private sbyte _type; + private AssetMetadata _metadata; public AssetBase() { + Metadata = new AssetMetadata(); } public AssetBase(UUID assetId, string name) { - FullID = assetId; - Name = name; - } - - public virtual UUID FullID - { - get { return _fullid; } - set { _fullid = value; } - } - - public virtual string ID - { - get { return _fullid.ToString(); } - set { _fullid = new UUID(value); } + Metadata = new AssetMetadata(); + Metadata.FullID = assetId; + Metadata.Name = name; } public virtual byte[] Data @@ -69,34 +56,98 @@ namespace OpenSim.Framework set { _data = value; } } - public virtual sbyte Type + public virtual AssetMetadata Metadata { - get { return _type; } - set { _type = value; } + get { return _metadata; } + set { _metadata = value; } + } + } + + [Serializable] + public class AssetMetadata + { + private UUID _fullid; + private string _name = String.Empty; + private string _description = String.Empty; + private DateTime _creation_date; + private sbyte _type; + private string _content_type; + private byte[] _sha1; + private bool _local = false; + private bool _temporary = false; + //private Dictionary _methods = new Dictionary(); + //private OSDMap _extra_data; + + public UUID FullID + { + get { return _fullid; } + set { _fullid = value; } } - public virtual string Name + public string ID + { + get { return _fullid.ToString(); } + set { _fullid = new UUID(value); } + } + + public string Name { get { return _name; } set { _name = value; } } - public virtual string Description + public string Description { get { return _description; } set { _description = value; } } - public virtual bool Local + public DateTime CreationDate + { + get { return _creation_date; } + set { _creation_date = value; } + } + + public sbyte Type + { + get { return _type; } + set { _type = value; } + } + + public string ContentType + { + get { return _content_type; } + set { _content_type = value; } + } + + public byte[] SHA1 + { + get { return _sha1; } + set { _sha1 = value; } + } + + public bool Local { get { return _local; } set { _local = value; } } - public virtual bool Temporary + public bool Temporary { get { return _temporary; } set { _temporary = value; } } + + //public Dictionary Methods + //{ + // get { return _methods; } + // set { _methods = value; } + //} + + //public OSDMap ExtraData + //{ + // get { return _extra_data; } + // set { _extra_data = value; } + //} } } diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index d636d34ea0..bbf25d847d 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs @@ -40,10 +40,10 @@ namespace OpenSim.Framework public AssetLandmark(AssetBase a) { Data = a.Data; - FullID = a.FullID; - Type = a.Type; - Name = a.Name; - Description = a.Description; + Metadata.FullID = a.Metadata.FullID; + Metadata.Type = a.Metadata.Type; + Metadata.Name = a.Metadata.Name; + Metadata.Description = a.Metadata.Description; InternData(); } diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index 9d0f697882..55b4ebd79b 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs @@ -145,7 +145,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false); - newAsset.Type = type; + newAsset.Metadata.Type = type; assets.Add(newAsset); } } diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 653597b167..2b2467c11e 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -42,7 +42,7 @@ namespace OpenSim.Framework.Communications.Cache /// /// Manages local cache of assets and their sending to viewers. /// - /// + /// /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and @@ -80,7 +80,7 @@ namespace OpenSim.Framework.Communications.Cache private Dictionary RequestLists; /// - /// The 'server' from which assets can be requested and to which assets are persisted. + /// The 'server' from which assets can be requested and to which assets are persisted. /// private readonly IAssetServer m_assetServer; @@ -211,7 +211,7 @@ namespace OpenSim.Framework.Communications.Cache else { // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); - + NewAssetRequest req = new NewAssetRequest(callback); AssetRequestsList requestList; @@ -228,10 +228,10 @@ namespace OpenSim.Framework.Communications.Cache // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); requestList = new AssetRequestsList(); requestList.TimeRequested = DateTime.Now; - requestList.Requests.Add(req); - - RequestLists.Add(assetId, requestList); - + requestList.Requests.Add(req); + + RequestLists.Add(assetId, requestList); + m_assetServer.RequestAsset(assetId, isTexture); } } @@ -247,7 +247,7 @@ namespace OpenSim.Framework.Communications.Cache /// the allowed number of polls. This isn't a very good way of doing things since a single thread /// is processing inbound packets, so if the asset server is slow, we could block this for up to /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset() - /// + /// /// /// /// null if the asset could not be retrieved @@ -264,7 +264,7 @@ namespace OpenSim.Framework.Communications.Cache { return asset; } - + m_assetServer.RequestAsset(assetID, isTexture); do @@ -275,7 +275,7 @@ namespace OpenSim.Framework.Communications.Cache { return asset; } - } + } while (--maxPolls > 0); m_log.WarnFormat("[ASSET CACHE]: {0} {1} was not received before the retrieval timeout was reached", @@ -290,17 +290,17 @@ namespace OpenSim.Framework.Communications.Cache /// public void AddAsset(AssetBase asset) { - if (!m_memcache.Contains(asset.FullID)) + if (!m_memcache.Contains(asset.Metadata.FullID)) { - m_log.Info("[CACHE] Caching " + asset.FullID + " for 24 hours from last access"); + m_log.Info("[CACHE] Caching " + asset.Metadata.FullID + " for 24 hours from last access"); // Use 24 hour rolling asset cache. - m_memcache.AddOrUpdate(asset.FullID, asset, TimeSpan.FromHours(24)); + m_memcache.AddOrUpdate(asset.Metadata.FullID, asset, TimeSpan.FromHours(24)); - // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the + // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the // information is stored locally. It could disappear, in which case we could send the - // ImageNotInDatabase packet to tell the client this. + // ImageNotInDatabase packet to tell the client this. // - // However, this doesn't quite appear to work with local textures that are part of an avatar's + // However, this doesn't quite appear to work with local textures that are part of an avatar's // appearance texture set. Whilst sending an ImageNotInDatabase does trigger an automatic rebake // and reupload by the client, if those assets aren't pushed to the asset server anyway, then // on crossing onto another region server, other avatars can no longer get the required textures. @@ -314,7 +314,7 @@ namespace OpenSim.Framework.Communications.Cache // But for now, we're going to take the easy way out and store local assets globally. // // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. - if (!asset.Temporary || asset.Local) + if (!asset.Metadata.Temporary || asset.Metadata.Local) { m_assetServer.StoreAsset(asset); } @@ -345,25 +345,25 @@ namespace OpenSim.Framework.Communications.Cache { AssetInfo assetInf = new AssetInfo(asset); - if (!m_memcache.Contains(assetInf.FullID)) + if (!m_memcache.Contains(assetInf.Metadata.FullID)) { - m_memcache.AddOrUpdate(assetInf.FullID, assetInf, TimeSpan.FromHours(24)); + m_memcache.AddOrUpdate(assetInf.Metadata.FullID, assetInf, TimeSpan.FromHours(24)); if (StatsManager.SimExtraStats != null) { StatsManager.SimExtraStats.AddAsset(assetInf); } - if (RequestedAssets.ContainsKey(assetInf.FullID)) + if (RequestedAssets.ContainsKey(assetInf.Metadata.FullID)) { - AssetRequest req = RequestedAssets[assetInf.FullID]; + AssetRequest req = RequestedAssets[assetInf.Metadata.FullID]; req.AssetInf = assetInf; req.NumPackets = CalculateNumPackets(assetInf.Data); - RequestedAssets.Remove(assetInf.FullID); + RequestedAssets.Remove(assetInf.Metadata.FullID); // If it's a direct request for a script, drop it // because it's a hacked client - if (req.AssetRequestSource != 2 || assetInf.Type != 10) + if (req.AssetRequestSource != 2 || assetInf.Metadata.Type != 10) AssetRequests.Add(req); } } @@ -373,8 +373,8 @@ namespace OpenSim.Framework.Communications.Cache lock (RequestLists) { - if (RequestLists.TryGetValue(asset.FullID, out reqList)) - RequestLists.Remove(asset.FullID); + if (RequestLists.TryGetValue(asset.Metadata.FullID, out reqList)) + RequestLists.Remove(asset.Metadata.FullID); } if (reqList != null) @@ -385,8 +385,8 @@ namespace OpenSim.Framework.Communications.Cache foreach (NewAssetRequest req in reqList.Requests) { // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked - // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.FullID); - req.Callback(asset.FullID, asset); + // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.Metadata.FullID); + req.Callback(asset.Metadata.FullID, asset); } } } @@ -398,12 +398,12 @@ namespace OpenSim.Framework.Communications.Cache // Remember the fact that this asset could not be found to prevent delays from repeated requests m_memcache.Add(assetID, null, TimeSpan.FromHours(24)); - + // Notify requesters for this asset AssetRequestsList reqList; lock (RequestLists) { - if (RequestLists.TryGetValue(assetID, out reqList)) + if (RequestLists.TryGetValue(assetID, out reqList)) RequestLists.Remove(assetID); } @@ -411,7 +411,7 @@ namespace OpenSim.Framework.Communications.Cache { if (StatsManager.SimExtraStats != null) StatsManager.SimExtraStats.AddAssetRequestTimeAfterCacheMiss(DateTime.Now - reqList.TimeRequested); - + foreach (NewAssetRequest req in reqList.Requests) { req.Callback(assetID, null); @@ -461,7 +461,7 @@ namespace OpenSim.Framework.Communications.Cache source = 3; //Console.WriteLine("asset request " + requestID); } - + //check to see if asset is in local cache, if not we need to request it from asset server. //Console.WriteLine("asset request " + requestID); if (!m_memcache.Contains(requestID)) @@ -494,7 +494,7 @@ namespace OpenSim.Framework.Communications.Cache } // Scripts cannot be retrieved by direct request - if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10) + if (transferRequest.TransferInfo.SourceType == 2 && asset.Metadata.Type == 10) return; // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list @@ -520,7 +520,7 @@ namespace OpenSim.Framework.Communications.Cache //no requests waiting return; } - + // if less than 5, do all of them int num = Math.Min(5, AssetRequests.Count); @@ -580,10 +580,10 @@ namespace OpenSim.Framework.Communications.Cache public AssetInfo(AssetBase aBase) { Data = aBase.Data; - FullID = aBase.FullID; - Type = aBase.Type; - Name = aBase.Name; - Description = aBase.Description; + Metadata.FullID = aBase.Metadata.FullID; + Metadata.Type = aBase.Metadata.Type; + Metadata.Name = aBase.Metadata.Name; + Metadata.Description = aBase.Metadata.Description; } } @@ -592,10 +592,10 @@ namespace OpenSim.Framework.Communications.Cache public TextureImage(AssetBase aBase) { Data = aBase.Data; - FullID = aBase.FullID; - Type = aBase.Type; - Name = aBase.Name; - Description = aBase.Description; + Metadata.FullID = aBase.Metadata.FullID; + Metadata.Type = aBase.Metadata.Type; + Metadata.Name = aBase.Metadata.Name; + Metadata.Description = aBase.Metadata.Description; } } @@ -608,7 +608,7 @@ namespace OpenSim.Framework.Communications.Cache /// A list of requests for assets /// public List Requests = new List(); - + /// /// Record the time that this request was first made. /// diff --git a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs index 3ed9172145..1b3e70d4d9 100644 --- a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs @@ -86,11 +86,11 @@ namespace OpenSim.Framework.Communications.Cache #region Rjindael /// - /// This class uses a symmetric key algorithm (Rijndael/AES) to encrypt and + /// This class uses a symmetric key algorithm (Rijndael/AES) to encrypt and /// decrypt data. As long as encryption and decryption routines use the same /// parameters to generate the keys, the keys are guaranteed to be the same. /// The class uses static functions with duplicate code to make it easier to - /// demonstrate encryption and decryption logic. In a real-life application, + /// demonstrate encryption and decryption logic. In a real-life application, /// this may not be the most efficient way of handling encryption, so - as /// soon as you feel comfortable with it - you may want to redesign this class. /// @@ -123,11 +123,11 @@ namespace OpenSim.Framework.Communications.Cache /// /// /// Initialization vector (or IV). This value is required to encrypt the - /// first block of plaintext data. For RijndaelManaged class IV must be + /// first block of plaintext data. For RijndaelManaged class IV must be /// exactly 16 ASCII characters long. /// /// - /// Size of encryption key in bits. Allowed values are: 128, 192, and 256. + /// Size of encryption key in bits. Allowed values are: 128, 192, and 256. /// Longer keys are more secure than shorter keys. /// /// @@ -143,7 +143,7 @@ namespace OpenSim.Framework.Communications.Cache { // Convert strings into byte arrays. // Let us assume that strings only contain ASCII codes. - // If strings include Unicode characters, use Unicode, UTF7, or UTF8 + // If strings include Unicode characters, use Unicode, UTF7, or UTF8 // encoding. byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); @@ -153,8 +153,8 @@ namespace OpenSim.Framework.Communications.Cache byte[] plainTextBytes = plainText; // First, we must create a password, from which the key will be derived. - // This password will be generated from the specified passphrase and - // salt value. The password will be created using the specified hash + // This password will be generated from the specified passphrase and + // salt value. The password will be created using the specified hash // algorithm. Password creation can be done in several iterations. PasswordDeriveBytes password = new PasswordDeriveBytes( passPhrase, @@ -173,8 +173,8 @@ namespace OpenSim.Framework.Communications.Cache // (CBC). Use default options for other symmetric key parameters. symmetricKey.Mode = CipherMode.CBC; - // Generate encryptor from the existing key bytes and initialization - // vector. Key size will be defined based on the number of the key + // Generate encryptor from the existing key bytes and initialization + // vector. Key size will be defined based on the number of the key // bytes. ICryptoTransform encryptor = symmetricKey.CreateEncryptor( keyBytes, @@ -265,8 +265,8 @@ namespace OpenSim.Framework.Communications.Cache // Convert our ciphertext into a byte array. byte[] cipherTextBytes = cipherText; - // First, we must create a password, from which the key will be - // derived. This password will be generated from the specified + // First, we must create a password, from which the key will be + // derived. This password will be generated from the specified // passphrase and salt value. The password will be created using // the specified hash algorithm. Password creation can be done in // several iterations. @@ -286,8 +286,8 @@ namespace OpenSim.Framework.Communications.Cache // (CBC). Use default options for other symmetric key parameters. symmetricKey.Mode = CipherMode.CBC; - // Generate decryptor from the existing key bytes and initialization - // vector. Key size will be defined based on the number of the key + // Generate decryptor from the existing key bytes and initialization + // vector. Key size will be defined based on the number of the key // bytes. ICryptoTransform decryptor = symmetricKey.CreateDecryptor( keyBytes, @@ -320,7 +320,7 @@ namespace OpenSim.Framework.Communications.Cache for (i = 0; i < decryptedByteCount; i++) plainText[i] = plainTextBytes[i]; - // Return decrypted string. + // Return decrypted string. return plainText; } } @@ -403,17 +403,17 @@ namespace OpenSim.Framework.Communications.Cache string salt = Convert.ToBase64String(rand); x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); - x.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", - "OPENSIM_AES_AF1", - file.AlsoKnownAs, - salt, - x.Description); + x.Metadata.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", + "OPENSIM_AES_AF1", + file.AlsoKnownAs, + salt, + x.Metadata.Description); } private bool DecryptAssetBase(AssetBase x) { // Check it's encrypted first. - if (!x.Description.Contains("ENCASS")) + if (!x.Metadata.Description.Contains("ENCASS")) return true; // ENCASS:ALG:AKA:SALT:Description @@ -421,7 +421,7 @@ namespace OpenSim.Framework.Communications.Cache string[] splitchars = new string[1]; splitchars[0] = "#:~:#"; - string[] meta = x.Description.Split(splitchars, StringSplitOptions.None); + string[] meta = x.Metadata.Description.Split(splitchars, StringSplitOptions.None); if (meta.Length < 5) { m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); @@ -432,7 +432,7 @@ namespace OpenSim.Framework.Communications.Cache if (m_keyfiles.ContainsKey(meta[2])) { RjinKeyfile deckey = m_keyfiles[meta[2]]; - x.Description = meta[4]; + x.Metadata.Description = meta[4]; switch (meta[1]) { case "OPENSIM_AES_AF1": @@ -506,7 +506,7 @@ namespace OpenSim.Framework.Communications.Cache { string assetUrl = _assetServerUrl + "/assets/"; - m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); + m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); RestObjectPoster.BeginPostObject(assetUrl, asset); } diff --git a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs index 5f15c3ef60..8b8172ef8b 100644 --- a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs @@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Cache } public override void StoreAsset(AssetBase asset) { - byte[] idBytes = asset.FullID.Guid.ToByteArray(); + byte[] idBytes = asset.Metadata.FullID.Guid.ToByteArray(); string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] + Path.DirectorySeparatorChar + idBytes[1]; @@ -56,7 +56,7 @@ namespace OpenSim.Framework.Communications.Cache if (!Directory.Exists(cdir)) Directory.CreateDirectory(cdir); - FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create); + FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.Metadata.FullID + ".xml", FileMode.Create); m_xs.Serialize(x, asset); x.Flush(); diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index e27c4f4a02..1cc9833cce 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs @@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache // rc.Request(s); //m_log.InfoFormat("[ASSET]: Stored {0}", rc); - m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); + m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); RestObjectPoster.BeginPostObject(assetUrl, asset); } diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index a6acd68371..a370eea9f5 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -159,7 +159,7 @@ namespace OpenSim.Framework.Communications.Capabilities m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest); m_log.DebugFormat( "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_agentID); - + //m_capsHandlers["MapLayer"] = // new LLSDStreamhandler("POST", // capsBase + m_mapLayerPath, @@ -247,9 +247,9 @@ namespace OpenSim.Framework.Communications.Capabilities //m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); string result = LLSDHelpers.SerialiseLLSDReply(m_capsHandlers.CapsDetails); - + //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); - + return result; } @@ -569,7 +569,7 @@ namespace OpenSim.Framework.Communications.Capabilities m_httpListener.AddStreamHandler( new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); - + string protocol = "http://"; if (m_httpListener.UseSSL) @@ -648,7 +648,7 @@ namespace OpenSim.Framework.Communications.Capabilities /// public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) { - if (llsdRequest.asset_type == "texture" || + if (llsdRequest.asset_type == "texture" || llsdRequest.asset_type == "animation" || llsdRequest.asset_type == "sound") { @@ -741,9 +741,9 @@ namespace OpenSim.Framework.Communications.Capabilities AssetBase asset; asset = new AssetBase(); - asset.FullID = assetID; - asset.Type = assType; - asset.Name = assetName; + asset.Metadata.FullID = assetID; + asset.Metadata.Type = assType; + asset.Metadata.Name = assetName; asset.Data = data; m_assetCache.AddAsset(asset); @@ -751,7 +751,7 @@ namespace OpenSim.Framework.Communications.Capabilities item.Owner = m_agentID; item.Creator = m_agentID; item.ID = inventoryItem; - item.AssetID = asset.FullID; + item.AssetID = asset.Metadata.FullID; item.Description = assetDescription; item.Name = assetName; item.AssetType = assType; diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index 3613cd886c..a44af6cc32 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs @@ -141,7 +141,7 @@ namespace OpenSim.Grid.AssetServer XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); AssetBase asset = (AssetBase) xs.Deserialize(request); - m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID); + m_log.InfoFormat("[REST]: Creating asset {0}", asset.Metadata.FullID); m_assetProvider.CreateAsset(asset); return new byte[] {}; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 96a274c0a7..42dbbeea88 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -63,9 +63,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /* private variables */ private readonly UUID m_sessionId; private readonly UUID m_secureSessionId = UUID.Zero; - + private int m_debugPacketLevel; - + private readonly AssetCache m_assetCache; private int m_cachedTextureSerial; private Timer m_clientPingTimer; @@ -355,7 +355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_groupPowers.ContainsKey(groupID)) return m_groupPowers[groupID]; - + return 0; } @@ -454,8 +454,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_circuitCode = circuitCode; m_userEndPoint = remoteEP; - m_proxyEndPoint = proxyEP; - + m_proxyEndPoint = proxyEP; + m_firstName = sessionInfo.LoginInfo.First; m_lastName = sessionInfo.LoginInfo.Last; m_startpos = sessionInfo.LoginInfo.StartPos; @@ -473,7 +473,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings); m_PacketHandler.SynchronizeClient = SynchronizeClient; m_PacketHandler.OnPacketStats += PopulateStats; - + RegisterLocalPacketHandlers(); m_imageManager = new LLImageManager(this, m_assetCache,Scene.RequestModuleInterface()); } @@ -501,7 +501,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Shut down timers m_clientPingTimer.Stop(); - + // This is just to give the client a reasonable chance of // flushing out all it's packets. There should probably // be a better mechanism here @@ -538,7 +538,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.DebugFormat( "[CLIENT]: Close has been called with shutdownCircuit = {0} for {1} attached to scene {2}", shutdownCircuit, Name, m_scene.RegionInfo.RegionName); - + m_imageManager.Close(); m_PacketHandler.Flush(); @@ -716,14 +716,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP { info = packet.Type.ToString(); } - + Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); } } /// /// Main packet processing loop for the UDP component of the client session. Both incoming and outgoing - /// packets are processed here. + /// packets are processed here. /// protected virtual void ClientLoop() { @@ -733,12 +733,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP while (IsActive) { LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue(); - + if (nextPacket.Incoming) { DebugPacket("IN", nextPacket.Packet); m_PacketHandler.ProcessInPacket(nextPacket); - } + } else { DebugPacket("OUT", nextPacket.Packet); @@ -821,14 +821,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_clientThread.Name = "ClientThread"; m_clientThread.IsBackground = true; m_clientThread.Start(); - ThreadTracker.Add(m_clientThread); + ThreadTracker.Add(m_clientThread); } - + /// /// Run a user session. This method lies at the base of the entire client thread. /// protected virtual void RunUserSession() - { + { //tell this thread we are using the culture set up for the sim (currently hardcoded to en_US) //otherwise it will override this and use the system default Culture.SetCurrentCulture(); @@ -838,7 +838,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // This sets up all the timers InitNewClient(); ClientLoop(); - } + } catch (Exception e) { if (e is ThreadAbortException) @@ -1065,7 +1065,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; public event ClassifiedDelete OnClassifiedDelete; public event ClassifiedDelete OnClassifiedGodDelete; - + public event EventNotificationAddRequest OnEventNotificationAddRequest; public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; public event EventGodDelete OnEventGodDelete; @@ -1078,14 +1078,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void ActivateGesture(UUID assetId, UUID gestureId) { } - + public void DeactivateGesture(UUID assetId, UUID gestureId) { } // Sound public void SoundTrigger(UUID soundId, UUID owerid, UUID Objectid,UUID ParentId,float Gain, Vector3 Position,UInt64 Handle) - { + { } #region Scene/Avatar to Client @@ -1330,7 +1330,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(map, patches); layerpack.Header.Zerocoded = true; - + OutPacket(layerpack, ThrottleOutPacketType.Land); } @@ -1410,11 +1410,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP agentData.child = false; agentData.firstname = m_firstName; agentData.lastname = m_lastName; - + ICapabilitiesModule capsModule = m_scene.RequestModuleInterface(); agentData.CapsPath = capsModule.GetCapsPath(m_agentId); agentData.ChildrenCapSeeds = new Dictionary(capsModule.GetChildrenSeeds(m_agentId)); - + return agentData; } @@ -1852,21 +1852,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP inventoryReply.Header.Zerocoded = true; OutPacket(inventoryReply, ThrottleOutPacketType.Asset); } - + /// IClientAPI.SendBulkUpdateInventory(InventoryFolderBase) public void SendBulkUpdateInventory(InventoryFolderBase folderBase) { // XXX: Nasty temporary move that will be resolved shortly InventoryFolderImpl folder = (InventoryFolderImpl)folderBase; - + // We will use the same transaction id for all the separate packets to be sent out in this update. UUID transactionId = UUID.Random(); - - List folderDataBlocks + + List folderDataBlocks = new List(); - + SendBulkUpdateInventoryRecursive(folder, ref folderDataBlocks, transactionId); - + if (folderDataBlocks.Count > 0) { // We'll end up with some unsent folder blocks if there were some empty folders at the end of the list @@ -1874,16 +1874,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP BulkUpdateInventoryPacket bulkUpdate = (BulkUpdateInventoryPacket)PacketPool.Instance.GetPacket(PacketType.BulkUpdateInventory); bulkUpdate.Header.Zerocoded = true; - + bulkUpdate.AgentData.AgentID = AgentId; - bulkUpdate.AgentData.TransactionID = transactionId; - bulkUpdate.FolderData = folderDataBlocks.ToArray(); - - //Console.WriteLine("SendBulkUpdateInventory :" + bulkUpdate); - OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); + bulkUpdate.AgentData.TransactionID = transactionId; + bulkUpdate.FolderData = folderDataBlocks.ToArray(); + + //Console.WriteLine("SendBulkUpdateInventory :" + bulkUpdate); + OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); } } - + /// /// Recursively construct bulk update packets to send folders and items /// @@ -1891,11 +1891,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// private void SendBulkUpdateInventoryRecursive( - InventoryFolderImpl folder, ref List folderDataBlocks, + InventoryFolderImpl folder, ref List folderDataBlocks, UUID transactionId) - { + { folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); - + const int MAX_ITEMS_PER_PACKET = 5; // If there are any items then we have to start sending them off in this packet - the next folder will have @@ -1909,10 +1909,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP bulkUpdate.Header.Zerocoded = true; bulkUpdate.AgentData.AgentID = AgentId; - bulkUpdate.AgentData.TransactionID = transactionId; - bulkUpdate.FolderData = folderDataBlocks.ToArray(); - - int itemsToSend = (items.Count > MAX_ITEMS_PER_PACKET ? MAX_ITEMS_PER_PACKET : items.Count); + bulkUpdate.AgentData.TransactionID = transactionId; + bulkUpdate.FolderData = folderDataBlocks.ToArray(); + + int itemsToSend = (items.Count > MAX_ITEMS_PER_PACKET ? MAX_ITEMS_PER_PACKET : items.Count); bulkUpdate.ItemData = new BulkUpdateInventoryPacket.ItemDataBlock[itemsToSend]; for (int i = 0; i < itemsToSend; i++) @@ -1921,51 +1921,51 @@ namespace OpenSim.Region.ClientStack.LindenUDP bulkUpdate.ItemData[i] = GenerateBulkUpdateItemDataBlock(items[items.Count - 1]); items.RemoveAt(items.Count - 1); } - + //Console.WriteLine("SendBulkUpdateInventoryRecursive :" + bulkUpdate); OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); - + folderDataBlocks = new List(); - + // If we're going to be sending another items packet then it needs to contain just the folder to which those // items belong. if (items.Count > 0) folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); - } - + } + List subFolders = folder.RequestListOfFolderImpls(); foreach (InventoryFolderImpl subFolder in subFolders) { SendBulkUpdateInventoryRecursive(subFolder, ref folderDataBlocks, transactionId); - } + } } - + /// /// Generate a bulk update inventory data block for the given folder /// /// - /// + /// private BulkUpdateInventoryPacket.FolderDataBlock GenerateBulkUpdateFolderDataBlock(InventoryFolderBase folder) { BulkUpdateInventoryPacket.FolderDataBlock folderBlock = new BulkUpdateInventoryPacket.FolderDataBlock(); - + folderBlock.FolderID = folder.ID; folderBlock.ParentID = folder.ParentID; folderBlock.Type = -1; - folderBlock.Name = Utils.StringToBytes(folder.Name); - + folderBlock.Name = Utils.StringToBytes(folder.Name); + return folderBlock; } - + /// - /// Generate a bulk update inventory data block for the given item + /// Generate a bulk update inventory data block for the given item /// /// /// private BulkUpdateInventoryPacket.ItemDataBlock GenerateBulkUpdateItemDataBlock(InventoryItemBase item) { BulkUpdateInventoryPacket.ItemDataBlock itemBlock = new BulkUpdateInventoryPacket.ItemDataBlock(); - + itemBlock.ItemID = item.ID; itemBlock.AssetID = item.AssetID; itemBlock.CreatorID = item.Creator; @@ -1996,7 +1996,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP itemBlock.ItemID, itemBlock.FolderID, (uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All); - + return itemBlock; } @@ -2396,17 +2396,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(viewertime, ThrottleOutPacketType.Task); */ } - + public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks) { ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect); packet.Effect = effectBlocks; - + packet.AgentData.AgentID = AgentId; packet.AgentData.SessionID = SessionId; packet.Header.Reliable = false; packet.Header.Zerocoded = true; - OutPacket(packet, ThrottleOutPacketType.Task); + OutPacket(packet, ThrottleOutPacketType.Task); } public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, @@ -2439,7 +2439,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Gesture #region Appearance/ Wearables Methods - + public void SendWearables(AvatarWearable[] wearables, int serial) { AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate); @@ -2457,9 +2457,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP awb.AssetID = wearables[i].AssetID; awb.ItemID = wearables[i].ItemID; aw.WearableData[i] = awb; - + // m_log.DebugFormat( -// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", +// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", // awb.ItemID, awb.AssetID, i, Name); } @@ -2489,7 +2489,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId) { //m_log.DebugFormat("[CLIENT]: Sending animations to {0}", Name); - + AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation); // TODO: don't create new blocks if recycling an old packet ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; @@ -2546,16 +2546,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Send a terse positional/rotation/velocity update about an avatar to the client. This avatar can be that of - /// the client itself. + /// the client itself. /// public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation) { if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) - rotation = Quaternion.Identity; + rotation = Quaternion.Identity; //m_log.DebugFormat("[CLIENT]: Sending rotation {0} for {1} to {2}", rotation, localID, Name); - + ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateAvatarImprovedBlock(localID, position, velocity, rotation); ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); @@ -2567,7 +2567,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP terse.Header.Reliable = false; terse.Header.Zerocoded = true; - + OutPacket(terse, ThrottleOutPacketType.Task); } @@ -2593,7 +2593,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP loc.Index = ib; loc.Header.Reliable = false; loc.Header.Zerocoded = true; - + OutPacket(loc, ThrottleOutPacketType.Task); } @@ -2808,7 +2808,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP im.Header.Zerocoded = true; OutPacket(im, ThrottleOutPacketType.Texture); } - + public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData) { ImagePacketPacket im = new ImagePacketPacket(); @@ -2816,13 +2816,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP im.ImageID.Packet = partNumber; im.ImageID.ID = imageUuid; im.ImageData.Data = imageData; - - OutPacket(im, ThrottleOutPacketType.Texture); + + OutPacket(im, ThrottleOutPacketType.Texture); } - + public void SendImageNotFound(UUID imageid) { - ImageNotInDatabasePacket notFoundPacket + ImageNotInDatabasePacket notFoundPacket = (ImageNotInDatabasePacket)PacketPool.Instance.GetPacket(PacketType.ImageNotInDatabase); notFoundPacket.ImageID.ID = imageid; @@ -2845,9 +2845,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP pack.Region.ObjectCapacity = stats.ObjectCapacity; //pack.Region = //stats.RegionBlock; pack.Stat = stats.StatsBlock; - + pack.Header.Reliable = false; - + OutPacket(pack, ThrottleOutPacketType.Task); } @@ -3129,7 +3129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned; updatePacket.ParcelData.LandingType = landData.LandingType; updatePacket.ParcelData.LocalID = landData.LocalID; - + if (landData.Area > 0) { updatePacket.ParcelData.MaxPrims = parcelObjectCapacity; @@ -3138,10 +3138,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { updatePacket.ParcelData.MaxPrims = 0; } - + updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale; - updatePacket.ParcelData.MediaID = landData.MediaID; - updatePacket.ParcelData.MediaURL = LLUtil.StringToPacketBytes(landData.MediaURL); + updatePacket.ParcelData.MediaID = landData.MediaID; + updatePacket.ParcelData.MediaURL = LLUtil.StringToPacketBytes(landData.MediaURL); updatePacket.ParcelData.MusicURL = LLUtil.StringToPacketBytes(landData.MusicURL); updatePacket.ParcelData.Name = Utils.StringToBytes(landData.Name); updatePacket.ParcelData.OtherCleanTime = landData.OtherCleanTime; @@ -4162,7 +4162,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// This is the starting point for sending a simulator packet out to the client. - /// + /// /// Please do not call this from outside the LindenUDP client stack. /// /// @@ -4244,13 +4244,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (ProcessPacketMethod(Pack)) { //there is a handler registered that handled this packet type - + // in the end, we dereference this, so we have to check if it's null if (m_imageManager != null) m_imageManager.ProcessImageQueue(3); return; } - + // Main packet processing conditional switch (Pack.Type) { @@ -4266,7 +4266,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.ChatFromViewer: ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; @@ -4296,7 +4296,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerChatFromClient(this, args); } break; - + case PacketType.AvatarPropertiesUpdate: AvatarPropertiesUpdatePacket Packet = (AvatarPropertiesUpdatePacket)Pack; @@ -4335,7 +4335,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.ImprovedInstantMessage: ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); @@ -4383,7 +4383,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP case PacketType.DeclineFriendship: DeclineFriendshipPacket dfriendpack = (DeclineFriendshipPacket)Pack; - + if (OnDenyFriendRequest != null) { OnDenyFriendRequest(this, @@ -4391,7 +4391,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP dfriendpack.TransactionBlock.TransactionID, null); } - break; + break; case PacketType.TerminateFriendship: TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack; @@ -4404,7 +4404,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); } break; - + case PacketType.RezObject: RezObjectPacket rezPacket = (RezObjectPacket)Pack; @@ -4418,8 +4418,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP rezPacket.RezData.FromTaskID); } break; - - case PacketType.DeRezObject: + + case PacketType.DeRezObject: DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) Pack; handlerDeRezObject = OnDeRezObject; if (handlerDeRezObject != null) @@ -4427,8 +4427,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP foreach (DeRezObjectPacket.ObjectDataBlock data in DeRezPacket.ObjectData) { - // It just so happens that the values on the DeRezAction enumerator match the Destination - // values given by a Second Life client + // It just so happens that the values on the DeRezAction enumerator match the Destination + // values given by a Second Life client handlerDeRezObject(this, data.ObjectLocalID, DeRezPacket.AgentBlock.GroupID, (DeRezAction)DeRezPacket.AgentBlock.Destination, @@ -4436,7 +4436,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; - + case PacketType.ModifyLand: ModifyLandPacket modify = (ModifyLandPacket)Pack; //m_log.Info("[LAND]: LAND:" + modify.ToString()); @@ -4461,7 +4461,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.RegionHandshakeReply: handlerRegionHandShakeReply = OnRegionHandShakeReply; @@ -4471,7 +4471,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.AgentWearablesRequest: handlerRequestWearables = OnRequestWearables; @@ -4488,7 +4488,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.AgentSetAppearance: AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; @@ -4537,7 +4537,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; - + case PacketType.RezSingleAttachmentFromInv: handlerRezSingleAttachment = OnRezSingleAttachmentFromInv; if (handlerRezSingleAttachment != null) @@ -4548,7 +4548,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.DetachAttachmentIntoInv: handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; if (handlerDetachAttachmentIntoInv != null) @@ -4561,7 +4561,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerDetachAttachmentIntoInv(itemID, this); } break; - + case PacketType.ObjectAttach: if (OnObjectAttach != null) { @@ -4578,7 +4578,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; - + case PacketType.ObjectDetach: ObjectDetachPacket dett = (ObjectDetachPacket)Pack; for (int j = 0; j < dett.ObjectData.Length; j++) @@ -4592,7 +4592,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.ObjectDrop: ObjectDropPacket dropp = (ObjectDropPacket)Pack; for (int j = 0; j < dropp.ObjectData.Length; j++) @@ -4605,7 +4605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; - + case PacketType.SetAlwaysRun: SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; @@ -4614,7 +4614,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerSetAlwaysRun(this, run.AgentData.AlwaysRun); break; - + case PacketType.CompleteAgentMovement: handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) @@ -4624,7 +4624,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerCompleteMovementToRegion = null; break; - + case PacketType.AgentUpdate: if (OnAgentUpdate != null) { @@ -4653,7 +4653,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa); } break; - + case PacketType.AgentAnimation: AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; @@ -4680,7 +4680,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; - + case PacketType.AgentRequestSit: if (OnAgentRequestSit != null) { @@ -4692,7 +4692,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); } break; - + case PacketType.AgentSit: if (OnAgentSit != null) { @@ -4705,7 +4705,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; - + case PacketType.SoundTrigger: SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack; handlerSoundTrigger = OnSoundTrigger; @@ -4718,7 +4718,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.AvatarPickerRequest: AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; @@ -4732,7 +4732,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Utils.BytesToString(querydata.Name)); } break; - + case PacketType.AgentDataUpdateRequest: AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack; @@ -5108,10 +5108,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP break; case PacketType.ObjectName: ObjectNamePacket objName = (ObjectNamePacket)Pack; - + handlerObjectName = null; for (int i = 0; i < objName.ObjectData.Length; i++) - { + { handlerObjectName = OnObjectName; if (handlerObjectName != null) { @@ -5243,7 +5243,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ObjectClickActionPacket ocpacket = (ObjectClickActionPacket)Pack; handlerObjectClickAction = OnObjectClickAction; - if (handlerObjectClickAction != null) + if (handlerObjectClickAction != null) { foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData) { @@ -5302,7 +5302,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP break; case PacketType.TransferRequest: //Console.WriteLine("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); - + TransferRequestPacket transfer = (TransferRequestPacket)Pack; //Console.WriteLine("Transfer Request: " + transfer.ToString()); // Validate inventory transfers @@ -5346,12 +5346,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (userInfo == null) { m_log.ErrorFormat( - "[CLIENT]: Could not resolve user {0} for caps inventory update", + "[CLIENT]: Could not resolve user {0} for caps inventory update", AgentId); break; } - + if (userInfo.RootFolder == null) break; @@ -5881,7 +5881,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.TeleportLocationRequest: TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; // Console.WriteLine(tpLocReq.ToString()); @@ -6693,11 +6693,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP // TODO: handle this packet //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); break; - + case PacketType.InventoryDescendents: // TODO: handle this packet //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); - + break; case PacketType.DirPlacesQuery: DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack; @@ -6775,7 +6775,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OnEventInfoRequest(this, eventInfoRequestPacket.EventData.EventID); } break; - + case PacketType.ParcelSetOtherCleanTime: ParcelSetOtherCleanTimePacket parcelSetOtherCleanTimePacket = (ParcelSetOtherCleanTimePacket)Pack; handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime; @@ -7516,7 +7516,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } public void SendAgentOnline(UUID[] agentIDs) - { + { OnlineNotificationPacket onp = new OnlineNotificationPacket(); OnlineNotificationPacket.AgentBlockBlock[] onpb = new OnlineNotificationPacket.AgentBlockBlock[agentIDs.Length]; for (int i = 0; i < agentIDs.Length; i++) @@ -7682,7 +7682,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Transfer.TransferInfo.Params = new byte[20]; Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); - int assType = req.AssetInf.Type; + int assType = req.AssetInf.Metadata.Type; Array.Copy(Utils.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); } else if (req.AssetRequestSource == 3) @@ -7901,7 +7901,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { case "ReliableIsImportant": return m_PacketHandler.ReliableIsImportant.ToString(); - + default: break; } @@ -8340,7 +8340,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP dg.AgentData = new AgentDropGroupPacket.AgentDataBlock(); dg.AgentData.AgentID = AgentId; dg.AgentData.GroupID = groupID; - + OutPacket(dg, ThrottleOutPacketType.Task); } @@ -8352,7 +8352,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP an.AgentData = new AvatarNotesReplyPacket.AgentDataBlock(); an.AgentData.AgentID = AgentId; - + an.Data = new AvatarNotesReplyPacket.DataBlock(); an.Data.TargetID = targetID; an.Data.Notes = Utils.StringToBytes(text); @@ -8369,7 +8369,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ap.AgentData = new AvatarPicksReplyPacket.AgentDataBlock(); ap.AgentData.AgentID = AgentId; ap.AgentData.TargetID = targetID; - + ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count]; int i = 0; @@ -8393,7 +8393,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ac.AgentData = new AvatarClassifiedReplyPacket.AgentDataBlock(); ac.AgentData.AgentID = AgentId; ac.AgentData.TargetID = targetID; - + ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count]; int i = 0; @@ -8416,7 +8416,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP pd.AgentData = new ParcelDwellReplyPacket.AgentDataBlock(); pd.AgentData.AgentID = AgentId; - + pd.Data = new ParcelDwellReplyPacket.DataBlock(); pd.Data.LocalID = localID; pd.Data.ParcelID = parcelID; @@ -8437,7 +8437,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ur.AgentData = new UserInfoReplyPacket.AgentDataBlock(); ur.AgentData.AgentID = AgentId; - + ur.UserData = new UserInfoReplyPacket.UserDataBlock(); ur.UserData.IMViaEMail = imViaEmail; ur.UserData.DirectoryVisibility = Utils.StringToBytes(Visible); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs index 517de34060..d2d86b9320 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { /// /// A work in progress, to contain the SL specific file transfer code that is currently in various region modules - /// This file currently contains multiple classes that need to be split out into their own files. + /// This file currently contains multiple classes that need to be split out into their own files. /// public class LLFileTransfer : IClientFileTransfer { @@ -206,13 +206,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void Initialise(UUID fileID, string fileName) { m_asset = new AssetBase(); - m_asset.FullID = fileID; - m_asset.Type = type; + m_asset.Metadata.FullID = fileID; + m_asset.Metadata.Type = type; m_asset.Data = new byte[0]; - m_asset.Name = fileName; - m_asset.Description = "empty"; - m_asset.Local = true; - m_asset.Temporary = true; + m_asset.Metadata.Name = fileName; + m_asset.Metadata.Description = "empty"; + m_asset.Metadata.Local = true; + m_asset.Metadata.Temporary = true; mXferID = Util.GetNextXferID(); } @@ -223,13 +223,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void RequestStartXfer(IClientAPI pRemoteClient) { - if (!String.IsNullOrEmpty(m_asset.Name)) + if (!String.IsNullOrEmpty(m_asset.Metadata.Name)) { - pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); + pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name)); } else { - pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); + pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]); } } @@ -238,7 +238,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// /// - /// + /// public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) { if (mXferID == xferID) @@ -273,7 +273,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUploadDone = UploadDone; if (handlerUploadDone != null) { - handlerUploadDone(m_asset.Name, m_asset.FullID, mXferID, m_asset.Data, remoteClient); + handlerUploadDone(m_asset.Metadata.Name, m_asset.Metadata.FullID, mXferID, m_asset.Data, remoteClient); } } @@ -282,7 +282,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerAbort = UploadAborted; if (handlerAbort != null) { - handlerAbort(m_asset.Name, m_asset.FullID, mXferID, remoteClient); + handlerAbort(m_asset.Metadata.Name, m_asset.Metadata.FullID, mXferID, remoteClient); } } } @@ -373,4 +373,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 3b21c8546a..f903c45db6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Priority Queue for images. Contains lots of data /// private readonly IPriorityQueue> pq = new IntervalHeap>(); - + /// /// Dictionary of PriorityQueue handles by AssetId /// @@ -87,7 +87,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //if (req.RequestType == 1) // avatar body texture! // return; - + AddQueueItem(req.RequestedAssetID, (int)req.Priority + 100000); //if (pq[PQHandles[req.RequestedAssetID]].data.Missing) //{ @@ -96,9 +96,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // //if (pq[PQHandles[req.RequestedAssetID]].data.HasData && pq[PQHandles[req.RequestedAssetID]].data.Layers.Length > 0) //{ - + //} - + pq[PQHandles[req.RequestedAssetID]].data.requestedUUID = req.RequestedAssetID; pq[PQHandles[req.RequestedAssetID]].data.Priority = (int)req.Priority; @@ -118,7 +118,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; //Console.WriteLine("AssetCallback for assetId" + assetID); - + if (asset == null || asset.Data == null) { lock (pq) @@ -132,12 +132,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP pq[PQHandles[assetID]].data.asset = asset; - + //lock (pq[PQHandles[assetID]].data) pq[PQHandles[assetID]].data.Update((int)pq[PQHandles[assetID]].data.Priority, pq[PQHandles[assetID]].data.CurrentPacket); - - - + + + } /// @@ -174,7 +174,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Is the asset missing? if (process.data.Missing) { - + //m_client.sendtextur pq[h] -= 90000; /* @@ -191,7 +191,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Substitute a blank image process.data.asset = MissingSubstitute; process.data.Missing = false; - + // If the priority is less then -4billion, the client has forgotten about it. if (pq[h] < -400000000) { @@ -224,7 +224,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP j2kDecodedCallback(process.data.AssetId, new OpenJPEG.J2KLayerInfo[0]); } - + } // Are we waiting? else if (!process.data.J2KDecodeWaiting) @@ -259,10 +259,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP //pq[h] = process; } - + // uncomment the following line to see the upper most asset and the priority //Console.WriteLine(process.ToString()); - + // Lower priority to give the next image a chance to bubble up pq[h] -= 50000; } @@ -318,7 +318,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } - + /// /// Adds an image to the queue and update priority @@ -336,7 +336,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { h = PQHandles[AssetId]; pq[h] = pq[h].SetPriority(priority); - + } else { @@ -354,7 +354,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void Close() { m_shuttingdown = true; - + lock (pq) { while (!pq.IsEmpty) @@ -362,7 +362,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP pq.DeleteMin(); } } - + lock (PQHandles) PQHandles.Clear(); @@ -423,7 +423,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public UUID AssetId { - get { return m_asset_ref.FullID; } + get { return m_asset_ref.Metadata.FullID; } } /// @@ -544,7 +544,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// true if a packet was sent, false if not public bool SendPacket(LLClientView client) { - // If we've hit the end of the send or if the client set -1, return false. + // If we've hit the end of the send or if the client set -1, return false. if (CurrentPacket > StopPacket || StopPacket == -1) return false; @@ -564,7 +564,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - + // Send first packet byte[] firstImageData = new byte[FIRST_IMAGE_PACKET_SIZE]; try { Buffer.BlockCopy(m_asset_ref.Data, 0, firstImageData, 0, FIRST_IMAGE_PACKET_SIZE); } @@ -585,7 +585,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // figure out if we're on the last packet, if so, use the last packet size. If not, use 1000. // we know that the total image size is greater then 1000 if we're here int imagePacketSize = (CurrentPacket == (TexturePacketCount() ) ) ? LastPacketSize() : IMAGE_PACKET_SIZE; - + //if (imagePacketSize > 0) // imagePacketSize = IMAGE_PACKET_SIZE; //if (imagePacketSize != 1000) @@ -611,7 +611,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { Buffer.BlockCopy(m_asset_ref.Data, CurrentBytePosition(), imageData, 0, imagePacketSize); } catch (Exception e) { - Console.WriteLine(String.Format("Err: srcLen:{0}, BytePos:{1}, desLen:{2}, pktsize:{3}, currpak:{4}, stoppak:{5}, totalpak:{6}", m_asset_ref.Data.Length, CurrentBytePosition(), + Console.WriteLine(String.Format("Err: srcLen:{0}, BytePos:{1}, desLen:{2}, pktsize:{3}, currpak:{4}, stoppak:{5}, totalpak:{6}", m_asset_ref.Data.Length, CurrentBytePosition(), imageData.Length, imagePacketSize, CurrentPacket,StopPacket,TexturePacketCount())); Console.WriteLine(e.ToString()); //m_log.Error("Texture data copy failed for " + m_asset_ref.FullID.ToString()); @@ -622,7 +622,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send next packet to the client client.SendImageNextPart((ushort)(CurrentPacket - 1), requestedUUID, imageData); - + ++CurrentPacket; if (atEnd) @@ -630,7 +630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } - + } /// @@ -676,7 +676,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public static Prio operator -(Prio tp, int delta) { - if (tp.priority - delta < 0) + if (tp.priority - delta < 0) return new Prio(tp.data, tp.priority - delta); else return new Prio(tp.data, 0); diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs index 087467695b..961ecb1828 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs @@ -1,29 +1,29 @@ /** * Copyright (c) 2008, Contributors. All rights reserved. * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without modification, + * + * 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, + * + * * 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 + * * 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 Organizations nor the names of Individual - * Contributors may be used to endorse or promote products derived from + * Contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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 + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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. - * + * */ @@ -73,11 +73,11 @@ namespace OpenSim.Region.Communications.Hypergrid public BaseHttpServer httpServer; protected List m_regionsOnInstance = new List(); - + // Hyperlink regions are hyperlinks on the map protected List m_hyperlinkRegions = new List(); - // Known regions are home regions of visiting foreign users. + // Known regions are home regions of visiting foreign users. // They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when // the visitor goes away. They are mapped to X=0 on the map. // This is key-ed on agent ID @@ -326,13 +326,13 @@ namespace OpenSim.Region.Communications.Hypergrid //Console.WriteLine("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); byte[] imageData = OpenJPEG.EncodeFromImage(m, true); AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString()); - info.RegionSettings.TerrainImageID = ass.FullID; - ass.Type = (int)AssetType.Texture; - ass.Temporary = false; + info.RegionSettings.TerrainImageID = ass.Metadata.FullID; + ass.Metadata.Type = (int)AssetType.Texture; + ass.Metadata.Temporary = false; //imageData.CopyTo(ass.Data, 0); ass.Data = imageData; m_assetcache.AddAsset(ass); - + } catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke { @@ -342,7 +342,7 @@ namespace OpenSim.Region.Communications.Hypergrid // A little ugly, since this code is exactly the same as OSG1's, and we're already // calling that for when the region in in grid mode... (for the grid regions) - // + // public virtual LandData RequestLandData (ulong regionHandle, uint x, uint y) { m_log.DebugFormat("[HGrid]: requests land data in {0}, at {1}, {2}", @@ -542,23 +542,23 @@ namespace OpenSim.Region.Communications.Hypergrid m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret); } - string capsPath = agentData.CapsPath; + string capsPath = agentData.CapsPath; Hashtable loginParams = new Hashtable(); - loginParams["session_id"] = agentData.SessionID.ToString(); - loginParams["secure_session_id"] = agentData.SecureSessionID.ToString(); + loginParams["session_id"] = agentData.SessionID.ToString(); + loginParams["secure_session_id"] = agentData.SecureSessionID.ToString(); loginParams["firstname"] = agentData.firstname; loginParams["lastname"] = agentData.lastname; - loginParams["agent_id"] = agentData.AgentID.ToString(); - loginParams["circuit_code"] = agentData.circuitcode.ToString(); - loginParams["startpos_x"] = agentData.startpos.X.ToString(); - loginParams["startpos_y"] = agentData.startpos.Y.ToString(); - loginParams["startpos_z"] = agentData.startpos.Z.ToString(); + loginParams["agent_id"] = agentData.AgentID.ToString(); + loginParams["circuit_code"] = agentData.circuitcode.ToString(); + loginParams["startpos_x"] = agentData.startpos.X.ToString(); + loginParams["startpos_y"] = agentData.startpos.Y.ToString(); + loginParams["startpos_z"] = agentData.startpos.Z.ToString(); loginParams["caps_path"] = capsPath; CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID); - if (u != null && u.UserProfile != null) + if (u != null && u.UserProfile != null) { loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero //Console.WriteLine(" --------- Home Region UUID -------"); @@ -691,7 +691,7 @@ namespace OpenSim.Region.Communications.Hypergrid userData.UserServerURI = (string)requestData["userserver_id"]; userData.UserAssetURI = (string)requestData["assetserver_id"]; - userData.UserInventoryURI = (string)requestData["inventoryserver_id"]; + userData.UserInventoryURI = (string)requestData["inventoryserver_id"]; UUID rootID = UUID.Zero; UUID.TryParse((string)requestData["root_folder_id"], out rootID); @@ -710,7 +710,7 @@ namespace OpenSim.Region.Communications.Hypergrid m_log.DebugFormat("[HGrid]: Told by user service to prepare for a connection from {0} {1} {2}", userData.FirstName, userData.SurName, userData.ID); - m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress + + m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress + "; home_port: " + userData.UserHomePort + "; remoting: " + userData.UserHomeRemotingPort); @@ -926,7 +926,7 @@ namespace OpenSim.Region.Communications.Hypergrid return true; } - public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) { // If we're here, it's because regionHandle is a remote, non-grided region m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle); @@ -934,7 +934,7 @@ namespace OpenSim.Region.Communications.Hypergrid RegionInfo regInfo = GetHyperlinkRegion(regionHandle); if (regInfo == null) return false; - + //ulong realHandle = regionHandle; if (!SendUserInformation(regInfo, agentData)) @@ -1184,7 +1184,7 @@ namespace OpenSim.Region.Communications.Hypergrid #region Methods triggered by calls from external instances /// - /// + /// /// /// /// @@ -1192,7 +1192,7 @@ namespace OpenSim.Region.Communications.Hypergrid public void AdjustUserInformation(AgentCircuitData agentData) { CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); - if ((uinfo != null) && (uinfo.UserProfile != null) && + if ((uinfo != null) && (uinfo.UserProfile != null) && (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData))) { //Console.WriteLine("---------------> Local User!"); @@ -1232,7 +1232,7 @@ namespace OpenSim.Region.Communications.Hypergrid if (info.RegionHandle == ihandle) return info; } - + return null; } @@ -1250,7 +1250,7 @@ namespace OpenSim.Region.Communications.Hypergrid ohandle = Convert.ToInt64(info.regionSecret); m_log.Info("[HGrid] remote region " + ohandle); } - catch + catch { m_log.Error("[HGrid] Could not convert secret for " + ihandle + " (" + info.regionSecret + ")"); } diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs index 689b4d513d..7f4bb0b558 100644 --- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs +++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs @@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction } public void HandleXfer(ulong xferID, uint packetID, byte[] data) - { + { lock (XferUploaders) { foreach (AssetXferUploader uploader in XferUploaders.Values) @@ -97,8 +97,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction wearableType, nextOwnerMask); } } - - + + /// /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed. @@ -171,10 +171,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction "[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}", item.Name, part.Name, transactionID); - asset.Name = item.Name; - asset.Description = item.Description; - asset.Type = (sbyte)item.Type; - item.AssetID = asset.FullID; + asset.Metadata.Name = item.Name; + asset.Metadata.Description = item.Description; + asset.Metadata.Type = (sbyte)item.Type; + item.AssetID = asset.Metadata.FullID; Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); @@ -206,14 +206,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction asset = GetTransactionAsset(transactionID); } - if (asset != null && asset.FullID == assetID) + if (asset != null && asset.Metadata.FullID == assetID) { // Assets never get updated, new ones get created - asset.FullID = UUID.Random(); - asset.Name = item.Name; - asset.Description = item.Description; - asset.Type = (sbyte)item.AssetType; - item.AssetID = asset.FullID; + asset.Metadata.FullID = UUID.Random(); + asset.Metadata.Name = item.Name; + asset.Metadata.Description = item.Description; + asset.Metadata.Type = (sbyte)item.AssetType; + item.AssetID = asset.Metadata.FullID; Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); } diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs index 6dcbe836bc..5387165b18 100644 --- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs @@ -113,17 +113,17 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction { ourClient = remoteClient; m_asset = new AssetBase(); - m_asset.FullID = assetID; - m_asset.Type = type; + m_asset.Metadata.FullID = assetID; + m_asset.Metadata.Type = type; m_asset.Data = data; - m_asset.Name = "blank"; - m_asset.Description = "empty"; - m_asset.Local = storeLocal; - m_asset.Temporary = tempFile; + m_asset.Metadata.Name = "blank"; + m_asset.Metadata.Description = "empty"; + m_asset.Metadata.Local = storeLocal; + m_asset.Metadata.Temporary = tempFile; TransactionID = transaction; m_storeLocal = storeLocal; - + if (m_asset.Data.Length > 2) { SendCompleteMessage(); @@ -140,12 +140,12 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction protected void RequestStartXfer() { XferID = Util.GetNextXferID(); - ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); + ourClient.SendXferRequest(XferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]); } protected void SendCompleteMessage() { - ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID); + ourClient.SendAssetUploadCompleteMessage(m_asset.Metadata.Type, true, m_asset.Metadata.FullID); m_finished = true; if (m_createItem) @@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction DateTime now = DateTime.Now; string filename = String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day, - now.Hour, now.Minute, now.Second, m_asset.Name, m_asset.Type); + now.Hour, now.Minute, now.Second, m_asset.Metadata.Name, m_asset.Metadata.Type); SaveAssetToFile(filename, m_asset.Data); } } @@ -196,9 +196,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction this.invType = invType; this.wearableType = wearableType; nextPerm = nextOwnerMask; - m_asset.Name = name; - m_asset.Description = description; - m_asset.Type = type; + m_asset.Metadata.Name = name; + m_asset.Metadata.Description = description; + m_asset.Metadata.Type = type; if (m_finished) { @@ -211,7 +211,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction } } - + private void DoCreateItem() { m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset); @@ -225,7 +225,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction item.Owner = ourClient.AgentId; item.Creator = ourClient.AgentId; item.ID = UUID.Random(); - item.AssetID = m_asset.FullID; + item.AssetID = m_asset.Metadata.FullID; item.Description = m_description; item.Name = m_name; item.AssetType = type; @@ -245,9 +245,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction else { m_log.ErrorFormat( - "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", + "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", ourClient.AgentId); - } + } } /// @@ -260,7 +260,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction { return m_asset; } - + return null; } } diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs index a6901b650e..f9a10bfc73 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender /// private AssetBase m_asset; - //public UUID assetID { get { return m_asset.FullID; } } + //public UUID assetID { get { return m_asset.Metadata.FullID; } } // private bool m_cancel = false; @@ -93,7 +93,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender get { return false; } set { - // m_cancel = value; + // m_cancel = value; } } @@ -102,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender get { return false; } set { - // m_sending = value; + // m_sending = value; } } @@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender // See ITextureSender public bool SendTexturePacket() { - //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.FullID); + //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.Metadata.FullID); SendPacket(); counter++; @@ -154,7 +154,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender { if (NumPackets == 0) { - RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); + RequestUser.SendImageFirstPart(1, m_asset.Metadata.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); PacketCounter++; } else @@ -163,7 +163,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender Array.Copy(m_asset.Data, 0, ImageData1, 0, 600); RequestUser.SendImageFirstPart( - (ushort)(NumPackets), m_asset.FullID, (uint)m_asset.Data.Length, ImageData1, 2); + (ushort)(NumPackets), m_asset.Metadata.FullID, (uint)m_asset.Data.Length, ImageData1, 2); PacketCounter++; } } @@ -179,11 +179,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender catch (ArgumentOutOfRangeException) { m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" + - m_asset.FullID.ToString()); + m_asset.Metadata.ID); return; } - RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.FullID, imageData); + RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.Metadata.FullID, imageData); PacketCounter++; } } diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 862caa9e09..dcfcba32c6 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver public class InventoryArchiveReadRequest { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + protected Scene scene; protected TarArchiveReader archive; private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); @@ -65,7 +65,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver InventoryItemBase item = new InventoryItemBase(); StringReader sr = new StringReader(contents); XmlTextReader reader = new XmlTextReader(sr); - + if (contents.Equals("")) return null; reader.ReadStartElement("InventoryObject"); @@ -79,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver item.InvType = System.Convert.ToInt32(reader.ReadString()); reader.ReadEndElement(); reader.ReadStartElement("CreatorUUID"); - item.Creator = UUID.Parse(reader.ReadString()); + item.Creator = UUID.Parse(reader.ReadString()); reader.ReadEndElement(); reader.ReadStartElement("CreationDate"); item.CreationDate = System.Convert.ToInt32(reader.ReadString()); @@ -94,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver } else { - reader.ReadStartElement("Description"); + reader.ReadStartElement("Description"); item.Description = reader.ReadString(); reader.ReadEndElement(); } @@ -145,7 +145,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver int successfulAssetRestores = 0; int failedAssetRestores = 0; int successfulItemRestores = 0; - + UserProfileData userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); if (null == userProfile) { @@ -157,28 +157,28 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver if (null == userInfo) { m_log.ErrorFormat( - "[CONSOLE]: Failed to find user info for {0} {1} {2}", + "[CONSOLE]: Failed to find user info for {0} {1} {2}", firstName, lastName, userProfile.ID); - + return; } - + if (!userInfo.HasReceivedInventory) { m_log.ErrorFormat( - "[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", + "[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", firstName, lastName, userProfile.ID); - + return; - } - + } + InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath); if (null == inventoryFolder) { // TODO: Later on, automatically create this folder if it does not exist m_log.ErrorFormat("[ARCHIVER]: Inventory path {0} does not exist", invPath); - + return; } @@ -202,17 +202,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver else { InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data)); - - if (item != null) + + if (item != null) { item.Creator = userProfile.ID; item.Owner = userProfile.ID; - + // Reset folder ID to the one in which we want to load it // TODO: Properly restore entire folder structure. At the moment all items are dumped in this // single folder no matter where in the saved folder structure they are. item.Folder = inventoryFolder.ID; - + userInfo.AddItem(item); successfulItemRestores++; } @@ -258,7 +258,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); - asset.Type = assetType; + asset.Metadata.Type = assetType; asset.Data = data; scene.AssetCache.AddAsset(asset); diff --git a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs index 0974f0276d..bddf10d837 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -231,21 +231,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture // Create a new asset for user AssetBase asset = new AssetBase(); - asset.FullID = UUID.Random(); + asset.Metadata.FullID = UUID.Random(); asset.Data = assetData; - asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); - asset.Type = 0; - asset.Description = "dynamic image"; - asset.Local = false; - asset.Temporary = true; + asset.Metadata.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); + asset.Metadata.Type = 0; + asset.Metadata.Description = "dynamic image"; + asset.Metadata.Local = false; + asset.Metadata.Temporary = true; scene.AssetCache.AddAsset(asset); - LastAssetID = asset.FullID; + LastAssetID = asset.Metadata.FullID; IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface(); if (cacheLayerDecode != null) { - cacheLayerDecode.syncdecode(asset.FullID, asset.Data); + cacheLayerDecode.syncdecode(asset.Metadata.FullID, asset.Data); } cacheLayerDecode = null; @@ -256,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture UUID oldID = tmptex.DefaultTexture.TextureID; scene.AssetCache.ExpireAsset(oldID); - tmptex.DefaultTexture.TextureID = asset.FullID; + tmptex.DefaultTexture.TextureID = asset.Metadata.FullID; // I'm pretty sure we always want to force this to true tmptex.DefaultTexture.Fullbright = true; @@ -287,7 +287,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture try { result = OpenJPEG.EncodeFromImage(joint, true); - } + } catch (Exception) { Console.WriteLine( diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 4e9fcef170..c860d01c09 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs @@ -66,12 +66,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); m_errorMessage = String.Empty; } - + public ArchiveReadRequest(Scene scene, Stream loadStream) { m_scene = scene; m_loadStream = loadStream; - } + } /// /// Dearchive the region embodied in this request. @@ -81,7 +81,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver // The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions DearchiveRegion0DotStar(); } - + private void DearchiveRegion0DotStar() { int successfulAssetRestores = 0; @@ -98,12 +98,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver byte[] data; TarArchiveReader.TarEntryType entryType; - + while ((data = archive.ReadEntry(out filePath, out entryType)) != null) { //m_log.DebugFormat( // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); - if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) + if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) { m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", filePath); @@ -133,7 +133,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver LoadRegionSettings(filePath, data); } } - + //m_log.Debug("[ARCHIVER]: Reached end of archive"); archive.Close(); @@ -154,10 +154,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); } - + m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); m_scene.DeleteAllSceneObjects(); - + // Reload serialized prims m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); @@ -176,10 +176,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver // Try to retain the original creator/owner/lastowner if their uuid is present on this grid // otherwise, use the master avatar uuid instead UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; - + if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner; - + foreach (SceneObjectPart part in sceneObject.Children.Values) { if (!resolveUserUuid(part.CreatorID)) @@ -233,7 +233,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver { sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); } - + m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); } @@ -290,12 +290,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); - asset.Type = assetType; + asset.Metadata.Type = assetType; asset.Data = data; m_scene.AssetCache.AddAsset(asset); - - /** + + /** * Create layers on decode for image assets. This is likely to significantly increase the time to load archives so * it might be best done when dearchive takes place on a separate thread if (asset.Type=AssetType.Texture) @@ -317,7 +317,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver return false; } } - + /// /// Load region settings data /// @@ -329,7 +329,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver private bool LoadRegionSettings(string settingsPath, byte[] data) { RegionSettings loadedRegionSettings; - + try { loadedRegionSettings = RegionSettingsSerializer.Deserialize(data); @@ -337,13 +337,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver catch (Exception e) { m_log.ErrorFormat( - "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", + "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", settingsPath, e); return false; } - + RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; - + currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit; currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage; currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide; @@ -373,10 +373,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; - + IEstateModule estateModule = m_scene.RequestModuleInterface(); estateModule.sendRegionHandshakeToAll(); - + return true; } @@ -411,11 +411,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver if (File.Exists(path)) { return new FileStream(path, FileMode.Open); - } + } else { Uri uri = new Uri(path); // throw exception if not valid URI - if (uri.Scheme == "file") + if (uri.Scheme == "file") { return new FileStream(uri.AbsolutePath, FileMode.Open); } diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs index 75ae47439f..36a60f37c9 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs @@ -86,16 +86,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver string extension = string.Empty; - if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) { - extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; + extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; } xtw.WriteElementString("filename", uuid.ToString() + extension); - xtw.WriteElementString("name", asset.Name); - xtw.WriteElementString("description", asset.Description); - xtw.WriteElementString("asset-type", asset.Type.ToString()); + xtw.WriteElementString("name", asset.Metadata.Name); + xtw.WriteElementString("description", asset.Metadata.Description); + xtw.WriteElementString("asset-type", asset.Metadata.Type.ToString()); xtw.WriteEndElement(); } @@ -123,15 +123,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver string extension = string.Empty; - if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) { - extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; + extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; } else { m_log.ErrorFormat( "[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded", - asset.Type, asset.ID); + asset.Metadata.Type, asset.Metadata.ID); } archive.AddFile( diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs index b26fe4c6c2..0ef1e1d769 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs @@ -157,8 +157,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); - asset.Description = metadata.Description; - asset.Type = metadata.AssetType; + asset.Metadata.Description = metadata.Description; + asset.Metadata.Type = metadata.AssetType; asset.Data = data; m_cache.AddAsset(asset); diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs index 6d69443649..2ba4e3470c 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs @@ -37,13 +37,13 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Modules.World.Estate { - + public class EstateTerrainXferHandler { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private AssetBase m_asset; - + public delegate void TerrainUploadComplete(string name, byte[] filedata, IClientAPI remoteClient); public event TerrainUploadComplete TerrainUploadDone; @@ -52,21 +52,21 @@ namespace OpenSim.Region.Environment.Modules.World.Estate //private string m_name = String.Empty; //private UUID TransactionID = UUID.Zero; private sbyte type = 0; - + public ulong mXferID; private TerrainUploadComplete handlerTerrainUploadDone; public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) { - + m_asset = new AssetBase(); - m_asset.FullID = UUID.Zero; - m_asset.Type = type; + m_asset.Metadata.FullID = UUID.Zero; + m_asset.Metadata.Type = type; m_asset.Data = new byte[0]; - m_asset.Name = pClientFilename; - m_asset.Description = "empty"; - m_asset.Local = true; - m_asset.Temporary = true; + m_asset.Metadata.Name = pClientFilename; + m_asset.Metadata.Description = "empty"; + m_asset.Metadata.Local = true; + m_asset.Metadata.Temporary = true; } @@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate public void RequestStartXfer(IClientAPI pRemoteClient) { mXferID = Util.GetNextXferID(); - pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); + pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name)); } /// @@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate /// /// /// - /// + /// public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) { if (mXferID == xferID) @@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate if ((packetID & 0x80000000) != 0) { SendCompleteMessage(remoteClient); - + } } } @@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate handlerTerrainUploadDone = TerrainUploadDone; if (handlerTerrainUploadDone != null) { - handlerTerrainUploadDone(m_asset.Name,m_asset.Data, remoteClient); + handlerTerrainUploadDone(m_asset.Metadata.Name, m_asset.Data, remoteClient); } } } diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs index 3acaa218ea..73a5a3a09a 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs @@ -1,29 +1,29 @@ /** * Copyright (c) 2008, Contributors. All rights reserved. * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without modification, + * + * 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, + * + * * 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 + * * 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 Organizations nor the names of Individual - * Contributors may be used to endorse or promote products derived from + * Contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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 + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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; @@ -48,7 +48,7 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Scenes.Hypergrid { - public class HGAssetMapper + public class HGAssetMapper { #region Fields private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -128,12 +128,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset) && (asset != null)) { - m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID); - // I think I need to store it in the asset DB too. + m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Metadata.Name + " " + assetID); + // I think I need to store it in the asset DB too. // For now, let me just do it for textures and scripts - if (((AssetType)asset.Type == AssetType.Texture) || - ((AssetType)asset.Type == AssetType.LSLBytecode) || - ((AssetType)asset.Type == AssetType.LSLText)) + if (((AssetType)asset.Metadata.Type == AssetType.Texture) || + ((AssetType)asset.Metadata.Type == AssetType.LSLBytecode) || + ((AssetType)asset.Metadata.Type == AssetType.LSLText)) { AssetBase asset1 = new AssetBase(); Copy(asset, asset1); @@ -157,9 +157,9 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid if (asset1 != null) { // See long comment in AssetCache.AddAsset - if (!asset1.Temporary || asset1.Local) + if (!asset1.Metadata.Temporary || asset1.Metadata.Local) { - // The asset cache returns instances of subclasses of AssetBase: + // The asset cache returns instances of subclasses of AssetBase: // TextureImage or AssetInfo. So in passing them to the remote // server we first need to convert this to instances of AssetBase, // which is the serializable class for assets. @@ -179,14 +179,14 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid private void Copy(AssetBase from, AssetBase to) { to.Data = from.Data; - to.Description = from.Description; - to.FullID = from.FullID; - to.ID = from.ID; - to.Local = from.Local; - to.Name = from.Name; - to.Temporary = from.Temporary; - to.Type = from.Type; - + to.Metadata.Description = from.Metadata.Description; + to.Metadata.FullID = from.Metadata.FullID; + to.Metadata.ID = from.Metadata.ID; + to.Metadata.Local = from.Metadata.Local; + to.Metadata.Name = from.Metadata.Name; + to.Metadata.Temporary = from.Metadata.Temporary; + to.Metadata.Type = from.Metadata.Type; + } private void _guardedAdd(Dictionary lst, UUID obj, bool val) @@ -243,7 +243,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid private Dictionary SniffUUIDs(AssetBase asset) { Dictionary uuids = new Dictionary(); - if ((asset != null) && ((AssetType)asset.Type == AssetType.Object)) + if ((asset != null) && ((AssetType)asset.Metadata.Type == AssetType.Object)) { string ass_str = Utils.BytesToString(asset.Data); SceneObjectGroup sog = new SceneObjectGroup(ass_str, true); diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 58ab058d49..cb9aee25b0 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -42,12 +42,12 @@ namespace OpenSim.Region.Environment.Scenes public partial class Scene { private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// Allows asynchronous derezzing of objects from the scene into a client's inventory. /// - protected AsyncSceneObjectGroupDeleter m_asyncSceneObjectDeleter; + protected AsyncSceneObjectGroupDeleter m_asyncSceneObjectDeleter; /// /// Start all the scripts in the scene which should be started. @@ -145,9 +145,9 @@ namespace OpenSim.Region.Environment.Scenes else { m_log.ErrorFormat( - "[AGENT INVENTORY]: Could not resolve user {0} for adding an inventory item", + "[AGENT INVENTORY]: Could not resolve user {0} for adding an inventory item", remoteClient.AgentId); - } + } } /// @@ -175,7 +175,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); return UUID.Zero; } - + remoteClient.SendAgentAlertMessage("Notecard saved", false); } else if ((InventoryType)item.InvType == InventoryType.LSL) @@ -185,7 +185,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); return UUID.Zero; } - + remoteClient.SendAgentAlertMessage("Script saved", false); } @@ -193,21 +193,21 @@ namespace OpenSim.Region.Environment.Scenes CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); AssetCache.AddAsset(asset); - item.AssetID = asset.FullID; + item.AssetID = asset.Metadata.FullID; userInfo.UpdateItem(item); // remoteClient.SendInventoryItemCreateUpdate(item); - return (asset.FullID); + return (asset.Metadata.FullID); } } } else { m_log.ErrorFormat( - "[AGENT INVENTORY]: Could not resolve user {0} for caps inventory update", + "[AGENT INVENTORY]: Could not resolve user {0} for caps inventory update", remoteClient.AgentId); - } - + } + return UUID.Zero; } @@ -283,9 +283,9 @@ namespace OpenSim.Region.Environment.Scenes { part.Inventory.RemoveScriptInstance(item.ItemID); } - + // Update item with new asset - item.AssetID = asset.FullID; + item.AssetID = asset.Metadata.FullID; group.UpdateInventoryItem(item); part.GetProperties(remoteClient); @@ -406,7 +406,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// ID of the sender of the item - /// + /// public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) { InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId); @@ -420,19 +420,19 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// ID of the sender of the item - /// + /// /// The inventory item copy given, null if the give was unsuccessful public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId) { return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero); } - + /// /// Give an inventory item from one user to another /// /// /// ID of the sender of the item - /// + /// /// /// The id of the folder in which the copy item should go. If UUID.Zero then the item is placed in the most /// appropriate default folder. @@ -485,7 +485,7 @@ namespace OpenSim.Region.Environment.Scenes itemCopy.AssetType = item.AssetType; itemCopy.InvType = item.InvType; itemCopy.Folder = recipientFolderId; - + if (Permissions.PropagatePermissions()) { if (item.InvType == 6) @@ -557,19 +557,19 @@ namespace OpenSim.Region.Environment.Scenes m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder"); return null; } - + return null; } - + /// - /// Give an entire inventory folder from one user to another. The entire contents (including all descendent + /// Give an entire inventory folder from one user to another. The entire contents (including all descendent /// folders) is given. /// /// /// ID of the sender of the item /// /// - /// The id of the receipient folder in which the send folder should be placed. If UUID.Zero then the + /// The id of the receipient folder in which the send folder should be placed. If UUID.Zero then the /// recipient folder is the root folder /// /// @@ -588,24 +588,24 @@ namespace OpenSim.Region.Environment.Scenes return null; } - + if (!senderUserInfo.HasReceivedInventory) { m_log.DebugFormat( "[AGENT INVENTORY]: Could not give inventory folder - have not yet received inventory for {0}", senderId); - + return null; } - + InventoryFolderImpl folder = senderUserInfo.RootFolder.FindFolder(folderId); - + if (null == folder) { m_log.ErrorFormat( "[AGENT INVENTORY]: Could not find inventory folder {0} to give", folderId); - return null; + return null; } CachedUserInfo recipientUserInfo @@ -618,30 +618,30 @@ namespace OpenSim.Region.Environment.Scenes return null; } - + if (recipientParentFolderId == UUID.Zero) recipientParentFolderId = recipientUserInfo.RootFolder.ID; - + UUID newFolderId = UUID.Random(); recipientUserInfo.CreateFolder(folder.Name, newFolderId, (ushort)folder.Type, recipientParentFolderId); - + // XXX: Messy - we should really get this back in the CreateFolder call InventoryFolderImpl copiedFolder = recipientUserInfo.RootFolder.FindFolder(newFolderId); - + // Give all the subfolders List subFolders = folder.RequestListOfFolderImpls(); foreach (InventoryFolderImpl childFolder in subFolders) { GiveInventoryFolder(recipientId, senderId, childFolder.ID, copiedFolder.ID); - } - + } + // Give all the items List items = folder.RequestListOfItems(); foreach (InventoryItemBase item in items) { GiveInventoryItem(recipientId, senderId, item.ID, copiedFolder.ID); } - + return copiedFolder; } @@ -688,7 +688,7 @@ namespace OpenSim.Region.Environment.Scenes { if (newName != String.Empty) { - asset.Name = newName; + asset.Metadata.Name = newName; } else { @@ -728,10 +728,10 @@ namespace OpenSim.Region.Environment.Scenes private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) { AssetBase asset = new AssetBase(); - asset.Name = name; - asset.Description = description; - asset.Type = assetType; - asset.FullID = UUID.Random(); + asset.Metadata.Name = name; + asset.Metadata.Description = description; + asset.Metadata.Type = assetType; + asset.Metadata.FullID = UUID.Random(); asset.Data = (data == null) ? new byte[1] : data; return asset; @@ -831,11 +831,11 @@ namespace OpenSim.Region.Environment.Scenes item.Owner = remoteClient.AgentId; item.Creator = remoteClient.AgentId; item.ID = UUID.Random(); - item.AssetID = asset.FullID; - item.Description = asset.Description; + item.AssetID = asset.Metadata.FullID; + item.Description = asset.Metadata.Description; item.Name = name; item.Flags = flags; - item.AssetType = asset.Type; + item.AssetType = asset.Metadata.Type; item.InvType = invType; item.Folder = folderID; item.CurrentPermissions = currentMask; @@ -879,7 +879,7 @@ namespace OpenSim.Region.Environment.Scenes if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) return; - + if (transactionID == UUID.Zero) { CachedUserInfo userInfo @@ -890,7 +890,7 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence presence; TryGetAvatar(remoteClient.AgentId, out presence); byte[] data = null; - + if (invType == 3 && presence != null) // OpenMetaverse.asset.assettype.landmark = 3 - needs to be turned into an enum { Vector3 pos = presence.AbsolutePosition; @@ -905,7 +905,7 @@ namespace OpenSim.Region.Environment.Scenes AssetBase asset = CreateAsset(name, description, assetType, data); AssetCache.AddAsset(asset); - CreateNewInventoryItem(remoteClient, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); + CreateNewInventoryItem(remoteClient, folderID, asset.Metadata.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); } else { @@ -1429,7 +1429,7 @@ namespace OpenSim.Region.Environment.Scenes } } else // Updating existing item with new perms etc - { + { IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); if (agentTransactions != null) { @@ -1511,7 +1511,7 @@ namespace OpenSim.Region.Environment.Scenes } } else // script has been rezzed directly into a prim's inventory - { + { SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); if (part == null) return; @@ -1521,10 +1521,10 @@ namespace OpenSim.Region.Environment.Scenes if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) return; - + if (!Permissions.CanCreateObjectInventory( - itemBase.InvType, part.UUID, remoteClient.AgentId)) - return; + itemBase.InvType, part.UUID, remoteClient.AgentId)) + return; AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); AssetCache.AddAsset(asset); @@ -1550,7 +1550,7 @@ namespace OpenSim.Region.Environment.Scenes taskItem.Flags = itemBase.Flags; taskItem.PermsGranter = UUID.Zero; taskItem.PermsMask = 0; - taskItem.AssetID = asset.FullID; + taskItem.AssetID = asset.Metadata.FullID; part.Inventory.AddInventoryItem(taskItem, false); part.GetProperties(remoteClient); @@ -1737,7 +1737,7 @@ namespace OpenSim.Region.Environment.Scenes grp.UUID, remoteClient.AgentId); permissionToDelete = permissionToTake; - + if (permissionToDelete) { AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); @@ -1794,8 +1794,8 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - /// - /// + /// + /// public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { @@ -1807,7 +1807,7 @@ namespace OpenSim.Region.Environment.Scenes // CachedUserInfo userInfo; - if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || + if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || action == DeRezAction.SaveToExistingUserInventoryItem) { // Take or take copy require a taker @@ -1850,25 +1850,25 @@ namespace OpenSim.Region.Environment.Scenes // InventoryFolderBase folder = null; - InventoryItemBase item = null; + InventoryItemBase item = null; if (DeRezAction.SaveToExistingUserInventoryItem == action) { item = userInfo.RootFolder.FindItem( objectGroup.RootPart.FromUserInventoryItemID); - + if (null == item) { m_log.DebugFormat( - "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", - objectGroup.Name, objectGroup.UUID); + "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", + objectGroup.Name, objectGroup.UUID); return UUID.Zero; } } else { // Folder magic - // + // if (action == DeRezAction.Delete) { // Deleting someone else's item @@ -1940,7 +1940,7 @@ namespace OpenSim.Region.Environment.Scenes item.InvType = (int)InventoryType.Object; item.Folder = folder.ID; item.Owner = userInfo.UserProfile.ID; - + } AssetBase asset = CreateAsset( @@ -1949,16 +1949,16 @@ namespace OpenSim.Region.Environment.Scenes (sbyte)AssetType.Object, Utils.StringToBytes(sceneObjectXml)); AssetCache.AddAsset(asset); - assetID = asset.FullID; - + assetID = asset.Metadata.FullID; + if (DeRezAction.SaveToExistingUserInventoryItem == action) - { - item.AssetID = asset.FullID; + { + item.AssetID = asset.Metadata.FullID; userInfo.UpdateItem(item); } else { - item.AssetID = asset.FullID; + item.AssetID = asset.Metadata.FullID; if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions()) { @@ -1991,12 +1991,12 @@ namespace OpenSim.Region.Environment.Scenes // TODO: add the new fields (Flags, Sale info, etc) item.CreationDate = Util.UnixTimeSinceEpoch(); - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; + item.Description = asset.Metadata.Description; + item.Name = asset.Metadata.Name; + item.AssetType = asset.Metadata.Type; userInfo.AddItem(item); - + if (remoteClient != null && item.Owner == remoteClient.AgentId) { remoteClient.SendInventoryItemCreateUpdate(item); @@ -2008,10 +2008,10 @@ namespace OpenSim.Region.Environment.Scenes { notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item); } - } + } } } - + return assetID; } @@ -2025,11 +2025,11 @@ namespace OpenSim.Region.Environment.Scenes m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID); return; } - + m_log.InfoFormat( - "[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}", + "[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}", grp.UUID, grp.GetAttachmentPoint()); - + string sceneObjectXml = objectGroup.ToXmlString(); CachedUserInfo userInfo = @@ -2077,10 +2077,10 @@ namespace OpenSim.Region.Environment.Scenes Utils.StringToBytes(sceneObjectXml)); AssetCache.AddAsset(asset); - item.AssetID = asset.FullID; - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; + item.AssetID = asset.Metadata.FullID; + item.Description = asset.Metadata.Description; + item.Name = asset.Metadata.Name; + item.AssetType = asset.Metadata.Type; item.InvType = (int)InventoryType.Object; item.Folder = foundFolder; @@ -2118,10 +2118,10 @@ namespace OpenSim.Region.Environment.Scenes item.Creator = grp.RootPart.CreatorID; item.Owner = remoteClient.AgentId; item.ID = UUID.Random(); - item.AssetID = asset.FullID; - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; + item.AssetID = asset.Metadata.FullID; + item.Description = asset.Metadata.Description; + item.Name = asset.Metadata.Name; + item.AssetType = asset.Metadata.Type; item.InvType = (int)InventoryType.Object; item.Folder = UUID.Zero; // Objects folder! @@ -2241,20 +2241,20 @@ namespace OpenSim.Region.Environment.Scenes if (rezAsset != null) { UUID itemId = UUID.Zero; - + // If we have permission to copy then link the rezzed object back to the user inventory // item that it came from. This allows us to enable 'save object to inventory' if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) - { + { itemId = item.ID; } } - + string xmlData = Utils.BytesToString(rezAsset.Data); SceneObjectGroup group = new SceneObjectGroup(itemId, xmlData, true); - + if (!Permissions.CanRezObject( group.Children.Count, remoteClient.AgentId, pos) && !attachment) @@ -2351,12 +2351,12 @@ namespace OpenSim.Region.Environment.Scenes group.ClearPartAttachmentData(); } } - + if (!attachment) { // Fire on_rez group.CreateScriptInstances(0, true, DefaultScriptEngine, 0); - + rootPart.ScheduleFullUpdate(); } @@ -2500,7 +2500,7 @@ namespace OpenSim.Region.Environment.Scenes DeRezObject(null, grp.RootPart.LocalId, grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero); } - + return true; } @@ -2632,7 +2632,7 @@ namespace OpenSim.Region.Environment.Scenes } } - + m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 33dae66e76..32bd9aa0e7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -115,18 +115,18 @@ namespace OpenSim.Region.Environment.Scenes /// /// All the region modules attached to this scene. - /// + /// public Dictionary Modules { get { return m_modules; } } protected Dictionary m_modules = new Dictionary(); - + /// /// The module interfaces available from this scene. /// protected Dictionary > ModuleInterfaces = new Dictionary >(); - + protected Dictionary ModuleAPIMethods = new Dictionary(); protected Dictionary m_moduleCommanders = new Dictionary(); @@ -143,7 +143,7 @@ namespace OpenSim.Region.Environment.Scenes protected IInterregionCommsIn m_interregionCommsIn; protected IDialogModule m_dialogModule; protected internal ICapabilitiesModule CapsModule; - + // Central Update Loop protected int m_fps = 10; @@ -280,10 +280,10 @@ namespace OpenSim.Region.Environment.Scenes } public int objectCapacity = 45000; - + /// /// Registered classes that are capable of creating entities. - /// + /// protected Dictionary m_entityCreators = new Dictionary(); #endregion @@ -316,7 +316,7 @@ namespace OpenSim.Region.Environment.Scenes m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); - + m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter.Enabled = true; @@ -421,7 +421,7 @@ namespace OpenSim.Region.Environment.Scenes protected virtual void RegisterDefaultSceneEvents() { IDialogModule dm = RequestModuleInterface(); - + if (dm != null) m_eventManager.OnPermissionError += dm.SendAlertToUser; } @@ -564,7 +564,7 @@ namespace OpenSim.Region.Environment.Scenes m_incrementsof15seconds = (int)seconds / 15; m_RestartTimerCounter = 0; m_restartTimer.AutoReset = true; - m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); + m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); m_restartTimer.Start(); m_dialogModule.SendNotificationToUsersInRegion( @@ -583,8 +583,8 @@ namespace OpenSim.Region.Environment.Scenes { if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7) m_dialogModule.SendNotificationToUsersInRegion( - UUID.Random(), - String.Empty, + UUID.Random(), + String.Empty, RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds"); } else @@ -717,7 +717,7 @@ namespace OpenSim.Region.Environment.Scenes // Stop all client threads. ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(true); }); - + // Stop updating the scene objects and agents. //m_heartbeatTimer.Close(); shuttingdown = true; @@ -733,7 +733,7 @@ namespace OpenSim.Region.Environment.Scenes } m_sceneGraph.Close(); - + // De-register with region communications (events cleanup) UnRegisterRegionWithComms(); @@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Environment.Scenes //tc = System.Environment.TickCount - tc; //m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms"); } - + m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (System.Environment.TickCount - tc) + " ms"); bool drawPrimVolume = true; @@ -1644,13 +1644,13 @@ namespace OpenSim.Region.Environment.Scenes m_regInfo.RegionSettings.TerrainImageID = TerrainImageUUID; AssetBase asset = new AssetBase(); - asset.FullID = m_regInfo.RegionSettings.TerrainImageID; + asset.Metadata.FullID = m_regInfo.RegionSettings.TerrainImageID; asset.Data = data; - asset.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(); - asset.Description = RegionInfo.RegionName; + asset.Metadata.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(); + asset.Metadata.Description = RegionInfo.RegionName; - asset.Type = 0; - asset.Temporary = temporary; + asset.Metadata.Type = 0; + asset.Metadata.Temporary = temporary; AssetCache.AddAsset(asset); } @@ -1699,7 +1699,7 @@ namespace OpenSim.Region.Environment.Scenes m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children", group.Children == null ? 0 : group.Children.Count); } - + AddRestoredSceneObject(group, true, true); SceneObjectPart rootPart = group.GetChildPart(group.UUID); rootPart.ObjectFlags &= ~(uint)PrimFlags.Scripted; @@ -1814,7 +1814,7 @@ namespace OpenSim.Region.Environment.Scenes { //m_log.DebugFormat( // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); - + // If an entity creator has been registered for this prim type then use that if (m_entityCreators.ContainsKey((PCode)shape.PCode)) return m_entityCreators[(PCode)shape.PCode].CreateEntity(ownerID, groupID, pos, rot, shape); @@ -2094,7 +2094,7 @@ namespace OpenSim.Region.Environment.Scenes /// public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod) { - + if (XMLMethod == 0) { m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID); @@ -2308,7 +2308,7 @@ namespace OpenSim.Region.Environment.Scenes CreateAndAddScenePresence(client); } - + m_LastLogin = System.Environment.TickCount; EventManager.TriggerOnNewClient(client); } @@ -2390,7 +2390,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnUnackedTerrain += TerrainUnAcked; client.OnObjectOwner += ObjectOwner; - + if (StatsReporter != null) client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats; @@ -2561,7 +2561,7 @@ namespace OpenSim.Region.Environment.Scenes m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}", client.Name, e); } - + m_log.Warn("[APPEARANCE]: Appearance not found, returning default"); } @@ -2770,21 +2770,21 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); if (sp != null) - { + { m_log.DebugFormat( - "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", + "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", agent.AgentID, RegionInfo.RegionName); - + sp.AdjustKnownSeeds(); - + return; } - + // Don't disable this log message - it's too helpful m_log.DebugFormat( - "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", + "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); - + if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) { m_log.WarnFormat( @@ -2808,10 +2808,10 @@ namespace OpenSim.Region.Environment.Scenes } m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); - + // rewrite session_id CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); - + if (userinfo != null) { userinfo.SessionID = agent.SessionID; @@ -2873,12 +2873,12 @@ namespace OpenSim.Region.Environment.Scenes public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) { ScenePresence presence; - + lock (m_scenePresences) { m_scenePresences.TryGetValue(agentID, out presence); } - + if (presence != null) { try @@ -2902,14 +2902,14 @@ namespace OpenSim.Region.Environment.Scenes { // m_log.DebugFormat( // "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); - + ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); if (childAgentUpdate != null) { childAgentUpdate.ChildAgentDataUpdate(cAgentData); return true; } - + return false; } @@ -2932,10 +2932,10 @@ namespace OpenSim.Region.Environment.Scenes // Not Implemented: //TODO: Do we need to pass the message on to one of our neighbors? } - + return true; } - + return false; } @@ -2957,7 +2957,7 @@ namespace OpenSim.Region.Environment.Scenes public bool IncomingCloseAgent(UUID agentID) { //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); - + ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); if (presence != null) { @@ -2972,7 +2972,7 @@ namespace OpenSim.Region.Environment.Scenes } // Don't do this to root agents on logout, it's not nice for the viewer - if (presence.IsChildAgent) + if (presence.IsChildAgent) { // Tell a single agent to disconnect from the region. IEventQueue eq = RequestModuleInterface(); @@ -2984,11 +2984,11 @@ namespace OpenSim.Region.Environment.Scenes else presence.ControllingClient.SendShutdownConnectionNotice(); } - + presence.ControllingClient.Close(true); return true; } - + // Agent not here return false; } @@ -3059,7 +3059,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); return; } - + RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); } @@ -3080,7 +3080,7 @@ namespace OpenSim.Region.Environment.Scenes if (m_scenePresences.ContainsKey(remoteClient.AgentId)) sp = m_scenePresences[remoteClient.AgentId]; } - + if (sp != null) { m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, @@ -3211,7 +3211,7 @@ namespace OpenSim.Region.Environment.Scenes return; l.Add(mod); - + if (mod is IEntityCreator) { IEntityCreator entityCreator = (IEntityCreator)mod; @@ -3220,7 +3220,7 @@ namespace OpenSim.Region.Environment.Scenes m_entityCreators[pcode] = entityCreator; } } - + ModuleInterfaces[typeof(M)] = l; } @@ -3243,7 +3243,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// For the given interface, retrieve an array of region modules that implement it. /// - /// an empty array if there are no registered modules implementing that interface + /// an empty array if there are no registered modules implementing that interface public override T[] RequestModuleInterfaces() { if (ModuleInterfaces.ContainsKey(typeof(T))) @@ -3383,7 +3383,7 @@ namespace OpenSim.Region.Environment.Scenes else { m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); - } + } } } @@ -3855,14 +3855,14 @@ namespace OpenSim.Region.Environment.Scenes public override bool PresenceChildStatus(UUID avatarID) { ScenePresence cp = GetScenePresence(avatarID); - + // FIXME: This is really crap - some logout code is relying on a NullReferenceException to halt its processing // This needs to be fixed properly by cleaning up the logout code. //if (cp != null) // return cp.IsChildAgent; - + //return false; - + return cp.IsChildAgent; } @@ -4140,10 +4140,10 @@ namespace OpenSim.Region.Environment.Scenes item.ID = UUID.Random(); item.Owner = remoteClient.AgentId; - item.AssetID = asset.FullID; - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; + item.AssetID = asset.Metadata.FullID; + item.Description = asset.Metadata.Description; + item.Name = asset.Metadata.Name; + item.AssetType = asset.Metadata.Type; item.InvType = (int)InventoryType.Object; item.Folder = categoryID; @@ -4194,7 +4194,7 @@ namespace OpenSim.Region.Environment.Scenes if (!okToSell) { m_dialogModule.SendAlertToUser( - remoteClient, "This item's inventory doesn't appear to be for sale"); + remoteClient, "This item's inventory doesn't appear to be for sale"); return false; } @@ -4252,7 +4252,7 @@ namespace OpenSim.Region.Environment.Scenes // This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called - // from within the OdePhysicsScene. + // from within the OdePhysicsScene. protected internal void jointMoved(PhysicsJoint joint) { @@ -4348,7 +4348,7 @@ namespace OpenSim.Region.Environment.Scenes // FIXME: this causes a sequential lookup of all objects in the scene; use a dictionary if (joint != null) { - if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) + if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) return; SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3e7ffab998..734b3ef533 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -37,8 +37,8 @@ using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.ScriptEngine.Shared; -using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; +using OpenSim.Region.ScriptEngine.Shared; +using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; @@ -117,7 +117,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host = host; m_localID = localID; m_itemID = itemID; - + if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) m_OSFunctionsEnabled = true; @@ -328,9 +328,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryHigh, "osRegionNotice"); m_host.AddScriptLPS(1); - + IDialogModule dm = World.RequestModuleInterface(); - + if (dm != null) dm.SendGeneralAlert(msg); } @@ -776,7 +776,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return String.Empty; } } - + public string osGetSimulatorVersion() { // High because it can be used to target attacks to known weaknesses @@ -802,37 +802,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.ParcelMediaSetTime((float)time); } - + public Hashtable osParseJSON(string JSON) { CheckThreatLevel(ThreatLevel.None, "osParseJSON"); - + m_host.AddScriptLPS(1); // see http://www.json.org/ for more details on JSON - + string currentKey=null; Stack objectStack = new Stack(); // objects in JSON can be nested so we need to keep a track of this Hashtable jsondata = new Hashtable(); // the hashtable to be returned int i=0; try { - + // iterate through the serialised stream of tokens and store at the right depth in the hashtable // the top level hashtable may contain more nested hashtables within it each containing an objects representation for (i=0;i