Ejemplo n.º 1
0
        /// <summary>
        /// Downloads the build, even if is already present.
        /// </summary>
        public async Task <bool> Download()
        {
            // Download the file
            FormProgress download = FormProgress.Download(DownloadURL, tempPath, $"{Name}.zip");

            download.ShowDialog();

            // If we failed, return
            if (!download.Completed)
            {
                return(false);
            }

            // If the folder with the build exists, delete it
            if (Directory.Exists(Folder))
            {
                Directory.Delete(Folder, true);
            }
            // And create it again
            Directory.CreateDirectory(Folder);

            // Once everything is ready, start the extraction
            FormProgress extraction = FormProgress.Extract(Path.Combine(tempPath, $"{Name}.zip"), Folder);

            extraction.ShowDialog();

            // If we failed, say so and return;
            if (!extraction.Completed)
            {
                return(false);
            }
            // Otherwise, show sucess
            return(true);
        }