新增 - 输入输出编码逻辑

This commit is contained in:
suwings 2018-06-13 19:44:22 +08:00
parent 5c709f94c2
commit 074d8c0419
2 changed files with 17 additions and 0 deletions

View File

@ -4,6 +4,7 @@ const os = require('os');
const properties = require("properties");
const fs = require('fs');
const tools = require('../tools');
class MinecraftServer extends ServerProcess {
@ -17,6 +18,11 @@ class MinecraftServer extends ServerProcess {
this.dataModel.createDate = now; //创建时间
this.dataModel.lastDate = now; //最后启动时间
//输入 输出编码
systemCode = tools.getSystemCodeing();
this.dataModel.ie = systemCode;
this.dataModel.oe = systemCode;
this.dataModel.autoRestart = false; //是否自动重启
this.dataModel.schedule = []; //计划任务配置项目

View File

@ -1,5 +1,7 @@
//工具箱
const os = require("os");
module.exports.getMineTime = () => {
var date = new Date();
return date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
@ -53,4 +55,13 @@ module.exports.mCopyFileSync = (oldpath, newpath) => {
encoding: 'UTF-8'
});
return true;
}
module.exports.getSystemCodeing = () => {
let auto_console_coding;
if (os.platform() == "win32")
auto_console_coding = 'GBK';
else
auto_console_coding = 'UTF-8';
return auto_console_coding;
}