-
Notifications
You must be signed in to change notification settings - Fork 0
/
bin.js
33 lines (26 loc) · 1.01 KB
/
bin.js
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
#!/usr/bin/env node
var krkrsvchk = require('./krkrsvchk');
var fs = require('fs');
if (process.argv.length != 3) {
console.log('Usage: krkrsvchk savedata.ksd/kdt');
process.exit(1);
}
var filename = process.argv[2];
var file = new Uint8Array(fs.readFileSync(filename));
var result = krkrsvchk.check(file);
console.log(result.code);
if (result.code==krkrsvchk.OK)
console.log(filename+' may be safe to load.');
if (result.code==krkrsvchk.BYTE_CODE)
console.log(filename+' is byte code.');
if (result.code==krkrsvchk.FORMAT_ERROR)
console.log('Failed to parse. '+filename+' may be custom format.');
if (result.code==krkrsvchk.PARSE_ERROR)
console.log('Failed to parse. '+filename+' may contain scripts.');
if (result.code==krkrsvchk.MACRO)
console.log(filename+' contains macros.');
if (result.code==krkrsvchk.THUMBNAIL)
console.log(filename+' contains a thumbnail. Save data with a thumbnail are not supported');
console.log('[detail]');
console.log(result.detail);
process.exit(result.code==krkrsvchk.OK ? 0 : 1);