<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>All Things IT Blog &#187; Example</title>
	<atom:link href="http://www.enusbaum.com/blog/tag/example/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.enusbaum.com/blog</link>
	<description>My little nerded out corner of the Internets!</description>
	<lastBuildDate>Tue, 18 Oct 2011 20:22:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Embedded Resources in C#</title>
		<link>http://www.enusbaum.com/blog/2007/01/embedded-resources-in-c/</link>
		<comments>http://www.enusbaum.com/blog/2007/01/embedded-resources-in-c/#comments</comments>
		<pubDate>Fri, 19 Jan 2007 18:50:39 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[C# Programming]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C# Assembly]]></category>
		<category><![CDATA[Embedded Resources]]></category>
		<category><![CDATA[Example]]></category>

		<guid isPermaLink="false">http://www.enusbaum.com/blog/?p=3</guid>
		<description><![CDATA[So last night I was trying to think of the best way to compile images into the WWWinamp EXE. One way I had considered was converting the images into a byte[] and then just putting this into the source code. The images I was working with were only about 200 bytes long, so this could [...]]]></description>
			<content:encoded><![CDATA[<p>So last night I was trying to think of the best way to compile images into the WWWinamp EXE.</p>
<p>One way I had considered was converting the images into a byte[] and then just putting this into the source code. The images I was working with were only about 200 bytes long, so this could be do-able.</p>
<p>Upon further investigation I came across <a href="http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=75">this</a> tutorial over at DevHood.com. It seemed a better idea to just roll with Embedded Resources in the EXE, since it would give me a few more options in the long run.</p>
<p>Below is the code I used to retrieve an embedded resource. You pass in the file name of the resource you want, and it&#8217;ll return a byte[] with the content:</p>
<p>[csharp]</p>
<p>public byte[] Server_ReadEmbeddedResource(string sFileName)<br />
{<br />
Assembly asResources = Assembly.GetExecutingAssembly(); //Referrence to the current assembly<br />
string[] sResNames = asResources.GetManifestResourceNames(); //Store list of resources for the current assembly in an array</p>
<p>foreach (string sResourceName in sResNames)<br />
{<br />
if(sResourceName.EndsWith(sFileName))<br />
{<br />
BinaryReader oBR = new BinaryReader(asResources.GetManifestResourceStream(sResourceName));<br />
return oBR.ReadBytes((int)asResources.GetManifestResourceStream(sResourceName).Length);<br />
}<br />
}<br />
return new byte[] { 0 };<br />
}</p>
<p>[/csharp]</p>
<div class="su-linkbox" id="post-3-linkbox"><div class="su-linkbox-label">Link to this post!</div><div class="su-linkbox-field"><input type="text" value="&lt;a href=&quot;http://www.enusbaum.com/blog/2007/01/embedded-resources-in-c/&quot;&gt;Embedded Resources in C#&lt;/a&gt;" onclick="javascript:this.select()" readonly="readonly" style="width: 100%;" /></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.enusbaum.com/blog/2007/01/embedded-resources-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

