private static packageMetadataDependencies GetDependencies(Dictionary <string, string> packageReferences)
        {
            var dependencies = new packageMetadataDependencies
            {
                Items = packageReferences.Select(x => new dependency {
                    id = x.Key, version = x.Value
                }).ToArray <object>()
            };

            return(dependencies);
        }
        public static PackageDependency[] Process(packageMetadataDependencies dependencies)
        {
            if (dependencies == null)
            {
                return(null);
            }

            // This is non standard behaviour. The nuspec should NOT have both grouped and ungrouped dependencies.
            // In case of both existing, just ignore the ungrouped ones.
            if (dependencies.group != null)
            {
                return(dependencies.group.SelectMany(g => g.dependency).Select(d => new PackageDependency(d.id, d.version)).ToArray());
            }

            return(dependencies.dependency.Select(d => new PackageDependency(d.id, d.version)).ToArray());
        }
 private static packageMetadata CreatePackageMetadata(IReadOnlyDictionary <string, string> tokens,
                                                      packageMetadataDependencies dependencies)
 {
     return(new packageMetadata
     {
         id = !string.IsNullOrEmpty(tokens["id"]) ? tokens["id"] : "$id$",
         version = !string.IsNullOrEmpty(tokens["version"]) ? tokens["version"] : "$version$",
         authors = !string.IsNullOrEmpty(tokens["author"]) ? tokens["author"] : "$author$",
         owners = !string.IsNullOrEmpty(tokens["author"]) ? tokens["author"] : "$owners$",
         title = !string.IsNullOrEmpty(tokens["title"]) ? tokens["title"] : "$title$",
         description = !string.IsNullOrEmpty(tokens["description"]) ? tokens["description"] : "$description$",
         copyright = !string.IsNullOrEmpty(tokens["copyright"]) ? tokens["copyright"] : "$copyright$",
         requireLicenseAcceptance = false,
         dependencies = dependencies.Items.Length == 0 ? null : dependencies
     });
 }