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


C# Framework.UserProfileProperties类代码示例

本文整理汇总了C#中OpenSim.Framework.UserProfileProperties的典型用法代码示例。如果您正苦于以下问题:C# UserProfileProperties类的具体用法?C# UserProfileProperties怎么用?C# UserProfileProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: RequestAvatarPropertiesUsingOpenProfile

        /// <summary>
        /// Gets an avatar's profile using the OpenProfile protocol.
        /// </summary>
        /// <param name="props">On success, this will contain the avatar's profile</param>
        /// <returns>Success/failure</returns>
        /// <remarks>
        /// There are two profile modules currently in use in OpenSim: the older one is OpenProfile, and the newer
        /// one is UserProfileModule (this file). This method attempts to read an avatar's profile from a foreign
        /// grid using the OpenProfile protocol.
        /// </remarks>
        public bool RequestAvatarPropertiesUsingOpenProfile(ref UserProfileProperties props)
        {
            Hashtable ReqHash = new Hashtable();
            ReqHash["avatar_id"] = props.UserId.ToString();

            Hashtable profileData = XMLRPCRequester.SendRequest(ReqHash, "avatar_properties_request", m_serverURI);

            if (profileData == null)
                return false;
            if (!profileData.ContainsKey("data"))
                return false;

            ArrayList dataArray = (ArrayList)profileData["data"];

            if (dataArray == null || dataArray[0] == null)
                return false;
            profileData = (Hashtable)dataArray[0];

            props.WebUrl = string.Empty;
            props.AboutText = String.Empty;
            props.FirstLifeText = String.Empty;
            props.ImageId = UUID.Zero;
            props.FirstLifeImageId = UUID.Zero;
            props.PartnerId = UUID.Zero;

            if (profileData["ProfileUrl"] != null)
                props.WebUrl = profileData["ProfileUrl"].ToString();
            if (profileData["AboutText"] != null)
                props.AboutText = profileData["AboutText"].ToString();
            if (profileData["FirstLifeAboutText"] != null)
                props.FirstLifeText = profileData["FirstLifeAboutText"].ToString();
            if (profileData["Image"] != null)
                props.ImageId = new UUID(profileData["Image"].ToString());
            if (profileData["FirstLifeImage"] != null)
                props.FirstLifeImageId = new UUID(profileData["FirstLifeImage"].ToString());
            if (profileData["Partner"] != null)
                props.PartnerId = new UUID(profileData["Partner"].ToString());

            props.WantToMask = 0;
            props.WantToText = String.Empty;
            props.SkillsMask = 0;
            props.SkillsText = String.Empty;
            props.Language = String.Empty;

            if (profileData["wantmask"] != null)
                props.WantToMask = Convert.ToInt32(profileData["wantmask"].ToString());
            if (profileData["wanttext"] != null)
                props.WantToText = profileData["wanttext"].ToString();

            if (profileData["skillsmask"] != null)
                props.SkillsMask = Convert.ToInt32(profileData["skillsmask"].ToString());
            if (profileData["skillstext"] != null)
                props.SkillsText = profileData["skillstext"].ToString();

            if (profileData["languages"] != null)
                props.Language = profileData["languages"].ToString();

            return true;
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:69,代码来源:OpenProfileClient.cs

示例2: UpdateAvatarInterests

        public bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
        {           
            string query = string.Empty;
            
            query += "UPDATE userprofile SET ";
            query += "\"profileWantToMask\"=:WantMask, ";
            query += "\"profileWantToText\"=:WantText,";
            query += "\"profileSkillsMask\"=:SkillsMask,";
            query += "\"profileSkillsText\"=:SkillsText, ";
            query += "\"profileLanguages\"=:Languages ";
            query += "WHERE \"useruuid\"=:uuid";
            
            try
            {
                using (NpgsqlConnection dbcon = new NpgsqlConnection(ConnectionString))
                {
                    dbcon.Open();
                    using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
                    {
                        cmd.Parameters.Add(m_database.CreateParameter("WantMask", up.WantToMask));
                        cmd.Parameters.Add(m_database.CreateParameter("WantText", up.WantToText));
                        cmd.Parameters.Add(m_database.CreateParameter("SkillsMask", up.SkillsMask));
                        cmd.Parameters.Add(m_database.CreateParameter("SkillsText", up.SkillsText));
                        cmd.Parameters.Add(m_database.CreateParameter("Languages", up.Language));
                        cmd.Parameters.Add(m_database.CreateParameter("uuid", up.UserId));
                        
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception e)
            {
                m_log.Error("[PROFILES_DATA]: UpdateAvatarInterests exception ", e);
                result = e.Message;
                return false;
            }

            return true;
        }
开发者ID:szielins,项目名称:opensim,代码行数:39,代码来源:PGSQLUserProfilesData.cs

示例3: UpdateAvatarProperties

        public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
        {            
            string query = string.Empty;
            
            query += "UPDATE userprofile SET ";
            query += "\"profileURL\"=:profileURL, ";
            query += "\"profileImage\"=:image, ";
            query += "\"profileAboutText\"=:abouttext,";
            query += "\"profileFirstImage\"=:firstlifeimage,";
            query += "\"profileFirstText\"=:firstlifetext ";
            query += "WHERE \"useruuid\"=:uuid";
            
            try
            {
                using (NpgsqlConnection dbcon = new NpgsqlConnection(ConnectionString))
                {
                    dbcon.Open();
                    using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
                    {
                        cmd.Parameters.Add(m_database.CreateParameter("profileURL", props.WebUrl));
                        cmd.Parameters.Add(m_database.CreateParameter("image", props.ImageId));
                        cmd.Parameters.Add(m_database.CreateParameter("abouttext", props.AboutText));
                        cmd.Parameters.Add(m_database.CreateParameter("firstlifeimage", props.FirstLifeImageId));
                        cmd.Parameters.Add(m_database.CreateParameter("firstlifetext", props.FirstLifeText));
                        cmd.Parameters.Add(m_database.CreateParameter("uuid", props.UserId));
                        
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception e)
            {
                m_log.Error("[PROFILES_DATA]: AgentPropertiesUpdate exception ", e);                
                return false;
            }

            return true;
        }
开发者ID:szielins,项目名称:opensim,代码行数:38,代码来源:PGSQLUserProfilesData.cs

示例4: RequestAvatarProperties

        public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
        {
            if (String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString()))
            {
                // Looking for a reason that some viewers are sending null Id's
                m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID);
                return;
            }

            // Can't handle NPC yet...
            ScenePresence p = FindPresence(avatarID);

            if (null != p)
            {
                if (p.PresenceType == PresenceType.Npc)
                    return;
            }

            string serverURI = string.Empty;
            bool foreign = GetUserProfileServerURI(avatarID, out serverURI);

            UserAccount account = null;
            Dictionary<string,object> userInfo;

            if (!foreign)
            {
                account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, avatarID);
            }
            else
            {
                userInfo = new Dictionary<string, object>();
            }

            Byte[] charterMember = new Byte[1];
            string born = String.Empty;
            uint flags = 0x00;

            if (null != account)
            {
                if (account.UserTitle == "")
                {
                    charterMember[0] = (Byte)((account.UserFlags & 0xf00) >> 8);
                }
                else
                {
                    charterMember = Utils.StringToBytes(account.UserTitle);
                }

                born = Util.ToDateTime(account.Created).ToString(
                                  "M/d/yyyy", CultureInfo.InvariantCulture);
                flags = (uint)(account.UserFlags & 0xff);
            }
            else
            {
                if (GetUserAccountData(avatarID, out userInfo) == true)
                {
                    if ((string)userInfo["user_title"] == "")
                    {
                        charterMember[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8);
                    }
                    else
                    {
                        charterMember = Utils.StringToBytes((string)userInfo["user_title"]);
                    }

                    int val_born = (int)userInfo["user_created"];
                    born = Util.ToDateTime(val_born).ToString(
                                  "M/d/yyyy", CultureInfo.InvariantCulture);

                    // picky, picky
                    int val_flags = (int)userInfo["user_flags"];
                    flags = (uint)(val_flags & 0xff);
                }
            }

            UserProfileProperties props = new UserProfileProperties();
            string result = string.Empty;

            props.UserId = avatarID;

            if (!GetProfileData(ref props, foreign, out result))
            {
                m_log.DebugFormat("Error getting profile for {0}: {1}", avatarID, result);
                return;
            }

            remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags,
                                              props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId);


            remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, (uint)props.SkillsMask,
                                                  props.SkillsText, props.Language);
        }
开发者ID:RutgersUniversityVirtualWorlds,项目名称:opensim,代码行数:93,代码来源:UserProfileModule.cs

示例5: AvatarInterestsUpdate

        /// <summary>
        /// Update the avatars interests .
        /// </summary>
        /// <param name='remoteClient'>
        /// Remote client.
        /// </param>
        /// <param name='wantmask'>
        /// Wantmask.
        /// </param>
        /// <param name='wanttext'>
        /// Wanttext.
        /// </param>
        /// <param name='skillsmask'>
        /// Skillsmask.
        /// </param>
        /// <param name='skillstext'>
        /// Skillstext.
        /// </param>
        /// <param name='languages'>
        /// Languages.
        /// </param>
        public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages)
        {
            UserProfileProperties prop = new UserProfileProperties();

            prop.UserId = remoteClient.AgentId;
            prop.WantToMask = (int)wantmask;
            prop.WantToText = wanttext;
            prop.SkillsMask = (int)skillsmask;
            prop.SkillsText = skillstext;
            prop.Language = languages;

            string serverURI = string.Empty;
            GetUserProfileServerURI(remoteClient.AgentId, out serverURI);

            object Param = prop;
            if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString()))
            {
                remoteClient.SendAgentAlertMessage(
                        "Error updating interests", false);
                return;
            }
        }
开发者ID:RutgersUniversityVirtualWorlds,项目名称:opensim,代码行数:43,代码来源:UserProfileModule.cs

示例6: AvatarInterestsUpdate

        /// <summary>
        /// Update the avatars interests .
        /// </summary>
        /// <param name='remoteClient'>
        /// Remote client.
        /// </param>
        /// <param name='wantmask'>
        /// Wantmask.
        /// </param>
        /// <param name='wanttext'>
        /// Wanttext.
        /// </param>
        /// <param name='skillsmask'>
        /// Skillsmask.
        /// </param>
        /// <param name='skillstext'>
        /// Skillstext.
        /// </param>
        /// <param name='languages'>
        /// Languages.
        /// </param>
        public void AvatarInterestsUpdate(IClientAPI remoteClient, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages)
        {

            UserProfileProperties prop = new UserProfileProperties();

            prop.UserId = remoteClient.AgentId;
            prop.WantToMask = (int)wantmask;
            prop.WantToText = wanttext;
            prop.SkillsMask = (int)skillsmask;
            prop.SkillsText = skillstext;
            prop.Language = languages;

            string serverURI = string.Empty;
            GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
            if(string.IsNullOrWhiteSpace(serverURI))
                return;

            object Param = prop;
            if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString()))
            {
                remoteClient.SendAgentAlertMessage(
                        "Error updating interests", false);
                return;
            }

            // flush cache
            UserProfileCacheEntry uce = null;
            lock(m_profilesCache)
            {
                if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
                {
                    uce.props = null;
                }
            }

        }
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:57,代码来源:UserProfileModule.cs

示例7: UpdateAvatarProperties

 public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
 {            
     string query = string.Empty;
     
     query += "UPDATE userprofile SET ";
     query += "profileURL=:profileURL, ";
     query += "profileImage=:image, ";
     query += "profileAboutText=:abouttext,";
     query += "profileFirstImage=:firstlifeimage,";
     query += "profileFirstText=:firstlifetext ";
     query += "WHERE useruuid=:uuid";
     
     try
     {
         using (NpgsqlConnection dbcon = new NpgsqlConnection(ConnectionString))
         {
             dbcon.Open();
             using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
             {
                 cmd.Parameters.AddWithValue("profileURL", props.WebUrl);
                 cmd.Parameters.AddWithValue("image", props.ImageId.ToString());
                 cmd.Parameters.AddWithValue("abouttext", props.AboutText);
                 cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString());
                 cmd.Parameters.AddWithValue("firstlifetext", props.FirstLifeText);
                 cmd.Parameters.AddWithValue("uuid", props.UserId.ToString());
                 
                 cmd.ExecuteNonQuery();
             }
         }
     }
     catch (Exception e)
     {
         m_log.DebugFormat("[PROFILES_DATA]" +
                          ": AgentPropertiesUpdate exception {0}", e.Message);
         
         return false;
     }
     return true;
 }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:39,代码来源:PGSQLUserProfilesData.cs

示例8: GetAvatarProperties

        public bool GetAvatarProperties(ref UserProfileProperties props, ref string result)
        {
            IDataReader reader = null;
            string query = string.Empty;
            
            query += "SELECT * FROM userprofile WHERE ";
            query += "useruuid = :Id";

                using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
                {
                    cmd.CommandText = query;
                    cmd.Parameters.AddWithValue(":Id", props.UserId.ToString());
                    

                    try
                    {
                        reader = cmd.ExecuteReader();
                    }
                    catch(Exception e)
                    {
                        m_log.DebugFormat("[PROFILES_DATA]" +
                                          ": GetAvatarProperties exception {0}", e.Message);
                        result = e.Message;
                        return false;
                    }
                        if(reader != null && reader.Read())
                        {
                            m_log.DebugFormat("[PROFILES_DATA]" +
                                              ": Getting data for {0}.", props.UserId);

                            props.WebUrl = (string)reader["profileURL"];
                            UUID.TryParse((string)reader["profileImage"], out props.ImageId);
                            props.AboutText = (string)reader["profileAboutText"];
                            UUID.TryParse((string)reader["profileFirstImage"], out props.FirstLifeImageId);
                            props.FirstLifeText = (string)reader["profileFirstText"];
                            UUID.TryParse((string)reader["profilePartner"], out props.PartnerId);
                            props.WantToMask = (int)reader["profileWantToMask"];
                            props.WantToText = (string)reader["profileWantToText"];
                            props.SkillsMask = (int)reader["profileSkillsMask"];
                            props.SkillsText = (string)reader["profileSkillsText"];
                            props.Language = (string)reader["profileLanguages"];
                        }
                        else
                        {
                            m_log.DebugFormat("[PROFILES_DATA]" +
                                              ": No data for {0}", props.UserId);
                            
                            props.WebUrl = string.Empty;
                            props.ImageId = UUID.Zero;
                            props.AboutText = string.Empty;
                            props.FirstLifeImageId = UUID.Zero;
                            props.FirstLifeText = string.Empty;
                            props.PartnerId = UUID.Zero;
                            props.WantToMask = 0;
                            props.WantToText = string.Empty;
                            props.SkillsMask = 0;
                            props.SkillsText = string.Empty;
                            props.Language = string.Empty;
                            props.PublishProfile = false;
                            props.PublishMature = false;
                            
                            query = "INSERT INTO userprofile (";
                            query += "useruuid, ";
                            query += "profilePartner, ";
                            query += "profileAllowPublish, ";
                            query += "profileMaturePublish, ";
                            query += "profileURL, ";
                            query += "profileWantToMask, ";
                            query += "profileWantToText, ";
                            query += "profileSkillsMask, ";
                            query += "profileSkillsText, ";
                            query += "profileLanguages, ";
                            query += "profileImage, ";
                            query += "profileAboutText, ";
                            query += "profileFirstImage, ";
                            query += "profileFirstText) VALUES (";
                            query += ":userId, ";
                            query += ":profilePartner, ";
                            query += ":profileAllowPublish, ";
                            query += ":profileMaturePublish, ";
                            query += ":profileURL, ";
                            query += ":profileWantToMask, ";
                            query += ":profileWantToText, ";
                            query += ":profileSkillsMask, ";
                            query += ":profileSkillsText, ";
                            query += ":profileLanguages, ";
                            query += ":profileImage, ";
                            query += ":profileAboutText, ";
                            query += ":profileFirstImage, ";
                            query += ":profileFirstText)";

                            using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
                            {
                                put.CommandText = query;
                                put.Parameters.AddWithValue(":userId", props.UserId.ToString());
                                put.Parameters.AddWithValue(":profilePartner", props.PartnerId.ToString());
                                put.Parameters.AddWithValue(":profileAllowPublish", props.PublishProfile);
                                put.Parameters.AddWithValue(":profileMaturePublish", props.PublishMature);
                                put.Parameters.AddWithValue(":profileURL", props.WebUrl);
                                put.Parameters.AddWithValue(":profileWantToMask", props.WantToMask);
//.........这里部分代码省略.........
开发者ID:justasabc,项目名称:opensim76,代码行数:101,代码来源:SQLiteUserProfilesData.cs

示例9: AvatarInterestsUpdate

 public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result)
 {
     return ProfilesData.UpdateAvatarInterests(prop, ref result);
 }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:4,代码来源:UserProfilesService.cs

示例10: AvatarPropertiesUpdate

 public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result)
 {
     return ProfilesData.UpdateAvatarProperties(ref prop, ref result);
 }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:4,代码来源:UserProfilesService.cs

示例11: AvatarPropertiesRequest

 public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result)
 {
     return ProfilesData.GetAvatarProperties(ref prop, ref result);
 }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:4,代码来源:UserProfilesService.cs

示例12: GetProfileData

        /// <summary>
        /// Gets the profile data.
        /// </summary>
        /// <returns>
        /// The profile data.
        /// </returns>
        bool GetProfileData(ref UserProfileProperties properties, bool foreign, string serverURI, out string message)
        {
            if (String.IsNullOrEmpty(serverURI))
            {
                message = "User profile service unknown at this time";
                return false;
            }

            object Prop = (object)properties;
            if (!rpc.JsonRpcRequest(ref Prop, "avatar_properties_request", serverURI, UUID.Random().ToString()))
            {
                // If it's a foreign user then try again using OpenProfile, in case that's what the grid is using
                bool secondChanceSuccess = false;
                if (foreign)
                {
                    try
                    {
                        OpenProfileClient client = new OpenProfileClient(serverURI);
                        if (client.RequestAvatarPropertiesUsingOpenProfile(ref properties))
                            secondChanceSuccess = true;
                    }
                    catch (Exception e)
                    {
                        m_log.Debug(
                            string.Format(
                                "[PROFILES]: Request using the OpenProfile API for user {0} to {1} failed", 
                                properties.UserId, serverURI),
                            e);

                        // Allow the return 'message' to say "JsonRpcRequest" and not "OpenProfile", because
                        // the most likely reason that OpenProfile failed is that the remote server
                        // doesn't support OpenProfile, and that's not very interesting.
                    }
                }

                if (!secondChanceSuccess)
                {
                    message = string.Format("JsonRpcRequest for user {0} to {1} failed", properties.UserId, serverURI);
                    m_log.DebugFormat("[PROFILES]: {0}", message);

                    return false;
                }
            }
                      
            properties = (UserProfileProperties)Prop;
            if(foreign)
            {
                cacheForeignImage(properties.UserId, properties.ImageId);
                cacheForeignImage(properties.UserId, properties.FirstLifeImageId);
            }

            message = "Success";
            return true;
        }
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:60,代码来源:UserProfileModule.cs

示例13: AvatarPropertiesUpdate

        /// <summary>
        /// Updates the avatar properties.
        /// </summary>
        /// <param name='remoteClient'>
        /// Remote client.
        /// </param>
        /// <param name='newProfile'>
        /// New profile.
        /// </param>
        public void AvatarPropertiesUpdate(IClientAPI remoteClient, UserProfileData newProfile)
        {
            if (remoteClient.AgentId == newProfile.ID)
            {

                UserProfileProperties prop = new UserProfileProperties();

                prop.UserId = remoteClient.AgentId;
                prop.WebUrl = newProfile.ProfileUrl;
                prop.ImageId = newProfile.Image;
                prop.AboutText = newProfile.AboutText;
                prop.FirstLifeImageId = newProfile.FirstLifeImage;
                prop.FirstLifeText = newProfile.FirstLifeAboutText;

                if(!m_allowUserProfileWebURLs)
                    prop.WebUrl ="";

                string serverURI = string.Empty;
                GetUserProfileServerURI(remoteClient.AgentId, out serverURI);

                object Prop = prop;

                if(!rpc.JsonRpcRequest(ref Prop, "avatar_properties_update", serverURI, UUID.Random().ToString()))
                {
                    remoteClient.SendAgentAlertMessage(
                            "Error updating properties", false);
                    return;
                }

                // flush cache
                UserProfileCacheEntry uce = null;
                lock(m_profilesCache)
                {
                    if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
                    {
                        uce.props = null;
                    }
                }

                RequestAvatarProperties(remoteClient, newProfile.ID);
            }
        }
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:51,代码来源:UserProfileModule.cs

示例14: RequestAvatarProperties

        public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
        {
            if (String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString()))
            {
                // Looking for a reason that some viewers are sending null Id's
                m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID);
                return;
            }

            ScenePresence p = FindPresence(avatarID);
            if (p != null && p.isNPC)
            {
                remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, ((INPC)(p.ControllingClient)).Born,
                      Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 0x10,
                      UUID.Zero, ((INPC)(p.ControllingClient)).profileImage, "", UUID.Zero);
                remoteClient.SendAvatarInterestsReply(avatarID, 0, "",
                          0, "Getting into trouble", "Droidspeak");
                return;
            }
            UserProfileProperties props;
            UserProfileCacheEntry uce = null;
            lock(m_profilesCache)
            {
                if(m_profilesCache.TryGetValue(avatarID, out uce) && uce != null)
                {
                    if(uce.props != null)
                    {
                        props = uce.props;
                        uint cflags = uce.flags;
                        // if on same region force online
                        if(p != null && !p.IsDeleted)
                            cflags |= 0x10;

                        remoteClient.SendAvatarProperties(props.UserId, props.AboutText,
                            uce.born, uce.membershipType , props.FirstLifeText, cflags,
                            props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId);

                        remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask,
                            props.WantToText, (uint)props.SkillsMask,
                            props.SkillsText, props.Language);
                        return;
                    }
                    else
                    {
                        if(uce.ClientsWaitingProps == null)
                            uce.ClientsWaitingProps = new HashSet<IClientAPI>();
                        else if(uce.ClientsWaitingProps.Contains(remoteClient))
                            return;
                        uce.ClientsWaitingProps.Add(remoteClient);
                    }
                }
                else
                {
                    uce = new UserProfileCacheEntry();
                    uce.ClientsWaitingProps = new HashSet<IClientAPI>();
                    uce.ClientsWaitingProps.Add(remoteClient);
                    m_profilesCache.AddOrUpdate(avatarID, uce, PROFILECACHEEXPIRE);
                }
            }

            string serverURI = string.Empty;
            bool foreign = GetUserProfileServerURI(avatarID, out serverURI);

            UserAccount account = null;
            Dictionary<string,object> userInfo;

            if (!foreign)
            {
                account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, avatarID);
            }
            else
            {
                userInfo = new Dictionary<string, object>();
            }

            Byte[] membershipType = new Byte[1];
            string born = string.Empty;
            uint flags = 0x00;

            if (null != account)
            {
                if (account.UserTitle == "")
                    membershipType[0] = (Byte)((account.UserFlags & 0xf00) >> 8);
                else
                    membershipType = Utils.StringToBytes(account.UserTitle);

                born = Util.ToDateTime(account.Created).ToString(
                                  "M/d/yyyy", CultureInfo.InvariantCulture);
                flags = (uint)(account.UserFlags & 0xff);
            }
            else
            {
                if (GetUserAccountData(avatarID, out userInfo) == true)
                {
                    if ((string)userInfo["user_title"] == "")
                        membershipType[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8);
                    else
                        membershipType = Utils.StringToBytes((string)userInfo["user_title"]);

                    int val_born = (int)userInfo["user_created"];
//.........这里部分代码省略.........
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:101,代码来源:UserProfileModule.cs

示例15: UpdateAvatarProperties

 public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
 {           
     string query = string.Empty;
     
     query += "UPDATE userprofile SET ";
     query += "profileURL=:profileURL, ";
     query += "profileImage=:image, ";
     query += "profileAboutText=:abouttext,";
     query += "profileFirstImage=:firstlifeimage,";
     query += "profileFirstText=:firstlifetext ";
     query += "WHERE useruuid=:uuid";
     
     try
     {
         using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
         {
             cmd.CommandText = query;
             cmd.Parameters.AddWithValue(":profileURL", props.WebUrl);
             cmd.Parameters.AddWithValue(":image", props.ImageId.ToString());
             cmd.Parameters.AddWithValue(":abouttext", props.AboutText);
             cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString());
             cmd.Parameters.AddWithValue(":firstlifetext", props.FirstLifeText);
             cmd.Parameters.AddWithValue(":uuid", props.UserId.ToString());
             
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception e)
     {
         m_log.ErrorFormat("[PROFILES_DATA]" +
                           ": AgentPropertiesUpdate exception {0}", e.Message);
         
         return false;
     }
     return true;
 }
开发者ID:RadaSangOn,项目名称:workCore2,代码行数:36,代码来源:SQLiteUserProfilesData.cs


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