ISO9660MicroUDFPrimaryVolClass.pas
上传用户:wanyu_2000
上传日期:2021-02-21
资源大小:527k
文件大小:10k
源码类别:

DVD

开发平台:

Delphi

  1. {-----------------------------------------------------------------------------
  2.  Unit Name: ISO9660MicroUDFPrimaryVolClass
  3.  Author:    Dancemammal, Daniel Mann / Thomas Koos (original class structure)
  4.  Purpose:  Primary Volume Descriptor Class
  5.  History:  First Code Release
  6. -----------------------------------------------------------------------------}
  7. Unit ISO9660MicroUDFPrimaryVolClass;
  8. Interface
  9. Uses
  10.   SysUtils,
  11.   Classes,
  12.   CovertFuncs,
  13.   ISO9660MicroUDFClassTypes;
  14. Type
  15.   TPrimaryVolumeDescriptor = Class
  16.   Private
  17.     Function  GetString(Const AIndex : Integer): String;
  18.     Procedure SetString(const AIndex : Integer; Const Value: String);
  19.   Protected
  20.     FDescriptor : TVolumeDescriptor;
  21.     LastErrorString : String;
  22.   Public
  23.     Constructor Create; Overload; Virtual;
  24.     Constructor Create(Const APrimaryVolumeDescriptor : TVolumeDescriptor); Overload; Virtual;
  25.     Destructor  Destroy; Override;
  26.     Function GetLastError : String;
  27.   Published
  28.     Property  Descriptor : TVolumeDescriptor  Read  fDescriptor;
  29.     Property  SystemIdentifier            : String   Index 0  Read  GetString Write SetString;
  30.     Property  VolumeIdentifier            : String   Index 1  Read  GetString Write SetString;
  31.     Property  VolumeSetIdentifier         : String   Index 2  Read  GetString Write SetString;
  32.     Property  PublisherIdentifier         : String   Index 3  Read  GetString Write SetString;
  33.     Property  DataPreparerIdentifier      : String   Index 4  Read  GetString Write SetString;
  34.     Property  ApplicationIdentifier       : String   Index 5  Read  GetString Write SetString;
  35.     Property  CopyrightFileIdentifier     : String   Index 6  Read  GetString Write SetString;
  36.     Property  AbstractFileIdentifier      : String   Index 7  Read  GetString Write SetString;
  37.     Property  BibliographicFileIdentifier : String   Index 8  Read  GetString Write SetString;
  38.     Property  VolumeCreationDateAndTime   : TVolumeDateTime   Read  fDescriptor.Primary.VolumeCreationDateAndTime
  39.                                                               Write fDescriptor.Primary.VolumeCreationDateAndTime;
  40.     Property  VolumeModificationDateAndTime : TVolumeDateTime
  41.                                                               Read  fDescriptor.Primary.VolumeModificationDateAndTime
  42.                                                               Write fDescriptor.Primary.VolumeModificationDateAndTime;
  43.     Property  VolumeExpirationDateAndTime : TVolumeDateTime   Read  fDescriptor.Primary.VolumeExpirationDateAndTime
  44.                                                               Write fDescriptor.Primary.VolumeExpirationDateAndTime;
  45.     Property  VolumeEffectiveDateAndTime  : TVolumeDateTime   Read  fDescriptor.Primary.VolumeEffectiveDateAndTime
  46.                                                               Write fDescriptor.Primary.VolumeEffectiveDateAndTime;
  47.     Property  VolumeSetSize               : TBothEndianWord   Read  fDescriptor.Primary.VolumeSetSize
  48.                                                               Write fDescriptor.Primary.VolumeSetSize;
  49.     Property  VolumeSequenceNumber        : TBothEndianWord   Read  fDescriptor.Primary.VolumeSequenceNumber
  50.                                                               Write fDescriptor.Primary.VolumeSequenceNumber;
  51.     Property  LogicalBlockSize            : TBothEndianWord   Read  fDescriptor.Primary.LogicalBlockSize
  52.                                                               Write fDescriptor.Primary.LogicalBlockSize;
  53.     Property  PathTableSize               : TBothEndianDWord  Read  fDescriptor.Primary.PathTableSize
  54.                                                               Write fDescriptor.Primary.PathTableSize;
  55.     Property  VolumeSpaceSize             : TBothEndianDWord  Read  fDescriptor.Primary.VolumeSpaceSize
  56.                                                               Write fDescriptor.Primary.VolumeSpaceSize;
  57.                                                               
  58.     Property  RootDirectory               : TRootDirectoryRecord
  59.                                                               Read  fDescriptor.Primary.RootDirectory
  60.                                                               Write fDescriptor.Primary.RootDirectory;
  61.     Property  LocationOfTypeLPathTable    : LongWord          Read  fDescriptor.Primary.LocationOfTypeLPathTable
  62.                                                               Write fDescriptor.Primary.LocationOfTypeLPathTable;
  63.     Property  LocationOfOptionalTypeLPathTable : LongWord     Read  fDescriptor.Primary.LocationOfOptionalTypeLPathTable
  64.                                                               Write fDescriptor.Primary.LocationOfOptionalTypeLPathTable;
  65.     Property  LocationOfTypeMPathTable    : LongWord          Read  fDescriptor.Primary.LocationOfTypeMPathTable
  66.                                                               Write fDescriptor.Primary.LocationOfTypeMPathTable;
  67.     Property  LocationOfOptionalTypeMPathTable : LongWord     Read  fDescriptor.Primary.LocationOfOptionalTypeMPathTable
  68.                                                               Write fDescriptor.Primary.LocationOfOptionalTypeMPathTable;
  69.   End;
  70. Implementation
  71. Constructor TPrimaryVolumeDescriptor.Create;
  72. Begin
  73.   Inherited Create;
  74.   FillChar(FDescriptor, SizeOf(FDescriptor), 0);
  75.   FDescriptor.DescriptorType := vdtPVD;
  76.   FDescriptor.Primary.SystemIdentifier        := ISO_SYSTEM_ID;
  77.   FDescriptor.Primary.StandardIdentifier      := ISO_STANDARD_ID;
  78.   FDescriptor.Primary.VolumeDescriptorVersion := 1;
  79.   FDescriptor.Primary.VolumeSetSize           := BuildBothEndianWord(1);
  80.   FDescriptor.Primary.ApplicationIdentifier   := ISO_LIBRARY_ID;
  81.   FillChar(FDescriptor.Primary.PublisherIdentifier,length(FDescriptor.Primary.PublisherIdentifier),$20);
  82.   FillChar(FDescriptor.Primary.DataPreparerIdentifier,length(FDescriptor.Primary.DataPreparerIdentifier),$20);
  83.   FillChar(FDescriptor.Primary.PublisherIdentifier,length(FDescriptor.Primary.PublisherIdentifier),$20);
  84.   FillChar(FDescriptor.Primary.VolumeSetIdentifier,length(FDescriptor.Primary.VolumeSetIdentifier),$20);
  85.   FDescriptor.Primary.FileStructureVersion    := $01;
  86.   FDescriptor.Primary.VolumeCreationDateAndTime := BuildVolumeDateTime(NOW,0);
  87.   FDescriptor.Primary.VolumeModificationDateAndTime := BuildVolumeDateTime(NOW,0);
  88.   FDescriptor.Primary.LogicalBlockSize              := BuildBothEndianWord(2048);
  89.   FDescriptor.Primary.VolumeSequenceNumber          := BuildBothEndianWord(1);
  90.   FDescriptor.Primary.VolumeSetSize                 := BuildBothEndianWord(1);
  91.   FDescriptor.Primary.LocationOfTypeLPathTable      := 257;
  92.   FDescriptor.Primary.LocationOfOptionalTypeLPathTable := 0;
  93.   FDescriptor.Primary.LocationOfTypeMPathTable      := SwapDWord(258);
  94.   FDescriptor.Primary.LocationOfOptionalTypeMPathTable := 0;
  95.   FillChar(FDescriptor.Primary.EscapeSequences,32,0);
  96.   FDescriptor.Primary.EscapeSequences[0] := '%';
  97.   FDescriptor.Primary.EscapeSequences[1] := '/';
  98.   FDescriptor.Primary.EscapeSequences[2] := 'E';
  99. End;
  100. Constructor TPrimaryVolumeDescriptor.Create(Const APrimaryVolumeDescriptor: TVolumeDescriptor);
  101. Begin
  102.   Inherited Create;
  103.   If ( APrimaryVolumeDescriptor.DescriptorType <> vdtPVD ) Then
  104.     LastErrorString := ('MisMatched Primary Volume Descriptor');
  105.   fDescriptor := APrimaryVolumeDescriptor;
  106. End;
  107. Destructor TPrimaryVolumeDescriptor.Destroy;
  108. Begin
  109.   Inherited Destroy;
  110. End;
  111. Function TPrimaryVolumeDescriptor.GetLastError : String;
  112. begin
  113.     Result := LastErrorString;
  114. end;
  115. Function TPrimaryVolumeDescriptor.GetString(Const AIndex : Integer): String;
  116. Begin
  117.   Case AIndex Of
  118.     0 : Result := fDescriptor.Primary.SystemIdentifier;
  119.     1 : Result := fDescriptor.Primary.VolumeIdentifier;
  120.     2 : Result := fDescriptor.Primary.VolumeSetIdentifier;
  121.     3 : Result := fDescriptor.Primary.PublisherIdentifier;
  122.     4 : Result := fDescriptor.Primary.DataPreparerIdentifier;
  123.     5 : Result := fDescriptor.Primary.ApplicationIdentifier;
  124.     6 : Result := fDescriptor.Primary.CopyrightFileIdentifier;
  125.     7 : Result := fDescriptor.Primary.AbstractFileIdentifier;
  126.     8 : Result := fDescriptor.Primary.BibliographicFileIdentifier;
  127.   End;
  128. End;
  129. Procedure TPrimaryVolumeDescriptor.SetString(Const AIndex: Integer; Const Value: String);
  130. Begin
  131.   Case AIndex Of
  132.     0 : StrPCopy(fDescriptor.Primary.SystemIdentifier,
  133.                   Copy(Value, 1, Length(fDescriptor.Primary.SystemIdentifier)));
  134.     1 : StrPCopy(fDescriptor.Primary.VolumeIdentifier,
  135.                   Copy(Value, 1, Length(fDescriptor.Primary.VolumeIdentifier)));
  136.     2 : StrPCopy(fDescriptor.Primary.VolumeSetIdentifier,
  137.                   Copy(Value, 1, Length(fDescriptor.Primary.VolumeSetIdentifier)));
  138.     3 : StrPCopy(fDescriptor.Primary.PublisherIdentifier,
  139.                   Copy(Value, 1, Length(fDescriptor.Primary.PublisherIdentifier)));
  140.     4 : StrPCopy(fDescriptor.Primary.DataPreparerIdentifier,
  141.                   Copy(Value, 1, Length(fDescriptor.Primary.DataPreparerIdentifier)));
  142.     5 : StrPCopy(fDescriptor.Primary.ApplicationIdentifier,
  143.                   Copy(Value, 1, Length(fDescriptor.Primary.ApplicationIdentifier)));
  144.     6 : StrPCopy(fDescriptor.Primary.CopyrightFileIdentifier,
  145.                   Copy(Value, 1, Length(fDescriptor.Primary.CopyrightFileIdentifier)));
  146.     7 : StrPCopy(fDescriptor.Primary.AbstractFileIdentifier,
  147.                   Copy(Value, 1, Length(fDescriptor.Primary.AbstractFileIdentifier)));
  148.     8 : StrPCopy(fDescriptor.Primary.BibliographicFileIdentifier,
  149.                   Copy(Value, 1, Length(fDescriptor.Primary.BibliographicFileIdentifier)));
  150.   End;
  151. End;
  152. End.