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
#[allow(dead_code)]
extern "C" {
    fn FileExist(p: i32) -> i32;
    fn PrintLog(level: i32, p: i32) -> i32;
    fn NowTimestamp() -> i64;
}

#[allow(dead_code)]
pub fn file_exist(file_path: &String) -> bool {
    let str_i = super::string::DynamicString::from(file_path.as_bytes()).get_index();
    unsafe {
        if FileExist(str_i) == 0 {
            return false;
        }
    }
    true
}

#[allow(dead_code)]
pub enum PrintLogLevel {
    INFO,
    ERROR,
    DEBUG,
}

#[allow(dead_code)]
pub fn now_timestamp() -> i64 {
    unsafe { NowTimestamp() }
}

#[allow(dead_code)]
pub fn print_log(level: PrintLogLevel, str: &String) {
    let str_i = super::string::DynamicString::from(str.as_bytes()).get_index();
    unsafe {
        PrintLog(level as i32, str_i);
    }
}