private void btnNew_Click(object sender, EventArgs e)
        {
            SourcePortEditForm editForm = new SourcePortEditForm(m_adapter, m_tabViews, m_launchType);

            IEnumerable <string> extensions = new string[] { ".wad" };

            if (m_launchType == SourcePortLaunchType.SourcePort)
            {
                extensions = extensions.Union(Util.GetDehackedExtensions().Union(Util.GetSourcePortPkExtensions()));
            }
            else
            {
                extensions = extensions.Union(Util.GetSourcePortPkExtensions());
            }

            editForm.SetSupportedExtensions(string.Join(",", extensions));

            editForm.StartPosition = FormStartPosition.CenterParent;

            if (editForm.ShowDialog(this) == DialogResult.OK)
            {
                SourcePortData sourcePort = new SourcePortData();
                editForm.UpdateDataSource(sourcePort);
                sourcePort.LaunchType = m_launchType;
                m_adapter.InsertSourcePort(sourcePort);
                ResetData();

                SelectSourcePort(sourcePort);
            }
        }
Beispiel #2
0
        public static List <ISourcePortData> GetSourcePortsData(IDataSourceAdapter adapter)
        {
            List <ISourcePortData> sourcePorts = adapter.GetSourcePorts().ToList();
            SourcePortData         noPort      = new SourcePortData();

            noPort.Name         = "N/A";
            noPort.SourcePortID = -1;
            sourcePorts.Insert(0, noPort);
            return(sourcePorts);
        }
Beispiel #3
0
        private static void CreateSourcePort(IDataSourceAdapter adapter, string name, string addfiles)
        {
            SourcePortData sourcePort = new SourcePortData
            {
                Executable          = name,
                Name                = name,
                Directory           = new LauncherPath("SourcePorts"),
                SupportedExtensions = ".wad",
                FileOption          = "-file",
                SettingsFiles       = addfiles
            };

            adapter.InsertSourcePort(sourcePort);
        }
Beispiel #4
0
        public void SetData(IDataSourceAdapter adapter, IGameFile gameFile)
        {
            m_adapter = adapter;

            cmbEngine.ValueMember   = "SourcePortID";
            cmbEngine.DisplayMember = "Name";
            List <ISourcePortData> sourcePorts = adapter.GetSourcePorts().ToList();
            SourcePortData         noPort      = new SourcePortData();

            noPort.SourcePortID = 0;
            noPort.Name         = "N/A";
            sourcePorts.Insert(0, noPort);
            cmbEngine.DataSource = sourcePorts;

            cmbGame.ValueMember   = "IWadID";
            cmbGame.DisplayMember = "Name";
            cmbGame.DataSource    = GetIwads(adapter);
            cmbGame.SelectedIndex = 0;

            if (gameFile != null)
            {
                if (gameFile.SourcePortID.HasValue)
                {
                    cmbEngine.SelectedValue = gameFile.SourcePortID.Value;
                }
                txtTile.Text     = gameFile.Title;
                txtFilename.Text = gameFile.FileName;
                if (gameFile.ReleaseDate.HasValue)
                {
                    dtRelease.Value = gameFile.ReleaseDate.Value;
                }
                txtAuthor.Text      = gameFile.Author;
                txtDescription.Text = gameFile.Description;
                if (gameFile.MapCount.HasValue)
                {
                    numLevels.Value = gameFile.MapCount.Value;
                }
                if (gameFile.Map != null)
                {
                    txtMaps.Text = GetMapString(gameFile.Map);
                }
                if (gameFile.IWadID.HasValue)
                {
                    cmbGame.SelectedValue = gameFile.IWadID.Value;
                }
            }
        }
Beispiel #5
0
        private void lnkSpecific_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            SpecificFilesForm form = new SpecificFilesForm();

            form.StartPosition = FormStartPosition.CenterParent;

            List <IGameFile> gameFiles = new List <IGameFile>();

            gameFiles.AddRange(GetAdditionalFiles());

            form.Initialize(m_appConfig.GameFileDirectory, gameFiles, SourcePortData.GetSupportedExtensions(SelectedSourcePort), SpecificFiles);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                SpecificFiles = form.GetSpecificFiles();
            }
        }
        private static ISourcePortData CreateSourcePortDataSource(DataTable dt, DataRow dr)
        {
            SourcePortData sourcePort = new SourcePortData();

            sourcePort.Directory  = new LauncherPath((string)dr["Directory"]);
            sourcePort.Executable = (string)dr["Executable"];
            sourcePort.Name       = (string)dr["Name"];
            if (dt.Columns.Contains("SettingsFiles"))
            {
                sourcePort.SettingsFiles = (string)CheckDBNull(dr["SettingsFiles"], string.Empty);
            }
            sourcePort.SourcePortID        = Convert.ToInt32(dr["SourcePortID"]);
            sourcePort.SupportedExtensions = (string)CheckDBNull(dr["SupportedExtensions"], string.Empty);
            sourcePort.LaunchType          = (SourcePortLaunchType)Convert.ToInt32(dr["LaunchType"]);
            sourcePort.FileOption          = (string)CheckDBNull(dr["FileOption"], string.Empty);
            sourcePort.ExtraParameters     = (string)CheckDBNull(dr["ExtraParameters"], string.Empty);

            return(sourcePort);
        }
Beispiel #7
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            SourcePortEditForm editForm = new SourcePortEditForm(m_adapter, m_tabViews, m_launchType);

            if (m_launchType == SourcePortLaunchType.SourcePort)
            {
                editForm.SetSupportedExtensions(string.Format(".wad,{0},.deh,.bex", Util.GetPkExtensionsCsv()));
            }
            else
            {
                editForm.SetSupportedExtensions(string.Format(".wad,{0}", Util.GetPkExtensionsCsv()));
            }

            editForm.StartPosition = FormStartPosition.CenterParent;

            if (editForm.ShowDialog(this) == DialogResult.OK)
            {
                SourcePortData sourcePort = new SourcePortData();
                editForm.UpdateDataSource(sourcePort);
                sourcePort.LaunchType = m_launchType;
                m_adapter.InsertSourcePort(sourcePort);
                ResetData();
            }
        }
        public bool RunUtility(IGameFile gameFile)
        {
            SpecificFilesForm form = new SpecificFilesForm();

            form.AutoCheckSupportedExtensions(false);
            form.ShowPkContentsCheckBox(true);
            form.Initialize(m_config.GameFileDirectory, new IGameFile[] { gameFile }, SourcePortData.GetSupportedExtensions(m_utility),
                            new string[] { }, m_config.TempDirectory);
            form.StartPosition = FormStartPosition.CenterParent;

            if (form.ShowDialog(m_parent) == DialogResult.OK)
            {
                var files = form.GetPathedSpecificFiles();

                GameFilePlayAdapter adapter = new GameFilePlayAdapter();
                StringBuilder       sb      = new StringBuilder();
                adapter.HandleGameFile(gameFile, sb, m_config.GameFileDirectory, m_config.TempDirectory,
                                       new GenericSourcePort(m_utility), files); //this checks File.Exists and might not be same file

                try
                {
                    if (!string.IsNullOrEmpty(m_utility.ExtraParameters))
                    {
                        sb.Append(" " + m_utility.ExtraParameters);
                    }

                    Process.Start(m_utility.GetFullExecutablePath(), sb.ToString().Trim());
                }
                catch
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #9
0
 private string[] GetSupportedFiles(IGameFile gameFile)
 {
     return(SpecificFilesForm.GetSupportedFiles(m_appConfig.GameFileDirectory.GetFullPath(), gameFile, SourcePortData.GetSupportedExtensions(SelectedSourcePort)));
 }