/[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 10:07:37	535
+++ trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2013/06/05 10:33:38	538
@@ -2864,35 +2864,30 @@
                 if (reader.ResultCount <= MIN_NUMBER_OF_RESULTS_BEFORE_DISPLAY)
                 {
                     lstResults.Items.Clear();
-                    //List<ResultItem> items = new List<ResultItem>();
-                    //for (int i = 0; i < reader.ResultCount; i++)
-                    //{
-                    //    ResultItem item = new ResultItem(0, false);
-                    //    //item.Text = string.Format("0x{0:x8}", SearchArgs.Results[i].Address);
-                    //    //item.SubItems.Add(string.Format("0x{0:x8}", SearchArgs.Results[i].Address));
-                    //    switch (SearchArgs.DataType)
-                    //    {
-                    //        case SearchDataTypes._8bits:
-                    //            if (SearchArgs.IsUnsignedDataType) { ResultType<byte> result = new ResultType<byte>(); item = new ResultItem(result.Address, false, result.Value); }
-                    //            else { ResultType<sbyte> result = reader.GetNextResult<sbyte>(); item = new ResultItem(result.Address, false, result.Value); }
-                    //            break;
-                    //        case SearchDataTypes._16bits:
-                    //            if (SearchArgs.IsUnsignedDataType) { ResultType<ushort> result = reader.GetNextResult<ushort>(); item = new ResultItem(result.Address, false, result.Value); }
-                    //            else { ResultType<short> result = reader.GetNextResult<short>(); item = new ResultItem(result.Address, false, result.Value); }
-                    //            break;
-                    //        case SearchDataTypes._32bits:
-                    //            if (SearchArgs.IsUnsignedDataType) { ResultType<uint> result = reader.GetNextResult<uint>(); item = new ResultItem(result.Address, false, result.Value); }
-                    //            else { ResultType<int> result = reader.GetNextResult<int>(); item = new ResultItem(result.Address, false, result.Value); }
-                    //            break;
-                    //        case SearchDataTypes._64bits:
-                    //            if (SearchArgs.IsUnsignedDataType) { ResultType<ulong> result = reader.GetNextResult<ulong>(); item = new ResultItem(result.Address, false, result.Value); }
-                    //            else { ResultType<long> result = reader.GetNextResult<long>(); item = new ResultItem(result.Address, false, result.Value); }
-                    //            break;
-                    //    }
-                    //    if (!items.Contains(item))
-                    //        items.Add(item);
-                    //}
-                    //lstResults.Items.AddRange(reader.GetResultItems(SearchArgs.IsUnsignedDataType, SearchArgs.DataType, new Action<int, string>(UpdateProgress)));
+                    List<ResultItem> items = new List<ResultItem>();
+                    foreach (var k in reader.GetResults(SearchArgs.IsUnsignedDataType, SearchArgs.DataType, new Action<int, string>(UpdateProgress), new Func<bool>(ShouldCancelAnySearchOperation)))
+                    {
+                        switch (SearchArgs.DataType)
+                        {
+                            case SearchDataTypes._8bits:
+                                if (SearchArgs.IsUnsignedDataType) { items.Add(new ResultItem(k.Address, false, Convert.ToByte(k.Value))); }
+                                else { items.Add(new ResultItem(k.Address, false, Convert.ToSByte(k.Value))); }
+                                break;
+                            case SearchDataTypes._16bits:
+                                if (SearchArgs.IsUnsignedDataType) { items.Add(new ResultItem(k.Address, false, Convert.ToUInt16(k.Value))); }
+                                else { items.Add(new ResultItem(k.Address, false, Convert.ToInt16(k.Value))); }
+                                break;
+                            case SearchDataTypes._32bits:
+                                if (SearchArgs.IsUnsignedDataType) { items.Add(new ResultItem(k.Address, false, Convert.ToUInt32(k.Value))); }
+                                else { items.Add(new ResultItem(k.Address, false, Convert.ToInt32(k.Value))); }
+                                break;
+                            case SearchDataTypes._64bits:
+                                if (SearchArgs.IsUnsignedDataType) { items.Add(new ResultItem(k.Address, false, Convert.ToUInt64(k.Value))); }
+                                else { items.Add(new ResultItem(k.Address, false, Convert.ToInt64(k.Value))); }
+                                break;
+                        }
+                    }
+                    lstResults.Items.AddRange(items.ToArray());
                 }
             }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22