/// <summary>
        /// Do the fuzz process
        /// </summary>
        /// <param name="realOffset">Real offset</param>
        public PatchChange Process(long realOffset)
        {
            // Removes

            var remove = RemoveLength != null?RemoveLength.Get() : (ushort)0;

            // Appends

            var size = AppendIterations != null?AppendIterations.Get() : 0;

            byte[] data = size > 0 && Append != null?Append.GetChunk(size) : null;

            if (data == null || data.Length == 0)
            {
                return(remove > 0 ? new PatchChange(Description, realOffset, remove) : null);
            }

            // Apply the filter

            if (Filter != null)
            {
                var filter = Filter.Get();
                if (filter != null)
                {
                    data = filter.ApplyFilter(data);
                }
            }

            return(new PatchChange(Description, realOffset, remove, data));
        }
Beispiel #2
0
        /// <summary>
        /// Do the fuzz process
        /// </summary>
        /// <param name="realOffset">Real offset</param>
        public PatchChange Process(long realOffset)
        {
            // Removes
            ushort remove = RemoveLength.Get();

            // Appends
            ushort size = _RemoveAndAppendAreSame ? remove : AppendLength.Get();

            if (size == 0)
            {
                return(remove > 0 ? new PatchChange(Description, realOffset, remove) : null);
            }

            byte[] data = new byte[size];
            RandomHelper.Randomize(data, 0, size, AppendByte);

            return(new PatchChange(Description, realOffset, data, remove));
        }