public ListViewItem ToListViewItem(PortScanMode Mode) { try { ListViewItem lvI = new ListViewItem(); lvI.Tag = this; if (_HostName != "") { lvI.Text = _HostName; } else { lvI.Text = _HostIP; } if (Mode == PortScanMode.Import) { lvI.SubItems.Add(BoolToYesNo(_SSH)); lvI.SubItems.Add(BoolToYesNo(_Telnet)); lvI.SubItems.Add(BoolToYesNo(_HTTP)); lvI.SubItems.Add(BoolToYesNo(_HTTPS)); lvI.SubItems.Add(BoolToYesNo(Rlogin)); lvI.SubItems.Add(BoolToYesNo(Serial)); lvI.SubItems.Add(BoolToYesNo(_RDP)); lvI.SubItems.Add(BoolToYesNo(_VNC)); } else { string strOpen = ""; string strClosed = ""; foreach (int p in _OpenPorts) { strOpen += System.Convert.ToString(p.ToString() + ", "); } foreach (int p in _ClosedPorts) { strClosed += System.Convert.ToString(p.ToString() + ", "); } lvI.SubItems.Add(strOpen.Substring(0, System.Convert.ToInt32(strOpen.Length > 0 ? strOpen.Length - 2 : strOpen.Length))); lvI.SubItems.Add(strClosed.Substring(0, System.Convert.ToInt32(strClosed.Length > 0 ? strClosed.Length - 2 : strClosed.Length))); } return(lvI); } catch (Exception) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "ToString failed (Tools.PortScan)", true); return(null); } }
public static void Show(Type WindowType, PortScanMode PortScanMode = PortScanMode.Normal) { try { switch (WindowType) { case Type.About: if (aboutForm == null || aboutPanel == null | aboutPanel.VisibleState==DockState.Unknown) { aboutForm = new About(aboutPanel); aboutPanel = aboutForm; aboutForm.Show(frmMain.Default.pnlDock); } else { aboutPanel.Focus(); aboutPanel.Show(); aboutPanel.BringToFront(); aboutForm.Focus(); } break; case Type.ADImport: adimportForm = new ADImport(adimportPanel); adimportPanel = adimportForm; adimportPanel.Show(frmMain.Default.pnlDock); break; case Type.Options: optionsForm = new frmOptions(optionsPanel); optionsForm.Show(frmMain.Default.pnlDock); break; case Type.SaveAs: saveasForm = new SaveAs(saveasPanel); saveasPanel = saveasForm; saveasForm.Show(frmMain.Default.pnlDock); break; case Type.SSHTransfer: sshtransferForm = new SSHTransfer(sshtransferPanel); sshtransferPanel = sshtransferForm; sshtransferForm.Show(frmMain.Default.pnlDock); break; case Type.Update: if (updateForm == null || updatePanel == null || updatePanel.VisibleState == DockState.Unknown) { updateForm = new UI.Window.Update(updatePanel); updatePanel = updateForm; updateForm.Show(frmMain.Default.pnlDock); } else { updatePanel.Focus(); updatePanel.Show(); updatePanel.BringToFront(); updateForm.Focus(); } break; case Type.Help: helpForm = new Help(helpPanel); helpPanel = helpForm; helpForm.Show(frmMain.Default.pnlDock); break; case Type.ExternalApps: if (externalappsForm == null || externalappsPanel == null || externalappsPanel.VisibleState == DockState.Unknown) { externalappsForm = new ExternalApps(externalappsPanel); externalappsPanel = externalappsForm; externalappsForm.Show(frmMain.Default.pnlDock); } else { externalappsPanel.Focus(); externalappsPanel.Show(); externalappsPanel.BringToFront(); externalappsForm.Focus(); } break; case Type.PortScan: portscanForm = new PortScan(portscanPanel, PortScanMode); portscanPanel = portscanForm; portscanForm.Show(frmMain.Default.pnlDock); break; case Type.UltraVNCSC: ultravncscForm = new UltraVNCSC(ultravncscPanel); ultravncscPanel = ultravncscForm; ultravncscForm.Show(frmMain.Default.pnlDock); break; case Type.ComponentsCheck: if (componentscheckForm == null || componentscheckPanel == null || componentscheckPanel.VisibleState == DockState.Unknown) { componentscheckForm = new ComponentsCheck(componentscheckPanel); componentscheckPanel = componentscheckForm; componentscheckForm.Show(frmMain.Default.pnlDock); } else { componentscheckPanel.Focus(); componentscheckPanel.Show(); componentscheckPanel.BringToFront(); componentscheckForm.Focus(); } break; case Type.Announcement: AnnouncementForm = new UI.Window.Announcement(AnnouncementPanel); AnnouncementPanel = AnnouncementForm; AnnouncementForm.Show(frmMain.Default.pnlDock); break; case Type.ConnectionStatus: connectionStatusForm = new ConnectionStatusForm(); componentscheckPanel = connectionStatusForm; connectionStatusForm.Show(frmMain.Default.pnlDock); break; case Type.QuickText: if (quicktextPanel != null && (quicktextForm == null || quicktextPanel == null | quicktextPanel.VisibleState == DockState.Unknown)) { quicktextForm = new QuickTextEdit(quicktextPanel); quicktextPanel = quicktextForm; quicktextForm.Show(frmMain.Default.pnlDock); } else { quicktextPanel.Focus(); quicktextPanel.Show(); quicktextPanel.BringToFront(); quicktextForm.Focus(); } break; } } catch (Exception ex) { MessageCollector.AddMessage(MessageClass.ErrorMsg, (string) ("Show (Runtime.Windows) failed" + Constants.vbNewLine + ex.Message), true); } }
public ListViewItem ToListViewItem(PortScanMode Mode) { try { ListViewItem lvI = new ListViewItem(); lvI.Tag = this; if (_HostName != "") { lvI.Text = _HostName; } else { lvI.Text = _HostIP; } if (Mode == PortScanMode.Import) { lvI.SubItems.Add(BoolToYesNo(_SSH)); lvI.SubItems.Add(BoolToYesNo(_Telnet)); lvI.SubItems.Add(BoolToYesNo(_HTTP)); lvI.SubItems.Add(BoolToYesNo(_HTTPS)); lvI.SubItems.Add(BoolToYesNo(Rlogin)); lvI.SubItems.Add(BoolToYesNo(Serial)); lvI.SubItems.Add(BoolToYesNo(_RDP)); lvI.SubItems.Add(BoolToYesNo(_VNC)); } else { string strOpen = ""; string strClosed = ""; foreach (int p in _OpenPorts) { strOpen += System.Convert.ToString(p.ToString() + ", "); } foreach (int p in _ClosedPorts) { strClosed += System.Convert.ToString(p.ToString() + ", "); } lvI.SubItems.Add(strOpen.Substring(0, System.Convert.ToInt32(strOpen.Length > 0 ? strOpen.Length - 2 : strOpen.Length))); lvI.SubItems.Add(strClosed.Substring(0, System.Convert.ToInt32(strClosed.Length > 0 ? strClosed.Length - 2 : strClosed.Length))); } return lvI; } catch (Exception) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "ToString failed (Tools.PortScan)", true); return null; } }