public static ObservableCollection<WebSite> GetAllWebsites(IFileIO fileIO) { if (fileIO == null) { throw new ArgumentNullException("fileIO"); } IEnumerable<XElement> xdoc = null; try { xdoc = fileIO.GetSitesSection(); } catch (Exception ex) { throw new ApplicationException( String.Format("Error access IIS Express applicationhost config file: {0}", ex.Message)); } if (xdoc == null) { return null; } try { return new ObservableCollection<WebSite>( from site in xdoc.Descendants("site") select new WebSite( Convert.ToInt32(site.Attribute("id").Value), site.Attribute("name").Value, site.Attribute("serverAutoStart") == null ? true : Convert.ToBoolean(site.Attribute("serverAutoStart").Value), site.Element("application").Attribute("path").Value, site.Element("application").Attribute("applicationPool") == null ? string.Empty : site.Element("application").Attribute("applicationPool").Value, site.Element("application").Element("virtualDirectory").Attribute("path").Value, site.Element("application").Element("virtualDirectory").Attribute("physicalPath").Value, (BindingProtocol)Enum.Parse(typeof(BindingProtocol), site.Element("bindings").Element("binding").Attribute("protocol").Value), site.Element("bindings").Element("binding").Attribute("bindingInformation").Value, fileIO.Exists(site.Element("application").Element("virtualDirectory").Attribute("physicalPath").Value))); } catch (Exception ex) { throw new ApplicationException( String.Format("Error parsing applicationhost config file: {0}", ex.Message)); } }
public static WebSite Create(IFileIO fileIO, int id, string name, bool serverAutoStart, string applicationPath, string applicationPool, string virtualPath, string physicalPath, BindingProtocol protocol, string bindingInfo) { var dirIsValid = false; try { dirIsValid = fileIO.Exists(physicalPath); var newSite = new WebSite(id, name, serverAutoStart, applicationPath, applicationPool, virtualPath, physicalPath, protocol, bindingInfo, dirIsValid); newSite.Save(fileIO); return newSite; } catch (Exception ex) { throw new ApplicationException(string.Format("Error creating new website: {0}", ex)); } }
public bool SolutionExists() { return(m_FileIOProvider.Exists(SolutionFile())); }
public bool HasSolutionBeenGenerated() { return(m_FileIOProvider.Exists(SolutionFile())); }
public bool ProjectExists(Compilation.Assembly assembly) { return(m_fileIOProvider.Exists(ProjectFile(assembly))); }