public byte[] ToBytes() { var bytes = new byte[Constants.Qidsz]; var offset = 0; bytes[offset] = Type; offset += Constants.Bit8Sz; offset += Protocol.WriteUint(bytes, Vers, offset); offset += Protocol.WriteUlong(bytes, Path, offset); if (offset < Constants.Qidsz) { throw new Exception($"Buffer underflow. Len: {Constants.Qidsz}, Offset: {offset}"); } return(bytes); }
public byte[] ToBytes() { var bytes = new byte[Size]; var offset = 0; offset += Protocol.WriteUshort(bytes, Size, offset); offset += Protocol.WriteUshort(bytes, Type, offset); offset += Protocol.WriteUint(bytes, Dev, offset); offset += Protocol.WriteQid(bytes, Qid, offset); offset += Protocol.WriteUint(bytes, Mode, offset); offset += Protocol.WriteUint(bytes, Atime, offset); offset += Protocol.WriteUint(bytes, Mtime, offset); offset += Protocol.WriteUlong(bytes, Length, offset); offset += Protocol.WriteString(bytes, Name, offset); offset += Protocol.WriteString(bytes, Uid, offset); offset += Protocol.WriteString(bytes, Gid, offset); offset += Protocol.WriteString(bytes, Muid, offset); if (offset < Size) { throw new Exception($"Buffer underflow. Len: {Size}, Offset: {offset}"); } return(bytes); }