Created
August 31, 2018 13:10
-
-
Save tsukanov-as/4a75e731d959017d7238e5ce456e6f28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Procedure ParseFiles(Path) Export | |
Files = FindFiles(Path, "*.bsl", True); | |
Total = Files.Count(); | |
MaxJobs = 8; | |
JobList = New Array(MaxJobs); | |
JobArgs = New Array(1); | |
Index = 0; | |
Taken = 0; | |
While Taken < Total Do | |
If JobList[Index] = Undefined Or JobList[Index].State <> BackgroundJobState.Active Then | |
JobArgs[0] = Files[Taken].FullName; | |
JobList[Index] = BackgroundJobs.Execute("Jobs.ParseFile", JobArgs); | |
Taken = Taken + 1; | |
EndIf; | |
Index = Index + 1; | |
If Index = MaxJobs Then | |
JobList = BackgroundJobs.WaitForExecutionCompletion(JobList, 60); | |
Index = 0; | |
Message = New UserMessage; | |
Message.Text = Format(Int(Taken * 100 / Total), "NZ=0; NG="); | |
Message.Message(); | |
EndIf; | |
EndDo; | |
EndProcedure // ParseFiles() | |
Procedure ParseFile(FileName) Export | |
TextReader = New TextReader(FileName); | |
Source = TextReader.Read(); | |
BSLParser = Cache.GetDataProcessor("BSLParser"); | |
Module = BSLParser.ParseModule(Source); | |
TextReader.Close() | |
EndProcedure // ParseFile() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment