/[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	2012/06/21 21:08:15	412
+++ trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2012/06/21 21:35:08	413
@@ -1045,17 +1045,17 @@
                                 switch (sdt)
                                 {
                                     case SearchDataTypes._8bits:
-                                        if (unsigned) { writer.WriteResult<Byte>((uint)br.BaseStream.Position, br.ReadByte()); }
-                                        else { writer.WriteResult<SByte>((uint)br.BaseStream.Position, br.ReadSByte()); } break;
+                                        if (unsigned) { writer.WriteResult<Byte>((uint)CurrentIndex, br.ReadByte()); }
+                                        else { writer.WriteResult<SByte>((uint)CurrentIndex, br.ReadSByte()); } break;
                                     case SearchDataTypes._16bits:
-                                        if (unsigned) { writer.WriteResult<UInt16>((uint)br.BaseStream.Position, br.ReadUInt16()); }
-                                        else { writer.WriteResult<Int16>((uint)br.BaseStream.Position, br.ReadInt16()); } break;
+                                        if (unsigned) { writer.WriteResult<UInt16>((uint)CurrentIndex, br.ReadUInt16()); }
+                                        else { writer.WriteResult<Int16>((uint)CurrentIndex, br.ReadInt16()); } break;
                                     case SearchDataTypes._32bits:
-                                        if (unsigned) { writer.WriteResult<UInt32>((uint)br.BaseStream.Position, br.ReadUInt32()); }
-                                        else { writer.WriteResult<Int32>((uint)br.BaseStream.Position, br.ReadInt32()); } break;
+                                        if (unsigned) { writer.WriteResult<UInt32>((uint)CurrentIndex, br.ReadUInt32()); }
+                                        else { writer.WriteResult<Int32>((uint)CurrentIndex, br.ReadInt32()); } break;
                                     case SearchDataTypes._64bits:
-                                        if (unsigned) { writer.WriteResult<UInt64>((uint)br.BaseStream.Position, br.ReadUInt64()); }
-                                        else { writer.WriteResult<Int64>((uint)br.BaseStream.Position, br.ReadInt64()); } break;
+                                        if (unsigned) { writer.WriteResult<UInt64>((uint)CurrentIndex, br.ReadUInt64()); }
+                                        else { writer.WriteResult<Int64>((uint)CurrentIndex, br.ReadInt64()); } break;
                                 }
                             }
                             catch (EndOfStreamException) { }
@@ -1070,7 +1070,21 @@
                                     Last_Whole_Percent_Done = int_percent_done;
                                 }
                             }
-                            CurrentIndex++;
+                            switch (sdt)
+                            {
+                                case SearchDataTypes._8bits:
+                                    CurrentIndex += sizeof(byte);
+                                    break;
+                                case SearchDataTypes._16bits:
+                                    CurrentIndex += sizeof(ushort);
+                                    break;
+                                case SearchDataTypes._32bits:
+                                    CurrentIndex += sizeof(uint);
+                                    break;
+                                case SearchDataTypes._64bits:
+                                    CurrentIndex += sizeof(ulong);
+                                    break;
+                            }                            
                         }
                      
                     }
@@ -1703,85 +1717,6 @@
             bool unsigned = SearchArgs.IsUnsignedDataType;
             using (SearchResultReader reader = new SearchResultReader())
             {
-
-                object result_value = 0;
-                uint address = 0;
-                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;
-                }
-
-
-
-                logger.Debug.WriteLine(string.Format("Results Count -> 0x{0:x8}", reader.ResultCount));
-
-
-                if (reader.ResultCount == 1) // debug message for 1 result using 32bit unsigned
-                    logger.Debug.WriteLine(string.Format("Debug: Found 1 result -> Address: 0x{0:x8} Value: 0x{1:x16}", address, result_value));
-
                 logger.Info.WriteLine(string.Format("Found 0x{0:x8} results", reader.ResultCount));
 
                 if (reader.ResultCount <= MIN_NUMBER_OF_RESULTS_BEFORE_DISPLAY)
@@ -1797,7 +1732,7 @@
                         {
 
                             case SearchDataTypes._8bits:
-                                if (SearchArgs.IsUnsignedDataType) { ResultType<byte> result = reader.GetNextResult<byte>(); item = new ResultItem(result.Address, false, result.Value); }
+                                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:

 

  ViewVC Help
Powered by ViewVC 1.1.22