import java.util.*;
public class Main
{
static void main(String[] args)
{
ArrayList ListHtml = GetHtml();
CreateSiteMap(ListHtml, "weekly", java.time.LocalDateTime.now());
}
private static void CreateSiteMap(ArrayList listHtml, String frecuency, java.time.LocalDateTime lastUpdated)
{
try
{
java.io.FileWriter writer = new java.io.OutputStreamWriter(File.Create("sitemap.xml"));
writer.write("" + System.lineSeparator());
writer.write("" + System.lineSeparator());
for (String html : listHtml)
{
writer.write("" + System.lineSeparator());
writer.write("" + html + "" + System.lineSeparator());
writer.write("" + lastUpdated.ToShortDateString() + "" + System.lineSeparator());
writer.write("" + frecuency + "" + System.lineSeparator());
writer.write("" + System.lineSeparator());
}
writer.write("" + System.lineSeparator());
writer.close();
}
catch (java.lang.Exception e)
{
System.out.println("Error writing sitemap.");
}
}
private static ArrayList GetHtml()
{
ArrayList ListHtml = new List();
String[] files = (new java.io.File(".")).list(java.io.File::isFile);
for (String file : files)
{
String extension = Path.GetExtension(file);
switch (extension)
{
case ".html":
case ".htm":
ListHtml.add(file.substring(2));
break;
}
}
return ListHtml;
}
}