Code refactoring

This commit is contained in:
Jaex 2022-11-02 19:27:16 +03:00
parent b6dd838cfe
commit ec02677775
2 changed files with 7 additions and 13 deletions

View file

@ -402,7 +402,13 @@ private static void DownloadFFmpeg()
{
if (!File.Exists(FFmpegPath))
{
string filePath = SetupHelpers.DownloadFile(FFmpegDownloadURL);
string fileName = Path.GetFileName(FFmpegDownloadURL);
string filePath = Path.Combine(OutputDir, fileName);
Console.WriteLine("Downloading: " + FFmpegDownloadURL);
URLHelpers.DownloadFile(FFmpegDownloadURL, filePath);
Console.WriteLine("Extracting: " + filePath);
ZipManager.Extract(filePath, OutputDir, false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase));
}
}

View file

@ -33,18 +33,6 @@ namespace ShareX.Setup
{
internal class SetupHelpers
{
public static string DownloadFile(string url)
{
string fileName = Path.GetFileName(url);
string filePath = Path.GetFullPath(fileName);
Console.WriteLine($"Downloading: \"{url}\" -> \"{filePath}\"");
URLHelpers.DownloadFile(url, filePath);
return filePath;
}
public static void CopyFile(string path, string toFolder)
{
CopyFiles(new string[] { path }, toFolder);