public static void Run() { // ExStart:MeteredLicense // ExFor:Metered // ExFor:Metered.SetMeteredKey // ExSummary:Shows how to set metered license. 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}"); // ExEnd:MeteredLicense }
public void Usage() { //ExStart //ExFor:Metered //ExFor:Metered.#ctor //ExFor:Metered.GetConsumptionCredit //ExFor:Metered.GetConsumptionQuantity //ExFor:Metered.SetMeteredKey(String, String) //ExSummary:Shows how to activate a Metered license and track credit/consumption. // Create a new Metered license, and then print its usage statistics. Metered metered = new Metered(); metered.SetMeteredKey("MyPublicKey", "MyPrivateKey"); Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit()}"); Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity()}"); // Operate using Aspose.Words, and then print our metered stats again to see how much we spent. Document doc = new Document(MyDir + "Document.docx"); doc.Save(ArtifactsDir + "Metered.Usage.pdf"); Console.WriteLine($"Credit after operation: {Metered.GetConsumptionCredit()}"); Console.WriteLine($"Consumption quantity after operation: {Metered.GetConsumptionQuantity()}"); //ExEnd }
public void MeteredUsage() { //ExStart //ExFor:Metered //ExFor:Metered.#ctor //ExFor:Metered.GetConsumptionCredit //ExFor:Metered.GetConsumptionQuantity //ExFor:Metered.SetMeteredKey(String, String) //ExSummary:Shows how to activate a Metered license and track credit/consumption. // Set a public and private key for a new Metered instance Metered metered = new Metered(); metered.SetMeteredKey("MyPublicKey", "MyPrivateKey"); // Print credit/usage Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit()}"); Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity()}"); // Do something Document doc = new Document(MyDir + "Document.doc"); // Print credit/usage to see how much was spent Console.WriteLine($"Credit after operation: {Metered.GetConsumptionCredit()}"); Console.WriteLine($"Consumption quantity after operation: {Metered.GetConsumptionQuantity()}"); //ExEnd }
public void ProcessMeter( MetricName name, Metered meter, TextWriter stream) { var unit = Abbrev(meter.RateUnit); stream.Write( string.Format(_locale, " count = {0}\n", meter.Count)); stream.Write( string.Format( _locale, " mean rate = {0:##.##} {1}/{2}\n", meter.MeanRate, meter.EventType, unit)); stream.Write( string.Format( _locale, " 1-minute rate = {0:##.##} {1}/{2}\n", meter.OneMinuteRate, meter.EventType, unit)); stream.Write( string.Format( _locale, " 5-minute rate = {0:##.##} {1}/{2}\n", meter.FiveMinuteRate, meter.EventType, unit)); stream.Write( string.Format( _locale, " 15-minute rate = {0:##.##} {1}/{2}\n", meter.FifteenMinuteRate, meter.EventType, unit)); }
/// <summary> /// Shows how to set metered public and private key for Dynabic.Metered account /// </summary> public static void SetMeteredKey() { //ExStart:SetMeteredKey Metered matered = new Metered(); matered.SetMeteredKey("PublicKey", "PrivateKey"); //ExEnd:SetMeteredKey }
/// <summary> /// Shows how to use library in licensed mode using Dynabic.Metered account /// </summary> public static void UseDynabicMeteredAccount() { // initialize Metered API Metered metered = new Metered(); // set-up credentials metered.SetMeteredKey(PublicKey, PrivateKey); }
public static void Run() { string publicKey = "*****"; string privateKey = "*****"; Metered metered = new Metered(); metered.SetMeteredKey(publicKey, privateKey); Console.WriteLine("License set successfully."); }
//ExEnd:ApplyLicense //ExStart:metered licensing /// <summary> /// provide metered licensing /// </summary> public static void MeteredLicensing() { // Set metered license public and private keys. Metered metered = new Metered(); metered.SetMeteredKey("PublicKey", "PrivateKey"); // Ensure that the product is licensed. License license = new License(); Debug.Assert(license.IsLicensed); }
public static void Run() { Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------"); Console.WriteLine("[Example Quick Start] # SetMeteredLicense : Set metered license\n"); string publicKey = "*****"; string privateKey = "*****"; Metered metered = new Metered(); metered.SetMeteredKey(publicKey, privateKey); Console.WriteLine("License set successfully."); }
//ExEnd:ApplyLicense //ExStart:metered licensing /// <summary> /// provide metered licensing /// </summary> public static void MeteredLicensing() { // Set metered license public and private keys. Metered metered = new Metered(); metered.SetMeteredKey("PublicKey", "PrivateKey"); //Do something here.... // and get consumption quantity decimal consumptionQuantitiy = GroupDocs.Assembly.Metered.GetConsumptionQuantity(); // get consumption credit (Supported since version 19.7) decimal consumptionCredit = GroupDocs.Assembly.Metered.GetConsumptionCredit(); }
/// <summary> /// Metered licensing /// </summary> public static void MeteredLicense() { //ExStart:MeteredLicense try { string PublicKey = ""; // Your public license key string PrivateKey = ""; // Your private license key Metered metered = new Metered(); metered.SetMeteredKey(PublicKey, PrivateKey); } catch (Exception ex) { Console.WriteLine(ex.Message); } //ExEnd:MeteredLicense }
public void ProcessMeter( MetricName name, Metered meter, Context context) { TextWriter stream = context.Invoke( "# time,count,1 min rate,mean rate,5 min rate,15 min rate"); stream.WriteLine( new StringBuilder() .Append(meter.Count).Append(',') .Append(meter.OneMinuteRate).Append(',') .Append(meter.MeanRate).Append(',') .Append(meter.FiveMinuteRate).Append(',') .Append(meter.FifteenMinuteRate) .ToString() ); stream.Flush(); }
/// <summary> /// Set metered license /// </summary> public static void ApplyMeteredLicense() { try { //ExStart:ApplyMeteredLicense string publicKey = "[Your Dynabic.Metered public key]"; string privateKey = "[Your Dynabic.Metered private key]"; Metered metered = new Metered(); metered.SetMeteredKey(publicKey, privateKey); // Use the library in licensed mode //ExEnd:ApplyMeteredLicense } catch (System.Exception exc) { Console.Write(exc.Message); } }
public void ApplyMeteredLicense() { //ExStart:ApplyMeteredLicense try { Metered metered = new Metered(); metered.SetMeteredKey("*****", "*****"); Document doc = new Document(MyDir + "Document.docx"); Console.WriteLine(doc.PageCount); } catch (Exception e) { Console.WriteLine("\nThere was an error setting the license: " + e.Message); } //ExEnd:ApplyMeteredLicense }
public void WorkWithMeteredLicense() { // ExStart:WorkWithMeteredLicense // ExFor: Metered // ExFor: Metered.ResetMeteredKey // ExFor: Metered.SetMeteredKey(String,String) // ExFor: Metered.GetConsumptionCredit // ExFor: Metered.GetConsumptionQuantity // ExSummary: Shows how to use <see cref="Aspose.Tasks.Metered" /> license type with Aspose.Tasks. // Let's use metered license (see https://purchase.aspose.com/faqs/licensing/metered) // set metered licence var metered = new Metered(); metered.SetMeteredKey("<public key>", "<private key>"); var project = new Project(DataDir + "Project2.mpp"); Console.WriteLine("Project Name: " + project.Get(Prj.Name)); // ... // work with project... // ... // We can get current credits and bytes consumption. try { Console.WriteLine("Credits spent: {0}", Metered.GetConsumptionCredit()); Console.WriteLine("Bytes consumed: {0}", Metered.GetConsumptionQuantity()); } catch (WebException) { // log exception } // lately the user can reset a metered and stop counting of bytes metered.ResetMeteredKey(); // ExEnd:WorkWithMeteredLicense }
//ExEnd:EnumerateMetadata /// <summary> /// shows how to use library in licensed mode using Dynabic.Metered account /// </summary> public static void UseDynabicMeteredAccount() { //ExStart:UseDynabicMeteredAccount // initialize Metered API GroupDocs.Metadata.Metered metered = new Metered(); // set-up credentials metered.SetMeteredKey(publicKey, privateKey); // do some work: // Open Word document DocFormat docFormat = new DocFormat(MapSourceFilePath("Documents/Doc/Metadata_testfile.docx")); // remove hidden metadata docFormat.RemoveHiddenData(new DocInspectionOptions(DocInspectorOptionsEnum.All)); // and get consumption quantity decimal consumptionQuantity = GroupDocs.Metadata.Metered.GetConsumptionQuantity(); //ExEnd:UseDynabicMeteredAccount }
public static void ApplyMeteredLicense() { //ExStart: ApplyMeteredLicense // Create an instance of CAD Metered class Metered metered = new Metered(); // Access the setMeteredKey property and pass public and private keys as parameters metered.SetMeteredKey("*****", "*****"); // Get metered data amount before calling API decimal amountbefore = Metered.GetConsumptionQuantity(); // Display information Console.WriteLine("Amount Consumed Before: " + amountbefore.ToString()); // Get metered data amount After calling API decimal amountafter = Metered.GetConsumptionQuantity(); // Display information Console.WriteLine("Amount Consumed After: " + amountafter.ToString()); //ExEnd: ApplyMeteredLicense }
/// <summary> /// Shows how to use library in licensed mode using Dynabic.Metered account /// </summary> public static void UseDynabicMeteredAccount() { // initialize Metered API Metered metered = new Metered(); // set-up credentials metered.SetMeteredKey(PublicKey, PrivateKey); // do some work: // Load Word document using (Document doc = Redactor.Load(Common.MapSourceFilePath(Conversion_Control_FilePath))) { // Do some redaction RedactionSummary result = doc.RedactWith(new ExactPhraseRedaction("John Doe", new ReplacementOptions(System.Drawing.Color.Red))); // and get consumption quantity decimal consumptionQuantitiy = GroupDocs.Redaction.Metered.GetConsumptionQuantity(); // get consumption credit (Supported since version 19.5) decimal consumptionCredit = GroupDocs.Redaction.Metered.GetConsumptionCredit(); } }
public static void Run() { // ExStart:ExtractText // Create an instance of Metered class Metered matered = new Metered(); // Set public & private keys matered.SetMeteredKey("publicKeyValue", "privateKeyValue"); // Get consumed quantity before calling any API method decimal amountBefore = Metered.GetConsumptionQuantity(); // Display value Console.WriteLine(amountBefore.ToString()); // DO PROCDESSING // The path to the documents directory //string dataDir = RunExamples.GetDataDir_OCR(); // Create an instance of OmrEngine and load the template using file path //OmrEngine omr = new OmrEngine(new OmrTemplate()); //string path = dataDir + "sampleimage.png"; //OmrImage omrImage = OmrImage.Load(path); ////Since upload data is running on another thread, so we need wait some time //Thread.Sleep(10000); // Get consumed quantity after calling any API method decimal amountAfter = Metered.GetConsumptionQuantity(); // Display value Console.WriteLine(amountAfter.ToString()); // ExEnd:ExtractText }
//ExEnd:SetMeteredLicense //ExStart:GetAlreadyUsedCredit /// <summary> /// Number of already used credits /// </summary> public static decimal GetAlreadyUsedCredit() { //Retrieves amount of already used credits return(Metered.GetConsumptionCredit()); }