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


C# Framework.IUserProfileInfo类代码示例

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


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

示例1: GetUserProfile

        public IUserProfileInfo GetUserProfile(UUID PrincipalID)
        {
            try
            {
                List<string> serverURIs =
                    m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(PrincipalID.ToString(),
                                                                                           "RemoteServerURI");
                foreach (string url in serverURIs)
                {
                    OSDMap map = new OSDMap();
                    map["Method"] = "getprofile";
                    map["PrincipalID"] = PrincipalID;
                    OSDMap response = WebUtils.PostToService(url + "osd", map, true, true);
                    if (response["_Result"].Type == OSDType.Map)
                    {
                        OSDMap responsemap = (OSDMap) response["_Result"];
                        if (responsemap.Count == 0)
                            continue;
                        IUserProfileInfo info = new IUserProfileInfo();
                        info.FromOSD(responsemap);
                        return info;
                    }
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e);
            }

            return null;
        }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:31,代码来源:RemoteProfileConnector.cs

示例2: GetUserProfile

        /// <summary>
        /// Get a user's profile
        /// </summary>
        /// <param name="agentID"></param>
        /// <returns></returns>
		public IUserProfileInfo GetUserProfile(UUID agentID)
		{
			IUserProfileInfo UserProfile = new IUserProfileInfo();
            //Try from the user profile first before getting from the DB
            if (UserProfilesCache.TryGetValue(agentID, out UserProfile)) 
				return UserProfile;
            else 
            {
                UserProfile = new IUserProfileInfo();
                List<string> query = null;
                //Grab it from the almost generic interface
                query = GD.Query(new string[]{"ID", "`Key`"}, new object[]{agentID, "LLProfile"}, "userdata", "Value");
                
                if (query == null || query.Count == 0)
					return null;
                //Pull out the OSDmap
                OSDMap profile = (OSDMap)OSDParser.DeserializeLLSDXml(query[0]);
                UserProfile.FromOSD(profile);

				//Add to the cache
			    UserProfilesCache[agentID] = UserProfile;

				return UserProfile;
			}
		}
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:30,代码来源:LocalProfileConnector.cs

示例3: UpdateUserProfile

        /// <summary>
        /// Update a user's profile (Note: this does not work if the user does not have a profile)
        /// </summary>
        /// <param name="Profile"></param>
        /// <returns></returns>
        public bool UpdateUserProfile(IUserProfileInfo Profile)
        {
            IUserProfileInfo previousProfile = GetUserProfile(Profile.PrincipalID);
            //Make sure the previous one exists
            if (previousProfile == null)
                return false;
            //Now fix values that the sim cannot change
            Profile.Partner = previousProfile.Partner;
            Profile.CustomType = previousProfile.CustomType;
            Profile.MembershipGroup = previousProfile.MembershipGroup;
            Profile.Created = previousProfile.Created;

            List<object> SetValues = new List<object>();
            List<string> SetRows = new List<string>();
            SetRows.Add("Value");
            SetValues.Add(OSDParser.SerializeLLSDXmlString(Profile.ToOSD()));

            List<object> KeyValue = new List<object>();
			List<string> KeyRow = new List<string>();
			KeyRow.Add("ID");
            KeyValue.Add(Profile.PrincipalID.ToString());
            KeyRow.Add("`Key`");
            KeyValue.Add("LLProfile");

            //Update cache
            UserProfilesCache[Profile.PrincipalID] = Profile;

            return GD.Update("userdata", SetValues.ToArray(), SetRows.ToArray(), KeyRow.ToArray(), KeyValue.ToArray());
		}
开发者ID:kow,项目名称:Aurora-Sim,代码行数:34,代码来源:LocalProfileConnector.cs

示例4: UpdateUserProfile

 public bool UpdateUserProfile (IUserProfileInfo Profile)
 {
     bool success = m_localService.UpdateUserProfile (Profile);
     if (!success)
         success = m_remoteService.UpdateUserProfile (Profile);
     return success;
 }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:7,代码来源:IWCProfileConnector.cs

示例5: GetUserProfile

        public IUserProfileInfo GetUserProfile(UUID PrincipalID)
        {
            NameValueCollection requestArgs = new NameValueCollection
            {
                { "RequestMethod", "GetUser" },
                { "UserID", PrincipalID.ToString() }
            };

            OSDMap result = PostUserData(PrincipalID, requestArgs);

            if (result == null)
                return null;

            if (result.ContainsKey("Profile"))
            {
                OSDMap profilemap = (OSDMap)OSDParser.DeserializeJson(result["Profile"].AsString());

                IUserProfileInfo profile = new IUserProfileInfo();
                profile.FromOSD(profilemap);

                return profile;
            }

            return null;
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:25,代码来源:SimianProfileConnector.cs

示例6: GetUserProfile

        /// <summary>
        ///   Get a user's profile
        /// </summary>
        /// <param name = "agentID"></param>
        /// <returns></returns>
        public IUserProfileInfo GetUserProfile(UUID agentID)
        {
            IUserProfileInfo UserProfile = new IUserProfileInfo();
            //Try from the user profile first before getting from the DB
            if (UserProfilesCache.TryGetValue(agentID, out UserProfile))
                return UserProfile;
            else
            {
                Dictionary<string, object> where = new Dictionary<string, object>();
                where["ID"] = agentID;
                where["`Key`"] = "LLProfile";
                List<string> query = null;
                //Grab it from the almost generic interface
                query = GD.Query(new string[] { "Value" }, "userdata", new QueryFilter
                {
                    andFilters = where
                }, null, null, null);

                if (query == null || query.Count == 0)
                    return null;
                //Pull out the OSDmap
                OSDMap profile = (OSDMap) OSDParser.DeserializeLLSDXml(query[0]);

                UserProfile = new IUserProfileInfo();
                UserProfile.FromOSD(profile);

                //Add to the cache
                UserProfilesCache[agentID] = UserProfile;

                return UserProfile;
            }
        }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:37,代码来源:LocalProfileConnector.cs

示例7: GetUserProfile

        public IUserProfileInfo GetUserProfile(UUID agentID)
        {
            object remoteValue = DoRemote(agentID);
            if (remoteValue != null || m_doRemoteOnly)
                return (IUserProfileInfo)remoteValue;

            IUserProfileInfo UserProfile = new IUserProfileInfo();
            //Try from the user profile first before getting from the DB
            if (UserProfilesCache.TryGetValue(agentID, out UserProfile))
                return UserProfile;

            var connector = GetWhetherUserIsForeign(agentID);
            if (connector != null)
                return connector.GetUserProfile(agentID);

            QueryFilter filter = new QueryFilter();
            filter.andFilters["ID"] = agentID;
            filter.andFilters["`Key`"] = "LLProfile";
            List<string> query = null;
            //Grab it from the almost generic interface
            query = GD.Query(new[] { "Value" }, "userdata", filter, null, null, null);

            if (query == null || query.Count == 0)
                return null;
            //Pull out the OSDmap
            OSDMap profile = (OSDMap) OSDParser.DeserializeLLSDXml(query[0]);

            UserProfile = new IUserProfileInfo();
            UserProfile.FromOSD(profile);

            //Add to the cache
            UserProfilesCache[agentID] = UserProfile;

            return UserProfile;
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:35,代码来源:LocalProfileConnector.cs

示例8: GetUserProfile

		public IUserProfileInfo GetUserProfile(UUID agentID)
		{
			IUserProfileInfo UserProfile = new IUserProfileInfo();
            if (UserProfilesCache.TryGetValue(agentID, out UserProfile)) 
				return UserProfile;
            else 
            {
                UserProfile = new IUserProfileInfo();
                List<string> query = null;
                try
                {
                    query = GD.Query(new string[]{"ID", "`Key`"}, new object[]{agentID, "LLProfile"}, "userdata", "Value");
                }
                catch
                {
                }
                if (query == null || query.Count == 0)
					return null;

                OSDMap profile = (OSDMap)OSDParser.DeserializeLLSDXml(query[0]);

				UserProfile.PrincipalID = agentID;
                UserProfile.AllowPublish = profile["AllowPublish"].AsInteger() == 1;
                UserProfile.MaturePublish = profile["MaturePublish"].AsInteger() == 1;
                UserProfile.Partner = profile["Partner"].AsUUID();
                UserProfile.WebURL = profile["WebURL"].AsString();
                UserProfile.AboutText = profile["AboutText"].AsString();
                UserProfile.FirstLifeAboutText = profile["FirstLifeAboutText"].AsString();
                UserProfile.Image = profile["Image"].AsUUID();
                UserProfile.FirstLifeImage = profile["FirstLifeImage"].AsUUID();
                UserProfile.CustomType = profile["CustomType"].AsString();
                UserProfile.Visible = profile["Visible"].AsInteger() == 1;
                UserProfile.IMViaEmail = profile["IMViaEmail"].AsInteger() == 1;
                UserProfile.MembershipGroup = profile["MembershipGroup"].AsString();
                UserProfile.AArchiveName = profile["AArchiveName"].AsString();
                UserProfile.IsNewUser = profile["IsNewUser"].AsInteger() == 1;
                UserProfile.Created = profile["Created"].AsInteger();
                UserProfile.DisplayName = profile["DisplayName"].AsString();
                UserProfile.Interests.CanDoMask = profile["CanDoMask"].AsUInteger();
                UserProfile.Interests.WantToText = profile["WantToText"].AsString();
                UserProfile.Interests.CanDoMask = profile["CanDoMask"].AsUInteger();
                UserProfile.Interests.CanDoText = profile["CanDoText"].AsString();
                UserProfile.Interests.Languages = profile["Languages"].AsString();

                OSD onotes = OSDParser.DeserializeLLSDXml(profile["Notes"].AsString());
                OSDMap notes = onotes.Type == OSDType.Unknown ? new OSDMap() : (OSDMap)onotes;
                UserProfile.Notes = Util.OSDToDictionary(notes);
                OSD opicks = OSDParser.DeserializeLLSDXml(profile["Picks"].AsString());
                OSDMap picks = opicks.Type == OSDType.Unknown ? new OSDMap() : (OSDMap)opicks;
                UserProfile.Picks = Util.OSDToDictionary(picks);
                OSD oclassifieds = OSDParser.DeserializeLLSDXml(profile["Classifieds"].AsString());
                OSDMap classifieds = oclassifieds.Type == OSDType.Unknown ? new OSDMap() : (OSDMap)oclassifieds;
                UserProfile.Classifieds = Util.OSDToDictionary(classifieds);

			    UserProfilesCache[agentID] = UserProfile;

				return UserProfile;
			}
		}
开发者ID:shangcheng,项目名称:Aurora,代码行数:59,代码来源:LocalProfileConnector.cs

示例9: GetUserProfile

        public IUserProfileInfo GetUserProfile(UUID PrincipalID)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["PRINCIPALID"] = PrincipalID.ToString();
            sendData["METHOD"] = "getprofile";

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        m_ServerURI + "/auroradata",
                        reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        if (replyData != null)
                        {
                            if (!replyData.ContainsKey("result"))
                                return null;

                            IUserProfileInfo profile = null;
                            foreach (object f in replyData.Values)
                            {
                                if (f is Dictionary<string, object>)
                                {
                                    profile = new IUserProfileInfo();
                                    profile.FromKVP((Dictionary<string, object>)f);
                                }
                                else
                                    m_log.DebugFormat("[AuroraRemoteProfileConnector]: GetProfile {0} received invalid response type {1}",
                                        PrincipalID, f.GetType());
                            }
                            // Success
                            return profile;
                        }

                        else
                            m_log.DebugFormat("[AuroraRemoteProfileConnector]: GetProfile {0} received null response",
                                PrincipalID);
                    }
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.ToString());
            }

            return null;
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:54,代码来源:RemoteProfileConnector.cs

示例10: UpdateUserProfile

        public bool UpdateUserProfile(IUserProfileInfo Profile)
        {
            NameValueCollection requestArgs = new NameValueCollection
            {
                { "RequestMethod", "AddUserData" },
                { "UserID", Profile.PrincipalID.ToString() },
                { "Profile", OSDParser.SerializeJsonString(Profile.ToOSD()) }
            };

            return PostData(Profile.PrincipalID, requestArgs);
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:11,代码来源:SimianProfileConnector.cs

示例11: UpdateUserProfile

        public bool UpdateUserProfile(IUserProfileInfo Profile)
        {
            NameValueCollection requestArgs = new NameValueCollection
            {
                { "RequestMethod", "AddUserData" },
                { "AgentID", Profile.PrincipalID.ToString() },
                { "Profile", OSDParser.SerializeJsonString(Util.DictionaryToOSD(Profile.ToKeyValuePairs())) }
            };

            OSDMap result = PostData(Profile.PrincipalID, requestArgs);

            if (result == null)
                return false;

            bool success = result["Success"].AsBoolean();
            return success;
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:17,代码来源:SimianProfileConnector.cs

示例12: GetUserProfile

        public IUserProfileInfo GetUserProfile(UUID PrincipalID)
        {
            NameValueCollection requestArgs = new NameValueCollection
            {
                { "RequestMethod", "GetUser" },
                { "AgentID", PrincipalID.ToString() }
            };

            OSDMap result = PostData(PrincipalID, requestArgs);

            if (result == null)
                return null;

            Dictionary<string, object> dresult = Util.OSDToDictionary(result);
            IUserProfileInfo profile = new IUserProfileInfo(dresult);

            return profile;
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:18,代码来源:SimianProfileConnector.cs

示例13: UpdateUserProfile

 public bool UpdateUserProfile(IUserProfileInfo Profile)
 {
     try
     {
         List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService> ().FindValueOf (Profile.PrincipalID.ToString (), "RemoteServerURI");
         foreach (string url in serverURIs)
         {
             OSDMap map = new OSDMap ();
             map["Method"] = "updateprofile";
             map["Profile"] = Profile.ToOSD();
             WebUtils.PostToService (url + "osd", map);
         }
         return true;
     }
     catch (Exception e)
     {
         m_log.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.ToString());
     }
     return false;
 }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:20,代码来源:RemoteProfileConnector.cs

示例14: HandleLoadAvatarProfile

        protected void HandleLoadAvatarProfile(string[] cmdparams)
        {
            if (cmdparams.Length != 6)
            {
                m_log.Info("[AvatarProfileArchiver] Not enough parameters!");
                return;
            }
            StreamReader reader = new StreamReader(cmdparams[5]);
            string document = reader.ReadToEnd();
            reader.Close();
            reader.Dispose();

            string[] lines = document.Split('\n');
            List<string> file = new List<string>(lines);
            Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(file[1]);

            Dictionary<string, object> results = replyData["result"] as Dictionary<string, object>;
            UserAccount UDA = new UserAccount();
            UDA.Name = cmdparams[3] + cmdparams[4];
            UDA.PrincipalID = UUID.Random();
            UDA.ScopeID = UUID.Zero;
            UDA.UserFlags = int.Parse(results["UserFlags"].ToString());
            UDA.UserLevel = 0; //For security... Don't want everyone loading full god mode.
            UDA.UserTitle = results["UserTitle"].ToString();
            UDA.Email = results["Email"].ToString();
            UDA.Created = int.Parse(results["Created"].ToString());
            UserAccountService.StoreUserAccount(UDA);

            replyData = WebUtils.ParseXmlResponse(file[2]);
            IUserProfileInfo UPI = new IUserProfileInfo();
            UPI.FromKVP(replyData["result"] as Dictionary<string, object>);
            //Update the principle ID to the new user.
            UPI.PrincipalID = UDA.PrincipalID;

            IProfileConnector profileData = Aurora.DataManager.DataManager.RequestPlugin<IProfileConnector>();
            if (profileData.GetUserProfile(UPI.PrincipalID) == null)
                profileData.CreateNewProfile(UPI.PrincipalID);

            profileData.UpdateUserProfile(UPI);

            m_log.Info("[AvatarProfileArchiver] Loaded Avatar Profile from " + cmdparams[5]);
        }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:42,代码来源:AvatarProfileArchiver.cs

示例15: SendProfile

        private void SendProfile(IClientAPI remoteClient, IUserProfileInfo Profile, UserAccount account, uint agentOnline)
        {
            Byte[] charterMember;
            if (Profile.MembershipGroup == "")
            {
                charterMember = new Byte[1];
                charterMember[0] = (Byte) ((account.UserFlags & 0xf00) >> 8);
            }
            else
                charterMember = Utils.StringToBytes(Profile.MembershipGroup);

            uint membershipGroupINT = 0;
            if (Profile.MembershipGroup != "")
                membershipGroupINT = 4;

            uint flags = Convert.ToUInt32(Profile.AllowPublish) + Convert.ToUInt32(Profile.MaturePublish) +
                         membershipGroupINT + agentOnline + (uint) account.UserFlags;
            remoteClient.SendAvatarInterestsReply(account.PrincipalID, Convert.ToUInt32(Profile.Interests.WantToMask),
                                                  Profile.Interests.WantToText,
                                                  Convert.ToUInt32(Profile.Interests.CanDoMask),
                                                  Profile.Interests.CanDoText, Profile.Interests.Languages);
            remoteClient.SendAvatarProperties(account.PrincipalID, Profile.AboutText,
                                              Util.ToDateTime(account.Created).ToString("M/d/yyyy",
                                                                                        CultureInfo.InvariantCulture),
                                              charterMember, Profile.FirstLifeAboutText, flags,
                                              Profile.FirstLifeImage, Profile.Image, Profile.WebURL,
                                              new UUID(Profile.Partner));
        }
开发者ID:SignpostMarv,项目名称:Aurora-Sim,代码行数:28,代码来源:AvatarProfileModule.cs


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