public static void Decrypt(DomainList domainList, StringCryptographer decrypter, IList <string> decryptedDomains) { decryptedDomains.Clear(); if (decrypter != null) { foreach (string encryptedDomain in domainList) { decryptedDomains.Add(decrypter.Decrypt(encryptedDomain)); } } else { foreach (string domain in domainList) { decryptedDomains.Add(domain); } } }
public static string[] Decrypt(DomainList domainList, StringCryptographer decrypter) { string[] allDomains = new string[domainList.Count]; if (decrypter != null) { for (int index = 0; index < allDomains.Length; ++index) { allDomains[index] = decrypter.Decrypt(domainList[index]); } } else { for (int index = 0; index < allDomains.Length; ++index) { allDomains[index] = domainList[index]; } } return(allDomains); }
public static DomainList Generate(string nameOfFile, IList <string> allDomains, StringCryptographer encrypter) { // Setup asset DomainList newAsset = CreateInstance <DomainList>(); newAsset.name = nameOfFile; // Copy over all the domain names string[] domains = new string[allDomains.Count]; if (encrypter != null) { // Encrypt all entries for (int index = 0; index < allDomains.Count; ++index) { domains[index] = encrypter.Encrypt(allDomains[index]); } } else { // Copy directly to the array allDomains.CopyTo(domains, 0); } newAsset.Domains = domains; return(newAsset); }