private ReadLicenseFrom ( string licensePath, string netsealId ) : NetSeal_Helper.NetSeal.LicenseManager.LicenseFile | ||
licensePath | string | License File Path |
netsealId | string | NetSeal ID |
return | NetSeal_Helper.NetSeal.LicenseManager.LicenseFile |
/// <summary> /// Load your Netseal Licenses /// </summary> private void LoadLocalLicenses() { LoadLocalLicensesV2(); return; this.ltvLicenses.Items.Clear(); Logger.LogInformation("Loading local license(s)"); var licenseReader = new LicenseReader(); if (!Directory.Exists(licenseReader.LocalPath)) { Logger.LogWarning("No license(s) found"); return; } var files = Directory.GetFiles(licenseReader.LocalPath).Where((x) => { var fileName = Path.GetFileNameWithoutExtension(x); return fileName.Length == 32; }); var counter = 0; foreach (var file in files) { try { var fileName = Path.GetFileNameWithoutExtension(file); var dbTuple = IdsDataBase.IDsDataBase[fileName]; var id = dbTuple.Item1; //Netseal ID var programName = dbTuple.Item2; //Netseal program name if (!string.IsNullOrEmpty(id)) { var licenseFile = licenseReader.ReadLicenseFrom(file, id); //Store the license Licenses.Add(licenseFile); programName = !string.IsNullOrEmpty(programName) ? programName : this.txtUnknownProgramName.Text; ltvLicenses.Items.Add(id).SubItems.AddRange(new string[] { programName, licenseFile.GUID, licenseFile.Remember.ToString(), licenseFile.Username, licenseFile.Sha1Password, }); counter++; } } catch { continue; } } Logger.LogInformation("Loaded " + counter + " license(s)"); }