private bool Equals(RegistryValueData other) { return string.Equals(Key, other.Key) && string.Equals(Data, other.Data) && string.Equals(Name, other.Name) && DataCmpMethod == other.DataCmpMethod; }
public override ICollection<BaseTestData> ExtractData(XElement xmlNode, ICollection<DataProperty> properties) { var result = new Collection<BaseTestData>(); var allowedAttributeNames = new Collection<string> { "key", "name", "data", "dataCmpMethod" }; foreach (var node in xmlNode.Descendants().Where(x => string.Equals(x.Name.LocalName, this.ElementName, StringComparison.InvariantCultureIgnoreCase))) { CheckForAdditionalAttributes(node, allowedAttributeNames); var data = new RegistryValueData { Key = DataPropertyTool.ResolvePropertiesInString(properties, XmlTools.GetNamedAttributeValue(node, "key", string.Empty)), Name = XmlTools.GetNamedAttributeValue(node, "name", string.Empty), DataCmpMethod = GetDataCmpMethod(node), Data = GetData(properties, node) }; AddCommonData(node, data, properties); result.Add(data); } return result; }
private static void UpdateRegDataIfValueIsShortPath(RegistryValueData regData) { // If the value is short file path if (regData.Data.StartsWith("[!]", StringComparison.OrdinalIgnoreCase)) { regData.Data = regData.Data.Replace("[!]", string.Empty); var shortPath = new StringBuilder(255); var replaceValue = regData.Data.Split(','); if (Kernel32Methods.GetShortPathName(replaceValue[0], shortPath, shortPath.Capacity) != 0) { throw new InstallerVerificationLibraryException("Could not get short name for " + regData.Data); } regData.Data = regData.Data.Replace(replaceValue[0], shortPath.ToString()); } }