예제 #1
0
        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));
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
        }