當前位置: 首頁>>代碼示例>>C#>>正文


C# Accounts.Account類代碼示例

本文整理匯總了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;
        }
開發者ID:rosebud,項目名稱:mooege,代碼行數:8,代碼來源:AccountManager.cs

示例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;
        }
開發者ID:wow4all,項目名稱:mooege,代碼行數:8,代碼來源:AccountManager.cs

示例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;
 }
開發者ID:God601,項目名稱:mooege,代碼行數:9,代碼來源:FriendManager.cs

示例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;
 }
開發者ID:God601,項目名稱:mooege,代碼行數:9,代碼來源:FriendManager.cs

示例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;
        }
開發者ID:God601,項目名稱:mooege,代碼行數:9,代碼來源:AccountManager.cs

示例6: SendFriends

        private void SendFriends(Account account)
        {
            if (!_friends.ContainsKey(account.BnetAccountID)) return;
            var friends = _friends[account.BnetAccountID];

            foreach (var friend in friends)
            {

            }
        }
開發者ID:sexywop,項目名稱:mooege,代碼行數:10,代碼來源:FriendManager.cs

示例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;
        }
開發者ID:Rianon,項目名稱:mooege,代碼行數:15,代碼來源:AccountManager.cs

示例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);
            }
        }
開發者ID:Rianon,項目名稱:mooege,代碼行數:16,代碼來源:AccountManager.cs

示例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;
        }
開發者ID:God601,項目名稱:mooege,代碼行數:22,代碼來源:AccountManager.cs

示例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);
        }
開發者ID:loonbg,項目名稱:mooege,代碼行數:24,代碼來源:AccountManager.cs

示例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>();

        }
開發者ID:God601,項目名稱:mooege,代碼行數:17,代碼來源:GameAccount.cs

示例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);
            }
        }
開發者ID:avatar21,項目名稱:mooege,代碼行數:29,代碼來源:AccountManager.cs

示例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();

        }
開發者ID:keltins,項目名稱:mooege,代碼行數:29,代碼來源:Toon.cs

示例14: CommandGroupAttribute

 public CommandGroupAttribute(string name, string help, Account.UserLevels minUserLevel = Account.UserLevels.User)
 {
     this.Name = name.ToLower();
     this.Help = help;
     this.MinUserLevel = minUserLevel;
 }
開發者ID:wow4all,項目名稱:mooege,代碼行數:6,代碼來源:CommandAttribute.cs

示例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);
 }
開發者ID:wow4all,項目名稱:mooege,代碼行數:4,代碼來源:ToonManager.cs


注:本文中的Mooege.Core.MooNet.Accounts.Account類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。