protected ProjectPage(string areaName, string projectName, string pageName, PageDocument pageDocument, BuildOwners buildOwners) { if (String.IsNullOrEmpty(areaName)) throw new ArgumentNullException(nameof(areaName)); if (String.IsNullOrEmpty(projectName)) throw new ArgumentNullException(nameof(projectName)); if (String.IsNullOrEmpty(pageName)) throw new ArgumentNullException(nameof(pageName)); if (pageDocument == null) throw new ArgumentNullException(nameof(pageDocument)); if (buildOwners == null) throw new ArgumentNullException(nameof(buildOwners)); AreaName = areaName; ProjectName = projectName; m_page = pageName; m_root = pageDocument.Root; m_owners = buildOwners; m_properties = ParseProperties(m_root); Description = ParseDescription(m_properties); Owner = ParseOwner(m_properties); Status = ParseStatus(m_properties); }
public LibraryProjectPage(string areaName, string projectName, string pageName, PageDocument pageDocument, BuildOwners buildOwners) : base(areaName, projectName, pageName, pageDocument, buildOwners) { Framework = ParseFramework(m_properties); Documentation = ParseDocumentation(m_properties); Namespace = ParseNamespace(m_properties); }
protected BasicProjectPage(string areaName, string projectName, string pageName, PageDocument pageDocument, BuildOwners buildOwners) : base(areaName, projectName, pageName, pageDocument, buildOwners) { TfsPath = ParseTfsPath(m_properties); Stats = ParseStats(m_root); History = ParseHistory(m_root); About = ParseAbout(m_root); }
/// <summary> /// Encodes internal HTML entities in specified value. /// </summary> public static XElement XValue(this XElement element, string value) { element.Value = PageDocument.EncodeEntities(WebUtility.HtmlEncode(value)); return(element); }
/// <summary> /// Decodes specified value from internal HTML entities. /// </summary> public static string XValue(this XElement element) { return(WebUtility.HtmlDecode(PageDocument.DecodeEntities(element.Value))); }
/// <summary> /// Finds attribute by name, using internal namespace prefixes. /// </summary> public static XAttribute XAttribute(this XElement element, string name) { return(element.Attribute(PageDocument.Nm(name))); }
public virtual PageDocument RenderPage() { var page = new PageDocument(); page.Root.Add(RenderProperties()); return page; }
protected ReleaseProjectPage(string areaName, string projectName, string pageName, PageDocument pageDocument, BuildOwners buildOwners) : base(areaName, projectName, pageName, pageDocument, buildOwners) { Title = ParseTitle(m_properties); }
public FabricApplicationProjectPage(string areaName, string projectName, string pageName, PageDocument pageDocument, BuildOwners buildOwners) : base(areaName, projectName, pageName, pageDocument, buildOwners) { }
public ServiceProjectPage(string areaName, string projectName, string pageName, PageDocument pageDocument, BuildOwners buildOwners) : base(areaName, projectName, pageName, pageDocument, buildOwners) { }
public CloudServiceProjectPage(string areaName, string projectName, string pageName, PageDocument pageDocument, BuildOwners buildOwners) : base(areaName, projectName, pageName, pageDocument, buildOwners) { Title = ParseTitle(m_properties); }
public WindowsProjectPage(string areaName, string projectName, string pageName, PageDocument pageDocument, BuildOwners buildOwners) : base(areaName, projectName, pageName, pageDocument, buildOwners) { ClickOnce = ParseClickOnce(m_properties); }
private bool UpdateSummaryPage(IEnumerable<IProjectPage> pages, PageSummary summary) { var updated = new PageDocument(); var tbody = new XElement( "tbody", new XElement( "tr", new XElement("th", "Area"), new XElement("th", "Project"), new XElement("th", "Type"), new XElement("th", ".NET"), new XElement("th", "Owner"), new XElement("th", "Status"))); foreach (var page in pages.OrderBy(p => p.OrderKey)) { tbody.Add(page.RenderSummaryRow(false)); } updated.Root.Add( new XElement( "table", tbody)); var content = updated.Render(); var existing = m_confluence.GetCachedPage(summary); var before = NormalizeForComparison(existing.Content); var after = NormalizeForComparison(content); if (after == before) return false; existing.Content = content; m_confluence.UpdatePage(existing); return true; }
private string NormalizeForComparison(string content) { var doc = new PageDocument(content); var macros = doc.Root.XElements("//ac:structured-macro").ToList(); foreach (var macro in macros) { macro.XAttribute("ac:macro-id").RemoveIfExists(); macro.XAttribute("ac:schema-version").RemoveIfExists(); } return doc.Render(); }
private IProjectPage RebuildProject(string areaName, PageSummary project) { Console.WriteLine("Processing page '{0} / {1}'...", areaName, project.Name); IProjectPage page; try { ProjectType projectType; var projectName = ResolveProjectName(project.Name, out projectType); var existing = m_confluence.GetCachedPage(project); var document = new PageDocument(existing.Content); switch (projectType) { case ProjectType.Library: page = new LibraryProjectPage(areaName, projectName, project.Name, document, m_owners); break; case ProjectType.Website: page = new WebsiteProjectPage(areaName, projectName, project.Name, document, m_owners); break; case ProjectType.Webservice: page = new WebserviceProjectPage(areaName, projectName, project.Name, document, m_owners); break; case ProjectType.Service: page = new ServiceProjectPage(areaName, projectName, project.Name, document, m_owners); break; case ProjectType.Console: page = new ConsoleProjectPage(areaName, projectName, project.Name, document, m_owners); break; case ProjectType.Windows: page = new WindowsProjectPage(areaName, projectName, project.Name, document, m_owners); break; case ProjectType.CloudRole: page = new CloudRoleProjectPage(areaName, projectName, project.Name, document, m_owners); break; case ProjectType.CloudService: page = new CloudServiceProjectPage(areaName, projectName, project.Name, document, m_owners); break; case ProjectType.FabricService: page = new FabricServiceProjectPage(areaName, projectName, project.Name, document, m_owners); break; case ProjectType.FabricApplication: page = new FabricApplicationProjectPage(areaName, projectName, project.Name, document, m_owners); break; default: throw new InvalidOperationException( $"Unknown how to process project of type '{projectType.ToString().ToLowerInvariant()}'."); } page.CheckPage(m_tfs); var updated = UpdateProjectPage(page, existing); if (updated) { Console.WriteLine("[{0}] {1} #{2}... UPDATED", areaName, projectName, projectType.ToString().ToLowerInvariant()); } else { Console.WriteLine("[{0}] {1} #{2}... not changed", areaName, projectName, projectType.ToString().ToLowerInvariant()); } } catch (Exception e) { throw new InvalidOperationException( $"An error occurred while processing page '{project.Name}' version {project.Version}.", e); } return page; }