public static bool AddUserToRoomLubbyBy(string username, string password, int idroom, ref IZone IZone, AbstractServer.StateObject Connction, out IUser user) { var room = IZone.Rooms.Find(x => x.Id == idroom); if (room == null) { object[] paramArray = { "RoomLubby", -1, 400, DateTime.Now, new DateTime(DateTime.Now.AddHours(12f).Ticks), IZone, new ServerGame.Core.Permissions.PermissionsRoom() }; room = (Interface.Room.IRoom)Activator.CreateInstance(GetTypeRoomBy(idroom), paramArray); IZone.Rooms.Add(room); } var IdIntTempUDP = -1; if (Connction.IPEndPointUDP != null) { IdIntTempUDP = IdInttempUDP(Connction.IPEndPointUDP); } try { user = UserMaster.ReturnUserBy(username); } catch (Core.GException.UserNotFind) { user = UserMaster.AddNewUser(username, -1, Connction, ref room, IdIntTempUDP); } catch (Exception e) { Console.WriteLine(e.ToString()); user = null; } if (user == null) { return(false); } if (null == room.UserInRoom.Find(x => x.Name == username)) { room.AddNewUser(user); } return(true); }