当前位置: 首页>>代码示例>>C#>>正文


C# CapsClient.StartRequest方法代码示例

本文整理汇总了C#中OpenMetaverse.Http.CapsClient.StartRequest方法的典型用法代码示例。如果您正苦于以下问题:C# CapsClient.StartRequest方法的具体用法?C# CapsClient.StartRequest怎么用?C# CapsClient.StartRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenMetaverse.Http.CapsClient的用法示例。


在下文中一共展示了CapsClient.StartRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartIMConfrence

       /// <summary>
       /// Start a friends confrence
       /// </summary>
       /// <param name="participants"><seealso cref="UUID"/> List of UUIDs to start a confrence with</param>
       /// <param name="tmp_session_id"><seealso cref="UUID"/>a Unique UUID that will be returned in the OnJoinedGroupChat callback></param>
       public void StartIMConfrence(List <UUID> participants,UUID tmp_session_id)
       {
           if (Client.Network.CurrentSim == null || Client.Network.CurrentSim.Caps == null)
               throw new Exception("ChatSessionRequest capability is not currently available");

            Uri url = Client.Network.CurrentSim.Caps.CapabilityURI("ChatSessionRequest");

            if (url != null)
            {
                OSDMap req = new OSDMap();
                req.Add("method", OSD.FromString("start conference"));
                OSDArray members = new OSDArray();
                foreach(UUID participant in participants)
                    members.Add(OSD.FromUUID(participant));

                req.Add("params",members);
                req.Add("session-id", OSD.FromUUID(tmp_session_id));

                byte[] postData = StructuredData.OSDParser.SerializeLLSDXmlBytes(req);

                Console.WriteLine(req.ToString());

                CapsClient request = new CapsClient(url);
                request.StartRequest(postData);
            }
            else
            {
                throw new Exception("ChatSessionRequest capability is not currently available");
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:35,代码来源:AgentManager.cs

示例2: RequestVoiceInternal

        private bool RequestVoiceInternal(string me, CapsClient.CompleteCallback callback, string capsName)
        {
            if (Enabled && Client.Network.Connected)
            {
                if (Client.Network.CurrentSim != null && Client.Network.CurrentSim.Caps != null)
                {
                    Uri url = Client.Network.CurrentSim.Caps.CapabilityURI(capsName);

                    if (url != null)
                    {
                        CapsClient request = new CapsClient(url);
                        OSDMap body = new OSDMap();
                        request.OnComplete += new CapsClient.CompleteCallback(callback);
                        request.StartRequest(body);

                        return true;
                    }
                    else
                    {
                        Logger.Log("VoiceManager." + me + "(): " + capsName + " capability is missing", 
                                   Helpers.LogLevel.Info, Client);
                        return false;
                    }
                }
            }

            Logger.Log("VoiceManager.RequestVoiceInternal(): Voice system is currently disabled", 
                       Helpers.LogLevel.Info, Client);
            return false;
            
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:31,代码来源:VoiceManager.cs

示例3: ChatterBoxAcceptInvite

        /// <summary>
        /// Accept invite for to a chatterbox session
        /// </summary>
        /// <param name="session_id"><seealso cref="UUID"/> of session to accept invite to</param>
        public void ChatterBoxAcceptInvite(UUID session_id)
        {
            if (Client.Network.CurrentSim == null || Client.Network.CurrentSim.Caps == null)
                throw new Exception("ChatSessionRequest capability is not currently available");

            Uri url = Client.Network.CurrentSim.Caps.CapabilityURI("ChatSessionRequest");

            if (url != null)
            {
                OSDMap req = new OSDMap();
                req.Add("method", OSD.FromString("accept invitation"));
                req.Add("session-id", OSD.FromUUID(session_id));

                byte[] postData = StructuredData.OSDParser.SerializeLLSDXmlBytes(req);

                CapsClient request = new CapsClient(url);
                request.StartRequest(postData);
            }
            else
            {
                throw new Exception("ChatSessionRequest capability is not currently available");
            }

       }
开发者ID:RavenB,项目名称:gridsearch,代码行数:28,代码来源:AgentManager.cs

示例4: CreateUser

        /// <summary>
        /// Returns the new user ID or throws an exception containing the error code
        /// The error codes can be found here: https://wiki.secondlife.com/wiki/RegAPIError
        /// </summary>
        /// <param name="user">New user account to create</param>
        /// <returns>The UUID of the new user account</returns>
        public UUID CreateUser(CreateUserParam user)
        {
            if (Initializing)
                throw new InvalidOperationException("still initializing");

            if (_caps.CreateUser == null)
                throw new InvalidOperationException("access denied; only approved developers have access to the registration api");

            // Create the POST data
            OSDMap query = new OSDMap();
            query.Add("username", OSD.FromString(user.FirstName));
            query.Add("last_name_id", OSD.FromInteger(user.LastName.ID));
            query.Add("email", OSD.FromString(user.Email));
            query.Add("password", OSD.FromString(user.Password));
            query.Add("dob", OSD.FromString(user.Birthdate.ToString("yyyy-MM-dd")));

            if (user.LimitedToEstate != null)
                query.Add("limited_to_estate", OSD.FromInteger(user.LimitedToEstate.Value));

            if (!string.IsNullOrEmpty(user.StartRegionName))
                query.Add("start_region_name", OSD.FromInteger(user.LimitedToEstate.Value));

            if (user.StartLocation != null)
            {
                query.Add("start_local_x", OSD.FromReal(user.StartLocation.Value.X));
                query.Add("start_local_y", OSD.FromReal(user.StartLocation.Value.Y));
                query.Add("start_local_z", OSD.FromReal(user.StartLocation.Value.Z));
            }

            if (user.StartLookAt != null)
            {
                query.Add("start_look_at_x", OSD.FromReal(user.StartLookAt.Value.X));
                query.Add("start_look_at_y", OSD.FromReal(user.StartLookAt.Value.Y));
                query.Add("start_look_at_z", OSD.FromReal(user.StartLookAt.Value.Z));
            }

            //byte[] postData = OSDParser.SerializeXmlBytes(query);

            // Make the request
            CapsClient request = new CapsClient(_caps.CreateUser);
            request.OnComplete += new CapsClient.CompleteCallback(CreateUserResponse);
            request.StartRequest();

            // FIXME: Block
            return UUID.Zero;
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:52,代码来源:RegistrationApi.cs

示例5: Update

        /// <summary>
        /// Update the simulator with any local changes to this Parcel object
        /// </summary>
        /// <param name="simulator">Simulator to send updates to</param>
        /// <param name="wantReply">Whether we want the simulator to confirm
        /// the update with a reply packet or not</param>
        public void Update(Simulator simulator, bool wantReply)
        {
            Uri url = simulator.Caps.CapabilityURI("ParcelPropertiesUpdate");

            if (url != null)
            {
                OSDMap body = new OSDMap();
                body["auth_buyer_id"] =  OSD.FromUUID(this.AuthBuyerID);
                body["auto_scale"] =  OSD.FromInteger(this.Media.MediaAutoScale);
                body["category"] = OSD.FromInteger((byte)this.Category);
                body["description"] = OSD.FromString(this.Desc);
                body["flags"] =  OSD.FromBinary(Utils.EmptyBytes);
                body["group_id"] = OSD.FromUUID(this.GroupID);
                body["landing_type"] = OSD.FromInteger((byte)this.Landing);
                body["local_id"] = OSD.FromInteger(this.LocalID);
                body["media_desc"] = OSD.FromString(this.Media.MediaDesc);
                body["media_height"] = OSD.FromInteger(this.Media.MediaHeight);
                body["media_id"] = OSD.FromUUID(this.Media.MediaID);
                body["media_loop"] = OSD.FromInteger(this.Media.MediaLoop ? 1 : 0);
                body["media_type"] = OSD.FromString(this.Media.MediaType);
                body["media_url"] = OSD.FromString(this.Media.MediaURL);
                body["media_width"] = OSD.FromInteger(this.Media.MediaWidth);
                body["music_url"] = OSD.FromString(this.MusicURL);
                body["name"] = OSD.FromString(this.Name);
                body["obscure_media"]= OSD.FromInteger(this.ObscureMedia ? 1 : 0);
                body["obscure_music"] = OSD.FromInteger(this.ObscureMusic ? 1 : 0);

                byte[] flags = Utils.IntToBytes((int)this.Flags); ;
                if (BitConverter.IsLittleEndian)
                    Array.Reverse(flags);
                body["parcel_flags"] = OSD.FromBinary(flags);

                body["pass_hours"] = OSD.FromReal(this.PassHours);
                body["pass_price"] = OSD.FromInteger(this.PassPrice);
                body["sale_price"] = OSD.FromInteger(this.SalePrice);
                body["snapshot_id"] = OSD.FromUUID(this.SnapshotID);
                OSDArray uloc = new OSDArray();
                uloc.Add(OSD.FromReal(this.UserLocation.X));
                uloc.Add(OSD.FromReal(this.UserLocation.Y));
                uloc.Add(OSD.FromReal(this.UserLocation.Z));
                body["user_location"] = uloc;
                OSDArray ulat = new OSDArray();
                ulat.Add(OSD.FromReal(this.UserLocation.X));
                ulat.Add(OSD.FromReal(this.UserLocation.Y));
                ulat.Add(OSD.FromReal(this.UserLocation.Z));
                body["user_look_at"] = ulat;

                //Console.WriteLine("OSD REQUEST\n{0}", body.ToString());

                byte[] postData = StructuredData.OSDParser.SerializeLLSDXmlBytes(body);
                //Console.WriteLine("{0}", OSDParser.SerializeLLSDXmlString(body));
                CapsClient capsPost = new CapsClient(url);
                capsPost.StartRequest(postData);

            }
            else
            {

                ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();

                request.AgentData.AgentID = simulator.Client.Self.AgentID;
                request.AgentData.SessionID = simulator.Client.Self.SessionID;

                request.ParcelData.LocalID = this.LocalID;

                request.ParcelData.AuthBuyerID = this.AuthBuyerID;
                request.ParcelData.Category = (byte)this.Category;
                request.ParcelData.Desc = Utils.StringToBytes(this.Desc);
                request.ParcelData.GroupID = this.GroupID;
                request.ParcelData.LandingType = (byte)this.Landing;
                request.ParcelData.MediaAutoScale = this.Media.MediaAutoScale;
                request.ParcelData.MediaID = this.Media.MediaID;
                request.ParcelData.MediaURL = Utils.StringToBytes(this.Media.MediaURL);
                request.ParcelData.MusicURL = Utils.StringToBytes(this.MusicURL);
                request.ParcelData.Name = Utils.StringToBytes(this.Name);
                if (wantReply) request.ParcelData.Flags = 1;
                request.ParcelData.ParcelFlags = (uint)this.Flags;
                request.ParcelData.PassHours = this.PassHours;
                request.ParcelData.PassPrice = this.PassPrice;
                request.ParcelData.SalePrice = this.SalePrice;
                request.ParcelData.SnapshotID = this.SnapshotID;
                request.ParcelData.UserLocation = this.UserLocation;
                request.ParcelData.UserLookAt = this.UserLookAt;

                simulator.SendPacket(request, true);
            }

            UpdateOtherCleanTime(simulator);
            
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:96,代码来源:ParcelManager.cs

示例6: RequestMapLayer

        /// <summary>
        /// 
        /// </summary>
        /// <param name="layer"></param>
        public void RequestMapLayer(GridLayerType layer)
        {
            Uri url = Client.Network.CurrentSim.Caps.CapabilityURI("MapLayer");

            if (url != null)
            {
                OSDMap body = new OSDMap();
                body["Flags"] = OSD.FromInteger((int)layer);

                CapsClient request = new CapsClient(url);
                request.OnComplete += new CapsClient.CompleteCallback(MapLayerResponseHandler);
                request.StartRequest(body);
            }
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:18,代码来源:GridManager.cs

示例7: InformClientOfNeighbors

        public void InformClientOfNeighbors(Agent agent)
        {
            for (int i = 0; i < 8; i++)
            {
                if (!agent.NeighborConnections[i] && neighbors[i].Online)
                {
                    Logger.Log("Sending enable_client for " + agent.FullName + " to neighbor " + neighbors[i].Name, Helpers.LogLevel.Info);

                    // Create a callback for enable_client_complete
                    Uri callbackUri = server.Capabilities.CreateCapability(EnableClientCompleteCapHandler, false, null);

                    OSDMap enableClient = CapsMessages.EnableClient(agent.ID, agent.SessionID, agent.SecureSessionID,
                        (int)agent.CircuitCode, agent.Info.FirstName, agent.Info.LastName, callbackUri);

                    AutoResetEvent waitEvent = new AutoResetEvent(false);

                    CapsClient request = new CapsClient(neighbors[i].EnableClientCap);
                    request.OnComplete +=
                    delegate(CapsClient client, OSD result, Exception error)
                    {
                        OSDMap response = result as OSDMap;
                        if (response != null)
                        {
                            bool success = response["success"].AsBoolean();
                            Logger.Log("enable_client response: " + success, Helpers.LogLevel.Info);

                            if (success)
                            {
                                // Send the EnableSimulator capability to clients
                                RegionInfo neighbor = neighbors[i];
                                OSDMap enableSimulator = CapsMessages.EnableSimulator(neighbor.Handle, neighbor.IPAndPort.Address, neighbor.IPAndPort.Port);

                                SendEvent(agent, "EnableSimulator", enableSimulator);
                            }
                        }
                        waitEvent.Set();
                    };
                    request.StartRequest(enableClient);

                    if (!waitEvent.WaitOne(30 * 1000, false))
                        Logger.Log("enable_client request timed out", Helpers.LogLevel.Warning);
                }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:44,代码来源:SceneManager.cs

示例8: GatherCaps

        private void GatherCaps()
        {
            // build post data
            byte[] postData = Encoding.ASCII.GetBytes(
                String.Format("first_name={0}&last_name={1}&password={2}", _userInfo.FirstName, _userInfo.LastName, 
                _userInfo.Password));

            CapsClient request = new CapsClient(RegistrationApiCaps);
            request.OnComplete += new CapsClient.CompleteCallback(GatherCapsResponse);
            request.StartRequest(postData);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:11,代码来源:RegistrationApi.cs

示例9: GatherErrorMessages

        private void GatherErrorMessages()
        {
            if (_caps.GetErrorCodes == null)
                throw new InvalidOperationException("access denied");	// this should work even for not-approved users

            CapsClient request = new CapsClient(_caps.GetErrorCodes);
            request.OnComplete += new CapsClient.CompleteCallback(GatherErrorMessagesResponse);
            request.StartRequest();
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:9,代码来源:RegistrationApi.cs

示例10: UploadNotecardAssetResponse

        private void UploadNotecardAssetResponse(CapsClient client, OSD result, Exception error)
        {
            OSDMap contents = (OSDMap)result;
            KeyValuePair<NotecardUploadedAssetCallback, byte[]> kvp = (KeyValuePair<NotecardUploadedAssetCallback, byte[]>)(((object[])client.UserData)[0]);
            NotecardUploadedAssetCallback callback = kvp.Key;
            byte[] itemData = (byte[])kvp.Value;

            string status = contents["state"].AsString();

            if (status == "upload")
            {
                string uploadURL = contents["uploader"].AsString();

                // This makes the assumption that all uploads go to CurrentSim, to avoid
                // the problem of HttpRequestState not knowing anything about simulators
                CapsClient upload = new CapsClient(new Uri(uploadURL));
                upload.OnComplete += new CapsClient.CompleteCallback(UploadNotecardAssetResponse);
                upload.UserData = new object[2] { kvp, (UUID)(((object[])client.UserData)[1]) };
                upload.StartRequest(itemData, "application/octet-stream");
            }
            else if (status == "complete")
            {
                if (contents.ContainsKey("new_asset"))
                {
                    try { callback(true, String.Empty, (UUID)(((object[])client.UserData)[1]), contents["new_asset"].AsUUID()); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, _Client, e); }
                }
                else
                {
                    try { callback(false, "Failed to parse asset and item UUIDs", UUID.Zero, UUID.Zero); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, _Client, e); }
                }
            }
            else
            {
                // Failure
                try { callback(false, status, UUID.Zero, UUID.Zero); }
                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, _Client, e); }
            }
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:40,代码来源:InventoryManager.cs

示例11: BeginLogin

        private void BeginLogin()
        {
            LoginParams loginParams = CurrentContext.Value;

            // Sanity check
            if (loginParams.Options == null)
                loginParams.Options = new List<string>();

            // Convert the password to MD5 if it isn't already
            if (loginParams.Password.Length != 35 && !loginParams.Password.StartsWith("$1$"))
                loginParams.Password = Utils.MD5(loginParams.Password);

            // Override SSL authentication mechanisms. DO NOT convert this to the
            // .NET 2.0 preferred method, the equivalent function in Mono has a
            // different name and it will break compatibility!
            #pragma warning disable 0618
            ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();
            // TODO: At some point, maybe we should check the cert?

            // Create the CAPS login structure
            OSDMap loginLLSD = new OSDMap();
            loginLLSD["first"] = OSD.FromString(loginParams.FirstName);
            loginLLSD["last"] = OSD.FromString(loginParams.LastName);
            loginLLSD["passwd"] = OSD.FromString(loginParams.Password);
            loginLLSD["start"] = OSD.FromString(loginParams.Start);
            loginLLSD["channel"] = OSD.FromString(loginParams.Channel);
            loginLLSD["version"] = OSD.FromString(loginParams.Version);
            loginLLSD["platform"] = OSD.FromString(loginParams.Platform);
            loginLLSD["mac"] = OSD.FromString(loginParams.MAC);
            loginLLSD["agree_to_tos"] = OSD.FromBoolean(true);
            loginLLSD["read_critical"] = OSD.FromBoolean(true);
            loginLLSD["viewer_digest"] = OSD.FromString(loginParams.ViewerDigest);
            loginLLSD["id0"] = OSD.FromString(loginParams.id0);

            // Create the options LLSD array
            OSDArray optionsOSD = new OSDArray();
            for (int i = 0; i < loginParams.Options.Count; i++)
                optionsOSD.Add(OSD.FromString(loginParams.Options[i]));
            foreach (string[] callbackOpts in CallbackOptions.Values)
            {
                if (callbackOpts != null)
                {
                    for (int i = 0; i < callbackOpts.Length; i++)
                    {
                        if (!optionsOSD.Contains(callbackOpts[i]))
                            optionsOSD.Add(callbackOpts[i]);
                    }
                }
            }
            loginLLSD["options"] = optionsOSD;

            // Make the CAPS POST for login
            Uri loginUri;
            try
            {
                loginUri = new Uri(loginParams.URI);
            }
            catch (Exception ex)
            {
                Logger.Log(String.Format("Failed to parse login URI {0}, {1}", loginParams.URI, ex.Message),
                    Helpers.LogLevel.Error, Client);
                throw ex;
            }

            CapsClient loginRequest = new CapsClient(loginUri);
            loginRequest.OnComplete += new CapsClient.CompleteCallback(LoginReplyHandler);
            loginRequest.UserData = CurrentContext;
            UpdateLoginStatus(LoginStatus.ConnectingToLogin, String.Format("Logging in as {0} {1}...", loginParams.FirstName, loginParams.LastName));
            loginRequest.StartRequest(OSDParser.SerializeLLSDXmlBytes(loginLLSD), "application/xml+llsd");
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:70,代码来源:Login.cs

示例12: CreateItemFromAssetResponse

        private void CreateItemFromAssetResponse(CapsClient client, OSD result, Exception error)
        {
            object[] args = (object[])client.UserData;
            CapsClient.ProgressCallback progCallback = (CapsClient.ProgressCallback)args[0];
            ItemCreatedFromAssetCallback callback = (ItemCreatedFromAssetCallback)args[1];
            byte[] itemData = (byte[])args[2];

            if (result == null)
            {
                try { callback(false, error.Message, UUID.Zero, UUID.Zero); }
                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, _Client, e); }
                return;
            }

            OSDMap contents = (OSDMap)result;

            string status = contents["state"].AsString().ToLower();

            if (status == "upload")
            {
                string uploadURL = contents["uploader"].AsString();

                Logger.DebugLog("CreateItemFromAsset: uploading to " + uploadURL);

                // This makes the assumption that all uploads go to CurrentSim, to avoid
                // the problem of HttpRequestState not knowing anything about simulators
                CapsClient upload = new CapsClient(new Uri(uploadURL));
                upload.OnProgress += progCallback;
                upload.OnComplete += new CapsClient.CompleteCallback(CreateItemFromAssetResponse);
                upload.UserData = new object[] { null, callback, itemData };
                upload.StartRequest(itemData, "application/octet-stream");
            }
            else if (status == "complete")
            {
                Logger.DebugLog("CreateItemFromAsset: completed");

                if (contents.ContainsKey("new_inventory_item") && contents.ContainsKey("new_asset"))
                {
                    try { callback(true, String.Empty, contents["new_inventory_item"].AsUUID(), contents["new_asset"].AsUUID()); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, _Client, e); }
                }
                else
                {
                    try { callback(false, "Failed to parse asset and item UUIDs", UUID.Zero, UUID.Zero); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, _Client, e); }
                }
            }
            else
            {
                // Failure
                try { callback(false, status, UUID.Zero, UUID.Zero); }
                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, _Client, e); }
            }
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:54,代码来源:InventoryManager.cs

示例13: RequestUploadNotecardAsset

        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="notecardID"></param>
        /// <param name="callback"></param>
        public void RequestUploadNotecardAsset(byte[] data, UUID notecardID, NotecardUploadedAssetCallback callback)
        {
            if (_Client.Network.CurrentSim == null || _Client.Network.CurrentSim.Caps == null)
                throw new Exception("UpdateNotecardAgentInventory capability is not currently available");

            Uri url = _Client.Network.CurrentSim.Caps.CapabilityURI("UpdateNotecardAgentInventory");

            if (url != null)
            {
                OSDMap query = new OSDMap();
                query.Add("item_id", OSD.FromUUID(notecardID));

                byte[] postData = StructuredData.OSDParser.SerializeLLSDXmlBytes(query);

                // Make the request
                CapsClient request = new CapsClient(url);
                request.OnComplete += new CapsClient.CompleteCallback(UploadNotecardAssetResponse);
                request.UserData = new object[2] { new KeyValuePair<NotecardUploadedAssetCallback, byte[]>(callback, data), notecardID };
                request.StartRequest(postData);
            }
            else
            {
                throw new Exception("UpdateNotecardAgentInventory capability is not currently available");
            }
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:31,代码来源:InventoryManager.cs

示例14: RequestCreateItemFromAsset

        public void RequestCreateItemFromAsset(byte[] data, string name, string description, AssetType assetType,
            InventoryType invType, UUID folderID, CapsClient.ProgressCallback progCallback, ItemCreatedFromAssetCallback callback)
        {
            if (_Client.Network.CurrentSim == null || _Client.Network.CurrentSim.Caps == null)
                throw new Exception("NewFileAgentInventory capability is not currently available");

            Uri url = _Client.Network.CurrentSim.Caps.CapabilityURI("NewFileAgentInventory");

            if (url != null)
            {
                OSDMap query = new OSDMap();
                query.Add("folder_id", OSD.FromUUID(folderID));
                query.Add("asset_type", OSD.FromString(AssetTypeToString(assetType)));
                query.Add("inventory_type", OSD.FromString(InventoryTypeToString(invType)));
                query.Add("name", OSD.FromString(name));
                query.Add("description", OSD.FromString(description));

                // Make the request
                CapsClient request = new CapsClient(url);
                request.OnComplete += new CapsClient.CompleteCallback(CreateItemFromAssetResponse);
                request.UserData = new object[] { progCallback, callback, data };

                request.StartRequest(query);
            }
            else
            {
                throw new Exception("NewFileAgentInventory capability is not currently available");
            }
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:29,代码来源:InventoryManager.cs

示例15: ModerateChatSessions

        /// <summary>
        /// Moderate a chat session
        /// </summary>
        /// <param name="sessionID">the <see cref="UUID"/> of the session to moderate, for group chats this will be the groups UUID</param>
        /// <param name="memberID">the <see cref="UUID"/> of the avatar to moderate</param>
        /// <param name="moderateText">true to moderate (silence user), false to allow avatar to speak</param>
        public void ModerateChatSessions(UUID sessionID, UUID memberID, bool moderateText)
        {
            if (Client.Network.CurrentSim == null || Client.Network.CurrentSim.Caps == null)
                throw new Exception("ChatSessionRequest capability is not currently available");

            Uri url = Client.Network.CurrentSim.Caps.CapabilityURI("ChatSessionRequest");

            if (url != null)
            {
                OSDMap req = new OSDMap();
                req.Add("method", OSD.FromString("mute update"));

                OSDMap mute_info = new OSDMap();
                mute_info.Add("text", OSD.FromBoolean(moderateText));

                OSDMap parameters = new OSDMap();
                parameters["agent_id"] = OSD.FromUUID(memberID);
                parameters["mute_info"] = mute_info;

                req["params"] = parameters;

                req.Add("session-id", OSD.FromUUID(sessionID));

                byte[] postData = StructuredData.OSDParser.SerializeLLSDXmlBytes(req);

                CapsClient request = new CapsClient(url);
                request.StartRequest(postData);
            }
            else
            {
                throw new Exception("ChatSessionRequest capability is not currently available");
            }
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:39,代码来源:AgentManager.cs


注:本文中的OpenMetaverse.Http.CapsClient.StartRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。