/[RomCheater]/trunk/RomCheater/Serialization/SearchResultReader.cs
ViewVC logotype

Diff of /trunk/RomCheater/Serialization/SearchResultReader.cs

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

--- trunk/RomCheater/Serialization/SearchResultReader.cs	2013/06/04 21:16:35	508
+++ trunk/RomCheater/Serialization/SearchResultReader.cs	2013/06/04 21:25:01	509
@@ -35,7 +35,8 @@
         SearchResultReader.ResultReaderCollection GetResults(bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress);
         bool ContainsAddress(uint address, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress);
         bool ContainsAddress(uint address, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress, out int index);
-        void GetResultAtAddress(uint address, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress, out StructResultType<ulong> result);
+        //void GetResultAtAddress(uint address, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress, out StructResultType<ulong> result);
+        void GetResultAtIndex(int index, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress, out StructResultType<ulong> result);
     }
 
 
@@ -52,7 +53,7 @@
         {
             int index = 0;
             return ContainsAddress(address, unsigned, datatype, update_progress, out index);
-        }
+        }       
         public bool ContainsAddress(uint address, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress, out int index)
         {
             bool contains = false;
@@ -72,19 +73,33 @@
             }
             return contains;
         }
-        public void GetResultAtAddress(uint address, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress, out StructResultType<ulong> result)
+        public void GetResultAtIndex(int index, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress, out StructResultType<ulong> result)
         {
             result = StructResultType<ulong>.Empty;
-            int index = 0;
-            if (ContainsAddress(address, unsigned, datatype, update_progress, out index))
-            {
-                result = GetResultAtIndex(this,index, unsigned, datatype, update_progress);
-            }
-            else
+            int count = 0;
+            foreach (var entry in GetResults(unsigned, datatype, update_progress))
             {
-                throw new KeyNotFoundException(string.Format("Could not find result for address: 0x{0}", address.ToString("X")));
+                if (index == count)
+                {
+                    result = entry;
+                    break;
+                }
+                count++;
             }
         }
+        //public void GetResultAtAddress(uint address, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress, out StructResultType<ulong> result)
+        //{
+        //    result = StructResultType<ulong>.Empty;
+        //    int index = 0;
+        //    if (ContainsAddress(address, unsigned, datatype, update_progress, out index))
+        //    {
+        //        result = GetResultAtIndex(this,index, unsigned, datatype, update_progress);
+        //    }
+        //    else
+        //    {
+        //        throw new KeyNotFoundException(string.Format("Could not find result for address: 0x{0}", address.ToString("X")));
+        //    }
+        //}
         #endregion
 
 

 

  ViewVC Help
Powered by ViewVC 1.1.22