diff --git a/DummyBackend.cs b/DummyBackend.cs
new file mode 100644
index 0000000..f4dfa1c
--- /dev/null
+++ b/DummyBackend.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace inf3
+{
+ class DummyBackend
+ {
+ }
+}
diff --git a/ParserTest.cs b/ParserTest.cs
new file mode 100644
index 0000000..20da838
--- /dev/null
+++ b/ParserTest.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Frontend;
+using WorldOfPeacecraft;
+using System.Threading;
+
+namespace inf3
+{
+ public class ParserTest
+ {
+ static void Main()
+ {
+ Parser p = new Parser();
+
+ p.AddToBuffer("begin:5");
+ //Console.WriteLine(p.getBuffer().Dequeue());
+ p.AddToBuffer("begin:upd");
+ p.AddToBuffer("begin:player");
+ p.AddToBuffer("id:3");
+ p.AddToBuffer("typ:Player");
+ p.AddToBuffer("busy:false");
+ p.AddToBuffer("desc:Player3");
+ p.AddToBuffer("x:3");
+ p.AddToBuffer("y:15");
+ p.AddToBuffer("points:0");
+ p.AddToBuffer("end:player");
+ p.AddToBuffer("end:upd");
+ p.AddToBuffer("end:5");
+
+
+ Thread.Sleep(1000);
+
+ Console.WriteLine(p.getDummyPlayer());
+ Console.ReadLine();
+
+ }
+ }
+}
diff --git a/inf3.csproj b/inf3.csproj
index 271866d..d772698 100644
--- a/inf3.csproj
+++ b/inf3.csproj
@@ -1,4 +1,4 @@
-
+
Debug
@@ -39,10 +39,14 @@
+
+
-
+
+ Form
+
@@ -57,7 +61,5 @@
-
-
-
+
\ No newline at end of file
diff --git a/src/DefaultGui/Program.cs b/src/DefaultGui/Program.cs
index 1f23c87..6a87ab0 100644
--- a/src/DefaultGui/Program.cs
+++ b/src/DefaultGui/Program.cs
@@ -11,12 +11,12 @@ namespace Frontend
///
/// Der Haupteinstiegspunkt für die Anwendung.
///
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new DefaultGui(new Backend()));
- }
+ //[STAThread]
+ // static void Main()
+ // {
+ // Application.EnableVisualStyles();
+ // Application.SetCompatibleTextRenderingDefault(false);
+ // Application.Run(new DefaultGui(new Backend()));
+ // }
}
}
diff --git a/src/Parser.cs b/src/Parser.cs
index 1574b13..8b247ac 100644
--- a/src/Parser.cs
+++ b/src/Parser.cs
@@ -28,19 +28,22 @@ namespace WorldOfPeacecraft
private Thread ParserThread;
private LinkedList Message;
private Regex LastLineRegex;
- private Backend backend;
+ //private Backend backend;
+ private Player DummyPlayer;
public Parser ()
{
ParserThread = new Thread (new ThreadStart (this.RunParser));
Message = new LinkedList ();
LastLineRegex = new Regex ("^end:[0-9]+$");
+
}
private void RunParser ()
{
while (true) {
bool waitRequired = false;
+ //Console.WriteLine(Buffer.Dequeue());
lock (Buffer) {
if (Buffer.Count == 0) {
waitRequired = true;
@@ -51,6 +54,7 @@ namespace WorldOfPeacecraft
BufferFilledEvent.WaitOne ();
}
lock (Buffer) {
+
Message.AddLast (Buffer.Dequeue ());
}
if (IsCompletePackage ()) {
@@ -67,6 +71,11 @@ namespace WorldOfPeacecraft
ProcessData (mainBlock);
}
+ public Player getDummyPlayer()
+ {
+ return DummyPlayer;
+ }
+
private void ProcessData (Block parentBlock)
{
if (parentBlock.GetStringValue ("ans") != null) {
@@ -131,7 +140,7 @@ namespace WorldOfPeacecraft
ProcessPlayer (block);
break;
case MessMapcell:
- ProcessMapcell (block);
+ //ProcessMapcell (block);
break;
default:
ThrowUnknownBlockException (updateBlock, block);
@@ -147,11 +156,11 @@ namespace WorldOfPeacecraft
switch (block.GetName ()) {
case MessPlayer:
Player player = MapPlayer (block);
- backend.removePlayer (player);
+ //backend.removePlayer (player);
break;
case MessDragon:
Dragon dragon = MapDragon (block);
- backend.removeDragon (dragon);
+ //backend.removeDragon (dragon);
break;
}
}
@@ -252,10 +261,11 @@ namespace WorldOfPeacecraft
string desc = playerBlock.GetStringValue ("desc");
int x = playerBlock.GetIntValue ("x");
int y = playerBlock.GetIntValue ("y");
+ DummyPlayer = new Player(id, x, y, desc, busy, score);
return new Player (id, x, y, desc, busy, score);
}
- private ITile MapMapcell (Block cellBlock)
+ /*private ITile MapMapcell (Block cellBlock)
{
CheckBlocksSize(cellBlock, 1, 1);
int x = cellBlock.GetIntValue("col");
@@ -263,6 +273,7 @@ namespace WorldOfPeacecraft
Block propsBlock = cellBlock.GetBlocks ().First.Value;
// TODO Fertigstellen
}
+ */
private void ThrowUnknownBlockException (Block parentBlock, Block childBlock)
{
@@ -301,13 +312,18 @@ namespace WorldOfPeacecraft
BufferFilledEvent.Set ();
}
}
+
+ public Queue getBuffer()
+ {
+ return Buffer;
+ }
private class Block
{
private string Name;
private LinkedList Blocks = new LinkedList ();
private Dictionary Values = new Dictionary ();
- private LinkedList UnnamedValues;
+ private LinkedList UnnamedValues = new LinkedList ();
public Block (String[] message, int start, int end)
{
@@ -378,6 +394,8 @@ namespace WorldOfPeacecraft
{
return bool.Parse (Values [name]);
}
+
+
}
}
}
diff --git a/src/Player.cs b/src/Player.cs
index 882d11f..50a3e99 100644
--- a/src/Player.cs
+++ b/src/Player.cs
@@ -18,5 +18,10 @@ namespace WorldOfPeacecraft
{
return Score;
}
+
+ public override string ToString()
+ {
+ return "Player: " + Id + " " + PosX + " " + PosY + " " + Desc + " " + Busy + " " + Score;
+ }
}
}