Beispiel #1
0
        private IEnumerable <ExternalFilesData> GetExternalFilesInfo(ITaskItem item)
        {
            var externalFileIdentity = item.GetMetadata("Identity");
            var externalFileBasePath = EnvironmentInfo.WorkingDirectory / item.GetMetadataOrNull("BasePath");

            var tokens = item
                         .MetadataNames.Cast <string>()
                         .Except(s_predefined)
                         .ToDictionary(TemplateUtility.GetTokenName, item.GetMetadata);
        private IEnumerable <ExternalFilesData> GetExternalFilesInfo(ITaskItem item)
        {
            var externalFileIdentity = item.GetMetadata("Identity");
            var externalFileBasePath = NormalizePath(Combine(EnvironmentInfo.WorkingDirectory, item.GetMetadataOrNull("BasePath")));

            var tokens = item
                         .MetadataNames.Cast <string>()
                         .Except(s_predefined)
                         .ToDictionary(TemplateUtility.GetTokenName, item.GetMetadata);

            Uri GetUri(string uriString)
            {
                Assert(Uri.TryCreate(uriString, UriKind.RelativeOrAbsolute, out var uri), $"Could not parse URI from '{uriString}'.");
                return(uri);
            }

            return(GetExternalFilePairs(externalFileIdentity)
                   .Select(x => new ExternalFilesData
            {
                Identity = externalFileIdentity,
                Uri = GetUri(x.UriString),
                Tokens = tokens,
                OutputPath = Path.Combine(externalFileBasePath, x.RelativePath)
            }));
        }