34 |
#region IAcceptsProcessPID |
#region IAcceptsProcessPID |
35 |
public int ProcessPID { get; set; } |
public int ProcessPID { get; set; } |
36 |
#endregion |
#endregion |
37 |
#region IAcceptsPlugin<IConfigPlugin> members |
#region IAcceptsPlugin<IConfigPlugin> members |
38 |
public IConfigPlugin AcceptedPlugin { get; set; } |
private IConfigPlugin _AcceptedPlugin; |
39 |
|
public IConfigPlugin AcceptedPlugin { |
40 |
|
get { return _AcceptedPlugin; } |
41 |
|
set { _AcceptedPlugin = value; ProcessWatcherTimer.Enabled = (value != null); } } |
42 |
#endregion |
#endregion |
43 |
#region IAcceptsChangedProcess members |
#region IAcceptsChangedProcess members |
44 |
public event BaseEventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged; |
public event BaseEventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged; |
101 |
//} |
//} |
102 |
|
|
103 |
private void btnRefresh_Click(object sender, EventArgs e) |
private void btnRefresh_Click(object sender, EventArgs e) |
104 |
{ |
{ |
105 |
this.RefreshList(); |
//this.RefreshList(); |
106 |
} |
} |
107 |
|
|
108 |
private bool RefreshList() |
private bool RefreshList() |
109 |
{ |
{ |
110 |
|
//if (this.AcceptedPlugin == null) { return false; }; |
111 |
isRefreshing = true; |
isRefreshing = true; |
112 |
lstProcessList.Items.Clear(); |
lstProcessList.Items.Clear(); |
113 |
|
//logger.VerboseDebug.WriteLine(System.Environment.StackTrace); |
114 |
this.AcceptedPlugin.Reload(true); |
this.AcceptedPlugin.Reload(true); |
115 |
// create a selection of PCSX2 processes |
// create a selection of PCSX2 processes |
116 |
List<ProcContainer> proc_list = AcceptedPlugin.ValidProcessesForPlugin; |
List<ProcContainer> proc_list = AcceptedPlugin.ValidProcessesForPlugin; |
208 |
if (AcceptedPlugin == null || this.DesignMode) return; |
if (AcceptedPlugin == null || this.DesignMode) return; |
209 |
txtstatus_Pid.Text = ""; |
txtstatus_Pid.Text = ""; |
210 |
txtstatus_Filename.Text = ""; |
txtstatus_Filename.Text = ""; |
211 |
btnRefresh.PerformClick(); |
this.RefreshList(); |
212 |
} |
} |
213 |
|
|
214 |
|
|
232 |
if (!fi.Exists) { logger.Warn.WriteLine("Cannot load and attach to non-existing exe file: {0}", fi.FullName); return; } |
if (!fi.Exists) { logger.Warn.WriteLine("Cannot load and attach to non-existing exe file: {0}", fi.FullName); return; } |
233 |
Process p = Process.Start(fi.FullName); |
Process p = Process.Start(fi.FullName); |
234 |
this.ProcessPID = p.Id; |
this.ProcessPID = p.Id; |
235 |
isAttachingToProcess = true; |
isAttachingToProcess = true; |
236 |
} |
} |
237 |
|
|
238 |
private void ProcessWatcherTimer_Tick(object sender, EventArgs e) |
private void ProcessWatcherTimer_Tick(object sender, EventArgs e) |
241 |
//if (lstProcessList.Items.Count == 0) return; |
//if (lstProcessList.Items.Count == 0) return; |
242 |
isAutoRefreshing = true; |
isAutoRefreshing = true; |
243 |
int pid = this.ProcessPID; |
int pid = this.ProcessPID; |
244 |
btnRefresh.PerformClick(); |
this.RefreshList(); |
245 |
bool pid_still_exists = false; |
bool pid_still_exists = false; |
246 |
int item_index = -1; |
int item_index = -1; |
247 |
foreach (ListViewItem li2 in lstProcessList.Items) |
foreach (ListViewItem li2 in lstProcessList.Items) |
256 |
} |
} |
257 |
if (pid_still_exists) |
if (pid_still_exists) |
258 |
{ |
{ |
259 |
//logger.Debug.WriteLine("Pid: {0} still exists", pid); |
//logger.Debug.WriteLine("Pid: {0} still exists", pid); |
260 |
if (lstProcessList.SelectedItems.Count > 0) |
if (lstProcessList.SelectedItems.Count > 0) |
261 |
{ |
{ |
262 |
if (lstProcessList.SelectedItems[0] != null) |
if (lstProcessList.SelectedItems[0] != null) |