Program PNETStreamAdapter;

{$APPTYPE CONSOLE}

uses System.IO,
	Borland.Delphi.Classes,
  Borland.Vcl.Forms,
	Borland.Vcl.Graphics,
	Borland.Vcl.Controls,
	Borland.Vcl.Forms,
	Borland.Vcl.Dialogs,
	Borland.Vcl.StdCtrls,
	Borland.Vcl.ExtCtrls;

var
  aWrapper : TCLRStreamWrapper;
  fStream : FileStream;
  iValue : Integer;
begin
  if (ParamCount = 0) then
  begin
    ConSole.WriteLine('½Ð¿é¤JÀÉ®×¦WºÙ.' );
    exit;
  end;

  fStream := FileStream.Create(ParamStr(1), FileMode.Create, FileAccess.Write);
  aWrapper := TCLRStreamWrapper.Create(fStream);
  try
    aWrapper.Write(10, SizeOf(Integer));
    aWrapper.Write(20, SizeOf(Integer));
  finally
    fStream.Close;
    aWrapper.Free;
  end;

  fStream := FileStream.Create(ParamStr(1), FileMode.Open, FileAccess.Read);
  aWrapper := TCLRStreamWrapper.Create(fStream);
  try
    aWrapper.Read(iValue);
    Console.WriteLine(IntToStr(iValue));
    aWrapper.Read(iValue);
    Console.WriteLine(IntToStr(iValue));
  finally
    fStream.Close;
  end;
end.
