예제 #1
0
        static void Main(string[] args)
        {
            Director.layoutArticle(new BuilderTXT(), "Neurons", "text");
            ArticleTXT articleTXT = (ArticleTXT)Director.GetArticle();

            Console.WriteLine(articleTXT.Title);

            Director.convertArticle(new BuilderXML(), articleTXT);
            ArticleXML articleXML = (ArticleXML)Director.GetArticle();

            Console.WriteLine(articleXML.Title);
        }
예제 #2
0
        // Класс отвечает за конвертациию статьи
        public static void convertArticle(IBuilder builder, ArticleTXT article_txt)
        {
            builder.reset();
            builder.setTitle(article_txt.Title);

            using (FileStream fileStream = File.OpenRead(article_txt.Text.FullName))
            {
                byte[] array = new byte[fileStream.Length];
                fileStream.Read(array, 0, array.Length);
                string textFromFile = System.Text.Encoding.Default.GetString(array);
                builder.setText(textFromFile);
            }
            article = builder.GetArticle();
        }
예제 #3
0
 public void reset()
 {
     articleTXT = new ArticleTXT();
 }