/// <summary>
        /// Enumerates over the DOOM 2 maps.
        /// </summary>
        /// <param name="wadFile">The IWAD file.</param>
        /// <returns>The list of maps.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="wadFile" /> is <see langword="null" />.
        /// </exception>
        /// <exception cref="FormatException">
        /// <paramref name="wadFile" /> has an invalid value in <see cref="IWADFile.Format" />.
        /// </exception>
        public static IEnumerable<IWADFile> EnumerateDOOM2Maps(this IWADFile wadFile)
        {
            if (wadFile == null)
            {
                throw new ArgumentNullException("wadFile");
            }

            if (wadFile.Format != WADFormat.Default)
            {
                throw new FormatException("wadFile");
            }

            using (var stream = wadFile.GetStream())
            {
                ILump mapLump = null;
                IList<ILump> lumpsOfMap = null;
                foreach (var lump in wadFile.EnumerateLumps())
                {
                    if ((lump.Name ?? string.Empty).ToUpper().Trim().StartsWith("MAP"))
                    {
                        if (lumpsOfMap != null)
                        {
                            using (var builder = new WADFileBuilder(true))
                            {
                                builder.AddRange(lumpsOfMap);

                                yield return builder.Build(mapLump.Name, WADFormat.Default);
                            }
                        }

                        mapLump = lump;
                        lumpsOfMap = new List<ILump>();

                        continue;
                    }

                    if (mapLump == null)
                    {
                        continue;
                    }

                    lumpsOfMap.Add(lump);
                }
            }
        }
        /// <summary>
        /// Enumerates over the DOOM 2 maps.
        /// </summary>
        /// <param name="wadFile">The IWAD file.</param>
        /// <returns>The list of maps.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="wadFile" /> is <see langword="null" />.
        /// </exception>
        /// <exception cref="FormatException">
        /// <paramref name="wadFile" /> has an invalid value in <see cref="IWADFile.Format" />.
        /// </exception>
        public static IEnumerable <IWADFile> EnumerateDOOM2Maps(this IWADFile wadFile)
        {
            if (wadFile == null)
            {
                throw new ArgumentNullException("wadFile");
            }

            if (wadFile.Format != WADFormat.Default)
            {
                throw new FormatException("wadFile");
            }

            using (var stream = wadFile.GetStream())
            {
                ILump         mapLump    = null;
                IList <ILump> lumpsOfMap = null;
                foreach (var lump in wadFile.EnumerateLumps())
                {
                    if ((lump.Name ?? string.Empty).ToUpper().Trim().StartsWith("MAP"))
                    {
                        if (lumpsOfMap != null)
                        {
                            using (var builder = new WADFileBuilder(true))
                            {
                                builder.AddRange(lumpsOfMap);

                                yield return(builder.Build(mapLump.Name, WADFormat.Default));
                            }
                        }

                        mapLump    = lump;
                        lumpsOfMap = new List <ILump>();

                        continue;
                    }

                    if (mapLump == null)
                    {
                        continue;
                    }

                    lumpsOfMap.Add(lump);
                }
            }
        }