This repository was archived by the owner on Sep 24, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
77 lines (74 loc) · 2.57 KB
/
main.cpp
File metadata and controls
77 lines (74 loc) · 2.57 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
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
#include <iostream>
#include "./src/Disk/Disk.h"
int main()
{
unsigned int choice{};
std::string filename{}, data{};
std::ofstream file;
lablnet::Disk disk;
disk = lablnet::deserialize_object();
while(true) {
std::cout << "Choose from the option: " << "\n"
<< "1). for create new file.\n"
<< "2). for copy file.\n"
<< "3). for move file.\n"
<< "4). for delete file.\n"
<< "5). for search file.\n"
<< "6). for print hash table.\n"
<< "7). for exit."
<< std::endl;
std::cin >> choice;
switch (choice) {
case 1:
std::cout << "Enter filename you want to create: \n";
std::cin >> filename;
file.open("./temp/"+filename+".txt",std::ios::out);
if(file) {
std::cin.ignore();
std::cout << "Enter the content you want to write?\n";
std::getline (std::cin, data);
file << data;
file.close();
disk.copy("./temp/" + filename + ".txt", "../temp");
lablnet::serialize_object(disk);
}
break;
case 2:
std::cout << "Enter file or directory to copy: \n";
std::cin >> filename;
disk.copy(filename, "../temp");
lablnet::serialize_object(disk);
filename = {};
break;
case 3:
std::cout << "Enter file or directory to move: \n";
std::cin >> filename;
disk.move(filename, "../temp");
lablnet::serialize_object(disk);
filename = {};
break;
case 4:
std::cout << "Enter file or directory to delete: \n";
std::cin >> filename;
disk.remove(filename);
lablnet::serialize_object(disk);
filename = {};
break;
case 5:
std::cout << "Enter file or directory to search: \n";
std::cin >> filename;
disk.search(filename);
filename = {};
break;
case 6:
disk.showTable();
break;
case 7:
exit(0);
default:
std::cout << "Please choose valid option\n";
}
std::cin.ignore();
}
return 0;
}