Скачать - архив готовой программы
Есть известная утилита Scanner
мои попытки
EnableExplicit
Declare FileSearch(sPath.s, Mask$ = "*", depth=130)
Global path$
If OpenWindow(0, 0, 0, 500, 550, "Круг", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
StringGadget(2 , 5 , 5 , 410 , 30 , GetUserDirectory(#PB_Directory_Downloads))
ButtonGadget (1, 415, 5, 90, 20, "рис")
CanvasGadget(0, 0, 50, 500, 500)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
path$ = GetGadgetText(2)
If FileSize(path$) = -2
FileSearch(path$, "*", 0)
EndIf
EndSelect
Case #PB_Event_CloseWindow
CloseWindow(0)
End
EndSelect
ForEver
EndIf
Procedure FileSearch(sPath.s, Mask$ = "*", depth=130)
Protected SizeTotal, grad.d, StrtF.d, endF.d
Protected NewList Files.s()
Protected NewList SizeF.q()
Protected sName.s, c = 0
Protected Dim aExaDir(depth)
Protected Dim aSePath.s(depth)
If Right(sPath, 1) <> #PS$
sPath + #PS$
EndIf
aSePath(c) = sPath
aExaDir(c) = ExamineDirectory(#PB_Any, sPath, Mask$)
If Not aExaDir(c)
ProcedureReturn
EndIf
Repeat
While NextDirectoryEntry(aExaDir(c))
sName=DirectoryEntryName(aExaDir(c))
If sName = "." Or sName = ".."
Continue
EndIf
If DirectoryEntryType(aExaDir(c)) = #PB_DirectoryEntry_Directory
If c >= depth
Continue
EndIf
sPath = aSePath(c)
c + 1
aSePath(c) = sPath + sName + #PS$
aExaDir(c) = ExamineDirectory(#PB_Any, aSePath(c), Mask$)
If Not aExaDir(c)
c - 1
EndIf
Else
If AddElement(Files())
Files() = aSePath(c) + sName
If AddElement(SizeF())
SizeF() = FileSize(Files())
EndIf
EndIf
EndIf
Wend
FinishDirectory(aExaDir(c))
c - 1
Until c < 0
; Debug "Depth = " + Str(depth)
; Debug "Count = " + Str(ListSize(Files()))
SizeTotal = 0
ForEach SizeF()
SizeTotal + SizeF()
Next
grad = SizeTotal/360
; Debug SizeTotal
; Debug grad
If StartVectorDrawing(CanvasVectorOutput(0))
endF = 0
ForEach SizeF()
StrtF = endF
endF + SizeF()/grad
MovePathCursor(250, 250)
AddPathCircle(250, 250, 245, StrtF, endF, #PB_Path_Connected)
; ClosePath()
VectorSourceColor(RGBA(Random(99, 50), Random(99, 50), Random(99, 50), 255))
FillPath()
VectorSourceColor(RGBA(255, 255, 255, 255))
MovePathCursor(190 * Cos(Radian((StrtF+endF)/2))+250, 190 * Sin(Radian((StrtF+endF)/2))+250)
DrawVectorText(Str(SizeF()/1024))
Next
StopVectorDrawing()
EndIf
ClearList(Files())
EndProcedureОтредактировано AZJIO (03.05.2021 14:38:51)


