view api/Factories/Xml/Zip/StringZipEntrySource.cs @ 105:f5aec697b8ea

Re #53: Make WarFoundry XML saver * Make XMLSaver implement Saver interface * Strip out old code * Start to code converting of objects to XML files * Add class to store strings in to Zip files
author IBBoard <dev@ibboard.co.uk>
date Mon, 17 Aug 2009 19:08:44 +0000
parents
children b04512847424
line wrap: on
line source

//  This file (StringZipEntrySource.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard
// 
//  The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
// 

using System;
using System.IO;
using IBBoard.Lang;
using ICSharpCode.SharpZipLib.Zip;

namespace IBBoard.WarFoundry.API.Factories.Xml.Zip
{
	/// <summary>
	/// A simple implementation of IStaticDataSource that lets us add a string directly to a Zip file
	/// </summary>
	public class StringZipEntrySource : IStaticDataSource
	{
		private byte[] entryContent;
		
		public StringZipEntrySource(String content)
		{
			entryContent = StringManipulation.StringToBytes(content);
		}

		public Stream GetSource()
		{
			return new MemoryStream(entryContent);
		}
	}
}