- Timestamp:
- Apr 2, 2016, 8:18:30 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Form/UFormMain.lfm
r15 r16 14 14 OnShow = FormShow 15 15 LCLVersion = '1.7' 16 object ButtonScan: TButton17 Left = 1618 Height = 2519 Top = 10420 Width = 7521 Action = AScanStart22 TabOrder = 023 end24 object Image1: TImage25 Left = 60026 Height = 85627 Top = 4028 Width = 109229 Anchors = [akTop, akLeft, akRight, akBottom]30 OnResize = Image1Resize31 end32 object Label1: TLabel33 Left = 1534 Height = 2435 Top = 67536 Width = 10137 Caption = 'Sector size:'38 ParentColor = False39 end40 object LabelSectorSize: TLabel41 Left = 25642 Height = 2443 Top = 67544 Width = 1045 Caption = ' '46 ParentColor = False47 end48 object LabelSectorCount: TLabel49 Left = 25650 Height = 2451 Top = 70452 Width = 1053 Caption = ' '54 ParentColor = False55 end56 object Label2: TLabel57 Left = 1658 Height = 2459 Top = 70460 Width = 11961 Caption = 'Sector count:'62 ParentColor = False63 end64 object LabelBlockCurrent: TLabel65 Left = 25666 Height = 2467 Top = 73668 Width = 1069 Caption = ' '70 ParentColor = False71 end72 object Label3: TLabel73 Left = 1674 Height = 2475 Top = 73676 Width = 13677 Caption = 'Current sector:'78 ParentColor = False79 end80 object Label4: TLabel81 Left = 1782 Height = 2483 Top = 76884 Width = 16285 Caption = 'Damaged sectors:'86 ParentColor = False87 end88 object LabelBlockDamaged: TLabel89 Left = 25690 Height = 2491 Top = 76492 Width = 1093 Caption = ' '94 ParentColor = False95 end96 object Label5: TLabel97 Left = 1698 Height = 2499 Top = 796100 Width = 122101 Caption = 'Elapsed time:'102 ParentColor = False103 end104 object LabelElapsedTime: TLabel105 Left = 256106 Height = 24107 Top = 792108 Width = 10109 Caption = ' '110 ParentColor = False111 end112 object Label6: TLabel113 Left = 17114 Height = 24115 Top = 824116 Width = 142117 Caption = 'Estimated time:'118 ParentColor = False119 end120 object LabelEstimatedTime: TLabel121 Left = 257122 Height = 24123 Top = 820124 Width = 10125 Caption = ' '126 ParentColor = False127 end128 object Label7: TLabel129 Left = 17130 Height = 24131 Top = 644132 Width = 160133 Caption = 'Sectors per Block:'134 ParentColor = False135 end136 object LabelSectorPerBlock: TLabel137 Left = 256138 Height = 24139 Top = 640140 Width = 10141 Caption = ' '142 ParentColor = False143 end144 object LabelIOSpeed: TLabel145 Left = 256146 Height = 24147 Top = 848148 Width = 10149 Caption = ' '150 ParentColor = False151 end152 object Label8: TLabel153 Left = 16154 Height = 24155 Top = 852156 Width = 94157 Caption = 'I/O speed:'158 ParentColor = False159 end160 object ButtonScan1: TButton161 Left = 440162 Height = 25163 Top = 48164 Width = 120165 Action = AProjectOptions166 TabOrder = 1167 end168 object ButtonScan2: TButton169 Left = 104170 Height = 25171 Top = 104172 Width = 75173 Action = AScanStop174 TabOrder = 2175 end176 object Label10: TLabel177 Left = 16178 Height = 24179 Top = 612180 Width = 40181 Caption = 'Size:'182 ParentColor = False183 end184 object LabelSize: TLabel185 Left = 256186 Height = 24187 Top = 608188 Width = 10189 Caption = ' '190 ParentColor = False191 end192 object Button2: TButton193 Left = 192194 Height = 25195 Top = 104196 Width = 107197 Action = AScanContinue198 TabOrder = 3199 end200 object ListView1: TListView201 Left = 17202 Height = 414203 Top = 168204 Width = 567205 Columns = <206 item207 Caption = 'Name'208 end209 item210 Caption = 'Time start'211 end212 item213 Caption = 'Time end'214 end215 item216 Caption = 'First sector'217 end218 item219 Caption = 'Last sector'220 Width = 347221 end>222 OwnerData = True223 ReadOnly = True224 RowSelect = True225 TabOrder = 4226 ViewStyle = vsReport227 OnData = ListView1Data228 end229 object Label11: TLabel230 Left = 17231 Height = 24232 Top = 141233 Width = 107234 Caption = 'Operations:'235 ParentColor = False236 end237 object Button3: TButton238 Left = 312239 Height = 25240 Top = 104241 Width = 112242 Action = AOperationOptions243 TabOrder = 5244 end245 object ComboBoxDrive: TComboBox246 Left = 8247 Height = 38248 Top = 40249 Width = 416250 ItemHeight = 0251 OnChange = ComboBoxDriveChange252 Style = csDropDownList253 TabOrder = 6254 end255 16 object ToolBar1: TToolBar 256 17 Left = 0 … … 259 20 Width = 1703 260 21 Caption = 'ToolBar1' 261 Images = ImageList1262 TabOrder = 722 Images = Core.ImageList1 23 TabOrder = 0 263 24 object ToolButton1: TToolButton 264 25 Left = 1 … … 277 38 end 278 39 end 40 object Panel1: TPanel 41 Left = 597 42 Height = 883 43 Top = 26 44 Width = 1106 45 Align = alClient 46 BevelOuter = bvNone 47 ClientHeight = 883 48 ClientWidth = 1106 49 TabOrder = 1 50 object Image1: TImage 51 Left = 8 52 Height = 867 53 Top = 8 54 Width = 1090 55 Align = alClient 56 BorderSpacing.Around = 8 57 OnResize = Image1Resize 58 end 59 end 60 object Panel2: TPanel 61 Left = 0 62 Height = 883 63 Top = 26 64 Width = 592 65 Align = alLeft 66 BevelOuter = bvNone 67 ClientHeight = 883 68 ClientWidth = 592 69 TabOrder = 2 70 object ButtonScan: TButton 71 Left = 16 72 Height = 25 73 Top = 104 74 Width = 75 75 Action = AScanStart 76 TabOrder = 0 77 end 78 object Label1: TLabel 79 Left = 15 80 Height = 24 81 Top = 675 82 Width = 101 83 Caption = 'Sector size:' 84 ParentColor = False 85 end 86 object LabelSectorSize: TLabel 87 Left = 256 88 Height = 24 89 Top = 675 90 Width = 10 91 Caption = ' ' 92 ParentColor = False 93 end 94 object LabelSectorCount: TLabel 95 Left = 256 96 Height = 24 97 Top = 704 98 Width = 10 99 Caption = ' ' 100 ParentColor = False 101 end 102 object Label2: TLabel 103 Left = 15 104 Height = 24 105 Top = 704 106 Width = 119 107 Caption = 'Sector count:' 108 ParentColor = False 109 end 110 object LabelBlockCurrent: TLabel 111 Left = 256 112 Height = 24 113 Top = 736 114 Width = 10 115 Caption = ' ' 116 ParentColor = False 117 end 118 object Label3: TLabel 119 Left = 15 120 Height = 24 121 Top = 736 122 Width = 136 123 Caption = 'Current sector:' 124 ParentColor = False 125 end 126 object Label4: TLabel 127 Left = 15 128 Height = 24 129 Top = 768 130 Width = 162 131 Caption = 'Damaged sectors:' 132 ParentColor = False 133 end 134 object LabelBlockDamaged: TLabel 135 Left = 256 136 Height = 24 137 Top = 764 138 Width = 10 139 Caption = ' ' 140 ParentColor = False 141 end 142 object Label5: TLabel 143 Left = 15 144 Height = 24 145 Top = 796 146 Width = 122 147 Caption = 'Elapsed time:' 148 ParentColor = False 149 end 150 object LabelElapsedTime: TLabel 151 Left = 256 152 Height = 24 153 Top = 792 154 Width = 10 155 Caption = ' ' 156 ParentColor = False 157 end 158 object Label6: TLabel 159 Left = 15 160 Height = 24 161 Top = 824 162 Width = 142 163 Caption = 'Estimated time:' 164 ParentColor = False 165 end 166 object LabelEstimatedTime: TLabel 167 Left = 257 168 Height = 24 169 Top = 820 170 Width = 10 171 Caption = ' ' 172 ParentColor = False 173 end 174 object Label7: TLabel 175 Left = 15 176 Height = 24 177 Top = 644 178 Width = 160 179 Caption = 'Sectors per Block:' 180 ParentColor = False 181 end 182 object LabelSectorPerBlock: TLabel 183 Left = 256 184 Height = 24 185 Top = 640 186 Width = 10 187 Caption = ' ' 188 ParentColor = False 189 end 190 object LabelIOSpeed: TLabel 191 Left = 256 192 Height = 24 193 Top = 848 194 Width = 10 195 Caption = ' ' 196 ParentColor = False 197 end 198 object Label8: TLabel 199 Left = 15 200 Height = 24 201 Top = 852 202 Width = 94 203 Caption = 'I/O speed:' 204 ParentColor = False 205 end 206 object ButtonScan1: TButton 207 Left = 440 208 Height = 25 209 Top = 16 210 Width = 120 211 Action = AProjectOptions 212 Anchors = [akTop, akRight] 213 TabOrder = 1 214 end 215 object ButtonScan2: TButton 216 Left = 104 217 Height = 25 218 Top = 104 219 Width = 75 220 Action = AScanStop 221 TabOrder = 2 222 end 223 object Label10: TLabel 224 Left = 15 225 Height = 24 226 Top = 612 227 Width = 40 228 Caption = 'Size:' 229 ParentColor = False 230 end 231 object LabelSize: TLabel 232 Left = 256 233 Height = 24 234 Top = 608 235 Width = 10 236 Caption = ' ' 237 ParentColor = False 238 end 239 object Button2: TButton 240 Left = 192 241 Height = 25 242 Top = 104 243 Width = 107 244 Action = AScanContinue 245 TabOrder = 3 246 end 247 object ListView1: TListView 248 Left = 17 249 Height = 398 250 Top = 168 251 Width = 567 252 Anchors = [akTop, akLeft, akRight] 253 Columns = < 254 item 255 Caption = 'Name' 256 Width = 100 257 end 258 item 259 Caption = 'Time start' 260 Width = 100 261 end 262 item 263 Caption = 'Time end' 264 Width = 100 265 end 266 item 267 Caption = 'First sector' 268 Width = 100 269 end 270 item 271 Caption = 'Last sector' 272 Width = 347 273 end> 274 OwnerData = True 275 PopupMenu = PopupMenu1 276 ReadOnly = True 277 RowSelect = True 278 TabOrder = 4 279 ViewStyle = vsReport 280 OnData = ListView1Data 281 OnSelectItem = ListView1SelectItem 282 end 283 object Label11: TLabel 284 Left = 17 285 Height = 24 286 Top = 141 287 Width = 107 288 Caption = 'Operations:' 289 ParentColor = False 290 end 291 object Button3: TButton 292 Left = 312 293 Height = 25 294 Top = 104 295 Width = 112 296 Action = AOperationOptions 297 TabOrder = 5 298 end 299 object ComboBoxDrive: TComboBox 300 Left = 8 301 Height = 38 302 Top = 16 303 Width = 416 304 Anchors = [akTop, akLeft, akRight] 305 ItemHeight = 0 306 OnChange = ComboBoxDriveChange 307 Style = csDropDownList 308 TabOrder = 6 309 end 310 object Button1: TButton 311 Left = 21 312 Height = 25 313 Top = 576 314 Width = 75 315 Action = AOperationAdd 316 TabOrder = 7 317 end 318 object Button4: TButton 319 Left = 112 320 Height = 25 321 Top = 576 322 Width = 115 323 Action = AOperationRemove 324 TabOrder = 8 325 end 326 end 327 object Splitter1: TSplitter 328 Left = 592 329 Height = 883 330 Top = 26 331 Width = 5 332 end 279 333 object Timer1: TTimer 280 334 Interval = 500 … … 284 338 end 285 339 object ActionList1: TActionList 340 Images = Core.ImageList1 286 341 left = 672 287 342 top = 291 … … 294 349 OnExecute = AScanStopExecute 295 350 end 351 object AScanContinue: TAction 352 Caption = 'Continue' 353 OnExecute = AScanContinueExecute 354 end 296 355 object AProjectOptions: TAction 297 356 Caption = 'Options' … … 317 376 OnExecute = AFileSaveExecute 318 377 end 319 object AScanContinue: TAction320 Caption = 'Continue'321 OnExecute = AScanContinueExecute322 end323 378 object AFileNew: TAction 324 379 Caption = 'New' … … 329 384 OnExecute = AFileCloseExecute 330 385 end 386 object AViewToolbar: TAction 387 Caption = 'Toolbar' 388 OnExecute = AViewToolbarExecute 389 end 331 390 object AOperationOptions: TAction 332 391 Caption = 'Options' 333 392 OnExecute = AOperationOptionsExecute 334 393 end 394 object AOperationRemove: TAction 395 Caption = 'Remove' 396 OnExecute = AOperationRemoveExecute 397 end 398 object AOperationAdd: TAction 399 Caption = 'Add' 400 OnExecute = AOperationAddExecute 401 end 335 402 end 336 403 object OpenDialog1: TOpenDialog … … 343 410 end 344 411 object MainMenu1: TMainMenu 345 Images = ImageList1412 Images = Core.ImageList1 346 413 left = 672 347 414 top = 504 … … 394 461 end 395 462 end 396 end 397 object XMLConfig1: TXMLConfig 398 StartEmpty = False 399 RootName = 'CONFIG' 400 ReadOnly = False 401 left = 672 402 top = 160 403 end 404 object ImageList1: TImageList 405 left = 672 406 top = 573 463 object MenuItem16: TMenuItem 464 Caption = 'View' 465 object MenuItem17: TMenuItem 466 Action = AViewToolbar 467 end 468 end 407 469 end 408 470 object LastOpenedList1: TLastOpenedList 409 471 MaxCount = 10 410 left = 904472 left = 672 411 473 top = 144 412 474 end 475 object PopupMenu1: TPopupMenu 476 left = 257 477 top = 425 478 object MenuItem18: TMenuItem 479 Action = AOperationAdd 480 end 481 object MenuItem19: TMenuItem 482 Action = AOperationRemove 483 end 484 end 413 485 end -
trunk/Form/UFormMain.pas
r15 r16 15 15 16 16 TFormMain = class(TForm) 17 AOperationAdd: TAction; 18 AOperationRemove: TAction; 19 AViewToolbar: TAction; 17 20 ADriveSelect: TAction; 18 21 AOperationOptions: TAction; … … 28 31 AScanStop: TAction; 29 32 ActionList1: TActionList; 33 Button1: TButton; 30 34 Button2: TButton; 31 35 Button3: TButton; 36 Button4: TButton; 32 37 ButtonScan: TButton; 33 38 ButtonScan1: TButton; … … 35 40 ComboBoxDrive: TComboBox; 36 41 Image1: TImage; 37 ImageList1: TImageList;38 42 Label1: TLabel; 39 43 Label10: TLabel; … … 46 50 Label7: TLabel; 47 51 Label8: TLabel; 48 LabelElapsedTime: TLabel;49 LabelSectorSize: TLabel;50 LabelSectorCount: TLabel;51 52 LabelBlockCurrent: TLabel; 52 53 LabelBlockDamaged: TLabel; 54 LabelElapsedTime: TLabel; 53 55 LabelEstimatedTime: TLabel; 54 56 LabelIOSpeed: TLabel; 57 LabelSectorCount: TLabel; 58 LabelSectorPerBlock: TLabel; 59 LabelSectorSize: TLabel; 55 60 LabelSize: TLabel; 56 LabelSectorPerBlock: TLabel;57 61 LastOpenedList1: TLastOpenedList; 58 62 ListView1: TListView; … … 65 69 MenuItem14: TMenuItem; 66 70 MenuItem15: TMenuItem; 71 MenuItem16: TMenuItem; 72 MenuItem17: TMenuItem; 73 MenuItem18: TMenuItem; 74 MenuItem19: TMenuItem; 67 75 MenuItemOpenRecent: TMenuItem; 68 76 MenuItem2: TMenuItem; … … 75 83 MenuItem9: TMenuItem; 76 84 OpenDialog1: TOpenDialog; 85 Panel1: TPanel; 86 Panel2: TPanel; 87 PopupMenu1: TPopupMenu; 77 88 SaveDialog1: TSaveDialog; 89 Splitter1: TSplitter; 78 90 Timer1: TTimer; 79 91 ToolBar1: TToolBar; … … 81 93 ToolButton2: TToolButton; 82 94 ToolButton3: TToolButton; 83 XMLConfig1: TXMLConfig;84 95 procedure AExitExecute(Sender: TObject); 85 96 procedure AFileCloseExecute(Sender: TObject); … … 88 99 procedure AFileSaveAsExecute(Sender: TObject); 89 100 procedure AFileSaveExecute(Sender: TObject); 101 procedure AOperationAddExecute(Sender: TObject); 90 102 procedure AOperationOptionsExecute(Sender: TObject); 103 procedure AOperationRemoveExecute(Sender: TObject); 91 104 procedure AProjectOptionsExecute(Sender: TObject); 92 105 procedure AScanContinueExecute(Sender: TObject); 93 106 procedure AScanStartExecute(Sender: TObject); 94 107 procedure AScanStopExecute(Sender: TObject); 108 procedure AViewToolbarExecute(Sender: TObject); 95 109 procedure ComboBoxDriveChange(Sender: TObject); 96 110 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 101 115 procedure Image1Resize(Sender: TObject); 102 116 procedure ListView1Data(Sender: TObject; Item: TListItem); 117 procedure ListView1SelectItem(Sender: TObject; Item: TListItem; 118 Selected: Boolean); 103 119 procedure Timer1Timer(Sender: TObject); 104 120 private … … 107 123 RedrawPending: Boolean; 108 124 LastDriveName: string; 125 ShowToolBar: Boolean; 109 126 procedure OpenRecentClick(Sender: TObject); 110 127 procedure ReloadOperationList; … … 165 182 procedure TFormMain.ListView1Data(Sender: TObject; Item: TListItem); 166 183 begin 167 if (Item.Index >= 0) and (Item.Index < Core.Project.Scans.Count) then 168 with TDriveScan(Core.Project.Scans[Item.Index]) do begin 184 with Core.Project do 185 if (Item.Index >= 0) and (Item.Index < Scans.Count) then 186 with TDriveScan(Scans[Item.Index]) do begin 169 187 Item.Caption := IntToStr(Item.Index); 188 Item.Data := TDriveScan(Scans[Item.Index]); 170 189 Item.SubItems.Add(DateTimeToStr(TimeStart)); 171 190 Item.SubItems.Add(DateTimeToStr(TimeEnd)); … … 175 194 end; 176 195 196 procedure TFormMain.ListView1SelectItem(Sender: TObject; Item: TListItem; 197 Selected: Boolean); 198 begin 199 Core.Project.CurrentScan := TDriveScan(Item.Data); 200 Redraw; 201 ReloadOperationList; 202 end; 203 177 204 procedure TFormMain.FormCreate(Sender: TObject); 178 205 begin 179 206 PrefixMultiplier := TPrefixMultiplier.Create; 180 XMLConfig1.Filename := 'config.xml';181 207 end; 182 208 … … 187 213 UpdateInterface; 188 214 end; 215 end; 216 217 procedure TFormMain.AViewToolbarExecute(Sender: TObject); 218 begin 219 ShowToolBar := not ShowToolBar; 220 ToolBar1.Visible := ShowToolBar; 221 AViewToolbar.Checked := ShowToolBar; 189 222 end; 190 223 … … 255 288 Core.Project.Modified := False; 256 289 Core.Project.Scans.Add(TDriveScan.Create); 290 Core.Project.CurrentScan := TDriveScan(Core.Project.Scans.Last); 257 291 258 292 ComboBoxDrive.ItemIndex := Core.DriveList.IndexOf(Core.DriveList.FindByModel(Core.Project.DriveInfo.Model)); … … 300 334 end; 301 335 336 procedure TFormMain.AOperationAddExecute(Sender: TObject); 337 var 338 NewOperation: TDriveScan; 339 begin 340 with Core.Project do begin 341 NewOperation := TDriveScan.Create; 342 Scans.Add(NewOperation); 343 CurrentScan := TDriveScan(Scans.Last); 344 ReloadOperationList; 345 Redraw; 346 Core.Project.Modified := True; 347 end; 348 end; 349 302 350 procedure TFormMain.AOperationOptionsExecute(Sender: TObject); 303 351 begin … … 308 356 UpdateInterface; 309 357 end; 358 end; 359 360 procedure TFormMain.AOperationRemoveExecute(Sender: TObject); 361 begin 362 Core.Project.CurrentScan := nil; 363 Core.Project.Scans.Remove(ListView1.Selected.Data); 364 ReloadOperationList; 365 Redraw; 366 Core.Project.Modified := True; 310 367 end; 311 368 … … 347 404 procedure TFormMain.DoDraw; 348 405 begin 349 if Assigned(Core.Project) then406 if Assigned(Core.Project) and Assigned(Core.Project.CurrentScan) then 350 407 with Core.Project do begin 351 if RedrawPending then 352 with Image1 do begin 353 if (Width <> Picture.Bitmap.Width) or (Height <> Picture.Bitmap.Height) then 354 Picture.Bitmap.SetSize(Width, Height); 408 if RedrawPending then 409 with Image1 do begin 410 if (Width <> Picture.Bitmap.Width) or (Height <> Picture.Bitmap.Height) then 411 Picture.Bitmap.SetSize(Width, Height); 412 try 413 Core.Project.CurrentScan.Lock.Acquire; 414 try 415 Picture.Bitmap.BeginUpdate(True); 416 CurrentScan.BlockMap.Draw(Picture.Bitmap.Canvas); 417 finally 418 Picture.Bitmap.EndUpdate; 419 end; 420 LabelSectorPerBlock.Caption := IntToStr(CurrentScan.BlockMap.SectorPerBlock); 421 LabelBlockCurrent.Caption := IntToStr(CurrentScan.SectorCurrent); 422 LabelBlockDamaged.Caption := IntToStr(CurrentScan.DamagedBlockCount); 423 finally 424 CurrentScan.Lock.Release; 425 end; 426 RedrawPending := False; 427 end; 355 428 try 356 Core.Project.CurrentScan.Lock.Acquire; 357 try 358 Picture.Bitmap.BeginUpdate(True); 359 CurrentScan.BlockMap.Draw(Picture.Bitmap.Canvas); 360 finally 361 Picture.Bitmap.EndUpdate; 429 CurrentScan.Lock.Acquire; 430 if not CurrentScan.Terminated then begin 431 LabelElapsedTime.Caption := TimeToStr(CurrentScan.GetElapsedTime); 432 LabelEstimatedTime.Caption := TimeToStr((Now - CurrentScan.TimeStart) / 433 CurrentScan.SectorCurrent * (CurrentScan.BlockMap.SectorCount - CurrentScan.SectorCurrent)); 434 LabelIOSpeed.Caption := PrefixMultiplier.Add((CurrentScan.SectorCurrent - LastBlockPos) * 435 CurrentScan.SectorSize / (Timer1.Interval / 1000), BasePrefixMultipliers, 'B/s'); 436 LastBlockPos := CurrentScan.SectorCurrent; 437 end else begin 438 LabelElapsedTime.Caption := ''; 439 LabelEstimatedTime.Caption := ''; 440 LabelIOSpeed.Caption := ''; 362 441 end; 363 LabelSectorPerBlock.Caption := IntToStr(CurrentScan.BlockMap.SectorPerBlock);364 LabelBlockCurrent.Caption := IntToStr(CurrentScan.SectorCurrent);365 LabelBlockDamaged.Caption := IntToStr(CurrentScan.DamagedBlockCount);366 442 finally 367 443 CurrentScan.Lock.Release; 368 444 end; 369 RedrawPending := False;370 end;371 try372 CurrentScan.Lock.Acquire;373 if not CurrentScan.Terminated then begin374 LabelElapsedTime.Caption := TimeToStr(CurrentScan.GetElapsedTime);375 LabelEstimatedTime.Caption := TimeToStr((Now - CurrentScan.TimeStart) /376 CurrentScan.SectorCurrent * (CurrentScan.BlockMap.SectorCount - CurrentScan.SectorCurrent));377 LabelIOSpeed.Caption := PrefixMultiplier.Add((CurrentScan.SectorCurrent - LastBlockPos) *378 CurrentScan.SectorSize / (Timer1.Interval / 1000), BasePrefixMultipliers, 'B/s');379 LastBlockPos := CurrentScan.SectorCurrent;380 end else begin381 LabelElapsedTime.Caption := '';382 LabelEstimatedTime.Caption := '';383 LabelIOSpeed.Caption := '';384 end;385 finally386 CurrentScan.Lock.Release;387 end;388 445 end else 389 446 with Image1 do begin … … 445 502 procedure TFormMain.SaveConfig; 446 503 begin 447 XMLConfig1.SetValue('DriveName', LastDriveName); 448 LastOpenedList1.SaveToXMLConfig(XMLConfig1, 'RecentProjects'); 504 Core.XMLConfig1.SetValue('DriveName', LastDriveName); 505 LastOpenedList1.SaveToXMLConfig(Core.XMLConfig1, 'RecentProjects'); 506 Core.XMLConfig1.SetValue('ShowToolBar', ShowToolBar); 449 507 end; 450 508 451 509 procedure TFormMain.LoadConfig; 452 510 begin 453 LastDriveName := XMLConfig1.GetValue('DriveName', ''); 454 LastOpenedList1.LoadFromXMLConfig(XMLConfig1, 'RecentProjects'); 511 LastDriveName := Core.XMLConfig1.GetValue('DriveName', ''); 512 LastOpenedList1.LoadFromXMLConfig(Core.XMLConfig1, 'RecentProjects'); 513 ShowToolBar := Core.XMLConfig1.GetValue('ShowToolBar', False); 514 ToolBar1.Visible := ShowToolBar; 515 AViewToolbar.Checked := ShowToolBar; 455 516 end; 456 517 … … 473 534 end; 474 535 ListView1.Refresh; 536 537 AOperationRemove.Enabled := Assigned(ListView1.Selected); 475 538 end; 476 539 -
trunk/UConfig.pas
r1 r16 9 9 10 10 const 11 ConfigTest = False;11 ConfigTest = True; 12 12 13 13 implementation -
trunk/UCore.lfm
r15 r16 13 13 top = 208 14 14 end 15 object ImageList1: TImageList 16 left = 224 17 top = 136 18 end 19 object XMLConfig1: TXMLConfig 20 Filename = 'config.xml' 21 StartEmpty = False 22 RootName = 'CONFIG' 23 ReadOnly = False 24 left = 424 25 top = 136 26 end 15 27 end -
trunk/UCore.pas
r15 r16 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, UProject, UPhysDrive, UPersistentForm; 8 Classes, SysUtils, XMLConf, FileUtil, Controls, UProject, UPhysDrive, 9 UPersistentForm; 9 10 10 11 type … … 13 14 14 15 TCore = class(TDataModule) 16 ImageList1: TImageList; 15 17 PersistentForm1: TPersistentForm; 18 XMLConfig1: TXMLConfig; 16 19 procedure DataModuleCreate(Sender: TObject); 17 20 procedure DataModuleDestroy(Sender: TObject); … … 36 39 DriveList := TDriveList.Create; 37 40 Project := nil; 41 XMLConfig1.Filename := 'config.xml'; 38 42 end; 39 43 -
trunk/UDriveScan.pas
r13 r16 175 175 Lock.Release; 176 176 DoChange; 177 178 if ConfigTest then begin 179 if Random < 0.000001 then RealSize := 0 180 else RealSize := SectorSize; 181 //Sleep(1); 182 end else begin 183 F.Position := FSectorCurrent * SectorSize; 184 if Mode = rmRead then RealSize := F.Read(Buffer[0], SectorSize) 185 else if Mode = rmWrite then RealSize := F.Write(Buffer[0], SectorSize) 186 else raise Exception.Create(SUnknownRunMode); 187 end; 177 F.Position := FSectorCurrent * SectorSize; 178 if Mode = rmRead then RealSize := F.Read(Buffer[0], SectorSize) 179 else if Mode = rmWrite then RealSize := F.Write(Buffer[0], SectorSize) 180 else raise Exception.Create(SUnknownRunMode); 188 181 finally 189 182 Lock.Acquire; -
trunk/UPhysDrive.pas
r13 r16 9 9 10 10 type 11 TDriveKind = (dkPhysical, dkFile); 11 12 12 13 { TDriveInfo } 13 14 14 15 TDriveInfo = class 16 Kind: TDriveKind; 15 17 Model: string; 16 18 Size: Int64; … … 97 99 if FileExists(List[I] + '/device') then begin 98 100 NewDriveInfo := TDriveInfo.Create; 101 NewDriveInfo.Kind := dkPhysical; 99 102 NewDriveInfo.Model := Trim(LoadFileToStr(List[I] + '/device/model')); 100 103 NewDriveInfo.SectorSize := StrToInt(Trim(LoadFileToStr(List[I] + '/queue/physical_block_size'))); … … 106 109 end; 107 110 {$ENDIF} 111 { NewDriveInfo := TDriveInfo.Create; 112 NewDriveInfo.Kind := dkFile; 113 NewDriveInfo.Model := 'File'; 114 NewDriveInfo.SectorSize := 4096; 115 NewDriveInfo.SectorCount := 0; 116 NewDriveInfo.Size := 0; 117 NewDriveInfo.Path := ''; 118 Add(NewDriveInfo); 119 } 108 120 end; 109 121 -
trunk/UProject.pas
r13 r16 15 15 TProject = class 16 16 private 17 FCurrentScan: TDriveScan; 17 18 function GetCurrentScan: TDriveScan; 18 19 function GetSectorCount: Integer; … … 28 29 procedure SaveToFile(FileName: string); 29 30 property SectorCount: Integer read GetSectorCount; 30 property CurrentScan: TDriveScan read GetCurrentScan;31 property CurrentScan: TDriveScan read FCurrentScan write FCurrentScan; 31 32 end; 32 33
Note:
See TracChangeset
for help on using the changeset viewer.