/// <summary> /// The ProcessRecord instantiates a FileRecord objects that /// corresponds to the file(s) that is/are specified. /// </summary> protected override void ProcessRecord() { if (!(MyInvocation.BoundParameters.ContainsKey("Key"))) { key = null; } if (MyInvocation.BoundParameters.ContainsKey("Value")) { WriteObject(ValueKey.Get(path, key, val), true); } else { foreach (ValueKey vk in ValueKey.GetInstances(path, key)) { WriteObject(vk, true); } } }
/// <summary> /// The ProcessRecord instantiates a FileRecord objects that /// corresponds to the file(s) that is/are specified. /// </summary> protected override void ProcessRecord() { if (ParameterSetName == "Path") { if (!(MyInvocation.BoundParameters.ContainsKey("Key"))) { key = null; } if (MyInvocation.BoundParameters.ContainsKey("Value")) { WriteObject(ValueKey.Get(path, key, val)); } else { foreach (ValueKey vk in ValueKey.GetInstances(path, key)) { WriteObject(vk); } } } /*if (ParameterSetName == "Path") * { * bytes = Helper.GetHiveBytes(path); * } * * NamedKey hiveroot = Helper.GetRootKey(bytes, path); * * NamedKey nk = hiveroot; * * if (MyInvocation.BoundParameters.ContainsKey("Key")) * { * foreach (string k in key.Split('\\')) * { * foreach (NamedKey n in nk.GetSubKeys(bytes)) * { * if (n.Name == k) * { * nk = n; * } * } * } * } * * ValueKey[] values = nk.GetValues(bytes); * * if (MyInvocation.BoundParameters.ContainsKey("Value")) * { * foreach (ValueKey v in values) * { * if (v.Name == val) * { * WriteObject(v); * } * } * } * else * { * WriteObject(values); * } */ }