การอนุญาตแบบมิเตอร์

การอนุญาตแบบมิเตอร์

นี่คือขั้นตอนง่าย ๆ ในการใช้คลาส Metered

  1. สร้างตัวอย่างของคลาส Metered
  2. ส่งคีย์สาธารณะและคีย์ส่วนตัวไปยังวิธีการ SetMeteredKey
  3. ดำเนินการ (ทำงาน)
  4. เรียกวิธี GetConsumptionQuantity ของคลาส Metered
  5. มันจะคืนค่าจำนวน API ที่คุณใช้ไปจนถึงตอนนี้

ต่อไปนี้คือโค้ดตัวอย่างที่แสดงวิธีการตั้งค่าคีย์สาธารณะและคีย์ส่วนตัวแบบมิเตอร์

import aspose.cad as cad
// Access the setMeteredKey property and pass public and private keys as parameters
Aspose.CAD.Metered.SetMeteredKey("PublicKey", "PrivateKey");
// Get metered data amount before calling API
amountbefore = cad.Metered.get_consumption_quantity()
// Display information
print("Amount Consumed Before: " + amountbefore.ToString());
// Do processing
image = cad.Image.load("file.dwg");
// Get metered data amount After calling API
amountafter = cad.Metered.get_consumption_quantity()
// Display information
print("Amount Consumed After: " + amountafter);