GW2RegisterImportMemory
Ang GW2RegisterImportMemory function ay nagrerehistro ng lokasyon sa memory na naglalaman ng interchange file na kinakailangan para sa import. Ang interchange file ay ang zip file na ginawa mula sa export process at ang lokasyon sa memory ay ibinibigay ng GW2RegisterExportMemory. Ang paggamit ng GW2RegisterImportMemory function ay nag-a-activate ng Import Process Mode para sa session.
- C++
- C#
- Java
- Python
- JavaScript
#include "glasswall.core2.api.h"
int GW2RegisterImportMemory(Session session, char *importFileBuffer, size_t *importLength);
Mga Parameter
session Ang ID ng session gaya ng ibinalik ng GW2OpenSession.
importFileBuffer Ang lokasyon sa memory na naglalaman ng interchange file na kinakailangan para sa import. Ang lokasyon sa memory ay ibinibigay ng GW2RegisterExportMemory at ang file ay dapat sumunod sa interchange file format.
importLength Ang haba ng importFileBuffer sa bytes
Ibinabalik
Nagbabalik ng integer na nagsasaad kung matagumpay ang function call. Ang mga negatibong numero ay nagsasaad ng failure. Tingnan ang talahanayang Return Types para sa paliwanag ng mga return code.
Buod
public int RegisterImportMemory(
int session,
byte[] importFileBuffer)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Buod
import com.glasswall.core2javabridge.*;
public int GW2RegisterImportMemory(int session, byte[] importBuffer) throws GlasswallException, NullPointerException
public int GW2RegisterImportMemory(int session, byte[] importBuffer, int length) throws GlasswallException, NullPointerException
Tandaan
Sumangguni sa API Overview/Return types para sa mga wastong enumerator para sa format.
Ang length ng fileBuffer ay maaaring tukuyin bilang opsyonal.
Ibinabalik
Ang GW2RegisterImportMemory function ay nagbabalik ng GW2_RetStatus enumeration na kino-convert sa int. Magiging negative ang value kung may naganap na error. Ang 0 ay nagpapahiwatig ng tagumpay. Sumangguni sa API Overview/Return types para sa mga detalye.
Magkakaroon ng GlasswallException exception kung hindi valid ang session, o kung hindi makuha ang import buffer.
Magkakaroon ng NullPointerException exception kung ang importBuffer buffer ay null o walang laman.
Buod
Nirerehistro ang isang .zip file na ii-import para sa ibinigay na session. Ang nabuong file ay gagawin sa panahon ng tawag na run_session ng session.
def register_import(self, session: int, input_file: Union[str, bytes, bytearray, io.BytesIO]):
""" Registers a .zip file to be imported for the given session. The constructed file will be created during the session's run_session call.
Args:
session (int): The session integer.
input_file (Union[str, bytes, bytearray, io.BytesIO]): The input import file path or bytes.
Returns:
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attribute 'status' indicating the result of the function call. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.
"""
Ibinabalik
gw_return_object (glasswall.GwReturnObj): Isang instance ng GwReturnObj na may attribute na 'status' na nagsasaad ng resulta ng function call. Kung ang output_file ay None (memory mode), kasama ang 'buffer' at 'buffer_length' na naglalaman ng nilalaman ng file at laki ng file.
Ang status attribute ay isang integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng failure.
Buod
Ang function na ito ay nagrerehistro ng isang import memory location laban sa isang tinukoy na session.
/**
* @param {number} session The ID of the session.
* @param {string} importFileBuffer A pointer to the specified memory location.
* @param {number} importLength The size of the file buffer.
*/
GW2RegisterImportMemory(session, import_File_Buffer, import_File_Buffer_Length)
Ibinabalik
Ang status attribute ay isang integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng failure.