Ejemplo n.º 1
0
        public static bool Login(string name, string pass)
        {
            object obj;

            Monitor.Enter(obj = PlayerManager.sys_obj);
            bool result;

            try
            {
                if (PlayerManager.m_players.ContainsKey(name) && PlayerManager.m_players[name].Pass == pass)
                {
                    PlayerManager.PlayerData p = PlayerManager.m_players[name];
                    if (p.Pass == pass && !PlayerManager.CheckTimeOut(p.Date))
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    result = false;
                }
            }
            finally
            {
                Monitor.Exit(obj);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static void Add(string name, string pass)
        {
            object obj;

            Monitor.Enter(obj = PlayerManager.sys_obj);
            try
            {
                if (PlayerManager.m_players.ContainsKey(name))
                {
                    PlayerManager.m_players[name].Name  = name;
                    PlayerManager.m_players[name].Pass  = pass;
                    PlayerManager.m_players[name].Date  = DateTime.Now;
                    PlayerManager.m_players[name].Count = 0;
                }
                else
                {
                    PlayerManager.PlayerData data = new PlayerManager.PlayerData();
                    data.Name = name;
                    data.Pass = pass;
                    data.Date = DateTime.Now;
                    PlayerManager.m_players.Add(name, data);
                }
            }
            finally
            {
                Monitor.Exit(obj);
            }
        }