type TSComponentsBase = class public function Create(); function Init();virtual; function InitZip(zip: ZipFile); function OpenFile(alias: string; file: string; password: string): tableArray; function Zip(): ZipFile; protected function GetProp(_variable: tslobj; _name: string): tslobj; function GetPropArr(_variable: tslobj; _name: string; _index: integer): tslobj; function NewObject(_name: string): tslobj;virtual; protected zipfile_: ZipFile; conf_: tableArray; end; function TSComponentsBase.Create(); begin end; function TSComponentsBase.InitZip(zip: ZipFile); begin {self.}Init(); zipfile_ := zip; end; function TSComponentsBase.OpenFile(alias: string; file: string; password: string): tableArray; begin {self.}Init(); zipfile_ := new ZipFile(); return zipfile_.Open(alias, file, password); end; function TSComponentsBase.Zip(): ZipFile; begin return zipfile_; end function TSComponentsBase.GetProp(_variable: tslobj; _name: string): tslobj; begin if ifnil(_variable) then begin name := conf_[_name][0]; xml := zipfile_.Get(name); if ifObj(xml) then begin node := xml.FirstChild(conf_[_name][1]); if not ifObj(node) then raise (name $ " error."); _variable := {self.}NewObject(_name); _variable.InitNode(node); end end return _variable; end; function TSComponentsBase.GetPropArr(_variable: tslobj; _name: string; _index: integer): tslobj; begin if not ifNumber(_index) then begin ind := 1; name := format(conf_[_name][0], ind); xml := zipfile_.Get(name); while ifObj(xml) do begin node := xml.FirstChild(conf_[_name][1]); obj := {self.}NewObject(_name); obj.InitNode(node); _variable[length(_variable)] := obj; name := format(conf_[_name][0], ++ind); xml := zipfile_.Get(name); end return _variable; end if ifnil(_variable[_index]) then begin obj := nil; name := format(conf_[_name][0], _index); xml := zipfile_.Get(name); if ifObj(xml) then begin node := xml.FirstChild(conf_[_name][1]); obj := {self.}NewObject(_name); obj.InitNode(node); _variable[_index] := obj; end end return _variable[_index]; end;