internal void SaveVersion(FFbinariesVersionInfo latestVersion) { var versionPath = Path.Combine(FFmpeg.ExecutablesPath ?? ".", "version.json"); File.WriteAllText(versionPath, JsonConvert.SerializeObject(new DownloadedVersion() { Version = latestVersion.Version }, Formatting.Indented)); }
internal async Task DownloadLatestVersion(FFbinariesVersionInfo latestFFmpegBinaries) { Links links = _linkProvider.GetLinks(latestFFmpegBinaries); var ffmpegZipDownloadTask = DownloadFile(links.FFmpegLink); var ffprobeZipDownloadTask = DownloadFile(links.FFprobeLink); var ffmpegZip = await ffmpegZipDownloadTask.ConfigureAwait(false); var ffprobeZip = await ffprobeZipDownloadTask.ConfigureAwait(false); Extract(ffmpegZip, FFmpeg.ExecutablesPath ?? "."); Extract(ffprobeZip, FFmpeg.ExecutablesPath ?? "."); if (Directory.Exists(Path.Combine(FFmpeg.ExecutablesPath ?? ".", "__MACOSX"))) { Directory.Delete(Path.Combine(FFmpeg.ExecutablesPath ?? ".", "__MACOSX"), true); } }
private bool CheckIfUpdateAvailable(string latestVersion) { var versionPath = Path.Combine(FFmpeg.ExecutablesPath ?? ".", "version.json"); if (!File.Exists(versionPath)) { return(true); } FFbinariesVersionInfo currentVersion = JsonConvert.DeserializeObject <FFbinariesVersionInfo>(File.ReadAllText(versionPath)); if (currentVersion != null) { if (new Version(latestVersion) > new Version(currentVersion.Version)) { return(true); } } return(false); }