Changeset 19


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.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Form/UFormMain.pas

    r18 r19  
    230230    DriveInfo.Assign(TDriveInfo(ComboBoxDrive.Items.Objects[ComboBoxDrive.ItemIndex]));
    231231    Modified := True;
    232     CurrentScan.SectorCount := DriveInfo.SectorCount;
    233     CurrentScan.SectorSize := DriveInfo.SectorSize;
    234     CurrentScan.SectorStart := 0;
    235     CurrentScan.SectorEnd := CurrentScan.SectorCount - 1;
    236     CurrentScan.Reset;
     232    Core.Project.ScanProfile.SectorCount := DriveInfo.SectorCount;
     233    Core.Project.ScanProfile.SectorStart := 0;
     234    Core.Project.ScanProfile.SectorEnd := Core.Project.ScanProfile.SectorCount - 1;
    237235    UpdateInterface;
    238236    Redraw;
     
    247245    CurrentScan.SectorCount := DriveInfo.SectorCount;
    248246    CurrentScan.SectorSize := DriveInfo.SectorSize;
     247    Core.Project.ScanProfile.SectorCount := Core.Project.DriveInfo.SectorCount;
     248    CurrentScan.LoadProfile(Core.Project.ScanProfile);;
    249249    CurrentScan.Reset;
    250250    CurrentScan.OnChange := DriveScanChange;
     
    353353procedure TFormMain.AOperationOptionsExecute(Sender: TObject);
    354354begin
    355   FormOperation.Load(Core.Project.CurrentScan);
     355  Core.Project.ScanProfile.SectorCount := Core.Project.DriveInfo.SectorCount;
     356  FormOperation.Load(Core.Project.ScanProfile);
    356357  if FormOperation.ShowModal = mrOk then begin
    357     FormOperation.Save(Core.Project.CurrentScan);
     358    FormOperation.Save(Core.Project.ScanProfile);
    358359    Core.Project.Modified := True;
    359360    UpdateInterface;
  • trunk/Form/UFormOperation.pas

    r11 r19  
    2828    procedure UpdateMaxValues;
    2929  public
    30     procedure Load(DriveScan: TDriveScan);
    31     procedure Save(DriveScan: TDriveScan);
     30    procedure Load(DriveScan: TDriveScanProfile);
     31    procedure Save(DriveScan: TDriveScanProfile);
    3232  end;
    3333
     
    5757end;
    5858
    59 procedure TFormOperation.Load(DriveScan: TDriveScan);
     59procedure TFormOperation.Load(DriveScan: TDriveScanProfile);
    6060begin
    6161  ComboBoxRunMode.ItemIndex := Integer(DriveScan.Mode);
     
    6767end;
    6868
    69 procedure TFormOperation.Save(DriveScan: TDriveScan);
     69procedure TFormOperation.Save(DriveScan: TDriveScanProfile);
    7070begin
    7171  DriveScan.Mode := TRunMode(ComboBoxRunMode.ItemIndex);
  • trunk/UDriveScan.pas

    r18 r19  
    2525    procedure Execute; override;
    2626    property OnException: TExceptionEvent read FOnException write FOnException;
     27  end;
     28
     29  TDriveScanProfile = class
     30    SectorCount: Integer;
     31    SectorStart: Integer;
     32    SectorEnd: Integer;
     33    Mode: TRunMode;
     34    WritePattern: Byte;
    2735  end;
    2836
     
    6169    procedure Start;
    6270    procedure Stop;
     71    procedure LoadProfile(Profile: TDriveScanProfile);
    6372    constructor Create;
    6473    destructor Destroy; override;
     
    253262end;
    254263
     264procedure TDriveScan.LoadProfile(Profile: TDriveScanProfile);
     265begin
     266  SectorStart := Profile.SectorStart;
     267  SectorEnd := Profile.SectorEnd;
     268  Mode := Profile.Mode;
     269  WritePattern := Profile.WritePattern;
     270end;
     271
    255272constructor TDriveScan.Create;
    256273begin
  • 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.