Class Metered
Class Metered
名称: Aspose.Note 集合: Aspose.Note.dll (25.4.0)
提供设置测量密钥的方法。
public class Metered
{
private double _meteredValue;
public double MeteredValue
{
get => _meteredValue;
set => _meteredValue = value;
}
public void Print()
{
Console.WriteLine(_meteredValue);
}
}
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 meterered = new Metered();
meterered.SetMeteredKey("MyPublicKey", "MyPrivateKey");
Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");
string dataDir = RunExamples.GetDataDir_Pages();
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
( )
public Metered()
{
}
Methods
信用信用( )
得到消费信用。
public static decimal GetConsumptionCredit()
{
var consumption = GetTotalConsumption();
var credit = 0m;
if (consumption > MaxConsumption)
credit = MaxAllowableCredit;
else
credit = CalculateCredit(consumption);
return credit;
}
Returns
返回消耗的信用点数量。
消费量( )
获取消费文件大小。
public static decimal GetConsumptionQuantity()
{
}
Returns
返回消耗的比特数量。
重定向( )
删除以前设置许可证。
public void ResetMeteredKey()
{
}
SetMeteredKey(条,条)
设置公共和私人密钥。
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}");
string dataDir = RunExamples.GetDataDir_Pages();
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。