예제 #1
0
        void Start()
        {
            string[] target_list = new string[2] {
                "plain",
                "html"
            };

            string target = target_list[1];

            if ("plain" == target)
            {
                TextBuilder textbuilder = new TextBuilder();
                Director    director    = new Director(textbuilder);
                director.construct();
                string result = textbuilder.getResult();
                Debug.Log(result);
            }
            else if ("html" == target)
            {
                HTMLBuilder htmlbuilder = new HTMLBuilder();
                Director    director    = new Director(htmlbuilder);
                director.construct();
                string filename = htmlbuilder.getResult();
                Debug.Log(filename + "が作成されました。");
            }
            else
            {
                usage();
            }
        }
예제 #2
0
        public static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Usage();
                Environment.Exit(0);
            }

            if (args[0].Equals("plain"))
            {
                TextBuilder textBuilder = new TextBuilder();
                var         director    = new Director <string>(textBuilder);

                var result = director.construct();
                Console.WriteLine(result);
            }
            else if (args[0].Equals("html"))
            {
                HTMLBuilder htmlbuilder = new HTMLBuilder();
                var         director    = new Director <FileInfo>(htmlbuilder);

                var filePath = director.construct();
                Console.WriteLine(filePath.Name + "が作成されました。");
            }
            else
            {
                Usage();
                Environment.Exit(0);
            }

            Console.ReadLine();
        }
예제 #3
0
        static void Main(string[] args)
        {
            Director m_director     = new Director();
            IBuilder wealthyBuilder = new wealthyBuilder();
            IBuilder commonBuilder  = new commonBuilder();

            m_director.setBuilder(wealthyBuilder);
            Computer m_computer = m_director.construct();

            m_computer.show();

            m_director.setBuilder(commonBuilder);
            Computer m_computer2 = m_director.construct();

            m_computer2.show();

            Console.ReadKey();
        }