/// <summary> /// Write the license. /// </summary> /// <param name="licenseInfo"><see cref="LicenseInformation"/> object contains the license information.</param> /// <param name="path">Path where the license file must be written.</param> internal string _Write(LicenseInformation licenseInfo, string path) { string info = licenseInfo; string encryptedInfo = Cryptography.Encrypt(info, _encryptionKey); string fullPath = ""; string licenseFile = ""; int ndxExtention = _licenseFileName.LastIndexOf(_extention); licenseFile = _licenseFileName.Substring(0, ndxExtention) + "." + licenseInfo.Product.ProductCode.ToString() + licenseInfo.Product.MajorVersion.ToString() + _extention; if (path != null && path.Trim() != "") { fullPath += path; if (path.Substring(path.Length - 1, 1) != @"\" && path.Substring(path.Length - 1, 1) != @"/") { fullPath += @"\"; } fullPath += licenseFile; } else { fullPath = licenseFile; } StreamWriter sw = new StreamWriter(fullPath, false); sw.Write(encryptedInfo); sw.Close(); return(fullPath); }
public LicenseStatus(LicenseError errorType, bool isRegistered, LicenseInformation info, string errorMessage) { _info = info; _isRegistered = isRegistered; _errorType = errorType; _errorMessage = errorMessage; }
/// <summary> /// Initialize the <see cref="License"/>. /// </summary> /// <param name="licenseInfo">Information about the license.</param> /// <param name="globalAssemblyKeyName">Name of the key in the registry.</param> private void _Init(LicenseInformation licenseInfo, string globalAssemblyKeyName) { if (licenseInfo == null) { licenseInfo = new LicenseInformation(); } _licenseInfo = licenseInfo; _globalAssemblyKeyName = globalAssemblyKeyName; }
/// <summary> /// Create a <see cref="License"/> object from the <see cref="LicenseInformation"/> object and the global assembly key name. /// </summary> /// <param name="licenseInfo">Information about the license.</param> /// <param name="globalAssemblyKeyName">Name of the key in the registry.</param> public License(LicenseInformation licenseInfo, string globalAssemblyKeyName) { _Init(licenseInfo, globalAssemblyKeyName); }
/// <summary> /// Create a <see cref="License"/> object from the <see cref="LicenseInformation"/> object. /// </summary> /// <param name="licenseInfo">Information about the license.</param> public License(LicenseInformation licenseInfo) { _Init(licenseInfo, ""); }
/// <summary> /// Read the license file. /// </summary> /// <param name="productCode">Product code.</param> /// <param name="majorVersion">Major version.</param> /// <param name="licenseKey">The license key.</param> public void Read(ProductCode productCode, int majorVersion, string licenseKey) { _licenseInfo = _Read(productCode, majorVersion, licenseKey); }