-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
72 lines (61 loc) · 1.32 KB
/
main.cpp
File metadata and controls
72 lines (61 loc) · 1.32 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
#include <iostream>
#include <string>
#include "FsFat32.hpp"
using namespace std;
int main(int argc, char** argv)
{
string path = "C:/Users/user/Documents/GitHub/FAT32_Analysis/FAT32_simple.mdf";
if (argc != 1) path = argv[1];
// open an image file
FsFat32 fs(path);
// build a file system
if (fs.build_file_system()) {
cout << "Successfully built a file system" << endl;
}
else {
cout << "Error occured while building a file system" << endl;
return 0;
}
//
bool ing = true;
while (ing)
{
int key = 0;
cout << "Press the number you want to do \n (1: show all the files/ 2: export a file/ 3: quit)" << endl;
cin >> key;
switch (key)
{
case 1:
{
// show all the files and directory
cout << "Show all the files" << endl;
vector<Inode*> v;
fs.show_all(fs.root_node, v);
cout << endl;
break;
}
case 2:
{
// export a file
cout << "Which file do you want to export?" << endl;
string file_path;
cin >> file_path;
if (fs.export_to(file_path)) cout << "Successfully export the file" << file_path << endl;
else cout << "Error occured while exporting the file" << endl;
break;
}
case 3:
{
ing = false;
break;
}
default:
{
cout << key << "is not available key\n Please, press again" << endl;
break;
}
}
}
// close an image file
return 0;
}