예제 #1
0
        public DependencyContext Read(Stream stream)
        {
            var lines = new List<DepsFileLine>();
            using (var reader = new StreamReader(stream))
            {
                while (!reader.EndOfStream)
                {
                    var line = new DepsFileLine();
                    line.LibraryType = ReadValue(reader);
                    line.PackageName = ReadValue(reader);
                    line.PackageVersion = ReadValue(reader);
                    line.PackageHash = ReadValue(reader);
                    line.AssetType = ReadValue(reader);
                    line.AssetName = ReadValue(reader);
                    line.AssetPath = ReadValue(reader);

                    if (line.AssetType == "runtime" &&
                        !line.AssetPath.EndsWith(".ni.dll"))
                    {
                        lines.Add(line);
                    }
                    SkipWhitespace(reader);
                }
            }

            var runtimeLibraries = new List<RuntimeLibrary>();
            var packageGroups = lines.GroupBy(PackageIdentity);
            foreach (var packageGroup in packageGroups)
            {
                var identity = packageGroup.Key;
                runtimeLibraries.Add(new RuntimeLibrary(
                    type: identity.Item1,
                    name: identity.Item2,
                    version: identity.Item3,
                    hash: identity.Item4,
                    assemblies: packageGroup.Select(l => RuntimeAssembly.Create(l.AssetPath)),
                    resourceAssemblies: Enumerable.Empty<ResourceAssembly>(),
                    subTargets: Enumerable.Empty<RuntimeTarget>(),
                    dependencies: Enumerable.Empty<Dependency>(),
                    serviceable: false
                    ));
            }

            return new DependencyContext(
                targetFramework: string.Empty,
                runtime: string.Empty,
                isPortable: false,
                compilationOptions: CompilationOptions.Default,
                compileLibraries: Enumerable.Empty<CompilationLibrary>(),
                runtimeLibraries: runtimeLibraries.ToArray(),
                runtimeGraph: Enumerable.Empty<KeyValuePair<string, string[]>>());
        }
예제 #2
0
        public DependencyContext Read(Stream stream)
        {
            var lines = new List<DepsFileLine>();
            using (var reader = new StreamReader(stream))
            {
                while (!reader.EndOfStream)
                {
                    var line = new DepsFileLine();
                    line.LibraryType = ReadValue(reader);
                    line.PackageName = ReadValue(reader);
                    line.PackageVersion = ReadValue(reader);
                    line.PackageHash = ReadValue(reader);
                    line.AssetType = ReadValue(reader);
                    line.AssetName = ReadValue(reader);
                    line.AssetPath = ReadValue(reader);

                    if (line.AssetType == "runtime" &&
                        !line.AssetPath.EndsWith(".ni.dll"))
                    {
                        lines.Add(line);
                    }
                    SkipWhitespace(reader);
                }
            }

            var runtimeLibraries = new List<RuntimeLibrary>();
            var packageGroups = lines.GroupBy(PackageIdentity);
            foreach (var packageGroup in packageGroups)
            {
                var identity = packageGroup.Key;
                runtimeLibraries.Add(new RuntimeLibrary(
                    libraryType: identity.Item1,
                    packageName: identity.Item2,
                    version: identity.Item3,
                    hash: identity.Item4,
                    assemblies: packageGroup.Select(l => l.AssetPath).ToArray(),
                    dependencies: new Dependency[] { },
                    serviceable: false
                    ));
            }

            return new DependencyContext(
                target: string.Empty,
                runtime: string.Empty,
                compilationOptions: CompilationOptions.Default,
                compileLibraries: new CompilationLibrary[] {},
                runtimeLibraries: runtimeLibraries.ToArray());
        }
예제 #3
0
 private Tuple<string, string, string, string> PackageIdentity(DepsFileLine line)
 {
     return Tuple.Create(line.LibraryType, line.PackageName, line.PackageVersion, line.PackageHash);
 }
 private Tuple <string, string, string, string> PackageIdentity(DepsFileLine line)
 {
     return(Tuple.Create(line.LibraryType, line.PackageName, line.PackageVersion, line.PackageHash));
 }