Class Metered
Tên không gian: Aspose.Note Tổng hợp: Aspose.Note.dll (25.4.0)
Cung cấp các phương pháp để đặt chìa khóa đo.
public class Metered
{
private double _meteredValue;
public double MeteredValue
{
get => _meteredValue;
set => _meteredValue = value;
}
public void Print()
{
Console.WriteLine(_meteredValue);
}
}
Inheritance
Thành viên thừa kế
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Trong ví dụ này, một nỗ lực sẽ được thực hiện để thiết lập chìa khóa công cộng và tư nhân
Metered metered = new Metered();
metered.SetMeteredKey("PublicKey", "PrivateKey");
Dim metered As Metered = New Metered
metered.SetMeteredKey("PublicKey", "PrivateKey")
Hiển thị cách thiết lập giấy phép đo.
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
Đánh giá ( )
public Metered()
{
}
Methods
Tài khoản tiêu dùng ( )
Nhận tín dụng tiêu dùng
public static decimal GetConsumptionCredit()
{
var consumption = GetTotalConsumption();
var credit = 0m;
if (consumption > MaxConsumption)
credit = MaxAllowableCredit;
else
credit = CalculateCredit(consumption);
return credit;
}
Returns
Trả lại số điểm tín dụng tiêu thụ.
Chất lượng tiêu thụ()
Nhận kích thước tệp tiêu thụ.
public static decimal GetConsumptionQuantity()
{
}
Returns
Quay lại số lượng byte đã tiêu thụ.
Lời bài hát: ResetMeteredKey
Xóa giấy phép cài đặt trước đó.
public void ResetMeteredKey()
{
}
SetMeteredKey (tring, string)
Đặt chìa khóa công cộng và tư nhân.
public void SetMeteredKey(
string publicKey,
string privateKey)
{
}
Parameters
publicKey
string
Chìa khóa công cộng
privateKey
string
Chìa khóa tư nhân
Examples
Hiển thị cách thiết lập giấy phép đo.
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
Nếu bạn mua giấy phép đo, API này nên được gọi trên ứng dụng khởi động, bình thường, điều này là đủ.Tuy nhiên, nếu người đo lường không tải dữ liệu tiêu thụ trong khoảng thời gian 24 giờ, giấy phép sẽ được thiết lập cho trạng thái đánh giá. Để tránh trường hợp như vậy, bạn nên kiểm tra trạng thái giấy phép thường xuyên Nếu đó là trạng thái đánh giá, hãy gọi lại API này.