📄 trdbase.pas
字号:
begin
if (Ftp.DirList.UID[p] = $ffff) and not (da_ReadList in Ftp.DirList.Attrib[p]) then exit;
end
else
begin
if (Ftp.DirList.UID[p] <> Ftp.UserList.UIDByName(User)) and not Ftp.UserList.RootByName(User) then
begin
if Ftp.UserList.InGroupByName(User,Ftp.DirList.GID[p]) then
begin
if not (da_GrReadList in Ftp.DirList.Attrib[p]) then exit;
end
else
if not (da_ReadList in Ftp.DirList.Attrib[p]) then exit;
end;
end;
end
else
exit;
end;
end;
l:=2;
if Ftp.FListFormat = lf_DOS then l:=-1;
if (TDir = '') and (LType <> di_NLST) then
begin
if (Dir = '') or (Dir[byte(Dir[0])] <> '/') then Dir:=Dir+'/';
for i:=0 to Ftp.DirList.Count-1 do
begin
if (Dir = copy(Ftp.DirList.Path[i],1,length(Dir))) or
((stupcase(Dir) = stupcase(copy(Ftp.DirList.Path[i],1,length(Dir)))) and not Ftp.FCaseSensitive) then
begin
s:=copy(Ftp.DirList.Path[i],length(Dir)+1,255);
j:=pos('/',s);
if (j > 0) and (length(s)-j > 0) then
continue;
s:=copy(s,1,pos('/',s)-1);
r:=[df_Directory];
if da_Enter in Ftp.DirList.Attrib[i] then r:=r+[df_Exec];
if da_ReadList in Ftp.DirList.Attrib[i] then r:=r+[df_Read];
if da_WriteFiles in Ftp.DirList.Attrib[i] then r:=r+[df_Write];
if da_GrEnter in Ftp.DirList.Attrib[i] then r:=r+[df_GrExec];
if da_GrReadList in Ftp.DirList.Attrib[i] then r:=r+[df_GrRead];
if da_GrWriteFiles in Ftp.DirList.Attrib[i] then r:=r+[df_GrWrite];
ft.dwLowDateTime:=0;
ft.dwHighDateTime:=0;
add(FormatLine(s,r,p,Ftp,Ftp.UserList.NameByUID[Ftp.DirList.UID[i]],
Ftp.GrpList.NameByGID[Ftp.DirList.GID[i]],ft,l,Ftp.DirList.UID[i],Ftp.DirList.GID[i]));
end;
end;
end;
Dir:=Ftp.DirList.Alias[p];
if Alltrim(Dir) = '' then exit;
i:=faArchive;
if Ftp.ShowHidden then i:=i+faHidden;
if Ftp.ShowReadOnly then i:=i+faReadOnly;
if TDir = '' then
i:=FindFirst(addslash(Dir)+'*.*',i,SR)
else
i:=FindFirst(addslash(Dir)+TDir,i,SR);
r:=[];
if p >= 0 then
begin
if da_ReadFiles in Ftp.DirList.Attrib[p] then r:=r+[df_Read];
if da_GrReadFiles in Ftp.DirList.Attrib[p] then r:=r+[df_GrRead];
if da_WriteFiles in Ftp.DirList.Attrib[p] then r:=r+[df_Write];
if da_GrWriteFiles in Ftp.DirList.Attrib[p] then r:=r+[df_GrWrite];
end
else
r:=[df_Read, df_GrRead];
r1:=[];
if p >= 0 then
begin
if da_ReadFiles in Ftp.DirList.Attrib[p] then r1:=r1+[df_Read];
if da_GrReadFiles in Ftp.DirList.Attrib[p] then r1:=r1+[df_GrRead];
end
else
r1:=[df_Read, df_GrRead];
while i = 0 do
begin
if (Ftp.FListFormat = lf_DOS) and not IsName8_3(SR.NAME) then
begin
lnm:='';
for j:=0 to 13 do
if SR.FindData.cAlternateFileName[j] in [#0,' '] then
break
else
lnm:=lnm+SR.FindData.cAlternateFileName[j];
end
else
lnm:=SR.Name;
if LType <> di_NLST then
begin
if (SR.Attr and faReadOnly) <> 0 then
add(FormatLine(lnm,r1,p,Ftp,Ftp.UserList.NameByUID[Ftp.DirList.UID[p]],
Ftp.GrpList.NameByGID[Ftp.DirList.GID[p]],SR.FindData.ftCreationTime,SR.Size,Ftp.DirList.UID[p],Ftp.DirList.GID[p]))
else
add(FormatLine(lnm,r,p,Ftp,Ftp.UserList.NameByUID[Ftp.DirList.UID[p]],
Ftp.GrpList.NameByGID[Ftp.DirList.GID[p]],SR.FindData.ftCreationTime,SR.Size,Ftp.DirList.UID[p],Ftp.DirList.GID[p]));
end
else
add(SR.Name);
i:=FindNext(SR);
end;
FindClose(SR);
end;
const
mt : array [1..12] of string[3] = ('Jan','Feb','Mar','Apr','May','Jun','Jul',
'Aug','Sep','Oct','Nov','Dec');
function TListFiller.FormatLine(Name : string; NType : TDirFile; PDir : integer;
Ftp : TFtpComponent; user,group : string; FDate : TFileTime;
FSize : longint; UID,GID : word) : string;
var
i : integer;
c : char;
s : string;
s1: string;
m : integer;
w : integer;
a : TDirAttrib;
st: TSystemTime;
ms: string;
al: boolean;
begin
if name = '' then
begin
result:='';
exit;
end;
FileTimeToSystemTime(FDate,st);
i:=1;
s:='';
s1:='';
m:=0;
w:=0;
al:=false;
a:=Ftp.DirList.Attrib[PDir];
ms:=Ftp.FCustomList;
while i <= length(ms) do
begin
c:=ms[i];
case c of
'\' :
begin
case m of
1: s1:=s1+'%';
2: s1:=s1+s;
3: if w > length(s) then
if al then
s1:=s1+space(w-length(s))+s
else
s1:=s1+s+space(w-length(s));
end;
m:=0;
inc(i);
if i <= length(ms) then
s1:=s1+ms[i];
end;
'%' : m:=1;
else
begin
case m of
0: s1:=s1+c;
1:
begin
case c of
'r' :
begin
if df_Directory in NType then
s:='drwx------'
else
s:='-rw-------';
if df_GrRead in NType then s[5]:='r';
if df_GrWrite in NType then s[6]:='w';
if df_GrExec in NType then s[7]:='x';
if df_Read in NType then s[8]:='r';
if df_Write in NType then s[9]:='w';
if df_Exec in NType then s[10]:='x';
m:=2;
al:=false;
end;
'R' :
begin
if df_Directory in NType then
s:='DRWX------'
else
s:='-RW-------';
if df_GrRead in NType then s[5]:='R';
if df_GrWrite in NType then s[6]:='W';
if df_GrExec in NType then s[7]:='X';
if df_Read in NType then s[8]:='R';
if df_Write in NType then s[9]:='W';
if df_Exec in NType then s[10]:='X';
m:=2;
al:=false;
end;
'u' :
begin
s:=user;
m:=2;
al:=false;
end;
'U' :
begin
s:=stupcase(user);
m:=2;
al:=false;
end;
'g' :
begin
s:=group;
m:=2;
al:=false;
end;
'G' :
begin
s:=stupcase(group);
m:=2;
al:=false;
end;
'I' :
begin
s:=format('%3u',[UID]);
m:=2;
al:=true;
end;
'i' :
begin
s:=format('%3u',[GID]);
m:=2;
al:=true;
end;
's','S' :
begin
if FSize < 0 then
s:='<DIR>'
else
str(FSize,s);
m:=2;
al:=true;
end;
'd','D' :
begin
s:=format('%s %2u %4u',[mt[st.wMonth],st.wDay,st.wYear]);
m:=2;
al:=false;
end;
'f' :
begin
s:=Name;
m:=2;
al:=false;
end;
'F' :
begin
s:=stupcase(Name);
m:=2;
al:=false;
end;
else
begin
s1:=s1+'%'+c;
m:=0;
al:=false;
end;
end;
end;
2:
begin
case c of
':' : w:=0;
'0'..'9' : w:=(w*10)+(byte(c)-$30);
else
begin
if w > length(s) then
begin
if al then
s1:=s1+space(w-length(s))+s+c
else
s1:=s1+s+space(w-length(s))+c;
end
else
s1:=s1+s+c;
m:=0;
w:=0;
end;
if w > 200 then
begin
m:=0;
w:=0;
end;
end;
end;
end;
end;
end;
inc(i);
end;
if s <> '' then
if al then
s1:=s1+space(w-length(s))+s
else
s1:=s1+s;
result:=s1;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -