Ejemplo n.º 1
0
        public UDPPackage(ushort partsPackageId, ushort parts, ushort part, BytesList body, UInt32 sign = 0)
        {
            this.PartsPackageId = partsPackageId;
            this.Parts          = parts;
            this.Part           = part;
            this.Body           = body;
            this.Sign           = sign;

            BytesList preCRCData = new BytesList();

            preCRCData.AddUInt(this.Sign);
            preCRCData.AddUShort(this.Parts);//!=0
            preCRCData.AddUShort(this.Part);
            preCRCData.AddUShort(this.PartsPackageId);
            preCRCData.Add(body);

            this.CRC = CRC32.Calculate(preCRCData);
            this.FullData.AddUInt(this.CRC);
            this.FullData.Add(preCRCData);
        }
Ejemplo n.º 2
0
        public UDPPackage(BytesList body, UInt32 sign = 0)
        {
            this.Body = body;
            this.Sign = sign;

            BytesList preCRCData = new BytesList();

            preCRCData.AddUInt(this.Sign);
            preCRCData.AddUShort(this.Parts);//==0
            preCRCData.Add(body);

            this.CRC = CRC32.Calculate(preCRCData);
            this.FullData.AddUInt(this.CRC);
            this.FullData.Add(preCRCData);
        }