public Task HandleAsync(WorkspaceFile file, HandleFileOptions options, CancellationToken cancellationToken) { file.Editor = "Pdf"; file.Meta.GetUrl = $"/api/file/content/{file.Meta.Id}"; return(Task.CompletedTask); }
public Task HandleAsync( WorkspaceFile file, HandleFileOptions options, CancellationToken cancellationToken) { file.Editor = "Image"; file.Meta.GetUrl = $"/api/file/content/{file.Meta.Id}"; file.Meta.Converters.Add("DATA_URL"); return(Task.CompletedTask); }
public void RemoveProject(Project p) { Projects.Remove(p.ProjName); var nodes = WorkspaceFile.SelectNodes("//Workspace//Project"); foreach (XmlNode node in nodes) { if (node.Attributes["Name"].Value == p.ProjName) { WorkspaceFile.SelectSingleNode("//Workspace").RemoveChild(node); } } }
public Task HandleAsync(WorkspaceFile file, HandleFileOptions options, CancellationToken cancellationToken) { try { var decompiler = new CSharpDecompiler( file.Path, new DecompilerSettings()); file.Content = decompiler.DecompileWholeModuleAsString(); file.Meta.Language = "csharp"; } catch (Exception ex) { Log.Warning(ex, "Could not decompile: {File}", file.Path); } return(Task.CompletedTask); }
public async Task <WorkspaceFile> GetFileAsync( GetFileRequest request, CancellationToken cancellationToken) { var file = new FileInfo(request.FileName); string contentType; if (!_contentTypeProvider.TryGetContentType(file.Name, out contentType)) { contentType = "application/octet-stream"; } FileEditorInfo meta = GetEditorInfo(file); var wsFile = new WorkspaceFile( file.Name, file.FullName, contentType) { Meta = meta }; var options = new HandleFileOptions(request.Converter); foreach (IFileContentTypeHandler handler in _fileHandlers) { if (handler.CanHandle(wsFile, options)) { await handler.HandleAsync(wsFile, options, cancellationToken); break; } } return(wsFile); }
/// <summary> /// Get the simple display name for a source file /// </summary> /// <param name="File">The source file to get a name for</param> /// <returns>The normalized path or full path for the given file</returns> static string GetDisplayName(SourceFile File) { WorkspaceFile WorkspaceFile = Workspace.GetFile(File.Location); return(WorkspaceFile.NormalizedPathFromBranchRoot ?? File.Location.FullName); }
public CreateFileFromBase64Payload(WorkspaceFile file) { File = file; }
public async Task HandleAsync( WorkspaceFile file, HandleFileOptions options, CancellationToken cancellationToken) { if (options.Converter is { })
public bool CanHandle(WorkspaceFile file, HandleFileOptions options) { return(true); }
public bool CanHandle(WorkspaceFile file, HandleFileOptions options) { return(file.ContentType.Equals("boost/dll")); }
public bool CanHandle(WorkspaceFile file, HandleFileOptions options) { return(file.ContentType.Equals("application/pdf") && options.Converter is null); }
public bool CanHandle(WorkspaceFile file, HandleFileOptions options) { return(file.ContentType.StartsWith("image") && options.Converter is null); }