Exemplo n.º 1
0
        public DotnetListPackageResult Parse(IEnumerable <string> lines)
        {
            var stringCollection = new StringCollection(lines);
            var reader           = new FrameworkReader();
            var result           = new DotnetListPackageResult();

            while (!stringCollection.Finished)
            {
                reader.Read(stringCollection, result);
                stringCollection.MoveNext();
            }

            result.Frameworks.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.InvariantCultureIgnoreCase));

            return(result);
        }
Exemplo n.º 2
0
        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);
                }
            }
        }