Valhalla Legends Forums Archive | .NET Platform | [C#] User Management

AuthorMessageTime
Smarter
I got bored and created a user management system if anyone would like to use it:

UserList.cs Code:
[code]
    public class Userlist
    {
        private Dictionary<string, User> userList = new Dictionary<string, User>();

        public Userlist()
        {

        }

        public void addUser(string Username, string Client, int Ping, int Flags, string Statstring)
        {
            userList.Add(Username, new User(Username, Client, Ping, Flags, Statstring));
        }
        public User getUser(string userName)
        {
            return userList[userName];
        }
    }

    public class User
    {
        private string m_username, m_client, m_statstring;
        private int m_ping, m_flags;

        public User(string Username, string Client, int Ping, int Flags, string Statstring)
        {
            m_username = Username;
            m_client = Client;
            m_ping = Ping;
            m_flags = Flags;
            m_statstring = Statstring;
        }

        public string Username { get { return m_username; } }
        public string Client { get { return m_client; } }
        public int Ping { get { return m_ping; } }
        public int Flags { get { return m_flags; } }
        public string Statstring { get { return m_statstring; } }
    }[/code]

Usage Code:
[code]
            Userlist userlist = new Userlist();
            userlist.addUser("Smarter", "SEXP", 0, 0, "123");
            User u = userlist.getUser("Smarter");
            MessageBox.Show("Username: " + u.Username + "\n" +
                "Client: " + u.Client + "\n" + "Ping: " + u.Ping + "\n" + "Flags: " + u.Flags +
                "\n" + "Statstring: " + u.Statstring + "\n");[/code]

Enjoy, and feel free to post comments.
December 5, 2007, 2:33 PM

Search