changeset 167:9808adf2d566 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 diff
     1.1 --- a/FrmExportXml.cs	Mon Oct 08 19:27:56 2012 +0100
     1.2 +++ b/FrmExportXml.cs	Wed Nov 28 20:25:53 2012 +0000
     1.3 @@ -88,7 +88,10 @@
     1.4  	
     1.5  				if (transformWidget.TransformEnabled)
     1.6  				{
     1.7 -					WarFoundryXmlWithXslExporter.GetDefault().ExportArmyWithTransform(army, fileName, transformWidget.GetXsltPath());
     1.8 +					using (Stream stream = transformWidget.GetXsltStream())
     1.9 +					{
    1.10 +						WarFoundryXmlWithXslExporter.GetDefault().ExportArmyWithTransform(army, fileName, stream);
    1.11 +					}
    1.12  				}
    1.13  				else
    1.14  				{
     2.1 --- a/Widgets/TransformXmlWidget.cs	Mon Oct 08 19:27:56 2012 +0100
     2.2 +++ b/Widgets/TransformXmlWidget.cs	Wed Nov 28 20:25:53 2012 +0000
     2.3 @@ -6,6 +6,8 @@
     2.4  using System.Collections.Generic;
     2.5  using IBBoard.GtkSharp;
     2.6  using IBBoard.GtkSharp.Translatable;
     2.7 +using IBBoard.WarFoundry.API.Exporters;
     2.8 +using IBBoard.IO;
     2.9  
    2.10  namespace IBBoard.WarFoundry.GUI.GTK
    2.11  {
    2.12 @@ -23,14 +25,13 @@
    2.13  
    2.14  		private void FillXsltList()
    2.15  		{
    2.16 -			DirectoryInfo dir = new DirectoryInfo(System.IO.Path.Combine(Constants.ExecutablePath, "xsl"));
    2.17 -			List<FileInfo> files = new List<FileInfo>(dir.GetFiles("*.xsl"));
    2.18 -			ComboBoxUtils.FillCombo(transformList, files, delegate(FileInfo file) { return file.Name; });
    2.19 +			NamedStream[] streams = WarFoundryXmlWithXslExporter.GetDefault().GetXsltStreams();
    2.20 +			ComboBoxUtils.FillCombo(transformList, streams, delegate(NamedStream xslStream) { return xslStream.Name; });
    2.21  		}
    2.22  
    2.23  		public bool IsValid
    2.24  		{
    2.25 -			get { return !doTransformWidget.Active || ComboBoxUtils.GetSelectedItem<FileInfo>(transformList) != null; }
    2.26 +			get { return !doTransformWidget.Active || ComboBoxUtils.GetSelectedItem<Stream>(transformList) != null; }
    2.27  		}
    2.28  
    2.29  		public bool TransformEnabled
    2.30 @@ -38,9 +39,9 @@
    2.31  			get { return doTransformWidget.Active; }
    2.32  		}
    2.33  
    2.34 -		public string GetXsltPath()
    2.35 +		public Stream GetXsltStream()
    2.36  		{
    2.37 -			return ComboBoxUtils.GetSelectedItem<FileInfo>(transformList).FullName;
    2.38 +			return ComboBoxUtils.GetSelectedItem<Stream>(transformList);
    2.39  		}
    2.40  
    2.41  		protected void OnDoTransformWidgetToggled(object sender, System.EventArgs e)