public ArchiveLister(string springPath)
{
Mods = new Dictionary <string, string>();
Maps = new Dictionary <string, string>();
var contentFolders = new[] { "mods", "maps", "base" };
var L = SpringLua.GetLuaState(springPath);
foreach (var folderPath in contentFolders)
{
foreach (var archivePath in Directory.GetFiles(Path.Combine(springPath, folderPath), "*"))
{
if (!IsSpringArchive(archivePath))
{
continue;
}
foreach (var fileName in Archive.RawListFiles(archivePath))
{
if (IsModInfo(fileName))
{
var modName = SpringLua.ProtectedGetModName(L, archivePath);
if (modName != null)
{
Mods.Remove(modName);
Mods[modName] = archivePath;
}
}
else if (IsMap(fileName))
{
var mapName = Path.GetFileName(fileName);
Maps.Remove(mapName);
Maps[mapName] = archivePath;
}
}
}
}
Lua.lua_close(L);
}