Exemplo n.º 1
0
        static void TextInputConsole1()
        {
            List<CompRect> ListofCompRect = new List<CompRect>();
            List<CompSystem> ListofCompSystem = new List<CompSystem>();

            Console.Write("Title of input file . . . (don't forget .txt or .csv) ");

            string name = Console.ReadLine();
            Console.Write("Title of output file . . . (default is .txt) ");
            string outputname = Console.ReadLine();

            System.IO.StreamReader theFile = new System.IO.StreamReader(name);
            System.IO.StreamWriter OutPut = new System.IO.StreamWriter(outputname + ".txt");

            string readline = "";
            Console.WriteLine("Input");
            OutPut.WriteLine("Input");

            while (!theFile.EndOfStream)
            {
                readline = theFile.ReadLine();
                Console.WriteLine(readline);
                OutPut.WriteLine(readline);
                if (readline == "done") { break; } else if (readline == "") { continue; }

                ListofCompRect.Add(new CompRect(readline));
            }
            CompSystem CurrentSystem = new CompSystem(ListofCompRect);

            Console.WriteLine("----------------------");
            Console.WriteLine(CurrentSystem.ToString());
            Console.WriteLine("Press Enter to Output and quit");

            OutPut.WriteLine("-----------------------");
            OutPut.WriteLine(CurrentSystem.ToString());

            readline = Console.ReadLine();
            theFile.Close();
            OutPut.Close();
        }
Exemplo n.º 2
0
        static void DefaultInput()
        {
            List<CompRect> ListofCompRect = new List<CompRect>();
            List<CompSystem> ListofCompSystem = new List<CompSystem>();

            System.IO.StreamReader theFile = new System.IO.StreamReader("DefaultInput.txt");
            System.IO.StreamWriter OutPut = new System.IO.StreamWriter("DefaultOutput.txt");

            string readline = "";
            Console.WriteLine("Input");
            OutPut.WriteLine("Input\n b, h, cx, cy");
            int count = 1;
            while (!theFile.EndOfStream)
            {
                readline = theFile.ReadLine();
                Console.WriteLine(readline);
                OutPut.Write("[{0}]", count);
                count++;
                OutPut.WriteLine(readline);
                if (readline == "done") { break; } else if (readline == "") { continue; }

                ListofCompRect.Add(new CompRect(readline));
            }
            CompSystem CurrentSystem = new CompSystem(ListofCompRect);

            Console.WriteLine("----------------------");
            Console.WriteLine(CurrentSystem.ToString());
            Console.WriteLine("Press Enter to Output and quit");

            OutPut.WriteLine("-----------------------");
            OutPut.WriteLine(CurrentSystem.ToString());

            readline = Console.ReadLine();
            theFile.Close();
            OutPut.Close();
        }