GW2RegisterLicenceFile
GW2RegisterLicenceFile किसी session में licence file को register करता है।
यदि GW2RegisterLicenceFile या GW2RegisterLicenceMemory में से कोई भी session के साथ registered नहीं है, तो Editor default location में licence खोजने का प्रयास करेगा। यह gwkey.lic नाम की एक file है, जो Editor library के उसी folder में स्थित होती है। यदि यह नहीं मिलती है, तो library को unlicenced माना जाएगा और कुछ processes licence expiry issues के साथ fail हो सकती हैं।
- C++
- C#
- Java
- Python
- JavaScript
सारांश
GW2RegisterLicenceFile function अनुरोध करता है कि session session उस licence का उपयोग करे जो उस file में निर्दिष्ट है जिसका नाम filename द्वारा point की गई string है। यह Licence उस session के लिए Glasswall द्वारा किए गए सभी processing पर लागू होगा।
#include "glasswall.core2.api.h"
int GW2RegisterLicenceFile(Session session, const char *filename);
रिटर्न
एक पूर्णांक GW2_RetStatus enum मान लौटाता है। नकारात्मक संख्याएँ विफलता को दर्शाती हैं।
उदाहरण
#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 method अनुरोध करता है कि session session उस licence का उपयोग करे जो उस file में निर्दिष्ट है जिसका नाम filename द्वारा point की गई string है। यह Licence उस session के लिए Glasswall द्वारा किए गए सभी processing पर लागू होगा।
/// <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 enum मान लौटाता है। नकारात्मक संख्याएँ विफलता को दर्शाती हैं।
सारांश
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 enumeration को int में परिवर्तित करके लौटाता है। यदि कोई त्रुटि हुई है, तो मान नकारात्मक होगा। 0 सफलता को दर्शाता है। विवरण के लिए API Overview/Return types देखें।
A NullPointerException exception will be thrown if licenceFilePath is null or empty.
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 wrapper में प्रत्येक session के लिए licence registration अपने-आप संभाला जाता है, और उपयोगकर्ताओं के लिए 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")
वैकल्पिक रूप से, आप licence data को in-memory रूप में bytes, bytearray, या io.BytesIO object के रूप में पास कर सकते हैं।
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 method अनुरोध करता है कि session session उस licence का उपयोग करे जो उस file में निर्दिष्ट है जिसका नाम filename द्वारा point की गई string है। यह Licence उस session के लिए Glasswall द्वारा किए गए सभी processing पर लागू होगा।
/**
* 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 enum मान लौटाता है। नकारात्मक संख्याएँ विफलता को दर्शाती हैं।