/// <summary> /// Validates a product, or CD, key that was entered into the Zoo administrator /// console, and returns license data. This data will, in turn, be serialized, /// maintained, and distributed by the Zoo. /// </summary> /// <param name="productKey"> /// The product, or CD, key to validate. This is the raw, unmodified product key /// string as entered into the Zoo Administrator console. /// </param> /// <param name="licenseData"> /// If productKey represents a valid license for your product, then licenseData /// should be filled in with information about the license. /// </param> /// <returns> /// Return 0 on success; the output Message is ignored. /// Return any other number to indicate failure. /// The Zoo will call FormatErrorMessage with the value you return in order to get /// a human-readable error message for display and logging purposes. /// </returns> public int ValidateProductKey(string productKey, out ZooPluginLicenseData licenseData) { // This class contains information about your product's license. licenseData = new ZooPluginLicenseData(); // If this example, we won't do much valiation... if (string.IsNullOrEmpty(productKey)) { return(-1); } // This value will never be display in any user interface. // When your plugin's ValidateProductKey member is called, it is // passed a a product, or CD, key that was entered into the Zoo // administrator console. Your ValidateProductKey will validate // the product key and decode it into a product license. This is // where you can store this license. This value will be passed // to your application at runtime when it requests a license. licenseData.ProductLicense = productKey; // This value will display in user interface items, such as in // the Zoo console and in About dialog boxes. Also, this value // is used to uniquely identify this license. Thus, it is // critical that this value be unique per product key, entered // by the administrator. No other license of this product, as // valided by this plugin, should return this value. // // This example just scrambles the productKey... licenseData.SerialNumber = Scramble(productKey); // This value will display in user interface items, such as in // the Zoo console and in About dialog boxes. // (e.g. "Rhinoceros 5.0", "Rhinoceros 5.0 Commercial", etc.) licenseData.LicenseTitle = "$safeprojectname$ 1.0 Educational"; // The build of the product that this license work with. // When your product requests a license from the Zoo, it // will specify one of these build types. licenseData.BuildType = LicenseBuildType.Release; // Zoo licenses can be used by more than one instance of any application. // For example, a single Rhion Education Lab license can be used by up // to 30 systems simulaneously. If your license supports multiple instance, // then specify the number of supported instances here. Otherwise just // specify a value of 1 for single instance use. licenseData.LicenseCount = 1; // The Zoo supports licenses that expire. If your licensing scheme // is sophisticated enough to support this, then specify the // expiration date here. Note, this value must be speicified in // Coordinated Universal Time (UTC). If your license does not expire, // then just this value to null. licenseData.DateToExpire = null; return(0); }
/// <summary> /// Validates a product, or CD, key that was entered into the Zoo administrator /// console, and returns license data. This data will, in turn, be serialized, /// maintained, and distributed by the Zoo. /// </summary> /// <param name="productKey"> /// The product, or CD, key to validate. This is the raw, unmodified product key /// string as entered into the Zoo Administrator console. /// </param> /// <param name="licenseData"> /// If productKey represents a valid license for your product, then licenseData /// should be filled in with information about the license. /// </param> /// <returns> /// Return 0 on success; the output Message is ignored. /// Return any other number to indicate failure. /// The Zoo will call FormatErrorMessage with the value you return in order to get /// a human-readable error message for display and logging purposes. /// </returns> public int ValidateProductKey(string productKey, out ZooPluginLicenseData licenseData) { // This class contains information about your product's license. licenseData = new ZooPluginLicenseData(); // If this example, we won't do much valiation... if (string.IsNullOrEmpty(productKey)) return -1; // This value will never be display in any user interface. // When your plugin's ValidateProductKey member is called, it is // passed a a product, or CD, key that was entered into the Zoo // administrator console. Your ValidateProductKey will validate // the product key and decode it into a product license. This is // where you can store this license. This value will be passed // to your application at runtime when it requests a license. licenseData.ProductLicense = productKey; // This value will display in user interface items, such as in // the Zoo console and in About dialog boxes. Also, this value // is used to uniquely identify this license. Thus, it is // critical that this value be unique per product key, entered // by the administrator. No other license of this product, as // valided by this plugin, should return this value. // // This example just scrambles the productKey... licenseData.SerialNumber = Scramble(productKey); // This value will display in user interface items, such as in // the Zoo console and in About dialog boxes. // (e.g. "Rhinoceros 5.0", "Rhinoceros 5.0 Commercial", etc.) licenseData.LicenseTitle = "$safeprojectname$ 1.0 Educational"; // The build of the product that this license work with. // When your product requests a license from the Zoo, it // will specify one of these build types. licenseData.BuildType = LicenseBuildType.Release; // Zoo licenses can be used by more than one instance of any application. // For example, a single Rhion Education Lab license can be used by up // to 30 systems simulaneously. If your license supports multiple instance, // then specify the number of supported instances here. Otherwise just // specify a value of 1 for single instance use. licenseData.LicenseCount = 1; // The Zoo supports licenses that expire. If your licensing scheme // is sophisticated enough to support this, then specify the // expiration date here. Note, this value must be speicified in // Coordinated Universal Time (UTC). If your license does not expire, // then just this value to null. licenseData.DateToExpire = null; return 0; }