Class TFileSource (unit FileSrc)

Inherits from

TComponent

TFileSource component by Peter Martinsson (1997.01.01) FREEWARE The purpose of this component is to be able to store ANY kind of file in the .EXE file. This is useful if a component needs a file and you don't want to supply the extra file. Properties: Compress: Boolean - set to True if you want to compress the stored data (reduces EXE-size) DisplayLabel: string - an optional string Extension: string - extension of the created tempfile with '.' (.TMP) FileName: TFileName - the file Store: Boolean - if True, the file in FileName will be stored in the .EXE file and at run-time the FileName property will point to a temporary file (c:\WIN95\TEMP\~fs???+Extension), which will be removed on destruction if False, FileName will point to the original file and you will have to distribute the file as normal The compression algoritm used is described in the LZRW1KH unit. It is not the best algoritm but it is fast. I have wrapped it up in the TCompressStream object (see the source below). -- Use this unit on your own risk. -- If you have any comments please send me an e-mail: martinsson@mbox301.swipnet.se

Constructors



Functions

destructor Destroy;

Public declarations

TFileSource


procedure DefineProperties(Filer: TFiler);

Protected declarations

procedure ReadFileData(Stream: TStream);


procedure WriteFileData(Stream: TStream);


function CreateTempFileName: string;


procedure DeleteTempFile;


function GetFileName: TFileName;


procedure SetCompress(Value: Boolean);


procedure SetFileName(Value: TFileName);


function StoreFileName: Boolean;


Properties

property Compress : Boolean

Published declarations

property DisplayLabel : string


property Extension : string


property FileName : TFileName


property Store : Boolean


Events

Variables

FCompress : Boolean;

Private declarations

FDisplayLabel : string;


FExtension : string;


FFileName : TFileName;


FStore : Boolean;


FTempFileCreated : Boolean;



Constructors


Functions


destructor Destroy;

Public declarations

TFileSource


procedure DefineProperties(Filer: TFiler);

Protected declarations


procedure ReadFileData(Stream: TStream);


procedure WriteFileData(Stream: TStream);


function CreateTempFileName: string;


procedure DeleteTempFile;


function GetFileName: TFileName;


procedure SetCompress(Value: Boolean);


procedure SetFileName(Value: TFileName);


function StoreFileName: Boolean;


Properties


property Compress : Boolean

Published declarations


property DisplayLabel : string


property Extension : string


property FileName : TFileName


property Store : Boolean


Events


Variables


FCompress : Boolean;

Private declarations


FDisplayLabel : string;


FExtension : string;


FFileName : TFileName;


FStore : Boolean;


FTempFileCreated : Boolean;