-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommandResolver.cs
37 lines (31 loc) · 965 Bytes
/
CommandResolver.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RSA
{
class CommandResolver
{
private const int COMMAND_ENCRYPT = 1;
private const int COMMAND_DECRYPT = 2;
private const int COMMAND_GENERATE = 3;
private const int COMMAND_EXIT = 4;
public Command getCommand(int status)
{
switch (status)
{
case COMMAND_ENCRYPT:
return new EncryptCommand();
case COMMAND_DECRYPT:
return new DecryptCommand();
case COMMAND_EXIT:
return new ExitCommand();
case COMMAND_GENERATE:
return new RSAKeyGeneratorCommand();
default:
throw new CommandNotFoundException($"Command with status {status} not found!");
}
}
}
}