コード例 #1
0
        static void Main(string[] args)
        {
            string        filename  = "C:\\Users\\Jackass\\Desktop\\SD1104\\Lab9_4\\FoodSite.html";
            Header        header    = new Header();
            Paragraph     paragraph = new Paragraph();
            UnorderedList list      = new UnorderedList();
            StringBuilder sb        = new StringBuilder();

            Console.WriteLine("Enter text for the header:");
            string headerElement = header.CreateHeader(Console.ReadLine());

            string[] listItems = new string[3];

            for (int i = 0; i < listItems.Length; i++)
            {
                Console.WriteLine("Add another item to the list:");
                listItems[i] = list.CreateListItem(Console.ReadLine());
            }

            Console.WriteLine("Enter text for a paragraph:");
            string paragraphElement = paragraph.CreateParagraph(Console.ReadLine());

            StringBuilder listElement = list.CreateList(listItems);

            sb.Append(headerElement);
            sb.Append(listElement.ToString());
            sb.Append(paragraphElement);

            File.AppendAllText(filename, sb.ToString());
        }
コード例 #2
0
        static void Main(string[] args)
        {
            string filename = "D://Users//sdoff//source//repos//9_4//somefilename.html";

            Header header = new Header();
            UnorderedList list = new UnorderedList();
            StringBuilder sb = new StringBuilder();

            Console.WriteLine("Enter text for HTML header.");
            string headerElement = header.CreateHeader(Console.ReadLine());
            string[] listItems = new string[3];

            for (int i = 0; i < listItems.Length; i++)
            {

                Console.WriteLine("Add another item to the list.");
                listItems[i] = list.CreateListItem(Console.ReadLine());
            }

            StringBuilder listElement = list.CreateList(listItems);
            sb.Append(headerElement);
            sb.Append(listElement.ToString());

            File.AppendAllText(filename, sb.ToString());
        }
コード例 #3
0
        static void Main(string[] args)
        {
            string        filename = "C://weblogs//9_4Lab.html";
            Heading       heading  = new Heading();
            UnorderedList list     = new UnorderedList();
            StringBuilder SB       = new StringBuilder();

            Console.WriteLine("Enter your heading here please");
            string headerElement = heading.CreateHeading(Console.ReadLine());

            string[] listItems = new string[3];
            for (int i = 0; i < listItems.Length; i++)
            {
                Console.WriteLine("Alright, Now add 1 of 3 list elements");
                listItems[i] = list.CreateListItem(Console.ReadLine());
            }
            StringBuilder listElement = list.CreateList(listItems);

            SB.Append(headerElement);
            SB.Append(listElement.ToString());
            File.AppendAllText(filename, SB.ToString());
        }