mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Code refactor
This commit is contained in:
parent
bc7c7adf26
commit
b23357d1f8
2 changed files with 14 additions and 32 deletions
|
@ -31,30 +31,23 @@ public class FFmpegUpdateChecker : GitHubUpdateChecker
|
|||
{
|
||||
public FFmpegArchitecture Architecture { get; private set; }
|
||||
|
||||
public FFmpegUpdateChecker(string owner, string repo) : base(owner, repo)
|
||||
{
|
||||
if (NativeMethods.Is64Bit())
|
||||
{
|
||||
Architecture = FFmpegArchitecture.win64;
|
||||
}
|
||||
else
|
||||
{
|
||||
Architecture = FFmpegArchitecture.win32;
|
||||
}
|
||||
}
|
||||
|
||||
public FFmpegUpdateChecker(string owner, string repo, FFmpegArchitecture architecture) : base(owner, repo)
|
||||
{
|
||||
Architecture = architecture;
|
||||
}
|
||||
|
||||
public override string GetLatestDownloadURL(bool isBrowserDownloadURL)
|
||||
{
|
||||
try
|
||||
{
|
||||
GitHubRelease latestRelease = GetLatestRelease(IncludePreRelease);
|
||||
|
||||
if (UpdateReleaseInfo(latestRelease, IsPortable, isBrowserDownloadURL))
|
||||
{
|
||||
return DownloadURL;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override bool UpdateReleaseInfo(GitHubRelease release, bool isPortable, bool isBrowserDownloadURL)
|
||||
{
|
||||
if (release != null && !string.IsNullOrEmpty(release.tag_name) && release.tag_name.Length > 1 && release.tag_name[0] == 'v')
|
||||
|
|
|
@ -29,22 +29,11 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
namespace ShareX.MediaLib
|
||||
{
|
||||
public class FFmpegGitHubDownloader
|
||||
public static class FFmpegGitHubDownloader
|
||||
{
|
||||
public static DialogResult DownloadFFmpeg(bool async, DownloaderForm.DownloaderInstallEventHandler installRequested)
|
||||
{
|
||||
FFmpegArchitecture architecture;
|
||||
|
||||
if (NativeMethods.Is64Bit())
|
||||
{
|
||||
architecture = FFmpegArchitecture.win64;
|
||||
}
|
||||
else
|
||||
{
|
||||
architecture = FFmpegArchitecture.win32;
|
||||
}
|
||||
|
||||
FFmpegUpdateChecker updateChecker = new FFmpegUpdateChecker("ShareX", "FFmpeg", architecture);
|
||||
FFmpegUpdateChecker updateChecker = new FFmpegUpdateChecker("ShareX", "FFmpeg");
|
||||
string url = updateChecker.GetLatestDownloadURL(false);
|
||||
|
||||
using (DownloaderForm form = new DownloaderForm(url, "ffmpeg.zip"))
|
||||
|
|
Loading…
Reference in a new issue