<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: FileStream v/s StreamReader and StreamWriter</title>
	<atom:link href="http://jamisonwhite.com/2009/06/18/filestream-vs-streamreader-and-streamwriter/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamisonwhite.com/2009/06/18/filestream-vs-streamreader-and-streamwriter/</link>
	<description>Just another WordPress.com site</description>
	<lastBuildDate>Mon, 18 Oct 2010 12:15:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Ricky</title>
		<link>http://jamisonwhite.com/2009/06/18/filestream-vs-streamreader-and-streamwriter/#comment-13</link>
		<dc:creator><![CDATA[Ricky]]></dc:creator>
		<pubDate>Thu, 18 Jun 2009 20:54:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.jamisonwhite.com/blog/?p=297#comment-13</guid>
		<description><![CDATA[Here&#039;s a little something for ya .. it&#039;ll serialize an object to xml, encrypt it, and save it as a file.

&lt;code&gt;
        public void SaveToFile(string Path)
        {
            byte[] data;

            using (MemoryStream ms = new MemoryStream())
            {
                XmlSerializer serializer = new XmlSerializer(typeof(List));
                serializer.Serialize(ms, this.Soldiers);

                data = ReadByteArrayFromInputStream(ms);
                ms.Close();
            }

            using (FileStream fs = File.Create(Path))
            {
                Aes aes = Aes.Create();
                using (CryptoStream cs = new CryptoStream(
                    fs,
                    aes.CreateEncryptor(GetKey(), GetIV()),
                    CryptoStreamMode.Write))
                {
                    cs.Write(data, 0, data.Length);

                    cs.Close();
                }
                fs.Close();
            }
        }
&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Here&#8217;s a little something for ya .. it&#8217;ll serialize an object to xml, encrypt it, and save it as a file.</p>
<p><code><br />
        public void SaveToFile(string Path)<br />
        {<br />
            byte[] data;</p>
<p>            using (MemoryStream ms = new MemoryStream())<br />
            {<br />
                XmlSerializer serializer = new XmlSerializer(typeof(List));<br />
                serializer.Serialize(ms, this.Soldiers);</p>
<p>                data = ReadByteArrayFromInputStream(ms);<br />
                ms.Close();<br />
            }</p>
<p>            using (FileStream fs = File.Create(Path))<br />
            {<br />
                Aes aes = Aes.Create();<br />
                using (CryptoStream cs = new CryptoStream(<br />
                    fs,<br />
                    aes.CreateEncryptor(GetKey(), GetIV()),<br />
                    CryptoStreamMode.Write))<br />
                {<br />
                    cs.Write(data, 0, data.Length);</p>
<p>                    cs.Close();<br />
                }<br />
                fs.Close();<br />
            }<br />
        }<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

