⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crcunit1.txt

📁 CRC校验算法 CRC校验算法 CRC校验算法 CRC校验算法
💻 TXT
字号:
unit Unit1;

interface

uses
  SysUtils,  Forms, crc32, ComCtrls, StdCtrls, ExtCtrls, Classes,
  Controls, Dialogs;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    ProgressCRC: TProgressBar;
    OpenDialog1: TOpenDialog;
    Label1: TLabel;
    FileEdit: TEdit;
    CRC32Text: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure AnalyzeFile(Filename: TFilename);
  private
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

const NotCalc='--Not Calculated--';

procedure UpdateProgress(Percent:Integer);
begin
Form1.ProgressCRC.Position:=Percent;
Form1.Refresh;
Application.ProcessMessages;
end;

procedure TForm1.AnalyzeFile(Filename: TFilename);
begin
  FileEdit.Text:=Filename;
  Screen.Cursor:=crHourGlass;
  Application.Title:='Analyzing';
  ProgressCRC.Top:=CRC32Text.Top;
  UpdateProgress(0);
  ProgressCRC.Visible:=True;
  Form1.Refresh;
  try
   CRC32Text.Text:=IntToHex(FileCRC32(FileName,@UpdateProgress),8);
   if CRCError then CRC32Text.Text:='Error';
  finally
   ProgressCRC.Visible:=False;
   Form1.Refresh;
   Application.Title:='CRC32: '+ExtractFileName(Filename);
   Screen.Cursor:=crDefault;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if FileExists(Form1.Caption) then OpenDialog1.FileName:=Form1.Caption;
if OpenDialog1.Execute then AnalyzeFile(OpenDialog1.Filename);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -