def export_flat_json_data(self, out_folder): json_dir = out_folder utility.prepare_dir(json_dir) for info in self.proto_infos: file_name = info.get_proto_name() json_file = json_dir + '/' + file_name self.save_to_json(json_file, info.get_lower_value())
def export_lua_data(self, out_folder): lua_dir = out_folder lua_dir_list = out_folder + '_list/' utility.prepare_dir(lua_dir) utility.prepare_dir(lua_dir_list) for info in self.proto_infos: self.save_to_lua(lua_dir, info) self.save_to_lua_list(lua_dir_list, info)
def export_flat_script(self): if isinstance(self.script_out_flatbuffer_dic, dict): for k, v in self.script_out_flatbuffer_dic.items(): utility.prepare_dir(v) self.execute_flat_buffer_out_script(k, v) if k == "lua": self.to_faltbuffer_lua_api(v) pass
def export_lua_api(self): api_dir = OutDir_Lua_Api utility.prepare_dir(api_dir) self.export_base_api(api_dir) for msg in self.global_msgs: log("export global lua api file:", msg.get_proto_file_name()) msg.to_lua_api(api_dir) for info in self.proto_infos: msg = info.get_message() log("export lua api file:", msg.get_proto_file_name()) msg.to_lua_api(api_dir)
def export_flat_scheme(self): global_dir = get_export_global_flat_folder() proto_dir = get_export_global_flat_folder() utility.prepare_dir(global_dir) utility.prepare_dir(proto_dir) for msg in self.global_msgs: log("export flat proto file success:", msg.get_proto_file_name()) msg.to_flat_scheme(global_dir) for info in self.proto_infos: msg = info.get_message() log("export flat proto file success:", msg.get_proto_file_name()) msg.to_flat_scheme(proto_dir)
def export_protobuf_data(self, out_folder): self.execute_protoc_out_script('python_out', '.') protobuf_dir = out_folder utility.prepare_dir(protobuf_dir) for info in self.proto_infos: file_name = info.get_proto_name() proto_file = protobuf_dir + '/' + file_name self.save_to_protobuf_data(proto_file, file_name, info.get_value(), info.is_single()) for root, dirs, files in os.walk( script_exporter.get_export_proto_folder()): for name in files: if (name.endswith(".py")): os.remove(os.path.join(root, name))
def export_proto(self): global_dir = get_export_global_proto_folder() proto_dir = script_exporter.get_export_proto_folder() utility.prepare_dir(global_dir) utility.prepare_dir(proto_dir) for msg in self.global_msgs: log("export global protobuf proto file success:", msg.get_proto_file_name()) msg.to_protobuf_proto(global_dir) for info in self.proto_infos: msg = info.get_message() log("export protobuf proto file success:", msg.get_proto_file_name()) msg.to_protobuf_proto(proto_dir)
def export_script(self): if isinstance(self.script_out_dic, dict): for k, v in self.script_out_dic.items(): utility.prepare_dir(v) self.execute_protoc_out_script(k, v)