This repository was archived by the owner on Jan 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.h
More file actions
84 lines (77 loc) · 2.87 KB
/
menu.h
File metadata and controls
84 lines (77 loc) · 2.87 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
78
79
80
81
82
83
84
// -*- C++ -*-
//===---------------------------- adb.h ----------------------------------===//
//
// Part of the EasyADB Project, under the GNU GPL License v3.
// See https://github.com/nu11plex/EasyADBCLI/LICENSE for license information.
//
//===----------------------------------------------------------------------===//
//
// Created by nu11plex on 2020/10/8.
//
// menu.h:Main menu of EasyADBCLI.
#include <iostream>
#include <cstring>
#ifndef EASYADBCLI_MENU_H
#define EASYADBCLI_MENU_H
#define __AUTHOR__ "nu11plex"
class menu {
public:
void chinese() {
std::cout << "欢迎使用EasyADB CLI模式!" << std::endl
<< "发布日期:" << getCompileDate()<< ",由" << __AUTHOR__ << "编写。" << std::endl
<< "编译日期:" << getCompileDate() << " " << __TIME__ << std::endl
<< "版本 " << getReleaseVersion() << "." << std::endl
<< "选项:" << std::endl
<< "1.安装apk" << std::endl
<< "0.选择语言";
}
void english() {
std::cout << "Hello from EasyADB CLI mode!" << std::endl
<< "Release at:" << getCompileDate() << ",by " << __AUTHOR__ << "." << std::endl
<< "Compile at:" << getCompileDate() << " " << __TIME__ << std::endl
<< "Version " << getReleaseVersion() << "." << std::endl
<< "Select option:" << std::endl
<< "1.Install package" << std::endl
<< "0.Switch language" << std::endl ;
}
void languageChooser() {
std::cout << "Choose language/选择语言" << std::endl
<< "1.English" << std::endl
<< "2.Chinese" << std::endl;
int opt;
std::cin >> opt;
switch (opt) {
case 1:
english();
break;
case 2:
chinese();
break;
default:
break;
}
}
private:
void getCompileDateBase(uint8_t *Year, uint8_t *Month, uint8_t *Day) {
const char *pMonth[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
const char Date[12] = __DATE__;
uint8_t i;
for (i = 0; i < 12; i++)if (memcmp(Date, pMonth[i], 3) == 0)*Month = i + 1, i = 12;
*Year = (uint8_t) atoi(Date + 9);
*Day = (uint8_t) atoi(Date + 4);
}
char g_date_buf[10];
char *getCompileDate(void) {
uint8_t Year, Month, Day;
getCompileDateBase(&Year, &Month, &Day);
sprintf(g_date_buf, "%02d20/%02d/%02d", Year, Month, Day);
return g_date_buf;
}
char *getReleaseVersion(void){
uint8_t Year, Month, Day;
getCompileDateBase(&Year, &Month, &Day);
sprintf(g_date_buf, "1.%02d.%02d", Month, Day);
return g_date_buf;
}
} menu;
#endif //EASYADBCLI_MENU_H