annotate api/Exporters/WarFoundryHtmlExporter.cs @ 143:7f13ffcb8765 WarFoundry_v0.1beta2_Winforms

Re #164: Show unit cost in army tree * Do prep work and create "ICostedWarFoundryObject" interface that defines objects with a "Points" property * Implement new interface where necessary * Deprecate old variations on "points value" * Remove references to deprecated code
author IBBoard <dev@ibboard.co.uk>
date Sat, 19 Sep 2009 19:42:53 +0000
parents 57f7b80757ea
children dd892567f054
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
130
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (WarFoundryHtmlExporter.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
131
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
6 using System.Collections.Generic;
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
7 using System.IO;
134
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
8 using System.Text;
131
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
9 using System.Xml;
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
10 using System.Xml.Schema;
132
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
11 using IBBoard.Lang;
130
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 using IBBoard.WarFoundry.API.Objects;
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 namespace IBBoard.WarFoundry.API.Exporters
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 {
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 /// <summary>
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 /// Custom exporter that exports an army as a basic HTML file
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 /// </summary>
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 public class WarFoundryHtmlExporter : IWarFoundryExporter
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 {
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 private static WarFoundryHtmlExporter exporter;
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 public static WarFoundryHtmlExporter GetDefault()
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 {
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 if (exporter == null)
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 {
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 exporter = new WarFoundryHtmlExporter();
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 }
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 return exporter;
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 }
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 private WarFoundryHtmlExporter()
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 {
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 //Hide constructor
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 }
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 public void ExportArmy(Army army, string path)
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 {
131
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
40 XmlDocument doc = new XmlDocument();
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
41 doc.AppendChild(doc.CreateDocumentType("html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd", null));
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
42 XmlElement html = doc.CreateElement("html");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
43 doc.AppendChild(html);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
44 XmlElement head = doc.CreateElement("head");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
45 html.AppendChild(head);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
46 XmlElement title = doc.CreateElement("title");
134
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
47 title.InnerXml = army.Name;
131
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
48 head.AppendChild(title);
134
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
49 XmlElement style = doc.CreateElement("style");
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
50 style.InnerText = "table, th, td { border: 1px solid #000 }";
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
51 head.AppendChild(style);
131
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
52 XmlElement body = doc.CreateElement("body");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
53 html.AppendChild(body);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
54 XmlElement header = doc.CreateElement("h1");
143
7f13ffcb8765 Re #164: Show unit cost in army tree
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
55 header.InnerText = Translation.GetTranslation("armyHtmlOutputBodyHeader", "{0} - {1}pts", army.Name, army.Points);
131
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
56 body.AppendChild(header);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
57
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
58 foreach (XmlElement table in CreateTables(army, doc))
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
59 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
60 body.AppendChild(table);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
61 }
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
62
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
63 StreamWriter writer = new StreamWriter(path, false);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
64
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
65 try
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
66 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
67 writer.Write(doc.OuterXml);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
68 }
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
69 finally
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
70 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
71 writer.Close();
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
72 }
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
73 }
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
74
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
75 private XmlElement[] CreateTables(Army army, XmlDocument doc)
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
76 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
77 Dictionary<string, XmlElement> tables = new Dictionary<string, XmlElement>();
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
78
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
79 foreach (SystemStats statSets in army.GameSystem.SystemStats)
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
80 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
81 tables[statSets.ID] = CreateTable(statSets, doc);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
82 }
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
83
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
84 foreach (Unit unit in army.GetUnits())
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
85 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
86 tables[unit.UnitType.StatsID].AppendChild(CreateUnitRow(unit, doc));
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
87 }
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
88
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
89 return DictionaryUtils.ToArray(tables);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
90 }
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
91
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
92 private XmlElement CreateTable(SystemStats stats, XmlDocument doc)
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
93 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
94 XmlElement table = doc.CreateElement("table");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
95 XmlElement headerRow = doc.CreateElement("tr");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
96 table.AppendChild(headerRow);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
97 XmlElement name = doc.CreateElement("th");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
98 name.InnerText = "Name";
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
99 headerRow.AppendChild(name);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
100
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
101 foreach (StatSlot stat in stats.StatSlots)
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
102 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
103 XmlElement statHeader = doc.CreateElement("th");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
104 statHeader.InnerText = stat.Name;
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
105 headerRow.AppendChild(statHeader);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
106 }
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
107
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
108 XmlElement notes = doc.CreateElement("th");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
109 notes.InnerText = "Notes";
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
110 headerRow.AppendChild(notes);
132
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
111
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
112 XmlElement points = doc.CreateElement("th");
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
113 points.InnerText = "Points";
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
114 headerRow.AppendChild(points);
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
115
131
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
116 return table;
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
117 }
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
118
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
119 private XmlElement CreateUnitRow(Unit unit, XmlDocument doc)
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
120 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
121 XmlElement row = doc.CreateElement("tr");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
122 XmlElement name = doc.CreateElement("td");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
123 name.InnerText = unit.Name;
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
124 row.AppendChild(name);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
125
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
126 foreach (Stat stat in unit.UnitStatsArray)
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
127 {
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
128 XmlElement statCell = doc.CreateElement("td");
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
129 statCell.InnerText = stat.SlotValueString;
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
130 row.AppendChild(statCell);
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
131 }
134
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
132
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
133 StringBuilder sb = new StringBuilder();
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
134 bool addSeparator = false;
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
135
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
136 foreach (UnitEquipmentItem equip in unit.GetEquipment())
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
137 {
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
138 if (!addSeparator)
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
139 {
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
140 addSeparator = true;
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
141 }
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
142 else
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
143 {
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
144 sb.Append(", ");
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
145 }
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
146
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
147 sb.Append(Translation.GetTranslation("armyHtmlExportEquipAmountRatio", "{0} for {1}", equip.Name, unit.GetEquipmentAmountString(equip)));
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
148 }
132
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
149
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
150 XmlElement notes = doc.CreateElement("td");
134
57f7b80757ea Re #68: Export army to another format
IBBoard <dev@ibboard.co.uk>
parents: 132
diff changeset
151 notes.InnerText = sb.ToString();
132
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
152 row.AppendChild(notes);
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
153
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
154 XmlElement points = doc.CreateElement("td");
143
7f13ffcb8765 Re #164: Show unit cost in army tree
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
155 points.InnerText = unit.Points.ToString();
132
e9c415839462 Re #68: Add "export" of army
IBBoard <dev@ibboard.co.uk>
parents: 131
diff changeset
156 row.AppendChild(points);
131
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
157
5145b7c61ae0 Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents: 130
diff changeset
158 return row;
130
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
159 }
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
160 }
e147a1e9399b Re #68: Add "export army list" function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
161 }