Class Metered
Class Metered
名称: Aspose.Note 集合: Aspose.Note.dll (25.4.0)
提供设置测量密钥的方法。
public class Metered
Inheritance
继承人
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
在此例子中,将尝试设置标记的公共和私人密钥。
Metered metered = new Metered();
metered.SetMeteredKey("PublicKey", "PrivateKey");
Dim metered As Metered = New Metered
metered.SetMeteredKey("PublicKey", "PrivateKey")
显示如何设置测量许可证。
Metered metered = new Metered();
metered.SetMeteredKey("MyPublicKey", "MyPrivateKey");
Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Pages();
// Load OneNote document and get first child
Document document = new Document(Path.Combine(dataDir, "Aspose.one"));
document.Save(Path.Combine(dataDir, "MeteredLicense.pdf"));
Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");
Constructors
Metered()
public Metered()
Methods
GetConsumptionCredit()
得到消费信用。
public static decimal GetConsumptionCredit()
Returns
返回消耗的信用点数量。
GetConsumptionQuantity()
获取消费文件大小。
public static decimal GetConsumptionQuantity()
Returns
返回消耗的比特数量。
ResetMeteredKey()
删除以前设置许可证。
public void ResetMeteredKey()
SetMeteredKey(字符串, string)
设置公共和私人密钥。
public void SetMeteredKey(string publicKey, string privateKey)
Parameters
publicKey
string
公共钥匙。
privateKey
string
个人钥匙。
Examples
显示如何设置测量许可证。
Metered metered = new Metered();
metered.SetMeteredKey("MyPublicKey", "MyPrivateKey");
Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Pages();
// Load OneNote document and get first child
Document document = new Document(Path.Combine(dataDir, "Aspose.one"));
document.Save(Path.Combine(dataDir, "MeteredLicense.pdf"));
Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");
Remarks
如果您购买测量许可证,则该 API 应该在应用程序启动时被召唤,通常,这就足够了。但是,如果测量未能在24小时内上传消费数据,则许可证将设置为评估状态。为了避免这种情况,您应该定期检查许可证状态 如果是评估状态,请再次呼叫此API。