/// <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 = Client.Network.CurrentSim.Caps.CapabilityURI("UpdateScriptAgent"); if (url != null) { UpdateScriptAgentRequestMessage msg = new UpdateScriptAgentRequestMessage(); 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, Client.Settings.CAPS_TIMEOUT); } else { throw new Exception("UpdateScriptAgent capability is not currently available"); } }
public void UpdateScriptAgentMessage() { UpdateScriptAgentRequestMessage s = new UpdateScriptAgentRequestMessage(); s.ItemID = UUID.Random(); s.Target = "lsl2"; OSDMap map = s.Serialize(); UpdateScriptAgentRequestMessage t = new UpdateScriptAgentRequestMessage(); t.Deserialize(map); Assert.AreEqual(s.ItemID, t.ItemID); Assert.AreEqual(s.Target, t.Target); }