public static void runMapTool(NameValueCollection loginData) { FileInfo svgMap = new FileInfo(SVGFileName); startTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; // If the map does not exists, try to download it if (!svgMap.Exists) { HttpClientForKosmor.Login(loginData); HttpClientForKosmor.DownloadMap(); } /* * If the -date parameter is used, the user has to input the date he * wishes to use in place of the current date */ /* if (useCustomDate) { * System.out.println("Please set the date"); * BufferedReader reader = new BufferedReader( * new InputStreamReader(System.in)); * SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH"); * MapTool.date = df.parse(reader.readLine()); * cal = MapTool.dateToGMTDate(MapTool.date); * }*/ planetLister = new PlanetLister(date, getKosmorDate()); HtmlBuilder.writeHTML(writeWarplanets, writePlanets, writeNeutral, date, loginData, fetchInfo); if (writeCSV) { CsvCreator csvCreator = new CsvCreator(); csvCreator.WriteCSV(date, warplanetList, planetList); } //XMLParserWriter.serialize(MapTool.planetLister); endTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; long time = (endTime - startTime) / 1000; }
public static void writeHTML(bool doWriteWarplanets, bool doWritePlanets, bool writeNeutral, DateTime date, NameValueCollection loginData, bool fetchInfo) { KosmorMapTool.setKosmorDate(date); string kosmorDate = KosmorMapTool.getKosmorDate(); // Gets the kosmorDate List <Object> warplanetAndPlanetList = PlanetListBuilder.BuildPlanetList(kosmorDate, date, fetchInfo); planetList = (List <Planet>)warplanetAndPlanetList[0]; warplanetList = (List <Planet>)warplanetAndPlanetList[1]; neutralPlanetList = (List <Planet>)warplanetAndPlanetList[2]; string dateString = KosmorMapTool.dateStringBuilder(kosmorDate, date); // Uses the kosmorDate to build the dateString //StatusMessageHandler.postStatusMessages(10); // Making sure the directory exists, if not, is is created DirectoryInfo htmldir = new DirectoryInfo("html"); if (!htmldir.Exists) { htmldir.Create(); } string fileName = htmldir + "/" + dateString + (" - Planet & WP List - kosmor.com - .html"); // Uses the dateString to create the fileName StreamWriter fileOut = new StreamWriter(fileName); //StatusMessageHandler.postStatusMessages(11); initializeHTML(dateString, fileOut); HttpClientForKosmor.Login(loginData); fileOut.WriteLine("<tbody>"); fileOut.WriteLine(fileOut.NewLine); if (doWriteWarplanets) { writeWarplanets(fetchInfo, warplanetList, fileOut); } if (doWritePlanets) { writePlanets(fetchInfo, planetList, fileOut); } /* * if (writeNeutral) { HTMLBuilder.writeNeutral(fetchInfo, * HTMLBuilder.neutralPlanetList, out, httpclient); } */ fileOut.WriteLine("</tbody>"); fileOut.WriteLine(fileOut.NewLine); //httpclient.getConnectionManager().shutdown(); fileOut.WriteLine("</table>"); fileOut.WriteLine(fileOut.NewLine); importJavaScriptFile(fileOut); writeScriptInfo(fileOut); fileOut.WriteLine("</form>"); fileOut.WriteLine(fileOut.NewLine); fileOut.WriteLine("</body>"); fileOut.WriteLine(fileOut.NewLine); fileOut.WriteLine("</html>"); fileOut.Close(); //StatusMessageHandler.postStatusMessages(15); KosmorMapTool.warplanetList = warplanetList; KosmorMapTool.planetList = planetList; KosmorMapTool.neutralPlanetList = neutralPlanetList; }