Exemplo n.º 1
0
        /// <summary>
        /// </summary>
        /// <param name="paramList">
        ///     1,string groupName
        ///     2,string fileName
        /// </param>
        /// <returns></returns>
        public override FDFSRequest GetRequest(params object[] paramList)
        {
            if (paramList.Length != 2)
            {
                throw new FDFSException("param count is wrong");
            }

            var result    = new QUERY_UPDATE();
            var groupName = (string)paramList[0];
            var fileName  = (string)paramList[1];

            if (groupName.Length > Consts.FDFS_GROUP_NAME_MAX_LEN)
            {
                throw new FDFSException("GroupName is too long");
            }

            byte[] groupNameBuffer = Util.StringToByte(groupName);
            byte[] fileNameBuffer  = Util.StringToByte(fileName);
            int    length          = Consts.FDFS_GROUP_NAME_MAX_LEN + fileNameBuffer.Length;
            var    body            = new byte[length];

            Array.Copy(groupNameBuffer, 0, body, 0, groupNameBuffer.Length);
            Array.Copy(fileNameBuffer, 0, body, Consts.FDFS_GROUP_NAME_MAX_LEN, fileNameBuffer.Length);

            result.Body   = body;
            result.Header = new FDFSHeader(length,
                                           Consts.TRACKER_PROTO_CMD_SERVICE_QUERY_UPDATE, 0);
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// </summary>
        /// <param name="paramList">
        ///     1,string groupName
        ///     2,string fileName
        /// </param>
        /// <returns></returns>
        public override FDFSRequest GetRequest(params object[] paramList)
        {
            if (paramList.Length != 2)
                throw new FDFSException("param count is wrong");

            var result = new QUERY_UPDATE();
            var groupName = (string) paramList[0];
            var fileName = (string) paramList[1];
            if (groupName.Length > Consts.FDFS_GROUP_NAME_MAX_LEN)
                throw new FDFSException("GroupName is too long");

            byte[] groupNameBuffer = Util.StringToByte(groupName);
            byte[] fileNameBuffer = Util.StringToByte(fileName);
            int length = Consts.FDFS_GROUP_NAME_MAX_LEN + fileNameBuffer.Length;
            var body = new byte[length];

            Array.Copy(groupNameBuffer, 0, body, 0, groupNameBuffer.Length);
            Array.Copy(fileNameBuffer, 0, body, Consts.FDFS_GROUP_NAME_MAX_LEN, fileNameBuffer.Length);

            result.Body = body;
            result.Header = new FDFSHeader(length,
                Consts.TRACKER_PROTO_CMD_SERVICE_QUERY_UPDATE, 0);
            return result;
        }