SessionLicenseControl 1.0.0 License Info
SessionLicenseControl 1.0.0
SessionLicenseControl
Проект предназначен для учёта сессий, и контроля лицензии в ПО При запуске считываются данные из зашифрованного архива и проверяются в зависимости от требований.
Быстрый старт:
для работы с лицензией: создание:
var lic = new LicenseGenerator(Secret, hdd, expirationDate, Ouner, check_sessions);
lic.CreateLicenseFile(LicenseFilePath);
где:
Secret
- secret string to encrypt datahdd
- HDD id of PC where file will useexpirationDate
- Date when license will expireOuner
- for whom the license is createdcheck_sessions
- enable session control in licensesLicenseFilePath
- path, where license file will saved
You can use a console application "LicenseCreator" to create a license
для работы с файлом лицензии:
var controller = new SessionLicenseController(LicenseFilePath, Secret, StartNewSession, "Admin");
если лицензия истекла, или данные были скомпроментированы - на этом этапе вы получите ошибку
чтобы посмотреть данные о лицензии:
controller.License.ToString(); //or controller.License.GetLicenseInformation()
посмотреть данные о сессиях
foreach (var (date_time, sessions) in controller.SessionController.GetSessionData())
{
$"Day: {date_time:dd.MM.yyyy}".ConsoleYellow();
foreach (var session in sessions)
{
session.ConsoleRed();
}
}
как проверить для консоли:
var flag = true;
string row = null;
while (flag)
try
{
var controller = row is null ? new SessionLicenseController(SessionsFilePath, Secret, true, "Admin") : new SessionLicenseController(row, Secret, SessionsFilePath, true, "Admin");
flag = false;
"License information:".ConsoleYellow();
controller.License.ToString().ConsoleRed();
}
catch (Exception)
{
Console.WriteLine("License is bad, Enter license code or add file");
row = Console.ReadLine();
}