/// <summary> /// Processes the markup syntax for this <see cref="SolutionState"/> according to the current /// <see cref="MarkupHandling"/>, and returns a new <see cref="SolutionState"/> with the /// <see cref="ProjectState.Sources"/>, <see cref="ProjectState.GeneratedSources"/>, /// <see cref="ProjectState.AdditionalFiles"/>, <see cref="ProjectState.AnalyzerConfigFiles"/>, and /// <see cref="ExpectedDiagnostics"/> updated accordingly. /// </summary> /// <param name="markupOptions">Additional options to apply during markup processing.</param> /// <param name="defaultDiagnostic">The diagnostic descriptor to use for markup spans without an explicit name, /// or <see langword="null"/> if no such default exists.</param> /// <param name="supportedDiagnostics">The diagnostics supported by analyzers used by the test.</param> /// <param name="fixableDiagnostics">The set of diagnostic IDs to treat as fixable. This value is only used when /// <see cref="MarkupHandling"/> is <see cref="MarkupMode.IgnoreFixable"/>.</param> /// <param name="defaultPath">The default file path for diagnostics reported in source code.</param> /// <returns>A new <see cref="SolutionState"/> with all markup processing completed according to the current /// <see cref="MarkupHandling"/>. The <see cref="MarkupHandling"/> of the returned instance is /// <see cref="MarkupMode.None"/>.</returns> /// <exception cref="InvalidOperationException">If <see cref="InheritanceMode"/> is not /// <see cref="StateInheritanceMode.Explicit"/>.</exception> public SolutionState WithProcessedMarkup(MarkupOptions markupOptions, DiagnosticDescriptor?defaultDiagnostic, ImmutableArray <DiagnosticDescriptor> supportedDiagnostics, ImmutableArray <string> fixableDiagnostics, string defaultPath) { if (InheritanceMode != StateInheritanceMode.Explicit) { throw new InvalidOperationException("Inheritance processing must complete before markup processing."); } var markupLocations = ImmutableDictionary <string, FileLinePositionSpan> .Empty; (var expected, var testSources) = ProcessMarkupSources(Sources, ExpectedDiagnostics, ref markupLocations, markupOptions, defaultDiagnostic, supportedDiagnostics, fixableDiagnostics, defaultPath); var(additionalExpected2, testGeneratedSources) = ProcessMarkupSources(GeneratedSources, expected, ref markupLocations, markupOptions, defaultDiagnostic, supportedDiagnostics, fixableDiagnostics, defaultPath); var(additionalExpected1, additionalFiles) = ProcessMarkupSources(AdditionalFiles.Concat(AdditionalFilesFactories.SelectMany(factory => factory())), additionalExpected2, ref markupLocations, markupOptions, defaultDiagnostic, supportedDiagnostics, fixableDiagnostics, defaultPath); var(additionalExpected, analyzerConfigFiles) = ProcessMarkupSources(AnalyzerConfigFiles, additionalExpected1, ref markupLocations, markupOptions, defaultDiagnostic, supportedDiagnostics, fixableDiagnostics, defaultPath); var result = new SolutionState(Name, Language, DefaultPrefix, DefaultExtension); result.MarkupHandling = MarkupMode.None; result.InheritanceMode = StateInheritanceMode.Explicit; result.ReferenceAssemblies = ReferenceAssemblies; result.OutputKind = OutputKind; result.DocumentationMode = DocumentationMode; result.Sources.AddRange(testSources); result.GeneratedSources.AddRange(testGeneratedSources); result.AdditionalFiles.AddRange(additionalFiles); result.AnalyzerConfigFiles.AddRange(analyzerConfigFiles); foreach (var(projectName, projectState) in AdditionalProjects) { var(correctedIntermediateDiagnostics, additionalProjectSources) = ProcessMarkupSources(projectState.Sources, additionalExpected, ref markupLocations, markupOptions, defaultDiagnostic, supportedDiagnostics, fixableDiagnostics, defaultPath); var(correctedDiagnostics2, additionalProjectGeneratedSources) = ProcessMarkupSources(projectState.GeneratedSources, correctedIntermediateDiagnostics, ref markupLocations, markupOptions, defaultDiagnostic, supportedDiagnostics, fixableDiagnostics, defaultPath); var(correctedDiagnostics1, additionalProjectAdditionalFiles) = ProcessMarkupSources(projectState.AdditionalFiles.Concat(projectState.AdditionalFilesFactories.SelectMany(factory => factory())), correctedDiagnostics2, ref markupLocations, markupOptions, defaultDiagnostic, supportedDiagnostics, fixableDiagnostics, defaultPath); var(correctedDiagnostics, additionalProjectAnalyzerConfigFiles) = ProcessMarkupSources(projectState.AnalyzerConfigFiles, correctedDiagnostics1, ref markupLocations, markupOptions, defaultDiagnostic, supportedDiagnostics, fixableDiagnostics, defaultPath); var processedProjectState = new ProjectState(projectState); processedProjectState.Sources.Clear(); processedProjectState.Sources.AddRange(additionalProjectSources); processedProjectState.GeneratedSources.Clear(); processedProjectState.GeneratedSources.AddRange(additionalProjectGeneratedSources); processedProjectState.AdditionalFiles.Clear(); processedProjectState.AdditionalFilesFactories.Clear(); processedProjectState.AdditionalFiles.AddRange(additionalProjectAdditionalFiles); processedProjectState.AnalyzerConfigFiles.Clear(); processedProjectState.AnalyzerConfigFiles.AddRange(additionalProjectAnalyzerConfigFiles); result.AdditionalProjects.Add(projectName, processedProjectState); additionalExpected = correctedDiagnostics; } for (var i = 0; i < additionalExpected.Length; i++) { additionalExpected[i] = additionalExpected[i].WithAppliedMarkupLocations(markupLocations); } result.AdditionalProjectReferences.AddRange(AdditionalProjectReferences); result.AdditionalReferences.AddRange(AdditionalReferences); result.ExpectedDiagnostics.AddRange(additionalExpected); return(result); }
private void AddAdditionalFile(string filename) { try { AdditionalFiles.Add(filename); RaisePropertyChanged("PackageContents"); } catch (Exception e) { dynamoViewModel.Model.Logger.Log(e); } }
private void AddAdditionalFile(string filename) { try { AdditionalFiles.Add(filename); RaisePropertyChanged("PackageContents"); } catch (Exception e) { UploadState = PackageUploadHandle.State.Error; ErrorString = String.Format(Resources.MessageFailedToAddFile, filename); dynamoViewModel.Model.Logger.Log(e); } }
private Diagnostic[] GetSortedDiagnosticsFromDocument(TAnalyzer analyzer, Document document) { var diagnostics = new List <Diagnostic>(); var compilation = document.Project.GetCompilationAsync().Result; var options = new AnalyzerOptions(AdditionalFiles.ToImmutableArray <AdditionalText>()); var compilationWithAnalyzers = compilation.WithAnalyzers(ImmutableArray.Create <DiagnosticAnalyzer>(analyzer), options); var diags = compilationWithAnalyzers.GetAnalyzerDiagnosticsAsync().Result; diagnostics.AddRange(diags.Concat(compilation.GetDiagnostics().Where(x => x.Severity == DiagnosticSeverity.Error))); var results = SortDiagnostics(diagnostics); diagnostics.Clear(); return(results); }
public SteamAppInfo(int appId, Library library, DirectoryInfo installationDirectory) { AppId = appId; Library = library; InstallationDirectory = installationDirectory; GameHeaderImage = $"http://cdn.akamai.steamstatic.com/steam/apps/{AppId}/header.jpg"; CompressedArchivePath = new FileInfo(Path.Combine(Library.DirectoryList["SteamApps"].FullName, AppId + ".zip")); AdditionalDirectories.Add((new DirectoryInfo(Path.Combine(Library.DirectoryList["Download"].FullName, InstallationDirectory.Name)), "*", SearchOption.AllDirectories)); AdditionalDirectories.Add((new DirectoryInfo(Path.Combine(Library.DirectoryList["Workshop"].FullName, "content", AppId.ToString())), "*", SearchOption.AllDirectories)); AdditionalDirectories.Add((Library.DirectoryList["Download"], $"*{AppId}*.patch", SearchOption.TopDirectoryOnly)); AdditionalFiles.Add(new FileInfo(Path.Combine(Library.DirectoryList["SteamApps"].FullName, $"appmanifest_{AppId}.acf"))); AdditionalFiles.Add(new FileInfo(Path.Combine(Library.DirectoryList["Workshop"].FullName, $"appworkshop_{AppId}.acf"))); }
internal ProjectState(ProjectState sourceState) { Name = sourceState.Name; Language = sourceState.Language; ReferenceAssemblies = sourceState.ReferenceAssemblies; OutputKind = sourceState.OutputKind; DocumentationMode = sourceState.DocumentationMode; DefaultPrefix = sourceState.DefaultPrefix; DefaultExtension = sourceState.DefaultExtension; Sources = new SourceFileList(DefaultPrefix, DefaultExtension); Sources.AddRange(sourceState.Sources); AdditionalFiles.AddRange(sourceState.AdditionalFiles); AdditionalFilesFactories.AddRange(sourceState.AdditionalFilesFactories); AdditionalProjectReferences.AddRange(sourceState.AdditionalProjectReferences); }
public IActionResult AddCustomerWish(string name, string description, string deadline) { if (name == null & description == null & deadline == null) { return(View("CreateCustomerWish")); } var userId = _userManager.GetUserId(HttpContext.User); var user = _db.Users.FirstOrDefault(x => x.Id == userId); var participant = _db.Participants.Include(x => x.Team).ThenInclude(x => x.Tasks).ThenInclude(x => x.Assignee).ThenInclude(x => x.User).Include(x => x.Department).ThenInclude(x => x.Tasks).ThenInclude(x => x.Assignee).ThenInclude(x => x.User) .Include(x => x.Project).ThenInclude(x => x.Tasks).ThenInclude(x => x.Assignee).ThenInclude(x => x.User).FirstOrDefault(x => (x.Project.Id == user.LastSelectedProjectId) & (x.User.Id == user.Id)); var newTask = new CustomerWish() { Name = name, Description = description, Autor = participant, AddingTime = DateTime.Now, Deadline = DateTime.Parse(deadline), }; newTask.Project = participant.Project; var files = new AdditionalFiles { Files = new List <FilePath>() }; var myFiles = Request.Form.Files; var targetLocation = Path.Combine(_appEnvironment.WebRootPath, "images"); foreach (var file in myFiles) { if (file.Length > 0) { var path = Path.Combine(targetLocation, file.FileName); using (var fileStream = System.IO.File.Create(path)) { file.CopyTo(fileStream); } files.Files.Add(new FilePath() { Owner = files, Path = file.FileName }); } } newTask.AdditionalFiles = files; _db.CustomerWishes.Add(newTask); _db.SaveChanges(); return(View("Index")); }
public void EnumerateAdditionalFiles() { if (String.IsNullOrEmpty(RootDirectory) || !Directory.Exists(RootDirectory)) { return; } var nonDyfDllFiles = Directory.EnumerateFiles( RootDirectory, "*", SearchOption.AllDirectories) .Where(x => !x.ToLower().EndsWith(".dyf") && !x.ToLower().EndsWith(".dll") && !x.ToLower().EndsWith("pkg.json") && !x.ToLower().EndsWith(".backup")) .Select(x => new PackageFileInfo(RootDirectory, x)); AdditionalFiles.Clear(); AdditionalFiles.AddRange(nonDyfDllFiles); }
public IActionResult SaveNewTaskToSprint(int?sprintId, string name, string description, string priority, string taskType, string deadline) { var sprint = _db.Sprints.Include(x => x.Team).Include("Team.Department.Project").Include(x => x.ListTasks).FirstOrDefault(x => x.Id == sprintId); var newTask = new ProjectTask() { Name = name, Description = description, Status = TaskStatusEnum.ToDo, Sprint = sprint, Department = sprint.Team.Department, Team = sprint.Team, AddingTime = DateTime.Now, ComplitedLine = 0, Deadline = DateTime.Parse(deadline), Priority = (PriorityEnum)Enum.Parse(typeof(PriorityEnum), priority, true), Type = (TaskTypeEnum)Enum.Parse(typeof(TaskTypeEnum), taskType, true), }; newTask.Project = newTask.Department.Project; var files = new AdditionalFiles { Files = new List <FilePath>() }; var myFiles = Request.Form.Files; var targetLocation = Path.Combine(_appEnvironment.WebRootPath, "images"); foreach (var file in myFiles) { if (file.Length > 0) { var path = Path.Combine(targetLocation, file.FileName); using (var fileStream = System.IO.File.Create(path)) { file.CopyTo(fileStream); } files.Files.Add(new FilePath() { Owner = files, Path = file.FileName }); } } newTask.AdditionalFiles = files; _db.Tasks.Add(newTask); _db.SaveChanges(); return(RedirectToAction("Edit", "Sprint", new{ sprintId = sprint.Id })); }
private void ExecuteAnalysis(AnalysisConfig config) { if (config == null || Language == null) { return; } IList <AnalyzerSettings> analyzers = config.AnalyzersSettings; if (analyzers == null) { Log.LogMessage(MessageImportance.Low, Resources.AnalyzerSettings_NotSpecifiedInConfig, Language); return; } var settings = analyzers.SingleOrDefault(s => Language.Equals(s.Language)); if (settings == null) { Log.LogMessage(MessageImportance.Low, Resources.AnalyzerSettings_NotSpecifiedInConfig, Language); return; } RuleSetFilePath = settings.RuleSetFilePath; if (settings.AnalyzerAssemblyPaths != null) { AnalyzerFilePaths = settings.AnalyzerAssemblyPaths.Where(f => IsAssemblyLibraryFileName(f)).ToArray(); } if (settings.AdditionalFilePaths != null) { AdditionalFiles = settings.AdditionalFilePaths.ToArray(); var additionalFileNames = new HashSet <string>( AdditionalFiles .Select(af => GetFileName(af)) .Where(n => !string.IsNullOrEmpty(n))); AdditionalFilesToRemove = (OriginalAdditionalFiles ?? Enumerable.Empty <string>()) .Where(original => additionalFileNames.Contains(GetFileName(original))) .ToArray(); } }
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 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 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); }
/// <inheritdoc /> public IEnumerable <AdditionalText> GetFilesMatchingPattern(string fileNamePattern) { return(AdditionalFiles.Where(file => Regex.IsMatch(Path.GetFileName(file.Path), fileNamePattern, RegexOptions.IgnoreCase))); }