<?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>luauf.com &#187; C#</title>
	<atom:link href="http://luauf.com/category/programacion/c-programacion/feed/" rel="self" type="application/rss+xml" />
	<link>http://luauf.com</link>
	<description>Sistemas Operativos, Bases de Datos, Programación y Redes</description>
	<lastBuildDate>Mon, 14 May 2012 01:15:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Microsoft Source Analysis para C#</title>
		<link>http://luauf.com/2008/05/24/microsoft-source-analysis-para-c/</link>
		<comments>http://luauf.com/2008/05/24/microsoft-source-analysis-para-c/#comments</comments>
		<pubDate>Sat, 24 May 2008 16:28:30 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=316</guid>
		<description><![CDATA[El día de ayer fue anunciado Microsfot Source Analisys para C#. Se trata de una nueva herramienta para desarrolladores. Esta herramienta es conocida y utilizada desde hace varios años internamente en los grupos...]]></description>
			<content:encoded><![CDATA[<p>El día de ayer fue anunciado Microsfot Source Analisys para C#. Se trata de una nueva herramienta para desarrolladores.</p>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/05/sa.jpg"><img class="aligncenter size-medium wp-image-317" title="sa" src="http://luauf.com/wp-content/uploads/2008/05/sa-300x236.jpg" alt="" width="300" height="236" /></a></p>
<p>Esta herramienta es conocida y utilizada desde hace varios años internamente en los grupos de desarrollo de Microsoft para ayudar a implementar las mejores prácticas en la disposición, elegancia, legibilidad, mantenimiento y documentado del código fuente.</p>
<p><span id="more-316"></span>Microsfot Source Analisys para C# viene con un conjunto de analizadores predeterminados que cubren aproximadamente 200 reglas. Estas cubren aspectos como:</p>
<ul>
<li>Disposición de elementos, sentencias, expresiones y claúsulas de consulta.</li>
<li>Ubicación de llavas, paréntesis, corchetes, etc</li>
<li>Espaciado entre palabras claves y operadores</li>
<li>Espaciado entre líneas</li>
<li>Ubicación de parametros en declaración o llamada de métodos</li>
<li>Ordenamiento estándar de los elementos de una clase</li>
<li>Nombrado de elementos, campos y variables</li>
<li>Uso de tipos &#8220;built-in&#8221;</li>
<li>Contenidos permitidos de archivos</li>
<li>Texto de debugging</li>
</ul>
<p>Una vez descargado e instalado, el mismo se integra al IDE de Visual Studio, y puedes encontrarlo en <strong>Tools \ Run Source Analysis (Ctrl+Shift+Y)</strong> o <strong>Tools \ Run Source Analysis (Rescan All)</strong>.</p>
<p>Descarga <a href="https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sourceanalysis" target="_blank">Microsoft Source Analysis for C#</a></p>
<p>Via: <a href="http://blogs.msdn.com/sourceanalysis/archive/2008/05/23/announcing-the-release-of-microsoft-source-analysis.aspx" target="_blank">MSDN Blogs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/24/microsoft-source-analysis-para-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programas básicos en CSharp con Mono</title>
		<link>http://luauf.com/2008/05/18/programas-basicos-en-csharp-con-mono/</link>
		<comments>http://luauf.com/2008/05/18/programas-basicos-en-csharp-con-mono/#comments</comments>
		<pubDate>Sun, 18 May 2008 16:56:40 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Sharp]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=294</guid>
		<description><![CDATA[Mono es el proyecto open source para crear aplicaciones en GNU/Linux, compatibles con C#. Básicamente, Mono lleva el Framework de .NET a plataformas no-windows. Hace tiempo atrás había publicado algo acerca de MonoDevelop...]]></description>
			<content:encoded><![CDATA[<p>Mono es el proyecto open source para crear aplicaciones en GNU/Linux, compatibles con C#. Básicamente, Mono lleva el Framework de .NET a  plataformas no-windows.</p>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/05/mono-logo.png"><img class="alignnone size-medium wp-image-295" title="mono-logo" src="http://luauf.com/wp-content/uploads/2008/05/mono-logo-300x261.png" alt="" width="300" height="261" /></a></p>
<p>Hace tiempo atrás había publicado algo acerca de <a href="http://luauf.com/2008/04/28/monodevelop-10-en-ubuntu/" target="_self">MonoDevelop 1.0</a>, un IDE para desarrollar en Mono en Linux.</p>
<p>En esta ocasión publicaré algunos ejemplos de aplicaciones de consola:<br />
<span id="more-294"></span><br />
<code></p>
<div class="syntax_hilite">
<div id="code-13">
<div class="code">$ gedit hola.<span style="">cs</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="csharp-14">
<div class="csharp"><span style="color: #FF0000;">class</span> Hola<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Hola Mundo!"</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-15">
<div class="code">$ mcs hola.<span style="">cs</span><br />
$ mono hola.<span style="">exe</span><br />
Hola Mundo!</div>
</div>
</div>
<p>
</code></p>
<p><code></p>
<div class="syntax_hilite">
<div id="code-16">
<div class="code">$gedit suma.<span style="">cs</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="csharp-17">
<div class="csharp"><span style="color: #FF0000;">class</span> Suma<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #FF0000;">string</span> &nbsp; primerNumero, segundoNumero;<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #FF0000;">int</span> &nbsp;numero1, numero2, suma;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Ingrese el primer n├║mero: "</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;primerNumero = <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Ingrese el segundo n├║mero: "</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;segundoNumero = <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp;numero1 = Int32.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span>primerNumero<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;numero2 = Int32.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span>segundoNumero<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;suma = numero1 + numero2;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"El resutado de la suma es {0}"</span>,suma<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-18">
<div class="code">$ mcs suma.<span style="">cs</span><br />
$ mono suma.<span style="">exe</span><br />
Ingrese el primer numero: <span style="color:#800000;">10</span><br />
Ingrese el segundo numero: <span style="color:#800000;">11</span><br />
El resutado de la suma es <span style="color:#800000;">21</span></div>
</div>
</div>
<p>
</code></p>
<p><code></p>
<div class="syntax_hilite">
<div id="code-19">
<div class="code">$ gedit if.<span style="">sc</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="csharp-20">
<div class="csharp"><span style="color: #FF0000;">class</span> <span style="color: #0600FF;">If</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> numero1,numero2;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Ingrese el primer numero: "</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; numero1 = Int32.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Ingrese el segundo numero:"</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; numero2 = Int32.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span> numero1 == numero2 <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span> numero1 + <span style="color: #808080;">" == "</span> + numero2<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span> numero1 != numero2 <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span> numero1 + <span style="color: #808080;">" != "</span> + numero2<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span> numero1 &lt;numero2 <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span> numero1 + <span style="color: #808080;">" &lt;"</span> + numero2<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span> numero1&gt; numero2 <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span> numero1 + <span style="color: #808080;">"&gt; "</span> + numero2<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span> numero1 &lt;= numero2 <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span> numero1 + <span style="color: #808080;">" &lt;= "</span> + numero2<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span> numero1&gt;= numero2 <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span> numero1 + <span style="color: #808080;">"&gt;= "</span> + numero2<span style="color: #000000;">&#41;</span>;<br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-21">
<div class="code">$ mcs if.<span style="">cs</span><br />
$ mono if.<span style="">exe</span><br />
Ingrese el primer numero: <span style="color:#800000;">10</span><br />
Ingrese el segundo numero:<span style="color:#800000;">11</span><br />
<span style="color:#800000;">10</span> != <span style="color:#800000;">11</span><br />
<span style="color:#800000;">10</span> &lt;<span style="color:#800000;">11</span><br />
<span style="color:#800000;">10</span> &lt;= <span style="color:#800000;">11</span></div>
</div>
</div>
<p>
</code></p>
<p><code></p>
<div class="syntax_hilite">
<div id="code-22">
<div class="code">$ gedit capicua.<span style="">cs</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="csharp-23">
<div class="csharp"><span style="color: #FF0000;">class</span> Programa<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Ingrese una palabra: "</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">string</span> palabra = <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">string</span> invertida = invertir<span style="color: #000000;">&#40;</span>palabra<span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span>palabra.<span style="color: #0000FF;">Equals</span><span style="color: #000000;">&#40;</span>invertida<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"La palabra es Capicua"</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"La palabra NO es Capicua"</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> invertir<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> cadena<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">string</span> invertido = <span style="color: #808080;">""</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i = cadena.<span style="color: #0000FF;">Length</span>-<span style="color: #FF0000;">1</span>; i&gt;= <span style="color: #FF0000;">0</span>; i--<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; invertido = invertido + cadena.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span>i, <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> invertido;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="code-24">
<div class="code">$ mcs capicua.<span style="">cs</span><br />
$ mono capicua.<span style="">exe</span><br />
Ingrese una palabra: menem<br />
La palabra es Capicua</div>
</div>
</div>
<p>
</code></p>
<p>Descargar ejemplos <a href="http://luauf.com/wp-content/uploads/2008/05/csharp.rar">aquí</a>. Cabe destacar además, que estos ejemplos compilados, pueden correr en tanto en Windows como en Linux.</p>
<p>Vía: <a href="http://www.casidiablo.net/wordpress/index.php/2007/12/10/codigo-c-sharp-programas-basicos/" target="_blank">Casidiablo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/18/programas-basicos-en-csharp-con-mono/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Minimizar una aplicación .NET a la Tray Bar</title>
		<link>http://luauf.com/2008/05/17/minimizar-una-aplicacion-net-a-la-tray-bar/</link>
		<comments>http://luauf.com/2008/05/17/minimizar-una-aplicacion-net-a-la-tray-bar/#comments</comments>
		<pubDate>Sat, 17 May 2008 22:26:44 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Tray]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=292</guid>
		<description><![CDATA[Hay muchos casos en los cuales minimizar una aplicación a la barra tray es muy útil, generalmente para todas aquellas aplicaciones que corren de fondo (en background), como antivirus, firewalls, etc. El framework...]]></description>
			<content:encoded><![CDATA[<p>Hay muchos casos en los cuales minimizar una aplicación a la barra tray es muy útil, generalmente para todas aquellas aplicaciones que corren de fondo (en background), como antivirus, firewalls, etc.</p>
<p>El framework de .NET pone a nuestra disposición un control &#8220;NotifyIcon&#8221;, con el cual podemos minimizar nuestras aplicaciones Windows Form en la barra tray.</p>
<p>Veremos un ejemplo, donde escribiremos unas pocas líneas de código en C# para minimizar una aplicación en la barra tray y restaurarla al hacer doble clic sobre la misma.</p>
<p><span id="more-292"></span></p>
<ul>
<li>Abrir un proyecto Windows Form existente, o crear uno nuevo.</li>
<li>De la barra de herramientas buscar el control <strong>NotifyIcon </strong>y draguearlo al formulario base</li>
</ul>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/05/notifyicon.png"><img class="aligncenter size-medium wp-image-293" title="notifyicon" src="http://luauf.com/wp-content/uploads/2008/05/notifyicon-222x300.png" alt="" width="222" height="300" /></a></p>
<ul>
<li>Setear la siguientes propiedades:
<ul>
<li><strong>Name</strong>: nombre del control, en mi caso lo nombré como &#8220;trayIcon&#8221;</li>
<li><strong>Text</strong>: texto con el nombre que queremos que aparezca al posicionar el mouse sobre el ícono de la tray.</li>
<li><strong>Icon</strong>: ícono con el que queremos que aparezca la aplicación en la tray bar.</li>
<li><strong>Visible</strong>: en falso, para que la aplicación, al arrancar no se vea en la tray, la haremos visible recién al momento de minimizarla.</li>
</ul>
</li>
<li>Agregar un manejador de eventos al evento <strong>Resize </strong>del formulario con el siguiente código:</li>
</ul>
<p><code></p>
<div class="syntax_hilite">
<div id="csharp-28">
<div class="csharp"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> formBase_Resize<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>FormWindowState.<span style="color: #0000FF;">Minimized</span> == WindowState<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hide<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; trayBar.<span style="color: #0000FF;">Visible</span> = <span style="color: #0600FF;">true</span>;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code></p>
<ul>
<li>Agregar un manejador de eventos al <strong>NotifyIcon.DoubleClick </strong>con siguiente código:</li>
</ul>
<p><code></p>
<div class="syntax_hilite">
<div id="csharp-29">
<div class="csharp"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> trayBar_MouseDoubleClick<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, MouseEventArgs e<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; Show<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; WindowState = FormWindowState.<span style="color: #0000FF;">Normal</span>;<br />
&nbsp; &nbsp; &nbsp; trayBar.<span style="color: #0000FF;">Visible</span> = <span style="color: #0600FF;">false</span>;<br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code></p>
<p>En este punto, nuestra aplicación ya se minimizará en la barra tray (en vez de la barra de tareas) y no volverá a aparecer hasta hacer doble clic sobre el ícono de la System Tray.</p>
<p>Si además queremos agregar un menú contextual, estos son los pasos a seguir:</p>
<ul>
<li>Draguear al formulario el control <strong>ContextMenuStrip</strong>.</li>
<li>Haciendo clic derecho sobre el control <strong>ContextMenuStrip</strong>insertado, seleccionar Edit Menu.</li>
<li>Agregar las opciones del menu contextual, por ejemplo, &#8220;Restaurar&#8221; y &#8220;Cerrar&#8221;.</li>
<li>Escribir el código para los eventos clic de cada una de las opciones del menú contextual:</li>
</ul>
<ul>
<li>Finalmente, setear en el <strong>NotifyIcon</strong> la propiedad <strong>ContextMenuStip </strong>con el nuevo menu contextual recién creado.</li>
</ul>
<p><code></p>
<div class="syntax_hilite">
<div id="csharp-30">
<div class="csharp"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> toolStripMenuItemRestaurar_Click<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; Show<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; WindowState = FormWindowState.<span style="color: #0000FF;">Normal</span>;<br />
&nbsp; &nbsp; &nbsp; trayBar.<span style="color: #0000FF;">Visible</span> = <span style="color: #0600FF;">false</span>;<br />
<span style="color: #000000;">&#125;</span></p>
<p><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> toolStripMenuItemSalir_Click<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; Application.<span style="color: #0000FF;">Exit</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code></p>
<p>Vía: <a href="http://www.developer.com/net/csharp/article.php/3336751" target="_blank">developer.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/17/minimizar-una-aplicacion-net-a-la-tray-bar/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Ejecutar aplicaciones externas desde C#</title>
		<link>http://luauf.com/2008/05/17/ejecutar-aplicaciones-externas-desde-c/</link>
		<comments>http://luauf.com/2008/05/17/ejecutar-aplicaciones-externas-desde-c/#comments</comments>
		<pubDate>Sat, 17 May 2008 17:21:02 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Procesos]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=290</guid>
		<description><![CDATA[Cuando publiqué Matar procesos desde Java, se vió como ejecutar aplicaciones externas desde Java. En esta ocasión, repetiré el mismo ejemplo (ejecutar un tskill) pero desde una aplicación Window Forms de C#. La...]]></description>
			<content:encoded><![CDATA[<p>Cuando publiqué <a href="http://luauf.com/2008/04/02/matar-procesos-desde-java/">Matar procesos desde Java</a>, se vió como ejecutar aplicaciones externas desde Java. En esta ocasión, repetiré el mismo ejemplo (ejecutar un tskill) pero desde una aplicación Window Forms de C#.</p>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/05/sharpkiller.jpg"><img class="aligncenter size-medium wp-image-291" title="sharpkiller" src="http://luauf.com/wp-content/uploads/2008/05/sharpkiller-300x58.jpg" alt="" width="300" height="58" /></a></p>
<p style="text-align: left;"><span id="more-290"></span></p>
<p style="text-align: left;">La clase Process del paquete System.Diagnostics será utiliza para crear el proceso, pasar los argumentos y ejecutarlo. Veamos directamente el código, pues es muy fácil de entender:</p>
<p style="text-align: left;">
<p><code></p>
<div class="syntax_hilite">
<div id="csharp-32">
<div class="csharp"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> buttonMatar_Click<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Diagnostics</span>.<span style="color: #0000FF;">Process</span> p = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Diagnostics</span>.<span style="color: #0000FF;">Process</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">StartInfo</span>.<span style="color: #0000FF;">FileName</span> = <span style="color: #808080;">"tskill.exe"</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">StartInfo</span>.<span style="color: #0000FF;">UseShellExecute</span> = <span style="color: #0600FF;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">StartInfo</span>.<span style="color: #0000FF;">Arguments</span> = textNombreDelProceso.<span style="color: #0000FF;">Text</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">StartInfo</span>.<span style="color: #0000FF;">RedirectStandardInput</span> = <span style="color: #0600FF;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">StartInfo</span>.<span style="color: #0000FF;">RedirectStandardOutput</span> = <span style="color: #0600FF;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">StartInfo</span>.<span style="color: #0000FF;">RedirectStandardError</span> = <span style="color: #0600FF;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">StartInfo</span>.<span style="color: #0000FF;">CreateNoWindow</span> = <span style="color: #0600FF;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">Start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">WaitForExit</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>p.<span style="color: #0000FF;">StandardOutput</span>.<span style="color: #0000FF;">ReadToEnd</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Console</span>.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>p.<span style="color: #0000FF;">StandardError</span>.<span style="color: #0000FF;">ReadToEnd</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception ex<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span>ex.<span style="color: #0000FF;">Message</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/17/ejecutar-aplicaciones-externas-desde-c/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Leer MP3 ID3 Tag con C#</title>
		<link>http://luauf.com/2008/05/12/leer-mp3-id3-tag-con-c/</link>
		<comments>http://luauf.com/2008/05/12/leer-mp3-id3-tag-con-c/#comments</comments>
		<pubDate>Tue, 13 May 2008 00:09:49 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[ID3 Tag]]></category>
		<category><![CDATA[MP3]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=270</guid>
		<description><![CDATA[Cuando vimos Gestión de Archivos en Python, desarrollamos un ejemplo que leia el ID3 Tag de un MP3. En esta ocasión, vamos a hacer lo mismo, pero utilizando C#. El código: OpenFileDialog fileDialogAbrir...]]></description>
			<content:encoded><![CDATA[<p>Cuando vimos <a href="http://luauf.com/2008/04/07/python-gestion-de-archivos/" target="_self">Gestión de Archivos en Python</a>, desarrollamos un ejemplo que leia el ID3 Tag de un MP3. En esta ocasión, vamos a hacer lo mismo, pero utilizando C#.</p>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/05/id3tag.jpg"><img class="aligncenter size-medium wp-image-272" title="id3tag" src="http://luauf.com/wp-content/uploads/2008/05/id3tag-300x162.jpg" alt="" width="300" height="162" /></a></p>
<p><span id="more-270"></span></p>
<p>El código:<br />
<code></p>
<div class="syntax_hilite">
<div id="csharp-34">
<div class="csharp">OpenFileDialog fileDialogAbrir = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> OpenFileDialog<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
fileDialogAbrir.<span style="color: #0000FF;">Filter</span> = <span style="color: #808080;">"Archivos MP3 (*.mp3)|*.mp3"</span>;<br />
fileDialogAbrir.<span style="color: #0000FF;">ShowDialog</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p><span style="color: #FF0000;">String</span> fileMP3 = textMP3.<span style="color: #0000FF;">Text</span> = fileDialogAbrir.<span style="color: #0000FF;">FileName</span>;</p>
<p><span style="color: #008080; font-style: italic;">//Lectura de ID3 Tag v1 y v1.1</span><br />
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>fileMP3.<span style="color: #0000FF;">Length</span>&gt; <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; FileStream fs;<br />
&nbsp; &nbsp; fs = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> FileStream<span style="color: #000000;">&#40;</span> fileMP3 , FileMode.<span style="color: #0000FF;">Open</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> buffer = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">128</span><span style="color: #000000;">&#93;</span>;<br />
&nbsp; &nbsp; fs.<span style="color: #0000FF;">Seek</span><span style="color: #000000;">&#40;</span>-<span style="color: #FF0000;">128</span>, SeekOrigin.<span style="color: #0000FF;">End</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; fs.<span style="color: #0000FF;">Read</span><span style="color: #000000;">&#40;</span>buffer,<span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">128</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; fs.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; Encoding&nbsp; enc = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> ASCIIEncoding<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #FF0000;">string</span> id3 = enc.<span style="color: #0000FF;">GetString</span><span style="color: #000000;">&#40;</span>buffer<span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> id3.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>,<span style="color: #FF0000;">3</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Equals</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"TAG"</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; textTitulo.<span style="color: #0000FF;">Text</span>&nbsp; &nbsp; &nbsp;= id3.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">3</span>, <span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">TrimEnd</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; textArtista.<span style="color: #0000FF;">Text</span>&nbsp; &nbsp; = id3.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">33</span>, <span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">TrimEnd</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; textAlbum.<span style="color: #0000FF;">Text</span>&nbsp; &nbsp; &nbsp; = id3.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">63</span>, <span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">TrimEnd</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; textAño.<span style="color: #0000FF;">Text</span>&nbsp; &nbsp; &nbsp; &nbsp; = id3.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">93</span>,&nbsp; <span style="color: #FF0000;">4</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">TrimEnd</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; textComentario.<span style="color: #0000FF;">Text</span> = id3.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">97</span>, <span style="color: #FF0000;">28</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">TrimEnd</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>id3<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">125</span><span style="color: #000000;">&#93;</span> == <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textNumero.<span style="color: #0000FF;">Text</span> = Convert.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span>buffer<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">126</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; comboGenero.<span style="color: #0000FF;">SelectedIndex</span> = Convert.<span style="color: #0000FF;">ToInt16</span><span style="color: #000000;">&#40;</span>buffer<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">127</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF;">else</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"IDE3 Tag no disponible"</span>, <span style="color: #808080;">"LuAuF"</span>, MessageBoxButtons.<span style="color: #0000FF;">OK</span>, MessageBoxIcon.<span style="color: #0000FF;">Error</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code><br />
El proyecto para <a href="http://luauf.com/wp-content/uploads/2008/05/id3tag_editor.rar">descargar</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/12/leer-mp3-id3-tag-con-c/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Cliente RSS con .NET LINQ</title>
		<link>http://luauf.com/2008/05/05/cliente-rss-con-net-linq/</link>
		<comments>http://luauf.com/2008/05/05/cliente-rss-con-net-linq/#comments</comments>
		<pubDate>Tue, 06 May 2008 00:25:15 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=242</guid>
		<description><![CDATA[Veremos un pequeño cliente RSS, bajo la forma de aplicación de consola, que utiliza LINQ de .NET para parsear el archivo xml de una forma elegante y concisa. Primero, definimos las clases Channel...]]></description>
			<content:encoded><![CDATA[<p>Veremos un pequeño cliente RSS, bajo la forma de aplicación de consola, que utiliza LINQ de .NET para parsear el archivo xml de una forma elegante y concisa.</p>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/05/rss.jpg"><img class="alignnone size-medium wp-image-244" title="rss" src="http://luauf.com/wp-content/uploads/2008/05/rss-300x126.jpg" alt="" width="300" height="126" /></a></p>
<p><span id="more-242"></span></p>
<p>Primero, definimos las clases Channel e Item, que darán forma a los objetos de un documento RSS:<br />
<code></p>
<div class="syntax_hilite">
<div id="csharp-38">
<div class="csharp"><span style="color: #FF0000;">class</span> Channel<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Title&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Link&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Description <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> IEnumerable&lt;Item&gt;&nbsp; &nbsp; Items&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; <span style="color: #FF0000;">class</span> Item<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Title&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Link&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Description&nbsp; &nbsp;<span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Guid&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code></p>
<p>Luego creamos el método que obtiene (utilizando LINQ) el listado de Items de los Channels del feed:<br />
<code></p>
<div class="syntax_hilite">
<div id="csharp-39">
<div class="csharp"><span style="color: #0600FF;">static</span> IEnumerable&lt;Channel&gt; getChannelQuery<span style="color: #000000;">&#40;</span>XDocument xdoc<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> from channels <span style="color: #0600FF;">in</span> xdoc.<span style="color: #0000FF;">Descendants</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"channel"</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;select <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Channel<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Title = channels.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"title"</span><span style="color: #000000;">&#41;</span> != <span style="color: #0600FF;">null</span> ? channels.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"title"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Value</span> : <span style="color: #808080;">""</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Link = channels.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"link"</span><span style="color: #000000;">&#41;</span> != <span style="color: #0600FF;">null</span> ? channels.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"link"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Value</span> : <span style="color: #808080;">""</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Description = channels.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"description"</span><span style="color: #000000;">&#41;</span> != <span style="color: #0600FF;">null</span> ? channels.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"description"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Value</span> : <span style="color: #808080;">""</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Items = from items <span style="color: #0600FF;">in</span> channels.<span style="color: #0000FF;">Descendants</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"item"</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;select <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Item<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Title = items.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"title"</span><span style="color: #000000;">&#41;</span> != <span style="color: #0600FF;">null</span> ? items.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"title"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Value</span> : <span style="color: #808080;">""</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Link = items.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"link"</span><span style="color: #000000;">&#41;</span> != <span style="color: #0600FF;">null</span> ? items.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"link"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Value</span> : <span style="color: #808080;">""</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Description = items.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"description"</span><span style="color: #000000;">&#41;</span> != <span style="color: #0600FF;">null</span> ? items.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"description"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Value</span> : <span style="color: #808080;">""</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Guid = <span style="color: #000000;">&#40;</span>items.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"guid"</span><span style="color: #000000;">&#41;</span> != <span style="color: #0600FF;">null</span> ? items.<span style="color: #0000FF;">Element</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"guid"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Value</span> : <span style="color: #808080;">""</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#125;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code></p>
<p>Finalmente, le solicitamos al usuario el path del feed a consultar y presentamos las entradas por consola:<br />
<code></p>
<div class="syntax_hilite">
<div id="csharp-40">
<div class="csharp"><span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Cliente RSS con .NET LINQ"</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Ingrese URL de feed RSS:"</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">String</span> feedUri = Console.<span style="color: #0600FF;">In</span>.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var myFeed = getChannelQuery<span style="color: #000000;">&#40;</span>XDocument.<span style="color: #0000FF;">Load</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StreamReader<span style="color: #000000;">&#40;</span>HttpWebRequest.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span>feedUri<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">GetResponse</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">GetResponseStream</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>var item <span style="color: #0600FF;">in</span> myFeed<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"{0} - {1}"</span>, item.<span style="color: #0000FF;">Title</span>, item.<span style="color: #0000FF;">Description</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>var i <span style="color: #0600FF;">in</span> item.<span style="color: #0000FF;">Items</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"{0}"</span>, i.<span style="color: #0000FF;">Title</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Presione cualquier tecla para continuar..."</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code></p>
<p>Vía: <a href="http://www.canerten.com/rss-feed-parser-in-20-lines-with-net-linq/" target="_blank">Coding Day</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/05/cliente-rss-con-net-linq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#: Captura de pantalla (SnapShot)</title>
		<link>http://luauf.com/2008/05/01/c-captura-de-pantalla-snapshot/</link>
		<comments>http://luauf.com/2008/05/01/c-captura-de-pantalla-snapshot/#comments</comments>
		<pubDate>Fri, 02 May 2008 01:27:29 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Snapshot]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=227</guid>
		<description><![CDATA[Tiempo atrás, se publicó como hacer una captura de pantalla (snapshot) en Java. En esta oportunidad, veremos un ejemplo similar, en C# con el .NET framework. A continuación, el ejemplo: static void Main&#40;&#41;...]]></description>
			<content:encoded><![CDATA[<p>Tiempo atrás, se publicó como hacer una <a href="http://luauf.com/2008/04/02/java-captura-de-pantalla-snapshot/">captura de pantalla (snapshot) en Java</a>. En esta oportunidad, veremos un ejemplo similar, en C# con el .NET framework.</p>
<p>A continuación, el ejemplo:</p>
<p><span id="more-227"></span></p>
<p><code>
<div class="syntax_hilite">
<div id="csharp-42">
<div class="csharp"><span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Rectangle region= Screen.<span style="color: #0000FF;">AllScreens</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Bounds</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bitmap bitmap = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Bitmap<span style="color: #000000;">&#40;</span>region.<span style="color: #0000FF;">Width</span>, region.<span style="color: #0000FF;">Height</span>, PixelFormat.<span style="color: #0000FF;">Format32bppPArgb</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Graphics graphic = Graphics.<span style="color: #0000FF;">FromImage</span><span style="color: #000000;">&#40;</span>bitmap<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; graphic.<span style="color: #0000FF;">CopyFromScreen</span><span style="color: #000000;">&#40;</span>region.<span style="color: #0000FF;">Left</span>, region.<span style="color: #0000FF;">Top</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, region.<span style="color: #0000FF;">Size</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bitmap.<span style="color: #0000FF;">Save</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">@"C:\pantalla.jpg"</span>,ImageFormat.<span style="color: #0000FF;">Jpeg</span> <span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/01/c-captura-de-pantalla-snapshot/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Cliente de email en .NET</title>
		<link>http://luauf.com/2008/05/01/cliente-de-email-en-net/</link>
		<comments>http://luauf.com/2008/05/01/cliente-de-email-en-net/#comments</comments>
		<pubDate>Fri, 02 May 2008 00:49:43 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[email]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=226</guid>
		<description><![CDATA[Utilizando el espacio de nombre (namespace) System.Net.Mail, enviar un correo electrónico desde .NET es tarea sencilla. Las clases que utilizaremos son: SmtpClient: permite a la aplicación enviar el mensaje de correo electrónico mediante...]]></description>
			<content:encoded><![CDATA[<p>Utilizando el espacio de nombre (namespace) <a href="http://msdn.microsoft.com/es-es/library/system.net.mail(VS.80).aspx" target="_blank">System.Net.Mail</a>, enviar un correo electrónico desde .NET es tarea sencilla.</p>
<p>Las clases que utilizaremos son:</p>
<ul>
<li><strong>SmtpClient</strong>: permite a la aplicación enviar el mensaje de correo electrónico mediante el protocolo SMTP.</li>
<li><strong>MailMessage</strong>: representa el mensaje de correo electrónico que será enviado mediante la clase SmtpClient.</li>
<li><strong>MailAddress: </strong></span>representa la dirección de un remitente o destinatario de correo electrónico.</li>
<li><strong>NetworkCredential </strong>(esta clase pertenece al namespace System.Net): proporciona la credencial para el esquema de autenticación.</li>
</ul>
<p>Para ejemplificar el uso, veamos directamente un poco de código escrito en C#:</p>
<p><span id="more-226"></span><br />
<code></p>
<div class="syntax_hilite">
<div id="csharp-45">
<div class="csharp"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> buttonEnviar_Click<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mMail m = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> mMail<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m.<span style="color: #0000FF;">From</span><span style="color: #000000;">&#40;</span>textDeCorreo.<span style="color: #0000FF;">Text</span>, textDeNombre.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span>m.<span style="color: #0000FF;">Send</span><span style="color: #000000;">&#40;</span>textAMail.<span style="color: #0000FF;">Text</span>,textAAsunto.<span style="color: #0000FF;">Text</span>,textContenido.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code></p>
<p><code></p>
<div class="syntax_hilite">
<div id="csharp-46">
<div class="csharp"><span style="color: #FF0000;">class</span> mMail<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">String</span> fromMail;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">String</span> fromName;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; SmtpClient client;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> mMail<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> SmtpClient<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #0000FF;">Credentials</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> NetworkCredential<span style="color: #000000;">&#40;</span><span style="color: #808080;">"nombre@servidor.com"</span>, <span style="color: #808080;">"password"</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #0000FF;">Port</span> = <span style="color: #FF0000;">587</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #0000FF;">Host</span> = <span style="color: #808080;">"smtp.gmail.com"</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #0000FF;">EnableSsl</span> = <span style="color: #0600FF;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> From<span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">String</span> fromMail, <span style="color: #FF0000;">String</span> fromName <span style="color: #000000;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">fromMail</span> = fromMail;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">fromName</span> = fromName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">String</span> Send<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span> to, <span style="color: #FF0000;">String</span> subject, <span style="color: #FF0000;">String</span> body<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MailMessage msg = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> MailMessage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.<span style="color: #0000FF;">To</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>to<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.<span style="color: #0000FF;">From</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> MailAddress<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">fromMail</span>, <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">fromName</span> , <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">Encoding</span>.<span style="color: #0000FF;">UTF8</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.<span style="color: #0000FF;">Subject</span> = subject;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.<span style="color: #0000FF;">SubjectEncoding</span> = <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">Encoding</span>.<span style="color: #0000FF;">UTF8</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.<span style="color: #0000FF;">Body</span> = body;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.<span style="color: #0000FF;">BodyEncoding</span> = <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">Encoding</span>.<span style="color: #0000FF;">UTF8</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.<span style="color: #0000FF;">IsBodyHtml</span> = <span style="color: #0600FF;">true</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">client</span>.<span style="color: #0000FF;">Send</span><span style="color: #000000;">&#40;</span>msg<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> <span style="color: #808080;">"Mail enviado correctamente"</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception ex<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> ex.<span style="color: #0000FF;">Message</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/05/01/cliente-de-email-en-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Efecto Matrix en C#</title>
		<link>http://luauf.com/2008/04/30/efecto-matrix-en-c/</link>
		<comments>http://luauf.com/2008/04/30/efecto-matrix-en-c/#comments</comments>
		<pubDate>Thu, 01 May 2008 02:19:03 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Matrix]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=222</guid>
		<description><![CDATA[Este código me pareció interesante de compartir, una modesta recreación del efecto matrix, escrita en C#. #define readkey using System; namespace m7tr1x &#123; &#160; &#160; class Program &#160; &#160; &#123; &#160; &#160; &#160;...]]></description>
			<content:encoded><![CDATA[<p>Este código me pareció interesante de compartir, una modesta recreación del efecto matrix, escrita en C#.</p>
<p style="text-align: center;"><a href="http://luauf.com/wp-content/uploads/2008/04/matrix.png"><img class="alignnone size-medium wp-image-223" title="matrix" src="http://luauf.com/wp-content/uploads/2008/04/matrix-300x173.png" alt="" width="300" height="173" /></a></p>
<p><span id="more-222"></span><br />
<code></p>
<div class="syntax_hilite">
<div id="csharp-48">
<div class="csharp"><span style="color: #008080;">#define readkey</span></p>
<p><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;</p>
<p><span style="color: #0600FF;">namespace</span> m7tr1x<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #FF0000;">class</span> Program<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">Title</span> = <span style="color: #808080;">"tH3 M7tr1x 3ff3&lt;t"</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">ForegroundColor</span> = ConsoleColor.<span style="color: #0000FF;">DarkGreen</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WindowLeft</span> = Console.<span style="color: #0000FF;">WindowTop</span> = <span style="color: #FF0000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WindowHeight</span> = Console.<span style="color: #0000FF;">BufferHeight</span> = Console.<span style="color: #0000FF;">LargestWindowHeight</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WindowWidth</span> = Console.<span style="color: #0000FF;">BufferWidth</span> = Console.<span style="color: #0000FF;">LargestWindowWidth</span>;<br />
<span style="color: #008080;">#if readkey</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"H1T 7NY K3Y T0 C0NT1NU3 =/"</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<span style="color: #008080;">#endif</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">CursorVisible</span> = <span style="color: #0600FF;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> width, height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> l;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Initialize<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">out</span> width, <span style="color: #0600FF;">out</span> height, <span style="color: #0600FF;">out</span> y, <span style="color: #0600FF;">out</span> l<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> ms;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">while</span> <span style="color: #000000;">&#40;</span><span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DateTime t1 = DateTime.<span style="color: #0000FF;">Now</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MatrixStep<span style="color: #000000;">&#40;</span>width, height, y, l<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ms = <span style="color: #FF0000;">10</span> - <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>TimeSpan<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>DateTime.<span style="color: #0000FF;">Now</span> - t1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">TotalMilliseconds</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ms&gt; <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Threading</span>.<span style="color: #0000FF;">Thread</span>.<span style="color: #0000FF;">Sleep</span><span style="color: #000000;">&#40;</span>ms<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>Console.<span style="color: #0000FF;">KeyAvailable</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Key</span> == ConsoleKey.<span style="color: #0000FF;">F5</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Initialize<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">out</span> width, <span style="color: #0600FF;">out</span> height, <span style="color: #0600FF;">out</span> y, <span style="color: #0600FF;">out</span> l<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">bool</span> thistime = <span style="color: #0600FF;">false</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> MatrixStep<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> width, <span style="color: #FF0000;">int</span> height, <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> y, <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> l<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; thistime = !thistime;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span>x = <span style="color: #FF0000;">0</span>; x &lt;width; ++x<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>x % <span style="color: #FF0000;">11</span> == <span style="color: #FF0000;">10</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>!thistime<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">continue</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">ForegroundColor</span> = ConsoleColor.<span style="color: #0000FF;">White</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">ForegroundColor</span> = ConsoleColor.<span style="color: #0000FF;">DarkGreen</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">SetCursorPosition</span><span style="color: #000000;">&#40;</span>x, inBoxY<span style="color: #000000;">&#40;</span>y<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span> - <span style="color: #FF0000;">2</span> - <span style="color: #000000;">&#40;</span>l<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span> / <span style="color: #FF0000;">40</span> * <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>, height<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span>R<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">ForegroundColor</span> = ConsoleColor.<span style="color: #0000FF;">Green</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">SetCursorPosition</span><span style="color: #000000;">&#40;</span>x, y<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span>R<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span> = inBoxY<span style="color: #000000;">&#40;</span>y<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span> + <span style="color: #FF0000;">1</span>, height<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">SetCursorPosition</span><span style="color: #000000;">&#40;</span>x, inBoxY<span style="color: #000000;">&#40;</span>y<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span> - l<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span>, height<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">' '</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Initialize<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">out</span> <span style="color: #FF0000;">int</span> width, <span style="color: #0600FF;">out</span> <span style="color: #FF0000;">int</span> height, <span style="color: #0600FF;">out</span> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> y, <span style="color: #0600FF;">out</span> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> l<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> h1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> h2 = <span style="color: #000000;">&#40;</span>h1 = <span style="color: #000000;">&#40;</span>height = Console.<span style="color: #0000FF;">WindowHeight</span><span style="color: #000000;">&#41;</span> / <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span> / <span style="color: #FF0000;">2</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width = Console.<span style="color: #0000FF;">WindowWidth</span> - <span style="color: #FF0000;">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span>width<span style="color: #000000;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span>width<span style="color: #000000;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">Clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span>x = <span style="color: #FF0000;">0</span>; x &lt;width; ++x<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span> = r.<span style="color: #0000FF;">Next</span><span style="color: #000000;">&#40;</span>height<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span> = r.<span style="color: #0000FF;">Next</span><span style="color: #000000;">&#40;</span>h2 * <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>x % <span style="color: #FF0000;">11</span> != <span style="color: #FF0000;">10</span><span style="color: #000000;">&#41;</span> ? <span style="color: #FF0000;">2</span> : <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span>, h1 * <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>x % <span style="color: #FF0000;">11</span> != <span style="color: #FF0000;">10</span><span style="color: #000000;">&#41;</span> ? <span style="color: #FF0000;">2</span> : <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">static</span> Random r = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Random<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">char</span> R<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">int</span> t = r.<span style="color: #0000FF;">Next</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">10</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>t &lt;= <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">char</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">'0'</span> + r.<span style="color: #0000FF;">Next</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">else</span> <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>t &lt;= <span style="color: #FF0000;">4</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">char</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">'a'</span> + r.<span style="color: #0000FF;">Next</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">27</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">else</span> <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>t &lt;= <span style="color: #FF0000;">6</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">char</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">'A'</span> + r.<span style="color: #0000FF;">Next</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">27</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">char</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>r.<span style="color: #0000FF;">Next</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">32</span>, <span style="color: #FF0000;">255</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">int</span> inBoxY<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> n, <span style="color: #FF0000;">int</span> height<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n = n % height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>n &lt;<span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> n + height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p>
</code><br />
Vía: <a href="http://pastebin.com/f54f15550" target="_blank">pastebin</a></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/04/30/efecto-matrix-en-c/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Lectura secuencial de archivos con C#</title>
		<link>http://luauf.com/2008/04/30/lectura-secuencial-de-archivos-con-c/</link>
		<comments>http://luauf.com/2008/04/30/lectura-secuencial-de-archivos-con-c/#comments</comments>
		<pubDate>Thu, 01 May 2008 02:05:17 +0000</pubDate>
		<dc:creator>Luciano</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://luauf.com/?p=221</guid>
		<description><![CDATA[Tiempo atrás, publiqué Lectura secuencial de archivos con Python. Hoy repito un ejemplo, tan elemental como el anterior, pero realizado con C#. using System; using System.Text; using System.IO; namespace Test_TextFiles &#123; &#160; &#160;...]]></description>
			<content:encoded><![CDATA[<p>Tiempo atrás, publiqué <a href="http://luauf.com/2008/04/10/lectura-secuencial-de-archivos-con-python/" target="_self">Lectura secuencial de archivos con Python</a>. Hoy repito un ejemplo, tan elemental como el anterior, pero realizado con C#.</p>
<p><span id="more-221"></span></p>
<p><code>
<div class="syntax_hilite">
<div id="csharp-50">
<div class="csharp"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;<br />
<span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>;<br />
<span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">IO</span>;</p>
<p><span style="color: #0600FF;">namespace</span> Test_TextFiles<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #FF0000;">class</span> Program<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TextReader trs = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StreamReader<span style="color: #000000;">&#40;</span><span style="color: #808080;">@"C:\test.txt"</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//Lectura de todo el texto del archivo</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//Console.WriteLine(trs.ReadToEnd());</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//o lectura secuencial</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">while</span> <span style="color: #000000;">&#40;</span>trs.<span style="color: #0000FF;">Peek</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>&gt;=<span style="color: #FF0000;">0</span> <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>trs.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; trs.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception e<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>e.<span style="color: #0000FF;">Message</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Presione cualquier tecla para continuar..."</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div>
</div>
</div>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://luauf.com/2008/04/30/lectura-secuencial-de-archivos-con-c/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

