public ImageMetaData ReadMetaData(TexEntry entry) { var info = new PsbTexMetaData { BPP = 32 }; info.DataOffset = (int)entry.Offset; info.FullWidth = entry.Width; info.FullHeight = entry.Height; info.Width = (uint)entry.TruncatedWidth; info.Height = (uint)entry.TruncatedHeight; info.TexType = entry.TexType; return(info); }
public List <Entry> GetTextures() { var source = GetRootKey <IDictionary> ("source"); if (null == source || 0 == source.Count) { return(null); } var dir = new List <Entry> (source.Count); foreach (DictionaryEntry item in source) { var item_value = item.Value as IDictionary; if (null == item_value) { continue; } var texture = item_value["texture"] as IDictionary; if (null == texture) { continue; } var pixel = texture["pixel"] as EmChunk; if (null == pixel) { continue; } var entry = new TexEntry { Name = item.Key.ToString(), Type = "image", Offset = DataOffset + pixel.Offset, Size = (uint)pixel.Length, TexType = texture["type"].ToString(), Width = Convert.ToInt32(texture["width"]), Height = Convert.ToInt32(texture["height"]), TruncatedWidth = Convert.ToInt32(texture["truncated_width"]), TruncatedHeight = Convert.ToInt32(texture["truncated_height"]), }; dir.Add(entry); } return(dir); }