GW2RegisterImportMemory
Hàm GW2RegisterImportMemory đăng ký vị trí bộ nhớ chứa tệp trao đổi cần thiết cho việc nhập. Tệp trao đổi là tệp zip được tạo ra từ quy trình xuất và vị trí bộ nhớ được cung cấp bởi GW2RegisterExportMemory. Việc sử dụng hàm GW2RegisterImportMemory sẽ kích hoạt Chế độ Quy trình Nhập cho session.
- C++
- C#
- Java
- Python
- JavaScript
#include "glasswall.core2.api.h"
int GW2RegisterImportMemory(Session session, char *importFileBuffer, size_t *importLength);
Tham số
session ID của session như được trả về bởi GW2OpenSession.
importFileBuffer Vị trí bộ nhớ chứa tệp trao đổi cần thiết cho việc nhập. Vị trí bộ nhớ được cung cấp bởi GW2RegisterExportMemory và tệp phải tuân thủ định dạng tệp trao đổi.
importLength Độ dài của importFileBuffer tính bằng byte
Giá trị trả về
Trả về một số nguyên cho biết liệu lời gọi hàm có thành công hay không. Các số âm biểu thị thất bại. Xem bảng Return Types để biết giải thích về các mã trả về.
Tóm tắt
public int RegisterImportMemory(
int session,
byte[] importFileBuffer)
Giá trị trả về
Trả về một giá trị enum GW2_RetStatus dạng số nguyên. Các số âm cho biết thất bại.
Tóm tắt
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
Lưu ý
Tham khảo API Overview/Return types để biết các giá trị liệt kê hợp lệ cho format.
length của fileBuffer có thể được chỉ định tùy chọn.
Giá trị trả về
Hàm GW2RegisterImportMemory trả về một giá trị liệt kê GW2_RetStatus được chuyển đổi thành int. Giá trị sẽ là số âm nếu xảy ra lỗi. 0 cho biết thành công. Tham khảo API Overview/Return types để biết chi tiết.
Một ngoại lệ GlasswallException sẽ được ném ra nếu session không hợp lệ, hoặc nếu không thể truy xuất bộ đệm nhập.
Một ngoại lệ NullPointerException sẽ được ném ra nếu bộ đệm importBuffer là null hoặc rỗng.
Tóm tắt
Đăng ký một tệp .zip để nhập cho session đã cho. Tệp được tạo sẽ được tạo trong lệnh gọi run_session của 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.
"""
Giá trị trả về
gw_return_object (glasswall.GwReturnObj): Một thể hiện GwReturnObj với thuộc tính 'status' cho biết kết quả của lệnh gọi hàm. Nếu output_file là None (chế độ bộ nhớ), 'buffer' và 'buffer_length' sẽ được bao gồm, chứa nội dung tệp và kích thước tệp.
Thuộc tính status là một giá trị enum GW2_RetStatus kiểu số nguyên. Các số âm cho biết thất bại.
Tóm tắt
Hàm này đăng ký một vị trí bộ nhớ nhập với một session được chỉ định.
/**
* @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)
Giá trị trả về
Thuộc tính status là một giá trị enum GW2_RetStatus kiểu số nguyên. Các số âm cho biết thất bại.