GW2RegisterImportFile
ฟังก์ชัน GW2RegisterImportFile ลงทะเบียนพาธไฟล์ไปยังไฟล์ interchange (ซึ่งสร้างเป็นเอาต์พุตจากโหมดการประมวลผล export) การใช้ฟังก์ชันนี้จะเปิดใช้งาน Import Process Mode สำหรับ session
- C++
- C#
- Java
- Python
- JavaScript
สรุป
ฟังก์ชัน GW2RegisterImportFile ลงทะเบียนไฟล์ที่มีชื่อซึ่งถูกชี้โดย importFilePath ให้เป็นไฟล์ที่ควรนำเข้า ไฟล์ต้องเป็นไปตามรูปแบบไฟล์ interchange การใช้ฟังก์ชันนี้จะเปิดใช้งาน Import Process Mode สำหรับ session
#include "glasswall.core2.api.h"
int GW2RegisterImportFile(Session session, const char *importFilePath);
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
public int RegisterImportFile(
int session,
string importFilePath)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
import com.glasswall.core2javabridge.*;
public int GW2RegisterImportFile(int session, String importFilePath) throws GlasswallException, NullPointerException
(deprecated)
public int GW2RegisterImportFile(int session, byte[] importFilePath) throws GlasswallException, NullPointerException
หมายเหตุ
พารามิเตอร์ของฟังก์ชัน GW2RegisterImportFile ได้รับการอัปเดตให้ใช้ String แทน byte[] ฟังก์ชันเดิมถูกเลิกใช้งานแล้ว
ส่งกลับ
ฟังก์ชัน GW2RegisterImportFile ส่งคืนค่า enumeration GW2_RetStatus ที่แปลงเป็น int ค่าจะเป็นลบหากเกิดข้อผิดพลาด 0 หมายถึงสำเร็จ โปรดดูรายละเอียดใน API Overview/Return types
ระบบจะโยน exception NullPointerException หาก importFilePath เป็น null หรือว่างเปล่า
ระบบจะโยน exception GlasswallException หาก session ไม่ถูกต้อง, หากไม่สามารถดึงข้อมูล importFilePath ได้, หรือหากไม่สามารถแปลง importFilePath เป็น UTF-8 ได้
สรุป
ลงทะเบียนไฟล์ .zip ที่จะนำเข้าให้กับ session ที่กำหนด ไฟล์ที่สร้างขึ้นจะถูกสร้างระหว่างการเรียก run_session ของ 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.
"""
ส่งกลับ
gw_return_object (glasswall.GwReturnObj): อินสแตนซ์ GwReturnObj ที่มีแอตทริบิวต์ 'status' ระบุผลลัพธ์ของการเรียกใช้ฟังก์ชัน หาก output_file เป็น None (โหมดหน่วยความจำ) จะมี 'buffer' และ 'buffer_length' รวมอยู่ด้วย ซึ่งประกอบด้วยเนื้อหาไฟล์และขนาดไฟล์
แอตทริบิวต์ status เป็นค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงความล้มเหลว
สรุป
ฟังก์ชันนี้ลงทะเบียนพาธไฟล์นำเข้าให้กับ session ที่ระบุ
/**
* @param {number} session The ID of the session.
* @param {string} importFilePath The path of the file to be registered.
*/
GW2RegisterImportFile(session, importFilePath)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว