/[RomCheater]/trunk/RomCheater/Docking/FloatingMemorySearcher.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/FloatingMemorySearcher.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2013/06/02 20:22:04	448
+++ trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2013/06/02 22:30:23	452
@@ -15,7 +15,7 @@
 #if !USE_AUTOMATIC_MEMORY_SEARCH_RANGE
 #define FORCE_USE_OF_MEMORYSIZECONSTANTS // when defined wil force the use of the constants defined in MemorySizeConstants for memory search range
 #endif
-//#define DONOT_HAVE_RANGED_SEARCH_SUPPORT // when defined, indicates that ranged searches have not been implemented
+#define DONOT_HAVE_RANGED_SEARCH_SUPPORT // when defined, indicates that ranged searches have not been implemented
 #define INCREASE_NUMBER_OF_RESULTS_BEFORE_DISPLAY // when defined will set MIN RESULTS to 0x2701 otherwise 0x03e8
 //#define DO_NOT_SUSPEND_RESUME_THREAD_ON_FREEZE // when defined will not freeze/resume thread on freeze
 using System;
@@ -57,6 +57,8 @@
         const int MIN_NUMBER_OF_RESULTS_BEFORE_DISPLAY = 0x03e8; // 1,000 results
 #endif
 
+        const bool USE_OLD_SEARCH_RESULTS_COMPRATOR_CODE = false;
+
         private bool DefaultUnsignedState = true; // set unsigned to true
         public FloatingMemorySearcher() { InitializeComponent(); this.AcceptedPlugin = null; OnBrowseMemoryRegion = null; this.AcceptedProcess = null; SearchInProgess = false; Reload(); }
         public FloatingMemorySearcher(IConfigPlugin config) : this() { this.AcceptedPlugin = config; }
@@ -1186,99 +1188,17 @@
                             {
                                 try
                                 {
-                                    for (int i = 0; i < reader.ResultCount; i += 1)
+                                    #region new comparator-support
+                                    switch (SearchArgs.DataType)
                                     {
-                                        object result_value = 0;
-                                        uint address = 0;
-                                        #region switch (SearchArgs.DataType)
-                                        switch (SearchArgs.DataType)
-                                        {
-                                            case SearchDataTypes._8bits: if (unsigned)
-                                                {
-                                                    using (ResultType<byte> result = reader.GetNextResult<byte>())
-                                                    {
-                                                        address = result.Address;
-                                                        result_value = result.Value;
-                                                    }
-                                                }
-                                                else
-                                                {
-                                                    using (ResultType<sbyte> result = reader.GetNextResult<sbyte>())
-                                                    {
-                                                        address = result.Address;
-                                                        result_value = result.Value;
-                                                    }
-                                                } break;
-                                            case SearchDataTypes._16bits: if (unsigned)
-                                                {
-                                                    using (ResultType<ushort> result = reader.GetNextResult<ushort>())
-                                                    {
-                                                        address = result.Address;
-                                                        result_value = result.Value;
-                                                    }
-                                                }
-                                                else
-                                                {
-                                                    using (ResultType<short> result = reader.GetNextResult<short>())
-                                                    {
-                                                        address = result.Address;
-                                                        result_value = result.Value;
-                                                    }
-                                                } break;
-                                            case SearchDataTypes._32bits: if (unsigned)
-                                                {
-                                                    using (ResultType<uint> result = reader.GetNextResult<uint>())
-                                                    {
-                                                        address = result.Address;
-                                                        result_value = result.Value;
-                                                    }
-                                                }
-                                                else
-                                                {
-                                                    using (ResultType<int> result = reader.GetNextResult<int>())
-                                                    {
-                                                        address = result.Address;
-                                                        result_value = result.Value;
-                                                    }
-                                                } break;
-                                            case SearchDataTypes._64bits: if (unsigned)
-                                                {
-                                                    using (ResultType<ulong> result = reader.GetNextResult<ulong>())
-                                                    {
-                                                        address = result.Address;
-                                                        result_value = result.Value;
-                                                    }
-                                                }
-                                                else
-                                                {
-                                                    using (ResultType<long> result = reader.GetNextResult<long>())
-                                                    {
-                                                        address = result.Address;
-                                                        result_value = result.Value;
-                                                    }
-                                                } break;
-                                        }
-                                        #endregion
-                                        if (MemoryRangeStart > 0 && !SearchArgs.IsFirstSearch) { address = address - MemoryRangeStart; }
-                                        try
-                                        {
-                                            //r_ms.BaseStream.Seek(address, SeekOrigin.Begin);
-                                        }
-                                        catch (Exception)
-                                        {
-                                            throw;
-                                        }
-                                        switch (SearchArgs.DataType)
-                                        {
-                                            #region Comparer Support
-                                            #region case SearchDataTypes._8bits:
-                                            case SearchDataTypes._8bits:
-                                                if (SearchArgs.IsUnsignedDataType)
+                                        case SearchDataTypes._8bits:
+                                            if (unsigned)
+                                            {
+                                                #region 8bits - unsigned
+                                                var list_results = reader.GetResults<byte>();
+                                                foreach (var list_result in list_results)
                                                 {
-                                                    byte lookup_value = 0;
-                                                    //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
-                                                    lookup_value = Convert.ToByte(result_value);
-                                                    using (_8bit_unsigned_comparer_ comparer = new _8bit_unsigned_comparer_(SearchArgs, address))
+                                                    using (_8bit_unsigned_comparer_ comparer = new _8bit_unsigned_comparer_(SearchArgs, list_result.Address))
                                                     {
                                                         byte value = 0;
                                                         if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
@@ -1288,7 +1208,7 @@
                                                                 try
                                                                 {
                                                                     gmp.OpenProvider();
-                                                                    gmp.ReadMemory(address, out value);
+                                                                    gmp.ReadMemory(list_result.Address, out value);
                                                                     gmp.CloseProvider();
                                                                 }
                                                                 catch (Exception ex)
@@ -1303,18 +1223,21 @@
                                                             value = Convert.ToByte(SearchArgs.CompareStartValue);
                                                             comparer.Value = value;
                                                         }
-                                                        if (comparer.Compare(lookup_value, value))
+                                                        if (comparer.Compare(list_result.Value, value))
                                                         {
                                                             second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
                                                         }
                                                     }
                                                 }
-                                                else
+                                                #endregion
+                                            }
+                                            else
+                                            {
+                                                #region 8bits - signed
+                                                var list_results = reader.GetResults<sbyte>();
+                                                foreach (var list_result in list_results)
                                                 {
-                                                    sbyte lookup_value = 0;
-                                                    //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
-                                                    lookup_value = Convert.ToSByte(result_value);
-                                                    using (_8bit_signed_comparer_ comparer = new _8bit_signed_comparer_(SearchArgs, address))
+                                                    using (_8bit_signed_comparer_ comparer = new _8bit_signed_comparer_(SearchArgs, list_result.Address))
                                                     {
                                                         sbyte value = 0;
                                                         if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
@@ -1324,7 +1247,7 @@
                                                                 try
                                                                 {
                                                                     gmp.OpenProvider();
-                                                                    gmp.ReadMemory(address, out value);
+                                                                    gmp.ReadMemory(list_result.Address, out value);
                                                                     gmp.CloseProvider();
                                                                 }
                                                                 catch (Exception ex)
@@ -1337,23 +1260,25 @@
                                                         else
                                                         {
                                                             value = Convert.ToSByte(SearchArgs.CompareStartValue);
+                                                            comparer.Value = value;
                                                         }
-                                                        if (comparer.Compare(lookup_value, value))
+                                                        if (comparer.Compare(list_result.Value, value))
                                                         {
                                                             second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
                                                         }
                                                     }
                                                 }
-                                                break;
-                                            #endregion
-                                            #region case SearchDataTypes._16bits:
-                                            case SearchDataTypes._16bits:
-                                                if (SearchArgs.IsUnsignedDataType)
+                                                #endregion
+                                            }
+                                            break;
+                                        case SearchDataTypes._16bits:
+                                            if (unsigned)
+                                            {
+                                                #region 16bits - unsigned
+                                                var list_results = reader.GetResults<ushort>();
+                                                foreach (var list_result in list_results)
                                                 {
-                                                    ushort lookup_value = 0;
-                                                    //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
-                                                    lookup_value = Convert.ToUInt16(result_value);
-                                                    using (_16bit_unsigned_comparer_ comparer = new _16bit_unsigned_comparer_(SearchArgs, address))
+                                                    using (_16bit_unsigned_comparer_ comparer = new _16bit_unsigned_comparer_(SearchArgs, list_result.Address))
                                                     {
                                                         ushort value = 0;
                                                         if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
@@ -1363,7 +1288,7 @@
                                                                 try
                                                                 {
                                                                     gmp.OpenProvider();
-                                                                    gmp.ReadMemory(address, out value);
+                                                                    gmp.ReadMemory(list_result.Address, out value);
                                                                     gmp.CloseProvider();
                                                                 }
                                                                 catch (Exception ex)
@@ -1378,18 +1303,21 @@
                                                             value = Convert.ToUInt16(SearchArgs.CompareStartValue);
                                                             comparer.Value = value;
                                                         }
-                                                        if (comparer.Compare(lookup_value, value))
+                                                        if (comparer.Compare(list_result.Value, value))
                                                         {
                                                             second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
                                                         }
                                                     }
                                                 }
-                                                else
+                                                #endregion
+                                            }
+                                            else
+                                            {
+                                                #region 16bits - signed
+                                                var list_results = reader.GetResults<short>();
+                                                foreach (var list_result in list_results)
                                                 {
-                                                    short lookup_value = 0;
-                                                    //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
-                                                    lookup_value = Convert.ToInt16(result_value);
-                                                    using (_16bit_signed_comparer_ comparer = new _16bit_signed_comparer_(SearchArgs, address))
+                                                    using (_16bit_signed_comparer_ comparer = new _16bit_signed_comparer_(SearchArgs, list_result.Address))
                                                     {
                                                         short value = 0;
                                                         if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
@@ -1399,7 +1327,7 @@
                                                                 try
                                                                 {
                                                                     gmp.OpenProvider();
-                                                                    gmp.ReadMemory(address, out value);
+                                                                    gmp.ReadMemory(list_result.Address, out value);
                                                                     gmp.CloseProvider();
                                                                 }
                                                                 catch (Exception ex)
@@ -1412,23 +1340,25 @@
                                                         else
                                                         {
                                                             value = Convert.ToInt16(SearchArgs.CompareStartValue);
+                                                            comparer.Value = value;
                                                         }
-                                                        if (comparer.Compare(lookup_value, value))
+                                                        if (comparer.Compare(list_result.Value, value))
                                                         {
                                                             second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
                                                         }
                                                     }
                                                 }
-                                                break;
-                                            #endregion
-                                            #region case SearchDataTypes._32bits:
-                                            case SearchDataTypes._32bits:
-                                                if (SearchArgs.IsUnsignedDataType)
+                                                #endregion
+                                            }
+                                            break;
+                                        case SearchDataTypes._32bits:
+                                            if (unsigned)
+                                            {
+                                                #region 32bits - unsigned
+                                                var list_results = reader.GetResults<uint>();
+                                                foreach (var list_result in list_results)
                                                 {
-                                                    uint lookup_value = 0;
-                                                    //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
-                                                    lookup_value = Convert.ToUInt32(result_value);                                                    
-                                                    using (_32bit_unsigned_comparer_ comparer = new _32bit_unsigned_comparer_(SearchArgs, address))
+                                                    using (_32bit_unsigned_comparer_ comparer = new _32bit_unsigned_comparer_(SearchArgs, list_result.Address))
                                                     {
                                                         uint value = 0;
                                                         if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
@@ -1438,7 +1368,7 @@
                                                                 try
                                                                 {
                                                                     gmp.OpenProvider();
-                                                                    gmp.ReadMemory(address, out value);
+                                                                    gmp.ReadMemory(list_result.Address, out value);
                                                                     gmp.CloseProvider();
                                                                 }
                                                                 catch (Exception ex)
@@ -1453,18 +1383,21 @@
                                                             value = Convert.ToUInt32(SearchArgs.CompareStartValue);
                                                             comparer.Value = value;
                                                         }
-                                                        if (comparer.Compare(lookup_value, value))
+                                                        if (comparer.Compare(list_result.Value, value))
                                                         {
                                                             second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
                                                         }
                                                     }
                                                 }
-                                                else
+                                                #endregion
+                                            }
+                                            else
+                                            {
+                                                #region 32bits - signed
+                                                var list_results = reader.GetResults<int>();
+                                                foreach (var list_result in list_results)
                                                 {
-                                                    int lookup_value = 0;
-                                                    //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
-                                                    lookup_value = Convert.ToInt32(result_value);
-                                                    using (_32bit_signed_comparer_ comparer = new _32bit_signed_comparer_(SearchArgs, address))
+                                                    using (_32bit_signed_comparer_ comparer = new _32bit_signed_comparer_(SearchArgs, list_result.Address))
                                                     {
                                                         int value = 0;
                                                         if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
@@ -1474,7 +1407,7 @@
                                                                 try
                                                                 {
                                                                     gmp.OpenProvider();
-                                                                    gmp.ReadMemory(address, out value);
+                                                                    gmp.ReadMemory(list_result.Address, out value);
                                                                     gmp.CloseProvider();
                                                                 }
                                                                 catch (Exception ex)
@@ -1487,23 +1420,25 @@
                                                         else
                                                         {
                                                             value = Convert.ToInt32(SearchArgs.CompareStartValue);
+                                                            comparer.Value = value;
                                                         }
-                                                        if (comparer.Compare(lookup_value, value))
+                                                        if (comparer.Compare(list_result.Value, value))
                                                         {
                                                             second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
                                                         }
                                                     }
                                                 }
-                                                break;
-                                            #endregion
-                                            #region case SearchDataTypes._64bits:
-                                            case SearchDataTypes._64bits:
-                                                if (SearchArgs.IsUnsignedDataType)
+                                                #endregion
+                                            }
+                                            break;
+                                        case SearchDataTypes._64bits:
+                                            if (unsigned)
+                                            {
+                                                #region 64bits - unsigned
+                                                var list_results = reader.GetResults<ulong>();
+                                                foreach (var list_result in list_results)
                                                 {
-                                                    ulong lookup_value = 0;
-                                                    //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
-                                                    lookup_value = Convert.ToUInt64(result_value);
-                                                    using (_64bit_unsigned_comparer_ comparer = new _64bit_unsigned_comparer_(SearchArgs, address))
+                                                    using (_64bit_unsigned_comparer_ comparer = new _64bit_unsigned_comparer_(SearchArgs, list_result.Address))
                                                     {
                                                         ulong value = 0;
                                                         if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
@@ -1513,7 +1448,7 @@
                                                                 try
                                                                 {
                                                                     gmp.OpenProvider();
-                                                                    gmp.ReadMemory(address, out value);
+                                                                    gmp.ReadMemory(list_result.Address, out value);
                                                                     gmp.CloseProvider();
                                                                 }
                                                                 catch (Exception ex)
@@ -1528,18 +1463,21 @@
                                                             value = Convert.ToUInt64(SearchArgs.CompareStartValue);
                                                             comparer.Value = value;
                                                         }
-                                                        if (comparer.Compare(lookup_value, value))
+                                                        if (comparer.Compare(list_result.Value, value))
                                                         {
                                                             second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
                                                         }
                                                     }
                                                 }
-                                                else
+                                                #endregion
+                                            }
+                                            else
+                                            {
+                                                #region 64bits - signed
+                                                var list_results = reader.GetResults<long>();
+                                                foreach (var list_result in list_results)
                                                 {
-                                                    long lookup_value = 0;
-                                                    //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
-                                                    lookup_value = Convert.ToInt64(result_value);
-                                                    using (_64bit_signed_comparer_ comparer = new _64bit_signed_comparer_(SearchArgs, address))
+                                                    using (_64bit_signed_comparer_ comparer = new _64bit_signed_comparer_(SearchArgs, list_result.Address))
                                                     {
                                                         long value = 0;
                                                         if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
@@ -1549,7 +1487,7 @@
                                                                 try
                                                                 {
                                                                     gmp.OpenProvider();
-                                                                    gmp.ReadMemory(address, out value);
+                                                                    gmp.ReadMemory(list_result.Address, out value);
                                                                     gmp.CloseProvider();
                                                                 }
                                                                 catch (Exception ex)
@@ -1562,29 +1500,425 @@
                                                         else
                                                         {
                                                             value = Convert.ToInt64(SearchArgs.CompareStartValue);
+                                                            comparer.Value = value;
                                                         }
-                                                        if (comparer.Compare(lookup_value, value))
+                                                        if (comparer.Compare(list_result.Value, value))
                                                         {
                                                             second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
                                                         }
                                                     }
                                                 }
-                                                break;
-                                            #endregion
-                                            #endregion
-                                        }
-                                        double double_percent_done = 100.0 * (double)((double)i / (double)reader.ResultCount);
-                                        int int_percent_done = (int)double_percent_done;
-                                        if (int_percent_done != Last_Whole_Percent_Done && i % 100000 == 0)
+                                                #endregion
+                                            }
+                                            break;
+                                    }
+                                    #endregion
+
+                                    #region USE_OLD_SEARCH_RESULTS_COMPRATOR_CODE
+                                    if (USE_OLD_SEARCH_RESULTS_COMPRATOR_CODE)
+                                    {
+                                        for (int i = 0; i < reader.ResultCount; i += 1)
                                         {
+                                            object result_value = 0;
+                                            uint address = 0;
+                                            #region switch (SearchArgs.DataType)
+                                            switch (SearchArgs.DataType)
+                                            {
+                                                case SearchDataTypes._8bits: if (unsigned)
+                                                    {
+                                                        using (ResultType<byte> result = reader.GetNextResult<byte>())
+                                                        {
+                                                            address = result.Address;
+                                                            result_value = result.Value;
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        using (ResultType<sbyte> result = reader.GetNextResult<sbyte>())
+                                                        {
+                                                            address = result.Address;
+                                                            result_value = result.Value;
+                                                        }
+                                                    } break;
+                                                case SearchDataTypes._16bits: if (unsigned)
+                                                    {
+                                                        using (ResultType<ushort> result = reader.GetNextResult<ushort>())
+                                                        {
+                                                            address = result.Address;
+                                                            result_value = result.Value;
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        using (ResultType<short> result = reader.GetNextResult<short>())
+                                                        {
+                                                            address = result.Address;
+                                                            result_value = result.Value;
+                                                        }
+                                                    } break;
+                                                case SearchDataTypes._32bits: if (unsigned)
+                                                    {
+                                                        using (ResultType<uint> result = reader.GetNextResult<uint>())
+                                                        {
+                                                            address = result.Address;
+                                                            result_value = result.Value;
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        using (ResultType<int> result = reader.GetNextResult<int>())
+                                                        {
+                                                            address = result.Address;
+                                                            result_value = result.Value;
+                                                        }
+                                                    } break;
+                                                case SearchDataTypes._64bits: if (unsigned)
+                                                    {
+                                                        using (ResultType<ulong> result = reader.GetNextResult<ulong>())
+                                                        {
+                                                            address = result.Address;
+                                                            result_value = result.Value;
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        using (ResultType<long> result = reader.GetNextResult<long>())
+                                                        {
+                                                            address = result.Address;
+                                                            result_value = result.Value;
+                                                        }
+                                                    } break;
+                                            }
+                                            #endregion
+                                            if (MemoryRangeStart > 0 && !SearchArgs.IsFirstSearch) { address = address - MemoryRangeStart; }
+                                            try
+                                            {
+                                                //r_ms.BaseStream.Seek(address, SeekOrigin.Begin);
+                                            }
+                                            catch (Exception)
+                                            {
+                                                throw;
+                                            }
+                                            switch (SearchArgs.DataType)
+                                            {
+                                                #region Comparer Support
+                                                #region case SearchDataTypes._8bits:
+                                                case SearchDataTypes._8bits:
+                                                    if (SearchArgs.IsUnsignedDataType)
+                                                    {
+                                                        byte lookup_value = 0;
+                                                        //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
+                                                        lookup_value = Convert.ToByte(result_value);
+                                                        using (_8bit_unsigned_comparer_ comparer = new _8bit_unsigned_comparer_(SearchArgs, address))
+                                                        {
+                                                            byte value = 0;
+                                                            if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
+                                                            {
+                                                                using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
+                                                                {
+                                                                    try
+                                                                    {
+                                                                        gmp.OpenProvider();
+                                                                        gmp.ReadMemory(address, out value);
+                                                                        gmp.CloseProvider();
+                                                                    }
+                                                                    catch (Exception ex)
+                                                                    {
+                                                                        logger.VerboseError.WriteLine(ex.ToString());
+                                                                    }
+                                                                }
+                                                                comparer.Value = value;
+                                                            }
+                                                            else
+                                                            {
+                                                                value = Convert.ToByte(SearchArgs.CompareStartValue);
+                                                                comparer.Value = value;
+                                                            }
+                                                            if (comparer.Compare(lookup_value, value))
+                                                            {
+                                                                second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
+                                                            }
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        sbyte lookup_value = 0;
+                                                        //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
+                                                        lookup_value = Convert.ToSByte(result_value);
+                                                        using (_8bit_signed_comparer_ comparer = new _8bit_signed_comparer_(SearchArgs, address))
+                                                        {
+                                                            sbyte value = 0;
+                                                            if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
+                                                            {
+                                                                using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
+                                                                {
+                                                                    try
+                                                                    {
+                                                                        gmp.OpenProvider();
+                                                                        gmp.ReadMemory(address, out value);
+                                                                        gmp.CloseProvider();
+                                                                    }
+                                                                    catch (Exception ex)
+                                                                    {
+                                                                        logger.VerboseError.WriteLine(ex.ToString());
+                                                                    }
+                                                                }
+                                                                comparer.Value = value;
+                                                            }
+                                                            else
+                                                            {
+                                                                value = Convert.ToSByte(SearchArgs.CompareStartValue);
+                                                            }
+                                                            if (comparer.Compare(lookup_value, value))
+                                                            {
+                                                                second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
+                                                            }
+                                                        }
+                                                    }
+                                                    break;
+                                                #endregion
+                                                #region case SearchDataTypes._16bits:
+                                                case SearchDataTypes._16bits:
+                                                    if (SearchArgs.IsUnsignedDataType)
+                                                    {
+                                                        ushort lookup_value = 0;
+                                                        //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
+                                                        lookup_value = Convert.ToUInt16(result_value);
+                                                        using (_16bit_unsigned_comparer_ comparer = new _16bit_unsigned_comparer_(SearchArgs, address))
+                                                        {
+                                                            ushort value = 0;
+                                                            if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
+                                                            {
+                                                                using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
+                                                                {
+                                                                    try
+                                                                    {
+                                                                        gmp.OpenProvider();
+                                                                        gmp.ReadMemory(address, out value);
+                                                                        gmp.CloseProvider();
+                                                                    }
+                                                                    catch (Exception ex)
+                                                                    {
+                                                                        logger.VerboseError.WriteLine(ex.ToString());
+                                                                    }
+                                                                }
+                                                                comparer.Value = value;
+                                                            }
+                                                            else
+                                                            {
+                                                                value = Convert.ToUInt16(SearchArgs.CompareStartValue);
+                                                                comparer.Value = value;
+                                                            }
+                                                            if (comparer.Compare(lookup_value, value))
+                                                            {
+                                                                second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
+                                                            }
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        short lookup_value = 0;
+                                                        //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
+                                                        lookup_value = Convert.ToInt16(result_value);
+                                                        using (_16bit_signed_comparer_ comparer = new _16bit_signed_comparer_(SearchArgs, address))
+                                                        {
+                                                            short value = 0;
+                                                            if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
+                                                            {
+                                                                using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
+                                                                {
+                                                                    try
+                                                                    {
+                                                                        gmp.OpenProvider();
+                                                                        gmp.ReadMemory(address, out value);
+                                                                        gmp.CloseProvider();
+                                                                    }
+                                                                    catch (Exception ex)
+                                                                    {
+                                                                        logger.VerboseError.WriteLine(ex.ToString());
+                                                                    }
+                                                                }
+                                                                comparer.Value = value;
+                                                            }
+                                                            else
+                                                            {
+                                                                value = Convert.ToInt16(SearchArgs.CompareStartValue);
+                                                            }
+                                                            if (comparer.Compare(lookup_value, value))
+                                                            {
+                                                                second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
+                                                            }
+                                                        }
+                                                    }
+                                                    break;
+                                                #endregion
+                                                #region case SearchDataTypes._32bits:
+                                                case SearchDataTypes._32bits:
+                                                    if (SearchArgs.IsUnsignedDataType)
+                                                    {
+                                                        uint lookup_value = 0;
+                                                        //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
+                                                        lookup_value = Convert.ToUInt32(result_value);
+                                                        using (_32bit_unsigned_comparer_ comparer = new _32bit_unsigned_comparer_(SearchArgs, address))
+                                                        {
+                                                            uint value = 0;
+                                                            if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
+                                                            {
+                                                                using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
+                                                                {
+                                                                    try
+                                                                    {
+                                                                        gmp.OpenProvider();
+                                                                        gmp.ReadMemory(address, out value);
+                                                                        gmp.CloseProvider();
+                                                                    }
+                                                                    catch (Exception ex)
+                                                                    {
+                                                                        logger.VerboseError.WriteLine(ex.ToString());
+                                                                    }
+                                                                }
+                                                                comparer.Value = value;
+                                                            }
+                                                            else
+                                                            {
+                                                                value = Convert.ToUInt32(SearchArgs.CompareStartValue);
+                                                                comparer.Value = value;
+                                                            }
+                                                            if (comparer.Compare(lookup_value, value))
+                                                            {
+                                                                second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
+                                                            }
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        int lookup_value = 0;
+                                                        //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
+                                                        lookup_value = Convert.ToInt32(result_value);
+                                                        using (_32bit_signed_comparer_ comparer = new _32bit_signed_comparer_(SearchArgs, address))
+                                                        {
+                                                            int value = 0;
+                                                            if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
+                                                            {
+                                                                using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
+                                                                {
+                                                                    try
+                                                                    {
+                                                                        gmp.OpenProvider();
+                                                                        gmp.ReadMemory(address, out value);
+                                                                        gmp.CloseProvider();
+                                                                    }
+                                                                    catch (Exception ex)
+                                                                    {
+                                                                        logger.VerboseError.WriteLine(ex.ToString());
+                                                                    }
+                                                                }
+                                                                comparer.Value = value;
+                                                            }
+                                                            else
+                                                            {
+                                                                value = Convert.ToInt32(SearchArgs.CompareStartValue);
+                                                            }
+                                                            if (comparer.Compare(lookup_value, value))
+                                                            {
+                                                                second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
+                                                            }
+                                                        }
+                                                    }
+                                                    break;
+                                                #endregion
+                                                #region case SearchDataTypes._64bits:
+                                                case SearchDataTypes._64bits:
+                                                    if (SearchArgs.IsUnsignedDataType)
+                                                    {
+                                                        ulong lookup_value = 0;
+                                                        //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
+                                                        lookup_value = Convert.ToUInt64(result_value);
+                                                        using (_64bit_unsigned_comparer_ comparer = new _64bit_unsigned_comparer_(SearchArgs, address))
+                                                        {
+                                                            ulong value = 0;
+                                                            if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
+                                                            {
+                                                                using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
+                                                                {
+                                                                    try
+                                                                    {
+                                                                        gmp.OpenProvider();
+                                                                        gmp.ReadMemory(address, out value);
+                                                                        gmp.CloseProvider();
+                                                                    }
+                                                                    catch (Exception ex)
+                                                                    {
+                                                                        logger.VerboseError.WriteLine(ex.ToString());
+                                                                    }
+                                                                }
+                                                                comparer.Value = value;
+                                                            }
+                                                            else
+                                                            {
+                                                                value = Convert.ToUInt64(SearchArgs.CompareStartValue);
+                                                                comparer.Value = value;
+                                                            }
+                                                            if (comparer.Compare(lookup_value, value))
+                                                            {
+                                                                second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
+                                                            }
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        long lookup_value = 0;
+                                                        //using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) { gmp.OpenProvider(); gmp.ReadMemory(address, out lookup_value); gmp.CloseProvider(); }
+                                                        lookup_value = Convert.ToInt64(result_value);
+                                                        using (_64bit_signed_comparer_ comparer = new _64bit_signed_comparer_(SearchArgs, address))
+                                                        {
+                                                            long value = 0;
+                                                            if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
+                                                            {
+                                                                using (GenericMemoryProvider gmp = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
+                                                                {
+                                                                    try
+                                                                    {
+                                                                        gmp.OpenProvider();
+                                                                        gmp.ReadMemory(address, out value);
+                                                                        gmp.CloseProvider();
+                                                                    }
+                                                                    catch (Exception ex)
+                                                                    {
+                                                                        logger.VerboseError.WriteLine(ex.ToString());
+                                                                    }
+                                                                }
+                                                                comparer.Value = value;
+                                                            }
+                                                            else
+                                                            {
+                                                                value = Convert.ToInt64(SearchArgs.CompareStartValue);
+                                                            }
+                                                            if (comparer.Compare(lookup_value, value))
+                                                            {
+                                                                second_tmp_Results.Add(new ResultType<object>(comparer.Address, comparer.Value));
+                                                            }
+                                                        }
+                                                    }
+                                                    break;
+                                                #endregion
+                                                #endregion
+                                            }
+                                            double double_percent_done = 100.0 * (double)((double)i / (double)reader.ResultCount);
+                                            int int_percent_done = (int)double_percent_done;
+                                            //if (int_percent_done != Last_Whole_Percent_Done && i % 100000 == 0)
+                                            //{
                                             if (int_percent_done <= 100)
                                             {
                                                 resultsprogress.Value = int_percent_done;
                                                 resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", i + MemoryRangeStart);
-                                                Last_Whole_Percent_Done = int_percent_done;
+                                                //Last_Whole_Percent_Done = int_percent_done;
                                             }
+                                            //}
+                                            //this.Refresh();
                                         }
                                     }
+                                    #endregion
                                 }
                                 catch (Exception ex)
                                 {

 

  ViewVC Help
Powered by ViewVC 1.1.22