public MainPattern(Patcher.Pattern ptrn, long[] streamPosition) { if (ptrn == null) { throw new ArgumentNullException("Pattern."); } this.Ptrn = ptrn; this.StreamPosition = streamPosition; }
private Patcher.MainPattern FindAllPatterns(Patcher.Pattern pt) { if (this._isDisposed) { throw new ObjectDisposedException("Object was disposed."); } if (pt == null) { throw new ArgumentNullException("Pattern"); } if (!pt.ValidPattern) { return(new Patcher.MainPattern(pt, null)); } long num = 0L; int num2 = 0; int num3 = 0; uint num4 = 0u; uint num5 = 0u; byte[] array = new byte[this._bufferSize]; int i = this._bufferSize; Patcher.Pattern.UniversalByte[] searchBytes = pt.SearchBytes; List <long> list = new List <long>(); if (this._isDisposed) { throw new ObjectDisposedException("Object was disposed."); } this._fs.Position = 0L; while (i > 0) { if (this._isDisposed) { throw new ObjectDisposedException("Object was disposed."); } long position = this._fs.Position; i = this._fs.Read(array, 0, array.Length); for (int j = 0; j < i; j++) { if (searchBytes[num3].Act == Patcher.Pattern.UniversalByte.Action.Skip || array[j] == searchBytes[num3].B) { if (num3 == 0) { num = position; num2 = j; } if (searchBytes.Length - 1 == num3) { num3 = 0; if (num4 == pt.ReplaceAfter) { num5 += 1u; list.Add(num + (long)num2); if (pt.BrakAfter > 0u && num5 == pt.BrakAfter) { return(new Patcher.MainPattern(pt, list.ToArray())); } } else { num4 += 1u; } } else { num3++; } } else if (num3 > 0) { num3 = 0; j = num2; if (num != position) { this._fs.Position = num; i = this._fs.Read(array, 0, array.Length); } } } } if (num5 <= 0u) { return(new Patcher.MainPattern(pt, null)); } return(new Patcher.MainPattern(pt, list.ToArray())); }
internal bool Patch(Patcher.Pattern item) { return(item == null); }