Exemplo n.º 1
0
        public void TestStrategy()
        {
            var tp = new TextProcessor();

            tp.SetOutputFormat(OutputFormat.Markdown);
            tp.AppendList(new [] { "foo", "bar", "baz" });
            Console.WriteLine(tp);

            tp.Clear();
            tp.SetOutputFormat(OutputFormat.Html);
            tp.AppendList(new[] { "foo", "bar", "baz" });
            Console.WriteLine(tp);
        }
Exemplo n.º 2
0
        public void Run()
        {
            var tp = new TextProcessor();

            tp.SetOutputFormat(OutputFormat.MarkDown);
            tp.AppendList(new[] { "foo", "bar", "baz" });
            WriteLine(tp);

            tp.Clear();

            tp.SetOutputFormat(OutputFormat.Html);
            tp.AppendList(new[] { "foo", "bar", "baz" });
            WriteLine(tp);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("---HTML格式----");
            var p = new TextProcessor();

            p.AppendList(new[] { "foo", "bar", "baz" });
            Console.WriteLine(p);


            Console.WriteLine("---Markdown格式----");
            p.Clear();
            p.SetListStrategy(OutputFormat.Markdown);
            p.AppendList(new [] { "foo", "bar", "baz" });
            Console.WriteLine(p);
            Console.ReadKey();
        }
Exemplo n.º 4
0
        public void Start()
        {
            var tp = new TextProcessor <MarkdownListStrategy>();

            tp.AppendList(new[] { "foo", "bar" });
            System.Console.WriteLine(tp);

            var tp2 = new TextProcessor <HtmlListStrategy>();

            tp2.AppendList(new[] { "foo", "bar" });
            System.Console.WriteLine(tp2);
        }
        public static void Run()
        {
            // cb.Register<MarkdownListStrategy>().As<IListStrategy>();
            var tp = new TextProcessor <MarkdownListStrategy>();

            tp.AppendList(new[] { "foo", "bar", "baz" });
            Console.WriteLine(tp);

            var tp2 = new TextProcessor <HtmlListStrategy>();

            tp2.AppendList(new[] { "foo", "bar", "baz" });
            Console.WriteLine(tp2);
        }
Exemplo n.º 6
0
        public void Start()
        {
            var tp = new TextProcessor();

            tp.SetOutputFormat(OutputFormat.Markdown);
            tp.AppendList(new[] { "foo", "bar" });
            System.Console.WriteLine(tp);

            tp = new TextProcessor();
            tp.SetOutputFormat(OutputFormat.Html);
            tp.AppendList(new[] { "foo", "bar" });
            System.Console.WriteLine(tp);
        }
Exemplo n.º 7
0
        internal static void Strategy()
        {
            var list = new[] { "C#", "Java", "Angular", "React", "Javascript", "CSS", "HTML" };
            //var tp = new TextProcessor();
            //tp.SetOutputFormat(OutputFormat.NumberList);
            var tp = new TextProcessor(OutputFormat.NumberList);

            tp.AppendList(list);
            Console.WriteLine(tp);
            tp.Clear();

            //tp.SetOutputFormat(OutputFormat.Html);
            tp = new TextProcessor(OutputFormat.Html);
            tp.AppendList(list);
            Console.WriteLine(tp);
            tp.Clear();

            // Strategy Demo 2:-----------------------------
            StrategyDemo2();
        }