public void TestCldDemoParserFile()
        {
            string file = "zandemo.cld";

            File.Copy(Path.Combine("Resources", file), file, true);

            IDemoParser parser = DemoUtil.GetDemoParser(file);

            Assert.IsNotNull(parser);

            string[] files = parser.GetRequiredFiles();
            Assert.AreEqual("doom2.wad", files[0]);
            Assert.AreEqual("pyrrhic_.wad", files[1]);
        }
Ejemplo n.º 2
0
        private void HandleDemoChange()
        {
            if (chkDemo.Checked && cmbDemo.SelectedItem != null)
            {
                var file   = cmbDemo.SelectedItem as IFileData;
                var parser = DemoUtil.GetDemoParser(Path.Combine(m_appConfig.DemoDirectory.GetFullPath(), file.FileName));

                if (parser != null)
                {
                    m_handler.Reset();
                    SetAdditionalFiles(true);

                    string[]         requiredFiles = parser.GetRequiredFiles();
                    List <string>    unavailable   = new List <string>();
                    List <IGameFile> iwads         = new List <IGameFile>();
                    List <IGameFile> gameFiles     = GetGameFiles(requiredFiles, unavailable, iwads);
                    ctrlFiles.SetDataSource(gameFiles);
                    if (iwads.Count > 0)
                    {
                        SelectedIWad = iwads.First();
                    }

                    if (unavailable.Count > 0)
                    {
                        TextBoxForm form = new TextBoxForm(true, MessageBoxButtons.OK)
                        {
                            StartPosition = FormStartPosition.CenterParent,
                            Text          = "Not Found",
                            HeaderText    = "The following required files were not found:",
                            DisplayText   = string.Join(Environment.NewLine, unavailable.ToArray())
                        };
                        form.ShowDialog(this);
                    }

                    m_demoChangedAdditionalFiles = true;
                    ResetSpecificFilesSelections(ctrlFiles.GetFiles().Cast <IGameFile>().ToArray()); //don't use the handler in this case, we are overriding it
                }
            }
            else
            {
                m_demoChangedAdditionalFiles = false;
            }
        }