-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
52 lines (48 loc) · 1.72 KB
/
Main.java
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
import java.util.ArrayList;
public class Main
{
public static void main(String[] args)
{
String host = args[0];
String selector = args.length > 1 ? args[1] : "";
int port= 70;
Core core = new Core();
core.stack = new ArrayList<View>();
core.emptyView = false;
// // Test retrieving gopher menus
// core.request(new MenuLine(ItemType.MENU, "Title", selector, host, port));
// View view = core.getCurrentView();
// if (view.type == ItemType.MENU)
// {
// for (int i = 0; i < ((Menu)view).lines.size(); i++)
// {
// MenuLine line = ((Menu)view).lines.get(i);
// switch (line.type)
// {
// case INFO:
// {
// System.out.println(line.userDisplayString);
// break;
// }
// case MENU:
// {
// System.out.println("📁" + line.userDisplayString + " (" + line.selector + ")");
// break;
// }
// case TEXTFILE:
// {
// System.out.println(line.userDisplayString + " (" + line.selector + ")");
// break;
// }
// }
// }
// }
// Test retrieving text documents
core.request(new MenuLine(ItemType.TEXTFILE, "Title", "comp.sec.300/structure.md", host, port));
View view = core.getCurrentView();
if (view.type == ItemType.TEXTFILE)
{
System.out.println(((TextFile)view).text);
}
}
}