コード例 #1
0
        internal void SaveVersion(FFbinariesVersionInfo latestVersion, string path)
        {
            var versionPath = Path.Combine(path ?? ".", "version.json");

            File.WriteAllText(versionPath, JsonConvert.SerializeObject(new DownloadedVersion()
            {
                Version = latestVersion.Version
            }, Formatting.Indented));
        }
コード例 #2
0
        private static void SaveVersion(FFbinariesVersionInfo latestVersion)
        {
            var versionPath = Path.Combine(FFmpeg.ExecutablesPath ?? ".", "version.json");

            File.WriteAllText(versionPath, JsonConvert.SerializeObject(new DownloadedVersion()
            {
                Version = latestVersion.Version
            }, Formatting.Indented));
        }
コード例 #3
0
        internal async Task DownloadLatestVersion(FFbinariesVersionInfo latestFFmpegBinaries, string path, IProgress <ProgressInfo> progress = null, int retries = 0)
        {
            Links links = _linkProvider.GetLinks(latestFFmpegBinaries);

            var ffmpegZipDownloadTask  = DownloadFile(links.FFmpegLink, progress, retries);
            var ffprobeZipDownloadTask = DownloadFile(links.FFprobeLink, progress, retries);

            var ffmpegZip  = await ffmpegZipDownloadTask;
            var ffprobeZip = await ffprobeZipDownloadTask;

            Extract(ffmpegZip, path ?? ".");
            Extract(ffprobeZip, path ?? ".");

            File.Delete(ffmpegZip);
            File.Delete(ffprobeZip);
        }
コード例 #4
0
        internal async static Task DownloadLatestVersion(FFbinariesVersionInfo latestFFmpegBinaries)
        {
            var ffProbeZipPath = Path.Combine(Path.GetTempPath(), "FFprobe.zip");

            Links links = _linkProvider.GetLinks(latestFFmpegBinaries);

            var ffmpegZip = await DownloadFile(links.FFmpegLink);

            var ffprobeZip = await DownloadFile(links.FFprobeLink);

            Extract(ffmpegZip, FFmpeg.ExecutablesPath ?? ".");
            Extract(ffprobeZip, FFmpeg.ExecutablesPath ?? ".");

            if (Directory.Exists(Path.Combine(FFmpeg.ExecutablesPath ?? ".", "__MACOSX")))
            {
                Directory.Delete(Path.Combine(FFmpeg.ExecutablesPath ?? ".", "__MACOSX"), true);
            }
        }
コード例 #5
0
        private bool CheckIfUpdateAvailable(string latestVersion, string path)
        {
            var versionPath = Path.Combine(path ?? ".", "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);
        }