activateSerialKey static method

void activateSerialKey(
  1. String? hardwareCode,
  2. String? serialKey,
  3. String? commentary,
  4. String? path
)

Activates a license using a serial key and saves the license to a file.

param hardwareCode The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function. param serialKey The serial key to activate. param commentary Commentary associated to this license activation, generally the host name. param path Path to the license file. throws FaceException An error has occurred during Face Library execution.

Implementation

static void activateSerialKey(String? hardwareCode, String? serialKey, String? commentary, String? path) {
  Pointer<Char>? pHardwareCode = hardwareCode?.toNativeUtf8().cast<Char>();
  Pointer<Char>? pSerialKey = serialKey?.toNativeUtf8().cast<Char>();
  Pointer<Char>? pCommentary = commentary?.toNativeUtf8().cast<Char>();
  Pointer<Char>? pPath = path?.toNativeUtf8().cast<Char>();
  try {
    var err = faceSDK.id3FaceLicense_ActivateSerialKey(pHardwareCode ?? nullptr, pSerialKey ?? nullptr, pCommentary ?? nullptr, pPath ?? nullptr);
    if (err != FaceError.success.value) {
      throw FaceException(err);
    }
  } finally {
    if (pHardwareCode != null) {
      calloc.free(pHardwareCode);
    }
    if (pSerialKey != null) {
      calloc.free(pSerialKey);
    }
    if (pCommentary != null) {
      calloc.free(pCommentary);
    }
    if (pPath != null) {
      calloc.free(pPath);
    }
  }
}