本文整理汇总了C#中UserProfileData类的典型用法代码示例。如果您正苦于以下问题:C# UserProfileData类的具体用法?C# UserProfileData怎么用?C# UserProfileData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserProfileData类属于命名空间,在下文中一共展示了UserProfileData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Register
public static bool Register(UserProfile userInfo, out string errorMsg)
{
errorMsg = "";
UserProfile regInfo = new UserProfile()
{
UserName = userInfo.UserName,
Password = SecurityHelper.Encrypt(userInfo.Password),
RoleId=1//权限角色
};
int registerState;
UserProfileData userPorfile=new UserProfileData();
var userList=userPorfile.select(0," username ","username='"+regInfo.UserName+"'",null);
bool isNewName = true ;
if (userList.Count > 0)
{
isNewName = false;
errorMsg = "该用户名已注册";
return isNewName;
}
try
{
registerState = userPorfile.insert(regInfo);
if (registerState > 0)
{
return true;
}
else return false;
}
catch (Exception ex)
{
errorMsg = "注册出错" + ex.ToString();
return false;
}
}
示例2: AddTemporaryUserProfile
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
//m_log.DebugFormat("[TEMP USER PROFILE]: Adding {0} {1}", userProfile.Name, userProfile.ID);
lock (m_profiles)
{
m_profiles[userProfile.ID] = userProfile;
}
}
示例3: AddTemporaryUserProfile
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
DumpStatus("AddTemporaryUserProfile(entry)");
AddToProfileCache(userProfile);
foreach (IUserDataPlugin plugin in m_plugins)
{
plugin.AddTemporaryUserProfile(userProfile);
}
DumpStatus("AddTemporaryUserProfile(exit)");
}
示例4: AddToCaches
/// <summary>
/// Update an existing profile
/// </summary>
/// <param name="userProfile"></param>
/// <returns>true if a user profile was found to update, false otherwise</returns>
// Commented out for now. The implementation needs to be improved by protecting against race conditions,
// probably by making sure that the update doesn't use the UserCacheInfo.UserProfile directly (possibly via
// returning a read only class from the cache).
// public bool StoreProfile(UserProfileData userProfile)
// {
// lock (m_userProfilesById)
// {
// CachedUserInfo userInfo = GetUserDetails(userProfile.ID);
//
// if (userInfo != null)
// {
// userInfo.m_userProfile = userProfile;
// m_commsManager.UserService.UpdateUserProfile(userProfile);
//
// return true;
// }
// }
//
// return false;
// }
/// <summary>
/// Populate caches with the given user profile
/// </summary>
/// <param name="userProfile"></param>
protected CachedUserInfo AddToCaches(UserProfileData userProfile)
{
CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile);
lock (m_userProfilesById)
{
m_userProfilesById[createdUserInfo.UserProfile.ID] = createdUserInfo;
lock (m_userProfilesByName)
{
m_userProfilesByName[createdUserInfo.UserProfile.Name] = createdUserInfo;
}
}
return createdUserInfo;
}
示例5: UpdateUserProfile
public bool UpdateUserProfile(UserProfileData user) { return false; }
示例6: AddUser
/// <summary>
/// Add a new user
/// </summary>
/// <param name="firstName">first name</param>
/// <param name="lastName">last name</param>
/// <param name="password">password</param>
/// <param name="email">email</param>
/// <param name="regX">location X</param>
/// <param name="regY">location Y</param>
/// <param name="uuid">UUID of avatar.</param>
/// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
public virtual UUID AddUser(
string firstName, string lastName, string password, string email, uint regX, uint regY, UUID uuid)
{
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
UserProfileData userProf = GetUserProfile(firstName, lastName);
if (userProf != null)
{
m_log.Error("[USERSTORAGE]: Not creating user. User already exists ");
return UUID.Zero;
}
UserProfileData user = new UserProfileData();
user.HomeLocation = new Vector3(128, 128, 100);
user.ID = uuid;
user.FirstName = firstName;
user.SurName = lastName;
user.PasswordHash = md5PasswdHash;
user.PasswordSalt = String.Empty;
user.Created = Util.UnixTimeSinceEpoch();
user.HomeLookAt = new Vector3(100, 100, 100);
user.HomeRegionX = regX;
user.HomeRegionY = regY;
user.Email = email;
m_storage.AddUser(user);
userProf = GetUserProfile(uuid);
if (userProf == null)
{
return UUID.Zero;
}
else
{
CreateInventorySkel(userProf);
return userProf.ID;
}
}
示例7: CreateAgent
public void CreateAgent(UserProfileData profile, OSD request)
{
//m_log.DebugFormat("[USER CACHE]: Creating agent {0} {1}", profile.Name, profile.ID);
UserAgentData agent = new UserAgentData();
// User connection
agent.AgentOnline = true;
//if (request.Params.Count > 1)
//{
// IPEndPoint RemoteIPEndPoint = (IPEndPoint)request.Params[1];
// agent.AgentIP = RemoteIPEndPoint.Address.ToString();
// agent.AgentPort = (uint)RemoteIPEndPoint.Port;
//}
// Generate sessions
RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
byte[] randDataS = new byte[16];
byte[] randDataSS = new byte[16];
rand.GetBytes(randDataS);
rand.GetBytes(randDataSS);
agent.SecureSessionID = new UUID(randDataSS, 0);
agent.SessionID = new UUID(randDataS, 0);
// Profile UUID
agent.ProfileID = profile.ID;
// Current location/position/alignment
if (profile.CurrentAgent != null)
{
agent.Region = profile.CurrentAgent.Region;
agent.Handle = profile.CurrentAgent.Handle;
agent.Position = profile.CurrentAgent.Position;
agent.LookAt = profile.CurrentAgent.LookAt;
}
else
{
agent.Region = profile.HomeRegionID;
agent.Handle = profile.HomeRegion;
agent.Position = profile.HomeLocation;
agent.LookAt = profile.HomeLookAt;
}
// What time did the user login?
agent.LoginTime = Util.UnixTimeSinceEpoch();
agent.LogoutTime = 0;
profile.CurrentAgent = agent;
}
示例8: UpdateUserProfile
public virtual bool UpdateUserProfile(UserProfileData profile)
{
ReplaceUserData(profile);
return m_storage.UpdateUserProfileData(profile);
}
示例9: CommitAgent
/// <summary>
/// Saves a target agent to the database
/// </summary>
/// <param name="profile">The users profile</param>
/// <returns>Successful?</returns>
public bool CommitAgent(ref UserProfileData profile)
{
//m_log.DebugFormat("[USER MANAGER]: Committing agent {0} {1}", profile.Name, profile.ID);
// TODO: how is this function different from setUserProfile? -> Add AddUserAgent() here and commit both tables "users" and "agents"
// TODO: what is the logic should be?
bool ret = false;
ret = AddUserAgent(profile.CurrentAgent);
ret = ret & UpdateUserProfile(profile);
return ret;
}
示例10: UpdateUserProfile
public virtual bool UpdateUserProfile(UserProfileData data)
{
bool result = false;
foreach (IUserDataPlugin plugin in m_plugins)
{
try
{
plugin.UpdateUserProfile(data);
result = true;
}
catch (Exception e)
{
m_log.ErrorFormat(
"[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}",
data.FirstName, data.SurName, plugin.Name, e.ToString());
}
}
return result;
}
示例11: UpdateUserProfileData
public virtual bool UpdateUserProfileData(UserProfileData profile)
{
m_log.DebugFormat("[USERSTORAGE]: UpdateUserProfileData plugin request for {0} {1}", profile.ID, profile.Name);
bool result = false;
foreach (IUserDataPlugin plugin in m_plugins)
{
try
{
plugin.UpdateUserProfile(profile);
result = true;
}
catch (Exception e)
{
m_log.ErrorFormat(
"[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}",
profile.FirstName, profile.SurName, plugin.Name, e.ToString());
}
}
return result;
}
示例12: AddUser
public void AddUser(UserProfileData profile)
{
m_log.DebugFormat("[USERSTORAGE]: AddUser plugin request for {0} {1}", profile.ID, profile.Name);
foreach (IUserDataPlugin plugin in m_plugins)
{
try
{
plugin.AddNewUserProfile(profile);
}
catch (Exception e)
{
m_log.Error("[USERSTORAGE]: Unable to add user via " + plugin.Name + "(" + e.ToString() + ")");
}
}
}
示例13: AddUser
/// <summary>
/// Add a new user
/// </summary>
/// <param name="firstName">first name</param>
/// <param name="lastName">last name</param>
/// <param name="password">password</param>
/// <param name="email">email</param>
/// <param name="regX">location X</param>
/// <param name="regY">location Y</param>
/// <param name="SetUUID">UUID of avatar.</param>
/// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
public virtual UUID AddUser(
string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID)
{
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
UserProfileData userProf = GetUserProfile(firstName, lastName);
if (userProf != null)
{
m_log.Error("[USERSTORAGE]: Not creating user. User already exists ");
return UUID.Zero;
}
UserProfileData user = new UserProfileData();
user.HomeLocation = new Vector3(128, 128, 100);
user.ID = SetUUID;
user.FirstName = firstName;
user.SurName = lastName;
user.PasswordHash = md5PasswdHash;
user.PasswordSalt = String.Empty;
user.Created = Util.UnixTimeSinceEpoch();
user.HomeLookAt = new Vector3(100, 100, 100);
user.HomeRegionX = regX;
user.HomeRegionY = regY;
user.Email = email;
foreach (IUserDataPlugin plugin in m_plugins)
{
try
{
plugin.AddNewUserProfile(user);
}
catch (Exception e)
{
m_log.Error("[USERSTORAGE]: Unable to add user via " + plugin.Name + "(" + e.ToString() + ")");
}
}
userProf = GetUserProfile(firstName, lastName);
if (userProf == null)
{
return UUID.Zero;
}
else
{
CreateInventorySkel(userProf);
return userProf.ID;
}
}
示例14: UpdateUserProfile
public virtual bool UpdateUserProfile(UserProfileData profile)
{
bool result = false;
lock (_userProfilesLock)
{
_cachedProfileData.Remove(profile.ID);
}
foreach (IUserDataPlugin plugin in m_plugins)
{
try
{
plugin.UpdateUserProfile(profile);
result = true;
}
catch (Exception e)
{
m_log.ErrorFormat(
"[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}",
profile.FirstName, profile.SurName, plugin.Name, e.ToString());
}
}
return result;
}
示例15: NewCachedUserInfo
/// <summary>
/// Upgrade a UserProfileData to a CachedUserInfo.
/// </summary>
/// <param name="userProfile"></param>
/// <param name="friends">friends can be null when called from the User grid server itself.</param>
/// <returns></returns>
protected CachedUserInfo NewCachedUserInfo(UserProfileData userProfile, List<FriendListItem> friends)
{
// if ((friends == null) && (m_commsManager.UserService != null))
// friends = m_commsManager.UserService.GetUserFriendList(userProfile.ID);
return new CachedUserInfo(m_commsManager, userProfile, friends);
}