public void download(String url, String rename) { using (var client = new WebClient()) { System.IO.Directory.CreateDirectory(imgPath + TextOperations.replaceSpace(title)); client.DownloadFile(url, imgPath + TextOperations.replaceSpace(title) + @"/" + rename); imgList.Add(imgPath + TextOperations.replaceSpace(title) + @"/" + rename); } }
static void Main(string[] args) { Post p = new Post(); p.exportToFile(); String a = TextOperations.replaceSpace("abcde zadadad azed"); Console.WriteLine("Hello World!224455 \n " + a); DateTime today = DateTime.Today; Console.WriteLine(today.ToString("yyyy-MM-dd")); using (var client = new WebClient()) { client.DownloadFile(@"C:/Users/11/Desktop/TOTO.bmp", @"img3.bmp"); //System.IO.Directory.CreateDirectory(@"line/fork/"); } }
public Post(String title, String image, String categories, String textPost) { DateTime today = DateTime.Today; nbAttributes = 13; attributes = new String[, ] { { "date", today.ToString("yyyy-MM-dd") }, { "layout", "post" }, { "title", title }, { "subtitle", "" }, { "author", "" }, { "image", imageLink + TextOperations.replaceSpace(title) + image }, { "permalink", TextOperations.replaceSpace(title) }, { "canonical_url", domain + TextOperations.replaceSpace(title) }, { "categories", "[" + categories + "]" }, //[english, tips, etc] { "redirectForm", "" }, { "featured", "no" }, { "comments", "true" }, { "textPost", textPost } }; }
public void exportToFile() { String title = ""; for (int i = 1; i < nbAttributes - 1; i++) { if (!attributes[i, 0].Equals("title")) { title = attributes[i, 1]; } } System.IO.File.WriteAllText(@"G:/projet/c#/easyJekyll/" + attributes[0, 1] + "-" + TextOperations.replaceSpace(title) + ".md", fusion()); }