/// <summary> /// </summary> /// <param name="paramList"> /// 1,IPEndPoint IPEndPoint-->the storage IPEndPoint /// 2,string groupName /// 3,string fileName /// </param> /// <returns></returns> public static FDFSRequest CreateRequest(params object[] paramList) { if (paramList.Length != 3) { throw new FDFSException("param count is wrong"); } var endPoint = (IPEndPoint)paramList[0]; var groupName = (string)paramList[1]; var fileName = (string)paramList[2]; var result = new DELETE_FILE { StorageConnection = ConnectionManager.GetStorageConnection(endPoint) }; if (groupName.Length > Consts.FDFS_GROUP_NAME_MAX_LEN) { throw new FDFSException("groupName is too long"); } long length = Consts.FDFS_GROUP_NAME_MAX_LEN + fileName.Length; var bodyBuffer = new byte[length]; byte[] groupNameBuffer = Util.StringToByte(groupName); byte[] fileNameBuffer = Util.StringToByte(fileName); Array.Copy(groupNameBuffer, 0, bodyBuffer, 0, groupNameBuffer.Length); Array.Copy(fileNameBuffer, 0, bodyBuffer, Consts.FDFS_GROUP_NAME_MAX_LEN, fileNameBuffer.Length); result.Body = bodyBuffer; result.Header = new FDFSHeader(length, Consts.STORAGE_PROTO_CMD_DELETE_FILE, 0); return(result); }
/// <summary> /// </summary> /// <param name="paramList"> /// 1,IPEndPoint IPEndPoint-->the storage IPEndPoint /// 2,string groupName /// 3,string fileName /// </param> /// <returns></returns> public override FDFSRequest GetRequest(params object[] paramList) { if (paramList.Length != 3) throw new FDFSException("param count is wrong"); var endPoint = (IPEndPoint)paramList[0]; var groupName = (string)paramList[1]; var fileName = (string)paramList[2]; var result = new DELETE_FILE { Connection = ConnectionManager.GetStorageConnection(endPoint) }; if (groupName.Length > Consts.FDFS_GROUP_NAME_MAX_LEN) throw new FDFSException("groupName is too long"); long length = Consts.FDFS_GROUP_NAME_MAX_LEN + fileName.Length; var bodyBuffer = new byte[length]; byte[] groupNameBuffer = Util.StringToByte(groupName); byte[] fileNameBuffer = Util.StringToByte(fileName); Array.Copy(groupNameBuffer, 0, bodyBuffer, 0, groupNameBuffer.Length); Array.Copy(fileNameBuffer, 0, bodyBuffer, Consts.FDFS_GROUP_NAME_MAX_LEN, fileNameBuffer.Length); result.Body = bodyBuffer; result.Header = new FDFSHeader(length, Consts.STORAGE_PROTO_CMD_DELETE_FILE, 0); return result; }