const protobuf = require('protobufjs'); const parseArgs = require('minimist'); function prettyJsonEncode(obj) { return JSON.stringify(obj, "", " "); } class PBTools { constructor() { this.csMsgIdPb = null; this.csProtoPb = null; this.ssMsgIdPb = null; this.ssProtoPb = null; this.mtPb = null; this.protoDir = './proto/'; } async init() { { this.csProtoPb = await (new protobuf.Root()).load( this.protoDir + 'cs_proto.proto', { 'keepCase': true } ); } { this.csMsgIdPb = await (new protobuf.Root()).load( this.protoDir + 'cs_msgid.proto', { 'keepCase': true } ); this.csCmMsgId = this.csMsgIdPb.lookup('CMMessageId_e'); this.csSmMsgId = this.csMsgIdPb.lookup('SMMessageId_e'); } { this.ssProtoPb = await (new protobuf.Root()).load( this.protoDir + 'ss_proto.proto', { 'keepCase': true } ); } { this.ssMsgIdPb = await (new protobuf.Root()).load( this.protoDir + 'ss_msgid.proto', { 'keepCase': true } ); this.ssSSmMsgId = this.ssMsgIdPb.lookup('SSMMessageId_e'); } { this.mtPb = await (new protobuf.Root()).load( this.protoDir + 'mt.proto', { 'keepCase': true } ); } } } (new PBTools).init();