Ejemplo n.º 1
0
        public static async Task <List <RepoContent> > GetContentListAsync(Repo repo, bool cache = true, string subDir = "")
        {
            var key = CacheKeys.ContentsKey(repo.id);

            if (!Utils.CheckConnection && !cache)
            {
                throw new Exception("No internet, no candy for you!🤬");
            }
            else if (!Utils.CheckConnection && cache)
            {
                try
                {
                    return(await BlobCache.LocalMachine.GetObject <List <RepoContent> >(key));
                }
                catch { return(await GetContentsAsync(repo.owner.login, repo.name, key, subDir)); }
            }
            else if (Utils.CheckConnection)
            {
                return(await GetContentsAsync(repo.owner.login, repo.name, key, subDir));
            }
            else
            {
                throw new Exception("No Cache, no Internet!!!🤬");
            }
        }