Changeset 19 for trunk/UProject.pas


Ignore:
Timestamp:
Apr 2, 2016, 10:01:11 PM (8 years ago)
Author:
chronos
Message:
  • Modified: Parameters for next scan operation is not stored separatelly from scans itself. So changing parameters will not affect current selected scan item.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UProject.pas

    r16 r19  
    2424    Scans: TDriveScanList;
    2525    DriveInfo: TDriveInfo;
     26    ScanProfile: TDriveScanProfile;
    2627    constructor Create;
    2728    destructor Destroy; override;
     
    5657  Scans := TDriveScanList.Create;
    5758  DriveInfo := TDriveInfo.Create;
     59  ScanProfile := TDriveScanProfile.Create;
    5860end;
    5961
    6062destructor TProject.Destroy;
    6163begin
     64  FreeAndNil(ScanProfile);
    6265  FreeAndNil(DriveInfo);
    6366  FreeAndNil(Scans);
     
    8285      WriteString(RootNode, 'DrivePath', DriveInfo.Path);
    8386      WriteInt64(RootNode, 'DriveSize', DriveInfo.Size);
     87
     88      NewNode := OwnerDocument.CreateElement('ScanProfile');
     89      AppendChild(NewNode);
     90      WriteInteger(NewNode, 'SectorStart', ScanProfile.SectorStart);
     91      WriteInteger(NewNode, 'SectorEnd', ScanProfile.SectorEnd);
     92      WriteInteger(NewNode, 'WritePattern', ScanProfile.WritePattern);
     93      WriteInteger(NewNode, 'Mode', Integer(ScanProfile.Mode));
    8494
    8595      NewNode := OwnerDocument.CreateElement('Scans');
     
    111121      DriveInfo.SectorSize := ReadInteger(RootNode, 'SectorSize', 4096);
    112122      DriveInfo.SectorCount := ReadInteger(RootNode, 'SectorCount', 0);
     123      ScanProfile.SectorCount := DriveInfo.SectorCount;
    113124      DriveInfo.Model := ReadString(RootNode, 'DriveName', '');
    114125      DriveInfo.Path := ReadString(RootNode, 'DrivePath', '');
    115126      DriveInfo.Size := ReadInt64(RootNode, 'DriveSize', 0);
     127
     128      NewNode := FindNode('ScanProfile');
     129      if Assigned(NewNode) then begin
     130        ScanProfile.SectorStart := ReadInteger(NewNode, 'SectorStart', 0);
     131        ScanProfile.SectorEnd := ReadInteger(NewNode, 'SectorEnd', ScanProfile.SectorCount - 1);
     132        ScanProfile.WritePattern := ReadInteger(NewNode, 'WritePattern', 0);
     133        ScanProfile.Mode := TRunMode(ReadInteger(NewNode, 'Mode', 0));
     134      end;
    116135
    117136      NewNode := FindNode('Scans');
Note: See TracChangeset for help on using the changeset viewer.