按需许可
Contents
[
Hide
]Aspose.CAD 允许开发人员应用按需密钥。这是一种新的许可机制。新的许可机制将与现有的许可方法一起使用。那些希望根据 API 功能的使用情况进行计费的客户可以使用按需许可。有关更多详细信息,请参阅 按需许可常见问题解答 部分。
按需许可
以下是使用 Metered 类的简单步骤。
- 创建 Metered 类的实例。
- 将公钥和私钥传递给 SetMeteredKey 方法。
- 进行处理(执行任务)。
- 调用 Metered 类的 GetConsumptionQuantity 方法。
- 它将返回到目前为止您已使用的 API 请求的数量。
以下是演示如何设置按需公钥和私钥的示例代码。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()); | |