public static CustomFile Parse(BinaryReader reader) { // Create instance CustomFile customFile = new CustomFile(); customFile.Path = reader.ReadString(); customFile.Matches = reader.ReadBoolean(); int comparisonCount = reader.ReadInt32(); customFile.Comparisons = new IComparison[comparisonCount]; for (int i = 0; i < comparisonCount; i++) { EComparison type = (EComparison)reader.ReadInt32(); switch (type) { case EComparison.Simple: customFile.Comparisons[i] = new ComparisonSimple(); break; case EComparison.Regex: customFile.Comparisons[i] = new ComparisonRegex(); break; } customFile.Comparisons[i].Load(reader); } // Read scoring values customFile.CustomOutput = reader.ReadString(); customFile.IsScored = reader.ReadBoolean(); return(customFile); }
public static SqlBoolean operator >=(SqlGuid x, SqlGuid y) { if (x.IsNull || y.IsNull) { return(SqlBoolean.Null); } EComparison comparison = Compare(x, y); return(new SqlBoolean((comparison == EComparison.GT) || (comparison == EComparison.EQ))); }
public static SqlBoolean operator >=(SqlBinary x, SqlBinary y) { if (x.IsNull || y.IsNull) { return(SqlBoolean.Null); } EComparison comparison = PerformCompareByte(x.Value, y.Value); return(new SqlBoolean((comparison == EComparison.GT) || (comparison == EComparison.EQ))); }
public static SqlBoolean operator <=(SqlGuid x, SqlGuid y) { if (x.IsNull || y.IsNull) { return(SqlBoolean.Null); } EComparison cmp = Compare(x, y); return(new SqlBoolean(cmp == EComparison.LT || cmp == EComparison.EQ)); }
/// <devdoc> /// <para> /// Compares the first <see cref='System.Data.SqlTypes.SqlBinary'/> for being less than or equal to the second <see cref='System.Data.SqlTypes.SqlBinary'/>. /// </para> /// </devdoc> public static SqlBoolean operator <=(SqlBinary x, SqlBinary y) { if (x.IsNull || y.IsNull) { return(SqlBoolean.Null); } EComparison cmpResult = PerformCompareByte(x.Value, y.Value); return(new SqlBoolean(cmpResult == EComparison.LT || cmpResult == EComparison.EQ)); }
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); }
public static RegistryKey Parse(BinaryReader reader) { // Create instance of policy storage RegistryKey registryKey = new RegistryKey(); // 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(); registryKey.Comparisons = new IComparison[comparisonCount]; for (int i = 0; i < comparisonCount; i++) { EComparison type = (EComparison)reader.ReadInt32(); switch (type) { case EComparison.Simple: registryKey.Comparisons[i] = new ComparisonSimple(); break; case EComparison.Regex: registryKey.Comparisons[i] = new ComparisonRegex(); break; case EComparison.Range: registryKey.Comparisons[i] = new ComparisonRange(); break; } registryKey.Comparisons[i].Load(reader); } // Read scoring values registryKey.CustomOutput = reader.ReadString(); registryKey.IsScored = reader.ReadBoolean(); return(registryKey); }
public static ProcessOutput Parse(BinaryReader reader) { // Create instance of policy storage ProcessOutput processOutput = new ProcessOutput(); processOutput.Path = reader.ReadString(); processOutput.Arguments = reader.ReadString(); processOutput.Timeout = reader.ReadInt32(); // Read comparison values processOutput.Matches = reader.ReadBoolean(); int comparisonCount = reader.ReadInt32(); processOutput.Comparisons = new IComparison[comparisonCount]; for (int i = 0; i < comparisonCount; i++) { EComparison type = (EComparison)reader.ReadInt32(); switch (type) { case EComparison.Simple: processOutput.Comparisons[i] = new ComparisonSimple(); break; case EComparison.Regex: processOutput.Comparisons[i] = new ComparisonRegex(); break; case EComparison.Range: processOutput.Comparisons[i] = new ComparisonRange(); break; } processOutput.Comparisons[i].Load(reader); } // Read scoring values processOutput.CustomOutput = reader.ReadString(); processOutput.IsScored = reader.ReadBoolean(); return(processOutput); }
// Comparison operators private static SqlBoolean Compare(SqlString x, SqlString y, EComparison ecExpectedResult) { if (x.IsNull || y.IsNull) { return(SqlBoolean.Null); } int iCmpResult = StringCompare(x, y); bool fResult = false; switch (ecExpectedResult) { case EComparison.EQ: fResult = (iCmpResult == 0); break; case EComparison.LT: fResult = (iCmpResult < 0); break; case EComparison.LE: fResult = (iCmpResult <= 0); break; case EComparison.GT: fResult = (iCmpResult > 0); break; case EComparison.GE: fResult = (iCmpResult >= 0); break; default: SQLDebug.Check(false, "Invalid ecExpectedResult"); return(SqlBoolean.Null); } return(new SqlBoolean(fResult)); }
public static ControlCustomFile Parse(BinaryReader reader) { // Create instance ControlCustomFile customFile = new ControlCustomFile(); customFile.Path = reader.ReadString(); customFile.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; } comparison.Load(reader); // Add comparison to list customFile.Comparisons.Add(comparison); } // Read scoring values customFile.CustomOutput = reader.ReadString(); customFile.IsScored = reader.ReadBoolean(); return(customFile); }
private static SqlBoolean Compare(SqlString x, SqlString y, EComparison ecExpectedResult) { bool flag; if (!x.IsNull && !y.IsNull) { int num = StringCompare(x, y); flag = false; switch (ecExpectedResult) { case EComparison.LT: flag = num < 0; goto Label_006F; case EComparison.LE: flag = num <= 0; goto Label_006F; case EComparison.EQ: flag = num == 0; goto Label_006F; case EComparison.GE: flag = num >= 0; goto Label_006F; case EComparison.GT: flag = num > 0; goto Label_006F; } } return(SqlBoolean.Null); Label_006F: return(new SqlBoolean(flag)); }
// Comparison operators private static SqlBoolean Compare(SqlString x, SqlString y, EComparison ecExpectedResult) { if (x.IsNull || y.IsNull) return SqlBoolean.Null; int iCmpResult = StringCompare(x, y); bool fResult = false; switch (ecExpectedResult) { case EComparison.EQ: fResult = (iCmpResult == 0); break; case EComparison.LT: fResult = (iCmpResult < 0); break; case EComparison.LE: fResult = (iCmpResult <= 0); break; case EComparison.GT: fResult = (iCmpResult > 0); break; case EComparison.GE: fResult = (iCmpResult >= 0); break; default: Debug.Assert(false, "Invalid ecExpectedResult"); return SqlBoolean.Null; } return new SqlBoolean(fResult); }
private static SqlBoolean Compare(SqlString x, SqlString y, EComparison ecExpectedResult) { bool flag; if (!x.IsNull && !y.IsNull) { int num = StringCompare(x, y); flag = false; switch (ecExpectedResult) { case EComparison.LT: flag = num < 0; goto Label_006F; case EComparison.LE: flag = num <= 0; goto Label_006F; case EComparison.EQ: flag = num == 0; goto Label_006F; case EComparison.GE: flag = num >= 0; goto Label_006F; case EComparison.GT: flag = num > 0; goto Label_006F; } } return SqlBoolean.Null; Label_006F: return new SqlBoolean(flag); }