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

📄 unit1.pas

📁 CRC 计算
💻 PAS
字号:
unit Unit1;

interface

uses
  SysUtils, WinTypes, WinProcs, Classes, Controls,
  Forms, Dialogs, StdCtrls, Buttons, CRC;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    BitBtn1: TBitBtn;
    Label3: TLabel;
    OpenDialog: TOpenDialog;
    Label4: TLabel;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.BitBtn1Click(Sender: TObject);
var
  f: File;
  CRC16: Word;
  CRC32: LongInt;
  CRCArc: Word;

 procedure Error;
 begin
   Application.MessageBox('Open error.', 'I/O Error', mb_Ok or mb_IconStop)
 end;

begin
  if OpenDialog.Execute then
   begin
    if not FileCRC16(OpenDialog.FileName, CRC16) then
     begin
      Error;
      Exit;
     end;
    Label1.Caption := 'CRC16 = ' + IntToStr(CRC16);

    if not FileCRC32(OpenDialog.FileName, CRC32) then
     begin
      Error;
      Exit;
     end;
    Label2.Caption := 'CRC32 = ' + IntToStr(CRC32);

    if not FileCRCArc(OpenDialog.FileName, CRCArc) then
     begin
      Error;
      Exit;
     end;
    Label4.Caption := 'CRCArc = ' + IntToStr(CRCArc);
   end;
end;

end.

⌨️ 快捷键说明

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