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


C# CapsClient.BeginGetResponse方法代码示例

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


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

示例1: 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)
            {
                ParcelPropertiesUpdateMessage req = new ParcelPropertiesUpdateMessage();
                req.AuthBuyerID = this.AuthBuyerID;
                req.Category = this.Category;
                req.Desc = this.Desc;
                req.GroupID = this.GroupID;
                req.Landing = this.Landing;
                req.LocalID = this.LocalID;
                req.MediaAutoScale = this.Media.MediaAutoScale;
                req.MediaDesc = this.Media.MediaDesc;
                req.MediaHeight = this.Media.MediaHeight;
                req.MediaID = this.Media.MediaID;
                req.MediaLoop = this.Media.MediaLoop;
                req.MediaType = this.Media.MediaType;
                req.MediaURL = this.Media.MediaURL;
                req.MediaWidth = this.Media.MediaWidth;
                req.MusicURL = this.MusicURL;
                req.Name = this.Name;
                req.ObscureMedia = this.ObscureMedia;
                req.ObscureMusic = this.ObscureMusic;
                req.ParcelFlags = this.Flags;
                req.PassHours = this.PassHours;
                req.PassPrice = (uint)this.PassPrice;
                req.SalePrice = (uint)this.SalePrice;
                req.SnapshotID = this.SnapshotID;
                req.UserLocation = this.UserLocation;
                req.UserLookAt = this.UserLookAt;
               
                OSDMap body = req.Serialize();

                CapsClient capsPost = new CapsClient(url);
                capsPost.BeginGetResponse(body, OSDFormat.Xml, simulator.Client.Settings.CAPS_TIMEOUT);
            }
            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) ? (byte)0x1 : (byte)0x0;
                request.ParcelData.MediaID = this.Media.MediaID;
                request.ParcelData.MediaURL = Utils.StringToBytes(this.Media.MediaURL.ToString());
                request.ParcelData.MusicURL = Utils.StringToBytes(this.MusicURL.ToString());
                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);
            }

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

示例2: GetAttachmentResources

        /// <summary>
        /// Fetches resource usage by agents attachmetns
        /// </summary>
        /// <param name="callback">Called when the requested information is collected</param>
        public void GetAttachmentResources(AttachmentResourcesCallback callback)
        {
            try
            {
                Uri url = Client.Network.CurrentSim.Caps.CapabilityURI("AttachmentResources");
                CapsClient request = new CapsClient(url);

                request.OnComplete += delegate(CapsClient client, OSD result, Exception error)
                {
                    try
                    {
                        if (result == null || error != null)
                        {
                            callback(false, null);
                        }
                        AttachmentResourcesMessage info = AttachmentResourcesMessage.FromOSD(result);
                        callback(true, info);

                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Failed fetching AttachmentResources", Helpers.LogLevel.Error, Client, ex);
                        callback(false, null);
                    }
                };

                request.BeginGetResponse(Client.Settings.CAPS_TIMEOUT);
            }
            catch (Exception ex)
            {
                Logger.Log("Failed fetching AttachmentResources", Helpers.LogLevel.Error, Client, ex);
                callback(false, null);
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:38,代码来源:AgentManager.cs

示例3: BeginLogin

        private void BeginLogin()
        {
            LoginParams loginParams = CurrentContext.Value;
            // Generate a random ID to identify this login attempt
            loginParams.LoginID = UUID.Random();
            CurrentContext = loginParams;

            #region Sanity Check loginParams

            if (loginParams.Options == null)
                loginParams.Options = new List<string>().ToArray();

            // 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);

            if (loginParams.ViewerDigest == null)
                loginParams.ViewerDigest = String.Empty;

            if (loginParams.Version == null)
                loginParams.Version = String.Empty;

            if (loginParams.UserAgent == null)
                loginParams.UserAgent = String.Empty;

            if (loginParams.Platform == null)
                loginParams.Platform = String.Empty;

            if (loginParams.MAC == null)
                loginParams.MAC = String.Empty;

            if (loginParams.Channel == null)
                loginParams.Channel = String.Empty;

            if (loginParams.Author == null)
                loginParams.Author = String.Empty;

            #endregion

            // TODO: Allow a user callback to be defined for handling the cert
            ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
            // Even though this will compile on Mono 2.4, it throws a runtime exception
            //ServicePointManager.ServerCertificateValidationCallback = TrustAllCertificatePolicy.TrustAllCertificateHandler;

            if (Client.Settings.USE_LLSD_LOGIN)
            {
                #region LLSD Based Login

                // 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(loginParams.AgreeToTos);
                loginLLSD["read_critical"] = OSD.FromBoolean(loginParams.ReadCritical);
                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.Length; 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);
                    return;
                }

                CapsClient loginRequest = new CapsClient(loginUri);
                loginRequest.OnComplete += new CapsClient.CompleteCallback(LoginReplyLLSDHandler);
                loginRequest.UserData = CurrentContext;
                UpdateLoginStatus(LoginStatus.ConnectingToLogin, String.Format("Logging in as {0} {1}...", loginParams.FirstName, loginParams.LastName));
                loginRequest.BeginGetResponse(loginLLSD, OSDFormat.Xml, Client.Settings.CAPS_TIMEOUT);

//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:Login.cs

示例4: UpdateScriptAgentInventoryResponse

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

            if (result == null)
            {
                try { callback(false, error.Message, false, null, 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();
            if (status == "upload")
            {
                string uploadURL = contents["uploader"].AsString();

                CapsClient upload = new CapsClient(new Uri(uploadURL));
                upload.OnComplete += new CapsClient.CompleteCallback(UpdateScriptAgentInventoryResponse);
                upload.UserData = new object[2] { kvp, (UUID)(((object[])client.UserData)[1]) };
                upload.BeginGetResponse(itemData, "application/octet-stream", Client.Settings.CAPS_TIMEOUT);
            }
            else if (status == "complete" && callback != null)
            {
                if (contents.ContainsKey("new_asset"))
                {
                    // Request full item update so we keep store in sync
                    RequestFetchInventory((UUID)(((object[])client.UserData)[1]), contents["new_asset"].AsUUID());
                    

                    try
                    {
                        List<string> compileErrors = null;
                        
                        if (contents.ContainsKey("errors"))
                        {
                            OSDArray errors = (OSDArray)contents["errors"];
                            compileErrors = new List<string>(errors.Count);

                            for (int i = 0; i < errors.Count; i++)
                            {
                                compileErrors.Add(errors[i].AsString());
                            }
                        }

                        callback(true,
                            status,
                            contents["compiled"].AsBoolean(),
                            compileErrors,
                            (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 UUID", false, null, UUID.Zero, UUID.Zero); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
            else if (callback != null)
            {
                try { callback(false, status, false, null, UUID.Zero, UUID.Zero); }
                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:69,代码来源:InventoryManager.cs

示例5: 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)
            {
                ChatSessionAcceptInvitation acceptInvite = new ChatSessionAcceptInvitation();
                acceptInvite.SessionID = session_id;

                CapsClient request = new CapsClient(url);
                request.BeginGetResponse(acceptInvite.Serialize(), OSDFormat.Xml, Client.Settings.CAPS_TIMEOUT);
            }
            else
            {
                throw new Exception("ChatSessionRequest capability is not currently available");
            }

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

示例6: RequestUploadGestureAsset

        /// <summary>
        /// Upload new gesture asset for an inventory gesture item
        /// </summary>
        /// <param name="data">Encoded gesture asset</param>
        /// <param name="gestureID">Gesture inventory UUID</param>
        /// <param name="callback">Callback whick will be called when upload is complete</param>
        public void RequestUploadGestureAsset(byte[] data, UUID gestureID, InventoryUploadedAssetCallback callback)
        {
            if (Client.Network.CurrentSim == null || Client.Network.CurrentSim.Caps == null)
                throw new Exception("UpdateGestureAgentInventory capability is not currently available");

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

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

                // Make the request
                CapsClient request = new CapsClient(url);
                request.OnComplete += UploadInventoryAssetResponse;
                request.UserData = new object[] { new KeyValuePair<InventoryUploadedAssetCallback, byte[]>(callback, data), gestureID };
                request.BeginGetResponse(query, OSDFormat.Xml, Client.Settings.CAPS_TIMEOUT);
            }
            else
            {
                throw new Exception("UpdateGestureAgentInventory capability is not currently available");
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:29,代码来源:InventoryManager.cs

示例7: CreateItemFromAssetResponse

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

            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.OnComplete += CreateItemFromAssetResponse;
                upload.UserData = new object[] { callback, itemData, millisecondsTimeout, request };
                upload.BeginGetResponse(itemData, "application/octet-stream", millisecondsTimeout);
            }
            else if (status == "complete")
            {
                Logger.DebugLog("CreateItemFromAsset: completed");

                if (contents.ContainsKey("new_inventory_item") && contents.ContainsKey("new_asset"))
                {
                    // Request full update on the item in order to update the local store
                    RequestFetchInventory(contents["new_inventory_item"].AsUUID(), Client.Self.AgentID);

                    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:RavenB,项目名称:gridsearch,代码行数:57,代码来源:InventoryManager.cs

示例8: SetAgentAccess

        /// <summary>
        /// Sets agents maturity access level
        /// </summary>
        /// <param name="access">PG, M or A</param>
        /// <param name="callback">Callback function</param>
        public void SetAgentAccess(string access, AgentAccessCallback callback)
        {
            if (Client == null || !Client.Network.Connected || Client.Network.CurrentSim.Caps == null) return;

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

            if (url == null) return;

            CapsClient request = new CapsClient(url);

            request.OnComplete += (client, result, error) =>
            {
                bool success = true;

                if (error == null && result is OSDMap)
                {
                    var map = ((OSDMap)result)["access_prefs"];
                    agentAccess = ((OSDMap)map)["max"];
                    Logger.Log("Max maturity access set to " + agentAccess, Helpers.LogLevel.Info, Client );
                }
                else if (error == null)
                {
                    Logger.Log("Max maturity unchanged at " + agentAccess, Helpers.LogLevel.Info, Client);
                }
                else
                {
                    Logger.Log("Failed setting max maturity access.", Helpers.LogLevel.Warning, Client);
                    success = false;
                }

                if (callback != null)
                {
                    try { callback(new AgentAccessEventArgs(success, agentAccess)); }
                    catch { }
                }

            };
            OSDMap req = new OSDMap();
            OSDMap prefs = new OSDMap();
            prefs["max"] = access;
            req["access_prefs"] = prefs;

            request.BeginGetResponse(req, OSDFormat.Xml, Client.Settings.CAPS_TIMEOUT);
        }
开发者ID:WolfGangS,项目名称:SteelCityAutomaton,代码行数:49,代码来源:AgentManager.cs

示例9: SetDisplayName

        /// <summary>
        /// Initates request to set a new display name
        /// </summary>
        /// <param name="oldName">Previous display name</param>
        /// <param name="newName">Desired new display name</param>
        public void SetDisplayName(string oldName, string newName)
        {
            Uri uri;

            if (Client.Network.CurrentSim == null ||
                Client.Network.CurrentSim.Caps == null ||
                (uri = Client.Network.CurrentSim.Caps.CapabilityURI("SetDisplayName")) == null)
            {
                Logger.Log("Unable to invoke SetDisplyName capability at this time", Helpers.LogLevel.Warning, Client);
                return;
            }

            SetDisplayNameMessage msg = new SetDisplayNameMessage();
            msg.OldDisplayName = oldName;
            msg.NewDisplayName = newName;

            CapsClient cap = new CapsClient(uri);
            cap.BeginGetResponse(msg.Serialize(), OSDFormat.Xml, Client.Settings.CAPS_TIMEOUT);
        }
开发者ID:WolfGangS,项目名称:SteelCityAutomaton,代码行数:24,代码来源:AgentManager.cs

示例10: 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.BeginGetResponse(postData, "application/x-www-form-urlencoded", REQUEST_TIMEOUT);
        }
开发者ID:Virtual-Universe,项目名称:Virtual-LibOMV,代码行数:10,代码来源:RegistrationApi.cs

示例11: 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.BeginGetResponse(REQUEST_TIMEOUT);
        }
开发者ID:Virtual-Universe,项目名称:Virtual-LibOMV,代码行数:9,代码来源:RegistrationApi.cs

示例12: GatherLastNames

        public void GatherLastNames()
        {
            if (Initializing)
                throw new InvalidOperationException("still initializing");

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

            CapsClient request = new CapsClient(_caps.GetLastNames);
            request.OnComplete += new CapsClient.CompleteCallback(GatherLastNamesResponse);
            request.BeginGetResponse(REQUEST_TIMEOUT);

            // FIXME: Block
        }
开发者ID:Virtual-Universe,项目名称:Virtual-LibOMV,代码行数:14,代码来源:RegistrationApi.cs

示例13: 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));
            }

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

            // FIXME: Block
            return UUID.Zero;
        }
开发者ID:Virtual-Universe,项目名称:Virtual-LibOMV,代码行数:50,代码来源:RegistrationApi.cs

示例14: CheckName

        public bool CheckName(string firstName, LastName lastName)
        {
            if (Initializing)
                throw new InvalidOperationException("still initializing");

            if (_caps.CheckName == 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(firstName));
            query.Add("last_name_id", OSD.FromInteger(lastName.ID));

            CapsClient request = new CapsClient(_caps.CheckName);
            request.OnComplete += new CapsClient.CompleteCallback(CheckNameResponse);
            request.BeginGetResponse(REQUEST_TIMEOUT);

            // FIXME:
            return false;
        }
开发者ID:Virtual-Universe,项目名称:Virtual-LibOMV,代码行数:20,代码来源:RegistrationApi.cs

示例15: RequestCreateItemFromAsset

        /// <summary>
        /// Create an inventory item and upload asset data
        /// </summary>
        /// <param name="data">Asset data</param>
        /// <param name="name">Inventory item name</param>
        /// <param name="description">Inventory item description</param>
        /// <param name="assetType">Asset type</param>
        /// <param name="invType">Inventory type</param>
        /// <param name="folderID">Put newly created inventory in this folder</param>
        /// <param name="permissions">Permission of the newly created item 
        /// (EveryoneMask, GroupMask, and NextOwnerMask of Permissions struct are supported)</param>
        /// <param name="callback">Delegate that will receive feedback on success or failure</param>
        public void RequestCreateItemFromAsset(byte[] data, string name, string description, AssetType assetType,
            InventoryType invType, UUID folderID, Permissions permissions, 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(Utils.AssetTypeToString(assetType)));
                query.Add("inventory_type", OSD.FromString(Utils.InventoryTypeToString(invType)));
                query.Add("name", OSD.FromString(name));
                query.Add("description", OSD.FromString(description));
                query.Add("everyone_mask", OSD.FromInteger((int)permissions.EveryoneMask));
                query.Add("group_mask", OSD.FromInteger((int)permissions.GroupMask));
                query.Add("next_owner_mask", OSD.FromInteger((int)permissions.NextOwnerMask));
                query.Add("expected_upload_cost", OSD.FromInteger(Client.Settings.UPLOAD_COST));

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

                request.BeginGetResponse(query, OSDFormat.Xml, Client.Settings.CAPS_TIMEOUT);
            }
            else
            {
                throw new Exception("NewFileAgentInventory capability is not currently available");
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:45,代码来源:InventoryManager.cs


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