Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TBirdSoars committed Dec 12, 2021
1 parent 24c1511 commit ded3adf
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
Expand Down Expand Up @@ -210,7 +209,7 @@ private static async Task DownloadArchive(Uri uri, string dest)
{
using (HttpResponseMessage message = await client.GetAsync(uri))
{
if (message.StatusCode != HttpStatusCode.OK)
if (!message.IsSuccessStatusCode)
{
Console.WriteLine("DownloadArchive Error: Did not receive 200 OK status code.");
return;
Expand All @@ -223,13 +222,9 @@ private static async Task DownloadArchive(Uri uri, string dest)
}

using (Stream stream = await message.Content.ReadAsStreamAsync())
using (FileStream fileStream = new FileInfo(dest).OpenWrite())
{
FileInfo fileInfo = new FileInfo(dest);

using (FileStream fileStream = fileInfo.OpenWrite())
{
stream.CopyTo(fileStream);
}
stream.CopyTo(fileStream);
}
}
}
Expand All @@ -251,13 +246,7 @@ private static void ExtractArchive(string src)
{
while (reader.MoveToNextEntry())
{
ExtractionOptions extractionOptions = new ExtractionOptions
{
ExtractFullPath = true,
Overwrite = true
};

reader.WriteEntryToDirectory(currentDir, extractionOptions);
reader.WriteEntryToDirectory(currentDir, new ExtractionOptions{ExtractFullPath = true, Overwrite = true});
}
}

Expand Down

0 comments on commit ded3adf

Please sign in to comment.