Ignore:
Timestamp:
Nov 19, 2012, 12:31:19 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Ladění komunikačního protokolu s terminálem BF-630.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/TemplateGenerics/Additional/UBinarySerializer.pas

    r12 r24  
    3131    procedure WriteByte(Data: Byte);
    3232    procedure WriteWord(Data: Word);
     33    procedure WriteInteger(Data: Integer);
    3334    procedure WriteCardinal(Data: Cardinal);
    3435    procedure WriteInt64(Data: Int64);
     
    4445    function ReadByte: Byte;
    4546    function ReadWord: Word;
     47    function ReadInteger: Integer;
    4648    function ReadCardinal: Cardinal;
    4749    function ReadInt64: Int64;
     
    169171  Buffer: array of Byte;
    170172begin
    171   if Count > (List.Count - StartIndex) then Count := (List.Count - StartIndex); // Limit max. stream size
     173  //if Count > (List.Count - StartIndex) then
     174  //  Count := (List.Count - StartIndex); // Limit max. stream size
     175  List.Count := Count;
    172176  if Count > 0 then begin
    173177    SetLength(Buffer, Count);
     
    242246  Result := 0;
    243247  Read(Result, SizeOf(Word));
     248  if SwapData then Result := SwapEndian(Result);
     249end;
     250
     251function TBinarySerializer.ReadInteger: Integer;
     252begin
     253  Result := 0;
     254  Read(Result, SizeOf(Integer));
    244255  if SwapData then Result := SwapEndian(Result);
    245256end;
     
    376387end;
    377388
     389procedure TBinarySerializer.WriteInteger(Data: Integer);
     390begin
     391  if SwapData then Data := SwapEndian(Data);
     392  Write(Data, SizeOf(Integer));
     393end;
     394
    378395end.
    379396
Note: See TracChangeset for help on using the changeset viewer.