Google.JarResolver.PlayServicesSupport.GetDependencies C# (CSharp) Méthode

GetDependencies() private méthode

Gets the dependencies of the given dependency. This is done by reading the .pom file for the BestVersion of the dependency.
private GetDependencies ( Dependency dep ) : IEnumerable
dep Dependency Dependency to process
Résultat IEnumerable
        internal IEnumerable<Dependency> GetDependencies(Dependency dep)
        {
            List<Dependency> dependencyList = new List<Dependency>();
            if (String.IsNullOrEmpty(dep.BestVersion)) {
                Log("ERROR: no compatible versions of " + dep.Key +
                    "given the set of dependencies");
                return dependencyList;
            }

            string basename = dep.Artifact + "-" + dep.BestVersion + ".pom";
            string pomFile = Path.Combine(dep.BestVersionPath, basename);
            Log("GetDependencies - reading pom of " + basename + " pom: " + pomFile + " " +
                " versions: " +
                String.Join(", ", (new List<string>(dep.PossibleVersions)).ToArray()),
                verbose: true);

            XmlTextReader reader = new XmlTextReader(new StreamReader(pomFile));
            bool inDependencies = false;
            bool inDep = false;
            string groupId = null;
            string artifactId = null;
            string version = null;
            while (reader.Read())
            {
                if (reader.Name == "dependencies")
                {
                    inDependencies = reader.IsStartElement();
                }

                if (inDependencies && reader.Name == "dependency")
                {
                    inDep = reader.IsStartElement();
                }

                if (inDep && reader.Name == "groupId")
                {
                    groupId = reader.ReadString();
                }

                if (inDep && reader.Name == "artifactId")
                {
                    artifactId = reader.ReadString();
                }

                if (inDep && reader.Name == "version")
                {
                    version = reader.ReadString();
                }

                // if we ended the dependency, add it
                if (!string.IsNullOrEmpty(artifactId) && !inDep)
                {
                    // Unfortunately, the Maven POM doesn't contain metadata to map the package
                    // to each Android SDK package ID so the list "packageIds" is left as null in
                    // this case.
                    Dependency d = FindCandidate(new Dependency(groupId, artifactId, version));
                    if (d == null)
                    {
                        throw new ResolutionException("Cannot find candidate artifact for " +
                            groupId + ":" + artifactId + ":" + version);
                    }

                    groupId = null;
                    artifactId = null;
                    version = null;
                    dependencyList.Add(d);
                }
            }

            return dependencyList;
        }