public void BuildExistingSiteList() { listViewSites.Items.Clear(); _XAMPPInstallDir = ConfigManager.GetXAMPPInstallDir(); _XAMPPWebRootPath = Path.Combine(_XAMPPInstallDir, "htdocs"); _XAMPPApacheVhostsConfigFile = Path.Combine(_XAMPPInstallDir, "apache\\conf\\extra\\httpd-vhosts.conf"); if (!CheckSettings()) { return; } _vhostsManager = new ApacheVhostsConfigManager(_XAMPPApacheVhostsConfigFile, _XAMPPWebRootPath); listViewSites.Items.Clear(); List<VhostsEntry> vhostEntries = _vhostsManager.GetVHostEntries(); List<HostsEntry> hostsEntries = _hostsManager.GetHostsEntries(); List<DirectoryInfo> sites = new DirectoryInfo(_XAMPPWebRootPath).GetDirectories("*", SearchOption.TopDirectoryOnly).ToList(); foreach (VhostsEntry vHostEntry in vhostEntries) { if (hostsEntries.Count(p => p.DomainName == vHostEntry.ServerName) > 0 || sites.Count(p => p.Name == vHostEntry.ServerName) > 0) { ListViewItem lvi = new ListViewItem(vHostEntry.ServerName); lvi.SubItems.Add("OK"); listViewSites.Items.Add(lvi); } } }
public FormAddNewSite(ApacheVhostsConfigManager vhostsParser, HostsFileManager hostsParser, string XAMPPSiteRootDir, string XAMPPSiteInstallDir) { InitializeComponent(); _vhostsManager = vhostsParser; _hostsManager = hostsParser; _XAMPPSiteRoot = XAMPPSiteRootDir; _XAMPPSiteInstallDir = XAMPPSiteInstallDir; }