-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
71 lines (60 loc) · 1.4 KB
/
main.cpp
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
/*
*Version 1.0
*by Mx, Nov. 30
*/
#include "include/encode.h"
#include "include/decode.h"
//#define DEBUG
//#define DEBUG_COMP//压缩调试
//#define DEBUG_EXTR//解压调试
//#define DEBUG_BOTH//综合调试
int main(int argc, char *argv[])
{
#ifndef DEBUG
if (argc == 4)
{
std::string fileName(argv[2]);
std::string wrtName(argv[3]);
std::string parameter(argv[1]);
if (parameter == "comp")
Encode(fileName, wrtName);
else if (parameter == "extr")
Decode(fileName, wrtName);
}
else
{
std::cout << "Error parameter, exiting..." << std::endl;
Sleep(1000);
exit(1);
}
std::cout << "Success." << std::endl;
system("PAUSE");
return 0;
#endif //DEBUG
//---------------------
#ifdef DEBUG_COMP
Encode("test.txt", "test.comp");
std::cout << "Success." << std::endl;
system("PAUSE");
return 0;
#endif //DEBUG_COMP
//---------------------
#ifdef DEBUG_EXTR
Decode("test.comp", "test.txt");
std::cout << "Success." << std::endl;
system("PAUSE");
return 0;
#endif //DEBUG_EXTR
//---------------------
#ifdef DEBUG_BOTH
std::string str;
std::cin >> str;
if (str=="comp")
Encode("test.txt", "test.comp");
else
Decode("test.comp", "test.txt");
std::cout << "Success." << std::endl;
system("PAUSE");
return 0;
#endif //DEBUG_BOTH
}