Example #1
0
 static void OutputECSGraph(int depth, ECSDependecy basePkg)
 {
     Console.WriteLine("ECS: {0}{1}:{2} v{3}", new string(' ', depth), basePkg.name, basePkg.key, basePkg.versions);
     foreach (ECSDependecy package in basePkg.dependencies)
     {
         OutputECSGraph(depth + 3, package);
     }
 }
Example #2
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());
            var repo = new LocalPackageRepository(@"\\Mac\Home\Documents\Visual Studio 2015\Projects\ConsoleApplication1\packages");
            IQueryable <IPackage> packages = repo.GetPackages();
            ECSDependecy          basePkg  = new ECSDependecy
            {
                versions = new List <String> {
                    "1.0-SNAPSHOT"
                },
                key          = "nuget:demo",
                name         = "Basismodul",
                dependencies = new List <ECSDependecy>()
            };

            OutputGraph(repo, packages, 0, basePkg);

            OutputECSGraph(0, basePkg);
            ECSArtifact artifact = new ECSArtifact
            {
                project      = "Mein Demo Projekt",
                moduleId     = "nuget.demo",
                module       = "Artefakt 1",
                dependencies = new List <ECSDependecy> {
                    basePkg
                }
            };

            var client = new RestClient("https://ecs-app.eacg.de");

            client.Proxy = new System.Net.WebProxy("http://*****:*****@eacg.de");
            request.AddHeader("x-apikey", "a301eb79-2fd5-4ef8-820d-33df5f9a188a");
            client.Execute(request);

            //Console.ReadLine();
        }
Example #3
0
        static void OutputGraph(LocalPackageRepository repository, IEnumerable <IPackage> packages, int depth, ECSDependecy basePkg)
        {
            foreach (IPackage package in packages)
            {
                ECSDependecy dep = new ECSDependecy
                {
                    versions = new List <string> {
                        package.Version.ToString()
                    },
                    key          = "nuget:" + package.Id,
                    name         = package.Id, //package.Title == null ? package.Title : package.Id,
                    description  = package.Description,
                    homepageUrl  = package.ProjectUrl?.AbsoluteUri,
                    dependencies = new List <ECSDependecy>(),
                    licenses     = new List <License> {
                    },
                };
                dep.licenses.Add(new License {
                    name = "unknown", url = package.LicenseUrl?.AbsoluteUri
                });

                Console.WriteLine("{0}{1} v{2}", new string(' ', depth), package.Id, package.Version);
                basePkg.dependencies.Add(dep);

                IList <IPackage> dependentPackages = new List <IPackage>();
                foreach (var dependencySet in package.DependencySets)
                {
                    foreach (var dependency in dependencySet.Dependencies)
                    {
                        dependentPackages.Add(repository.FindPackage(dependency.Id, dependency.VersionSpec, true, true));
                    }
                }

                OutputGraph(repository, dependentPackages, depth + 3, dep);
            }
        }