![]() |
[Erledigt]Totales Brett vorm Kopf: Problem mit 'end'
Hi
Entweder habe ich ein KOMPLETTES Brett vorm Kopf gerade, oder sonste was. Er sagt es fehle ein 'end', aber wo? Bitte Schnelle Hilfe!
Delphi-Quellcode:
if (Command[1]+Command[2]+Command[3]+Command[4]+Command[5]) = 'LOGIN' then
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; |
Re: Totales Brett vorm Kopf: Problem mit 'end'
Es fehlt nicht in diesem Code-Stück, aber wohl woanders ;) Wahrscheinlich davor.
...:cat:... |
Re: Totales Brett vorm Kopf: Problem mit 'end'
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 = 'TIME' then begin AThread.Connection.WriteLn(FormatDateTime('hh:nn:ss',now)); lbProcesses.Items.Insert(0, 'Sending Command: '+FormatDateTime('hh:nn:ss',now)); end else if Command = 'DATE' then begin AThread.Connection.WriteLn(FormatDateTime('dd/mmm/yyyy',date)); lbProcesses.Items.Insert(0, 'Sending Command: '+FormatDateTime('dd/mmm/yyyy',date)); end else if Command = 'TICKCOUNT' then begin j:=GetTickCount; AThread.Connection.WriteLn(IntToStr(j)); lbProcesses.Items.Insert(0, 'Sending Command: '+IntToStr(GetTickCount)); end else if Command = 'QUIT' then begin AThread.Connection.WriteLn('Cya!'); lbProcesses.Items.Insert(0, 'Sending Command: Cya!'); AThread.Connection.Disconnect; end else if Command = 'GETLIST' then 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 = 'SHUTDOWN' then begin AThread.Connection.WriteLn('Shutdown Server'); lbProcesses.Items.Insert(0, 'Shutdown Server'); AThread.Connection.Disconnect; btnExit.Click; end else if Command = 'RESTART' then 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]) = 'LOGIN' then 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] = 'LOGOUT' then 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; |
Re: Totales Brett vorm Kopf: Problem mit 'end'
Ne Brett vorm Kopf hast du nicht.
ACHTUNG: Nimm die end´s weg die vor dem Quellcode ende kommt! MERKEN: Ein end kommt ans end(e)!!!!!!!!!!!!!!! Es gibt nämlich 3 Arten von end - end - end; - end. Ich hatte auch Probleme mit diesem end. Probier mal end; und end. Dann dürfte es klappen. Wie gesagt: Ich hatte auch dauernd dieses Problem Gruss, Mindforce |
Re: Totales Brett vorm Kopf: Problem mit 'end'
Ds ist auch nicht der komplette Quellcode, sondern nur eine Procedur daraus. Das ende des Programms ist das nicht
|
Re: Totales Brett vorm Kopf: Problem mit 'end'
@MindForce: Was hilft es Ends wegzunehmen, wenn welche fehlen?
@inherited: auf den ersten Blick schaut der Code auch okay aus. Die Anzahl der Begin und der End ist identisch, wie es innerhalb einer Prozedur sein sollte. Allerdings ist die Formattierung (sorry) imo grauenhaft, so dass ich es nicht nachvollziehen kann, ob die Matches zwischen den begin-end Parts stimmen. ...:cat:... |
Re: Totales Brett vorm Kopf: Problem mit 'end'
^^
ja ich weiss, aber das sollte den compiler ja nicht au der fassung bringen. So langsam fange ih an, an meinem Verstand zu zweifeln. HIIILLLLFFEEEEEEEEE. Kann mir denn keiner Helfen? |
Re: Totales Brett vorm Kopf: Problem mit 'end'
omg chon der 3.^^
Wenn ich den teil mit dem LOGIN auskommentiere dann GEHTS |
Re: Totales Brett vorm Kopf: Problem mit 'end'
Kannst du auch Sätze schreiben, die man auch verstehen kann?
Sry :roll: |
Re: Totales Brett vorm Kopf: Problem mit 'end'
Mh, also ich hab auch mal nachgezählt und finde genau so viele ends wie begins.
Ich bin zwar noch nicht so lange dabei, aber vielleicht hilft es ja was wenn man ein bisschen Übersicht in den Quelltext reinbringt. Also ich musste mir doch einige Stellen bisschen länger anschauen um dahinterzusteigen. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:47 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