SharpMod.Server.IsMapValid C# (CSharp) Method

IsMapValid() public static method

Uses the engine function to check if a map is valid.
public static IsMapValid ( string map ) : bool
map string /// Name of the map ///
return bool
        public static bool IsMapValid(string map)
        {
            return (MetaModEngine.engineFunctions.IsMapValid(map) == 1);
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Returns a list of all valid maps in the directory.
        /// </summary>
        /// <returns>
        /// String array of all map names <see cref="System.String[]"/>
        /// </returns>
        public static string[] LoadMapListFromDirectory()
        {
            List <string> list  = new List <string>();
            var           files = new DirectoryInfo(Path.Combine(Server.GameDirectory, "maps")).GetFiles("*.bsp");

            foreach (FileInfo fi in files)
            {
                string map = fi.Name.Substring(0, fi.Name.Length - 4);
                if (Server.IsMapValid(map))
                {
                    list.Add(map);
                }
            }
            return(list.ToArray());
        }
All Usage Examples Of SharpMod.Server::IsMapValid