/// <summary> /// Main method. /// </summary> /// <param name="args">Array of command-line parameters</param> private static void Main(string[] args) { if (args.Length == 0) { return; } using (WadFile wad = new WadFile()) { foreach (string file in args) { if (!File.Exists(file)) { continue; } string lumpName = Regex.Replace( Path.GetFileNameWithoutExtension(file).ToUpperInvariant(), @"[^\u0000-\u007F]+", string.Empty); // Remove non-ASCII characters wad.AddLump(lumpName, File.ReadAllBytes(file)); } wad.SaveToFile("PackedFiles.wad"); } }
/// <summary> /// Adds the map lumps to a Doom wad file. /// </summary> /// <param name="wad">The wad file to which the map should be added</param> public void AddToWad(WadFile wad) { wad.AddLump(Name, new byte[0]); wad.AddLump("LINEDEFS", Linedefs.SelectMany(x => x.ToBytes()).ToArray()); wad.AddLump("SECTORS", Sectors.SelectMany(x => x.ToBytes()).ToArray()); wad.AddLump("SIDEDEFS", Sidedefs.SelectMany(x => x.ToBytes()).ToArray()); wad.AddLump("THINGS", Things.SelectMany(x => x.ToBytes()).ToArray()); wad.AddLump("VERTEXES", Vertices.SelectMany(x => x.ToBytes()).ToArray()); }