Advertisement
Guest User

Untitled

a guest
Feb 21st, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Procedure DelegateFunctions (Array TData.TData (1), Count.i, Path.s, PathOut.s)
  2.     Protected Tmp.i
  3.     Protected Part.i
  4.     Protected Pos1.i, Pos2.i
  5.    
  6.     Protected TFile.i = ReadFile(#PB_Any, Path)
  7.    
  8.     If TFile
  9.         Part = Lof(TFile) / Count
  10.    
  11.         For Tmp = 1 To Count
  12.             Pos2 = Pos1 + Part
  13.             TData(Tmp)\StartOffset = Pos1
  14.                 If Pos2 > Lof(TFile)
  15.                     Pos2 = Lof(TFile)
  16.                 Else
  17.                     FileSeek (TFile, Pos2, #PB_Absolute)
  18.                     ReadString(TFile) ; align position to the len of string
  19.                     Pos2 = Loc(TFile)          
  20.                 EndIf
  21.    
  22.             TData(Tmp)\EndOffset = Pos2
  23.             Pos1 = Pos2
  24.             ;;;;;;;
  25.             TData(Tmp)\Path = Path
  26.             TData(Tmp)\PathOut = PathOut   
  27.            
  28.             TData(Tmp)\Signal = CreateSemaphore()
  29.             TData(Tmp)\ID = Tmp
  30.         Next Tmp
  31.        
  32.         ; also set data for saver thread
  33.         Dim TData(0)\Signals(Count)
  34.             For Tmp = 1 To Count
  35.                 TData(0)\Signals (Tmp) = TData(Tmp)\Signal
  36.             Next Tmp
  37.         TData(0)\PathOut = PathOut
  38.  
  39.         CloseFile(TFile)
  40.         ProcedureReturn 1
  41.     EndIf
  42. EndProcedure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement