Skip to content

Commit

Permalink
Bug fixes, changed some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
integralfx authored Mar 2, 2019
1 parent 3276c37 commit cef5107
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion MemTestHelper/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 21 additions & 11 deletions MemTestHelper/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Management;
Expand Down Expand Up @@ -686,25 +687,26 @@ private void start_memtests()
state.is_finished = false;
memtest_states[i] = state;
// wait for processes to start
Thread.Sleep(threads * 50);
IntPtr hwnd = memtest_states[i].proc.MainWindowHandle;
if (chk_start_min.Checked)
ShowWindow(hwnd, SW_MINIMIZE);
else
// wait for process to start
while (string.IsNullOrEmpty(state.proc.MainWindowTitle))
{
move_memtests();
Activate();
Thread.Sleep(100);
state.proc.Refresh();
}
IntPtr hwnd = state.proc.MainWindowHandle;
double ram = Convert.ToDouble(txt_ram.Text) / threads;
ControlSetText(hwnd, MEMTEST_EDT_RAM, $"{ram:f2}");
ControlSetText(hwnd, MEMTEST_STATIC_FREE_VER, "Modified version by ∫ntegral#7834");
ControlClick(hwnd, MEMTEST_BTN_START);
if (chk_start_min.Checked)
ShowWindow(hwnd, SW_MINIMIZE);
});

if (!chk_start_min.Checked)
move_memtests();
}

private void move_memtests()
Expand All @@ -731,6 +733,7 @@ private void move_memtests()
});
}

// only close MemTests started by MemTestHelper
private void close_memtests()
{
Parallel.ForEach(memtest_states, s =>
Expand All @@ -742,6 +745,10 @@ private void close_memtests()
});
}

/*
* close all MemTests, regardless of if they were
* started by MemTestHelper
*/
private void close_all_memtests()
{
// remove the .exe
Expand All @@ -764,7 +771,10 @@ private Tuple<double, int> get_coverage_info(IntPtr hwnd)

// 47.3% Coverage, 0 Errors
// ^^^^
double coverage = Convert.ToDouble(str.Split("%".ToCharArray())[0]);
// some countries use a comma as the decimal point
string coverage_str = str.Split("%".ToCharArray())[0].Replace(',', '.');
double coverage = 0;
double.TryParse(coverage_str, NumberStyles.Any, CultureInfo.InvariantCulture, out coverage);

// 47.3% Coverage, 0 Errors
// ^^^^^^^^
Expand Down

0 comments on commit cef5107

Please sign in to comment.