Exemple #1
0
        public async Task Install(string path)
        {
            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            Directory.CreateDirectory(path);

            try
            {
                await Task.Factory.StartNew(() =>
                {
                    using (var targzStream = _installSource.Get())
                    {
                        using (var tarStream = new GZipStream(targzStream, CompressionMode.Decompress, true))
                        {
                            using (var zipArchive = TarArchive.CreateInputTarArchive(tarStream))
                            {
                                zipArchive.ExtractContents(path);
                            }
                        }
                    }
                }, TaskCreationOptions.LongRunning);
            }
            catch (Exception)
            {
                Directory.Delete(path, false);
                throw;
            }
        }
        public async Task Install(string path)
        {
            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            Directory.CreateDirectory(path);

            using (var zipStream = _installSource.Get())
            {
                await UnZip(path, zipStream);
            }
        }