public Xci(Keyset keyset, Stream stream) { Header = new XciHeader(keyset, stream); var hfs0Stream = new SubStream(stream, Header.PartitionFsHeaderAddress); RootPartition = new XciPartition(hfs0Stream) { Name = RootPartitionName, Offset = Header.PartitionFsHeaderAddress, HashValidity = Header.PartitionFsHeaderValidity }; Partitions.Add(RootPartition); foreach (PfsFileEntry file in RootPartition.Files) { Stream partitionStream = RootPartition.OpenFile(file); var partition = new XciPartition(partitionStream) { Name = file.Name, Offset = Header.PartitionFsHeaderAddress + RootPartition.HeaderSize + file.Offset, HashValidity = file.HashValidity }; Partitions.Add(partition); } UpdatePartition = Partitions.FirstOrDefault(x => x.Name == UpdatePartitionName); NormalPartition = Partitions.FirstOrDefault(x => x.Name == NormalPartitionName); SecurePartition = Partitions.FirstOrDefault(x => x.Name == SecurePartitionName); LogoPartition = Partitions.FirstOrDefault(x => x.Name == LogoPartitionName); }
public XciPartition OpenPartition(XciPartitionType type) { XciPartition root = GetRootPartition(); if (type == XciPartitionType.Root) { return(root); } root.OpenFile(out IFile partitionFile, type.GetFileName().ToU8Span(), OpenMode.Read).ThrowIfFailure(); return(new XciPartition(partitionFile.AsStorage())); }
public XciPartition OpenPartition(XciPartitionType type) { XciPartition root = GetRootPartition(); if (type == XciPartitionType.Root) { return(root); } IStorage partitionStorage = root.OpenFile(type.GetFileName(), OpenMode.Read).AsStorage(); return(new XciPartition(partitionStorage)); }
private void InitializeRootPartition() { lock (InitLocker) { if (RootPartition != null) { return; } IStorage rootStorage = BaseStorage.Slice(Header.RootPartitionOffset); RootPartition = new XciPartition(rootStorage) { Offset = Header.RootPartitionOffset, HashValidity = Header.PartitionFsHeaderValidity }; } }