コード例 #1
0
            /// <summary>
            /// Called by the notecard update handler.  Provides a URL to which the client can upload a new asset.
            /// </summary>
            /// <param name="request"></param>
            /// <param name="path"></param>
            /// <param name="param"></param>
            /// <returns></returns>
            public string NoteCardAgentInventory(string request, string path, string param,
                                                 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                //m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName + "\n" + request);
                //m_log.Debug("[CAPS]: NoteCardAgentInventory Request is: " + request);

                //OpenMetaverse.StructuredData.OSDMap hash = (OpenMetaverse.StructuredData.OSDMap)OpenMetaverse.StructuredData.LLSDParser.DeserializeBinary(Utils.StringToBytes(request));
                Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
                LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
                LLSDHelpers.DeserializeOSDMap(hash, llsdRequest);

                string capsBase = m_Caps.CapsBase;
                string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");

                ItemUpdater uploader =
                    new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_httpServer);

                uploader.OnUpLoad += ItemUpdated;

                m_httpServer.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
                string uploaderURL = m_httpServer.ServerURI + capsBase + uploaderPath;

                LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
                uploadResponse.uploader = uploaderURL;
                uploadResponse.state = "upload";

                //            m_log.InfoFormat("[CAPS]: " +
                //                             "NoteCardAgentInventory response: {0}",
                //                             LLSDHelpers.SerializeLLSDReply(uploadResponse)));

                return LLSDHelpers.SerializeLLSDReply(uploadResponse);
            }
コード例 #2
0
ファイル: AssetCapsModule.cs プロジェクト: zwagoth/halcyon
            /// <summary>
            /// Handle a request from the client for a Uri to upload a baked texture.
            /// </summary>
            /// <param name="request"></param>
            /// <param name="path"></param>
            /// <param name="param"></param>
            /// <param name="httpRequest"></param>
            /// <param name="httpResponse"></param>
            /// <returns>The upload response if the request is successful, null otherwise.</returns>
            public string UploadBakedTexture(
                string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                try
                {
                    IAssetCache assetCache = m_Scene.CommsManager.AssetCache;
                    IJ2KDecoder layerDecoder = m_Scene.RequestModuleInterface<IJ2KDecoder>();
                    String uploaderPath = m_Caps.CapsBase + "/" + UUID.Random();
                    BakedTextureUploader uploader = new BakedTextureUploader(m_Caps, uploaderPath, assetCache, layerDecoder);
                    m_Caps.HttpListener.AddStreamHandler(new BinaryStreamHandler("POST", uploaderPath, uploader.BakedTextureUploaded));

                    string uploaderURL = m_Caps.HttpListener.ServerURI + uploaderPath;
                    LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
                    uploadResponse.uploader = uploaderURL;
                    uploadResponse.state = "upload";
                    return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat("[UPLOAD BAKED TEXTURE HANDLER]: {0}{1}", e.Message, e.StackTrace);
                }

                return null;
            }
コード例 #3
0
            /// <summary>
            /// Handle a request from the client for a Uri to upload a baked texture.
            /// </summary>
            /// <param name="request"></param>
            /// <param name="path"></param>
            /// <param name="param"></param>
            /// <param name="httpRequest"></param>
            /// <param name="httpResponse"></param>
            /// <returns>The upload response if the request is successful, null otherwise.</returns>
            public string ScriptTaskInventory(
                string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName);
                //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param);

                try
                {
                    string capsBase = m_Caps.CapsBase;
                    string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");

                    Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
                    LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate();
                    LLSDHelpers.DeserializeOSDMap(hash, llsdUpdateRequest);

                    TaskInventoryScriptUpdater uploader =
                        new TaskInventoryScriptUpdater(
                            llsdUpdateRequest.item_id,
                            llsdUpdateRequest.task_id,
                            llsdUpdateRequest.is_script_running,
                            capsBase + uploaderPath,
                            m_httpServer);

                    uploader.OnUpLoad += TaskScriptUpdated;

                    m_httpServer.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));

                    string uploaderURL = m_httpServer.ServerURI + capsBase + uploaderPath;
                    LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
                    uploadResponse.uploader = uploaderURL;
                    uploadResponse.state = "upload";

                    // m_log.InfoFormat("[CAPS]: " +"ScriptTaskInventory response: {0}", LLSDHelpers.SerializeLLSDReply(uploadResponse)));

                    return LLSDHelpers.SerializeLLSDReply(uploadResponse);

                }
                catch (Exception e)
                {
                    m_log.ErrorFormat("[UPLOAD SCRIPT TASK HANDLER]: {0}{1}", e.Message, e.StackTrace);
                }

                return null;
            }