/[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/05 09:36:14	534
+++ trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2013/06/05 10:07:37	535
@@ -2307,7 +2307,7 @@
                                     string message = string.Format(" -> Reading Address 0x{0:x8} from index 0x{1}", k.Address, index.ToString("X"));
                                     double double_percent_done = 100.0 * (double)((double)index / (double)reader.ResultCount);
                                     int int_percent_done = (int)double_percent_done;
-                                    if ((int_percent_done != Last_Whole_Percent_Done) && ((double)index % 0.005) == 0.0)
+                                    if ((int_percent_done != Last_Whole_Percent_Done) && (index % 1000) == 0)
                                     {
                                         UpdateProgress((int)double_percent_done, message);
                                         Last_Whole_Percent_Done = int_percent_done;
@@ -2702,448 +2702,7 @@
                 }
 
                 if (NeedToCompare)
-                {
-                    if (SearchArgs.CompareType != SearchCompareTypes.Between && SearchArgs.CompareType != SearchCompareTypes.NotBetween)
-                    {
-                        #region Non-Range Searches
-                        if (USE_NONRANGE_SEARCH_RESULT_READER)
-                        {
-                            st_nonrange_search.Start();
-                            //second_tmp_Results = new List<ResultType<object>>(SearchArgs.Results.Count * 1024);
-                            ////second_tmp_Results.c
-                            try
-                            {
-                                using (SearchResultReader reader = new SearchResultReader(SearchGuid))
-                                {
-                                    try
-                                    {
-
-                                        #region new comparator-support
-                                        //second_tmp_Results = new List<StructResultType<object>>(reader.GetResults(SearchArgs.IsUnsignedDataType, SearchArgs.DataType, new Action<int, string>(UpdateProgress)));
-                                        #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<ulong>(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<ulong>(comparer.Address, (ulong)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<ulong>(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<ulong>(comparer.Address, (ulong)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<ulong>(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<ulong>(comparer.Address, (ulong)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<ulong>(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<ulong>(comparer.Address, (ulong)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)
-                                                {
-                                                    //Last_Whole_Percent_Done = int_percent_done;
-                                                    UpdateProgress(int_percent_done, string.Format(" -> Reading Address: 0x{0:x8}", i + MemoryRangeStart));
-                                                    //new Action<int, string>(UpdateProgress).Invoke(int_percent_done, string.Format(" -> Reading Address: 0x{0:x8}", i + MemoryRangeStart));
-                                                }
-                                                //}
-                                                //this.Refresh();
-                                            }
-                                        }
-                                        #endregion
-                                    }
-                                    catch (Exception ex)
-                                    {
-                                        throw ex;
-                                    }
-                                }
-                            }
-                            catch (Exception ex)
-                            {
-                                throw ex;
-                            }
-                            st_nonrange_search.Stop();
-                            logger.Profiler.WriteLine("Non-Ranged search took a total of {0} seconds to complete.", st_nonrange_search.Elapsed.TotalSeconds);
-                            //Last_Whole_Percent_Done = 0;
-                        }
-                        #endregion
-                    }
+                {        
                     #region Ranged Searches
 #if !DONOT_HAVE_RANGED_SEARCH_SUPPORT
                     if (SearchArgs.CompareType == SearchCompareTypes.Between || SearchArgs.CompareType == SearchCompareTypes.NotBetween)
@@ -3222,7 +2781,6 @@
                     }
 #endif
                     #endregion
-
                 }
                 #endregion
                 //// leave SearchArgs.Results alone, if false

 

  ViewVC Help
Powered by ViewVC 1.1.22