Exemple #1
0
        public async Task <DownloadedGithubFile> DownloadFile(GithubFile content)
        {
            string name = content.Name;
            string url  = content.DownloadUrl;
            string path = content.Path;

            return(await DownloadFile(name, url, path));
        }
        public static List <GithubFile> ToGithubFiles(this IReadOnlyList <Repository> files)
        {
            List <GithubFile> list = new List <GithubFile>();

            foreach (Repository file in files)
            {
                list.Add(GithubFile.FromRepository(file));
            }

            return(list);
        }
Exemple #3
0
        public static GithubFile FromRepository(Repository file)
        {
            GithubFile item = new GithubFile();

            item.Name  = file.Name;
            item.Owner = file.Owner.Login;
            item.Id    = file.Id;

            item.IsDirectory = true;

            return(item);
        }
        public static List <GithubFile> ToGithubFiles(this IReadOnlyList <RepositoryContent> files)
        {
            List <GithubFile> list = new List <GithubFile>();

            foreach (RepositoryContent file in files)
            {
                var converted = GithubFile.FromRepositoryContent(file);
                list.Add(converted);
            }

            return(list);
        }
Exemple #5
0
        public static GithubFile FromRepositoryContent(RepositoryContent file)
        {
            GithubFile item = new GithubFile();

            item.Name        = file.Name;
            item.Path        = file.Path;
            item.Sha         = file.Sha;
            item.IsDirectory = (file.Type == ContentType.Dir);
            if (!item.IsDirectory)
            {
                item.DownloadUrl = file.DownloadUrl.OriginalString;
            }
            string[] split = file.Name.Split('.');
            item.Extension = split[split.Length - 1];

            return(item);
        }
 public void Reset()
 {
     DriveFile  = null;
     GithubFile = null;
     Style      = null;
 }