<?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>Harry Finocchiaro &#187; Geek Tips</title>
	<atom:link href="http://blog.harryfino.com/category/geek-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.harryfino.com</link>
	<description>&#34;It&#039;s not even that big of a deal. Something like 8% of kids do it, but whatever&#34;</description>
	<lastBuildDate>Wed, 14 Jul 2010 06:12:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Problems with a jailbroken iOS 4 – Part 1</title>
		<link>http://blog.harryfino.com/2010/06/28/problems-with-a-jailbroken-ios-4-part-1/</link>
		<comments>http://blog.harryfino.com/2010/06/28/problems-with-a-jailbroken-ios-4-part-1/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 12:08:05 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[Geek Tips]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iOS4]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[jailbreak]]></category>
		<category><![CDATA[No Sender]]></category>
		<category><![CDATA[No Subject]]></category>

		<guid isPermaLink="false">http://blog.harryfino.com/?p=476</guid>
		<description><![CDATA[One of the first things that caught my eye about iOS 4 was the unified inbox. I know that I could have had 2 instances of exchange before, but I didn&#8217;t like the fact that I needed to manually change files on the iPhone. With this in mind, I went forward and upgraded to iOS [...]]]></description>
			<content:encoded><![CDATA[<p>One of the first things that caught my eye about iOS 4 was the unified inbox. I know that I could have had 2 instances of exchange before, but I didn&#8217;t like the fact that I needed to manually change files on the iPhone. With this in mind, I went forward and upgraded to iOS 4.</p>
<p>Unified inbox worked right of the bat. It wasn&#8217;t until later in the day that I started having issues. I would receive email and it would show &#8220;(No Sender)&#8221; as the From email, and &#8220;(No Subject)&#8221; in the subject line. I read online a couple places that said a quick reset of the phone should clear it up, so I gave that a try. It worked! All of my emails were back to having a sender and a subject. But&#8230; it came back as soon as I got a new email.</p>
<p>Since none of my other friends were having this issue, I postulated that this issue must be caused by some jailbreak app. My first choice to uninstall was LockInfo, which is an awesome app that displays email and other information in an easily readable list on your lock screen. Well my first guess was a good guess, it fixed the issues. Turns out that LockInfo will function on iOS 4, but it is certainly not bug free on iOS 4. I suppose I should have read about it before installing.</p>
<p>In any case, that was the solution and now I wait until the issue is fixed before I reinstall. I could not find a lick of this on the interwebs, so I hope that I&#8217;ve helped someone find an answer to this annoying issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2010/06/28/problems-with-a-jailbroken-ios-4-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To: jailbreak your iPhone 3GS to iOS 4 with Pwnage Tool 4.0</title>
		<link>http://justanotheriphoneblog.com/wordpress/iphone-tips/jailbreaking-your-iphone-3gs-to-ios-4-with-pwnage-tool-4-0/</link>
		<comments>http://justanotheriphoneblog.com/wordpress/iphone-tips/jailbreaking-your-iphone-3gs-to-ios-4-with-pwnage-tool-4-0/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 20:29:05 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Geek Tips]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[
[Update: I have now also used PwnageTool 4.01 to fix iBooks (which just didn't work properly if you used PwnageTool 4.0 to jailbreak) and have added my instructions near the bottom of the post.]
Early yesterday morning MacStories released an excellent...]]></description>
			<content:encoded><![CDATA[<p></p><p style="text-align:center"><a href="http://justanotheriphoneblog.com/wordpress/wp-content/uploads/2010/06/jaib-jailbreak-guide-for-ios-4.jpg" title="jaib jailbreak guide for ios 4" rel="lightbox[18487]"><img title="jaib jailbreak guide for ios 4" src="http://justanotheriphoneblog.com/wordpress/wp-content/uploads/2010/06/jaib-jailbreak-guide-for-ios-4.jpg" alt="" width="256" height="384"></a></p>
<p>[<strong>Update:</strong> I have now also used PwnageTool 4.01 to fix iBooks (which just didn't work properly if you used PwnageTool 4.0 to jailbreak) and have added my instructions near the bottom of the post.]</p>
<p>Early yesterday morning MacStories released an <a href="http://www.macstories.net/tutorials/jailbreak-ios-4-iphone-3gs-and-install-your-first-cydia-apps-with-compatibility-list/">excellent preliminary jailbreak guide</a> which used a modified version of PwnageTool to jailbreak iOS 4. It was very useful, but it used quite a few terms I didn’t quite understand, so I decided to try my hand at a different iOS 4 jailbreak guide.</p>
<p>I started this whole process off on the official iOS 4 release on my iPhone 3GS and although I am going to outline all the steps I took after the jump. Here are the necessary links and info for the guide (make sure to unzip files the files to your desktop or a special folder so you have everything in one place):</p>
<ul>
<li>a Mac — that’s what I used, and PwnageTool is Mac-only for now</li>
<li>SHSH blobs for 3.1.2 on Cydia servers to downgrade your firmware</li>
<li>iOS <a href="http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7270.20091008.phn32/iPhone2,1_3.1.2_7D11_Restore.ipsw">3.1.2 </a>and <a href="http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone4/061-7437.20100621.5urG8/iPhone2,1_4.0_8A293_Restore.ipsw">4.0</a> .ipsw files for iPhone 3GS</li>
<li><a href="http://redsn0w.com/">RedSn0w</a> 0.9.4 to help you jailbreak 3.1.2 (Spirit won’t work for this)</li>
<li><a href="http://blog.iphone-dev.org/post/726179754/foursome-news#idc-cover">PwnageTool 4.0</a>1 to help you create a custom jailbroken 4.0 .ipsw (firmware restore file)</li>
<li>an iPhone 3GS with the “old” bootrom (iBoot: 359.3)</li>
<li><a href="http://www.ihackintosh.com/2009/07/irecovery-iphone-recovery-mode-loop-restart/">iRecovery</a> to help you downgrade to 3.1.2</li>
</ul>
<p>If any of those terms confuse you, don’t worry. I’ve tried to explain and provide links to the guides I used after the jump. This is not a carrier unlock guide, but you should be alright if you need one, now that ultrasn0w 0.93 has been updated for every baseband from iOS 3.0 to iOS 4.0.</p>
<p>(...)<br>Read the rest of <a href="http://justanotheriphoneblog.com/wordpress/iphone-tips/jailbreaking-your-iphone-3gs-to-ios-4-with-pwnage-tool-4-0/">How To: jailbreak your iPhone 3GS to iOS 4 with Pwnage Tool 4.0</a> </p>
<hr>

<p><small>© Ragart for <a href="http://justanotheriphoneblog.com/wordpress">Just Another iPhone Blog</a>, 2010. |
<a href="http://justanotheriphoneblog.com/wordpress/iphone-tips/jailbreaking-your-iphone-3gs-to-ios-4-with-pwnage-tool-4-0/">Permalink</a> |
|
Add to
<a href="http://del.icio.us/post?url=http://justanotheriphoneblog.com/wordpress/iphone-tips/jailbreaking-your-iphone-3gs-to-ios-4-with-pwnage-tool-4-0/%20&amp;title=How%20To:%20jailbreak%20your%20iPhone%203GS%20to%20iOS%204%20with%20Pwnage%20Tool%204.0">del.icio.us</a>
<br>
Post tags: <a href="http://justanotheriphoneblog.com/wordpress/tag/iphone-jailbreak-guide" rel="tag">iphone jailbreak guide</a>, <a href="http://justanotheriphoneblog.com/wordpress/tag/jailbreak-ios-4" rel="tag">jailbreak iOS 4</a><br>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/PSSuN3HvYe1LAE9wdQSvDO8HDWQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/PSSuN3HvYe1LAE9wdQSvDO8HDWQ/0/di" border="0" ismap></a><br>
<a href="http://feedads.g.doubleclick.net/~a/PSSuN3HvYe1LAE9wdQSvDO8HDWQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/PSSuN3HvYe1LAE9wdQSvDO8HDWQ/1/di" border="0" ismap></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2010/06/23/how-to-jailbreak-your-iphone-3gs-to-ios-4-with-pwnage-tool-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://justanotheriphoneblog.com/wordpress/wp-content/uploads/2010/06/jaib-jailbreak-guide-for-ios-4.jpg" length="" type="" />
		</item>
		<item>
		<title>Reusing Those Old iPhones!</title>
		<link>http://blog.harryfino.com/2009/12/28/reusing-those-old-iphones/</link>
		<comments>http://blog.harryfino.com/2009/12/28/reusing-those-old-iphones/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 20:12:35 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[Geek Tips]]></category>

		<guid isPermaLink="false">http://blog.harryfino.com/?p=353</guid>
		<description><![CDATA[Anyone who has the original iPhone will probably tell you that it&#8217;s sitting somewhere on their desk being used as a paper weight. After all, if it doesn&#8217;t have a SIM card it&#8217;s pretty much useless, right? Every time you turn it on you get that annoying SIM card message. And when you plug it [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone who has the original iPhone will probably tell you that it&#8217;s sitting somewhere on their desk being used as a paper weight. After all, if it doesn&#8217;t have a SIM card it&#8217;s pretty much useless, right? Every time you turn it on you get that annoying SIM card message. And when you plug it into iTunes you get the same damn message. </p>
<div style="text-align:center"><img src="http://blog.harryfino.com/wp-content/uploads/2009/12/iphonesim1-300x232.jpg" alt="" title="iPhoneSimCard" width="300" height="232" class="size-medium wp-image-356" /></div>
<p>That is exactly what was happening with a colleague of mine. His old 2G was sitting around taking up space. Why did I care? Why would I want that paper weight!? I&#8217;ll tell you&#8230;</p>
<p>I transformed his old iPhone into a nice wireless device for my fiancée to use. Not only that, but because I set it up using my iTunes account, I was able to download all of my paid apps onto it. I no longer have to let her use my iPhone (my precious, precious iPhone) in order to check the weather or look at LOLCats. It&#8217;s a win-win situation, imo. <img src='http://blog.harryfino.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>So here&#8217;s how to do it:</p>
<p><span id="more-353"></span></p>
<p>
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4029854049688172";
/* 468x60, created 9/6/09 */
google_ad_slot = "3443745643";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</p>
<p>The process is rather simple.</p>
<p><em>Steps 1 &#8211; 2 involve updating the 2G to the latest firmware. If your 2G is already on OS 3.1.2 then just skip ahead.</em></p>
<p><strong>Step 1</strong> &#8211; Power off the phone. Wait 5 seconds, then plug it in while holding the HOME button. Continue holding the HOME button until you see the &#8220;Connect to iTunes&#8221; image.</p>
<p>Your computer will recognize that you connected an iPhone in recovery mode and it may even load iTunes for you.</p>
<p><strong>Step 2</strong> &#8211; In iTunes, recover your iPhone by checking for updates. CAUTION: This will remove everything from the phone, so make sure you back it up first. When it&#8217;s finished updating, it may try to sync your phone. That&#8217;s up to you whether you let it or not.</p>
<p><strong>Step 3</strong> &#8211; Keep your iPhone plugged in, close iTunes, and download a piece of software called <a href="http://www.blackra1n.com/">Blackra1n</a>.</p>
<p><strong>Step 4</strong> &#8211; Run blackra1n.exe, and click the &#8220;make it ra1n&#8221; button.</p>
<p><strong>Step 5</strong> &#8211; Wait until it says it&#8217;s finished. You should now be able to use your iPhone with wireless. You&#8217;ll also have a &#8220;Blackra1n&#8221; app on your phone. That means that you can access Cydia, if you want. But thats another article.</p>
<p>This worked very smoothly for me. Leave a comment if you have any issues and I&#8217;ll help you get it settled.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2009/12/28/reusing-those-old-iphones/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Protip: Screenshots on the iPhone</title>
		<link>http://blog.harryfino.com/2009/12/16/protip-screenshots-on-the-iphone/</link>
		<comments>http://blog.harryfino.com/2009/12/16/protip-screenshots-on-the-iphone/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 16:11:11 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[Geek Tips]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[screenshot]]></category>

		<guid isPermaLink="false">http://blog.harryfino.com/?p=334</guid>
		<description><![CDATA[If you&#8217;ve ever wanted to share that glorious moment of beating a game, or crushing your friends&#8217; high score, or show a friend a new app you downloaded without having them buy it first, then maybe you&#8217;ve needed to take a screenshot on your iPhone. Below is an example of a screenshot of my home [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever wanted to share that glorious moment of beating a game, or crushing your friends&#8217; high score, or show a friend a new app you downloaded without having them buy it first, then maybe you&#8217;ve needed to take a <strong>screenshot on your iPhone</strong>.</p>
<p><span id="more-334"></span></p>
<p>
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4029854049688172";
/* 468x60, created 9/6/09 */
google_ad_slot = "3443745643";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</p>
<p>Below is an example of a screenshot of my home page:</p>
<div style="text-align: center">
<a href="http://blog.harryfino.com/wp-content/uploads/2009/12/photo.jpg"><img class="size-thumbnail wp-image-335" title="iPhone Screenshot" src="http://blog.harryfino.com/wp-content/uploads/2009/12/photo-150x150.jpg" alt="iPhone Screenshot" width="150" height="150" /></a>
</div>
<p><br/></p>
<p>So you&#8217;re probably asking yourself, well how do I take a damn screenshot already!? Simple, just press the home button and the lock button at the same time (just press and release, no holding) anywhere you want and the image will show up in your camera roll.</p>
<p>I&#8217;ve only tested this on my 3Gs (OS 3.1.2), so I have no idea if it works on the other versions. Let me know if you&#8217;ve tested it on others and I&#8217;ll update my post.</p>
<p>Link your favorite screenshot in the comments below!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2009/12/16/protip-screenshots-on-the-iphone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using GMail on the iPhone</title>
		<link>http://blog.harryfino.com/2009/09/24/using-gmail-on-the-iphone/</link>
		<comments>http://blog.harryfino.com/2009/09/24/using-gmail-on-the-iphone/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 13:05:39 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[Geek Gadgets]]></category>
		<category><![CDATA[Geek Tips]]></category>
		<category><![CDATA[GMail]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Push]]></category>

		<guid isPermaLink="false">http://blog.harryfino.com/?p=297</guid>
		<description><![CDATA[If you&#8217;ve read my previous article on setting up GMail on the iPhone, you are now using GMail with Google Sync. However, you might not be aware that Google Sync handles your actions on the iPhone differently than might be expected. For instance, clicking the trash button doesn&#8217;t mean that the email is getting deleted. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-286" style="padding-right:10px;padding-bottom:10px;" title="GMail" src="http://blog.harryfino.com/wp-content/uploads/2009/09/imgres.jpg" alt="GMail" width="117" height="117" />If you&#8217;ve read my <a href="http://blog.harryfino.com/2009/09/22/gmail-officially-on-the-iphone-with-push/">previous article on setting up GMail on the iPhone</a>, you are now using GMail with Google Sync. However, you might not be aware that Google Sync handles your actions on the iPhone differently than might be expected. For instance, clicking the trash button doesn&#8217;t mean that the email is getting deleted. So take a few minutes and get acquainted with what&#8217;s really happening with your email. I have provided a couple of important tips below, as well as a link to the site explaining it all.</p>
<p><span id="more-297"></span></p>
<div style="text-align:center">
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4029854049688172";
/* 468x60, created 9/6/09 */
google_ad_slot = "3443745643";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</div>
<p>For a full list of what iPhone actions do on your GMail, check <a href="http://www.google.com/support/mobile/bin/answer.py?hl=en&amp;answer=161771">the Google Mobile help page</a>. Here are some important ones that I wanted to highlight:</p>
<ul>
<li>Opening an email on the iPhone will mark it as read on the web</li>
<li>Trashing an email on the iPhone will archive it on the web</li>
<li>Moving an email to the Trash folder will move it to the Trash on the web as well</li>
<li>Delete a message from the Trash folder to delete it permanently from the web</li>
</ul>
<p><strong>Protip:</strong> Note the section at the bottom of the Google Mobile help page that states that you cannot search for messages that have not been synced to your iPhone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2009/09/24/using-gmail-on-the-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Extension Methods/Indexers in .Net 3.5</title>
		<link>http://blog.harryfino.com/2009/09/11/using-extension-methods-in-net-3-5/</link>
		<comments>http://blog.harryfino.com/2009/09/11/using-extension-methods-in-net-3-5/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 00:20:04 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[Geek Tips]]></category>
		<category><![CDATA[awesome]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[extensions]]></category>

		<guid isPermaLink="false">http://blog.harryfino.com/?p=210</guid>
		<description><![CDATA[If you&#8217;re not familiar with extension methods in C#, you should probably read http://msdn.microsoft.com/en-us/library/bb383977.aspx. Long story short, they are a special type of static method that can appear to be an instance method while you&#8217;re coding. Normally, if you were to create a special method that performs an operation on a string, you would do [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re not familiar with extension methods in C#, you should probably read <a href="http://msdn.microsoft.com/en-us/library/bb383977.aspx">http://msdn.microsoft.com/en-us/library/bb383977.aspx</a>.</p>
<p>Long story short, they are a special type of static method that can appear to be an instance method while you&#8217;re coding. Normally, if you were to create a special method that performs an operation on a string, you would do something like this:</p>
<p><span id="more-210"></span></p>
<p>
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4029854049688172";
/* 468x60, created 9/6/09 */
google_ad_slot = "3443745643";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> StripDuplicateNumbers<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span> seriesOfNumbers <span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #FF0000;">char</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> numbers <span style="color: #008000;">=</span> seriesOfNumbers.<span style="color: #0000FF;">ToCharArray</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
	StringBuilder str <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StringBuilder<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #FF0000;">object</span> exists <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #FF0000;">object</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
	Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">char</span>, <span style="color: #FF0000;">object</span><span style="color: #008000;">&gt;</span> knownNumbers <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">char</span>,<span style="color: #FF0000;">object</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
	<span style="color: #FF0000;">int</span> length <span style="color: #008000;">=</span> numbers.<span style="color: #0000FF;">length</span><span style="color: #008000;">;</span>
&nbsp;
	<span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> length<span style="color: #008000;">;</span> i<span style="color: #008000;">++</span> <span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #FF0000;">char</span> number <span style="color: #008000;">=</span> numbers<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
		<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span>knownNumbers.<span style="color: #0000FF;">ContainsKey</span><span style="color: #000000;">&#40;</span> number <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			knownNumbers.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span> number, exists <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			str.<span style="color: #0000FF;">Append</span><span style="color: #000000;">&#40;</span> number <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">return</span> str.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>And you would call this method something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">string</span> numbers <span style="color: #008000;">=</span> StripDuplicateNumbers<span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;1234545366323&quot;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>When you convert this to an extension, the definition would change to look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> StripDuplicateNumbers<span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">this</span> <span style="color: #FF0000;">string</span> seriesOfNumbers <span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
...
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>And now you would call it like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">string</span> numbers <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;1432545326543&quot;</span><span style="color: #008000;">;</span>
numbers <span style="color: #008000;">=</span> numbers.<span style="color: #0000FF;">StripDuplicateNumbers</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Now this might not look great from the example, but it can being extremely useful in cleaning up your code and extending the functionality. Similarly, you can use <a href="http://msdn.microsoft.com/en-us/library/6x16t2tx.aspx">indexers</a> for accessing members of a class. For instance, if you create a class that has different collections in it, you may want to use the array-type indexers to load different things:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">class</span> MyClass
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">private</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span>, <span style="color: #FF0000;">int</span><span style="color: #008000;">&gt;</span> _strings <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span>, <span style="color: #FF0000;">int</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #0600FF;">private</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">int</span>, <span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span> _numbers <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">int</span>, <span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> <span style="color: #0600FF;">this</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">string</span> s<span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#123;</span>
		get
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0600FF;">return</span> _strings<span style="color: #000000;">&#91;</span>s<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
		set
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #008000;">!</span>_strings.<span style="color: #0000FF;">ContainsKey</span><span style="color: #000000;">&#40;</span>s<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
				_strings.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>s, value<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #0600FF;">else</span>
				_strings<span style="color: #000000;">&#91;</span>s<span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> <span style="color: #0600FF;">this</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">int</span> i<span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#123;</span>
		get
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0600FF;">return</span> _numbers<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
		set
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #008000;">!</span>_numbers.<span style="color: #0000FF;">ContainsKey</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
				_numbers.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>i, value<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #0600FF;">else</span>
				_numbers<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>And you could use it like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">MyClass m <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MyClass<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
m<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;hi&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">4</span><span style="color: #008000;">;</span>
m<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">4</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;something else&quot;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Although my examples aren&#8217;t the greatest, these features increase readability/usability of your code. If you didn&#8217;t know about them already, I hope you&#8217;re able to get some use out of these.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2009/09/11/using-extension-methods-in-net-3-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The elusive SSL POP3 client in C#</title>
		<link>http://blog.harryfino.com/2009/07/23/the-elusive-ssl-pop3-client-in-c/</link>
		<comments>http://blog.harryfino.com/2009/07/23/the-elusive-ssl-pop3-client-in-c/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 15:42:51 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[Geek Tips]]></category>
		<category><![CDATA[POP3]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://blog.harryfino.com/?p=75</guid>
		<description><![CDATA[When writing the code for my GMailPush application, I searched high and low for a C# managed POP3 client hidden in the framework somewhere. After all, C# has a managed SMTP client&#8230; so why not POP3? In my research, I found several examples of what people were doing, but nothing was already in the framework. [...]]]></description>
			<content:encoded><![CDATA[<p>When writing the code for my GMailPush application, I searched high and low for a C# managed POP3 client hidden in the framework somewhere. After all, C# has a managed SMTP client&#8230; so why not POP3?</p>
<p>
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4029854049688172";
/* 468x60, created 9/6/09 */
google_ad_slot = "3443745643";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</p>
<p>In my research, I found several examples of what people were doing, but nothing was already in the framework. The examples I saw were informative, but most of them were too bloated and felt &#8220;dirty&#8221; to me. And so I sought out to create my own using the knowledge that I gained. </p>
<p>Without further adieu, I present my SslPopClient class:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Net.Sockets</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Net.Security</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Security.Cryptography.X509Certificates</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">namespace</span> GMailPush
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> SslPopClient
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Stores the host and port we'll use to connect to</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;host&quot;&gt;The hostname of the pop server&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;port&quot;&gt;The port the pop server listens on&lt;/param&gt;</span>
		<span style="color: #0600FF;">public</span> SslPopClient<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span> host, <span style="color: #FF0000;">int</span> port <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Store the connection information for when the user logs in (see Login())</span>
			_host <span style="color: #008000;">=</span> host<span style="color: #008000;">;</span>
			_port <span style="color: #008000;">=</span> port<span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Deconstructor to clean up the client connection</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		~SslPopClient<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Try to clean up the connection before closing</span>
			<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Disconnect</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Logs into the pop server using the USER and PASS commands</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;username&quot;&gt;The username to connect to the server&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;password&quot;&gt;The password to connect to the server&lt;/param&gt;</span>
		<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> Login<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span> username, <span style="color: #FF0000;">string</span> password <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Create a new socket and ssl stream</span>
			_client <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TcpClient<span style="color: #000000;">&#40;</span> _host, _port <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			_sslStream <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SslStream<span style="color: #000000;">&#40;</span> _client.<span style="color: #0000FF;">GetStream</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #0600FF;">false</span>, <span style="color: #008000;">new</span> RemoteCertificateValidationCallback<span style="color: #000000;">&#40;</span> ValidateServerCertificate <span style="color: #000000;">&#41;</span>, <span style="color: #008000;">new</span> LocalCertificateSelectionCallback<span style="color: #000000;">&#40;</span> SelectLocalCertificate <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Authenticate over the ssl stream</span>
			_sslStream.<span style="color: #0000FF;">AuthenticateAsClient</span><span style="color: #000000;">&#40;</span> _host <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Initialize our reader and writer with the ssl stream</span>
			_reader <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StreamReader<span style="color: #000000;">&#40;</span> _sslStream <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			_writer <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StreamWriter<span style="color: #000000;">&#40;</span> _sslStream <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			_writer.<span style="color: #0000FF;">AutoFlush</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Check to see whether our connection was successful</span>
			<span style="color: #FF0000;">string</span> response <span style="color: #008000;">=</span> _reader.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span>response.<span style="color: #0000FF;">StartsWith</span><span style="color: #000000;">&#40;</span> _success <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">throw</span> <span style="color: #008000;">new</span> Exception<span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;Server responded with error&quot;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// If we got her, we're connected!</span>
			<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Connected</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Now we try to authenticate with USER and PASS</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">User</span><span style="color: #000000;">&#40;</span> username <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">throw</span> <span style="color: #008000;">new</span> Exception<span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;Username not accepted&quot;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Pass</span><span style="color: #000000;">&#40;</span> password <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">throw</span> <span style="color: #008000;">new</span> Exception<span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;Password not accepted&quot;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Safely disconnects from the pop server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> Disconnect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Connected</span> <span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #008080; font-style: italic;">// Gracefully exit the pop3 server</span>
				<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Quit</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
				<span style="color: #008080; font-style: italic;">// Turn the connected flag off so we can't perform anything else</span>
				<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Connected</span> <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
&nbsp;
				<span style="color: #008080; font-style: italic;">// Clean up our reader and writer</span>
				_reader.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
				_reader.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
				_writer.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
				_writer.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
				_sslStream.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
				_sslStream.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
				<span style="color: #008080; font-style: italic;">// Clean up our socket</span>
				_client.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
				_client <span style="color: #008000;">=</span> null<span style="color: #008000;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Sends the USER command to the pop server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;username&quot;&gt;The username to connect to the server&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;True for success, false for failure&lt;/returns&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">bool</span> User<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span> username <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Don't continue if we're not connected to the server</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Connected</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Return the results of the USER command</span>
			<span style="color: #0600FF;">return</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SendCommand</span><span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;USER {0}&quot;</span>, username <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Sends the PASS command to the pop server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;password&quot;&gt;The password used to connect to the server&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;True for success, false for failure&lt;/returns&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">bool</span> Pass<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span> password <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Don't continue if we're not connected to the server</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Connected</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Return the results of the PASS command</span>
			<span style="color: #0600FF;">return</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SendCommand</span><span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;PASS {0}&quot;</span>, password <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Sends the QUIT command to the pop server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;True for success, false for failure&lt;/returns&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">bool</span> Quit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Don't continue if we're not connected to the server</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Connected</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Just send the QUIT command by itself</span>
			<span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SendCommand</span><span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;QUIT&quot;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Sends the STAT command on the pop server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;messageCount&quot;&gt;An output variable that contains the number of messages&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;messageSize&quot;&gt;An output variable that contains the size of the messages&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;True for success, false for failure&lt;/returns&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">bool</span> Stat<span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">out</span> <span style="color: #FF0000;">int</span> messageCount, <span style="color: #0600FF;">out</span> <span style="color: #FF0000;">int</span> messageSize <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Initialize our output variables</span>
			messageCount <span style="color: #008000;">=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
			messageSize <span style="color: #008000;">=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Don't continue if we're not connected to the server</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Connected</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Send the STAT command</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SendCommand</span><span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;STAT&quot;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Get the response parameters (there should be 2)</span>
			<span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> responseRarameters <span style="color: #008000;">=</span> _lastResponse.<span style="color: #0000FF;">Split</span><span style="color: #000000;">&#40;</span> <span style="color: #666666;">' '</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> responseRarameters.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">!=</span> <span style="color: #FF0000;">3</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Save the response values to our output variables</span>
			<span style="color: #FF0000;">string</span> firstParameter <span style="color: #008000;">=</span> responseRarameters<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
			<span style="color: #FF0000;">string</span> secondParameter <span style="color: #008000;">=</span> responseRarameters<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
			<span style="color: #FF0000;">int</span>.<span style="color: #0000FF;">TryParse</span><span style="color: #000000;">&#40;</span> firstParameter, <span style="color: #0600FF;">out</span> messageCount <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #FF0000;">int</span>.<span style="color: #0000FF;">TryParse</span><span style="color: #000000;">&#40;</span> secondParameter, <span style="color: #0600FF;">out</span> messageSize <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// If we got this far, success!</span>
			<span style="color: #0600FF;">return</span> true<span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Sends the TOP command to the pop server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;messageId&quot;&gt;The message to call TOP for&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;numLines&quot;&gt;The number of lines to receive&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;header&quot;&gt;An output variable containing the headers&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;lines&quot;&gt;An output variable containing the lines retrieved&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;True for success, false for failure&lt;/returns&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">bool</span> Top<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">int</span> messageId, <span style="color: #FF0000;">int</span> numLines, <span style="color: #0600FF;">out</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span> header, <span style="color: #0600FF;">out</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span> lines <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Initialize our output variables</span>
			header <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			lines <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Don't continue if we're not connected to a server</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Connected</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Send the TOP command</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #008000;">!</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SendCommand</span><span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;TOP {0} {1}&quot;</span>, messageId, numLines <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Read the received data until the terminating character &quot;.&quot;</span>
			<span style="color: #FF0000;">string</span> response <span style="color: #008000;">=</span> _reader.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #0600FF;">while</span> <span style="color: #000000;">&#40;</span> response <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;.&quot;</span> <span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #008080; font-style: italic;">// Add each header to the output variable</span>
				header.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span> response <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
				response <span style="color: #008000;">=</span> _reader.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Add all the remaining lines to the output variable</span>
			<span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> numLines<span style="color: #008000;">;</span> i<span style="color: #008000;">++</span> <span style="color: #000000;">&#41;</span>
				lines.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span> _reader.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// If we got this far, success!</span>
			<span style="color: #0600FF;">return</span> true<span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Sends a command to the pop server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;command&quot;&gt;The command to send to the server&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;commandParams&quot;&gt;Any parameters used in the command string&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;True for success, false for failure&lt;/returns&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">bool</span> SendCommand<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span> command, <span style="color: #0600FF;">params</span> <span style="color: #FF0000;">object</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> commandParams <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> _writer <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span> <span style="color: #008000;">||</span> _reader <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Send the command over the ssl stream to the server</span>
			_writer.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span> command, commandParams <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Read in the last response</span>
			_lastResponse <span style="color: #008000;">=</span> _reader.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> _lastResponse <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// See whether it was a success message or not</span>
			<span style="color: #0600FF;">return</span> _lastResponse.<span style="color: #0000FF;">StartsWith</span><span style="color: #000000;">&#40;</span> _success <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Validates the certificates from the server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Found on the MSDN forums here: </span>
		<span style="color: #008080; font-style: italic;">/// http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/7a674196-1422-4937-90cd-628c6e3ae3d1</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/remarks&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;sender&quot;&gt;&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;certificate&quot;&gt;&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;chain&quot;&gt;&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;sslPolicyErrors&quot;&gt;&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;&lt;/returns&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">bool</span> ValidateServerCertificate<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">object</span> sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Success</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> sslPolicyErrors <span style="color: #008000;">==</span> SslPolicyErrors.<span style="color: #0000FF;">None</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> true<span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Failure</span>
			<span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Selects the appropritate certificate to use</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Found on the MSDN forums here: </span>
		<span style="color: #008080; font-style: italic;">/// http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/7a674196-1422-4937-90cd-628c6e3ae3d1</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/remarks&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;sender&quot;&gt;&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;targetHost&quot;&gt;&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;localCertificates&quot;&gt;&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;remoteCertificate&quot;&gt;&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;acceptableIssuers&quot;&gt;&lt;/param&gt;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;&lt;/returns&gt;</span>
		<span style="color: #0600FF;">private</span> X509Certificate SelectLocalCertificate<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">object</span> sender, <span style="color: #FF0000;">string</span> targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> acceptableIssuers <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-style: italic;">// Check to see if there are any acceptable issuers and local certificates</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> acceptableIssuers <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span> <span style="color: #008000;">&amp;&amp;</span> acceptableIssuers.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">&amp;&amp;</span> localCertificates <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span> <span style="color: #008000;">&amp;&amp;</span> localCertificates.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span> <span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #008080; font-style: italic;">// Loop through the certificates</span>
				<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span> X509Certificate certificate <span style="color: #0600FF;">in</span> localCertificates <span style="color: #000000;">&#41;</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #008080; font-style: italic;">// Check to see if this cert contains an acceptable issuer</span>
					<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> Array.<span style="color: #0000FF;">IndexOf</span><span style="color: #000000;">&#40;</span> acceptableIssuers, certificate.<span style="color: #0000FF;">Issuer</span> <span style="color: #000000;">&#41;</span> <span style="color: #008000;">!=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span> <span style="color: #000000;">&#41;</span>
						<span style="color: #0600FF;">return</span> certificate<span style="color: #008000;">;</span>
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// If there were no acceptable issuers, just return the first certificate found</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> localCertificates <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span> <span style="color: #008000;">&amp;&amp;</span> localCertificates.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span> <span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> localCertificates<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">// Nothing was found</span>
			<span style="color: #0600FF;">return</span> null<span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// A flag to see whether the client is connected to the server or not</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">bool</span> Connected <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// The hostname the client will connect to</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> _host<span style="color: #008000;">;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// The port the client will connect on</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">int</span> _port<span style="color: #008000;">;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// The socket that will handle the transmission to the server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">private</span> TcpClient _client<span style="color: #008000;">;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// A layer to handle SSL communication with the server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">private</span> SslStream _sslStream<span style="color: #008000;">;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Reads data from the SSL stream</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">private</span> StreamReader _reader<span style="color: #008000;">;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// Writes data to the SSL stream</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">private</span> StreamWriter _writer<span style="color: #008000;">;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// A reference to the last response received from the server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> _lastResponse<span style="color: #008000;">;</span>
		<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
		<span style="color: #008080; font-style: italic;">/// A constant that represents the successful response from the pop server</span>
		<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
		<span style="color: #0600FF;">private</span> <span style="color: #0600FF;">const</span> <span style="color: #FF0000;">string</span> _success <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;+OK&quot;</span><span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2009/07/23/the-elusive-ssl-pop3-client-in-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My first Google Code submission</title>
		<link>http://blog.harryfino.com/2009/07/13/my-first-google-code-submission/</link>
		<comments>http://blog.harryfino.com/2009/07/13/my-first-google-code-submission/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 22:06:13 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[Geek Gadgets]]></category>
		<category><![CDATA[Geek Tips]]></category>
		<category><![CDATA[Programming iPhone GMail Push]]></category>

		<guid isPermaLink="false">http://blog.harryfino.com/?p=50</guid>
		<description><![CDATA[I&#8217;m excited to announce my first Google Code submission. It is a desktop application that checks your GMail account for new emails. When it finds some, it sends an sms/email to your AT&#38;T phone number to notify you. This was created because GMail does not offer push notification on the iPhone. Here is the link: http://code.google.com/p/gmailpush/]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m excited to announce my first Google Code submission. It is a desktop application that checks your GMail account for new emails. When it finds some, it sends an sms/email to your AT&amp;T phone number to notify you. This was created because GMail does not offer push notification on the iPhone. Here is the link: <a href="http://code.google.com/p/gmailpush/">http://code.google.com/p/gmailpush/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2009/07/13/my-first-google-code-submission/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virtual Key Constants in C#</title>
		<link>http://blog.harryfino.com/2009/06/11/virtual-key-constants/</link>
		<comments>http://blog.harryfino.com/2009/06/11/virtual-key-constants/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 14:46:50 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[Geek Tips]]></category>

		<guid isPermaLink="false">http://blog.harryfino.com/?p=41</guid>
		<description><![CDATA[I ran into another issue searching for virtual key constants on google. In VB6 you can reference virtual keys by using the vbKey constants (i.e, vbKeyF4, vbKeyShift). I knew there had to be a way to do this in the .Net framework without defining the constants yourself (VK_SHIFT, VK_CAPITAL), I just couldn&#8217;t find it. Luckily, [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into another issue searching for virtual key constants on google. In VB6 you can reference virtual keys by using the vbKey constants (i.e, vbKeyF4, vbKeyShift). I knew there had to be a way to do this in the .Net framework without defining the constants yourself (VK_SHIFT, VK_CAPITAL), I just couldn&#8217;t find it. Luckily, I had a friend who knew the answer to this, because google came up short this time.</p>
<p>In order to reference virtual keys in the framework, use the static object &#8220;Keys&#8221; in the System.Windows.Forms namespace (i.e, System.Windows.Forms.Keys.Capital).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2009/06/11/virtual-key-constants/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The RichTextBox control in C# has issues&#8230;</title>
		<link>http://blog.harryfino.com/2009/06/10/the-richtextbox-control-has-issues/</link>
		<comments>http://blog.harryfino.com/2009/06/10/the-richtextbox-control-has-issues/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 16:49:25 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[Geek Tips]]></category>

		<guid isPermaLink="false">http://blog.harryfino.com/?p=29</guid>
		<description><![CDATA[Since I had such a hard time with this control, I decided to post my findings in the hopes that I can spread the knowledge to other people having the same issues. The task at hand was to replicate a normal multi-lined TextBox control, but be able to add some color to each line of [...]]]></description>
			<content:encoded><![CDATA[<p>Since I had such a hard time with this control, I decided to post my findings in the hopes that I can spread the knowledge to other people having the same issues.</p>
<p>The task at hand was to replicate a normal multi-lined TextBox control, but be able to add some color to each line of text. In a normal TextBox, you can call the AppendText() method and the control will automatically scroll to the bottom for you. Why oh why can&#8217;t the RichTextBox be so easy?</p>
<p>
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-4029854049688172";
/* 468x60, created 9/6/09 */
google_ad_slot = "3443745643";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
</p>
<p>In order to overcome this problem, I created a new class to inherit from RichTextBox. My code looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> MyRichTextBox<span style="color: #008000;">:</span> RichTextBox
<span style="color: #000000;">&#123;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;</span>
	<span style="color: #008080; font-style: italic;">/// This has to inherit from the RichTextBox so we can</span>
	<span style="color: #008080; font-style: italic;">/// override some of the events to properly hide the</span>
	<span style="color: #008080; font-style: italic;">/// caret in the desired way (to only show when selecting text)</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/remarks&gt;</span>
	<span style="color: #0600FF;">public</span> MyRichTextBox<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-style: italic;">// Set the default property values</span>
		<span style="color: #0600FF;">this</span>.<span style="color: #0600FF;">ReadOnly</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
		<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Multiline</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
		<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">BackColor</span> <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Drawing</span></span>.<span style="color: #0000FF;">Color</span>.<span style="color: #0000FF;">White</span><span style="color: #008000;">;</span>
		<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Font</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Drawing</span></span>.<span style="color: #0000FF;">Font</span><span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;Verdana&quot;</span>, <span style="color: #FF0000;">10</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Dock</span> <span style="color: #008000;">=</span> DockStyle.<span style="color: #0000FF;">Fill</span><span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Override the OnTextChanged event to hide the caret</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;e&quot;&gt;&lt;/param&gt;</span>
	<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> OnTextChanged<span style="color: #000000;">&#40;</span> EventArgs e <span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">OnTextChanged</span><span style="color: #000000;">&#40;</span> e <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		HideCaret<span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Handle</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// An override of this event to prevent the window from system beeping</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;e&quot;&gt;&lt;/param&gt;</span>
	<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> OnKeyPress<span style="color: #000000;">&#40;</span> KeyPressEventArgs e <span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-style: italic;">// Do not let anything else try to process this event</span>
		e.<span style="color: #0000FF;">Handled</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Override the OnClick event to hide the caret</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;e&quot;&gt;&lt;/param&gt;</span>
	<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> OnClick<span style="color: #000000;">&#40;</span> EventArgs e <span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">OnClick</span><span style="color: #000000;">&#40;</span> e <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		HideCaret<span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Handle</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Override the OnGotFocus event to hide the caret</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;e&quot;&gt;&lt;/param&gt;</span>
	<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> OnGotFocus<span style="color: #000000;">&#40;</span> EventArgs e <span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">OnGotFocus</span><span style="color: #000000;">&#40;</span>e<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		HideCaret<span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Handle</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Hides the original function that appends text and replaces</span>
	<span style="color: #008080; font-style: italic;">/// it with this version</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;</span>
	<span style="color: #008080; font-style: italic;">/// This makes the AppendText() function more like the</span>
	<span style="color: #008080; font-style: italic;">/// AppendText() function of a TextBox, which scrolls</span>
	<span style="color: #008080; font-style: italic;">/// to the bottom of the text after it appends the new text</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/remarks&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;message&quot;&gt;&lt;/param&gt;</span>
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> AppendText<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">string</span> text, <span style="color: #000000;">System.<span style="color: #0000FF;">Drawing</span></span>.<span style="color: #0000FF;">Color</span> color <span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-style: italic;">// The first text in the textbox can stay on the first line</span>
		<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">!=</span> <span style="color: #FF0000;">0</span> <span style="color: #000000;">&#41;</span>
			<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">AppendText</span><span style="color: #000000;">&#40;</span> Environment.<span style="color: #0000FF;">NewLine</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">// Add our text with the specified color</span>
		<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SelectionColor</span> <span style="color: #008000;">=</span> color<span style="color: #008000;">;</span>
		<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SelectedText</span> <span style="color: #008000;">=</span> text<span style="color: #008000;">;</span>
&nbsp;
		<span style="color: #008080; font-style: italic;">// Now do what we need in order to scroll to the bottom and hide the caret</span>
		<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Select</span><span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">Length</span>, <span style="color: #FF0000;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">ScrollToCaret</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		HideCaret<span style="color: #000000;">&#40;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Handle</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// A DLL import that will help us hide the caret in the RichTextBox</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;hwnd&quot;&gt;&lt;/param&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;&lt;/returns&gt;</span>
	<span style="color: #000000;">&#91;</span>DllImport<span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;user32.dll&quot;</span>, EntryPoint <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;HideCaret&quot;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">extern</span> <span style="color: #FF0000;">bool</span> HideCaret<span style="color: #000000;">&#40;</span> IntPtr hwnd <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.harryfino.com/2009/06/10/the-richtextbox-control-has-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
