コード例 #1
0
        public static async IAsyncEnumerable <(string file, string[] folders, string platform, string architecture)> GetSupportedNativeLibsAsync(PackageReaderBase packageReader, ILogger logger)
        {
            var versions = await packageReader.GetItemsAsync(PackagingConstants.Folders.Runtimes, CancellationToken.None);

            var files = versions.SelectMany(v => v.Items);

            foreach (var file in files)
            {
                var folderPath = Path.GetDirectoryName(file);
                var folders    = folderPath.Split(Path.DirectorySeparatorChar);

                if (folders.Length != 3 || !folders[2].Equals("native", StringComparison.OrdinalIgnoreCase))
                {
                    logger.LogInformation($"Skipping non-native library file located in the runtimes folder: {file} ...");
                    continue;
                }

                var system = folders[1].Split('-');

                if (system.Length != 2)
                {
                    logger.LogInformation($"Skipping file located in the runtime folder that does not specify platform and architecture: {file} ...");
                    continue;
                }

                var platform = system[0][..3] switch