- Timestamp:
- Mar 25, 2016, 10:24:04 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:ignore
set to
CoolDisk
lib
CoolDisk.lps
-
Property svn:ignore
set to
-
trunk/UFormMain.lfm
r1 r2 201 201 TabOrder = 5 202 202 end 203 object ComboBoxRunMode: TComboBox 204 Left = 17 205 Height = 38 206 Top = 88 207 Width = 247 208 ItemHeight = 0 209 ItemIndex = 0 210 Items.Strings = ( 211 'Read test' 212 'Write test' 213 ) 214 Style = csDropDownList 215 TabOrder = 6 216 Text = 'Read test' 217 end 218 object Label9: TLabel 219 Left = 286 220 Height = 24 221 Top = 95 222 Width = 121 223 Caption = 'Data pattern:' 224 ParentColor = False 225 end 226 object EditPattern: TEdit 227 Left = 440 228 Height = 34 229 Top = 88 230 Width = 80 231 TabOrder = 7 232 Text = '0xff' 233 end 203 234 object MainMenu1: TMainMenu 204 235 left = 323 -
trunk/UFormMain.pas
r1 r2 48 48 end; 49 49 50 TRunMode = (rmRead, rmWrite); 51 50 52 { TDriveScan } 51 53 … … 66 68 DamagedBlockCount: Integer; 67 69 Drive: string; 70 Mode: TRunMode; 71 WritePattern: Byte; 68 72 function GetElapsedTime: TDateTime; 69 procedure Scan;73 procedure Run; 70 74 constructor Create; 71 75 destructor Destroy; override; … … 93 97 ButtonScan1: TButton; 94 98 ButtonScan2: TButton; 99 ComboBoxRunMode: TComboBox; 100 EditPattern: TEdit; 95 101 EditDrive: TEdit; 96 102 Image1: TImage; … … 103 109 Label7: TLabel; 104 110 Label8: TLabel; 111 Label9: TLabel; 105 112 LabelElapsedTime: TLabel; 106 113 LabelBlockSize: TLabel; … … 155 162 procedure TScanThread.Execute; 156 163 begin 157 TFormMain(Form).DriveScan. Scan;164 TFormMain(Form).DriveScan.Run; 158 165 end; 159 166 … … 313 320 end; 314 321 315 procedure TDriveScan. Scan;322 procedure TDriveScan.Run; 316 323 var 317 324 F: TFileStream; 318 Rea dSize: Integer;325 RealSize: Integer; 319 326 Buffer: array of Byte; 320 327 I: Integer; … … 325 332 Terminated := False; 326 333 DamagedBlockCount := 0; 327 F := TFileStream.Create(Drive, fmOpenRead); 334 if Mode = rmRead then F := TFileStream.Create(Drive, fmOpenRead) 335 else if Mode = rmWrite then F := TFileStream.Create(Drive, fmOpenReadWrite); 328 336 BlockMap.SectorCount := F.Size div SectorSize; 329 337 BlockMap.Clear; 330 338 SetLength(Buffer, SectorSize); 339 if Mode = rmWrite then 340 FillChar(Buffer[0], Length(Buffer), WritePattern); 331 341 for I := 0 to BlockMap.SectorCount - 1 do begin 332 342 SectorCurrent := I; … … 336 346 337 347 if ConfigTest then begin 338 if Random < 0.000001 then Rea dSize := 0339 else Rea dSize := SectorSize;348 if Random < 0.000001 then RealSize := 0 349 else RealSize := SectorSize; 340 350 //Sleep(1); 341 351 end else begin 342 352 F.Position := I * SectorSize; 343 ReadSize := F.Read(Buffer[0], SectorSize); 353 if Mode = rmRead then RealSize := F.Read(Buffer[0], SectorSize) 354 else if Mode = rmWrite then RealSize := F.Write(Buffer[0], SectorSize) 355 else raise Exception.Create('Unknwon run mode'); 344 356 end; 345 357 finally 346 358 Lock.Acquire; 347 359 end; 348 if Rea dSize <> SectorSize then begin360 if RealSize <> SectorSize then begin 349 361 BlockMap.Sectors[I] := bsDamaged; 350 362 Inc(DamagedBlockCount); … … 416 428 DriveScan.SectorSize := Project.SectorSize; 417 429 DriveScan.Terminated := False; 430 DriveScan.Mode := TRunMode(ComboBoxRunMode.ItemIndex); 431 DriveScan.WritePattern := StrToInt(EditPattern.Text); 418 432 ScanThread.Start; 419 433 UpdateInterface; -
trunk/UProject.pas
r1 r2 29 29 constructor TProject.Create; 30 30 begin 31 SectorSize := 512;31 SectorSize := 4096; 32 32 end; 33 33
Note:
See TracChangeset
for help on using the changeset viewer.