GW2RegisterLicenceMemory
GW2RegisterLicenceMemory memory में रखी licence file को एक session में 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
सारांश
session session के लिए, GW2RegisterLicenceMemory function उस licence को register करता है जिसका उपयोग Glasswall files को process करते समय करेगा। licenceContents licence data का pointer है, और licenceLength licence data का आकार bytes में निर्दिष्ट करता है।
#include "glasswall.core2.api.h"
int GW2RegisterLicenceMemory(Session session,
const char *licenceContents,
size_t licenceLength);
रिटर्न
एक पूर्णांक GW2_RetStatus enum मान लौटाता है। नकारात्मक संख्याएँ विफलता को दर्शाती हैं।
उदाहरण
#include "glasswall.core2.api.h"
Session session = GW2OpenSession();
char *licence = NULL;
size_t size = 0;
if (!session)
/* deal with error */
else
{
/* ... load 'licence' with a pointer to the licence content ... */
if (GW2RegisterLicenceMemory(session, licence, size) < 0)
/* deal with error */
else
/* continue processing */
}
. . .
/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */
सारांश
session session के लिए, RegisterLicenceMemory method उस licence को register करता है जिसका उपयोग Glasswall files को process करते समय करेगा।
/// <summary>
/// Provide a licence to use for the session.
/// </summary>
/// <param name="session">Current open Glasswall session</param>
/// <param name="licence">Byte content of the licence</param>
public int RegisterLicenceMemory(int session, byte[] licence)
रिटर्न
एक पूर्णांक GW2_RetStatus enum मान लौटाता है। नकारात्मक संख्याएँ विफलता को दर्शाती हैं।
सारांश
import com.glasswall.core2javabridge.*;
public int GW2RegisterLicenceMemory(int session, byte[] licenceBuffer) throws GlasswallException, NullPointerException
public int GW2RegisterLicenceMemory(int session, byte[] licenceBuffer, int licenceLength) throws GlasswallException, NullPointerException
नोट
The length of the licenceBuffer may optionally be specified.
रिटर्न
GW2RegisterLicenceMemory function, GW2_RetStatus enumeration को int में convert करके लौटाता है। यदि कोई error हुई हो तो मान negative होगा। 0 सफलता को दर्शाता है। विवरण के लिए API Overview/Return types देखें।
A GlasswallException exception will be thrown if session is invalid.
A NullPointerException exception will be thrown if licenceBuffer buffer is null or empty.
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
)
सारांश
session session के लिए, GW2RegisterLicenceMemory function उस licence को register करता है जिसका उपयोग Glasswall files को process करते समय करेगा। licenceContents licence data का pointer है, और licenceLength licence data का आकार bytes में निर्दिष्ट करता है।
/**
* Provides the contents of the licence file that will be used for this session.
* @param {number} session The ID of the session.
* @param {string} licenceContents A pointer to the licence data buffer.
* @param {number} licenceLength Length of the data in the licence buffer.
* @returns {number} Status of the operation; 0 for success, non-zero for failure.
*/
GW2RegisterLicenceMemory(session, licenceContents, licenceLength)
रिटर्न
एक पूर्णांक GW2_RetStatus enum मान लौटाता है। नकारात्मक संख्याएँ विफलता को दर्शाती हैं।