コード例 #1
0
 public static DirectoryHeader ReadFrom(MetablockReader reader)
 {
     DirectoryHeader result = new DirectoryHeader();
     result.Count = reader.ReadInt();
     result.StartBlock = reader.ReadInt();
     result.InodeNumber = reader.ReadInt();
     return result;
 }
コード例 #2
0
ファイル: Inode.cs プロジェクト: AnotherAltr/Rc.Core
        public static Inode Read(MetablockReader inodeReader)
        {
            byte[] typeData = new byte[2];
            if (inodeReader.Read(typeData, 0, 2) != 2)
            {
                throw new IOException("Unable to read Inode type");
            }

            InodeType type = (InodeType)Utilities.ToUInt16LittleEndian(typeData, 0);
            Inode inode = InstantiateType(type);

            byte[] inodeData = new byte[inode.Size];
            inodeData[0] = typeData[0];
            inodeData[1] = typeData[1];

            if (inodeReader.Read(inodeData, 2, inode.Size - 2) != inode.Size - 2)
            {
                throw new IOException("Unable to read whole Inode");
            }

            inode.ReadFrom(inodeData, 0);

            return inode;
        }