/// <summary>
/// Update an existing script in an agents Inventory
/// </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, bool mono, ScriptUpdatedCallback callback)
{
Uri url = _Network.CurrentSim.Caps.CapabilityURI("UpdateScriptAgent");
if(url != null)
{
UpdateScriptAgentMessage msg = new UpdateScriptAgentMessage();
msg.ItemID = itemID;
msg.Target = mono ? "mono" : "lsl2";
CapsClient request = new CapsClient(url);
request.OnComplete += new CapsClient.CompleteCallback(UpdateScriptAgentInventoryResponse);
request.UserData = new object[2] { new KeyValuePair<ScriptUpdatedCallback, byte[]>(callback, data), itemID };
request.BeginGetResponse(msg.Serialize(), OSDFormat.Xml, _Network.CapsTimeout);
}
else
{
throw new Exception("UpdateScriptAgent capability is not currently available");
}
}