public static ControlCustomRegistryValue Parse(BinaryReader reader) { // Create instance of policy storage ControlCustomRegistryValue registryKey = new ControlCustomRegistryValue(); // Read registry identifing fields registryKey.Hive = (RegistryHive)reader.ReadInt32(); registryKey.KeyPath = reader.ReadString(); registryKey.ValueName = reader.ReadString(); // Read comparison values registryKey.ValueEquals = reader.ReadBoolean(); int comparisonCount = reader.ReadInt32(); for (int i = 0; i < comparisonCount; i++) { IComparison comparison = null; EComparison type = (EComparison)reader.ReadInt32(); switch (type) { case EComparison.Simple: comparison = new ControlComparisonSimple(); break; case EComparison.Regex: comparison = new ControlComparisonRegex(); break; case EComparison.Range: comparison = new ControlComparisonRange(); break; } comparison.Load(reader); // Add comparison to list registryKey.Comparisons.Add(comparison); } // Read scoring values registryKey.CustomOutput = reader.ReadString(); registryKey.IsScored = reader.ReadBoolean(); return(registryKey); }
public static ControlCustomProcessOutput Parse(BinaryReader reader) { // Create instance of policy storage ControlCustomProcessOutput processOutput = new ControlCustomProcessOutput(); processOutput.Path = reader.ReadString(); processOutput.Arguments = reader.ReadString(); processOutput.Timeout = reader.ReadInt32(); // Read comparison values processOutput.Matches = reader.ReadBoolean(); int comparisonCount = reader.ReadInt32(); for (int i = 0; i < comparisonCount; i++) { IComparison comparison = null; EComparison type = (EComparison)reader.ReadInt32(); switch (type) { case EComparison.Simple: comparison = new ControlComparisonSimple(); break; case EComparison.Regex: comparison = new ControlComparisonRegex(); break; case EComparison.Range: comparison = new ControlComparisonRange(); break; } comparison.Load(reader); // Add comparison to list processOutput.Comparisons.Add(comparison); } // Read scoring values processOutput.CustomOutput = reader.ReadString(); processOutput.IsScored = reader.ReadBoolean(); return(processOutput); }