public unsafe bool Compare(ValueReaderData value)
        {
            var intPtr = (int *)value.Ptr;
            var intVal = *intPtr;

            return(_valueCompare.Compare(intVal));
        }
        public unsafe List <int> SearchOffsets(OffsetSearchParams searchParams, Memory memory)
        {
            var result = new List <int>();

            var data = new ValueReaderData
            {
                DataArray = searchParams.StructureBytes
            };

            fixed(void *ptr = searchParams.StructureBytes)
            {
                var intPtr = (byte *)ptr;

                for (var i = 0; i < searchParams.StructureBytes.Length - Alignment; i += Alignment)
                {
                    data.DataArrayPos = i;
                    data.Ptr          = intPtr;

                    if (_valueCompare.Compare(data))
                    {
                        result.Add(i);
                    }

                    intPtr += Alignment;
                }
            }

            FoundOffsets.AddRange(result);
            return(result);
        }
        public bool Compare(PossiblePointerInfo pointerData)
        {
            var value = Memory.Instance.ReadStringU(pointerData.PointerAddress);

            //TODO: Here can be a string optimization (in poe), see NativeStringReader in HUD code.
            //Perfectly it should be implemented too. Example: in Player component -> Name
            //or just read string directly without reading address using:
            //var realData = M.ReadStringU(pointerData.StructBaseAddress + pointerData.Offset)
            //TODO: Make this optionally

            if (_compareValue.Compare(value))
            {
                return(true); //for debug purposes (breakpoint)
            }
            return(false);
        }
        public List <int> SearchOffsets(OffsetSearchParams searchParams, Memory memory)
        {
            Contract.Assume(searchParams != null);
            Contract.Assume(searchParams.StructureBytes != null);
            Contract.Assume(_valueComparer != null);
            Contract.Assume(memory != null);

            //if (searchParams.StructAddress == 0x00000058946BDE60)
            //{
            //    var t = 0;
            //}

            if (searchParams.PossiblePointers == null)
            {
                searchParams.PossiblePointers = Helpers.SearchPossiblePointers(searchParams.StructureBytes, searchParams.StructAddress);
            }

            var result = new List <int>();

            foreach (var searchParamsPossiblePointer in searchParams.PossiblePointers)
            {
                if (_checkVMT && !searchParamsPossiblePointer.HasVMT)
                {
                    continue;
                }

                if (_valueComparer.Compare(searchParamsPossiblePointer))
                {
                    result.Add(searchParamsPossiblePointer.Offset);

                    if (FirstFound)
                    {
                        break;
                    }
                }
            }

            FoundOffsets.AddRange(result);
            return(result);
        }
        public bool Compare(PossiblePointerInfo value)
        {
            //pointers should goes one after another sequentially
            if (_prevPointerAddress == 0 || value.Offset - _prevPointerOffset != 8)
            {
                _prevPointerAddress = value.PointerAddress;
                _prevPointerOffset  = value.Offset;
                return(false);
            }

            var pointersDiff = value.PointerAddress - _prevPointerAddress;
            var arrayLength  = (int)(pointersDiff / sizeof(long));

            if (_arrayLengthCompare.Compare(arrayLength))
            {
                return(true);
            }

            _prevPointerAddress = value.PointerAddress;
            _prevPointerOffset  = value.Offset;

            return(false);
        }
 public bool Compare(PossiblePointerInfo value)
 {
     return(_valueCompare.Compare(value.PointerAddress));
 }