การอนุญาตแบบชั่งน้ำหนัก

การอนุญาตแบบชั่งน้ำหนัก

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

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

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

// 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
decimal amountbefore = Aspose.CAD.Metered.GetConsumptionQuantity();
// Display information
Console.WriteLine("Amount Consumed Before: " + amountbefore.ToString());
// Do processing
//Aspose.CAD.FileFormats.Cad.CadImage image = (Aspose.CAD.FileFormats.Cad.CadImage)Aspose.CAD.Image.load("BlockRefDgn.dwg");
// Get metered data amount After calling API
decimal amountafter = Aspose.CAD.Metered.GetConsumptionQuantity();
// Display information
Console.WriteLine("Amount Consumed After: " + amountafter.ToString());