public void ShouldReadCreatedWadFile()
        {
            var fileInfo = new FileInfo(Path.GetTempFileName());

            try
            {
                var map = DemoMap.Create();

                var wadWriter = new WadWriter();
                wadWriter.Append("MAP01", map);
                wadWriter.SaveTo(fileInfo.FullName);

                using (var wadReader = WadReader.Read(fileInfo.FullName))
                {
                    Assert.That(wadReader.Directory.Length, Is.EqualTo(3), "Did not return correct count.");
                    Assert.That(
                        wadReader.Directory.Select(l => l.Name).ToArray(),
                        Is.EquivalentTo(new[]
                                        { new LumpName("MAP01"), new LumpName("TEXTMAP"), new LumpName("ENDMAP"), }),
                        "Did not return correct lump names.");

                    var roundTripped = MapData.LoadFrom(wadReader.GetTextmapStream("MAP01"));

                    Assert.That(roundTripped, Is.DeepEqualTo(map));
                }
            }
            finally
            {
                if (fileInfo.Exists)
                {
                    fileInfo.Delete();
                }
            }
        }
        public void ShouldCreateWadFile()
        {
            var fileInfo = new FileInfo(Path.GetTempFileName());

            try
            {
                var wad = new WadWriter();
                wad.Append("MAP01", DemoMap.Create());
                wad.SaveTo(fileInfo.FullName);
            }
            finally
            {
                if (fileInfo.Exists)
                {
                    fileInfo.Delete();
                }
            }
        }
Esempio n. 3
0
        private static void LoadMaps(params MapData[] maps)
        {
            string wadFilePath = "demo.wad";

            var enginePath = GetEngineExePath();

            var wadWriter = new WadWriter();

            foreach (var(map, index) in maps.Select((map, index) => (map, index)))
            {
                wadWriter.Append($"E3M{index + 1}", map);
            }

            wadWriter.SaveTo(wadFilePath);

            Process.Start(
                enginePath,
                $"-file {wadFilePath} -skill 4 -iwad doom.wad -warp 3 1");
        }