Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public Xci(Keyset keyset, IStorage storage)
 {
     BaseStorage = storage;
     Header      = new XciHeader(keyset, storage.AsStream());
 }