-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeqEditor.seq
104 lines (74 loc) · 1.88 KB
/
SeqEditor.seq
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#! A basic text editor written in Sequence, called SeqEditor.
#! Global variables:
string globalPath = "";
string readFileContents = "";
integer menuSelection = 0;
#! Print the startup menu and handle events.
printhandleMenu(){
println("");
println("SeqEditor========================>");
println("");
println("1 = New File");
println("2 = Open File");
println("3 = Exit");
print("Enter your selection: ");
input = menuSelection;
if(menuSelection == 1){
#! Create a new file
run editorNewFile("");
} else {
if(menuSelection == 2){
#! Open a new file with a "dialog"
println("Open file====================>");
string fileToOpen = "";
print("Enter path of the file to open: ");
input = fileToOpen;
globalPath = fileToOpen;
run readtext(fileToOpen);
} else {
if(menuSelection == 3){
#! Exit. Do nothing.
} else {
println("Invalid option. Please try again.");
run printhandleMenu();
}
}
}
}
#! Handle reading/writing to files.
readtext(string pathrecieved){
#! Read from the file.
string readPath = pathrecieved;
fileread = pathrecieved;
readFileContents = pathrecieved;
run editor(readFileContents);
}
#! Prints the text-editing menu.
printtexteditingmenu(string path){
}
editorNewFile(string fileContents){
println("");
println("Type \x to exit==========================>");
println("");
println(fileContents);
string content = "";
inputConsecutive = content;
println(globalPath);
filewrite = content;
}
editor(string fileContents){
println("");
println("Type \x to exit==========================>");
println("");
println(fileContents);
string content = "";
inputConsecutive = content;
println(globalPath);
clearfile = globalPath;
filewrite = fileContents;
filewrite = content;
}
#! Main class
program() {
run printhandleMenu();
}