public static BundleArchive Read(string path) { using (Stream s = File.OpenRead(path)) { try { BinaryReader2 br = new BinaryReader2(s); BundleArchive result = new BundleArchive(); result.Path = path; if (!result.Read(br)) { br.Close(); return(null); } br.Close(); return(result); } catch (IOException ex) { Debug.WriteLine(ex.Message + "\n" + ex.StackTrace); return(null); } catch (ReadFailedError ex) { Debug.WriteLine(ex.Message + "\n" + ex.StackTrace); return(null); } } }
public override string ToString() { string value = ""; bool external = Entry == null; string extra = ""; if (Entry == null) { string file = BundleCache.GetFileByEntryID(EntryID); if (!string.IsNullOrEmpty(file)) { extra = ", Path: " + BundleCache.GetRelativePath(file); BundleArchive archive = BundleArchive.Read(file); Entry = archive.GetEntryByID(EntryID); } } if (Entry != null && Entry.Type == EntryType.VertexDescriptor) { VertexDesc desc = VertexDesc.Read(Entry); value = ", Attribute Count: " + desc.AttributeCount.ToString("D2"); } string location = external ? "External" : "Internal"; string info = "(External)"; if (Entry != null) { info = "(" + location + ": " + EntryIndex.ToString("D3") + ", " + Entry.Type + value + extra + ")"; } return("ID: 0x" + EntryID.ToString("X8") + ", PtrOffset: 0x" + EntryPointerOffset.ToString("X8") + " " + info); }