コード例 #1
0
        public void createListFilesFromHtml()
        {
            string path   = Path.Combine(this.currentAdress, this.view.SelectedItems[0].Text);
            var    reader = new StreamReader(path, Encoding.GetEncoding(1251));
            string text   = reader.ReadToEnd();
            string ans    = "";

            while (true)
            {
                int pos = text.IndexOf("<a href=");
                if (pos == -1)
                {
                    break;
                }
                int    start  = pos + 9;
                string adress = "";
                while (text[start] != '\"')
                {
                    adress += text[start++];
                }
                text = text.Substring(start, text.Length - start);
                ans  = ans + adress + "\n";
            }
            Creator cr = new ConcreteCreator(Path.Combine(this.currentAdress,
                                                          this.view.SelectedItems[0].Text.Split('.')[0] + "_ListOfFiles"),
                                             1, ans);

            cr.Create();
            this.buildDirectories(this.currentAdress);
        }
コード例 #2
0
        static void main2()
        {
            Creator creator = new ConcreteCreator();
            Posilek produkt = creator.Create("Sniadanie");

            Console.WriteLine(produkt.getName());
        }
コード例 #3
0
 public void saveFile()
 {
     saveFileDialog1.Filter   = "Txt file (*.txt)|*.txt|Html file (*.html)|*.html";
     saveFileDialog1.FileName = openFileDialog1.FileName;
     if (saveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         Creator cr = new ConcreteCreator(saveFileDialog1.FileName.Split('.')[0],
                                          saveFileDialog1.FilterIndex, richTextBox1.Text);
         cr.Create();
     }
 }