Changeset 405 for CoolStreaming
- Timestamp:
- Aug 14, 2012, 7:04:04 AM (12 years ago)
- Location:
- CoolStreaming
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
CoolStreaming/CoolStreaming.lpk
r379 r405 50 50 </Files> 51 51 <Type Value="RunAndDesignTime"/> 52 <RequiredPkgs Count=" 3">52 <RequiredPkgs Count="2"> 53 53 <Item1> 54 54 <PackageName Value="Common"/> 55 55 </Item1> 56 56 <Item2> 57 <PackageName Value="TemplateGenerics"/>58 </Item2>59 <Item3>60 57 <PackageName Value="FCL"/> 61 58 <MinVersion Major="1" Valid="True"/> 62 </Item 3>59 </Item2> 63 60 </RequiredPkgs> 64 61 <UsageOptions> -
CoolStreaming/UVarBlockSerializer.pas
r384 r405 38 38 procedure WriteVarStream(AStream: TStream); 39 39 procedure ReadVarStream(AStream: TStream); 40 procedure WriteVarList(List: TListByte); 41 procedure ReadVarList(List: TListByte); 40 42 function GetVarSize: Integer; 41 43 function GetVarCount: Integer; … … 80 82 procedure WriteVarStream(Index: Integer; Stream: TStream); 81 83 procedure ReadVarStream(Index: Integer; Stream: TStream); 84 procedure WriteVarList(Index: Integer; List: TListByte); 85 procedure ReadVarList(Index: Integer; List: TListByte); 82 86 procedure WriteVarIndexedBlock(Index: Integer; Block: TVarBlockIndexed); 83 87 procedure ReadVarIndexedBlock(Index: Integer; Block: TVarBlockIndexed); … … 101 105 procedure WriteToStream(Stream: TStream); 102 106 procedure ReadFromStream(Stream: TStream); 107 procedure WriteToList(List: TListByte); 108 procedure ReadFromList(List: TListByte); 103 109 constructor Create; 104 110 destructor Destroy; override; … … 413 419 end; 414 420 421 procedure TVarBlockSerializer.WriteVarList(List: TListByte); 422 var 423 Mem: TMemoryStream; 424 begin 425 try 426 Mem := TMemoryStream.Create; 427 List.WriteToStream(Mem); 428 WriteVarStream(Mem); 429 finally 430 Mem.Free 431 end; 432 end; 433 434 procedure TVarBlockSerializer.ReadVarList(List: TListByte); 435 var 436 Mem: TMemoryStream; 437 begin 438 try 439 Mem := TMemoryStream.Create; 440 ReadVarStream(Mem); 441 List.Count := Mem.Size; 442 List.ReplaceStream(Mem); 443 finally 444 Mem.Free 445 end; 446 end; 447 415 448 function TVarBlockSerializer.GetVarSize: Integer; 416 449 var … … 697 730 end; 698 731 732 procedure TVarBlockIndexed.WriteVarList(Index: Integer; List: TListByte); 733 begin 734 CheckItem(Index); 735 TVarBlockSerializer(Items[Index]).WriteVarList(List); 736 end; 737 738 procedure TVarBlockIndexed.ReadVarList(Index: Integer; List: TListByte); 739 begin 740 TVarBlockSerializer(Items[Index]).ReadVarList(List); 741 end; 742 699 743 procedure TVarBlockIndexed.WriteVarIndexedBlock(Index: Integer; 700 744 Block: TVarBlockIndexed); … … 915 959 end; 916 960 961 procedure TVarBlockIndexed.WriteToList(List: TListByte); 962 var 963 Mem: TMemoryStream; 964 begin 965 try 966 Mem := TMemoryStream.Create; 967 WriteToStream(Mem); 968 List.Count := Mem.Size; 969 List.ReplaceStream(Mem); 970 finally 971 Mem.Free; 972 end; 973 end; 974 975 procedure TVarBlockIndexed.ReadFromList(List: TListByte); 976 var 977 Mem: TMemoryStream; 978 begin 979 try 980 Mem := TMemoryStream.Create; 981 List.WriteToStream(Mem); 982 ReadFromStream(Mem); 983 finally 984 Mem.Free; 985 end; 986 end; 987 917 988 constructor TVarBlockIndexed.Create; 918 989 begin
Note:
See TracChangeset
for help on using the changeset viewer.