Changeset 303 for CoolStreaming


Ignore:
Timestamp:
Dec 5, 2011, 2:21:38 PM (13 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • CoolStreaming/UVarBlockSerializer.pas

    r262 r303  
    5858    constructor Create;
    5959    destructor Destroy; override;
     60    procedure Assign(Source: TVarBlockSerializer);
    6061    property Stream: TStream read FStream write SetStream;
    6162  end;
     
    100101    constructor Create;
    101102    destructor Destroy; override;
     103    procedure Assign(Source: TVarBlockIndexed);
    102104  end;
    103105
     
    582584end;
    583585
     586procedure TVarBlockSerializer.Assign(Source: TVarBlockSerializer);
     587var
     588  Helper: TStreamHelper;
     589  LastPos: Integer;
     590begin
     591  OwnsStream := Source.OwnsStream;
     592  FStream.Size := 0;
     593  try
     594    Helper := TStreamHelper.Create(Source.FStream);
     595    LastPos := Source.FStream.Position;
     596    Source.FStream.Position := 0;
     597    Helper.ReadStream(FStream, Source.FStream.Size);
     598    Source.FStream.Position := LastPos;
     599  finally
     600    Helper.Free;
     601  end;
     602  FStream.Position := Source.FStream.Position;
     603end;
     604
    584605{ TVarBlockIndexed }
    585606
     
    777798  if (Index >= 0) and (Index < Items.Count) then
    778799    Result := Assigned(Items[Index])
    779     else Result := False
     800    else Result := False;
    780801end;
    781802
     
    864885end;
    865886
     887procedure TVarBlockIndexed.Assign(Source: TVarBlockIndexed);
     888var
     889  I: Integer;
     890begin
     891  Enclose := Source.Enclose;
     892  Items.Count := Source.Items.Count;
     893  for I := 0 to Items.Count - 1 do begin
     894    CheckItem(I);
     895    TVarBlockSerializer(Items[I]).Assign(TVarBlockSerializer(Source.Items[I]));
     896  end;
     897end;
     898
    866899end.
Note: See TracChangeset for help on using the changeset viewer.