internal bool TryResolveFilePathFromSourceControl(IList <VersionControlDetails> sources, string pathFromLogFile, string workingDirectory, IFileSystem fileSystem, out string resolvedPath)
        {
            if (!SarifViewerPackage.IsUnitTesting)
            {
#pragma warning disable VSTHRD108 // Assert thread affinity unconditionally
                ThreadHelper.ThrowIfNotOnUIThread();
#pragma warning restore VSTHRD108
            }

            resolvedPath = null;
            if (sources == null || !sources.Any())
            {
                return(false);
            }

            foreach (VersionControlDetails versionControl in sources)
            {
                string localFilePath;

                // check if file exists in mapped location
                Uri mapToPath = versionControl.MappedTo?.Uri;
                if (mapToPath != null)
                {
                    localFilePath = new Uri(mapToPath, pathFromLogFile).LocalPath;
                    if (fileSystem.FileExists(localFilePath))
                    {
                        resolvedPath = localFilePath;
                        return(true);
                    }
                }

                // try to read from remote repo
                Uri    soureFileFromRepo = null;
                string localRelativePath = null;
                if (VersionControlParserFactory.TryGetVersionControlParser(versionControl, out IVersionControlParser parser))
                {
                    soureFileFromRepo = parser.GetSourceFileUri(pathFromLogFile);
                    localRelativePath = parser.GetLocalRelativePath(soureFileFromRepo, pathFromLogFile);
                }

                if (soureFileFromRepo != null)
                {
                    localFilePath = this.HandleHttpFileDownloadRequest(soureFileFromRepo, workingDirectory, localRelativePath);
                    if (fileSystem.FileExists(localFilePath))
                    {
                        resolvedPath = localFilePath;
                        return(true);
                    }
                }
            }

            return(false);
        }
        internal string GetFilePathFromHttp(SarifErrorListItem sarifErrorListItem, string uriBaseId, RunDataCache dataCache, string pathFromLogFile)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            Uri uri = null;

            if ((uriBaseId != null &&
                 dataCache.OriginalUriBasePaths.TryGetValue(uriBaseId, out Uri baseUri) &&
                 Uri.TryCreate(baseUri, pathFromLogFile, out uri) &&
                 uri.IsHttpScheme()) ||

                // if result location uri is an absolute http url
                (Uri.TryCreate(pathFromLogFile, UriKind.Absolute, out uri) &&
                 uri.IsHttpScheme()))
            {
                return(this.HandleHttpFileDownloadRequest(
                           VersionControlParserFactory.ConvertToRawFileLink(uri),
                           sarifErrorListItem.WorkingDirectory));
            }

            return(null);
        }