-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
52 lines (38 loc) · 1.1 KB
/
Copy pathProgram.cs
File metadata and controls
52 lines (38 loc) · 1.1 KB
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
42
43
44
45
46
47
48
49
50
51
52
using ActorMapReduceWordCount.Actors;
using ActorMapReduceWordCount.Messages;
using Akka.Hosting;
using Microsoft.Extensions.Hosting;
var file = PrintInstructionsAndGetFile();
if (file.Length == 0)
{
return;
}
var system = ActorSystem.Create("helloAkka");
var counter = system.ActorOf(CountSupervisor.Create(), "supervisor");
counter.Tell(new StartCount(file));
Console.ReadLine();
static String PrintInstructionsAndGetFile()
{
Console.WriteLine("Word counter. Select the document to count:");
Console.WriteLine(" (1) Magna Carta");
Console.WriteLine(" (2) Declaration of Independence");
var choice = Console.ReadLine() ?? String.Empty;
String path = @"C:\code\git\akka\ActorWordCounterMR1_5\src\ActorWordCounterMR1_5.App\Files\";
if (choice.Equals("1"))
{
return $"{path}MagnaCarta.txt";
}
else if (choice.Equals("2"))
{
return $"{path}DeclarationOfIndependence.txt";
}
else if (choice.Equals("3"))
{
return $"{path}test.txt";
}
else
{
Console.WriteLine("Invalid -- bye!");
return String.Empty;
}
}