private IEnumerable <ProductRegistry> GetRegistryKeys(string cn) { var comparer = SmoContext.GetComparer(); var list = new List <ProductRegistry>(); using (var regKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, cn)) { using (RegistryKey baseKey = regKey.OpenSubKey(BASE_KEY)) { foreach (string key in baseKey.GetSubKeyNames()) { for (int i = 0; i < this.InstanceName.Length; i++) { string inst = this.InstanceName[i]; if (key.Contains(inst)) { ProductRegistry prodReg = GetSetupKeys(inst, key, baseKey); if (prodReg != null) { list.Add(prodReg); } } } } } } return(list); }
internal SmoLicense(string computerName, ProductRegistry prodReg, char[] charArray) { this.ProductKey = this.GetProductKey(prodReg.DigitalProductId, prodReg.Version.Major, charArray); this.ComputerName = computerName; this.InstanceName = prodReg.Instance; this.SqlEdition = prodReg.Edition; this.SqlVersion = FromVersion(prodReg.Version); this.Version = prodReg.Version; }