public string GetLaunchParameters(LauncherPath gameFileDirectory, LauncherPath tempDirectory, IGameFile gameFile, ISourcePort sourcePort, bool isGameFileIwad) { StringBuilder sb = new StringBuilder(); List <IGameFile> loadFiles = AdditionalFiles.ToList(); if (isGameFileIwad) { loadFiles.Remove(gameFile); } else if (!loadFiles.Contains(gameFile)) { loadFiles.Add(gameFile); } if (IWad != null) { if (!AssertFile(gameFileDirectory.GetFullPath(), gameFile.FileName, "game file")) { return(null); } if (!HandleGameFileIWad(IWad, sb, gameFileDirectory, tempDirectory)) { return(null); } } List <string> launchFiles = new List <string>(); foreach (IGameFile loadFile in loadFiles) { if (!AssertFile(gameFileDirectory.GetFullPath(), loadFile.FileName, "game file")) { return(null); } if (!HandleGameFile(loadFile, launchFiles, gameFileDirectory, tempDirectory, sourcePort, true)) { return(null); } } string[] extensions = sourcePort.SupportedExtensions.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); launchFiles = SortParameters(launchFiles, extensions).ToList(); BuildLaunchString(sb, sourcePort, launchFiles); if (Map != null) { sb.Append(BuildWarpParamter(Map)); if (Skill != null) { sb.Append(string.Format(" -skill {0}", Skill)); } } if (Record) { RecordedFileName = Path.Combine(tempDirectory.GetFullPath(), Guid.NewGuid().ToString()); sb.Append(string.Format(" -record \"{0}\"", RecordedFileName)); } if (PlayDemo && PlayDemoFile != null) { if (!AssertFile(PlayDemoFile, "", "demo file")) { return(null); } sb.Append(string.Format(" -playdemo \"{0}\"", PlayDemoFile)); } if (ExtraParameters != null) { sb.Append(" " + ExtraParameters); } if (!string.IsNullOrEmpty(sourcePort.ExtraParameters)) { sb.Append(" " + sourcePort.ExtraParameters); } return(sb.ToString()); }
public string GetLaunchParameters(LauncherPath gameFileDirectory, LauncherPath tempDirectory, IGameFile gameFile, ISourcePortData sourcePortData, bool isGameFileIwad) { ISourcePort sourcePort = SourcePortUtil.CreateSourcePort(sourcePortData); StringBuilder sb = new StringBuilder(); List <IGameFile> loadFiles = AdditionalFiles.ToList(); if (isGameFileIwad) { loadFiles.Remove(gameFile); } else if (!loadFiles.Contains(gameFile)) { loadFiles.Add(gameFile); } if (IWad != null) { if (!AssertFile(gameFileDirectory.GetFullPath(), gameFile.FileName, "game file")) { return(null); } if (!HandleGameFileIWad(IWad, sourcePort, sb, gameFileDirectory, tempDirectory)) { return(null); } } List <string> launchFiles = new List <string>(); foreach (IGameFile loadFile in loadFiles) { if (!AssertFile(gameFileDirectory.GetFullPath(), loadFile.FileName, "game file")) { return(null); } if (!HandleGameFile(loadFile, launchFiles, gameFileDirectory, tempDirectory, sourcePortData, true)) { return(null); } } string[] extensions = sourcePortData.SupportedExtensions.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); launchFiles = SortParameters(launchFiles, extensions).ToList(); BuildLaunchString(sb, sourcePort, launchFiles); if (Map != null) { sb.Append(sourcePort.WarpParameter(new SpData(Map))); if (Skill != null) { sb.Append(sourcePort.SkillParameter(new SpData(Skill))); } } if (Record) { RecordedFileName = Path.Combine(tempDirectory.GetFullPath(), Guid.NewGuid().ToString()); sb.Append(sourcePort.RecordParameter(new SpData(RecordedFileName))); } if (PlayDemo && PlayDemoFile != null) { if (!AssertFile(PlayDemoFile, "", "demo file")) { return(null); } sb.Append(sourcePort.PlayDemoParameter(new SpData(PlayDemoFile))); } if (ExtraParameters != null) { sb.Append(" " + ExtraParameters); } if (!string.IsNullOrEmpty(sourcePortData.ExtraParameters)) { sb.Append(" " + sourcePortData.ExtraParameters); } IStatisticsReader statsReader = sourcePort.CreateStatisticsReader(gameFile, new IStatsData[] { }); if (SaveStatistics && statsReader != null && !string.IsNullOrEmpty(statsReader.LaunchParameter)) { sb.Append(" " + statsReader.LaunchParameter); } return(sb.ToString()); }
public override bool ExecuteTask() { var packagingDir = CreateEmptyOutputDirectory(IntermediateOutputFolderName); string outputZipFileName = Path.Combine(packagingDir, "resources.zip"); // we want to put module content, and resx files, in the resources zip that will get deployed to module install (desktop modules) folder dir. ITaskItem[] resourcesZipContentItems = ResourceFiles != null ? ResourcesZipContent.Concat(ResourceFiles).ToArray() : ResourcesZipContent.ToArray(); // create a resources zip containing install files, without source. CreateResourcesZip(outputZipFileName, resourcesZipContentItems); // copy the manifests to packaging dir root foreach (var item in ManifestFileItems) { var manifestFilePath = item.GetFullPath(this.ProjectDirectory); CopyFile(manifestFilePath, packagingDir); } // Ensure packagingdir\bin dir string binFolder = Path.Combine(packagingDir, "bin"); EnsureEmptyDirectory(binFolder); // copy assemblies to packagingdir\bin CopyFileTaskItems(ProjectDirectory, Assemblies, binFolder); // copy symbols to packagingdir\bin if (DebugSymbols) { CopyFileTaskItems(ProjectDirectory, Symbols, binFolder, true); } // copy AdditionalFiles directly into packagingdir (keeping same relative path from new parent dir) if (AdditionalFiles.Length > 0) { // This item array is initialised with a dummy item, so that its easy for // for consumers to override and add in their own items. // This means we have to take care of removing the dummy entry though. var dummyItem = AdditionalFiles.FirstOrDefault(a => a.ItemSpec == "_DummyEntry_.txt"); if (dummyItem != null) { var filesList = AdditionalFiles.ToList(); filesList.Remove(dummyItem); AdditionalFiles = filesList.ToArray(); } } CopyFileTaskItems(ProjectDirectory, AdditionalFiles, packagingDir, false, true); // find any // .sqldataprovider files // .lic files // "ReleaseNotes.txt" file // and copy them to the same relative directory in the packaging dir. ITaskItem[] specialPackageContentFiles = FindContentFiles(t => Path.GetExtension(t.ItemSpec).ToLowerInvariant() == ".sqldataprovider" || Path.GetExtension(t.ItemSpec).ToLowerInvariant() == ".lic" || Path.GetFileName(t.ItemSpec).ToLowerInvariant() == ReleaseNotesFileName.ToLowerInvariant() ); CopyFileTaskItems(ProjectDirectory, specialPackageContentFiles, packagingDir, false, true); // otpional: check that if a lic file is referenced in manifest that it exists in packagingdir // otpional: check that if a releasenotes file is referenced in manifest that it exists in packagingdir // otpional: run variable substitution against manifest? // otpional: ensure manifest has a ResourceFile component that references Resources.zip? // zip up packagingdir to OutputDirectory\OutputZipFileName string installZipFileName = Path.Combine(OutputDirectory, OutputZipFileName); CompressFolder(packagingDir, installZipFileName); InstallPackage = new TaskItem(installZipFileName); var buildServerArtifacts = new List <ITaskItem>(); buildServerArtifacts.Add(InstallPackage); // now, if sources are also provided, create another package, but this time, include sources in the resources zip file as well. if (SourceFiles != null && SourceFiles.Any()) { resourcesZipContentItems = resourcesZipContentItems.Concat(SourceFiles).ToArray(); // create a resources zip that also contains source files. CreateResourcesZip(outputZipFileName, resourcesZipContentItems); // create sources zip. string sourcesZipFileName = Path.Combine(OutputDirectory, OutputSourcesZipFileName); CompressFolder(packagingDir, sourcesZipFileName); SourcesPackage = new TaskItem(sourcesZipFileName); buildServerArtifacts.Add(SourcesPackage); } // publish assets to build server. PublishToBuildServer(buildServerArtifacts); return(true); }