本文整理汇总了C#中Mooege.Core.MooNet.Accounts.Account类的典型用法代码示例。如果您正苦于以下问题:C# Account类的具体用法?C# Account怎么用?C# Account使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Account类属于Mooege.Core.MooNet.Accounts命名空间,在下文中一共展示了Account类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAccount
public static Account CreateAccount(string email, string password)
{
var account = new Account(email, password);
Accounts.Add(email, account);
account.SaveToDB();
return account;
}
示例2: CreateAccount
public static Account CreateAccount(string email, string password, Account.UserLevels userLevel = Account.UserLevels.User)
{
var account = new Account(email, password, userLevel);
Accounts.Add(email, account);
account.SaveToDB();
return account;
}
示例3: AreFriends
public static bool AreFriends(Account account1, Account account2)
{
foreach (var friend in Friends[account1.BnetEntityId.Low])
{
if (friend.Id.Low == account2.BnetEntityId.Low)
return true;
}
return false;
}
示例4: InvitationExists
public static bool InvitationExists(Account inviter, Account invitee)
{
foreach (var invitation in OnGoingInvitations.Values)
{
if ((invitation.InviterIdentity.AccountId == inviter.BnetEntityId) && (invitation.InviteeIdentity.AccountId == invitee.BnetEntityId))
return true;
}
return false;
}
示例5: CreateAccount
public static Account CreateAccount(string email, string password, string battleTag, Account.UserLevels userLevel = Account.UserLevels.User)
{
var hashCode = AccountManager.GetUnusedHashCodeForBattleTag(battleTag);
var account = new Account(email, password, battleTag, hashCode, userLevel);
Accounts.Add(email, account);
account.SaveToDB();
return account;
}
示例6: SendFriends
private void SendFriends(Account account)
{
if (!_friends.ContainsKey(account.BnetAccountID)) return;
var friends = _friends[account.BnetAccountID];
foreach (var friend in friends)
{
}
}
示例7: GetAccountByEmail
public static Account GetAccountByEmail(string email)
{
Account account;
if (Accounts.ContainsKey(email))
account = Accounts[email];
else
{
account = new Account(email);
Accounts.Add(email, account);
account.SaveToDB();
}
return account;
}
示例8: LoadAccounts
private static void LoadAccounts()
{
var query = "SELECT * from accounts";
var cmd = new SQLiteCommand(query, DBManager.Connection);
var reader = cmd.ExecuteReader();
if (!reader.HasRows) return;
while (reader.Read())
{
var databaseId = (ulong)reader.GetInt64(0);
var email = reader.GetString(1);
var account = new Account(databaseId, email);
Accounts.Add(email, account);
}
}
示例9: DeleteAccount
public static bool DeleteAccount(Account account)
{
if (account == null) return false;
if (!Accounts.ContainsKey(account.Email)) return false;
try
{
var query = string.Format("DELETE from accounts where id={0}", account.PersistentID);
var cmd = new SQLiteCommand(query, DBManager.Connection);
cmd.ExecuteNonQuery();
}
catch (Exception e)
{
Logger.ErrorException(e, "DeleteAccount()");
return false;
}
Accounts.Remove(account.Email);
// we should be also disconnecting the account if he's online. /raist.
return true;
}
示例10: CreateAccount
public static Account CreateAccount(string email, string password, string battleTag, Account.UserLevels userLevel = Account.UserLevels.User)
{
if (password.Length > 16) password = password.Substring(0, 16); // make sure the password does not exceed 16 chars.
var hashCode = GetRandomHashCodeForBattleTag();
var salt = SRP6a.GetRandomBytes(32);
var passwordVerifier = SRP6a.CalculatePasswordVerifierForAccount(email, password, salt);
var newDBAccount = new DBAccount
{
Email = email,
Salt = salt,
PasswordVerifier = passwordVerifier,
BattleTagName = battleTag,
UserLevel = userLevel,
HashCode = hashCode
};
DBSessions.AccountSession.SaveOrUpdate(newDBAccount);
DBSessions.AccountSession.Flush();
return GetAccountByDBAccount(newDBAccount);
}
示例11: SetField
private void SetField(Account owner)
{
this.Owner = owner;
this.OwnerIdField.Value = owner.BnetEntityId;
var bnetGameAccountHigh = ((ulong)EntityIdHelper.HighIdType.GameAccountId) + (0x6200004433);
this.BnetEntityId = bnet.protocol.EntityId.CreateBuilder().SetHigh(bnetGameAccountHigh).SetLow(this.PersistentID).Build();
this.D3GameAccountId = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh(bnetGameAccountHigh).SetIdLow(this.PersistentID).Build();
//TODO: Now hardcode all game account notifications to D3
this.ProgramField.Value = "D3";
this.GameAccountNameField.Value = Owner.BnetEntityId.Low.ToString() + "#1";
this.BattleTagField.Value = this.Owner.BattleTag;
this.Achievements = new List<bnet.protocol.achievements.AchievementUpdateRecord>();
this.AchievementCriteria = new List<bnet.protocol.achievements.CriteriaUpdateRecord>();
}
示例12: LoadAccounts
private static void LoadAccounts()
{
var query = "SELECT * from accounts";
var cmd = new SQLiteCommand(query, DBManager.Connection);
var reader = cmd.ExecuteReader();
if (!reader.HasRows) return;
while (reader.Read())
{
var accountId = (ulong)reader.GetInt64(0);
var email = reader.GetString(1);
var salt = new byte[32];
var readBytes = reader.GetBytes(2, 0, salt, 0, 32);
var passwordVerifier = new byte[128];
readBytes = reader.GetBytes(3, 0, passwordVerifier, 0, 128);
var battleTagName = reader.GetString(4);
var hashCode = reader.GetInt32(5);
var userLevel = reader.GetByte(6);
var account = new Account(accountId, email, salt, passwordVerifier, battleTagName, hashCode, (Account.UserLevels)userLevel);
Accounts.Add(email, account);
}
}
示例13: SetFields
private void SetFields(string name, int hashCode, ToonClass @class, ToonFlags flags, byte level, Account owner,uint timePlayed)
{
this.ToonHandle = new ToonHandleHelper(this.PersistentID);
this.D3EntityID = this.ToonHandle.ToD3EntityID();
this.BnetEntityID = this.ToonHandle.ToBnetEntityID();
this.Name = name;
this.HashCode = hashCode;
this.HashCodeString = HashCode.ToString("D3");
this.Class = @class;
this.Flags = flags;
this.Level = level;
this.Owner = owner;
this.TimePlayed = timePlayed;
var visualItems = new[]
{
D3.Hero.VisualItem.CreateBuilder().SetGbid(0).SetDyeType(0).SetItemEffectType(0).SetEffectLevel(0).Build(), // Head
D3.Hero.VisualItem.CreateBuilder().SetGbid(0).SetDyeType(0).SetItemEffectType(0).SetEffectLevel(0).Build(), // Chest
D3.Hero.VisualItem.CreateBuilder().SetGbid(0).SetDyeType(0).SetItemEffectType(0).SetEffectLevel(0).Build(), // Feet
D3.Hero.VisualItem.CreateBuilder().SetGbid(0).SetDyeType(0).SetItemEffectType(0).SetEffectLevel(0).Build(), // Hands
D3.Hero.VisualItem.CreateBuilder().SetGbid(0).SetDyeType(0).SetItemEffectType(0).SetEffectLevel(0).Build(), // Weapon (1)
D3.Hero.VisualItem.CreateBuilder().SetGbid(0).SetDyeType(0).SetItemEffectType(0).SetEffectLevel(0).Build(), // Weapon (2)
D3.Hero.VisualItem.CreateBuilder().SetGbid(0).SetDyeType(0).SetItemEffectType(0).SetEffectLevel(0).Build(), // Shoulders
D3.Hero.VisualItem.CreateBuilder().SetGbid(0).SetDyeType(0).SetItemEffectType(0).SetEffectLevel(0).Build(), // Legs
};
this.Equipment = D3.Hero.VisualEquipment.CreateBuilder().AddRangeVisualItem(visualItems).Build();
}
示例14: CommandGroupAttribute
public CommandGroupAttribute(string name, string help, Account.UserLevels minUserLevel = Account.UserLevels.User)
{
this.Name = name.ToLower();
this.Help = help;
this.MinUserLevel = minUserLevel;
}
示例15: GetToonsForAccount
public static Dictionary<ulong, Toon> GetToonsForAccount(Account account)
{
return Toons.Where(pair => pair.Value.Owner != null).Where(pair => pair.Value.Owner.PersistentID == account.PersistentID).ToDictionary(pair => pair.Key, pair => pair.Value);
}