Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 2x 2x 2x 2x 2x 12x 11x 11x 12x 12x 12x 104x 13x 11x 88x 11x 11x 58x 11x 11x | import { mhaStrings } from "./mhaStrings"; import { ArchivedRow } from "./row/ArchivedRow"; import { CreationRow } from "./row/CreationRow"; import { Header } from "./row/Header"; import { Row } from "./row/Row"; import { SummaryRow } from "./row/SummaryRow"; export class Summary { private totalTimeInternal = ""; private creationPostFix(totalTime: string): string { if (!totalTime) { return ""; } return ` ${mhaStrings.mhaDeliveredStart} ${totalTime}${mhaStrings.mhaDeliveredEnd}`; } private dateRow = new CreationRow("Date", mhaStrings.mhaCreationTime); private archivedRow = new ArchivedRow("Archived-At", mhaStrings.mhaArchivedAt,); private summaryRows: SummaryRow[] = [ new SummaryRow("Subject", mhaStrings.mhaSubject), new SummaryRow("Message-ID", mhaStrings.mhaMessageId), this.archivedRow, this.dateRow, new SummaryRow("From", mhaStrings.mhaFrom), new SummaryRow("Reply-To", mhaStrings.mhaReplyTo), new SummaryRow("To", mhaStrings.mhaTo), new SummaryRow("CC", mhaStrings.mhaCc) ]; public exists(): boolean { let row: Row | undefined; this.rows.forEach((r: Row) => { Iif (!row && r.value) row = r; }); return row !== undefined; } public add(header: Header) { Iif (!header) { return false; } let row: SummaryRow | undefined; this.rows.forEach((r: Row) => { Iif (!row && r.header.toUpperCase() === header.header.toUpperCase()) row = r; }); Iif (row) { row.value = header.value; return true; } return false; } public get rows(): SummaryRow[] { return this.summaryRows; } public get totalTime(): string { return this.totalTimeInternal; } public set totalTime(value: string) { this.totalTimeInternal = value; this.dateRow.postFix = this.creationPostFix(value); } public toString(): string { Iif (!this.exists()) return ""; const ret = ["Summary"]; this.rows.forEach(function (row) { Iif (row.value) { ret.push(row.toString()); } }); return ret.join("\n"); } } |