public static HtmlBuilder Report(GenericDescription desc) { if (desc == null) return null; HtmlBuilder sb = new HtmlBuilder(); if (desc.Name != null) sb.AddSection(desc.Name); sb.AddLine(desc.Description); if (desc.DateSpecified) sb.AddLabel("Created", desc.Date.ToString()); if (desc.License != null) sb.AddLabel("License", desc.License); if (desc.Author != null) { if (desc.Author.Name != null) sb.AddLabel("Author", desc.Author.Name); if (desc.Author.Email != null) sb.AddLabel("Email", desc.Author.Email); if (desc.Author.Homepage != null) sb.AddLabel("Web", string.Format("<a href=\"{0}\">{0}</a>", desc.Author.Homepage)); } sb.AddLine(desc.Comments); if (desc.Name != null) sb.EndSection(); return sb; }
public static HtmlBuilder Report(Puzzle puzzle, StaticImage drawing) { HtmlBuilder sb = new HtmlBuilder(); sb.AddSection(puzzle.Details.Name); sb.Add("<table class=\"tableformat\"><tr><td>"); GenericDescription desc = new GenericDescription(puzzle.Details); desc.Name = null; // so that the H1 tag is not generated here sb.Add(Report(desc)); if (puzzle.Category != null) sb.AddLabel("Category", puzzle.Category.Details.Name); sb.AddLabel("Order", puzzle.Order.ToString()); sb.AddLabel("Rating", puzzle.Rating); sb.AddLabel("PuzzleID", puzzle.PuzzleID); sb.AddLabel("Size", "{0}x{1}, {2} crates, {3} floor space", puzzle.MasterMap.Map.Size.X, puzzle.MasterMap.Map.Size.Y, puzzle.MasterMap.Map.Count(Cell.Crate), puzzle.MasterMap.Map.Count(Cell.Floor) ); if (puzzle.HasAlternatives) { sb.AddLabel("Alternatives", puzzle.Alternatives.Count.ToString()); } sb.Add("</td><td>"); if (drawing != null) { sb.Add(puzzle.MasterMap, drawing.Draw(puzzle.MasterMap.Map), null); } sb.Add("</td></tr></table>"); return sb; }
public static HtmlBuilder Report(PuzzleMap item, StaticImage drawing) { HtmlBuilder sb = new HtmlBuilder(); sb.Add(Report(item.Details)); if (drawing != null) { sb.Add(item, drawing.Draw(item.Map), null); } if (item.HasSolution) { sb.AddLabel("Solutions", item.Solutions.Count.ToString()); } return sb; }