<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>IT1 Services</title>
	
	<link>http://www.it1services.ca</link>
	<description>All Things IT</description>
	<lastBuildDate>Thu, 01 Sep 2011 14:28:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/It1Services" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="it1services" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">It1Services</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>TestFlightApp.com MonoDevelop Integration</title>
		<link>http://www.it1services.ca/2011/09/testflightapp-com-monodevelop-integration/</link>
		<comments>http://www.it1services.ca/2011/09/testflightapp-com-monodevelop-integration/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 14:28:20 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.it1services.ca/?p=131</guid>
		<description><![CDATA[Well it&#8217;s been quite a while since I&#8217;ve done a post. Today&#8217;s post is just a repost of an old post I had on my old blog before I had some data loss issues. Someone in the IRC channel asked about it today, so here it is. The following is a except from a csproj [...]]]></description>
			<content:encoded><![CDATA[<p>Well it&#8217;s been quite a while since I&#8217;ve done a post.  Today&#8217;s post is just a repost of an old post I had on my old blog before I had some data loss issues.  Someone in the IRC channel asked about it today, so here it is. The following is a except from a csproj file, showing what you need to add/change into your configuration to get MD to auto-build your app and upload to TFA.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PropertyGroup</span> <span style="color: #000066;">Condition</span>=<span style="color: #ff0000;">&quot; '$(Configuration)|$(Platform)' == 'AdHoc|iPhone' &quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;DebugType<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>none<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/DebugType<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Optimize<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Optimize<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OutputPath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>bin\iPhone\AdHoc<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/OutputPath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WarningLevel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/WarningLevel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MtouchDebug<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>False<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MtouchDebug<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;AssemblyName<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;Your</span> Assembly Name<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/AssemblyName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CodesignKey<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;Your</span> Key Here<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/CodesignKey<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MtouchI18n</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CustomCommands<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CustomCommands<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Command</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;BeforeBuild&quot;</span> <span style="color: #000066;">command</span>=<span style="color: #ff0000;">&quot;rm -rf ${SolutionDir}/Output/Payload/${ProjectName}.app/&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Command</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;BeforeBuild&quot;</span> <span style="color: #000066;">command</span>=<span style="color: #ff0000;">&quot;rm -rf ${SolutionDir}/${ProjectName}.ipa&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Command</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;AfterBuild&quot;</span> <span style="color: #000066;">command</span>=<span style="color: #ff0000;">&quot;cp -r ${ProjectDir}/bin/${ProjectConfigPlat}/${ProjectConfigName}/${ProjectName}.app ${SolutionDir}/Output/Payload/${ProjectName}.app&quot;</span> <span style="color: #000066;">workingdir</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Command</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;AfterBuild&quot;</span> <span style="color: #000066;">command</span>=<span style="color: #ff0000;">&quot;zip -r ../${ProjectName}.ipa .&quot;</span> <span style="color: #000066;">workingdir</span>=<span style="color: #ff0000;">&quot;${SolutionDir}/Output/&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Command</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;AfterBuild&quot;</span> <span style="color: #000066;">command</span>=<span style="color: #ff0000;">&quot;curl http://testflightapp.com/api/builds.json -F file=@../${ProjectName}.ipa -F api_token='&lt;Your API Token Here&gt;</span></span>' -F team_token='<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Your</span> Team Token<span style="color: #000000; font-weight: bold;">&gt;</span></span>' -F notes='Uploaded Automatically From MonoDevelop' -F notify=false -F distribution_lists='<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Your</span> Distribution Lists<span style="color: #000000; font-weight: bold;">&gt;</span></span>'&quot; /&gt;
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CustomCommands<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CustomCommands<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CodesignProvision<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;Your</span> Codesign UID<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/CodesignProvision<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MtouchUseLlvm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MtouchUseLlvm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MtouchUseArmv7<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MtouchUseArmv7<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MtouchUseThumb<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MtouchUseThumb<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MtouchUseSGen<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MtouchUseSGen<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MtouchArch<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ARMv6<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MtouchArch<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MtouchSdkVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4.3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MtouchSdkVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MtouchMinimumOS<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4.3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MtouchMinimumOS<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/PropertyGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Once you&#8217;ve made this change to your CSPROJ file, the next steps are as follows.</p>
<ol>
<li>Create an Output Directory in your solution folder</li>
<li>Create a Payload folder inside the new Output folder</li>
<li>Configure the upload note, and API Key and </li>
</ol>
<p>While there is still lots of room for improvement, it should give everyone a quick idea of how to use MD&#8217;s custom build actions to automatically upload your build to TFA.  </p>
<p>Cheers<br />
Warren</p>
]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2011/09/testflightapp-com-monodevelop-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rewrite Memory size for JNLP Web Clients</title>
		<link>http://www.it1services.ca/2011/08/rewrite-memory-size-jnlp-web-clients/</link>
		<comments>http://www.it1services.ca/2011/08/rewrite-memory-size-jnlp-web-clients/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 22:31:46 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[Windows Scripting]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Windows Script]]></category>

		<guid isPermaLink="false">http://www.it1services.ca/?p=125</guid>
		<description><![CDATA[Well today I ran into a weird issue where a JNLP file wouldn&#8217;t launch the JVM. Through some troubleshooting, I discovered it was because more virtual memory than could be assigned was being assigned. I wrote this little script that goes and gets the latest ws file, searches for 1024m and replaces with 768m then [...]]]></description>
			<content:encoded><![CDATA[<p>Well today I ran into a weird issue where a JNLP file wouldn&#8217;t launch the JVM. Through some troubleshooting, I discovered it was because more virtual memory than could be assigned was being assigned. I wrote this little script that goes and gets the latest ws file, searches for 1024m and replaces with 768m then runs the file.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">Const ForReading = 1
Const ForWriting = 2
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Dim</span> fso, folder, files, NewsFile,sFolder, dDateModified, jnlpFile
dDateModified = CDate(<span style="color: #800000;">&quot;1/1/2000&quot;</span>)
<span style="color: #151B8D; font-weight: bold;">Set</span> fso = <span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;Scripting.FileSystemObject&quot;</span>)
<span style="color: #151B8D; font-weight: bold;">Set</span> sFolder = fso.GetSpecialFolder(2)
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">If</span> sFolder = <span style="color: #800000;">&quot;&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span>
    	Wscript.Echo <span style="color: #800000;">&quot;No Temp Folder Found&quot;</span>    
	Wscript.Quit
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Set</span> folder = fso.GetFolder(sFolder)
<span style="color: #151B8D; font-weight: bold;">Set</span> files = folder.Files 
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">each</span> fil <span style="color: #8D38C9; font-weight: bold;">In</span> files
    <span style="color: #8D38C9; font-weight: bold;">if</span> (InStr(fil.Name,<span style="color: #800000;">&quot;javaws&quot;</span>) &gt; 0 <span style="color: #8D38C9; font-weight: bold;">and</span> fil.DateLastModified &gt; dDateModified) <span style="color: #8D38C9; font-weight: bold;">then</span>
        dDateModified = fil.DateLastModified        
	jnlpFile = fil.Name
    <span style="color: #8D38C9; font-weight: bold;">end</span> <span style="color: #8D38C9; font-weight: bold;">if</span>
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">Next</span>
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">if</span> jnlpFile &lt;&gt; <span style="color: #800000;">&quot;&quot;</span> <span style="color: #8D38C9; font-weight: bold;">then</span>
	<span style="color: #151B8D; font-weight: bold;">Set</span> objFile = fso.OpenTextFile(sFolder.Path &amp; <span style="color: #800000;">&quot;\&quot;</span> &amp; jnlpFile, ForReading)
    	strText = objFile.ReadAll    
	objFile.<span style="color: #8D38C9; font-weight: bold;">Close</span>
    	strNewText = Replace(strText, <span style="color: #800000;">&quot;1024m&quot;</span>, <span style="color: #800000;">&quot;768m&quot;</span>)
    	<span style="color: #151B8D; font-weight: bold;">Set</span> objFile = fso.OpenTextFile(sFolder.Path &amp; <span style="color: #800000;">&quot;\&quot;</span> &amp; jnlpFile, ForWriting)
    	objFile.WriteLine strNewText    
	objFile.<span style="color: #8D38C9; font-weight: bold;">Close</span>
    	<span style="color: #151B8D; font-weight: bold;">Set</span> WshShell = WScript.<span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;WScript.Shell&quot;</span>)
    	WshShell.Run(<span style="color: #800000;">&quot;javaws &quot;</span> &amp; <span style="color: #800000;">&quot;&quot;</span><span style="color: #800000;">&quot;&quot;</span> &amp; sFolder.Path &amp; <span style="color: #800000;">&quot;\&quot;</span> &amp; jnlpFile &amp; <span style="color: #800000;">&quot;&quot;</span><span style="color: #800000;">&quot;&quot;</span>)    
	<span style="color: #151B8D; font-weight: bold;">Set</span> oShell = <span style="color: #00C2FF; font-weight: bold;">Nothing</span>
<span style="color: #8D38C9; font-weight: bold;">end</span> <span style="color: #8D38C9; font-weight: bold;">if</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2011/08/rewrite-memory-size-jnlp-web-clients/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ABAddressBook Helper</title>
		<link>http://www.it1services.ca/2010/11/abaddressbook-helper/</link>
		<comments>http://www.it1services.ca/2010/11/abaddressbook-helper/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 07:48:31 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[MonoTouch]]></category>

		<guid isPermaLink="false">http://superyeti420.wordpress.com/?p=105</guid>
		<description><![CDATA[Hey everyone, while working on my latest project, i discovered the need to search the address book for a phone number. Through my travels, I DID discover that it seems this functionality isn&#8217;t exposed by default with the native iOS libraries, or if it is, its with NSArrays, and NSObjects which can be slower than [...]]]></description>
			<content:encoded><![CDATA[<p>Hey everyone, while working on my latest project, i discovered the need to search the address book for a phone number.  Through my travels, I DID discover that it seems this functionality isn&#8217;t exposed by default with the native iOS libraries, or if it is, its with NSArrays, and NSObjects which can be slower than native MT components.  So with a bit of help from Clancy, i came up with this helper class for the MonoTouch ABAddressBook.  Enjoy.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> ContactHelper
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> ContactHelper<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> ABPerson PickContact<span style="color: #008000;">&#40;</span>UIViewController view<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        ABPeoplePickerNavigationController picker <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ABPeoplePickerNavigationController<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        ABPerson ret <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
        picker<span style="color: #008000;">.</span><span style="color: #0000FF;">SelectPerson</span> <span style="color: #008000;">+=</span> <span style="color: #6666cc; font-weight: bold;">delegate</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, ABPeoplePickerSelectPersonEventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            picker<span style="color: #008000;">.</span><span style="color: #0000FF;">DismissModalViewControllerAnimated</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> ret <span style="color: #008000;">=</span> e<span style="color: #008000;">.</span><span style="color: #0000FF;">Person</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
        picker<span style="color: #008000;">.</span><span style="color: #0000FF;">Cancelled</span> <span style="color: #008000;">+=</span> <span style="color: #6666cc; font-weight: bold;">delegate</span>
        <span style="color: #008000;">&#123;</span>
            picker<span style="color: #008000;">.</span><span style="color: #0000FF;">DismissModalViewControllerAnimated</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
        view<span style="color: #008000;">.</span><span style="color: #0000FF;">PresentModalViewController</span><span style="color: #008000;">&#40;</span>picker, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">return</span> ret<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> ABPerson SearchByPhoneNumber<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> phoneNumber<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        List singlePeople <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        phoneNumber <span style="color: #008000;">=</span> Regex<span style="color: #008000;">.</span><span style="color: #0000FF;">Replace</span><span style="color: #008000;">&#40;</span>phoneNumber, <span style="color: #666666;">&quot;[^0-9]&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        ABAddressBook ab <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ABAddressBook<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        var people <span style="color: #008000;">=</span> ab<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Where</span><span style="color: #008000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x <span style="color: #008000;">is</span> ABPerson<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cast</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Where</span><span style="color: #008000;">&#40;</span>
            x <span style="color: #008000;">=&gt;</span> x<span style="color: #008000;">.</span><span style="color: #0000FF;">GetPhones</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Where</span><span style="color: #008000;">&#40;</span>p <span style="color: #008000;">=&gt;</span> Regex<span style="color: #008000;">.</span><span style="color: #0000FF;">Replace</span><span style="color: #008000;">&#40;</span>p<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span>, <span style="color: #666666;">&quot;[^0-9]&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span>phoneNumber<span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span>
                phoneNumber<span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span>Regex<span style="color: #008000;">.</span><span style="color: #0000FF;">Replace</span><span style="color: #008000;">&#40;</span>p<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span>, <span style="color: #666666;">&quot;[^0-9]&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>var person <span style="color: #0600FF; font-weight: bold;">in</span> people<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>singlePeople<span style="color: #008000;">.</span><span style="color: #0000FF;">Intersect</span><span style="color: #008000;">&#40;</span>person<span style="color: #008000;">.</span><span style="color: #0000FF;">GetRelatedNames</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cast</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&lt;=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
                singlePeople<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>person<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">return</span> singlePeople<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">First</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2010/11/abaddressbook-helper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updates to SuperYeti/MonoTouch.Dialog</title>
		<link>http://www.it1services.ca/2010/08/updates-to-superyetimonotouch-dialog-2/</link>
		<comments>http://www.it1services.ca/2010/08/updates-to-superyetimonotouch-dialog-2/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 06:16:02 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[MonoTouch]]></category>
		<category><![CDATA[MonoTouch.Dialog]]></category>

		<guid isPermaLink="false">http://superyeti420.wordpress.com/?p=103</guid>
		<description><![CDATA[I fixed up the BooleanImageElement to draw the On/Off slider in the correct location on the view now, it detects what device it is, and based on that it changes the X value accordingly. http://github.com/SuperYeti/MonoTouch.Dialog]]></description>
			<content:encoded><![CDATA[<p>I fixed up the BooleanImageElement to draw the On/Off slider in the correct location on the view now, it detects what device it is, and based on that it changes the X value accordingly.  <a href="http://github.com/SuperYeti/MonoTouch.Dialog">http://github.com/SuperYeti/MonoTouch.Dialog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2010/08/updates-to-superyetimonotouch-dialog-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Im Back hehe  new updates to MonoTouch.Dialog.Extensions</title>
		<link>http://www.it1services.ca/2010/08/im-back-hehe-new-updates-to-monotouch-dialog-extensions/</link>
		<comments>http://www.it1services.ca/2010/08/im-back-hehe-new-updates-to-monotouch-dialog-extensions/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 04:12:31 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[MonoTouch]]></category>
		<category><![CDATA[MonoTouch.Dialog]]></category>
		<category><![CDATA[MonoTouch.Dialog.Extensions]]></category>
		<category><![CDATA[MT.D Spiffy Background Image Controller]]></category>

		<guid isPermaLink="false">http://superyeti420.wordpress.com/?p=101</guid>
		<description><![CDATA[Well after a bit of a hiatus on iOS Dev, i&#8217;m back. I added a new &#8220;SpiffyDialogViewController&#8221; to the MT.D.Ext library today. Its based off of Miguel&#8217;s code sample in MT.d to do a backgroun image on a UITable, but wasn&#8217;t working correctly on the iPad aka not at all. So i did some research [...]]]></description>
			<content:encoded><![CDATA[<p>Well after a bit of a hiatus on iOS Dev, i&#8217;m back.  I added a new &#8220;SpiffyDialogViewController&#8221; to the MT.D.Ext library today.  Its based off of Miguel&#8217;s code sample in MT.d to do a backgroun image on a UITable, but wasn&#8217;t working correctly on the iPad aka not at all.  So i did some research figured out where it was failing and fixed it.  silly SDK version inconsistencies.  Well its all good to go now, and uploaded to.  <a href="http://github.com/SuperYeti/MonoTouch.Dialog.Extensions/">http://github.com/SuperYeti/MonoTouch.Dialog.Extensions</a>  feel free to add to it or any comments or suggestions are always welcomed.  Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2010/08/im-back-hehe-new-updates-to-monotouch-dialog-extensions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MonoTouch.Dialog.Extensions Release</title>
		<link>http://www.it1services.ca/2010/05/monotouch-dialog-extensions-release/</link>
		<comments>http://www.it1services.ca/2010/05/monotouch-dialog-extensions-release/#comments</comments>
		<pubDate>Thu, 13 May 2010 01:18:05 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[MonoTouch]]></category>
		<category><![CDATA[MonoTouch.Dialog]]></category>
		<category><![CDATA[MonoTouch.Dialog.Extensions]]></category>

		<guid isPermaLink="false">http://superyeti420.wordpress.com/?p=94</guid>
		<description><![CDATA[Hey everyone. I&#8217;ve released the 1st version of MonoTouch.Dialog.Extensions at http://github.com/SuperYeti/MonoTouch.Dialog.Extensions. The first addition is a UrlImageStringElement extension that will load an image and caption from a URL, save the image on the file system, and create a thumbnail for it. This also utilizes an LRU cache, and download throttling mechanism thanks to Miguel for [...]]]></description>
			<content:encoded><![CDATA[<p>Hey everyone.  I&#8217;ve released the 1st version of MonoTouch.Dialog.Extensions at <a href="http://github.com/SuperYeti/MonoTouch.Dialog.Extensions">http://github.com/SuperYeti/MonoTouch.Dialog.Extensions</a>.  The first addition is a UrlImageStringElement extension that will load an image and caption from a URL, save the image on the file system, and create a thumbnail for it.  This also utilizes an LRU cache, and download throttling mechanism thanks to Miguel for that.  Check it out, and let me know what other extensions you&#8217;d like to see on it in the future.  Cheers.</p>
<p>UPDATE:  I just added in a search bar, and image cache management for clearing the cache.  I made the sample app a little google images search tool.</p>
<p><a href="http://github.com/SuperYeti/MonoTouch.Dialog.Extensions">http://github.com/SuperYeti/MonoTouch.Dialog.Extensions</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2010/05/monotouch-dialog-extensions-release/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MonoTouch.DirectoryRecurser</title>
		<link>http://www.it1services.ca/2010/05/monotouch-directoryrecurser/</link>
		<comments>http://www.it1services.ca/2010/05/monotouch-directoryrecurser/#comments</comments>
		<pubDate>Tue, 11 May 2010 03:46:29 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[MonoTouch]]></category>
		<category><![CDATA[MonoTouch.Dialog]]></category>

		<guid isPermaLink="false">http://superyeti420.wordpress.com/?p=92</guid>
		<description><![CDATA[Well today i built a quick little File system browser for the iPhone using MonoTouch.Dialog as a little POC. It goes and recurses your documents directory, and allows you to navigate through the folder structure, and click on files to see an alert with the name.]]></description>
			<content:encoded><![CDATA[<p>Well today i built a quick little File system browser for the iPhone using MonoTouch.Dialog as a little POC.  It goes and recurses your documents directory, and allows you to navigate through the folder structure, and click on files to see an alert with the name.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2010/05/monotouch-directoryrecurser/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SuperYeti/MonoTouch.Dialog updates</title>
		<link>http://www.it1services.ca/2010/05/superyetimonotouch-dialog-updates-2/</link>
		<comments>http://www.it1services.ca/2010/05/superyetimonotouch-dialog-updates-2/#comments</comments>
		<pubDate>Mon, 10 May 2010 20:14:54 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[MonoTouch]]></category>
		<category><![CDATA[MonoTouch.Dialog]]></category>

		<guid isPermaLink="false">http://superyeti420.wordpress.com/?p=88</guid>
		<description><![CDATA[Well Miguel went to merge some/all of my changes on my fork into trunk today, and there were a ton of whitespace and formatting changes. i went through and cleaned these up, and pulled from trunk to make it more consistent. While i was in there i included all of Miguel&#8217;s recent changes, and made [...]]]></description>
			<content:encoded><![CDATA[<p>Well Miguel went to merge some/all of my changes on my fork into trunk today, and there were a ton of whitespace and formatting changes.  i went through and cleaned these up, and pulled from trunk to make it more consistent.  While i was in there i included all of Miguel&#8217;s recent changes, and made his new changes, and my old ones play nice together.  Essentially the merge is done, miguel just has to decide which of the changes he wants to keep.  in any case, please find the url below, and check it out for yourself if wanted.  Cheers.</p>
<p><a href="http://http://github.com/SuperYeti/MonoTouch.Dialog/">http://github.com/SuperYeti/MonoTouch.Dialog/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2010/05/superyetimonotouch-dialog-updates-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>caulker extensions</title>
		<link>http://www.it1services.ca/2010/05/caulker-extensions/</link>
		<comments>http://www.it1services.ca/2010/05/caulker-extensions/#comments</comments>
		<pubDate>Fri, 07 May 2010 06:23:34 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[MonoTouch]]></category>

		<guid isPermaLink="false">http://superyeti420.wordpress.com/?p=83</guid>
		<description><![CDATA[hey guys, today FAK finally released his AWESOME 3d mapping library, and i began to cut my teeth on it. it annoyed me that double tap wasn&#8217;t there so i added it in, and removed the tilt during zoom functionality as well. I was thinking either 3 touch tilt (ahill&#8217;s idea) or maybe a touch [...]]]></description>
			<content:encoded><![CDATA[<p>hey guys, today FAK finally released  his AWESOME 3d mapping library, and i began to cut my teeth on it.  it annoyed me that double tap wasn&#8217;t there so i added it in, and removed the tilt during zoom functionality as well.  I was thinking either 3 touch tilt (ahill&#8217;s idea) or maybe a touch and hold button and use the accelerometer to tilt your display of the map, that&#8217;d be kinda cool.  Also i think the compass, and gps should be tied into the core library, for map orientation, and location capabilitites.  I&#8217;ll be adding this release to FAK&#8217;s source if he wants when he gets back, but i wanted to start a good forum on ideas/suggestions for the library while it was fresh until FAK gets up a forum, or suggestion list.  Cheers Warren.  I&#8217;m lazy and didnt feel like posting the file elsewhere.  Just right-click and save-as the link below and remove the .jpg extension from the file to reveal the tar.gz.  l8rs</p>
<p><a href="http://it1services.ca/wp-content/uploads/2010/05/superyeti-caulker-tar-gz.jpg">Download Source Here, rename to *.tar.gz</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2010/05/caulker-extensions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>UPDATE: MonoTouch Compatible Encryption Functions</title>
		<link>http://www.it1services.ca/2010/05/update-monotouch-compatible-encryption-functions/</link>
		<comments>http://www.it1services.ca/2010/05/update-monotouch-compatible-encryption-functions/#comments</comments>
		<pubDate>Thu, 06 May 2010 18:27:37 +0000</pubDate>
		<dc:creator>Yeti</dc:creator>
				<category><![CDATA[MonoTouch]]></category>

		<guid isPermaLink="false">http://superyeti420.wordpress.com/?p=72</guid>
		<description><![CDATA[Hey guys, i was informed that i used a weak cipher combination on my last post and example. I&#8217;ve done some more reading, learned a ton more about encryption today , and have come up with this based on the MSDN examples, and some more reading. Cheers. 1 2 3 4 5 6 7 8 [...]]]></description>
			<content:encoded><![CDATA[<p>Hey guys, i was informed that i used a weak cipher combination on my last post and example.  I&#8217;ve done some more reading, learned a ton more about encryption today <img src='http://www.it1services.ca/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , and have come up with this based on the MSDN examples, and some more reading.  Cheers.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">class</span> PageSecurity
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">string</span> bKey <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Fvjh834funw0uw34nf9we80yfw07FYB3Q4FNH74329&quot;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> bSalt
    <span style="color: #008000;">&#123;</span>
        get <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#123;</span> 0x23, 0x5e, 0x2d, 0x65, 0x94, 0x7a, 0x62, 0x64, 0x5d, 0x3c, 0xe3, 0xee, 0xfa <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> EncryptString<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> plainText<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        Rfc2898DeriveBytes rdb <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Rfc2898DeriveBytes<span style="color: #008000;">&#40;</span>bKey <span style="color: #008000;">+</span> UIDevice<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentDevice</span><span style="color: #008000;">.</span><span style="color: #0000FF;">UniqueIdentifier</span>, bSalt<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> Key <span style="color: #008000;">=</span> rdb<span style="color: #008000;">.</span><span style="color: #0000FF;">GetBytes</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">32</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> IV <span style="color: #008000;">=</span> rdb<span style="color: #008000;">.</span><span style="color: #0000FF;">GetBytes</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">16</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">// Check arguments.</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>plainText <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">||</span> plainText<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&lt;=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;plainText&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>Key <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">||</span> Key<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&lt;=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Key&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>IV <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">||</span> IV<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&lt;=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;IV&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">// Declare the stream used to encrypt to an in memory</span>
        <span style="color: #008080; font-style: italic;">// array of bytes.</span>
        MemoryStream msEncrypt <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">// Declare the RijndaelManaged object</span>
        <span style="color: #008080; font-style: italic;">// used to encrypt the data.</span>
        RijndaelManaged aesAlg <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">try</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">// Create a RijndaelManaged object</span>
            <span style="color: #008080; font-style: italic;">// with the specified key and IV.</span>
            aesAlg <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> RijndaelManaged<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">Key</span> <span style="color: #008000;">=</span> Key<span style="color: #008000;">;</span>
            aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">IV</span> <span style="color: #008000;">=</span> IV<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Create a decrytor to perform the stream transform.</span>
            ICryptoTransform encryptor <span style="color: #008000;">=</span> aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateEncryptor</span><span style="color: #008000;">&#40;</span>aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">Key</span>, aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">IV</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Create the streams used for encryption.</span>
            msEncrypt <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MemoryStream<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>CryptoStream csEncrypt <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> CryptoStream<span style="color: #008000;">&#40;</span>msEncrypt, encryptor, CryptoStreamMode<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>StreamWriter swEncrypt <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StreamWriter<span style="color: #008000;">&#40;</span>csEncrypt<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
&nbsp;
                    <span style="color: #008080; font-style: italic;">//Write all data to the stream.</span>
                    swEncrypt<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>plainText<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">finally</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">// Clear the RijndaelManaged object.</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>aesAlg <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">Clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">// Return the encrypted bytes from the memory stream.</span>
        <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> retArray <span style="color: #008000;">=</span> msEncrypt<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">return</span> Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToBase64String</span><span style="color: #008000;">&#40;</span>retArray, <span style="color: #FF0000;">0</span>, retArray<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> DecryptString<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> cipher<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        Rfc2898DeriveBytes rdb <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Rfc2898DeriveBytes<span style="color: #008000;">&#40;</span>bKey <span style="color: #008000;">+</span> UIDevice<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentDevice</span><span style="color: #008000;">.</span><span style="color: #0000FF;">UniqueIdentifier</span>, bSalt<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> Key <span style="color: #008000;">=</span> rdb<span style="color: #008000;">.</span><span style="color: #0000FF;">GetBytes</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">32</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> IV <span style="color: #008000;">=</span> rdb<span style="color: #008000;">.</span><span style="color: #0000FF;">GetBytes</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">16</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> cipherText <span style="color: #008000;">=</span> Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">FromBase64String</span><span style="color: #008000;">&#40;</span>cipher<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">// Check arguments.</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>cipherText <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">||</span> cipherText<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&lt;=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;cipherText&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>Key <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">||</span> Key<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&lt;=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Key&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>IV <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">||</span> IV<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&lt;=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;IV&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">// Declare the RijndaelManaged object</span>
        <span style="color: #008080; font-style: italic;">// used to decrypt the data.</span>
        RijndaelManaged aesAlg <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">// Declare the string used to hold</span>
        <span style="color: #008080; font-style: italic;">// the decrypted text.</span>
        <span style="color: #6666cc; font-weight: bold;">string</span> plaintext <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">try</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">// Create a RijndaelManaged object</span>
            <span style="color: #008080; font-style: italic;">// with the specified key and IV.</span>
            aesAlg <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> RijndaelManaged<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">Key</span> <span style="color: #008000;">=</span> Key<span style="color: #008000;">;</span>
            aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">IV</span> <span style="color: #008000;">=</span> IV<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Create a decrytor to perform the stream transform.</span>
            ICryptoTransform decryptor <span style="color: #008000;">=</span> aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateDecryptor</span><span style="color: #008000;">&#40;</span>aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">Key</span>, aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">IV</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">// Create the streams used for decryption.</span>
            <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>MemoryStream msDecrypt <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MemoryStream<span style="color: #008000;">&#40;</span>cipherText<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>CryptoStream csDecrypt <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> CryptoStream<span style="color: #008000;">&#40;</span>msDecrypt, decryptor, CryptoStreamMode<span style="color: #008000;">.</span><span style="color: #0000FF;">Read</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>StreamReader srDecrypt <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StreamReader<span style="color: #008000;">&#40;</span>csDecrypt<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
&nbsp;
                        <span style="color: #008080; font-style: italic;">// Read the decrypted bytes from the decrypting stream</span>
                        <span style="color: #008080; font-style: italic;">// and place them in a string.</span>
                        plaintext <span style="color: #008000;">=</span> srDecrypt<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadToEnd</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">finally</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">// Clear the RijndaelManaged object.</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>aesAlg <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                aesAlg<span style="color: #008000;">.</span><span style="color: #0000FF;">Clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">return</span> plaintext<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> EncryptString<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> value<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span> EncryptString<span style="color: #008000;">&#40;</span>value<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.it1services.ca/2010/05/update-monotouch-compatible-encryption-functions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

