changeset 167:9808adf2d566 default tip

Re #419: Remove assumptions of a file-based install * Update GTK# GUI to use Streams version of XSLT export
author IBBoard <dev@ibboard.co.uk>
date Wed, 28 Nov 2012 20:25:53 +0000
parents ef94bed818e1
children
files FrmExportXml.cs Widgets/TransformXmlWidget.cs
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/FrmExportXml.cs	Mon Oct 08 19:27:56 2012 +0100
+++ b/FrmExportXml.cs	Wed Nov 28 20:25:53 2012 +0000
@@ -88,7 +88,10 @@
 	
 				if (transformWidget.TransformEnabled)
 				{
-					WarFoundryXmlWithXslExporter.GetDefault().ExportArmyWithTransform(army, fileName, transformWidget.GetXsltPath());
+					using (Stream stream = transformWidget.GetXsltStream())
+					{
+						WarFoundryXmlWithXslExporter.GetDefault().ExportArmyWithTransform(army, fileName, stream);
+					}
 				}
 				else
 				{
--- a/Widgets/TransformXmlWidget.cs	Mon Oct 08 19:27:56 2012 +0100
+++ b/Widgets/TransformXmlWidget.cs	Wed Nov 28 20:25:53 2012 +0000
@@ -6,6 +6,8 @@
 using System.Collections.Generic;
 using IBBoard.GtkSharp;
 using IBBoard.GtkSharp.Translatable;
+using IBBoard.WarFoundry.API.Exporters;
+using IBBoard.IO;
 
 namespace IBBoard.WarFoundry.GUI.GTK
 {
@@ -23,14 +25,13 @@
 
 		private void FillXsltList()
 		{
-			DirectoryInfo dir = new DirectoryInfo(System.IO.Path.Combine(Constants.ExecutablePath, "xsl"));
-			List<FileInfo> files = new List<FileInfo>(dir.GetFiles("*.xsl"));
-			ComboBoxUtils.FillCombo(transformList, files, delegate(FileInfo file) { return file.Name; });
+			NamedStream[] streams = WarFoundryXmlWithXslExporter.GetDefault().GetXsltStreams();
+			ComboBoxUtils.FillCombo(transformList, streams, delegate(NamedStream xslStream) { return xslStream.Name; });
 		}
 
 		public bool IsValid
 		{
-			get { return !doTransformWidget.Active || ComboBoxUtils.GetSelectedItem<FileInfo>(transformList) != null; }
+			get { return !doTransformWidget.Active || ComboBoxUtils.GetSelectedItem<Stream>(transformList) != null; }
 		}
 
 		public bool TransformEnabled
@@ -38,9 +39,9 @@
 			get { return doTransformWidget.Active; }
 		}
 
-		public string GetXsltPath()
+		public Stream GetXsltStream()
 		{
-			return ComboBoxUtils.GetSelectedItem<FileInfo>(transformList).FullName;
+			return ComboBoxUtils.GetSelectedItem<Stream>(transformList);
 		}
 
 		protected void OnDoTransformWidgetToggled(object sender, System.EventArgs e)