Пример #1
0
        public Stat(byte[] bytes)
        {
            var offset = 0;

            Size    = Protocol.ReadUShort(bytes, offset);
            offset += Constants.Bit16Sz;
            Type    = Protocol.ReadUShort(bytes, offset);
            offset += Constants.Bit16Sz;
            Dev     = Protocol.ReadUInt(bytes, offset);
            offset += Constants.Bit32Sz;
            Qid     = Protocol.ReadQid(bytes, offset);
            offset += Constants.Qidsz;
            Mode    = Protocol.ReadUInt(bytes, offset);
            offset += Constants.Bit32Sz;
            Atime   = Protocol.ReadUInt(bytes, offset);
            offset += Constants.Bit32Sz;
            Mtime   = Protocol.ReadUInt(bytes, offset);
            offset += Constants.Bit32Sz;
            Length  = Protocol.ReadULong(bytes, offset);
            offset += Constants.Bit64Sz;
            Name    = Protocol.ReadString(bytes, offset);
            offset += (int)Protocol.GetStringLength(Name);
            Uid     = Protocol.ReadString(bytes, offset);
            offset += (int)Protocol.GetStringLength(Uid);
            Gid     = Protocol.ReadString(bytes, offset);
            offset += (int)Protocol.GetStringLength(Gid);
            Muid    = Protocol.ReadString(bytes, offset);
            offset += (int)Protocol.GetStringLength(Muid);
            if (offset < Size)
            {
                throw new Exception("Too much data");
            }
        }
Пример #2
0
        public Qid(byte[] bytes)
        {
            var offset = 0;

            Type    = bytes[offset];
            offset += Constants.Bit8Sz;
            Vers    = Protocol.ReadUInt(bytes, offset);
            offset += Constants.Bit32Sz;
            Path    = Protocol.ReadULong(bytes, offset);
        }