Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request #11

Open
xmenxwk opened this issue Nov 26, 2024 · 3 comments
Open

Feature Request #11

xmenxwk opened this issue Nov 26, 2024 · 3 comments

Comments

@xmenxwk
Copy link

xmenxwk commented Nov 26, 2024

Upon further usage, I came to realize BaseLicense.Features is <string, bool> which is good for true/false features, but sometimes there are other types. I would suggest using something more flexible like byte[], you can store any data in it.

Also about Features.Key, its string, since both license generator app and license validator app will share a common id, I would suggest using an integer as key, it will reduce file size of license if there are many features. Having string key seems to give no benefit.

Something like this


        Dictionary<int, byte[]> Features = new();
        public static byte[]? GetFeature(int featureId)
        {
            if (Current is null)
                return null;//or throw exception

            if (Current.Features.TryGetValue(featureId, out byte[]? features))
                return features;

            return null;
        }

        public static bool IsFeatureEnabled(int featureId)
        {
            byte[]? data = GetFeature(featureId);

            if (data is not null && data.Length == 1)
                return Convert.ToBoolean(data[0]);

            return false;//or throw exception
        }
@xmenxwk
Copy link
Author

xmenxwk commented Dec 23, 2024

....

@LSXPrime
Copy link
Owner

LSXPrime commented Dec 24, 2024 via email

@xmenxwk
Copy link
Author

xmenxwk commented Dec 26, 2024

Great. Looking for update. I'm more interested in byte[] as I m using such stuff everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants