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); } }
private void BuildLaunchString(StringBuilder sb, ISourcePort sourcePort, List <string> files) { List <string> dehFiles = new List <string>(); if (files.Count > 0) { sb.Append(sourcePort.FileParameter(new SpData())); var dehExtensions = Util.GetDehackedExtensions(); foreach (string str in files) { FileInfo fi = new FileInfo(str); if (!dehExtensions.Contains(fi.Extension.ToLower())) { sb.Append(string.Format("\"{0}\" ", str)); } else { dehFiles.Add(str); } } } if (dehFiles.Count > 0) { sb.Append(" -deh "); foreach (string str in dehFiles) { sb.Append(string.Format("\"{0}\" ", str)); } } }
// Take .deh and .bex files and put them together so they cane be put in the same parameter private IEnumerable <string> SortParameters(IEnumerable <string> parameters) { List <string> dehFiles = new List <string>(); var dehExtensions = Util.GetDehackedExtensions(); foreach (string file in parameters) { foreach (string deh in dehExtensions) { if (Path.GetExtension(file).Equals(deh, StringComparison.OrdinalIgnoreCase)) { dehFiles.Add(file); } } } return(parameters.Except(dehFiles).Union(dehFiles).ToList()); }