Skip to content

Commit 9005359

Browse files
committed
Changed callback.
1 parent 41dcf03 commit 9005359

File tree

5 files changed

+15
-21
lines changed

5 files changed

+15
-21
lines changed

Core/CoreFunctionsManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ public void SetActiveFunctionsProvider(string provider)
9292

9393
#region Plugin Functions
9494

95-
public void EnumerateProcesses(Action<Tuple<IntPtr, string>> callbackProcess)
95+
public void EnumerateProcesses(Action<ProcessInfo> callbackProcess)
9696
{
9797
var c = callbackProcess == null ? null : (EnumerateProcessCallback)delegate (ref EnumerateProcessData data)
9898
{
99-
callbackProcess(Tuple.Create(data.Id, data.Path));
99+
callbackProcess(new ProcessInfo(data.Id, data.Path));
100100
};
101101

102102
currentFunctions.EnumerateProcesses(c);

Core/ICoreProcessFunctions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using ReClassNET.Debugger;
3-
using ReClassNET.Memory;
4-
using ReClassNET.Native;
53

64
namespace ReClassNET.Core
75
{

Core/InternalCoreFunctions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Runtime.InteropServices;
3-
using ReClassNET.Native;
43

54
namespace ReClassNET.Core
65
{

Forms/ProcessBrowserForm.cs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,9 @@ public ProcessInfo SelectedProcess
2929
{
3030
get
3131
{
32-
var row = (processDataGridView.SelectedRows.Cast<DataGridViewRow>().FirstOrDefault()?.DataBoundItem as DataRowView)?.Row;
33-
if (row != null)
34-
{
35-
return new ProcessInfo(row.Field<IntPtr>("id"), row.Field<string>("name"), row.Field<string>("path"));
36-
}
37-
return null;
32+
return (processDataGridView.SelectedRows.Cast<DataGridViewRow>().FirstOrDefault()?.DataBoundItem as DataRowView)
33+
?.Row
34+
?.Field<ProcessInfo>("info");
3835
}
3936
}
4037

@@ -116,17 +113,18 @@ private void RefreshProcessList()
116113
dt.Columns.Add("name", typeof(string));
117114
dt.Columns.Add("id", typeof(IntPtr));
118115
dt.Columns.Add("path", typeof(string));
116+
dt.Columns.Add("info", typeof(ProcessInfo));
119117

120-
coreFunctions.EnumerateProcesses(data =>
118+
coreFunctions.EnumerateProcesses(p =>
121119
{
122-
var moduleName = Path.GetFileName(data.Item2);
123-
if (!filterCheckBox.Checked || !CommonProcesses.Contains(moduleName.ToLower()))
120+
if (!filterCheckBox.Checked || !CommonProcesses.Contains(p.Name.ToLower()))
124121
{
125122
var row = dt.NewRow();
126-
row["icon"] = NativeMethods.GetIconForFile(data.Item2);
127-
row["name"] = moduleName;
128-
row["id"] = data.Item1;
129-
row["path"] = data.Item2;
123+
row["icon"] = NativeMethods.GetIconForFile(p.Path);
124+
row["name"] = p.Name;
125+
row["id"] = p.Id;
126+
row["path"] = p.Path;
127+
row["info"] = p;
130128
dt.Rows.Add(row);
131129
}
132130
});

Memory/ProcessInfo.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ public class ProcessInfo
99
public string Name { get; }
1010
public string Path { get; }
1111

12-
public ProcessInfo(IntPtr id, string name, string path)
12+
public ProcessInfo(IntPtr id, string path)
1313
{
14-
Contract.Requires(name != null);
1514
Contract.Requires(path != null);
1615

1716
Id = id;
18-
Name = name;
17+
Name = System.IO.Path.GetFileName(path);
1918
Path = path;
2019
}
2120
}

0 commit comments

Comments
 (0)