Esempio n. 1
0
        inode MakeInode(InodeMode Mode, uint Blocks, long Size = 0, long SizeCompressed = 0, ushort Nlink = 1, uint Number = 0, InodeFlags Flags = 0)
        {
            inode ret;

            if (properties.Sign)
            {
                ret = new DinodeS32()
                {
                    Mode           = Mode,
                    Blocks         = Blocks,
                    Size           = Size,
                    SizeCompressed = SizeCompressed,
                    Nlink          = Nlink,
                    Number         = Number,
                    Flags          = Flags | InodeFlags.unk2 | InodeFlags.unk3,
                };
            }
            else
            {
                ret = new DinodeD32()
                {
                    Mode           = Mode,
                    Blocks         = Blocks,
                    Size           = Size,
                    SizeCompressed = SizeCompressed,
                    Nlink          = Nlink,
                    Number         = Number,
                    Flags          = Flags
                };
            }
            ret.SetTime(properties.FileTime);
            return(ret);
        }
Esempio n. 2
0
        public static DinodeS32 ReadFromStream(Stream s)
        {
            var di = new DinodeS32
            {
                Mode           = (InodeMode)s.ReadUInt16LE(),
                Nlink          = s.ReadUInt16LE(),
                Flags          = (InodeFlags)s.ReadUInt32LE(),
                Size           = s.ReadInt64LE(),
                SizeCompressed = s.ReadInt64LE(),
                Time1_sec      = s.ReadInt64LE(),
                Time2_sec      = s.ReadInt64LE(),
                Time3_sec      = s.ReadInt64LE(),
                Time4_sec      = s.ReadInt64LE(),
                Time1_nsec     = s.ReadUInt32LE(),
                Time2_nsec     = s.ReadUInt32LE(),
                Time3_nsec     = s.ReadUInt32LE(),
                Time4_nsec     = s.ReadUInt32LE(),
                Uid            = s.ReadUInt32LE(),
                Gid            = s.ReadUInt32LE(),
                Unk1           = s.ReadUInt64LE(),
                Unk2           = s.ReadUInt64LE(),
                Blocks         = s.ReadUInt32LE(),
                db             = new block_sig[12],
                ib             = new block_sig[5],
            };

            for (var i = 0; i < 12; i++)
            {
                di.db[i] = new block_sig
                {
                    sig   = s.ReadBytes(32),
                    block = s.ReadInt32LE()
                }
            }
            ;
            for (var i = 0; i < 5; i++)
            {
                di.ib[i] = new block_sig
                {
                    sig   = s.ReadBytes(32),
                    block = s.ReadInt32LE()
                }
            }
            ;
            return(di);
        }
    };