varfe=newCFileEnumerator(feNotifier);fe.AddDirMask(".svn",CFileEnumerator.MASK_WILDCARD,CFileEnumerator.FILE_EXCLUDE);fe.Enumerate(directoryFileName);//get found filesvarfl=fe.GetFoundFiles();
Method
Description
CFileEnumerator()
construct file enumerator without binding to notifier object
CFileEnumerator(notifier)
construct file enumerator with binding to notifier object
AddFileMask(mask,maskType,includeExclude)
add file mask
AddDirMask(mask,maskType,includeExclude)
add directory mask
AddFullFilePathMask(mask,maskType,includeExclude)
add full path file mask
AddFullDirPathMask(mask,maskType,includeExclude)
add full path directory mask
AddFileSizeRule(fileSize,ruleSizeType)
add rule by file size
Enumerate(path, clearPreviousResults)
enumerate files and directories based on rules
ResetAllRules()
clear all rules
GetFoundDirs(ordered = true)
return array of found directories
GetFoundFiles(ordered = true)
return array of found files
Constant
Type
Description
MASK_WILDCARD
maskType
search by wildcard
MASK_REGEX
maskType
search by regex
FILE_INCLUDE
includeExclude
include file if rule is true
FILE_EXCLUDE
includeExclude
exclude file if rule is true
FILESIZE_MINIMUM
ruleSizeType
passed value is minimum file size
FILESIZE_MAXIMUM
ruleSizeType
passed value is maximum file size
FILESIZE_EXACT
ruleSizeType
passed value have to be exact file size
CFileEnumeratorNotifier
This class allows to pass notification callback to CFileEnumerator class.
varfeNotifier=newCFileEnumeratorNotifier;feNotifier.fceOnDirectory=function(path){MessageCenter.ProgressSetMessage("status",path);};//scan for files by path and extensionvarfe=newCFileEnumerator(feNotifier);
Method
Description
CFileEnumeratorNotifier()
construct file enumerator notifier
Property
Description
fceOnDirectory
callback function onDirectory
FileTools
Static class with file manipulation routines.
//convert XML to codevarfileName=...;FileTools.ExistsFile(fileName);
Static class with markup langages (XML,YML,XSLT) routines.
//convert YML to XMLMLTools.ConvertYamlToXml(ymlFile,xmlFile);//setup transform paramsvarxslParams=newArray();xslParams["import-path"]=fileName;xslParams["import-format"]="DoctrineYml";MLTools.XslTransformation(inputXml,inputXslt,outputFile,xslParams);//split and merge filesvarsplitFiles=MLTools.XmlSplitFile(inputXmlFile);MLTools.XmlMergeFiles(splitFiles,outputFile);//read values from xmlvarxmlQuery={"destinationPath":"/import-export-file/@import-path"};MLTools.XmlReadValues(fileName,xmlQuery);varresult=xmlQuery["destinationPath"];
register default namespaces for specified annotations
ScanFile(filePath)
Scan passed file for specified annotation
InsertStopMarks(stopMarks)
define string stop for scanned files
SetMaximumScanLength(scanLength)
define maximum size of file to scan
CAstMergeRules
Class for defining AST merge rules. Rules are evaluated from bottom to top. So the rule entered as latest has the highest priority during evaluation.
varmergeRules=newCAstMergeRules;//default behavior is ADD anything new, DON'T DELETE or UPDATE anything.//If elements are equal, KEEP themmergeRules.SetDefaultRule(CAstMergeRules.ACTION_MERGE,CAstMergeRules.RULE_KEEP,CAstMergeRules.RULE_KEEP,CAstMergeRules.RULE_KEEP);//set special rule for functions. If function exists, DONT't test content(child)mergeRules.AddRuleByType(true,"function",CAstMergeRules.RULE_MERGE,CAstMergeRules.RULE_KEEP,CAstMergeRules.RULE_KEEP,CAstMergeRules.RULE_SKIP);//set special rule for Doctrine2 annotations (and everything else in Doctrine NS).//Insert missing, remove excess, update different, merge-the-same (if you want to keep//unmodified values, set this value to RULE_KEEP)mergeRules.AddRuleByTypeNameNamespace(true,"","","Doctrine\\ORM\\Mapping",CAstMergeRules.RULE_MERGE,CAstMergeRules.RULE_MERGE,CAstMergeRules.RULE_MERGE,CAstMergeRules.RULE_MERGE);
This class allows to calculate all missing namespaces in source XML. It’s useful when importing schema files with relative namespaces inside to simplify following XSLT transfomations.
Note: Xpath evaluator has mapped “dns” namespace alias to document’s default namespace.