internal Tool CreateTool(ToolVersionOne v1Tool) { Tool tool = null; if (v1Tool != null) { // The SARIF v1 spec does not specify a format for tool.fileVersion (although on the // Windows platform, the spec anticipated that it would be of the form n.n.n.n where // each n is one or more decimal digits). // // The SARIF v2 spec is more prescriptive: it defines a property toolComponent.dottedQuadFileVersion // with exactly that format. So if the v1 file contained a tool.fileVersion in any other // format, the best we can do is put it in the property bag. string dottedQuadFileVersion = null; if (v1Tool.FileVersion != null && s_dottedQuadFileVersionRegex.IsMatch(v1Tool.FileVersion)) { dottedQuadFileVersion = v1Tool.FileVersion; } var driver = new ToolComponent { DottedQuadFileVersion = dottedQuadFileVersion, FullName = v1Tool.FullName, Name = v1Tool.Name, Properties = v1Tool.Properties, SemanticVersion = v1Tool.SemanticVersion, Version = v1Tool.Version }; if (dottedQuadFileVersion == null && v1Tool.FileVersion != null) { driver.SetProperty("sarifv1/toolFileVersion", v1Tool.FileVersion); } tool = new Tool { Driver = driver }; } return(tool); }
internal ToolVersionOne CreateToolVersionOne(Tool v2Tool) { ToolVersionOne tool = null; if (v2Tool != null) { tool = new ToolVersionOne() { FileVersion = v2Tool.Driver.DottedQuadFileVersion, FullName = v2Tool.Driver.FullName, Name = v2Tool.Driver.Name, Properties = v2Tool.Properties, SemanticVersion = v2Tool.Driver.SemanticVersion, Version = v2Tool.Driver.Version }; } return(tool); }
internal Tool CreateTool(ToolVersionOne v1Tool) { Tool tool = null; if (v1Tool != null) { tool = new Tool() { FileVersion = v1Tool.FileVersion, FullName = v1Tool.FullName, Language = v1Tool.Language, Name = v1Tool.Name, Properties = v1Tool.Properties, SarifLoggerVersion = v1Tool.SarifLoggerVersion, SemanticVersion = v1Tool.SemanticVersion, Version = v1Tool.Version }; } return(tool); }
internal Tool CreateTool(ToolVersionOne v1Tool) { Tool tool = null; if (v1Tool != null) { tool = new Tool() { Driver = new ToolComponent { DottedQuadFileVersion = v1Tool.FileVersion, FullName = v1Tool.FullName, Name = v1Tool.Name, Properties = v1Tool.Properties, SemanticVersion = v1Tool.SemanticVersion, Version = v1Tool.Version } }; } return(tool); }
internal Tool CreateTool(ToolVersionOne v1Tool) { Tool tool = null; if (v1Tool != null) { tool = new Tool() { // V2 doesn't support Language, hence v1Tool.Language will be ignored. Driver = new ToolComponent { DottedQuadFileVersion = v1Tool.FileVersion, FullName = v1Tool.FullName, Name = v1Tool.Name, Properties = v1Tool.Properties, SemanticVersion = v1Tool.SemanticVersion, Version = v1Tool.Version } }; } return(tool); }