umeViewer_01

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
program graphScan;
uses GraphABC;
type
_folder = class
private
path : string;
name : string;
countFiles : integer;
countFolders : integer;
pathToFiles : array of string;
pathToFolders : array of string;
fileName : array of string;
folderName : array of string;
reservedData : array of _folder; // for other folders
public
constructor Create(pth : string);
begin
path := pth;
end;
procedure collectData();
procedure outputData(n : integer);
procedure outputDataGraph(x, y, rad, inputRad : integer);
end;
procedure _folder.collectData();
begin
var dataClass := new System.IO.DirectoryInfo(path);
name := dataClass.Name;
var subFolders := dataClass.GetDirectories;
var subFiles := dataClass.GetFiles;
if ( length(subFiles) > 0 ) then
for var i := 0 to length(subFiles)-1 do begin
setlength(pathToFiles, length(pathToFiles)+1);
setlength(fileName, i+1);
fileName[i] := subFiles[i].Name;
pathToFiles[length(pathToFiles)-1] := subFiles[i].FullName;
end;
if ( length(subFolders) > 0 ) then
for var i := 0 to length(subFolders)-1 do begin
setlength(pathToFolders, i+1);
setlength(folderName, i+1);
pathToFolders[i] := subFolders[i].FullName;
folderName[i] := subFolders[i].Name;
setlength(reservedData, i+1);
if (folderName[i].Chars[1] <> '$') then begin
reservedData[i] := new _folder(pathToFolders[i]);
reservedData[i].collectData();
end;
end;
countFiles := length(subFiles);
countFolders := length(subFolders);
SubFiles := nil;
SubFolders := nil;
dataClass := nil;
end;
procedure _folder.outputData(n : integer);
begin
for var i := 0 to countFolders-1 do begin
var str := '--' * n;
writeln(str,'',folderName[i]);
if (length(reservedData) > 0) then
if (folderName[i].Chars[1] <> '$') then
reservedData[i].outputData(n+1);
end;
end;
procedure _folder.outputDataGraph(x, y, rad, InputRad : integer);
begin;
var Rx, Ry : array of integer;
setlength(Rx, countFolders);
setlength(Ry, countFolders);
setbrushcolor(argb(200,255,255,255));
setpencolor(argb(180,0,0,0));
for var i := 0 to countFolders-1 do
if (folderName[i].Chars[1] <> '$') then begin
Rx[i] := round( rad * (cos((360/countFolders ) + 55 * i * (pi/180) ) ));
Ry[i] := round( rad * (sin((360/countFolders ) + 55 * i * (pi/180) ) ));
//fillcircle(x + Rx[i], y + Ry[i], InputRad);
if (length(reservedData) > 0) then
if (folderName[i].Chars[1] <> '$') then
reservedData[i].outputDataGraph(x + Rx[i], y + Ry[i], round(rad/1.5), round(inputRad/1.4));
line(x, y, x + Rx[i], y + Ry[i], argb(100,50,50,50));
fillcircle(x + Rx[i], y + Ry[i], InputRad);
drawcircle(x + Rx[i], y + Ry[i], InputRad);
{for var j := 0 to countFiles-1 do begin
var a := random(360);
var xx := round( random(Inputrad) * (cos(a * (pi/180)) ));
var yy := round( random(inputrad) * (sin(a * (pi/180)) ));
putpixel(x+xx,y+yy,clred);
end;}
end;
end;
begin
SetSmoothingOff;
Window.Maximize;
writeln('Scanning file system on D:/');
var ScannedData := new _folder('D:');
ScannedData.collectData();
//ScannedData.outputData(1);
writeln('Drawing all data');
ScannedData.outputDataGraph(window.Center.X, window.Center.Y, 150, 25);
//for var i := 0 to ScannedData.countFolders-1 do
//writeln('-- ', ScannedData.pathToFolders[i]);
//var test := new System.IO.DirectoryInfo(root);
writeln('All complete in ', milliseconds/1000, ' seconds');
//readln();
end.