//generate a new map
nextMapId = $dataMapInfos.length;
console.log("mapEdgeTransfer generating: ",nextMapName," id: ",nextMapId);
newMap = {"id":nextMapId,"expanded":true,"name":nextMapName,"order":nextMapId,"parentId":0,"scrollX":1716,"scrollY":1048.3636363636365};
$dataMapInfos.push(newMap);
//copy map file
var path = require('path');
var fs = require('fs');
var sourceFile = path.dirname(process.mainModule.filename)+"/data/Map"+String(nextMapId-1).padZero(3)+".json";
var targetFile = path.dirname(process.mainModule.filename)+"/data/Map"+String(nextMapId).padZero(3)+".json";
fs.createReadStream(sourceFile).pipe(fs.createWriteStream(targetFile));
//save $dataMapInfos file
targetFile = path.dirname(process.mainModule.filename)+"/data/MapInfos.json";
fs.writeFileSync(targetFile, JSON.stringify($dataMapInfos));