LIBOMV-540 Adds parameter to CopyScriptToTask method which allows the scripts running state to be set.
git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2758 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -1143,7 +1143,47 @@ namespace OpenMetaverse.Tests
|
||||
}
|
||||
#region Performance Testing
|
||||
|
||||
private const int TEST_ITER = 1000;
|
||||
private const int TEST_ITER = 100000;
|
||||
|
||||
[Test]
|
||||
[Category("Benchmark")]
|
||||
public void ReflectionPerformanceRemoteParcelRequest()
|
||||
{
|
||||
DateTime messageTestTime = DateTime.UtcNow;
|
||||
for (int x = 0; x < TEST_ITER; x++)
|
||||
{
|
||||
RemoteParcelRequestMessage s = new RemoteParcelRequestMessage();
|
||||
s.ParcelID = UUID.Random();
|
||||
OSDMap map = s.Serialize();
|
||||
|
||||
RemoteParcelRequestMessage t = new RemoteParcelRequestMessage();
|
||||
t.Deserialize(map);
|
||||
|
||||
Assert.AreEqual(s.ParcelID, t.ParcelID);
|
||||
}
|
||||
TimeSpan duration = DateTime.UtcNow - messageTestTime;
|
||||
Console.WriteLine("RemoteParcelRequestMessage: OMV Message System Serialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, duration);
|
||||
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
DateTime xmlTestTime = DateTime.UtcNow;
|
||||
for (int x = 0; x < TEST_ITER; x++)
|
||||
{
|
||||
RemoteParcelRequestMessage s = new RemoteParcelRequestMessage();
|
||||
s.ParcelID = UUID.Random();
|
||||
|
||||
MemoryStream stream = new MemoryStream();
|
||||
|
||||
formatter.Serialize(stream, s);
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
RemoteParcelRequestMessage t = (RemoteParcelRequestMessage)formatter.Deserialize(stream);
|
||||
|
||||
Assert.AreEqual(s.ParcelID, t.ParcelID);
|
||||
}
|
||||
TimeSpan durationxml = DateTime.UtcNow - xmlTestTime;
|
||||
Console.WriteLine("RemoteParcelRequestMessage: .NET BinarySerialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, durationxml);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Category("Benchmark")]
|
||||
@@ -1199,7 +1239,7 @@ namespace OpenMetaverse.Tests
|
||||
}
|
||||
}
|
||||
TimeSpan duration = DateTime.UtcNow - messageTestTime;
|
||||
Console.WriteLine("OMV Message System Serialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, duration);
|
||||
Console.WriteLine("DirLandReplyMessage: OMV Message System Serialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, duration);
|
||||
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
DateTime xmlTestTime = DateTime.UtcNow;
|
||||
@@ -1254,7 +1294,7 @@ namespace OpenMetaverse.Tests
|
||||
}
|
||||
}
|
||||
TimeSpan durationxml = DateTime.UtcNow - xmlTestTime;
|
||||
Console.WriteLine(".NET BinarySerialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, durationxml);
|
||||
Console.WriteLine("DirLandReplyMessage: .NET BinarySerialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, durationxml);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1321,7 +1361,6 @@ namespace OpenMetaverse.Tests
|
||||
[Category("Benchmark")]
|
||||
public void ReflectionPerformanceParcelProperties()
|
||||
{
|
||||
|
||||
DateTime messageTestTime = DateTime.UtcNow;
|
||||
for (int x = 0; x < TEST_ITER; x++)
|
||||
{
|
||||
@@ -1444,7 +1483,7 @@ namespace OpenMetaverse.Tests
|
||||
Assert.AreEqual(s.UserLookAt, t.UserLookAt);
|
||||
}
|
||||
TimeSpan duration = DateTime.UtcNow - messageTestTime;
|
||||
Console.WriteLine("OMV Message System Serialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, duration);
|
||||
Console.WriteLine("ParcelPropertiesMessage: OMV Message System Serialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, duration);
|
||||
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
|
||||
@@ -1574,7 +1613,7 @@ namespace OpenMetaverse.Tests
|
||||
Assert.AreEqual(s.UserLookAt, t.UserLookAt);
|
||||
}
|
||||
TimeSpan durationxml = DateTime.UtcNow - xmlTestTime;
|
||||
Console.WriteLine(".NET BinarySerialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, durationxml);
|
||||
Console.WriteLine("ParcelPropertiesMessage: .NET BinarySerialization/Deserialization Passes: {0} Total time: {1}", TEST_ITER, durationxml);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -2082,8 +2082,9 @@ namespace OpenMetaverse
|
||||
/// </summary>
|
||||
/// <param name="data">A byte[] array containing the encoded scripts contents</param>
|
||||
/// <param name="itemID">the itemID of the script</param>
|
||||
/// <param name="mono">if true, sets the script content to run on the mono interpreter</param>
|
||||
/// <param name="callback"></param>
|
||||
public void RequestUpdateScriptAgentInventory(byte[] data, UUID itemID, ScriptUpdatedCallback callback)
|
||||
public void RequestUpdateScriptAgentInventory(byte[] data, UUID itemID, bool mono, ScriptUpdatedCallback callback)
|
||||
{
|
||||
Uri url = _Client.Network.CurrentSim.Caps.CapabilityURI("UpdateScriptAgent");
|
||||
|
||||
@@ -2091,7 +2092,7 @@ namespace OpenMetaverse
|
||||
{
|
||||
UpdateScriptAgentMessage msg = new UpdateScriptAgentMessage();
|
||||
msg.ItemID = itemID;
|
||||
msg.Target = "lsl2";
|
||||
msg.Target = mono ? "mono" : "lsl2";
|
||||
|
||||
CapsClient request = new CapsClient(url);
|
||||
request.OnComplete += new CapsClient.CompleteCallback(UpdateScriptAgentInventoryResponse);
|
||||
@@ -2559,6 +2560,7 @@ namespace OpenMetaverse
|
||||
/// </summary>
|
||||
/// <param name="objectLocalID">An unsigned integer representing a primitive being simulated</param>
|
||||
/// <param name="item">An <seealso cref="InventoryItem"/> which represents a script object from the agents inventory</param>
|
||||
/// <param name="enableScript">true to set the scripts running state to enabled</param>
|
||||
/// <returns>A Unique Transaction ID</returns>
|
||||
/// <remarks>
|
||||
/// <code>
|
||||
@@ -2571,7 +2573,7 @@ namespace OpenMetaverse
|
||||
/// UUID Transaction = Client.Inventory.RezScript(Prim, (InventoryItem)Client.Inventory.Store[Script]);
|
||||
/// </code>
|
||||
/// </remarks>
|
||||
public UUID CopyScriptToTask(uint objectLocalID, InventoryItem item)
|
||||
public UUID CopyScriptToTask(uint objectLocalID, InventoryItem item, bool enableScript)
|
||||
{
|
||||
UUID transactionID = UUID.Random();
|
||||
|
||||
@@ -2580,6 +2582,7 @@ namespace OpenMetaverse
|
||||
ScriptPacket.AgentData.SessionID = _Client.Self.SessionID;
|
||||
|
||||
ScriptPacket.UpdateBlock.ObjectLocalID = objectLocalID;
|
||||
ScriptPacket.UpdateBlock.Enabled = enableScript;
|
||||
|
||||
ScriptPacket.InventoryBlock.ItemID = item.UUID;
|
||||
ScriptPacket.InventoryBlock.FolderID = item.ParentUUID;
|
||||
|
||||
@@ -939,8 +939,11 @@ namespace OpenMetaverse.Messages.Linden
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class RemoteParcelRequestMessage : IMessage
|
||||
{
|
||||
/// <summary>The grid-wide unique parcel ID</summary>
|
||||
public UUID ParcelID;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -45,17 +45,17 @@ namespace OpenMetaverse.TestClient
|
||||
using (StreamReader reader = new StreamReader(file))
|
||||
{
|
||||
string body = reader.ReadToEnd();
|
||||
string desc = String.Format("{0} created by OpenMetaverse BotClient {1}", file, DateTime.Now);
|
||||
string desc = String.Format("{0} created by OpenMetaverse TestClient {1}", file, DateTime.Now);
|
||||
// create the asset
|
||||
Client.Inventory.RequestCreateItem(Client.Inventory.FindFolderForType(AssetType.LSLText), file, desc, AssetType.LSLText, UUID.Random(), InventoryType.LSL, PermissionMask.All,
|
||||
delegate(bool success, InventoryItem item)
|
||||
{
|
||||
if (success)
|
||||
// upload the asset
|
||||
Client.Inventory.RequestUpdateScriptAgentInventory(EncodeScript(body), item.UUID, new InventoryManager.ScriptUpdatedCallback(delegate(bool success1, string status, UUID itemid, UUID assetid)
|
||||
Client.Inventory.RequestUpdateScriptAgentInventory(EncodeScript(body), item.UUID, true, new InventoryManager.ScriptUpdatedCallback(delegate(bool success1, string status, UUID itemid, UUID assetid)
|
||||
{
|
||||
if (success1)
|
||||
ret += String.Format("Script successfully uploaded, ItemID {0} AssetID {1}", itemid, assetid);
|
||||
ret += String.Format(" Script successfully uploaded, ItemID {0} AssetID {1}", itemid, assetid);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user