public GcfFileInfo(Gcf gcf, uint index) { Gcf = gcf; Index = index; if (Index == 0xFFFFFFFF) { ParentIndex = 0xFFFFFFFF; Path = null; ItemSize = 0; return; } List <string> path = new List <string>(); DirectoryEntry entry, parent; entry = parent = Gcf.GetDirectoryEntry(Index); do { path.Add(gcf.GetDirectoryName(parent.NameOffset)); if (parent.ParentIndex != 0xFFFFFFFF) { parent = gcf.GetDirectoryEntry(parent.ParentIndex); } } while (parent.ParentIndex != 0xFFFFFFFF); path.Reverse(); Path = string.Join(Gcf.Path.DirectorySeparatorChars[0].ToString(), path); ParentIndex = entry.ParentIndex; ItemSize = entry.ItemSize; }
public GcfFileInfo(Gcf gcf, string path) { Gcf = gcf; Path = path; path = Gcf.Path.GetFullPath(path); string[] names = path.Split(Gcf.Path.DirectorySeparatorChars); Packaging.DirectoryInfo dir = Gcf.Root; for (int i = 0; i < names.Length - 1; ++i) { var children = dir.GetDirectories(names[i]); if (children.Length != 1) { dir = null; break; } dir = children[0]; } if (dir != null) { var children = dir.GetFiles(names[names.Length - 1]); if (children.Length != 1) { Index = 0xFFFFFFFF; ParentIndex = 0xFFFFFFFF; ItemSize = 0; } else { GcfFileInfo gcffile = children[0] as GcfFileInfo; Index = gcffile.Index; ParentIndex = gcffile.ParentIndex; ItemSize = gcffile.ItemSize; } } else { Index = 0xFFFFFFFF; ParentIndex = 0xFFFFFFFF; ItemSize = 0; } }
public GcfStream(Gcf gcf, uint index) { Gcf = gcf; Index = index; Size = Gcf.GetDirectoryEntry(Index).ItemSize; Position = 0; FAT = new List <uint>(); var block = Gcf.GetBlockEntry(Gcf.GetDirectoryMapEntry(Index)); uint data = block.FirstDataBlockIndex; while (data != Gcf.Terminator) { FAT.Add(data); data = Gcf.GetFragmentationMapEntry(data); } }
public GcfDirectoryInfo(Gcf gcf, string path) { Gcf = gcf; Path = path; path = Gcf.Path.GetFullPath(path); string[] names = path.Split(Gcf.Path.DirectorySeparatorChars); Packaging.DirectoryInfo dir = Gcf.Root; for (int i = 0; i < names.Length; ++i) { var children = dir.GetDirectories(names[i]); if (children.Length != 1) { dir = null; break; } dir = children[0]; } GcfDirectoryInfo gcfdir = dir as GcfDirectoryInfo; if (gcfdir != null) { Index = gcfdir.Index; ParentIndex = gcfdir.ParentIndex; } else { Index = 0xFFFFFFFF; ParentIndex = 0xFFFFFFFF; } }
public GcfStream(Gcf gcf, uint index) { Gcf = gcf; Index = index; Size = Gcf.GetDirectoryEntry(Index).ItemSize; Position = 0; FAT = new List<uint>(); var block = Gcf.GetBlockEntry(Gcf.GetDirectoryMapEntry(Index)); uint data = block.FirstDataBlockIndex; while (data != Gcf.Terminator) { FAT.Add(data); data = Gcf.GetFragmentationMapEntry(data); } }
public GcfFileInfo(Gcf gcf, uint index) { Gcf = gcf; Index = index; if (Index == 0xFFFFFFFF) { ParentIndex = 0xFFFFFFFF; Path = null; ItemSize = 0; return; } List<string> path = new List<string>(); DirectoryEntry entry, parent; entry = parent = Gcf.GetDirectoryEntry(Index); do { path.Add(gcf.GetDirectoryName(parent.NameOffset)); if (parent.ParentIndex != 0xFFFFFFFF) parent = gcf.GetDirectoryEntry(parent.ParentIndex); } while (parent.ParentIndex != 0xFFFFFFFF); path.Reverse(); Path = string.Join(Gcf.Path.DirectorySeparatorChars[0].ToString(), path); ParentIndex = entry.ParentIndex; ItemSize = entry.ItemSize; }