<?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>richard-slater.co.uk &#187; EVEMon</title>
	<atom:link href="http://www.richard-slater.co.uk/archives/tag/evemon/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.richard-slater.co.uk</link>
	<description>Jesus, Life, Programming and Systems Administration</description>
	<lastBuildDate>Sat, 21 Aug 2010 17:40:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using EVEMon Data with LINQPad</title>
		<link>http://www.richard-slater.co.uk/archives/2010/07/31/using-evemon-data-with-linqpad/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/07/31/using-evemon-data-with-linqpad/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 21:52:17 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[EVEMon]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[EVE Online]]></category>
		<category><![CDATA[LINQPad]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=782</guid>
		<description><![CDATA[LINQPad is an awesome aide to .NET Developers. Written by Joseph Albahari of LinqBridge and the C# In a Nutshell series fame. LINQPad allows the developer to write, compile and run C# or VB.NET Expressions, Statements of Programs outside of Visual Studio. Everything I am going to show you in this post can be done [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.linqpad.net">LINQPad</a> is an awesome aide to .NET Developers. Written by Joseph Albahari of <a href="http://www.albahari.com/nutshell/linqbridge.aspx">LinqBridge</a> and the <a href="http://www.albahari.com/nutshell">C# In a Nutshell</a> series fame. LINQPad allows the developer to write, compile and run C# or VB.NET Expressions, Statements of Programs outside of Visual Studio.</p>
<p>Everything I am going to show you in this post can be done with Visual Studio simply by wrapping the text in a new console application, and adding references to the DLLs. However I strongly encourage you to download LINQPad and give it a go.</p>
<p>In the event you are using 64-bit windows and are still using LINQPad 2 you will need to download the <a href="http://www.linqpad.net/Beta.aspx">x86 version</a> of LINQPad 2, as all of the EVEMon assemblies are compiled for x86. If you have LINQPad 4 you don&#8217;t need to worry about.</p>
<p>Assuming you have <a href="http://evemon.battleclinic.com">EVEMon</a> installed, the first step is to load the EVEMon.Common.dll assembly into LINQPad:</p>
<ol>
<li>Go ahead and fire up LINQPad ensure you have a new query window open</li>
<li>Press F4 (Query -> Query Properties).</li>
<li>Click the &#8220;Browse&#8230;&#8221; button at the bottom of the properties window.</li>
<li>Navigate to the EVEMon install directory.</li>
<li>Select &#8220;EVEMon.Common.dll&#8221;</li>
</ol>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/07/LINQPadQueryProperties.png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2010/07/LINQPadQueryProperties.png" alt="" title="LINQPadQueryProperties" width="556" height="223" class="aligncenter size-full wp-image-783" /></a></p>
<p>While you have &#8220;Query Properties&#8221; open go to the &#8220;Additional Namespace Import&#8221; tab and add the following two lines:</p>
<pre>
EVEMon.Common.Data
EVEMon.Common
</pre>
<p>EVEMon.Common was designed to work as part of a long running process, namely the EVEMon application sitting in your system tray from when you turn your computer on until you turn it off, as such we need load the static data from the data files.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">EveClient.<span style="color: #0000FF;">Initialize</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>Now we get to do some LINQ,</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">var allItems <span style="color: #008000;">=</span> from item <span style="color: #0600FF;">in</span> StaticItems.<span style="color: #0000FF;">AllItems</span>
	       where item.<span style="color: #0000FF;">Family</span> <span style="color: #008000;">==</span> ItemFamily.<span style="color: #0000FF;">Ship</span>
	       select <span style="color: #008000;">new</span> 
	       <span style="color: #000000;">&#123;</span>
	           item.<span style="color: #0000FF;">Name</span>,
	           item.<span style="color: #0000FF;">Race</span>,
	           CPU <span style="color: #008000;">=</span> item.<span style="color: #0000FF;">Properties</span><span style="color: #000000;">&#91;</span>DBConstants.<span style="color: #0000FF;">CPUOutputPropertyID</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Value</span>.<span style="color: #0000FF;">Value</span>,
	           PG <span style="color: #008000;">=</span> item.<span style="color: #0000FF;">Properties</span><span style="color: #000000;">&#91;</span>DBConstants.<span style="color: #0000FF;">PGOutputPropertyID</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Value</span>.<span style="color: #0000FF;">Value</span>,
	           item.<span style="color: #0000FF;">Description</span>
	       <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>I could start to explain the above line by line, but there are lots of really good LINQ articles on the Internet, including one by <a href="http://www.linqpad.net/WhyLINQBeatsSQL.aspx">Joseph Albahari</a>. We will just say that the above pulls all of the ships out of EVEMon&#8217;s Items data file and selects the Name, Race, CPU, PowerGrid and Description property for each one.</p>
<p>Now we see my favorite aspect of LINQPad, the .Dump() extension method, simply running the following command:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>14
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">allItems.<span style="color: #0000FF;">Dump</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>Will output the data we have just queried as a nice HTML Table:</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/07/LINQPadDumpShips.png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2010/07/LINQPadDumpShips.png" alt="" title="LINQPadDumpShips" width="574" height="402" class="aligncenter size-full wp-image-784" /></a></p>
<p>That is all I have for you for now, I am working on a project that uses this data outside of EVEMon, keep an eye on <a href="https://twitter.com/richardslater">Twitter</a> where I will hopefully be providing a link for testing in the not too far distant future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/07/31/using-evemon-data-with-linqpad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lack of AutoEllipsis support in ToolStripSystemRenderer</title>
		<link>http://www.richard-slater.co.uk/archives/2010/03/07/lack-of-autoellipsis-support-in-toolstripsystemrenderer/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/03/07/lack-of-autoellipsis-support-in-toolstripsystemrenderer/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 21:03:04 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[EVEMon]]></category>
		<category><![CDATA[WinForms]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=753</guid>
		<description><![CDATA[AutoEllipsis is a property introduced to System.Windows.Forms.Label with .NET 3.0, which in the event of the text overflowing the rendering rectangle of the Label will trim the end and add a Ellipsis (&#8220;…&#8221;), if this does occur the ToolTip for the label will also be set to the full (untrimmed text). Unfortunately this functionality is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.label.autoellipsis%28VS.85%29.aspx">AutoEllipsis</a> is a property introduced to System.Windows.Forms.Label with .NET 3.0, which in the event of the text overflowing the rendering rectangle of the Label will trim the end and add a Ellipsis (&#8220;…&#8221;), if this does occur the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tooltip.aspx">ToolTip</a> for the label will also be set to the full (untrimmed text).</p>
<p>Unfortunately this functionality is not available for <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripstatuslabel.aspx">ToolStripStatusLabel</a>. To make things worse in the event the text overflows it disappears completely. This bug, oversight, feature or whatever you want to call it cause some confusion after the release of EVEMon 1.3.0.1912. Several people assumed the new more verbose status bar was broken, being empty and all.</p>
<p>We put together a kludge fix, which would set the text and if it overflowed try to guess the length with <a href="http://msdn.microsoft.com/en-us/library/6xe5hazb.aspx">Graphics.MeasureString</a>. This worked fairly well, it cause some flickering when resizing the window and would leave a small gap on the right hand side of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.statusstrip.aspx">StatusStrip</a>.</p>
<p>I knew there must be a better way, and seeing an article about the <a href="http://msdn.microsoft.com/en-us/library/system.drawing.stringformat.aspx">StringFormat</a> class reminded me of the need to find it. Searching about a bit found me a post on <a href="http://discuss.joelonsoftware.com/default.asp?dotnet.12.597246.5">Joel on Software</a>, I refined the code a little and came up with this (which is basically identical to Tom&#8217;s solution):</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> AutoEllipsisToolStripRenderer <span style="color: #008000;">:</span> ToolStripSystemRenderer
<span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> OnRenderItemText<span style="color: #000000;">&#40;</span>ToolStripItemTextRenderEventArgs e<span style="color: #000000;">&#41;</span>
  <span style="color: #000000;">&#123;</span>
    ToolStripStatusLabel label <span style="color: #008000;">=</span> e.<span style="color: #0000FF;">Item</span> <span style="color: #0600FF;">as</span> ToolStripStatusLabel<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>label <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">OnRenderItemText</span><span style="color: #000000;">&#40;</span>e<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      return<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    TextRenderer.<span style="color: #0000FF;">DrawText</span><span style="color: #000000;">&#40;</span>e.<span style="color: #0000FF;">Graphics</span>,
      label.<span style="color: #0000FF;">Text</span>,
      label.<span style="color: #0000FF;">Font</span>,
      e.<span style="color: #0000FF;">TextRectangle</span>,
      label.<span style="color: #0000FF;">ForeColor</span>,
      TextFormatFlags.<span style="color: #0000FF;">EndEllipsis</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>You need to wire this code into your StatusStrip:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">MainStatusStrip</span>.<span style="color: #0000FF;">Renderer</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> AutoEllipsisToolStripRenderer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>To the ToolStripStatusLabel will also need it&#8217;s Spring property set to true, and if you want the text left aligned the TextAlign Property will need to be set to MiddleLeft.</p>
<p>If you want the ToolTip to work correctly the StatusStrip will need to have ShowItemToolTips set to work, and the ToolStripStatusLabel AutoToolTip set to true. It isn&#8217;t perfect as the ToolTip is displayed when the text is not truncated, but it is close enough for my purposes.</p>
<p>I am exploring WPF at the moment, I was glad to see the default behaviour of a <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.statusbar.aspx">StatusBar</a> was to just stop rendering the text at the bounds of control, an ellipsis could be added with the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.textblock.texttrimming.aspx">TextTrimming</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.textblock.textwrapping.aspx">TextWraping</a> properties:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;statusbar</span> <span style="color: #000066;">HorizontalAlignment</span>=<span style="color: #ff0000;">&quot;Left&quot;</span> <span style="color: #000066;">Margin</span>=<span style="color: #ff0000;">&quot;0,102,0,0&quot;</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;MainStatusBar&quot;</span> <span style="color: #000066;">VerticalAlignment</span>=<span style="color: #ff0000;">&quot;Top&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;statusbaritem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textblock</span> <span style="color: #000066;">TextWrapping</span>=<span style="color: #ff0000;">&quot;NoWrap&quot;</span> <span style="color: #000066;">TextTrimming</span>=<span style="color: #ff0000;">&quot;CharacterEllipsis&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            Some Text Goes Here, this text may be very long as demonstrated here. In the event we run out of space an ellipsis is used.
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/textblock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/statusbaritem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/statusbar<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/03/07/lack-of-autoellipsis-support-in-toolstripsystemrenderer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Preventing the PictureBox control from locking files</title>
		<link>http://www.richard-slater.co.uk/archives/2010/02/28/preventing-the-picturebox-control-from-locking-files/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/02/28/preventing-the-picturebox-control-from-locking-files/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 20:18:58 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[EVEMon]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=739</guid>
		<description><![CDATA[One of our more regular contributors to EVEMon posted on our forums showing that the application was incapable of updating cached files (specifically images), after a bit testing I discovered the following Exception was being thrown when trying to overwrite the file in question: System.IO.IOException: The process cannot access the file 'path\filename' because it is [...]]]></description>
			<content:encoded><![CDATA[<p>One of our more regular contributors to <a href="http://evemon.battleclinic.com/">EVEMon</a> posted on our forums showing that the application was incapable of updating cached files (specifically images), after a bit testing I discovered the following Exception was being thrown when trying to overwrite the file in question:</p>
<pre>System.IO.IOException: The process cannot access the file 'path\filename' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at EVEMon.Common.FileHelper.OverwriteOrWarnTheUser(String srcFileName, String destFileName) in EVEMon.Common\FileHelper.cs:line 108
   at EVEMon.Common.FileHelper.OverwriteOrWarnTheUser(String destFileName, Func`2 writeContentFunc) in EVEMon.Common\FileHelper.cs:line 82
   at EVEMon.Common.Controls.CharacterPortrait.SavePortraitToCache(Image newImage) in EVEMon.Common\Controls\CharacterPortrait.cs:line 248
</pre>
<p>After a bit of searching around I discovered a <a href="http://stackoverflow.com/questions/2188464/net-app-locks-file">post on StackOverflow</a> identifying that System.Drawing.Bitmap(string filename) would lock the filename until the Bitmap was disposed of. The post presented a solution but no code, A bit of further searching confirmed my expectation that <a href="http://msdn.microsoft.com/en-us/library/4sahykhd.aspx">Image.FromFile(string filename)</a> was subject to the same locking behaviour:</p>
<blockquote><p>The file remains locked until the <a id="ctl00_MTCS_main_ctl51_ctl00_ctl00" onclick="javascript:Track('ctl00_MTCS_main_ctl51_ctl00_contenthere|ctl00_MTCS_main_ctl51_ctl00_ctl00',this);" href="http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx">Image</a> is disposed.</p></blockquote>
<p>A bit more searching identified another <a href="http://stackoverflow.com/questions/542217/load-a-bitmapsource-and-save-using-the-same-name-in-wpf-ioexception">post on StackOverflow</a> which gave me the basic syntax and structure for the code I was going to need to implement this in EVEMon. The final code looks like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>189
190
191
192
193
194
195
196
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">MemoryStream stream <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MemoryStream<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> imageBytes <span style="color: #008000;">=</span> File.<span style="color: #0000FF;">ReadAllBytes</span><span style="color: #000000;">&#40;</span>cacheFileName<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
stream.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span>imageBytes, <span style="color: #FF0000;">0</span>, imageBytes.<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
stream.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp;
var image <span style="color: #008000;">=</span> Image.<span style="color: #0000FF;">FromStream</span><span style="color: #000000;">&#40;</span>stream<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">return</span> image<span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>It appears that GDI+ will lock any image that is loaded into a control in WinForms and WPF, several comments on StackOverflow and byte.com suggested that even disposing of the control and the FileStream was not a reliable way of being able to write to the file so the above method is seems to be be the best solution all round.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/02/28/preventing-the-picturebox-control-from-locking-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing EVEMon&#8217;s Crashy C++ DLLs</title>
		<link>http://www.richard-slater.co.uk/archives/2009/04/18/evemons-crashy-dlls/</link>
		<comments>http://www.richard-slater.co.uk/archives/2009/04/18/evemons-crashy-dlls/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 19:22:06 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[EVE Online]]></category>
		<category><![CDATA[EVEMon]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=628</guid>
		<description><![CDATA[I have been working on EVEMon for about two months now, taking on the responsibility of committing changes to the trunk, fixing bugs and adding new features. As a project I have been involved for several years submitting bug fixes and little features, it was down to my experiences with EVEMon that I decided to [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on <a href="http://evemon.battleclinic.com/">EVEMon</a> for about two months now, taking on the responsibility of committing changes to the trunk, fixing bugs and adding new features. As a project I have been involved for several years submitting bug fixes and little features, it was down to my experiences with EVEMon that I decided to implement <a class='wikipedia' href='http://en.wikipedia.org/wiki/Subversion_%28software%29' title='Wikipedia article on Subversion (software)'>Subversion</a> and <a href="http://trac.edgewall.org/">Trac</a> at work.</p>
<p>Unfortunately the first time it came to me to be responsible for a release, it seemed to go terribly wrong. The updated installer worked fine, and it seemed initially there were no problems with the updated code base. However BattleClinic shortly went a little mad with bug reports similar to this one:</p>
<blockquote><p>EVEMon Version: 1.2.7.1283<br />
.NET Runtime Version: 2.0.50727.1434<br />
Operating System: Microsoft Windows NT 6.0.6001 Service Pack 1<br />
Executable Path: &#8220;C:\Program Files\EVEMon\EVEMon.exe&#8221;</p>
<p>System.IO.FileLoadException: Could not load file or assembly &#8216;lgLCDNETWrapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null&#8217; or one of its dependencies. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)<br />
File name: &#8216;lgLCDNETWrapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null&#8217; &#8212;&gt; System.Runtime.InteropServices.COMException (0x800736B1): The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)<br />
at EVEMon.LogitechG15.Lcdisplay.Dispose(Boolean bDisposing)<br />
at EVEMon.LogitechG15.Lcdisplay.Finalize() in D:\EVEMon\EveMon.LogitechG15\Lcdisplay.cs:line 70</p></blockquote>
<p>For those who are not familiar the above is the crash report generated by EVEMon when a .NET exception is unhandled. lgLCDNETWrapper is the C++ library EVEMon uses to communicate with the <a href="http://www.logitech.com/index.cfm/keyboards/keyboard/devices/3498&amp;cl=US,EN">Logitech G15</a>. A similar error was generated for EVEMons other C++ component the window relocator.</p>
<p><a href="http://www.battleclinic.com/forum/index.php?action=profile;u=23955">Tonto Auri</a> quickly spotted that the problem was something to do with the re-compiled C++ DLLs and switching the new DLLs with those from an older package resolved the problems. Whilst this was a fix, I wasn&#8217;t willing to just revert the changes and give up on the changes we had made to the G15 library, additionally I was concerned that we had not made changes to the window relocation code and that was causing at least one person a problem.</p>
<p>Quite a bit of searching about with Google and <a href="http://stackoverflow.com/">Stack Overflow</a> resulting in finding these two little gems of information:</p>
<ul>
<li><a href="http://stackoverflow.com/questions/230715/mixed-mode-library-and-crt-dependencies-help">Mixed Mode Library and CRT Dependencies</a> (Stack Overflow)</li>
<li><a href="http://www.nuonsoft.com/blog/2008/10/29/binding-to-the-most-recent-visual-studio-libraries/">Binding to the most recent Visual Studio Libraries</a> (Nuonsoft)</li>
</ul>
<p>These two posts basically gave me the tools and the knowledge to fix EVEMon&#8217;s problems.</p>
<p>First I made the sudden (and &#8220;facepalm&#8221;) realization that EVEMon deployed the Visual Studio 2005 Redistributable; we had moved to Visual Studio 2008 SP1 about a month before the release of 1.2.7. I confirmed this with the <a href="http://www.dependencywalker.com/">Dependency Walker</a> utility, by walking lgLCDNETWrapper.dll I was able to confirm that version 9.0.21022.8 of the Microsoft CRT Library (Microsoft.VC90.CRT) would be required.</p>
<p>The next trick was figuring out which re-distributables to deploy with EVEMon to ensure the end user would have all the dependencies required to use all of the features; frustratingly it seems that Microsoft only bundles the latest version of the re-distributables with Visual Studio 2008 and that was version 9.0.30729.1 which was not going to cut it.</p>
<p>Enter Nuonsofts excellent article providing a step by step guide on adding the required compiler flags to ensure the latest version of the CRT was bound. I did find a nice GUI resource editor that was capable of getting the manifests out in <a href="http://www.wilsonc.demon.co.uk/d10resourceeditor.htm">XN Resource Editor</a> which made the process a little faster.</p>
<p>A little bit of hacking later the updated Visual Studio 2008 SP1 CRT DLLs and manifest file were deployed to the Microsoft.VC90.CRT folder within the EVEMon program files directory as the VC80 CRT libraries were in the past and the two C++ projects were setup to bind to the latest version with the _BIND_TO_CURRENT_CRT_VERSION=1 preprocessor definition.</p>
<p>A bit more poking arround with XN Resource Editor and Dependency Walker showed we were now in a far better position to have a working copy of EVEMon in the hands of our end users.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2009/04/18/evemons-crashy-dlls/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
