/// <summary> /// Tries to find a valid packet provider, asks the user to select one /// if there are multiple windows. /// </summary> /// <param name="selectSingle">If true a single valid candidate will be selected without prompt.</param> /// <returns></returns> private bool SelectPacketProvider(bool selectSingle) { var alissaWindows = WinApi.FindAllWindows("mod_Alissa"); FoundWindow window = null; if (alissaWindows.Count == 0) { MessageBox.Show("No packet provider found.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else if (selectSingle && alissaWindows.Count == 1) { window = alissaWindows[0]; } else { var form = new FrmAlissaSelection(alissaWindows, LblPacketProvider.Text); if (form.ShowDialog() == DialogResult.Cancel) { return(false); } window = FrmAlissaSelection.Selection; } alissaHWnd = window.HWnd; LblPacketProvider.Text = window.ClassName; return(true); }
/// <summary> /// Tries to find a valid packet provider, asks the user to select one /// if there are multiple windows. /// </summary> /// <param name="selectSingle">If true a single valid candidate will be selected without prompt.</param> /// <returns></returns> private bool SelectPacketProvider(bool selectSingle) { var alissaWindows = WinApi.FindAllWindows("mod_Alissa"); FoundWindow window = null; if (alissaWindows.Count == 0) { MessageBox.Show("No packet provider found.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } else if (selectSingle && alissaWindows.Count == 1) { window = alissaWindows[0]; } else { var form = new FrmAlissaSelection(alissaWindows, LblPacketProvider.Text); if (form.ShowDialog() == DialogResult.Cancel) return false; window = FrmAlissaSelection.Selection; } alissaHWnd = window.HWnd; LblPacketProvider.Text = window.ClassName; return true; }