Exemple #1
0
        public async Task <RefreshResults> Refresh()
        {
            var repo = await Download();

            if (repo != null)
            {
                var toUpdate = Current == null;
                if (!toUpdate)
                {
                    var c = MediaRepository.CompareVersions(Current, repo);
                    toUpdate = c != null && c < 0;
                }
                if (toUpdate)
                {
                    Current = repo;
                    // TODO should try mutliple times?
                    await Save();
                }
                return(toUpdate ? RefreshResults.Refreshed : RefreshResults.AlreadyLatest);
            }
            return(RefreshResults.FailedToDownload);
        }