Exemplo n.º 1
0
        public void GitDownloadTest()
        {
            var downloadLocation = @"C:\Melkor\";

            /* string[] urls =
             * {
             *   "https://github.com/ZvonimirKucis/2-domaca-zadaca",
             *   "https://github.com/m3talen/RAUPJC-DZ2/",
             *   "https://github.com/fspigel/RAUPJC-DZ2/",
             *   "https://github.com/ib47885/DZ02",
             *   "https://github.com/tbozuric/RAUPJC-HW2",
             *   "https://github.com/nbukovac/RAUPJC_2.HW",
             *   "https://github.com/bernarda22/RAUPJC_DrugaDZ",
             *   "https://github.com/KatarinaBlazic/RAUPJC-DZ2",
             *   "https://github.com/donikv/dz2"
             * };*/
            string[] urls =
            {
                "https://github.com/ZvonimirKucis/2-domaca-zadaca/"
            };
            GitZipper.CleanUp(downloadLocation);
            foreach (var url in urls)
            {
                var zip = new GitZipper(url, Guid.NewGuid().ToString());

                zip.GitDownload(downloadLocation);
                zip.GitUnzip();
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GitDownload(GitLinkModel link)
        {
            if (!link.URL.Contains("github.com"))
            {
                return(View("Index"));
            }

            string downloadLocation = _location;

            ApplicationUser currentUser = await _userManager.GetUserAsync(HttpContext.User);

            GitZipper.CleanUp(downloadLocation);

            GitZipper zip = new GitZipper(link.URL, Guid.Parse(currentUser.Id).ToString());

            zip.GitDownload(downloadLocation);
            zip.GitUnzip();

            ViewData["Message"] = link.URL;

            return(RedirectToAction("Build"));
        }