Skip to content

Commit

Permalink
Merge pull request #18 from cryptlex/ahmad/unlimited-syntax
Browse files Browse the repository at this point in the history
Unlimited syntax
  • Loading branch information
ahmad-kemsan committed Aug 6, 2024
2 parents 7e2407e + 3d9adbf commit 4ec8769
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/Cryptlex.LexFloatClient/LexFloatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ public static string GetHostLicenseMetadata(string key)
/// <returns>Returns the values of meter attribute allowed and total uses.</returns>
public static HostLicenseMeterAttribute GetHostLicenseMeterAttribute(string name)
{
uint allowedUses = 0, totalUses = 0, grossUses = 0;
long allowedUses = 0;
ulong totalUses = 0, grossUses = 0;
int status;
if (LexFloatClientNative.IsWindows())
{
Expand Down
6 changes: 3 additions & 3 deletions src/Cryptlex.LexFloatClient/LexFloatClientNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ public static bool IsWindows()
public static extern int GetHostLicenseMetadataA(string key, StringBuilder value, int length);

[DllImport(DLL_FILE_NAME, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetHostLicenseMeterAttribute(string name, ref uint allowedUses, ref uint totalUses, ref uint grossUses);
public static extern int GetHostLicenseMeterAttribute(string name, ref long allowedUses, ref ulong totalUses, ref ulong grossUses);

[DllImport(DLL_FILE_NAME, CharSet = CharSet.Ansi, EntryPoint = "GetHostLicenseMeterAttribute", CallingConvention = CallingConvention.Cdecl)]
public static extern int GetHostLicenseMeterAttributeA(string name, ref uint allowedUses, ref uint totalUses, ref uint grossUses);
public static extern int GetHostLicenseMeterAttributeA(string name, ref long allowedUses, ref ulong totalUses, ref ulong grossUses);

[DllImport(DLL_FILE_NAME, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetHostLicenseExpiryDate(ref uint expiryDate);
Expand Down Expand Up @@ -182,7 +182,7 @@ public static bool IsWindows()
public static extern int GetHostLicenseMetadata_x86(string key, StringBuilder value, int length);

[DllImport(DLL_FILE_NAME_X86, CharSet = CharSet.Unicode, EntryPoint = "GetHostLicenseMeterAttribute", CallingConvention = CallingConvention.Cdecl)]
public static extern int GetHostLicenseMeterAttribute_x86(string name, ref uint allowedUses, ref uint totalUses, ref uint grossUses);
public static extern int GetHostLicenseMeterAttribute_x86(string name, ref long allowedUses, ref ulong totalUses, ref ulong grossUses);

[DllImport(DLL_FILE_NAME_X86, CharSet = CharSet.Unicode, EntryPoint = "GetHostLicenseExpiryDate", CallingConvention = CallingConvention.Cdecl)]
public static extern int GetHostLicenseExpiryDate_x86(ref uint expiryDate);
Expand Down
20 changes: 16 additions & 4 deletions src/Cryptlex.LexFloatClient/LicenseMeterAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,27 @@ namespace Cryptlex
public class HostLicenseMeterAttribute
{

/// <summary>
/// The name of the meter attribute.
/// </summary>
public string Name;

public uint AllowedUses;
/// <summary>
/// The allowed uses of the meter attribute. A value of -1 indicates unlimited allowed uses.
/// </summary>
public long AllowedUses;

public uint TotalUses;
/// <summary>
/// The total uses of the meter attribute.
/// </summary>
public ulong TotalUses;

public uint GrossUses;
/// <summary>
/// The gross uses of the meter attribute.
/// </summary>
public ulong GrossUses;

public HostLicenseMeterAttribute(string name, uint allowedUses, uint totalUses, uint grossUses)
public HostLicenseMeterAttribute(string name, long allowedUses, ulong totalUses, ulong grossUses)
{
this.Name = name;
this.AllowedUses = allowedUses;
Expand Down

0 comments on commit 4ec8769

Please sign in to comment.