OSDN Git Service

AppliStation-GUI,設定ダイアログのリンクラベルをUAC向けシールドアイコンを使用するよう変更(Windows7でシールドアイコンが4色になってしまう)
[applistation/AppliStation.git] / all-get / Util.cs
1 using System;\r
2 \r
3 namespace AllGet\r
4 {\r
5         \r
6         sealed class Util\r
7         {\r
8                 public static char Query(string msg, string selections, char defaultSelection)\r
9                 {\r
10                         int resNum = -1;\r
11                         while (resNum < 0) {    \r
12                                 Console.Write(msg);\r
13                                 string response = Console.ReadLine();\r
14                                 response = response.Trim().ToLower();\r
15                                 if (response.Length < 1) return defaultSelection;\r
16                                 resNum = selections.ToLower().IndexOf(response[0]);\r
17                         }\r
18                         return selections[resNum];\r
19                 }\r
20                 \r
21                 public static bool Confirm(string msg, bool defaultSelection)\r
22                 {\r
23                         return Query(msg, "yn", defaultSelection? 'y' : 'n') == 'y';\r
24                 }\r
25         }\r
26 }\r