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 Metered

相続人

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

decimal

消費されたクレジットポイントの数を返します。

消費量( )

消費ファイルサイズ

public static decimal GetConsumptionQuantity()
   {
   }

Returns

decimal

消費したバイトの数を返します。

レイアウト( )

以前の設定ライセンスを削除します。

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時間の期間に消費データをアップロードできない場合、ライセンスは評価状態に設定されます。このようなケースを避けるには、定期的にライセンス状態をチェックする必要があります。

 日本語