예제 #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);
        }
예제 #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);
        }
예제 #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();
        }
예제 #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);
        }
예제 #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);
        }
예제 #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();
        }