/// <summary> /// Récupère les infos contenues dans le nom du fichier /// </summary> private void FindMetaFromFileName() { string[] splittedName = CleanedName.Split('-'); // Si la recherche ne contient pas de tiret if (splittedName.Count() < 2) { // On considère que l'on a que le titre de la musique MetaFromFileName.ArtistName = ""; MetaFromFileName.Title = splittedName[0]; } else { MetaFromFileName.ArtistName = splittedName[0]; MetaFromFileName.Title = splittedName[1]; } }
/// <summary> /// Handles any client related logic on connection /// </summary> public bool IsAbleToConnectSimple() { var loc = Utilities.CurrentLocalization.LocalizationIndex; if (string.IsNullOrWhiteSpace(Name) || CleanedName.Replace(" ", "").Length < 3) { CurrentServer.Logger.WriteDebug($"Kicking {this} because their name is too short"); Kick(loc["SERVER_KICK_MINNAME"], Utilities.IW4MAdminClient(CurrentServer)); return(false); } if (CurrentServer.Manager.GetApplicationSettings().Configuration() .DisallowedClientNames ?.Any(_name => Regex.IsMatch(Name, _name)) ?? false) { CurrentServer.Logger.WriteDebug($"Kicking {this} because their name is not allowed"); Kick(loc["SERVER_KICK_GENERICNAME"], Utilities.IW4MAdminClient(CurrentServer)); return(false); } if (Name.Where(c => char.IsControl(c)).Count() > 0) { CurrentServer.Logger.WriteDebug($"Kicking {this} because their name contains control characters"); Kick(loc["SERVER_KICK_CONTROLCHARS"], Utilities.IW4MAdminClient(CurrentServer)); return(false); } // reserved slots stuff // todo: bots don't seem to honor party_maxplayers/sv_maxclients if (CurrentServer.MaxClients - (CurrentServer.GetClientsAsList().Count(_client => !_client.IsPrivileged() && !_client.IsBot)) < CurrentServer.ServerConfig.ReservedSlotNumber && !this.IsPrivileged() && CurrentServer.GetClientsAsList().Count <= CurrentServer.MaxClients && CurrentServer.MaxClients != 0) { CurrentServer.Logger.WriteDebug($"Kicking {this} their spot is reserved"); Kick(loc["SERVER_KICK_SLOT_IS_RESERVED"], Utilities.IW4MAdminClient(CurrentServer)); return(false); } return(true); }