Ejemplo n.º 1
0
        private static MemoryQuery Search(MemoryQuery query, bool fromEndToStart = false, int offsetAddress = 0)
        {
            query.QueryResult        = -1;
            query.QueryResultAddress = -1;

            if (query?.Search == null || query.Search.Length == 0 || string.IsNullOrEmpty(query.SearchPattern))
            {
                return(query);
            }

            if (query.Search.Length != query.SearchPattern.Length)
            {
                return(query);
            }

            var searchSize = query.Search.Length;
            var pattern    = query.SearchPattern;

            for (
                var i = !fromEndToStart ? offsetAddress : _moduleMemSize - offsetAddress;
                (!fromEndToStart && i < _moduleMemSize - searchSize) || (fromEndToStart && i > searchSize);
                i = !fromEndToStart ? i + 1 : i - 1)
            {
                var addr   = _baseAddr + i;
                var read   = InnerRead(addr, searchSize, true);
                var result = new List <byte>();

                if (!MemoryReaderUtils.Match(pattern, read, query.Search, result))
                {
                    continue;
                }

                query.QueryResult        = MemoryReaderUtils.ConvertLittleEndian(result.ToArray());
                query.QueryResultAddress = addr;
                return(query);
            }

            return(query);
        }
Ejemplo n.º 2
0
 private static string InnerReadString(int addr, int size, bool forceRead = false)
 {
     return(MemoryReaderUtils.ConvertToString(InnerRead(addr, size, forceRead)));
 }
Ejemplo n.º 3
0
 private static int InnerReadInt(int addr, int size, bool forceRead = false)
 {
     return(MemoryReaderUtils.ConvertLittleEndian(InnerRead(addr, size, forceRead)));
 }