public static Open ( string archive ) : |
||
archive | string | |
return |
/// <summary> /// Make a dictionary with all the files in the VFS /// </summary> Dictionary <string, LazyFileData> LoadArchives(IEnumerable <string> archives) { var fileMap = new Dictionary <string, LazyFileData>(); foreach (var archiveName in archives) { var archive = Archive.Open(archiveName); var fileName = archiveName.ToLower().Replace("\\", "/"); var fileData = new LazyFileData(archiveName, archive); fileMap.Remove(fileName); fileMap[fileName] = fileData; } return(fileMap); }
static string GetTdfField(IntPtr L, string fieldName, string archivePath) { var archive = Archive.Open(archivePath); var tdfFile = FindModInfo(archive, "tdf"); if (tdfFile != null) { var modInfoTable = GetTdfTableFromString(L, Archive.ExtractTextFile(archivePath, tdfFile)); if (modInfoTable[0] is LuaNil) { throw new Exception(String.Format("Error in file {0}: {1}", archivePath, modInfoTable[1])); } var modInfo = modInfoTable[0].GetField("mod"); if (modInfo == null) { return(null); } var field = modInfo.GetField(fieldName); if (field == null) { return(null); } return(field.ToString()); } var luaFile = FindModInfo(archive, "lua"); if (luaFile != null) { var modinfo = Archive.ExtractTextFile(archivePath, luaFile); var result = CLua.TraceDoString(L, 1, modinfo)[0].GetField(fieldName); if (result == null) { return(null); } return(result.ToString()); } return(null); }