コード例 #1
0
 public Room(string name, string password = "")
 {
     Name     = name;
     Password = password;
     Guid     = GuidGenerator.GenerateNew();
     Users    = new List <User>();
 }
コード例 #2
0
 public Account(string name, string password, Room room, ACCOUNT_LEVEL level, bool enabled)
 {
     Name = name;
     CryptPassword(password);
     Guid         = GuidGenerator.GenerateNew();
     AccountLevel = level;
     IsKicked     = false;
     IsBanned     = !enabled;
     Room         = room;
 }
コード例 #3
0
        public Session(Socket socket, ServerHandler manager)
        {
            _socket     = socket;
            _manager    = manager;
            _sendQueue  = new SendQueue();
            Buffer      = new CircularBuffer();
            _recvBuffer = _bufferPool.GetSegment();
            Guid        = GuidGenerator.GenerateNew();

            _lastUpdate = DateTime.Now.AddMinutes(1);
        }
コード例 #4
0
 public Room(XmlElement node)
 {
     Name     = Utility.GetText(node["name"], null);
     Password = Utility.GetText(node["password"], string.Empty);
     if (!Guid.TryParse(Utility.GetText(node["guid"], string.Empty), out var guid))
     {
         guid = GuidGenerator.GenerateNew();
     }
     Guid  = guid;
     Users = new List <User>();
 }
コード例 #5
0
        public Account(XmlElement node)
        {
            Name            = Utility.GetText(node["username"], string.Empty);
            CryptedPassword = Utility.GetText(node["password"], string.Empty);

            if (!Guid.TryParse(Utility.GetText(node["guid"], string.Empty), out var guid))
            {
                guid = GuidGenerator.GenerateNew();
            }
            Guid = guid;

            Room = RoomManager.Get(Utility.GetText(node["room"], string.Empty));

            switch (Utility.GetText(node["type"], string.Empty))
            {
            default:
            case "Normal":
                AccountLevel = ACCOUNT_LEVEL.NORMAL;
                break;

            case "RoomAdmin":
                AccountLevel = ACCOUNT_LEVEL.ROOM_ADMIN;
                break;

            case "ServerAdmin":
                AccountLevel = ACCOUNT_LEVEL.SERVER_ADMIN;
                break;
            }

            IsBanned = !Convert.ToBoolean(Utility.GetText(node["enabled"], "false"));
            IsKicked = Convert.ToBoolean(Utility.GetText(node["kicked"], "false"));

            if (!DateTime.TryParseExact(Utility.GetText(node["kicktime"], null), "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out var kicktime))
            {
                kicktime = DateTime.MinValue;
            }
            KickTime = kicktime;
        }