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 ActionResult Hello() { Poems myPoem = new Poems(); myPoem.SetRecipient("Jill"); return(View(myPoem)); }
public void ClearAllPoems() { Poems.Clear(); foreach (string filePath in files) { File.Delete(filePath); } }
public void RefreshPoemList() { files = Directory.GetFiles(repoFilePath); Poems.Clear(); foreach (string filePath in files) { Poems.Add(ReadPoemFromFile(filePath)); } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); var poems = new Poems { Path = @"C:\Users\cflor\OneDrive\Poems" }; poems.ImportText(); var poemsList = poems.GetList(); foreach (var poem in poemsList) { Console.WriteLine(poem.Path); } }
void Start() { Poems.ShowPoem(this.poemIdx); }
private void SaveButton_Click(object sender, System.EventArgs e) { int result = 0; switch (position) { case 0: Words word = new Words(); word.GroupId = groupSpinner.SelectedItemPosition + 1; word.SubGroupId = subgroupSpinner.SelectedItemPosition + 1; word.Word = contentText.Text; result = repository.Save(word); break; case 1: Sentences sentence = new Sentences(); sentence.Sentence = contentText.Text; result = repository.Save(sentence); break; case 2: Poems poem = new Poems(); poem.Title = poemTitleText.Text; poem.Poem = contentText.Text; result = repository.Save(poem); break; } string message = result == 1 ? "Zapisano" : "B³¹d zapisu!"; Toast.MakeText(this, message, ToastLength.Long).Show(); OnBackPressed(); }
public virtual void AddPoem(Poem m) { m.Author = this; Poems.Add(m); }