public static string Setup(string url) { try { WebClient webClient = new WebClient(); MainText = webClient.DownloadString(url); //Name, UrlForDescription, UrlForMainBody string[] entries = MainText.Split(','); if (entries.Length % 3 != 0) { return("Lewis has messed up the code: please email him at: [email protected]"); } for (int i = 0; i < entries.Length - 1; i += 3) { string descriptionRaw = webClient.DownloadString(entries[i + 1]); string mainRaw = webClient.DownloadString(entries[i + 2]); string description = descriptionRaw.Replace(@"’", @"'"); string main = mainRaw.Replace(@"’", @"'"); description = description.Replace(@"“", '"'.ToString()); main = main.Replace(@"“", '"'.ToString()); description = description.Replace(@"â€", '"'.ToString()); main = main.Replace(@"â€", '"'.ToString()); Poems.Add(new Poem(entries[i], description, main)); } } catch (Exception e) { return(e.ToString()); } return(string.Empty); }
public void RefreshPoemList() { files = Directory.GetFiles(repoFilePath); Poems.Clear(); foreach (string filePath in files) { Poems.Add(ReadPoemFromFile(filePath)); } }
public virtual void AddPoem(Poem m) { m.Author = this; Poems.Add(m); }