/// <summary> /// Obtains a license from the application data path and adds it to the <paramref name="licenses"/> if exists. /// </summary> /// <param name="key">The encryption key to verify the license.</param> /// <param name="licenses">The licenses collection.</param> private void AddLicenseFromPaths(RSACryptoServiceProvider key, List <License> licenses) { LicenseFile lic = null; using (Stream stream = FileNames.CreateLicenseFileStream(FileMode.Open, FileAccess.Read, FileShare.Read)) lic = LicenseFile.LoadFile(stream, key); if (lic != null) { licenses.Add(lic); } }
/// <summary> /// Obtains a license from Isolated Storage if exist. /// </summary> /// <param name="licFile">The string name of the license file.</param> /// <param name="key">The encryption key to verify the license.</param> /// <param name="licenses">The licenses collection to add new license if exist.</param> private void AddLicenseFromIsolatedStorage(string licFile, RSACryptoServiceProvider key, List <License> licenses) { LicenseFile license = null; using (var reader = IsolatedStorageAccess.CreateIsolatedStorageLicenseStream(FileMode.Open)) license = LicenseFile.LoadFile(reader, key); if (license != null) { licenses.Add(license); } }