public CorruptSectionRandomValue(byte low_byte, byte high_byte, CorruptSectionOperation op) { _rand = new Random(); _low_byte = low_byte; _high_byte = high_byte + 1; _op = op; }
public CorruptSectionFixedValue(byte[] data, CorruptSectionOperation op) : base(op) { if (data.Length < 1) { throw new ArgumentException("Data array must contain at least one byte"); } _data = (byte[])data.Clone(); }
internal static byte ApplyOperationToByte(byte left, byte right, CorruptSectionOperation op) { switch (op) { case CorruptSectionOperation.Xor: return (byte)(left ^ right); case CorruptSectionOperation.And: return (byte)(left & right); case CorruptSectionOperation.Or: return (byte)(left | right); default: return right; } }
internal static byte ApplyOperationToByte(byte left, byte right, CorruptSectionOperation op) { switch (op) { case CorruptSectionOperation.Xor: return((byte)(left ^ right)); case CorruptSectionOperation.And: return((byte)(left & right)); case CorruptSectionOperation.Or: return((byte)(left | right)); default: return(right); } }
public CorruptSectionFixedValue(byte[] data, CorruptSectionOperation op) { _data = (byte[])data.Clone(); _op = op; }
protected CorruptSectionBase(CorruptSectionOperation op) { _op = op; }
internal static void ApplyOperationToArray(byte[] array, Func <byte> generator, CorruptSectionOperation op) { for (int i = 0; i < array.Length; ++i) { array[i] = ApplyOperationToByte(array[i], generator(), op); } }