예제 #1
0
        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));
        }
예제 #3
0
 public void ClearAllPoems()
 {
     Poems.Clear();
     foreach (string filePath in files)
     {
         File.Delete(filePath);
     }
 }
예제 #4
0
        public void RefreshPoemList()
        {
            files = Directory.GetFiles(repoFilePath);

            Poems.Clear();
            foreach (string filePath in files)
            {
                Poems.Add(ReadPoemFromFile(filePath));
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
 void Start()
 {
     Poems.ShowPoem(this.poemIdx);
 }
예제 #7
0
        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();
        }
예제 #8
0
파일: Poet.cs 프로젝트: dsmarkchen/comedia
 public virtual void AddPoem(Poem m)
 {
     m.Author = this;
     Poems.Add(m);
 }