AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi [Erledigt]Totales Brett vorm Kopf: Problem mit 'end'
Thema durchsuchen
Ansicht
Themen-Optionen

[Erledigt]Totales Brett vorm Kopf: Problem mit 'end'

Ein Thema von inherited · begonnen am 12. Feb 2006 · letzter Beitrag vom 13. Feb 2006
Antwort Antwort
Benutzerbild von inherited
inherited

Registriert seit: 19. Dez 2005
Ort: Rosdorf
2.022 Beiträge
 
Turbo Delphi für Win32
 
#1

Re: Totales Brett vorm Kopf: Problem mit 'end'

  Alt 12. Feb 2006, 19:57
Erstmal danke für die mühe, hier ist die komplette procedure, ääääh Pro>z<edur
Delphi-Quellcode:
procedure TfrmMain.IdTCPServerExecute(AThread: TIdPeerThread);
var
    Command, Answer : String; i, j : Integer; OK: Boolean;
begin
  if Edit1.Text<>'then
  begin
    AThread.Connection.WriteLn(Edit1.Text);
    Exit;
  end;
Answer:='';
Command := AThread.Connection.ReadLn;
lbProcesses.Items.Insert(0, 'Getting Command: '+Command);

Command := uppercase(Command);


if Command = 'TIMEthen begin
    AThread.Connection.WriteLn(FormatDateTime('hh:nn:ss',now));
    lbProcesses.Items.Insert(0, 'Sending Command: '+FormatDateTime('hh:nn:ss',now)); end
else if Command = 'DATEthen begin
    AThread.Connection.WriteLn(FormatDateTime('dd/mmm/yyyy',date));
    lbProcesses.Items.Insert(0, 'Sending Command: '+FormatDateTime('dd/mmm/yyyy',date)); end
else if Command = 'TICKCOUNTthen begin
    j:=GetTickCount;
    AThread.Connection.WriteLn(IntToStr(j));
    lbProcesses.Items.Insert(0, 'Sending Command: '+IntToStr(GetTickCount)); end
else if Command = 'QUITthen
    begin
    AThread.Connection.WriteLn('Cya!');
    lbProcesses.Items.Insert(0, 'Sending Command: Cya!');
    AThread.Connection.Disconnect;
    end

else if Command = 'GETLISTthen
    begin
    for i := 0 to ListBox1.Count-1 do Answer:=Answer+('; '+ListBox1.Items[i]);
    AThread.Connection.WriteLn(Answer);
    lbProcesses.Items.Insert(0, 'Sending Command: '+Answer)
    end

else if Command = 'SHUTDOWNthen
    begin
    AThread.Connection.WriteLn('Shutdown Server');
    lbProcesses.Items.Insert(0, 'Shutdown Server');
    AThread.Connection.Disconnect;
    btnExit.Click;
    end

else if Command = 'RESTARTthen
    begin
    AThread.Connection.WriteLn('Restarting Server in 3 seconds...');
    lbProcesses.Items.Insert(0, 'Restarting Server in 3 seconds...');
    Timer1.Enabled:=true;

    end

else if (Command[1]+Command[2]+Command[3]+Command[4]+Command[5]) = 'LOGINthen
    begin
      OK:=true;
      for i := 0 to ListBox1.Count-1 do if Uppercase(ListBox1.Items[i])=Copy(Command, 6, Length(Command)) then OK:=false;

      if ok then
      begin
        if (Copy(Command, 6, Length(Command)) = 'HAMSTER') or (Copy(Command, 6, Length(Command)) = 'IGEL') then
        begin
          ListBox1.Items.Add(Copy(Command, 6, Length(Command)));
          AThread.Connection.WriteLn('VER:0.1');
          lbProcesses.Items.Insert(0, 'Sending Command: loginok');
        end;
      end;
    end
    else
      begin
      AThread.Connection.WriteLn('loginnotok');
      end

    else if Command[1]+Command[2]+Command[3]+Command[4]+Command[5]+Command[6] = 'LOGOUTthen
    begin
      for i := 0 to ListBox1.Count-1 do
      begin
        if Uppercase(ListBox1.Items[i])=Copy(Command, 7, Length(Command)) then
        begin
          ListBox1.Items.Delete(i);
          lbProcesses.Items.Insert(0, ('Logged out '+Copy(Command, 7, Length(Command))));
        end;
      end;
      AThread.Connection.WriteLn('logoutok');
    end

else
begin
AThread.Connection.WriteLn('Ungültiger Befehl!');
lbProcesses.Items.Insert(0, 'Sending Command: Ungültiger Befehl!');
end;

end;
Nikolai Wyderka

SWIM SWIM HUNGRY!
Neuer Blog: hier!
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:23 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz