Mercurial > defical
diff 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defical-sharp/defical-cli/inputparser.cs Fri Apr 02 23:11:57 2010 +0700 @@ -0,0 +1,80 @@ +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"); + } + } + } + } +} \ No newline at end of file