Changeset 13 for trunk/UProject.pas
- Timestamp:
- Apr 2, 2016, 1:06:34 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UProject.pas
r10 r13 6 6 7 7 uses 8 Classes, SysUtils, Contnrs, DOM, XMLRead, XMLWrite, UXMLUtils, UDriveScan; 8 Classes, SysUtils, Contnrs, DOM, XMLRead, XMLWrite, UXMLUtils, UDriveScan, 9 UPhysDrive; 9 10 10 11 type … … 13 14 14 15 TProject = class 16 private 17 function GetCurrentScan: TDriveScan; 18 function GetSectorCount: Integer; 19 public 15 20 Name: string; 16 21 FileName: string; 17 SectorSize: Integer;18 SectorCount: Integer;19 22 Modified: Boolean; 20 23 Scans: TDriveScanList; 21 Drive Name: string;24 DriveInfo: TDriveInfo; 22 25 constructor Create; 23 26 destructor Destroy; override; 24 27 procedure LoadFromFile(FileName: string); 25 28 procedure SaveToFile(FileName: string); 29 property SectorCount: Integer read GetSectorCount; 30 property CurrentScan: TDriveScan read GetCurrentScan; 26 31 end; 27 32 … … 35 40 { TProject } 36 41 42 function TProject.GetCurrentScan: TDriveScan; 43 begin 44 if Scans.Count > 0 then Result := TDriveScan(Scans[Scans.Count - 1]) 45 else Result := nil; 46 end; 47 48 function TProject.GetSectorCount: Integer; 49 begin 50 Result := DriveInfo.SectorCount; 51 end; 52 37 53 constructor TProject.Create; 38 54 begin 39 SectorSize := 4096;40 55 Scans := TDriveScanList.Create; 56 DriveInfo := TDriveInfo.Create; 41 57 end; 42 58 43 59 destructor TProject.Destroy; 44 60 begin 61 FreeAndNil(DriveInfo); 45 62 FreeAndNil(Scans); 46 63 inherited Destroy; … … 59 76 AppendChild(RootNode); 60 77 with RootNode do begin 61 WriteInteger(RootNode, 'SectorSize', SectorSize); 62 WriteInteger(RootNode, 'SectorCount', SectorCount); 63 WriteString(RootNode, 'DriveName', DriveName); 78 WriteInteger(RootNode, 'SectorCount', DriveInfo.SectorCount); 79 WriteInteger(RootNode, 'SectorSize', DriveInfo.SectorSize); 80 WriteString(RootNode, 'DriveName', DriveInfo.Model); 81 WriteString(RootNode, 'DrivePath', DriveInfo.Path); 82 WriteInt64(RootNode, 'DriveSize', DriveInfo.Size); 64 83 65 84 NewNode := OwnerDocument.CreateElement('Scans'); … … 89 108 RootNode := Doc.DocumentElement; 90 109 with RootNode do begin 91 SectorSize := ReadInteger(RootNode, 'SectorSize', 4096); 92 SectorCount := ReadInteger(RootNode, 'SectorCount', 0); 93 DriveName := ReadString(RootNode, 'DriveName', ''); 110 DriveInfo.SectorSize := ReadInteger(RootNode, 'SectorSize', 4096); 111 DriveInfo.SectorCount := ReadInteger(RootNode, 'SectorCount', 0); 112 DriveInfo.Model := ReadString(RootNode, 'DriveName', ''); 113 DriveInfo.Path := ReadString(RootNode, 'DrivePath', ''); 114 DriveInfo.Size := ReadInt64(RootNode, 'DriveSize', 0); 94 115 95 116 NewNode := FindNode('Scans');
Note:
See TracChangeset
for help on using the changeset viewer.