43 |
using RomCheater.Core; |
using RomCheater.Core; |
44 |
using RomCheater.PluginFramework.Core; |
using RomCheater.PluginFramework.Core; |
45 |
using ManagedWinapi; |
using ManagedWinapi; |
46 |
|
using Enterprise.Logging; |
47 |
|
|
48 |
namespace RomCheater.Docking |
namespace RomCheater.Docking |
49 |
{ |
{ |
1004 |
} |
} |
1005 |
catch (Exception ex) |
catch (Exception ex) |
1006 |
{ |
{ |
1007 |
logger.Error.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1008 |
} |
} |
1009 |
} |
} |
1010 |
|
|
1252 |
bool unsigned = SearchArgs.IsUnsignedDataType; |
bool unsigned = SearchArgs.IsUnsignedDataType; |
1253 |
SearchDataTypes sdt = SearchArgs.DataType; |
SearchDataTypes sdt = SearchArgs.DataType; |
1254 |
//byte[] buffered_mem = new byte[(MemoryRangeSize - MemoryRangeStart)]; // throws OutOfMemoryException if size is over 2G |
//byte[] buffered_mem = new byte[(MemoryRangeSize - MemoryRangeStart)]; // throws OutOfMemoryException if size is over 2G |
1255 |
logger.Debug.WriteLine(string.Format("Buffered Memory Size -> 0x{0:x8}", MemoryRangeSize - MemoryRangeStart)); |
gLog.Debug.WriteLine(string.Format("Buffered Memory Size -> 0x{0:x8}", MemoryRangeSize - MemoryRangeStart)); |
1256 |
UpdateProgress(0, string.Format("Search is Warming Up...Please Wait...")); |
UpdateProgress(0, string.Format("Search is Warming Up...Please Wait...")); |
1257 |
//new Action<int, string>(UpdateProgress).Invoke(0, string.Format("Search is Warming Up...Please Wait...")); |
//new Action<int, string>(UpdateProgress).Invoke(0, string.Format("Search is Warming Up...Please Wait...")); |
1258 |
Stopwatch provider_st = new Stopwatch(); |
Stopwatch provider_st = new Stopwatch(); |
1318 |
} |
} |
1319 |
catch (Exception ex) |
catch (Exception ex) |
1320 |
{ |
{ |
1321 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1322 |
} |
} |
1323 |
} |
} |
1324 |
comparer.Value = value; |
comparer.Value = value; |
1359 |
} |
} |
1360 |
catch (Exception ex) |
catch (Exception ex) |
1361 |
{ |
{ |
1362 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1363 |
} |
} |
1364 |
} |
} |
1365 |
comparer.Value = value; |
comparer.Value = value; |
1401 |
} |
} |
1402 |
catch (Exception ex) |
catch (Exception ex) |
1403 |
{ |
{ |
1404 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1405 |
} |
} |
1406 |
} |
} |
1407 |
comparer.Value = value; |
comparer.Value = value; |
1442 |
} |
} |
1443 |
catch (Exception ex) |
catch (Exception ex) |
1444 |
{ |
{ |
1445 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1446 |
} |
} |
1447 |
} |
} |
1448 |
comparer.Value = value; |
comparer.Value = value; |
1484 |
} |
} |
1485 |
catch (Exception ex) |
catch (Exception ex) |
1486 |
{ |
{ |
1487 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1488 |
} |
} |
1489 |
} |
} |
1490 |
comparer.Value = value; |
comparer.Value = value; |
1525 |
} |
} |
1526 |
catch (Exception ex) |
catch (Exception ex) |
1527 |
{ |
{ |
1528 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1529 |
} |
} |
1530 |
} |
} |
1531 |
comparer.Value = value; |
comparer.Value = value; |
1567 |
} |
} |
1568 |
catch (Exception ex) |
catch (Exception ex) |
1569 |
{ |
{ |
1570 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1571 |
} |
} |
1572 |
} |
} |
1573 |
comparer.Value = value; |
comparer.Value = value; |
1608 |
} |
} |
1609 |
catch (Exception ex) |
catch (Exception ex) |
1610 |
{ |
{ |
1611 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1612 |
} |
} |
1613 |
} |
} |
1614 |
comparer.Value = value; |
comparer.Value = value; |
1690 |
{ |
{ |
1691 |
UpdateProgress((int)double_percent_done, message); |
UpdateProgress((int)double_percent_done, message); |
1692 |
Last_Whole_Percent_Done = int_percent_done; |
Last_Whole_Percent_Done = int_percent_done; |
1693 |
logger.Profiler.WriteLine("It has taken {0} seconds to pre-populate the address array.", st_profiler_reader_addresses.Elapsed.TotalSeconds); |
gLog.Profiler.WriteLine("It has taken {0} seconds to pre-populate the address array.", st_profiler_reader_addresses.Elapsed.TotalSeconds); |
1694 |
} |
} |
1695 |
|
|
1696 |
reader_address_index++; |
reader_address_index++; |
1697 |
} |
} |
1698 |
st_profiler_reader_addresses.Stop(); |
st_profiler_reader_addresses.Stop(); |
1699 |
logger.Profiler.WriteLine("It took a total of {0} seconds to pre-populate the address array.", st_profiler_reader_addresses.Elapsed.TotalSeconds); |
gLog.Profiler.WriteLine("It took a total of {0} seconds to pre-populate the address array.", st_profiler_reader_addresses.Elapsed.TotalSeconds); |
1700 |
} |
} |
1701 |
GC.Collect(); // force gc collection |
GC.Collect(); // force gc collection |
1702 |
#endregion |
#endregion |
1765 |
} |
} |
1766 |
catch (Exception ex) |
catch (Exception ex) |
1767 |
{ |
{ |
1768 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1769 |
} |
} |
1770 |
} |
} |
1771 |
comparer.Value = value; |
comparer.Value = value; |
1801 |
} |
} |
1802 |
catch (Exception ex) |
catch (Exception ex) |
1803 |
{ |
{ |
1804 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
1805 |
} |
} |
1806 |
} |
} |
1807 |
comparer.Value = value; |
comparer.Value = value; |
2298 |
|
|
2299 |
} |
} |
2300 |
provider_st.Stop(); |
provider_st.Stop(); |
2301 |
logger.Profiler.WriteLine("It took a total of {0} seconds for the memory provider to complete it's operation(s).", provider_st.Elapsed.TotalSeconds); |
gLog.Profiler.WriteLine("It took a total of {0} seconds for the memory provider to complete it's operation(s).", provider_st.Elapsed.TotalSeconds); |
2302 |
//if (buffered_mem.Length == 0) { logger.Warn.WriteLine("Buffered Memory is Zero Length."); return; } |
//if (buffered_mem.Length == 0) { logger.Warn.WriteLine("Buffered Memory is Zero Length."); return; } |
2303 |
//int Last_Whole_Percent_Done = 0; |
//int Last_Whole_Percent_Done = 0; |
2304 |
|
|
2431 |
catch (OutOfMemoryException ex) |
catch (OutOfMemoryException ex) |
2432 |
{ |
{ |
2433 |
e.Result = true; |
e.Result = true; |
2434 |
logger.Error.WriteLine("Encounted {0} for search: {0}", ex.GetType().Name, SearchGuid.ToString()); |
gLog.Error.WriteLine("Encounted {0} for search: {0}", ex.GetType().Name, SearchGuid.ToString()); |
2435 |
logger.VerboseError.WriteLine(ex.ToString()); |
gLog.Verbose.Error.WriteLine(ex.ToString()); |
2436 |
MessageBox.Show(string.Format("Encounted {0} for search: {0} ... Please try again.", ex.GetType().Name, SearchGuid.ToString()), string.Format("{0} was thrown", ex.GetType().Name), MessageBoxButtons.OK, MessageBoxIcon.Error); |
MessageBox.Show(string.Format("Encounted {0} for search: {0} ... Please try again.", ex.GetType().Name, SearchGuid.ToString()), string.Format("{0} was thrown", ex.GetType().Name), MessageBoxButtons.OK, MessageBoxIcon.Error); |
2437 |
return; |
return; |
2438 |
} |
} |
2455 |
|
|
2456 |
private void SearchWorkerThread_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) |
private void SearchWorkerThread_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) |
2457 |
{ |
{ |
2458 |
try { if ((bool)e.Result) { logger.Warn.WriteLine("Search operation was cancelled."); |
try { if ((bool)e.Result) { gLog.Warn.WriteLine("Search operation was cancelled."); |
2459 |
//new Action<int, string>(UpdateProgress).Invoke(0, string.Empty); |
//new Action<int, string>(UpdateProgress).Invoke(0, string.Empty); |
2460 |
UpdateProgress(0, string.Empty); |
UpdateProgress(0, string.Empty); |
2461 |
return; } |
return; } |
2465 |
{ |
{ |
2466 |
Stopwatch st = (Stopwatch)e.Result; |
Stopwatch st = (Stopwatch)e.Result; |
2467 |
st.Stop(); |
st.Stop(); |
2468 |
logger.Profiler.WriteLine("Search took {0} seconds, overall, to complete.", st.Elapsed.TotalSeconds); |
gLog.Profiler.WriteLine("Search took {0} seconds, overall, to complete.", st.Elapsed.TotalSeconds); |
2469 |
} |
} |
2470 |
catch (InvalidCastException) { } |
catch (InvalidCastException) { } |
2471 |
catch (Exception ex) { throw ex; } |
catch (Exception ex) { throw ex; } |
2475 |
bool unsigned = SearchArgs.IsUnsignedDataType; |
bool unsigned = SearchArgs.IsUnsignedDataType; |
2476 |
using (SearchResultReader reader = new SearchResultReader(SearchGuid, SearchArgs.IsUnsignedDataType, SearchArgs.DataType, new Action<int, string>(UpdateProgress), new Func<bool>(ShouldCancelAnySearchOperation))) |
using (SearchResultReader reader = new SearchResultReader(SearchGuid, SearchArgs.IsUnsignedDataType, SearchArgs.DataType, new Action<int, string>(UpdateProgress), new Func<bool>(ShouldCancelAnySearchOperation))) |
2477 |
{ |
{ |
2478 |
logger.Info.WriteLine(string.Format("Found 0x{0:x8} results", reader.ResultCount)); |
gLog.Info.WriteLine(string.Format("Found 0x{0:x8} results", reader.ResultCount)); |
2479 |
|
|
2480 |
if (reader.ResultCount <= MIN_NUMBER_OF_RESULTS_BEFORE_DISPLAY) |
if (reader.ResultCount <= MIN_NUMBER_OF_RESULTS_BEFORE_DISPLAY) |
2481 |
{ |
{ |
2601 |
else if (radio_16bits.Checked) { _data_type = SearchDataTypes._16bits; } |
else if (radio_16bits.Checked) { _data_type = SearchDataTypes._16bits; } |
2602 |
else if (radio_32bits.Checked) { _data_type = SearchDataTypes._32bits; } |
else if (radio_32bits.Checked) { _data_type = SearchDataTypes._32bits; } |
2603 |
else if (radio_64bits.Checked) { _data_type = SearchDataTypes._64bits; } |
else if (radio_64bits.Checked) { _data_type = SearchDataTypes._64bits; } |
2604 |
else { logger.Error.WriteLine("Could not determine search data type bit size. (was not 8/16/32/or 64bits)"); } |
else { gLog.Error.WriteLine("Could not determine search data type bit size. (was not 8/16/32/or 64bits)"); } |
2605 |
// get compare type |
// get compare type |
2606 |
if (radiocompare_equal.Checked) { _compare_type = SearchCompareTypes.Equal; } |
if (radiocompare_equal.Checked) { _compare_type = SearchCompareTypes.Equal; } |
2607 |
else if (radiocompare_greaterthan.Checked) { _compare_type = SearchCompareTypes.GreaterThan; } |
else if (radiocompare_greaterthan.Checked) { _compare_type = SearchCompareTypes.GreaterThan; } |
2611 |
else if (radiocompare_notequal.Checked) { _compare_type = SearchCompareTypes.NotEqual; } |
else if (radiocompare_notequal.Checked) { _compare_type = SearchCompareTypes.NotEqual; } |
2612 |
else if (radiocompare_between.Checked) { _compare_type = SearchCompareTypes.Between; } |
else if (radiocompare_between.Checked) { _compare_type = SearchCompareTypes.Between; } |
2613 |
else if (radiocompare_notbetween.Checked) { _compare_type = SearchCompareTypes.NotBetween; } |
else if (radiocompare_notbetween.Checked) { _compare_type = SearchCompareTypes.NotBetween; } |
2614 |
else { logger.Error.WriteLine("Could not determine search comparison type. (was not == > < >= <= != <> or !<>)"); } |
else { gLog.Error.WriteLine("Could not determine search comparison type. (was not == > < >= <= != <> or !<>)"); } |
2615 |
// get compare valure type |
// get compare valure type |
2616 |
if (radio_oldvalue.Checked) { _compare_value_type = CompareValueTypes.OldValue; } |
if (radio_oldvalue.Checked) { _compare_value_type = CompareValueTypes.OldValue; } |
2617 |
else if (radio_specificvalue.Checked) { _compare_value_type = CompareValueTypes.SpecificValue; } |
else if (radio_specificvalue.Checked) { _compare_value_type = CompareValueTypes.SpecificValue; } |
2618 |
else { logger.Error.WriteLine("Could not determine search comparison type. (was not old or specific value"); } |
else { gLog.Error.WriteLine("Could not determine search comparison type. (was not old or specific value"); } |
2619 |
|
|
2620 |
if (_compare_value_type == CompareValueTypes.SpecificValue || (_compare_type == SearchCompareTypes.Between || _compare_type == SearchCompareTypes.NotBetween)) |
if (_compare_value_type == CompareValueTypes.SpecificValue || (_compare_type == SearchCompareTypes.Between || _compare_type == SearchCompareTypes.NotBetween)) |
2621 |
{ |
{ |