Index: trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.Designer.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.Designer.cs	(revision 513)
+++ trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.Designer.cs	(revision 514)
@@ -48,4 +48,5 @@
     /// </summary>
     private void InitializeComponent() {
+      this.components = new System.ComponentModel.Container();
       this.splitContainer1 = new System.Windows.Forms.SplitContainer();
       this.agentsGroupBox = new System.Windows.Forms.GroupBox();
@@ -54,8 +55,11 @@
       this.addButton = new System.Windows.Forms.Button();
       this.refreshButton = new System.Windows.Forms.Button();
+      this.entryContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
+      this.exportAllResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
       this.splitContainer1.Panel1.SuspendLayout();
       this.splitContainer1.Panel2.SuspendLayout();
       this.splitContainer1.SuspendLayout();
       this.agentsGroupBox.SuspendLayout();
+      this.entryContextMenuStrip.SuspendLayout();
       this.SuspendLayout();
       // 
@@ -133,4 +137,18 @@
       this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
       // 
+      // entryContextMenuStrip
+      // 
+      this.entryContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.exportAllResultsToolStripMenuItem});
+      this.entryContextMenuStrip.Name = "entryContextMenuStrip";
+      this.entryContextMenuStrip.Size = new System.Drawing.Size(166, 26);
+      // 
+      // exportAllResultsToolStripMenuItem
+      // 
+      this.exportAllResultsToolStripMenuItem.Name = "exportAllResultsToolStripMenuItem";
+      this.exportAllResultsToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+      this.exportAllResultsToolStripMenuItem.Text = "Export all results";
+      this.exportAllResultsToolStripMenuItem.Click += new System.EventHandler(this.exportAllResultsToolStripMenuItem_Click);
+      // 
       // AgentListView
       // 
@@ -145,4 +163,5 @@
       this.splitContainer1.ResumeLayout(false);
       this.agentsGroupBox.ResumeLayout(false);
+      this.entryContextMenuStrip.ResumeLayout(false);
       this.ResumeLayout(false);
 
@@ -157,4 +176,6 @@
     private TreeView agentTreeView;
     private Button refreshButton;
+    private ContextMenuStrip entryContextMenuStrip;
+    private ToolStripMenuItem exportAllResultsToolStripMenuItem;
   }
 }
Index: trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.cs	(revision 513)
+++ trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.cs	(revision 514)
@@ -65,4 +65,5 @@
           node.Tag = agent;
           node.Nodes.Add("dummy");
+          node.ContextMenuStrip = entryContextMenuStrip;
           agentTreeView.Nodes.Add(node);
         }
@@ -84,4 +85,5 @@
           node.Text = subAgent.Name;
           node.Tag = subAgent;
+          node.ContextMenuStrip = entryContextMenuStrip;
           node.Nodes.Add("dummy");
           e.Node.Nodes.Add(node);
@@ -123,4 +125,16 @@
       UpdateControls();
     }
+
+    private void exportAllResultsToolStripMenuItem_Click(object sender, EventArgs e) {
+      TreeNode node = agentTreeView.SelectedNode;
+      Agent agent = (Agent)node.Tag;
+      ResultExporter exporter = new ResultExporter();
+      ResultTable table = new ResultTable();
+      exporter.Export(agent, table);
+
+      using(System.IO.FileStream s = new System.IO.FileStream("exported-results.txt", System.IO.FileMode.Create)) {
+        table.Write(s);
+      }
+    }
   }
 }
Index: trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.resx
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.resx	(revision 513)
+++ trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.resx	(revision 514)
@@ -118,3 +118,6 @@
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <metadata name="entryContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
 </root>
Index: trunk/sources/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj	(revision 513)
+++ trunk/sources/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj	(revision 514)
@@ -62,4 +62,6 @@
       <SubType>UserControl</SubType>
     </Compile>
+    <Compile Include="ResultTable.cs" />
+    <Compile Include="ResultExporter.cs" />
     <Compile Include="DatabaseOperatorLibrary.cs" />
     <Compile Include="DatabaseOperatorLibraryView.cs">
Index: trunk/sources/HeuristicLab.CEDMA.Core/IResult.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Core/IResult.cs	(revision 513)
+++ trunk/sources/HeuristicLab.CEDMA.Core/IResult.cs	(revision 514)
@@ -29,4 +29,5 @@
 namespace HeuristicLab.CEDMA.Core {
   public interface IResult : IDatabaseItem, IViewable {
+    IItem Item { get; }
     string Summary { get; }
     string Description { get; }
Index: trunk/sources/HeuristicLab.CEDMA.Core/Result.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Core/Result.cs	(revision 513)
+++ trunk/sources/HeuristicLab.CEDMA.Core/Result.cs	(revision 514)
@@ -34,5 +34,14 @@
     public string Summary { get; set; }
     public string Description { get; set; }
-    public IItem Item { get; set; }
+    private IItem item;
+    public IItem Item {
+      get {
+        if(item == null) {
+          byte[] rawData = Database.GetResultRawData(Id);
+          item = (IItem)PersistenceManager.RestoreFromGZip(rawData);
+        }
+        return item;
+      }
+    }
     public Result()
       : base() {
@@ -60,8 +69,4 @@
 
     public IView CreateView() {
-      if(Item == null) {
-        byte[] rawData = Database.GetResultRawData(Id);
-        Item = (IItem)PersistenceManager.RestoreFromGZip(rawData);
-      }
       return Item.CreateView();
     }
Index: trunk/sources/HeuristicLab.CEDMA.Core/ResultExporter.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Core/ResultExporter.cs	(revision 514)
+++ trunk/sources/HeuristicLab.CEDMA.Core/ResultExporter.cs	(revision 514)
@@ -0,0 +1,60 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using System.Xml;
+using HeuristicLab.CEDMA.DB.Interfaces;
+using System.IO;
+
+namespace HeuristicLab.CEDMA.Core {
+  public class ResultExporter {
+    internal void Export(IAgent agent, ResultTable t) {
+      foreach(IResult r in agent.Results) {
+        Export(r, t);
+      }
+      foreach(IAgent a in agent.SubAgents) {
+        Export(a, t);
+      }
+    }
+
+    private void Export(IResult result, ResultTable t) {
+      Export(result.Item, t);
+      foreach(IResult subResult in result.SubResults) {
+        Export(subResult, t);
+      }
+    }
+
+    private void Export(IItem item, ResultTable t) {
+      if(item is IScope) {
+        IScope scope = item as IScope;
+        ResultRow row = new ResultRow();
+        foreach(IVariable variable in scope.Variables) {
+          row.AddAttribute(variable.Name, variable.Value.ToString());
+        }
+        t.AddRow(row);
+      } 
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.CEDMA.Core/ResultTable.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Core/ResultTable.cs	(revision 514)
+++ trunk/sources/HeuristicLab.CEDMA.Core/ResultTable.cs	(revision 514)
@@ -0,0 +1,73 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using System.Xml;
+using HeuristicLab.CEDMA.DB.Interfaces;
+using System.IO;
+
+namespace HeuristicLab.CEDMA.Core {
+  public class ResultRow {
+    private Dictionary<string, string> attributes = new Dictionary<string, string>();
+
+    public void AddAttribute(string name, string value) {
+      attributes[name] = value;
+    }
+
+    public ICollection<string> AttributeNames {
+      get { return attributes.Keys; }
+    }
+
+    public string AttributeValue(string name) {
+      string value = "";
+      attributes.TryGetValue(name, out value);
+      return value;
+    }
+  }
+
+  public class ResultTable {
+
+    private List<ResultRow> rows = new List<ResultRow>();
+    private List<string> allAttributeNames = new List<string>();
+
+    public void AddRow(ResultRow r) {
+      rows.Add(r);
+      foreach(string name in r.AttributeNames) if(!allAttributeNames.Contains(name)) allAttributeNames.Add(name);
+    }
+
+    public void Write(Stream s) {
+      using(StreamWriter w = new StreamWriter(s)) {
+        foreach(string attributeName in allAttributeNames) w.Write(attributeName + ";");
+        w.WriteLine();
+        foreach(ResultRow r in rows) {
+          foreach(string attributeName in allAttributeNames) {
+            w.Write(r.AttributeValue(attributeName) + ";"); // we should probably escape the ';' if it occures in the value
+          }
+          w.WriteLine();
+        }
+      }
+    }
+  }
+}
