GW2RegisterAnalysisFile
GW2RegisterAnalysisFile ใช้ลงทะเบียนตำแหน่งสำหรับจัดเก็บรายงานการวิเคราะห์ลงดิสก์ให้กับ Session การใช้ฟังก์ชันนี้จะเปิดใช้งานกระบวนการวิเคราะห์สำหรับ Session นี้
- C++
- C#
- Java
- Python
- JavaScript
สรุป
ฟังก์ชัน GW2RegisterAnalysisFile จะจัดเก็บรายงานการวิเคราะห์ที่สร้างจากการเรียกใช้ API function runSession ที่สำเร็จและใช้ session session ลงในไฟล์ที่มีชื่อซึ่งถูกอ้างถึงโดยสตริง analysisFilePath การใช้ฟังก์ชันนี้จะเปิดใช้งานโหมด Analysis Process สำหรับ session นี้
#include "glasswall.core2.api.h"
int GW2RegisterAnalysisFile(Session session,
const char *analysisFilePath,
Analysis_format format);
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
ตัวอย่าง
#include "glasswall.core2.api.h"
Session session = GW2OpenSession();
if (!session)
/* deal with error */
else
if (GW2RegisterAnalysisFile(session, "c:\\analysis_files\\analysis_file_023.xml", AF_XML) < 0)
/* deal with error */
else
/* analysis file registered */
/* later */
if (GW2CloseSession(session))
/* error closing session */
สรุป
public int RegisterAnalysisFile(
int session,
string analysisFilePath,
int analysisFormat)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
import com.glasswall.core2javabridge.*;
public int GW2RegisterAnalysisFile(int session, String analysisFilePath, int format) throws GlasswallException, NullPointerException
(Deprecated)
public int GW2RegisterAnalysisFile(int session, byte[] analysisFilePath, int format) throws GlasswallException, NullPointerException
หมายเหตุ
พารามิเตอร์ของฟังก์ชัน GW2RegisterAnalysisFile ได้รับการอัปเดตให้ใช้ String แทน byte[] แล้ว ฟังก์ชันเดิมถูกเลิกใช้งานแล้ว
โปรดดู API Overview/Return types สำหรับ enumerator ที่ใช้ได้ของ format.
ส่งกลับ
ฟังก์ชัน GW2RegisterAnalysisFile จะส่งคืนค่า enumeration GW2_RetStatus ที่แปลงเป็น int ค่าจะเป็นลบหากเกิดข้อผิดพลาด 0 หมายถึงสำเร็จ โปรดดูรายละเอียดใน API Overview/Return types
จะมีการโยนข้อยกเว้น NullPointerException หาก analysisFilePath เป็น null หรือว่างเปล่า
จะมีการโยนข้อยกเว้น GlasswallException หาก session ไม่ถูกต้อง หรือหากไม่สามารถดึงข้อมูล analysisFilePath ได้
สรุป
ลงทะเบียนไฟล์การวิเคราะห์สำหรับ session ที่กำหนด ไฟล์การวิเคราะห์จะถูกสร้างขึ้นระหว่างการเรียก run_session ของ session
def register_analysis(self, session: int, output_file: Optional[str] = None):
""" Registers an analysis file for the given session. The analysis file will be created during the session's run_session call.
Args:
session (int): The session integer.
output_file (Optional[str]): Default None. The file path where the analysis will be written. None returns the analysis as bytes.
Returns:
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'status', 'session', 'analysis_format'. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size. If output_file is not None (file mode) 'output_file' is included.
"""
ส่งกลับ
gw_return_object (glasswall.GwReturnObj): อินสแตนซ์ของ GwReturnObj ที่มีแอตทริบิวต์ 'status', 'session', 'analysis_format' หาก output_file เป็น None (โหมดหน่วยความจำ) จะมี 'buffer' และ 'buffer_length' รวมอยู่ด้วย ซึ่งประกอบด้วยเนื้อหาไฟล์และขนาดไฟล์ หาก output_file ไม่เป็น None (โหมดไฟล์) จะมี 'output_file' รวมอยู่ด้วย
แอตทริบิวต์ status เป็นค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงความล้มเหลว
สรุป
ฟังก์ชันนี้ลงทะเบียนไฟล์ที่ระบุไว้กับ session ที่ระบุไว้ ตามรูปแบบที่ระบุ
/**
*
* @param {number} session The ID of the session.
* @param {string} analysisFilePathName The path of the file to be registered.
* @param {number} format The specified format.
*/
GW2RegisterAnalysisFile(
session,
analysisFilePathName,
format)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว