Mercurial > defical
view defical-sharp/defical-cli/inputparser.cs @ 0:ebed2bd0d300
Initial import from svn. History be damned.
author | Edho P. Arief <me@myconan.net> |
---|---|
date | Fri, 02 Apr 2010 23:11:57 +0700 |
parents | |
children |
line wrap: on
line source
using System; namespace defical_cli { public partial class Program { private partial class main { private void getInput() { int min, def; if (graphType == "") { while (true) { Console.Write("Available graph type:\n1. Wheel\n2. Fan\n3. Double Fan\nGraph type (default: 1): "); if (!parseGraphType(Console.ReadKey().KeyChar)) { Console.Write("\nInvalid graph type.\n"); } else { Console.Write("\n"); break; } } } if (numVer == -1) { while (true) { min = 5; def = 10; Console.Write("Number of vertices (default: {0}): ", def); if (!parseNum(Console.ReadLine(), min, def, out this.numVer)) { Console.Write("Invalid number of vertices.\nPlease enter number with minimum of {0}.", min); } else { break; } } } if (numDef == -1) { while (true) { min = 0; def = 2; Console.Write("Number of deficiencies (default: {0}): ", def); if (!parseNum(Console.ReadLine(), min, def, out this.numDef)) { Console.Write("Please enter number (or press enter to use default)."); } else { break; } } } if (algorithm == "") { while (true) { Console.Write("Available algorithm:\n1. Backtrack\nYour choice (default: 1): "); if (!parseAlgo(Console.ReadKey().KeyChar)) { Console.Write("\nInvalid algorithm.\n"); } else { Console.Write("\n"); break; } } Console.Write("\n"); } } } } }