public bool CheckDataSegment(DataSegment dataSegment)
        {
            if (dataSegment == null)
            {
                return(false);
            }

            return(CrcHash.Compute(dataSegment.DataString).ToString(CultureInfo.InvariantCulture) == dataSegment.Crccode);
        }
        public DataParameter BuildDataParameter <T>(int actionId, T data)
        {
            var parameter = new DataParameter {
                Action = actionId
            };

            parameter.DataString = ProcessToString(data);
            parameter.CrcCode    = CrcHash.Compute(parameter.DataString).ToString(CultureInfo.InvariantCulture);

            return(parameter);
        }
        public DataSegment BuildDataSegment(int index, string dataId, int dataLength, int dataCount, string content)
        {
            var beginPos = index * dataLength;
            var legth    = index == dataCount - 1 ? content.Length - beginPos : dataLength;
            var data     = content.Substring(beginPos, legth);

            var dataSegment = new DataSegment();

            dataSegment.DataId     = dataId;
            dataSegment.Crccode    = CrcHash.Compute(data).ToString(CultureInfo.InvariantCulture);
            dataSegment.DataString = data;
            dataSegment.Index      = index;
            return(dataSegment);
        }