Einzelnen Beitrag anzeigen

Benutzerbild von Deltachaos
Deltachaos

Registriert seit: 20. Feb 2008
Ort: Berlin
195 Beiträge
 
Delphi 7 Personal
 
#9

Re: Kleines Verschlüsselungs-Programm

  Alt 13. Apr 2008, 00:18
Ich habe jetzt auch die Proggressbar durch diese "Gauge" ersätzt gefällt mir irgendwie besser und finde ich mit der Prozentanzeige auch Benutzerfreundlicher.
Auserdem Par Rechtschreibfehler korigirt.

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, Printers, Menus, IdBaseComponent,
  IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, ShellApi, Gauges;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    Memo1: TMemo;
    GroupBox2: TGroupBox;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    Label4: TLabel;
    Button3: TButton;
    Button4: TButton;
    OpenDialog1: TOpenDialog;
    SaveDialog1: TSaveDialog;
    PrintDialog1: TPrintDialog;
    Label6: TLabel;
    Label7: TLabel;
    Button6: TButton;
    Label8: TLabel;
    GroupBox3: TGroupBox;
    MainMenu1: TMainMenu;
    Update1: TMenuItem;
    UpdateStarten1: TMenuItem;
    IdHTTP1: TIdHTTP;
    Datei1: TMenuItem;
    ffnen1: TMenuItem;
    Speichernunter1: TMenuItem;
    Drucken1: TMenuItem;
    Gauge1: TGauge;
    Gauge2: TGauge;
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure UpdateStarten1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ffnen1Click(Sender: TObject);
    procedure Speichernunter1Click(Sender: TObject);
    procedure Drucken1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

const
imax : integer = 65;
iwait : integer = 500; //0.5 sec = 500ms

var
key1, key1a, key1b, key2, key2a, key2b, key3, key3a, key3b: string;

procedure _var_;
begin
 key1:= form1.edit1.text;
 key2:= form1.edit2.text;
 key3:= form1.edit3.text;
 key1a := Copy(key1,1,2);
 key1b := Copy(key1,3,4);
 key2a := Copy(key2,1,2);
 key2b := Copy(key2,3,4);
 key3a := Copy(key3,1,2);
 key3b := Copy(key3,3,4);
end;

procedure l;
begin
  form1.gauge1.progress:=form1.gauge1.progress+1;
end;

procedure code;
begin
  form1.gauge2.MinValue:=0;
  form1.gauge2.MaxValue:=100;
  form1.gauge2.MinValue:=0;
  form1.gauge2.MaxValue:=100;
      begin
        form1.Memo1.text := stringreplace(form1.Memo1.text, '=', '[_0_]' , [rfReplaceAll]);
        l;
        form1.Memo1.text := stringreplace(form1.Memo1.text, ':', '[_-_]' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'a','th%6' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'A','th&%6' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'b','g' + key3b + 'fhu' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'B','gf' + key2a + '#hu' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'c','"' + key1a + 'bJs' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'C','"b' + key2a +'%Js' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'd','/' + key2b +'§jT' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'D','' + key3a + '?jT' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'e','&ast' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'E','&a{st' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'f','g@4[' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'F','g' + key2b + '@%4[' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'g','JHG³' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'G','JH²³' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'h','&' + key3b +'%gd' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'H','&' + key1b + '%%gd' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'i','ß}' + key1a + '=47' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'I','ß' + key3a + '}=G47' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'j','&"' + key3a + '31' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'J','&"}31' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'k','&' + key1b + '%$2' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'K','&%' + key3a + ')$2' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'l','9v' + key1b + '45' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'L','9v' + key2a + '[45' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'm','oed' + key3b + '2' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'M','oe' + key1b + 'dß2' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'n','%' + key2a + '-93' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'N','%-;' + key1a + '93' , [rfReplaceAll]);
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'o','jdS' + key2a +'t' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'O','jd' + key1b + '§St' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'p','%h'+ key2a +'te' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'P','%ht' + key2b + '!e' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'q','g' + key1a + 'h92' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'Q','g' + key3a + 'h³92' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'r','th' + key3b + 'vg' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'R','th?' + key3b + 'vg' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 's','}\' + key2a + '23' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'S','}\d' + key1b + '³23' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 't','x' + key2b + 'J%"' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'T','xJ' + key1a + '$%"' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'u','²[' + key3b + 'g]{' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'U','²[g' + key2a + '&]{' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'v','ueb' + key3a + 'A' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'V','' + key2a + 'ebA' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'w','%&5' + key3a + '&' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'W','%&' + key1b + '=5&' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'x','g' + key2b + 'htz' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'X','gh{' + key1b + 'tz' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'y','(th' + key3a + '{G' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'Y','(th!{' + key1a + 'G' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'z','³E' + key2b + '€w' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, 'Z','³E€@' + key1a + 'w' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, ' ','[H$%³t]' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '1','' + key1b + '!' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '2','' + key1b + '"' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '3','' + key1b + '§' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '4','' + key1b + '$' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '5','' + key1b + '%' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '6','' + key1b + '&' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '7','' + key1b + '/' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '8','' + key1b + '(' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '9','' + key1b + ')' , [rfReplaceAll]);
        l;
        l;
        form1.memo1.text := StringReplace(form1.memo1.text, '0','' + key1b + '=' , [rfReplaceAll]);
        l;
        l;
      end;
  form1.gauge1.progress:=0;
end;

procedure decode;
begin
  form1.gauge2.MinValue:=0;
  form1.gauge2.MaxValue:=65;
  form1.gauge2.MinValue:=0;
  form1.gauge2.MaxValue:=65;
    begin
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + '=','0' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + ')','9' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + '(','8' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + '/','7' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + '&','6' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + '%','5' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + '$','4' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + '§','3' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + '"','2' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key1b + '!','1' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '[H$%³t]',' ' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '³E€@' + key1a + 'w','Z' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '³E' + key2b + '€w','z' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '(th!{' + key1a + 'G','Y' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '(th' + key3a + '{G','y' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'gh{' + key1b + 'tz','X' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'g' + key2b + 'htz','x' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '%&' + key1b + '=5&','W' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '%&5' + key3a + '&','w' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key2a + 'ebA','V' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'ueb' + key3a + 'A','v' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '²[g' + key2a + '&]{','U' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '²[' + key3b + 'g]{','u' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'xJ' + key1a + '$%"','T' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'x' + key2b + 'J%"','t' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '}\d' + key1b + '³23','S' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '}\' + key2a + '23','s' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'th?' + key3b + 'vg','R' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'th' + key3b + 'vg','r' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'g' + key3a + 'h³92','Q' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'g' + key1a + 'h92','q' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '%ht' + key2b + '!e','P' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '%h' + key2a + 'te','p' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'jd' + key1b + '§St','O' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'jdS' + key2a +'t','o' , [rfReplaceAll]);
      l;
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '%-;' + key1a + '93','N' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '%' + key2a + '-93','n' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'oe' + key1b + 'dß2','M' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'oed' + key3b + '2','m' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '9v' + key2a + '[45','L' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '9v' + key1b + '45','l' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '&%' + key3a + ')$2','K' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '&' + key1b + '%$2','k' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '&"}31','J' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '&"' + key3a + '31','j' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'ß' + key3a + '}=G47','I' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'ß}' + key1a + '=47','i' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '&' + key1b + '%%gd','H' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '&' + key3b +'%gd','h' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'JH²³','G' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'JHG³','g' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'g' + key2b + '@%4[','F' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'g@4[','f' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '&a{st','E' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '&ast','e' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '' + key3a + '?jT','D' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '/' + key2b +'§jT','d' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '"b' + key2a +'%Js','C' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, '"' + key1a + 'bJs','c' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'gf' + key2a + '#hu','B' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'g' + key3b + 'fhu','b' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'th&%6','A' , [rfReplaceAll]);
      l;
      form1.memo1.text := StringReplace(form1.memo1.text, 'th%6','a' , [rfReplaceAll]);
      l;
      form1.Memo1.text := stringreplace(form1.Memo1.text, '[_-_]',':' , [rfReplaceAll]);
      l;
      form1.Memo1.text := stringreplace(form1.Memo1.text, '[_0_]','=' , [rfReplaceAll]);
      l;
    end;
  form1.gauge1.progress:=0;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  _var_;
  begin
    if form1.RadioButton1.Checked then
      begin
        code;
        form1.gauge2.progress:=form1.gauge2.progress+100;
        MessageDlg('Codieren erfolgreich beendet',
        mtinformation, [mbOk], 0);
        form1.gauge2.progress:=0;
      end;
  end;
  begin
    if form1.RadioButton2.Checked then
      begin;
        code;
        form1.gauge2.progress:=form1.gauge2.progress+50;
        code; //ich weis das es zählschleifen gibt! :-)
        form1.gauge2.progress:=form1.gauge2.progress+50;
        MessageDlg('Codieren erfolgreich beendet',
        mtinformation, [mbOk], 0);
        form1.gauge2.progress:=0;
      end;
  end;
  begin
    if form1.radiobutton3.checked then
      begin
        code;
        form1.gauge2.progress:=form1.gauge2.progress+33;
        code;
        form1.gauge2.progress:=form1.gauge2.progress+33;
        code;
        form1.gauge2.progress:=form1.gauge2.progress+34;
        MessageDlg('Codieren erfolgreich beendet',
        mtinformation, [mbOk], 0);
        form1.gauge2.progress:=0;
     end;
  end;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  _var_;
  begin
    if form1.RadioButton1.Checked then
      begin
        decode;
        form1.gauge2.progress:=form1.gauge2.progress+100;
        MessageDlg('Decodieren erfolgreich beendet',
        mtinformation, [mbOk], 0);
        form1.gauge2.progress:=0;
      end;
  end;
  begin
    if form1.RadioButton2.Checked then
      begin;
        decode;
        form1.gauge2.progress:=form1.gauge2.progress+50;
        decode; //ich weis das es zählschleifen gibt! :-)
        form1.gauge2.progress:=form1.gauge2.progress+50;
        MessageDlg('Decodieren erfolgreich beendet',
        mtinformation, [mbOk], 0);
        form1.gauge2.progress:=0;
      end;
  end;
  begin;
    if form1.radiobutton3.checked then
      begin
        decode;
        form1.gauge2.progress:=form1.gauge2.progress+33;
        decode;
        form1.gauge2.progress:=form1.gauge2.progress+33;
        decode;
        form1.gauge2.progress:=form1.gauge2.progress+34;
        MessageDlg('Decodieren erfolgreich beendet',
        mtinformation, [mbOk], 0);
        form1.gauge2.progress:=0;
      end;
  end;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  memo1.Lines.Clear
end;

//Update Anfang

//uses ShellApi;

var prog_name: string;

procedure TForm1.UpdateStarten1Click(Sender: TObject);
var stream: TFileStream;
     version, version_p, prog_name_k, check_version: string;
     version_int, check_version_int: integer;
     text_dat: TextFile;
begin
  showmessage('EnigmaD und Updateprogramm kehren während des Updates in einen Zusatnd, in dem es nicht mehr reagiert.' + #10 + 'Warten Sie einfach ab!' + #10 + 'Sollte sich aber nach ungefähr 2 Minuten kein neues Fenster öffnen, starten Sie das Programm neu und führen Sie das Update erneut aus.' + #10 + 'Das Update-Programm legt vor jedem Update ein Backup im Ordner /bak an!');

  version:= '1002';
  version_p:= '1.00.2';
  prog_name_k:= 'enigmad';
  prog_name:= 'EnigmaD';


  version_int:= (StrToInt(version));
  stream := TFilestream.create('ver_info.ini', fmcreate);
  form1.idhttp1.Get('http://redplug.re.funpic.de/dlw/'+ prog_name_k +'/aktuelle_version.txt',stream);
  stream.Free;
  AssignFile(text_dat, 'ver_info.ini');
  Reset(text_dat);
  Readln(text_dat, check_version);
  CloseFile(text_dat);
  check_version_int:= StrToInt(check_version);
  if (check_version_int > version_int) then
  begin
    stream := TFilestream.create('th_upd.exe',fmcreate );
    try
      form1.idhttp1.Get('http://redplug.re.funpic.de/dlw/'+ prog_name_k +'/th_upd.exe',stream);
    finally
      stream.Free;
    end;
    ShellExecute(Application.Handle,'open',PChar('th_upd.exe'),PChar('/UPDATE ' + version_p),PChar(''),SC_DEFAULT);
    form1.close
  end;
  if (check_version_int <= version_int) then
  begin
    showmessage('Sie haben die aktuellste Version ('+ version_p +') von '+ prog_name);
    DeleteFile('ver_info.ini');
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var version: string;
begin
  if ParamCount > 0 then
  if UpperCase(ParamStr(1)) = '/UPDATE'
  then
  begin
    DeleteFile('th_upd.exe');
    DeleteFile('unrar.dll');
    DeleteFile('ver_info.ini');
    version:= UpperCase(ParamStr(2));
    showmessage('' + prog_name +' wurde auf Version ' + version + ' aktualisiert.')
  end;
end;

//update Ende

procedure TForm1.ffnen1Click(Sender: TObject);
begin
  if OpenDialog1.Execute
  then
    TRY
      Memo1.Lines.Loadfromfile(OpenDialog1.Filename);
    EXCEPT
      MessageDlg('Es ist ein Fehler beim Laden der Datei aufgetreten!',
      mtError, [mbOk], 0)
    end;
end;

procedure TForm1.Speichernunter1Click(Sender: TObject);
begin
  if SaveDialog1.Execute
  then
    TRY
      Memo1.Lines.SavetoFile(SaveDialog1.Filename);
    EXCEPT
      MessageDlg('Es ist ein Fehler beim speichern der Datei aufgetreten!',
      mtError, [mbOk], 0)
    END;
end;

procedure TForm1.Drucken1Click(Sender: TObject);
begin
  with Printer do
  begin
    BeginDoc;
    Canvas.TextRect(Rect(200,200,PageWidth-200,PageHeight-200),
                    200, 200, Memo1.Lines.Text);
    EndDoc;
  end;
  MessageDlg('Druckauftrag wurde gesendet!',
  mtinformation, [mbOk], 0);
end;

end.
Was ist "Entropie"?

Das mit dem ändern der "code" und "decode" procedure musst du mir noch genauer erklären.
EnigmaD ist mein erstes Richtiges (sinfolles) Programm.

kleine Frage nebenbei: wie Kann ich überprüfen ob eine internetverbindung besteht?
Ich habs schon mit
Delphi-Quellcode:
 if not form1.idhttp1.Get('http://redplug.re.funpic.de/dlw/'+ prog_name_k +'/aktuelle_version.txt',stream) then
showmessage('Bitte überprüfen sie ihre internetverbindung');
versucht aber das ist net das wahre
Angehängte Dateien
Dateityp: rar enigmad_670.rar (249,8 KB, 5x aufgerufen)
Maximilian Ruta
  Mit Zitat antworten Zitat