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(string, 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}");
   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 знову.

 Українська