Exemple #1
0
 public Stat(
     ushort type,
     uint dev,
     Qid qid,
     uint mode,
     uint atime,
     uint mtime,
     ulong length,
     string name,
     string uid,
     string gid,
     string muid)
 {
     Type   = type;
     Dev    = dev;
     Qid    = qid;
     Mode   = mode;
     Atime  = atime;
     Mtime  = mtime;
     Length = length;
     Name   = name;
     Uid    = uid;
     Gid    = gid;
     Muid   = muid;
     Size   = (ushort)(Constants.Bit16Sz + Constants.Bit16Sz +
                       Constants.Bit32Sz + Constants.Qidsz +
                       Constants.Bit32Sz + Constants.Bit32Sz +
                       Constants.Bit32Sz + Constants.Bit64Sz +
                       Protocol.GetStringLength(Name) +
                       Protocol.GetStringLength(Uid) +
                       Protocol.GetStringLength(Gid) +
                       Protocol.GetStringLength(Muid));
 }
Exemple #2
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");
            }
        }