Mercurial > defical
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ebed2bd0d300 |
---|---|
1 using System; | |
2 | |
3 namespace defical_cli | |
4 { | |
5 public partial class Program | |
6 { | |
7 private partial class main | |
8 { | |
9 private void getInput() | |
10 { | |
11 int min, def; | |
12 if (graphType == "") | |
13 { | |
14 while (true) | |
15 { | |
16 Console.Write("Available graph type:\n1. Wheel\n2. Fan\n3. Double Fan\nGraph type (default: 1): "); | |
17 if (!parseGraphType(Console.ReadKey().KeyChar)) | |
18 { | |
19 Console.Write("\nInvalid graph type.\n"); | |
20 } | |
21 else | |
22 { | |
23 Console.Write("\n"); | |
24 break; | |
25 } | |
26 } | |
27 } | |
28 if (numVer == -1) | |
29 { | |
30 while (true) | |
31 { | |
32 min = 5; def = 10; | |
33 Console.Write("Number of vertices (default: {0}): ", def); | |
34 if (!parseNum(Console.ReadLine(), min, def, out this.numVer)) | |
35 { | |
36 Console.Write("Invalid number of vertices.\nPlease enter number with minimum of {0}.", min); | |
37 } | |
38 else | |
39 { | |
40 break; | |
41 } | |
42 } | |
43 } | |
44 if (numDef == -1) | |
45 { | |
46 while (true) | |
47 { | |
48 min = 0; def = 2; | |
49 Console.Write("Number of deficiencies (default: {0}): ", def); | |
50 if (!parseNum(Console.ReadLine(), min, def, out this.numDef)) | |
51 { | |
52 Console.Write("Please enter number (or press enter to use default)."); | |
53 } | |
54 else | |
55 { | |
56 break; | |
57 } | |
58 } | |
59 } | |
60 if (algorithm == "") | |
61 { | |
62 while (true) | |
63 { | |
64 Console.Write("Available algorithm:\n1. Backtrack\nYour choice (default: 1): "); | |
65 if (!parseAlgo(Console.ReadKey().KeyChar)) | |
66 { | |
67 Console.Write("\nInvalid algorithm.\n"); | |
68 } | |
69 else | |
70 { | |
71 Console.Write("\n"); | |
72 break; | |
73 } | |
74 } | |
75 Console.Write("\n"); | |
76 } | |
77 } | |
78 } | |
79 } | |
80 } |