Exemplo n.º 1
0
        public void TestHandlerIWad()
        {
            IDataSourceAdapter adapter = TestUtil.CreateAdapter();
            FileLoadHandler    handler = new FileLoadHandler(adapter, adapter.GetGameFile("COOLGAMEFILE.WAD"));

            Assert.AreEqual(3, handler.GetCurrentAdditionalFiles().Count);

            var iwad       = adapter.GetGameFileIWads().First(x => x.FileName == "PLUTONIA.WAD");
            var sourceport = adapter.GetSourcePorts().First(x => x.Name == "odamex.exe"); //no additional files for port

            handler.CalculateAdditionalFiles(iwad, sourceport);
            var gameFiles = handler.GetCurrentAdditionalFiles();

            Assert.AreEqual(4, gameFiles.Count);
            Assert.IsNotNull(gameFiles.FirstOrDefault(x => x.FileName == "IWADMOD1.WAD"));

            //no change
            handler.CalculateAdditionalFiles(iwad, sourceport);
            gameFiles = handler.GetCurrentAdditionalFiles();

            Assert.IsNotNull(gameFiles.FirstOrDefault(x => x.FileName == "IWADMOD1.WAD"));

            Assert.IsTrue(handler.IsIWadFile(gameFiles.First(x => x.FileName == "IWADMOD1.WAD")));
            Assert.IsFalse(handler.IsSourcePortFile(gameFiles.First(x => x.FileName == "IWADMOD1.WAD")));
        }
Exemplo n.º 2
0
        private void ctrlFiles_CellFormatting(object sender, AdditionalFilesEventArgs e)
        {
            IGameFile   gameFile = e.Item as IGameFile;
            IGameFile   iwad     = SelectedIWad;
            ISourcePort port     = cmbSourcePorts.SelectedValue as ISourcePort;

            if (m_handler.IsIWadFile(gameFile))
            {
                e.DisplayText = string.Format("{0} ({1})", gameFile.FileName, Util.RemoveExtension(iwad.FileName));
            }
            if (m_handler.IsSourcePortFile(gameFile))
            {
                e.DisplayText = string.Format("{0} ({1})", gameFile.FileName, port.Name);
            }
        }
Exemplo n.º 3
0
        private void ctrlFiles_CellFormatting(object sender, AdditionalFilesEventArgs e)
        {
            IGameFile       gameFile = e.Item as IGameFile;
            IGameFile       iwad     = SelectedIWad;
            ISourcePortData port     = SelectedSourcePort;

            if (iwad != null && m_handler.IsIWadFile(gameFile))
            {
                e.DisplayText = string.Format("{0} ({1})", gameFile.FileName, Path.GetFileNameWithoutExtension(iwad.FileName));
            }
            if (port != null && m_handler.IsSourcePortFile(gameFile))
            {
                e.DisplayText = string.Format("{0} ({1})", gameFile.FileName, port.Name);
            }
        }
Exemplo n.º 4
0
        public void TestHandlerMixed()
        {
            IDataSourceAdapter adapter = TestUtil.CreateAdapter();
            FileLoadHandler    handler = new FileLoadHandler(adapter, adapter.GetGameFile("COOLGAMEFILE.WAD"));

            Assert.AreEqual(3, handler.GetCurrentAdditionalFiles().Count);

            var iwad       = adapter.GetGameFileIWads().First(x => x.FileName == "PLUTONIA.WAD");
            var sourceport = adapter.GetSourcePorts().First(x => x.Name == "zdoom.exe");

            handler.CalculateAdditionalFiles(iwad, sourceport);
            var gameFiles = handler.GetCurrentAdditionalFiles();

            Assert.AreEqual(5, gameFiles.Count);
            Assert.IsNotNull(gameFiles.First(x => x.FileName == "IWADMOD1.WAD"));
            Assert.IsNotNull(gameFiles.First(x => x.FileName == "PORTMOD1.WAD"));

            Assert.IsTrue(handler.IsIWadFile(gameFiles.First(x => x.FileName == "IWADMOD1.WAD")));
            Assert.IsTrue(handler.IsSourcePortFile(gameFiles.First(x => x.FileName == "PORTMOD1.WAD")));
        }