Beispiel #1
0
        public FSFile(PfsBuilder b)
        {
            var pfsc = new PFSCWriter(b.CalculatePfsSize());

            Write = s =>
            {
                pfsc.WritePFSCHeader(s);
                b.WriteImage(new Util.OffsetStream(s, s.Position));
            };
            _compressedSize = b.CalculatePfsSize();
            Size            = _compressedSize + pfsc.HeaderSize;
            name            = "pfs_image.dat";
            Compress        = true;
        }
Beispiel #2
0
        /// <summary>
        /// Generates a PfsProperties object for the outer PFS image of a PKG with the given properties.
        /// </summary>
        /// <param name="props">PKG properties to convert from</param>
        /// <param name="innerPFS">Inner pfs image to use, presumably from MakeInnerPFSProps</param>
        /// <param name="EKPFS">Encryption key for PFS</param>
        /// <param name="encrypt">Set to false to make a non-encrypted PFS</param>
        /// <returns></returns>
        public static PfsProperties MakeOuterPFSProps(PKG.PkgProperties props, PfsBuilder innerPFS, byte[] EKPFS, bool encrypt = true)
        {
            var root = new FSDir();

            root.Files.Add(new FSFile(innerPFS)
            {
                Parent = root,
            });
            return(new PfsProperties()
            {
                root = root,
                BlockSize = 0x10000,
                Encrypt = encrypt,
                Sign = true,
                EKPFS = EKPFS,
                Seed = new byte[16],
                FileTime = GetTimeStamp(props),
            });
        }
Beispiel #3
0
        /// <summary>
        /// Generates a PfsProperties object for the outer PFS image of a PKG with the given properties.
        /// </summary>
        /// <param name="props">PKG properties to convert from</param>
        /// <param name="innerPFS">Inner pfs image to use, presumably from MakeInnerPFSProps</param>
        /// <param name="EKPFS">Encryption key for PFS</param>
        /// <param name="encrypt">Set to false to make a non-encrypted PFS</param>
        /// <returns></returns>
        public static PfsProperties MakeOuterPFSProps(PKG.PkgProperties props, PfsBuilder innerPFS, byte[] EKPFS, bool encrypt = true)
        {
            var root = new FSDir();

            root.Files.Add(new FSFile(innerPFS)
            {
                Parent = root,
            });
            return(new PfsProperties()
            {
                root = root,
                BlockSize = 0x10000,
                Encrypt = encrypt,
                Sign = true,
                EKPFS = EKPFS,
                // This doesn't seem to really matter when verifying a PKG so use all zeroes for now
                Seed = new byte[16],
                FileTime = GetTimeStamp(props),
            });
        }