GW2RegisterAnalysisFile
GW2RegisterAnalysisFile đăng ký vị trí để lưu báo cáo phân tích trên đĩa vào một Session. Việc sử dụng hàm này sẽ kích hoạt Quy trình Phân tích cho Session.
- C++
- C#
- Java
- Python
- JavaScript
Tóm tắt
Hàm GW2RegisterAnalysisFile lưu vào tệp có tên được chuỗi analysisFilePath trỏ tới báo cáo phân tích được tạo ra bởi lần chạy thành công của hàm API runSession đã sử dụng session session. Việc sử dụng hàm này sẽ kích hoạt Chế độ Quy trình Phân tích cho session.
#include "glasswall.core2.api.h"
int GW2RegisterAnalysisFile(Session session,
const char *analysisFilePath,
Analysis_format format);
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.
Ví dụ
#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 */
Tóm tắt
public int RegisterAnalysisFile(
int session,
string analysisFilePath,
int analysisFormat)
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 GW2RegisterAnalysisFile(int session, String analysisFilePath, int format) throws GlasswallException, NullPointerException
(Deprecated)
public int GW2RegisterAnalysisFile(int session, byte[] analysisFilePath, int format) throws GlasswallException, NullPointerException
Lưu ý
Các tham số của hàm GW2RegisterAnalysisFile đã được cập nhật để sử dụng String thay cho byte[]. Hàm gốc đã bị ngừng dùng.
Tham khảo API Overview/Return types để biết các giá trị liệt kê hợp lệ cho format.
Giá trị trả về
Hàm GW2RegisterAnalysisFile 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ệ NullPointerException sẽ được ném ra nếu analysisFilePath là null hoặc rỗng.
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 analysisFilePath.
Tóm tắt
Đăng ký một tệp phân tích cho session đã cho. Tệp phân tích sẽ được tạo trong lệnh gọi run_session của 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.
"""
Giá trị trả về
gw_return_object (glasswall.GwReturnObj): Một thực thể GwReturnObj với các thuộc tính 'status', 'session', 'analysis_format'. 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. Nếu output_file không phải là None (chế độ tệp) thì 'output_file' sẽ được bao gồm.
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 tệp được chỉ định với một session được chỉ định, theo một định dạng được chỉ định
/**
*
* @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)
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.