⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 idftplistparsevse.pas

📁 photo.163.com 相册下载器 多线程下载
💻 PAS
📖 第 1 页 / 共 2 页
字号:
    //6 - user ID that owns the job
    //contents are always files
    if LCols.Count >0 then
    begin
      LI.FileName := LCols[0];
    end;
    if LCols.Count >1 then
    begin
      LI.Size := StrToIntDef(LCols[1],0);
      LI.NumberRecs := AItem.Size;
    end;
    if (LCols.Count > 4) then
    begin
      LI.VSEPQPriority := StrToIntDef(LCols[4],0);
    end;
    if (LCols.Count > 5) and (LCols[5]<>'') then
    begin
      LI.VSEPQDisposition := DispositionCodeToTIdVSEPQDisposition(LCols[5][1]);
    end;
    if LCols.Count > 6 then
    begin
      LI.OwnerName := LCols[6];
    end;
    LI.ItemType := ditFile;
  finally
    FreeAndNil(LCols);
  end;
  Result := True;
end;

{ TIdFTPLPVSEVSAMCatalog }

class function TIdFTPLPVSEVSAMCatalog.CheckListing(AListing: TIdStrings;
  const ASysDescript: String; const ADetails: Boolean): boolean;

  //E for ESDS
  //K for KSDS
  //R for RRDS
const ValidFileTypeSet = 'EKR'; {do not localize}
var s : TIdStrings;
    LData : String;
begin
  Result := False;
  if AListing.Count >0 then
  begin
    LData := AListing[0];
    s := TIdStringList.Create;
    try
      SplitColumns(LData,s);
      if (s.Count = 5) then
      begin
        Result := (IndyPos(s[4],ValidFileTypeSet)>0) and (IsNumeric(s[3]));
      end;
    finally
      FreeAndNil(s);
    end;
  end;
end;

class function TIdFTPLPVSEVSAMCatalog.GetIdent: String;
begin
  Result := 'VSE:  VSAM Catalog'; {do not localize}
end;

class function TIdFTPLPVSEVSAMCatalog.MakeNewItem(
  AOwner: TIdFTPListItems): TIdFTPListItem;
begin
  Result := TIdVSEVSAMCatalogFTPListItem.Create(AOwner);
end;

class function TIdFTPLPVSEVSAMCatalog.ParseLine(
  const AItem: TIdFTPListItem; const APath: String): Boolean;
//Based on: TCP/IP for VSE User's Guide Version 1 Release 4.0A
//URL: http://publibz.boulder.ibm.com/epubs/pdf/iestcu02.pdf

//Cols:
// 0 - File name
// 1 - Modified Date
// 2 - Modified Time
// 3 - Number of records (might be reported in Unix emulation mode as size)
// 4 - file type (E for ESDS,  K for KSDS,   R for RRDS)
var
  LCols : TIdStrings;
  LI : TIdVSEVSAMCatalogFTPListItem;
begin
  LI := AItem as TIdVSEVSAMCatalogFTPListItem;
  LCols := TIdStringList.Create;
  try
    SplitColumns(Trim(AItem.Data),LCols);
    LI.FileName := LCols[0];
    LI.ModifiedDate := DateYYMMDD(LCols[1]);
    LI.ModifiedDate := AItem.ModifiedDate + TimeHHMMSS(LCols[2]);
    LI.Size := StrToIntDef(LCols[3],0);
    LI.ItemType := ditFile;
  finally
    FreeAndNil(LCols);
  end;
  Result := True;
end;

{ TIdFTPLPVSELibrary }

class function TIdFTPLPVSELibrary.CheckListing(AListing: TIdStrings;
  const ASysDescript: String; const ADetails: Boolean): boolean;
var LBuffer : String;
begin
  if AListing.Count >0 then
  begin
    LBuffer := AListing[0];
    Fetch(LBuffer);
    LBuffer := TrimLeft(LBuffer);
    LBuffer := Fetch(LBuffer,'>')+'>';
    Result := LBuffer = '<Sub Library>';  //Note that for Libraries, this  {Do not translate}
    //is always <Sub Library>
  end
  else
  begin
    Result := False;
  end;
end;

class function TIdFTPLPVSELibrary.GetIdent: String;
begin
  Result := 'VSE:  Library';  {do not localize}
end;

class function TIdFTPLPVSELibrary.MakeNewItem(
  AOwner: TIdFTPListItems): TIdFTPListItem;
begin
  Result := TIdVSELibraryFTPListItem.Create(AOwner);
end;

class function TIdFTPLPVSELibrary.ParseLine(const AItem: TIdFTPListItem;
  const APath: String): Boolean;
var
  LBuffer : String;
//Based on: TCP/IP for VSE User's Guide Version 1 Release 4.0A
//URL: http://publibz.boulder.ibm.com/epubs/pdf/iestcu02.pdf
  LCols : TIdStrings;
  LI : TIdVSELibraryFTPListItem;
begin
  LI := AItem as TIdVSELibraryFTPListItem;
  LBuffer := LI.Data;

  AItem.FileName := Fetch(LBuffer);
  Fetch(LBuffer,'>');  //This is always <Sub Library>
  LCols := TIdStringList.Create;
  try
    SplitColumns(Trim(LBuffer),LCols);
    //0 - number of members - used as file size when emulating Unix, I think
    //1 - number of blocks
    //2 - date
    //3 - time
    if LCols.Count > 0 then
    begin
      LI.Size := StrToIntDef(LCols[0],0);
    end;
    if LCols.Count > 1 then
    begin
      LI.NumberBlocks := StrToIntDef(LCols[1],0);
    end;
    if LCols.Count > 2 then
    begin
      LI.ModifiedDate := DateYYMMDD(Lcols[2]);
    end;
    if LCols.Count > 3 then
    begin
      LI.ModifiedDate := LI.ModifiedDate + TimeHHMMSS(Lcols[3]);
    end;
    //sublibraries are always types of directories
    LI.ItemType := ditDirectory;
  finally
    FreeAndNil(LCols);
  end;
  Result := True;
end;

{ TIdFTPLPVSESubLibrary }

class function TIdFTPLPVSESubLibrary.CheckListing(AListing: TIdStrings;
  const ASysDescript: String; const ADetails: Boolean): boolean;

const ValidEntry : array [0..1] of string = (' F',' S');  {Do not translate}
      VSE_SUBLIBTYPES = ['F',  //fixed
                           'S'];  //string
var s : TIdStrings;
    LData : String;
begin
  if AListing.Count > 0 then
  begin
    LData := AListing[0];
    Result := (Length(LData)>2) and
      ( PosInStrArray( Copy(LData,Length(LData)-1,2),ValidEntry) > -1);
    if Result then
    begin
      s := TIdStringList.Create;
      try
        SplitColumns(LData,s);
        Result := (s.Count > 4) and (IndyPos('/',s[3])>0) and (IndyPos(':',s[4])>0)
          and (CharIsInSet(s[s.Count -1], 1, VSE_SUBLIBTYPES));
      finally
        FreeAndNil(s);
      end;
    end;
  end
  else
  begin
    Result := False;
  end;
end;

class function TIdFTPLPVSESubLibrary.GetIdent: String;
begin
  Result := 'VSE:  Sublibrary'; {do not localize}
end;

class function TIdFTPLPVSESubLibrary.MakeNewItem(
  AOwner: TIdFTPListItems): TIdFTPListItem;
begin
  Result := TIdVSESubLibraryFTPListItem.Create(AOwner);
end;

class function TIdFTPLPVSESubLibrary.ParseLine(const AItem: TIdFTPListItem;
  const APath: String): Boolean;
var
  LBuffer : String;
//Based on: TCP/IP for VSE User's Guide Version 1 Release 4.0A
//URL: http://publibz.boulder.ibm.com/epubs/pdf/iestcu02.pdf
  LCols : TIdStrings;
  LI : TIdVSESubLibraryFTPListItem;
begin
  LI := AItem as TIdVSESubLibraryFTPListItem;
  LBuffer := AItem.Data;
  if Length (LBuffer)<2 then
  begin
    Result := False;
    Exit;
  end;
  LBuffer := Copy(LBuffer,1,Length(LBuffer)-1);
  LCols := TIdStringList.Create;
  try
    SplitColumns(Trim(LBuffer),LCols);
    //0 - file name
    //1 - records in file - might be reported as size in Unix emulation
    //2 - number of library blocks
    //3 - creation date
    //4 - creation time
    //5 - last modified date (may not be present)
    //6 - last modified time (may not be present)
    //sublibrary contents are always files
    if LCols.Count >0 then
    begin
      LI.FileName := LCols[0];
    end;
    if LCols.Count >1 then
    begin
      LI.Size := StrToIntDef(LCols[1],0);
      LI.NumberRecs := AItem.Size;
    end;
    if LCols.Count > 2 then
    begin
      LI.NumberBlocks := StrToIntDef(LCols[2],0);
    end;
    //creation time
      if LCols.Count >3 then
      begin
        LI.CreationDate := DateYYMMDD(LCols[3]);
      end;
      if LCols.Count >4 then
      begin
        LI.CreationDate := LI.CreationDate + TimeHHMMSS(LCols[4]);
      end;

    //modified time
      if LCols.Count >5 then
      begin
        LI.ModifiedDate := DateYYMMDD(LCols[5]);
      end
      else
      begin
        LI.ModifiedDate := DateYYMMDD(LCols[3]);
      end;
      if LCols.Count >6 then
      begin
        LI.ModifiedDate := LI.ModifiedDate + TimeHHMMSS(LCols[6]);
      end
      else
      begin
        LI.ModifiedDate := LI.ModifiedDate + TimeHHMMSS(LCols[4]);
      end;
     AItem.ItemType := ditFile;
  finally
    FreeAndNil(LCols);
  end;
  Result := True;
end;

{ TIdVSEVTOCFTPListItem }

constructor TIdVSEVTOCFTPListItem.Create(AOwner: TCollection);
begin
  inherited;
  SizeAvail := False;
end;

initialization
  RegisterFTPListParser(TIdFTPLPVSELibrary);
  RegisterFTPListParser(TIdFTPLPVSEPowerQueue);
  RegisterFTPListParser(TIdFTPLPVSERootDir);
  RegisterFTPListParser(TIdFTPLPVSESubLibrary);
  RegisterFTPListParser(TIdFTPLPVSEVSAMCatalog);
  RegisterFTPListParser(TIdFTPLPVSEVTOC);
finalization
  UnRegisterFTPListParser(TIdFTPLPVSELibrary);
  UnRegisterFTPListParser(TIdFTPLPVSEPowerQueue);
  UnRegisterFTPListParser(TIdFTPLPVSERootDir);
  UnRegisterFTPListParser(TIdFTPLPVSESubLibrary);
  UnRegisterFTPListParser(TIdFTPLPVSEVSAMCatalog);
  UnRegisterFTPListParser(TIdFTPLPVSEVTOC);
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -