示例#1
0
        public GhTreeItem(Octokit.TreeItem ti, string name, string relativePath)
        {
            Name         = name;
            RelativePath = relativePath;

            Path     = ti.Path;
            Mode     = ti.Mode;
            ItemType = ti.Type;
            Size     = ti.Size;
            Sha      = ti.Sha;
            Url      = ti.Url;
        }
示例#2
0
        public async Task SaveAllItemsFromTree(TreeItem subTree)
        {
            var treesClient = new TreesClient(apiConn);
            var tree = await treesClient.Get(Config.GitHubOwner, Config.GitHubRepo, subTree.Sha);
            LocalFileCache local = new LocalFileCache();
            foreach (var item in tree.Tree.Where(x => local.LocalItemExists(subTree.Path, x.Path) == false))
            {
                var blob = await GetBlobContents(item.Sha);

                local.SaveLocalItem(new DiskSaveItem { FileContents = Convert.FromBase64String(blob.Content), SubDirectory = subTree.Path, FileName = item.Path });
            }
        }
示例#3
0
        public async Task<BlogPost> ConvertTreeItemToBlogPost(TreeItem treeItem)
        {
            var blob = await GetBlobContents(treeItem.Sha);

            string fileContents = Encoding.UTF8.GetString(Convert.FromBase64String(blob.Content));

            return BlogPostParsing.ConvertFileToBlogPost(treeItem.Path, fileContents, treeItem.Sha, treeItem.Url.AbsoluteUri);
        }