internal PhysicalLocationVersionOne CreatePhysicalLocationVersionOne(Region v2Region) { PhysicalLocationVersionOne physicalLocation = null; if (v2Region != null) { physicalLocation = new PhysicalLocationVersionOne { Region = CreateRegionVersionOne(v2Region, uri: null) }; } return(physicalLocation); }
internal Region CreateRegion(PhysicalLocationVersionOne v1AnnotationLocation, PhysicalLocationVersionOne v1PhysicalLocation, string message) { Region region = null; // In SARIF v1, a location could have annotations that referred to files other than the location's own file. // That made no sense. In SARIF v2, a location can only be annotated with regions in the same file. // So only copy the v1 annotations that refer to the same file as the location. if (v1PhysicalLocation != null && v1AnnotationLocation.Uri == v1PhysicalLocation.Uri) { region = CreateRegion(v1PhysicalLocation.Region); region.Message = CreateMessage(message); } return(region); }
internal PhysicalLocation CreatePhysicalLocation(PhysicalLocationVersionOne v1PhysicalLocation) { PhysicalLocation physicalLocation = null; if (v1PhysicalLocation != null) { physicalLocation = new PhysicalLocation { ArtifactLocation = CreateFileLocation(v1PhysicalLocation), Region = CreateRegion(v1PhysicalLocation.Region) }; } return(physicalLocation); }
internal PhysicalLocationVersionOne CreatePhysicalLocationVersionOne(ArtifactLocation v2FileLocation) { PhysicalLocationVersionOne physicalLocation = null; if (v2FileLocation != null) { physicalLocation = new PhysicalLocationVersionOne { Uri = v2FileLocation.Uri, UriBaseId = v2FileLocation.UriBaseId }; } return(physicalLocation); }
internal PhysicalLocationVersionOne CreatePhysicalLocationVersionOne(PhysicalLocation v2PhysicalLocation) { PhysicalLocationVersionOne physicalLocation = null; if (v2PhysicalLocation != null) { physicalLocation = new PhysicalLocationVersionOne { Region = CreateRegionVersionOne(v2PhysicalLocation.Region, v2PhysicalLocation.ArtifactLocation?.Uri), Uri = v2PhysicalLocation.ArtifactLocation?.Uri, UriBaseId = v2PhysicalLocation.ArtifactLocation?.UriBaseId }; } return(physicalLocation); }
private List <Location> CreateLocations(PhysicalLocationVersionOne v1PhysicalLocation) { List <Location> locations = null; if (v1PhysicalLocation != null) { locations = new List <Location> { new Location { PhysicalLocation = CreatePhysicalLocation(v1PhysicalLocation) } }; } return(locations); }
internal ArtifactLocation CreateFileLocation(PhysicalLocationVersionOne v1PhysicalLocation) { return(CreateFileLocation(v1PhysicalLocation?.Uri, v1PhysicalLocation?.UriBaseId)); }