{*Unit Used For opening and reading ZAX files...ZAX Devolopment by Adam N.Andujar.*}unit ZAX;{*ZAX STATEMENTS#ZAX to say its a ZAX file%Author[Author Name here]%About[About Document Here]%BOD* Start the document*EOD% Close the document*}{$mode objfpc}{$H+}interfaceuses Classes,SysUtils,LCLProc;Type TZAXHeader = Record//File header ZHead:String; ZAuthor:String; ZAbout:String; ZBody:String; end; TZaxFile = File Of TZAXHeader;//File Type TOpenZax = Class(TObject) Private Zax:TZaxheader; F:TZaxFile; FileN:String; Function GetAuthor:String;//Returns the Author Function GetBody:String;//Resturns the body Function GetAbout:String;//returns about Function GetIsDoc:Boolean;//Check for #ZAX Public Property IsDoc:Boolean Read GetIsDoc;//If the documents first line isnt #ZAX it wont be a ZAX doc though will still be read Property Body:String Read GetBody;//The whole file document Property Author:String Read GetAuthor;//Property to hold the author Property About:String Read GetAbout;//Property to hold about the document Constructor Create(const ZF:String);virtual;//Load an existing ZAX file end;implementationFunction TOpenZax.GetIsDoc:Boolean;begin IF(Zax.ZHead = '#ZAx')Then Result := True Else Result := False;end;Function TOpenZax.GetAbout:String;begin Result := GetPart('[',']',ZAX.ZAbout);end;Function TOpenZax.GetAuthor:String;begin Result := GetPart('[',']',Zax.ZAuthor);end;Function TopenZax.GetBody:String;begin Result := GetPart('%BOD*','*EOD%',Zax.ZBody)end;Constructor TOpenZax.Create(const ZF:String);begin FileN := ZF; AssignFile(F,FileN); Reset(F); Read(F,Zax);end;end.
{*Unit used for creating ZAX files. Devolopment by Adam N.Andujar*}unit ZAXCreate;{$mode objfpc}{$H+}interfaceuses Classes,SysUtils,LCLProc,ZAX;Type TMakeZAX = object Private F:TZAXFile; NewZax:TZAXHeader; FileN:String; Function ReadAbout:String;//Read about Function ReadBody:String;//read the body Function ReadAuthor:String;//Read the author Procedure WriteBody(const S:String);virtual;// Add the body Procedure WriteAuthor(const S:String);virtual;//Add the author Procedure WriteAbout(const S:String);virtual;//Add about the document Public Property Body:String Read ReadBody Write WriteBody; Property About:String Read ReadAbout Write WriteAbout; Property Author:String Read ReadAuthor Write WriteAuthor; Constructor Create(const FN:String);//Set all the stuff :P Procedure MakeFile;//Create the file end;implementationProcedure TMakeZax.MakeFile;begin Rewrite(F); Write(F,newZax); CloseFile(F);end;Function TMakeZAX.ReadAbout:String;begin Result := About;end;Function TMakeZAX.ReadAuthor:String;begin Result := Author;end;Function TmakeZAX.ReadBody:String;begin Result := Body;end;Constructor TMakeZax.Create(const FN:String);begin FileN := Fn; AssignFile(F,FileN); Author := ''; About := ''; Body := '';end;Procedure TMakeZAX.WriteAbout(const S:String);begin About := S; NewZax.ZAbout := About;end;Procedure TMakeZAX.WriteBody(const S:String);begin Body := S; NewZax.ZBody := Body;end;Procedure TMakeZAX.WriteAuthor(const S:String);begin Author := S; NewZax.ZAuthor := Author;end;end.
program project1;{$mode objfpc}{$H+}uses Classes,SysUtils,ZAX,ZAXCreate;Var OpenZax:TOpenZAX; make:TMakeZax;begin Make.Create('Z.zax'); Make.Author := 'Adam'; Make.About := 'Something'; Make.Body := 'DJHADJAFK JAFNKJ AANFKJABRUHFAHNJVNKJFKJABKJN'; Make.MakeFile; OPenZax.Create('Z.zax'); Writeln(OPenZax.Author); Writeln(''); Writeln(''); Writeln(OpenZax.Body); Readln;end.
make:=TMakeZax.Create('Z.zax');First initialize Your variable
{*Unit used for creating ZAX files. Devolopment by Adam N.Andujar*}unit ZAXCreate;{$mode objfpc}{$H+}interfaceuses Classes,SysUtils,LCLProc,ZAX;Type TMakeZAX = Class(TObject) Private F:TZAXFile; NewZax:TZAXHeader; FileN:String; Function ReadAbout:String;//Read about Function ReadBody:String;//read the body Function ReadAuthor:String;//Read the author Procedure WriteBody(const S:String);virtual;// Add the body Procedure WriteAuthor(const S:String);virtual;//Add the author Procedure WriteAbout(const S:String);virtual;//Add about the document Public Property Body:String Read ReadBody Write WriteBody; Property About:String Read ReadAbout Write WriteAbout; Property Author:String Read ReadAuthor Write WriteAuthor; Constructor Create(const FN:String);//Set all the stuff :P Procedure MakeFile;//Create the file end;implementationProcedure TMakeZax.MakeFile;begin AssignFile(F,FileN); Rewrite(F); Write(F,newZax); CloseFile(F);end;Function TMakeZAX.ReadAbout:String;begin Result := About;end;Function TMakeZAX.ReadAuthor:String;begin Result := Author;end;Function TmakeZAX.ReadBody:String;begin Result := Body;end;Constructor TMakeZax.Create(const FN:String);begin FileN := Fn; Author := ''; About := ''; Body := '';end;Procedure TMakeZAX.WriteAbout(const S:String);begin About := '%About['+S+']'; NewZax.ZAbout := About;end;Procedure TMakeZAX.WriteBody(const S:String);begin Body := '%BOD*'+S+'*EOD%'; NewZax.ZBody := Body;end;Procedure TMakeZAX.WriteAuthor(const S:String);begin Author := '%Author['+S+']'; NewZax.ZAuthor := Author;end;end.
{*Unit Used For opening and reading ZAX files...ZAX Devolopment by Adam N.Andujar.*}unit ZAX;{*ZAX STATEMENTS#ZAX to say its a ZAX file%Author[Author Name here]%About[About Document Here]%BOD* Start the document*EOD% Close the document*}{$mode objfpc}{$H+}interfaceuses Classes,SysUtils,LCLProc;Type TZAXHeader = Record//File header ZHead:String; ZAuthor:String; ZAbout:String; ZBody:String; end; TZaxFile = File Of TZAXHeader;//File Type TOpenZax = Class(TObject) Private Zax:TZaxheader; F:TZaxFile; FileN:String; Function GetAuthor:String;//Returns the Author Function GetBody:String;//Resturns the body Function GetAbout:String;//returns about Function GetIsDoc:Boolean;//Check for #ZAX Public Property IsDoc:Boolean Read GetIsDoc;//If the documents first line isnt #ZAX it wont be a ZAX doc though will still be read Property Body:String Read GetBody;//The whole file document Property Author:String Read GetAuthor;//Property to hold the author Property About:String Read GetAbout;//Property to hold about the document Constructor Create(const ZF:String);Virtual;//Load an existing ZAX file end;implementationFunction TOpenZax.GetIsDoc:Boolean;begin IF(Zax.ZHead = '#ZAx')Then Result := True Else Result := False;end;Function TOpenZax.GetAbout:String;begin Result := GetPart('[',']',ZAX.ZAbout);end;Function TOpenZax.GetAuthor:String;begin Result := GetPart('[',']',Zax.ZAuthor);end;Function TopenZax.GetBody:String;begin Result := GetPart('%BOD*','*EOD%',Zax.ZBody)end;Constructor TOpenZax.Create(const ZF:String);begin FileN := ZF; AssignFile(F,FileN); Reset(F); Read(F,Zax);end;end.
program project1;{$mode objfpc}{$H+}uses Classes,SysUtils,ZAX,ZAXCreate;Var OpenZax:TOpenZAX; make:TMakeZax;begin Writeln('h'); Make := TMakeZAX.Create('Z.zax'); Make.About := 'Just some book'; Make.Author := 'Adam'; Make.Body := 'HHHHHHHHHHHHHHHHHHHHHHHHHEnvjdn vkj noi3niovnwkvnknm3wlvk nkn3'; Make.MakeFile; OpenZax := TOpenZax.Create('Z.zax'); Writeln(OpenZax.Author); Writeln(OpenZax.Body); Readln;end.