-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
41 lines (37 loc) · 1.08 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ISBN
{
class Program
{
static void Main(string[] args)
{
string output;
try
{
switch (args[0].ToLower())
{
case "/validate":
case "/v":
Isbn isbn = new Isbn(args[1]);
output = String.Format("ISBN {0} is {1}", isbn.ToString(), isbn.isValid() ? "valid" : "invalid");
break;
case "/generate":
case "/g":
output = Isbn.Generate().ToString();
break;
default:
throw new ArgumentException("Invalid Argument");
}
}
catch (Exception ex)
{
output = String.Format("Error: {0}", ex.Message);
}
Console.WriteLine(output);
}
}
}