Example #1
0
        private void WriteByRatio(StreamWriter writer, ArrayList rulers, string resource)
        {
            writer.WriteLine("<h2>Top Rulers by {0}</h2>", CultureModule.getContent(resource));
            writer.WriteLine("<table>");

            writer.WriteLine("<tr>");
            writer.WriteLine("<th>#</td>");
            writer.WriteLine("<th>Ruler</td>");
            writer.WriteLine("<th>Planets</td>");
            writer.WriteLine("<th>Avg</td>");
            writer.WriteLine("<th>{0}</td>", "Per Turn");
            writer.WriteLine("</tr>");

            for (int i = 0; i < NumberOfRulers; ++i)
            {
                Ruler ruler = (Ruler)rulers[i];
                writer.WriteLine("<tr>");
                writer.WriteLine("<td>{0}</td>", i + 1);
                writer.WriteLine("<td>{0}</td>", OrionGlobals.getLink(ruler));
                writer.WriteLine("<td>{0}</td>", ruler.Planets.Length);

                int ratio = RatioComparer.Count(ruler, resource);

                writer.WriteLine("<td>+{0}</td>", OrionGlobals.format(ratio / ruler.Planets.Length));
                writer.WriteLine("<td>+{0}</td>", OrionGlobals.format(ratio));
                writer.WriteLine("</tr>");
            }

            writer.WriteLine("</table>");
        }
Example #2
0
        private void WikiWriteByRatio(StreamWriter writer, ArrayList rulers, string resource)
        {
            writer.WriteLine("!!!Top Rulers by {0}", CultureModule.getContent(resource));

            writer.Write("||{!^}*#*");
            writer.Write("||{!^}*Ruler*");
            writer.Write("||{!^}*Planets*");
            writer.Write("||{!^}*Avg*");
            writer.WriteLine("||{!^}*Per Turn*||");

            for (int i = 0; i < NumberOfRulers; ++i)
            {
                Ruler ruler = (Ruler)rulers[i];

                writer.Write("||{0}", i + 1);
                writer.Write("||{0}", ruler.Name);
                writer.Write("||{0}", ruler.Planets.Length);

                int ratio = RatioComparer.Count(ruler, resource);

                writer.Write("||+{0}", OrionGlobals.format(ratio / ruler.Planets.Length));
                writer.WriteLine("||+{0}||", OrionGlobals.format(ratio));
            }
        }