public void Read(StringCollection collection, DotnetListPackageFramework framework) { if (!collection.Current.StartsWith("transitive package", StringComparison.InvariantCultureIgnoreCase)) { return; } collection.MoveNext(); while (collection.Current.StartsWith(">")) { var strings = collection.Current.Split(' ', StringSplitOptions.RemoveEmptyEntries); var available = strings[3]; var current = strings[2]; var name = strings[1]; framework.Dependencies.Add(new DotnetListPackageDependency { AvailableVersion = available, CurrentVersion = current, Name = name, IsTransitive = true }); collection.MoveNext(); } }
public void Read(StringCollection collection, DotnetListPackageResult result) { while (collection.Current.StartsWith("[")) { var index = collection.Current.IndexOf("]"); var name = collection.Current.Substring(1, index - 1); var framework = new DotnetListPackageFramework { Name = name }; collection.MoveNext(); new TopLevelPackageReader().Read(collection, framework); new TransitivePackageReader().Read(collection, framework); if (framework.Dependencies.Any()) { framework.Dependencies.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.InvariantCultureIgnoreCase)); result.Frameworks.Add(framework); } } }