예제 #1
0
        public static async Task <IEnumerable <ArticleMetadata> > GetArticleList(this DropboxClient client)
        {
            var list = await client.Files.ListFolderAsync(string.Empty);

            var articles = new List <ArticleMetadata>();

            foreach (var item in list.Entries)
            {
                if (!item.IsFile)
                {
                    continue;
                }

                var fileMetadata = item.AsFile;

                var metadata = ArticleMetadata.Parse(item.Name, fileMetadata.Rev);
                if (metadata != null)
                {
                    articles.Add(metadata);
                }
            }

            articles.Sort((l, r) => l.Date.CompareTo(r.Date));

            return(articles);
        }
예제 #2
0
        public static Article FromMetadata(FileMetadata metadata, HtmlString content)
        {
            var parsed = metadata.Name.ParseBlogFileName();

            return(new Article(
                       metadata.Name,
                       ArticleMetadata.Parse(metadata.Name, metadata.Rev),
                       content));
        }