Changeset 29 for trunk


Ignore:
Timestamp:
Apr 7, 2016, 11:08:31 PM (9 years ago)
Author:
chronos
Message:
  • Added: Random data pattern write operation.
  • Modified: Reversed list of operations so new ones are placed at top of the list.
  • Fixed: Error on openning recent file which not exists.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Form/UFormMain.lfm

    r27 r29  
    283283          item
    284284            Caption = 'Name'
    285             Width = 100
     285            Width = 200
    286286          end       
    287287          item
    288288            Caption = 'Time start'
    289             Width = 100
     289            Width = 150
    290290          end       
    291291          item
    292292            Caption = 'Time end'
    293             Width = 100
     293            Width = 150
    294294          end       
    295295          item
  • trunk/Form/UFormMain.pas

    r28 r29  
    176176  LoadConfig;
    177177  Core.PersistentForm1.Load(Self);
    178   if (LastOpenedList1.Items.Count > 0) then
     178  if (LastOpenedList1.Items.Count > 0) and FileExists(LastOpenedList1.Items[0]) then
    179179    ProjectOpen(LastOpenedList1.Items[0])
    180180  else begin
     
    195195  with Core.Project do
    196196  if (Item.Index >= 0) and (Item.Index < Scans.Count) then
    197   with TDriveScan(Scans[Item.Index]) do begin
     197  with TDriveScan(Scans[Scans.Count - 1 - Item.Index]) do begin
    198198    Item.Caption := GetName;
    199     Item.Data := TDriveScan(Scans[Item.Index]);
     199    Item.Data := TDriveScan(Scans[Scans.Count - 1 - Item.Index]);
    200200    Item.SubItems.Add(DateTimeToStr(TimeStart));
    201201    Item.SubItems.Add(DateTimeToStr(TimeEnd));
  • trunk/Form/UFormOperation.lfm

    r22 r29  
    3737      'Write test'
    3838    )
     39    OnChange = ComboBoxRunModeChange
    3940    Style = csDropDownList
    4041    TabOrder = 2
     
    4243  end
    4344  object Label9: TLabel
    44     Left = 285
     45    Left = 16
    4546    Height = 24
    46     Top = 23
    47     Width = 121
    48     Caption = 'Data pattern:'
     47    Top = 200
     48    Width = 172
     49    Caption = 'Write byte pattern:'
    4950    ParentColor = False
    5051  end
    5152  object EditPattern: TEdit
    52     Left = 439
     53    Left = 232
    5354    Height = 34
    54     Top = 16
     55    Top = 192
    5556    Width = 80
    5657    TabOrder = 3
     
    9394    ParentColor = False
    9495  end
     96  object CheckBoxRandomPattern: TCheckBox
     97    Left = 16
     98    Height = 28
     99    Top = 160
     100    Width = 174
     101    Caption = 'Random pattern'
     102    OnChange = CheckBoxRandomPatternChange
     103    TabOrder = 6
     104  end
    95105end
  • trunk/Form/UFormOperation.pas

    r22 r29  
    1616    ButtonOk: TButton;
    1717    ButtonCancel: TButton;
     18    CheckBoxRandomPattern: TCheckBox;
    1819    ComboBoxRunMode: TComboBox;
    1920    EditPattern: TEdit;
     
    2324    SpinEditFirstSector: TSpinEdit;
    2425    SpinEditLastSector: TSpinEdit;
     26    procedure CheckBoxRandomPatternChange(Sender: TObject);
     27    procedure ComboBoxRunModeChange(Sender: TObject);
    2528    procedure SpinEditFirstSectorChange(Sender: TObject);
    2629    procedure SpinEditLastSectorChange(Sender: TObject);
    2730  private
    2831    procedure UpdateMaxValues;
     32    procedure UpdateWritePattern;
    2933  public
    3034    procedure Load(DriveScan: TDriveScanProfile);
     
    4650end;
    4751
     52procedure TFormOperation.ComboBoxRunModeChange(Sender: TObject);
     53begin
     54  UpdateWritePattern;
     55end;
     56
     57procedure TFormOperation.CheckBoxRandomPatternChange(Sender: TObject);
     58begin
     59  UpdateWritePattern;
     60end;
     61
    4862procedure TFormOperation.SpinEditLastSectorChange(Sender: TObject);
    4963begin
     
    5771end;
    5872
     73procedure TFormOperation.UpdateWritePattern;
     74begin
     75  CheckBoxRandomPattern.Enabled := (ComboBoxRunMode.ItemIndex = Integer(rmWrite));
     76  EditPattern.Enabled := not CheckBoxRandomPattern.Checked and (ComboBoxRunMode.ItemIndex = Integer(rmWrite));
     77end;
     78
    5979procedure TFormOperation.Load(DriveScan: TDriveScanProfile);
    6080begin
     81  CheckBoxRandomPattern.Checked := DriveScan.WritePatternRandom;
     82  UpdateWritePattern;
    6183  ComboBoxRunMode.ItemIndex := Integer(DriveScan.Mode);
    6284  EditPattern.Text := '$' + IntToHex(DriveScan.WritePattern, 2);
     
    7395  DriveScan.SectorStart := SpinEditFirstSector.Value;
    7496  DriveScan.SectorEnd := SpinEditLastSector.Value;
     97  DriveScan.WritePatternRandom := CheckBoxRandomPattern.Checked;
    7598end;
    7699
  • trunk/UDriveScan.pas

    r27 r29  
    3535    Mode: TRunMode;
    3636    WritePattern: Byte;
     37    WritePatternRandom: Boolean;
    3738    procedure LoadFromDriveInfo(DriveInfo: TDriveInfo);
    3839  end;
     
    9192    Mode: TRunMode;
    9293    WritePattern: Byte;
     94    WritePatternRandom: Boolean;
    9395    SectorSize: Integer;
    9496    SectorStart: Integer;
     
    292294  RealSize: Integer;
    293295  Buffer: array of Byte;
     296  I: Integer;
    294297begin
    295298  try
     
    303306    try
    304307      SetLength(Buffer, SectorSize);
    305       if Mode = rmWrite then
    306         FillChar(Buffer[0], Length(Buffer), WritePattern);
     308      if Mode = rmWrite then begin
     309        if not WritePatternRandom then
     310          FillChar(Buffer[0], Length(Buffer), WritePattern)
     311          else for I := 0 to Length(Buffer) - 1 do
     312            Buffer[I] := Random(256);
     313      end;
    307314      while FSectorCurrent < SectorEnd do begin
    308315        try
     
    370377  if Mode = rmNone then Result := 'None'
    371378  else if Mode = rmRead then Result := 'Read'
    372   else if Mode = rmWrite then Result := 'Write pattern $' + IntToHex(WritePattern, 2)
    373   else Result := '';
     379  else if Mode = rmWrite then begin
     380    if WritePatternRandom then Result := 'Write pattern random'
     381      else Result := 'Write pattern $' + IntToHex(WritePattern, 2);
     382  end else Result := '';
    374383end;
    375384
     
    391400  Mode := Profile.Mode;
    392401  WritePattern := Profile.WritePattern;
     402  WritePatternRandom := Profile.WritePatternRandom;
    393403end;
    394404
     
    428438    WriteInteger(Node, 'RunMode', Integer(Mode));
    429439    WriteInteger(Node, 'WritePattern', WritePattern);
     440    WriteBoolean(Node, 'WritePatternRandom', WritePatternRandom);
    430441    WriteString(Node, 'DriveName', DriveName);
    431442    WriteDateTime(Node, 'TimeStart', TimeStart);
     
    469480    Mode := TRunMode(ReadInteger(Node, 'RunMode', 0));
    470481    WritePattern := ReadInteger(Node, 'WritePattern', 0);
     482    WritePatternRandom := ReadBoolean(Node, 'WritePatternRandom', False);
    471483    DriveName := ReadString(Node, 'DriveName', '');
    472484    TimeStart := ReadDateTime(Node, 'TimeStart', 0);
Note: See TracChangeset for help on using the changeset viewer.