GW2RegisterLicenceFile
GW2RegisterLicenceFile は、ライセンスファイルをセッションに登録します。
GW2RegisterLicenceFile と GW2RegisterLicenceMemory のいずれもセッションに登録されていない場合、Editor はデフォルトの場所でライセンスを検索しようとします。これは Editor library と同じフォルダーにある gwkey.lic というファイルです。これが見つからない場合、library はライセンス未登録と見なされ、一部の処理がライセンス有効期限の問題により失敗する可能性があります。
- C++
- C#
- Java
- Python
- JavaScript
概要
GW2RegisterLicenceFile 関数は、セッション session が、filename が指す文字列で名前が指定されたファイル内のライセンスを使用するよう要求します。このライセンスは、そのセッションに対して Glasswall が実行するすべての処理に適用されます。
#include "glasswall.core2.api.h"
int GW2RegisterLicenceFile(Session session, const char *filename);
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
例
#include "glasswall.core2.api.h"
HANDLE session = GW2OpenSession();
if (!session)
/* deal with error */
else
if (GW2RegisterLicenceFile(session, "gwkey.lic") < 0)
/* deal with error */
else
/* the file has been successfully registered */
...
/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */
概要
RegisterLicenceFile メソッドは、セッション session が、filename が指す文字列で名前が指定されたファイル内のライセンスを使用するよう要求します。このライセンスは、そのセッションに対して Glasswall が実行するすべての処理に適用されます。
/// <param name="session">Current open Glasswall session</param>
/// <param name="filePath">The file path to the licence file to be registered</param>
public int RegisterLicenceFile(int session, string filePath)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
概要
import com.glasswall.core2javabridge.*;
public int GW2RegisterLicenceFile(int session, String licenceFilePath) throws GlasswallException, NullPointerException
(Deprecated)
public int GW2RegisterLicenceFile(int session, byte[] licenceFilePath) throws GlasswallException, NullPointerException
注
The GW2RegisterLicenceFile function parameters have been updated to use String in place of byte[]. The original function has been deprecated.
戻り値
GW2RegisterLicenceFile 関数は、GW2_RetStatus 列挙型を int に変換して返します。エラーが発生した場合、値は負になります。0 は成功を示します。詳細については、API Overview/Return types を参照してください。
NullPointerException 例外は、licenceFilePath が null または空の場合にスローされます。
A GlasswallException exception will be thrown if session is invalid, if the licenceFilePath could not be retrieved, or if the licenceFilePath could not be converted to UTF-8.
各セッションのライセンス登録は Python ラッパーで自動的に処理されるため、ユーザーが GW2RegisterLicenceFile または GW2RegisterLicenceMemory を手動で呼び出す必要はありません。
By default, the Editor class expects a valid licence file to be located in the same directory as the library_path. You can also specify a different path to a gwkey.lic licence file using the licence argument.
import glasswall
# Load the Glasswall Editor library with a specified licence file
editor = glasswall.Editor(r"C:\gwpw\libraries\10.0", licence=r"C:\gwpw\licence\gwkey.lic")
または、ライセンスデータを bytes、bytearray、または io.BytesIO オブジェクトとしてメモリ内で渡すこともできます。
import glasswall
# Alternatively, load the licence from in-memory bytes or bytearray
with open(r"C:\gwpw\licence\gwkey.lic", "rb") as f:
licence_data = f.read()
editor = glasswall.Editor(
r"C:\gwpw\libraries\10.0",
licence=licence_data # In-memory licence data
)
概要
RegisterLicenceFile メソッドは、セッション session が、filename が指す文字列で名前が指定されたファイル内のライセンスを使用するよう要求します。このライセンスは、そのセッションに対して Glasswall が実行するすべての処理に適用されます。
/**
* Sets what licence file should be loaded for the session.
* @param {number} session The ID of the session.
* @param {string} filename The filename from which to load the licence.
* @returns {number} Status of the operation; 0 for success, non-zero for failure.
*/
GW2RegisterLicenceFile(session, filename)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。