public static Tileset FromArchive(string file, Archive archive) { if (!archive.Contains(file)) return null; Tileset tileset = LoadTiles(new MemoryStream(archive.ExtractFile(file))); tileset.name = Path.GetFileNameWithoutExtension(file).ToUpper(); tileset.filename = file; return tileset; }
public int LoadTables(string pattern, Archive archive) { entries.Clear(); foreach (ArchiveFile file in archive.Files) { // Check for Palette if (file.Name.ToUpper().EndsWith(".TBL") && file.Name.ToUpper().StartsWith(pattern.ToUpper())) { string tableName = Path.GetFileNameWithoutExtension(file.Name).Remove(0, pattern.Length); if (tableName != "ani") { MemoryStream stream = new MemoryStream(archive.ExtractFile(file)); StreamReader reader = new StreamReader(stream); while (!reader.EndOfStream) { string line = reader.ReadLine(); string[] lineSplit = line.Split(' '); if (lineSplit.Length == 3) { int min = Convert.ToInt32(lineSplit[0]); int max = Convert.ToInt32(lineSplit[1]); int pal = Convert.ToInt32(lineSplit[2]); int index = 0; if (int.TryParse(tableName, out index)) overrides.Add(new Palette(min, max, pal)); else entries.Add(new Palette(min, max, pal)); } else if (lineSplit.Length == 2) { int min = Convert.ToInt32(lineSplit[0]); int max = min; int pal = Convert.ToInt32(lineSplit[1]); int index = 0; if (int.TryParse(tableName, out index)) overrides.Add(new Palette(min, max, pal)); else entries.Add(new Palette(min, max, pal)); } } reader.Close(); } } } return entries.Count; }
public static HPF FromArchive(string file, bool ignoreCase, Archive archive) { if (!archive.Contains(file, ignoreCase)) return null; return FromRawData(archive.ExtractFile(file, ignoreCase)); }
public static ColorPalette FromArchive(string file, Archive archive) { if (!archive.Contains(file)) return null; return FromRawData(archive.ExtractFile(file)); }