/// <summary> /// /// </summary> /// <param name="data"></param> /// <param name="path"></param> /// <param name="param"></param> /// <returns></returns> public string uploaderCaps(byte[] data, string path, string param) { try { // m_log.InfoFormat("[CAPS]: " + // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", // data, path, param)); string res = String.Empty; UpdateItemResponse response = new UpdateItemResponse(); handlerUpdateTaskScript = OnUpLoad; if (handlerUpdateTaskScript != null) { response = handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data); } if (response.AssetKind == AssetType.LSLText) { if (response.SaveErrors != null && response.SaveErrors.Count > 0) { LLSDScriptCompileFail compFail = new LLSDScriptCompileFail(); compFail.new_asset = response.AssetId.ToString(); compFail.state = "complete"; foreach (string str in response.SaveErrors) { compFail.errors.Array.Add(str); } res = LLSDHelpers.SerializeLLSDReply(compFail); } else { LLSDScriptCompileSuccess compSuccess = new LLSDScriptCompileSuccess(); compSuccess.new_asset = response.AssetId.ToString(); compSuccess.state = "complete"; res = LLSDHelpers.SerializeLLSDReply(compSuccess); } } else { LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); uploadComplete.new_asset = response.AssetId.ToString(); uploadComplete.state = "complete"; res = LLSDHelpers.SerializeLLSDReply(uploadComplete); } httpListener.RemoveStreamHandler("POST", uploaderPath); // m_log.InfoFormat("[CAPS]: TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); return res; } catch (Exception e) { m_log.Error("[CAPS]: " + e.ToString()); } // XXX Maybe this should be some meaningful error packet return null; }
/// <summary> /// /// </summary> /// <param name="data"></param> /// <param name="path"></param> /// <param name="param"></param> /// <returns></returns> public string uploaderCaps(byte[] data, string path, string param) { UUID inv = inventoryItemID; string res = String.Empty; UpdateItemResponse response = new UpdateItemResponse(); handlerUpdateItem = OnUpLoad; if (handlerUpdateItem != null) { response = handlerUpdateItem(inv, data); } if (response.AssetKind == AssetType.LSLText) { if (response.SaveErrors != null && response.SaveErrors.Count > 0) { LLSDScriptCompileFail compFail = new LLSDScriptCompileFail(); compFail.new_asset = response.AssetId.ToString(); compFail.new_inventory_item = inv; compFail.state = "complete"; foreach (string str in response.SaveErrors) { compFail.errors.Array.Add(str); } res = LLSDHelpers.SerializeLLSDReply(compFail); } else { LLSDScriptCompileSuccess compSuccess = new LLSDScriptCompileSuccess(); compSuccess.new_asset = response.AssetId.ToString(); compSuccess.new_inventory_item = inv; compSuccess.state = "complete"; res = LLSDHelpers.SerializeLLSDReply(compSuccess); } } else { LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); uploadComplete.new_asset = response.AssetId.ToString(); uploadComplete.new_inventory_item = inv; uploadComplete.state = "complete"; res = LLSDHelpers.SerializeLLSDReply(uploadComplete); } httpListener.RemoveStreamHandler("POST", uploaderPath); return res; }