Delphi专题 ·

Delphi制作千年sf通用登陆器(附源码下载)

原理

千年sf的ip地址都存在于Addr.dat文件中(早期版本为Addr.txt?)

所以,操作这个就行了

本软件用Delphi Xe8编写(Delphi7修改相应的引用单元即可)

Delphi制作千年sf通用登陆器(附源码下载) Delphi专题 第1张

主要代码


{*******************************************************}
{                                                       }
{                 Delphi制作千年sf登录器                 }
{                                                       }
{         Copyright(c) 2018 www.amingstudio.com         }
{                                                       }     
{                 All rights reserved                   }
{                                                       }
{*******************************************************}
function IsValidIP(Str: string): Boolean; // 检查IP地址合法性
var
  i, PartCount { 用多少段,以点号分开 } : Integer;
  Part: string;
begin
  PartCount := 0;
  while Str <> '' do
  begin
    i := Pos('.', Str);
    if i = 0 then
    begin
      Part := Str;
      Str := '';
    end
    else
    begin
      Part := Copy(Str, 1, i - 1);
      Delete(Str, 1, i);
    end;
    // IP分段必须是[0,255]的整数
    if not TryStrToInt(Part, i) or (i < 0) or (i > 255) then
    begin
      Result := False;
      Exit;
    end;
    Inc(PartCount);
  end;
  Result := PartCount = 4; // 必须要有4段
end;

procedure TForm3.Button1Click(Sender: TObject);
var
  CopyAdd: string;
begin
  if (Edit1.Text = '') or (Edit2.Text = '') or (Edit3.Text = '') or
    (Edit4.Text = '') then
    Showmessage('IP地址、端口、服务器名称、线路名称未填写完全,请认真填写!')
  else
  begin
    CopyAdd := Edit1.Text + ',' + Edit2.Text + ',' + Edit3.Text + ',' +
      Edit4.Text;
    Clipboard.AsText := CopyAdd;
    Showmessage('复制所有信息成功!');
  end;
end;

procedure TForm3.Button2Click(Sender: TObject);
var
  AddList: TStringList;
  i: Integer;
begin
  if IsValidIP(Edit1.Text) = False then
    Showmessage('IP地址不合法,请重新输入!')
  else
  begin
    AddList := TStringList.Create;
    try
      AddList.LoadFromFile(Form2.Label2.Caption);
      AddList.Insert(0, Edit1.Text + ',' + Edit2.Text + ',' + Edit3.Text + ',' +
        Edit4.Text);
      for i := 0 to AddList.Count - 1 do
        Form1.ComboBox1.Items.Clear;
      Form1.ComboBox1.Items := AddList;
      Form1.ComboBox1.ItemIndex := 0;
      AddList.SaveToFile(Form2.Label2.Caption);
    finally
      FreeAndNil(AddList);
    end;
    close;
  end;
end;

procedure TForm3.Button3Click(Sender: TObject);
begin
  if Edit1.Text = '' then
    Showmessage('尚未填写IP地址,请填写后再复制!')
  else if IsValidIP(Edit1.Text) = False then
    Showmessage('IP地址不合法,请重新输入!')
  else
  begin
    Edit1.SelectAll;
    Edit1.CopyToClipboard;
    Showmessage('复制成功!');
  end;
end;

procedure TForm3.Button4Click(Sender: TObject);
begin
  if Edit2.Text = '' then
    Showmessage('尚未填写端口地址,请填写后再复制!')
  else
  begin
    Edit2.SelectAll;
    Edit2.CopyToClipboard;
    Showmessage('复制成功!');
  end;
end;

procedure TForm3.Button6Click(Sender: TObject);
begin
  if Edit4.Text = '' then
    Showmessage('尚未填写服务器名称,请填写后再复制!')
  else
  begin
    Edit4.SelectAll;
    Edit4.CopyToClipboard;
    Showmessage('复制成功!');
  end;
end;

procedure TForm3.Button5Click(Sender: TObject);
begin
  if Edit3.Text = '' then
    Showmessage('尚未填写线路名称,请填写后再复制!')
  else
  begin
    Edit3.SelectAll;
    Edit3.CopyToClipboard;
    Showmessage('复制成功!');
  end;
end;

procedure TForm3.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
  if not(Key in ['0' .. '9']) then
  begin
    Showmessage('只能为数字,端口输入不合法,请重新输入!');
    Key := #0;
  end;
end;

相关下载

点击下载

参与评论