<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Sergei Meleshchuk - Random Notes</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/sergeim/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/sergeim/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 05:28:50 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Simplest WCF REST Web Service</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/simplest-wcf-rest-web-service</link>
      <pubDate>Thu, 25 Jan 2018 01:52:08 GMT</pubDate>
      <dc:creator><![CDATA[Sergei B. Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/?p=145</guid>
      <description><![CDATA[WCF allows to create a web site exposing WCF service and service endpoints. REST Web Service does...]]></description>
      <content:encoded><![CDATA[WCF allows to create a web site exposing WCF service and service endpoints. REST Web Service does not use SOAP, but returns data as JSON or XML instead.

WCF service is a DLL which should be hosted in a desktop application, or IIS.

This post is about how to create a very simple WCF REST Web Service hosted in IIS. Practical problems are:
<ul>
 	<li>What is the simplest Service.svc file such that the service will be hosted in IIS;</li>
 	<li>What is the simplest Web.Config file, given that our beloved bindings such as binding="basicHttpsBinding" and such won’t work with REST services (those are for SOAP envelopes). We need webHttpBinding instead!</li>
 	<li>How to manage whether the service will return JSON or XML;</li>
 	<li>How to map which parts of the URL map to which service method arguments.</li>
</ul>
<h1>Usual part</h1>
Usual interface and implementation could be in two files, or in one file.

File <strong>IService1.cs</strong>
<pre>using System.ServiceModel;
using System.ServiceModel.Web;

namespace SimplestWcfWebService
{
  [ServiceContract]
  public interface IService1
  {
    [OperationContract]
    [WebGet(UriTemplate = "Ping",
    ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json)]
    string Ping();

    [OperationContract]
    [WebGet(UriTemplate = "Bounce/{value}",
    ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json)]
    string Bounce(string value);
  }
}</pre>
&nbsp;

File <strong>Service1.svc.cs</strong>
<pre>namespace SimplestWcfWebService
{
  public class Service1 : IService1
  {
    public string Ping()
    {
      return "Ping!";
    }
    public string Bounce(string value)
    {
      return $"You entered: {value}";
    }
  }
}</pre>
That’s basically all the code.
<h1>Set up IIS hosting</h1>
File <strong>Service1.svc</strong>
<pre>&lt;%@ ServiceHost Language="C#" Debug="true" Service="SimplestWcfWebService.Service1"
                Factory="System.ServiceModel.Activation.WebServiceHostFactory"
                CodeBehind="Service1.svc.cs" %&gt;

</pre>
What is important here is the Factory attribute. Presence of this attribute will trigger, when processing the first REST request, creation of a host object living in IIS. The host will be hosting your custom DLL, which will be processing the requests.
<h1>Web.config file</h1>
Cool news is that the Web.config can be just empty: the below content is sufficient.

File <strong>Web.config</strong>
<pre>&lt;?xml version="1.0"?&gt;
&lt;configuration&gt;
&lt;/configuration&gt;</pre>
<h1>Finishing VS project</h1>
Nothing else, actually. You need to have references in the .csproj file.

File <strong>SimplestWcfWebService.csproj</strong>
<pre>&lt;Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
&lt;Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /&gt;
&lt;PropertyGroup&gt;
&lt;Configuration Condition=" '$(Configuration)' == '' "&gt;Debug&lt;/Configuration&gt;
&lt;Platform Condition=" '$(Platform)' == '' "&gt;AnyCPU&lt;/Platform&gt;
&lt;ProductVersion&gt;
&lt;/ProductVersion&gt;
&lt;SchemaVersion&gt;2.0&lt;/SchemaVersion&gt;
&lt;ProjectGuid&gt;{5FE2D554-CC0D-4349-B112-2F4FBFE0E7EF}&lt;/ProjectGuid&gt;
&lt;ProjectTypeGuids&gt;{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}&lt;/ProjectTypeGuids&gt;
&lt;OutputType&gt;Library&lt;/OutputType&gt;
&lt;AppDesignerFolder&gt;Properties&lt;/AppDesignerFolder&gt;
&lt;RootNamespace&gt;SimplestWcfWebService&lt;/RootNamespace&gt;
&lt;AssemblyName&gt;SimplestWcfWebService&lt;/AssemblyName&gt;
&lt;TargetFrameworkVersion&gt;v4.7.1&lt;/TargetFrameworkVersion&gt;
&lt;WcfConfigValidationEnabled&gt;True&lt;/WcfConfigValidationEnabled&gt;
&lt;AutoGenerateBindingRedirects&gt;true&lt;/AutoGenerateBindingRedirects&gt;
&lt;UseIISExpress&gt;true&lt;/UseIISExpress&gt;
&lt;Use64BitIISExpress /&gt;
&lt;IISExpressSSLPort /&gt;
&lt;IISExpressAnonymousAuthentication /&gt;
&lt;IISExpressWindowsAuthentication /&gt;
&lt;IISExpressUseClassicPipelineMode /&gt;
&lt;UseGlobalApplicationHostFile /&gt;
&lt;/PropertyGroup&gt;
&lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "&gt;
&lt;DebugSymbols&gt;true&lt;/DebugSymbols&gt;
&lt;DebugType&gt;full&lt;/DebugType&gt;
&lt;Optimize&gt;false&lt;/Optimize&gt;
&lt;OutputPath&gt;bin\&lt;/OutputPath&gt;
&lt;DefineConstants&gt;DEBUG;TRACE&lt;/DefineConstants&gt;
&lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
&lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
&lt;/PropertyGroup&gt;
&lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "&gt;
&lt;DebugType&gt;pdbonly&lt;/DebugType&gt;
&lt;Optimize&gt;true&lt;/Optimize&gt;
&lt;OutputPath&gt;bin\&lt;/OutputPath&gt;
&lt;DefineConstants&gt;TRACE&lt;/DefineConstants&gt;
&lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
&lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
&lt;/PropertyGroup&gt;
&lt;ItemGroup&gt;
&lt;Reference Include="Microsoft.CSharp" /&gt;
&lt;Reference Include="System.Web.DynamicData" /&gt;
&lt;Reference Include="System.Web.Entity" /&gt;
&lt;Reference Include="System.Web.ApplicationServices" /&gt;
&lt;Reference Include="System" /&gt;
&lt;Reference Include="System.Configuration" /&gt;
&lt;Reference Include="System.Core" /&gt;
&lt;Reference Include="System.Data" /&gt;
&lt;Reference Include="System.Drawing" /&gt;
&lt;Reference Include="System.EnterpriseServices" /&gt;
&lt;Reference Include="System.Runtime.Serialization" /&gt;
&lt;Reference Include="System.ServiceModel" /&gt;
&lt;Reference Include="System.ServiceModel.Web" /&gt;
&lt;Reference Include="System.Web" /&gt;
&lt;Reference Include="System.Web.Extensions" /&gt;
&lt;Reference Include="System.Web.Services" /&gt;
&lt;Reference Include="System.Xml" /&gt;
&lt;Reference Include="System.Xml.Linq" /&gt;
&lt;/ItemGroup&gt;
&lt;ItemGroup&gt;
&lt;Content Include="Service1.svc" /&gt;
&lt;Content Include="Web.config" /&gt;
&lt;/ItemGroup&gt;
&lt;ItemGroup&gt;
&lt;Compile Include="Service1.svc.cs"&gt;
&lt;DependentUpon&gt;Service1.svc&lt;/DependentUpon&gt;
&lt;/Compile&gt;
&lt;Compile Include="IService1.cs" /&gt;
&lt;Compile Include="Properties\AssemblyInfo.cs" /&gt;
&lt;/ItemGroup&gt;
&lt;ItemGroup&gt;
&lt;Folder Include="App_Data\" /&gt;
&lt;/ItemGroup&gt;
&lt;ItemGroup&gt;
&lt;None Include="Web.Debug.config"&gt;
&lt;DependentUpon&gt;Web.config&lt;/DependentUpon&gt;
&lt;/None&gt;
&lt;None Include="Web.Release.config"&gt;
&lt;DependentUpon&gt;Web.config&lt;/DependentUpon&gt;
&lt;/None&gt;
&lt;/ItemGroup&gt;
&lt;PropertyGroup&gt;
&lt;VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''"&gt;10.0&lt;/VisualStudioVersion&gt;
&lt;VSToolsPath Condition="'$(VSToolsPath)' == ''"&gt;$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)&lt;/VSToolsPath&gt;
&lt;/PropertyGroup&gt;
&lt;Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /&gt;
&lt;Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /&gt;
&lt;Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /&gt;
&lt;ProjectExtensions&gt;
&lt;VisualStudio&gt;
&lt;FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"&gt;
&lt;WebProjectProperties&gt;
&lt;UseIIS&gt;True&lt;/UseIIS&gt;
&lt;AutoAssignPort&gt;True&lt;/AutoAssignPort&gt;
&lt;DevelopmentServerPort&gt;38062&lt;/DevelopmentServerPort&gt;
&lt;DevelopmentServerVPath&gt;/&lt;/DevelopmentServerVPath&gt;
&lt;IISUrl&gt;http://localhost:38062/&lt;/IISUrl&gt;
&lt;NTLMAuthentication&gt;False&lt;/NTLMAuthentication&gt;
&lt;UseCustomServer&gt;False&lt;/UseCustomServer&gt;
&lt;CustomServerUrl&gt;
&lt;/CustomServerUrl&gt;
&lt;SaveServerSettingsInUserFile&gt;False&lt;/SaveServerSettingsInUserFile&gt;
&lt;/WebProjectProperties&gt;
&lt;/FlavorProperties&gt;
&lt;/VisualStudio&gt;
&lt;/ProjectExtensions&gt;
&lt;!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
&lt;Target Name="BeforeBuild"&gt;
&lt;/Target&gt;
&lt;Target Name="AfterBuild"&gt;
&lt;/Target&gt;
--&gt;
&lt;/Project&gt;</pre>
<h1>Setting up IIS site</h1>
If your project files are in C:\GitHub\sergeim\web\SimplestWcfWebService\SimplestWcfWebService, do, using the IIS manager:
<ul>
 	<li>Right-click on Default Web Site and “Add Application”</li>
 	<li>Set Alias as SimplestWcfWebService, and Physical path as C:\GitHub\sergeim\web\SimplestWcfWebService\SimplestWcfWebService</li>
 	<li>Click OK</li>
</ul>
Now, if you enter in Chrome browser, the URL

<a href="http://localhost/SimplestWcfWebService/Service1.svc/bounce/Hi%20there">http://localhost/SimplestWcfWebService/Service1.svc/bounce/Hi%20there</a>

then you will get the page

"You entered: Hi there"

And this is how Chrome renders the JSON-formatted response.

Edge behaves similarly: Now, from another machine, enter URL

<a href="http://b88h11-32/SimplestWcfWebService/Service1.svc/bounce/Hi%20there">http://b88h11-32/SimplestWcfWebService/Service1.svc/bounce/Hi%20there</a>

and you get same rendering

"You entered: Hi there"

However, IE behaves a little differently.

Anyway, due to your actual web service consumer will be the code, the code will have to parse the JSON from the response. Thus we don’t care too much about variations in browser rendering.]]></content:encoded>
    </item>
    <item>
      <title>Tracing application via ETW in .NET 4.5</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/tracing-application-via-etw-in-net-4-5</link>
      <pubDate>Sat, 07 Sep 2013 00:37:09 GMT</pubDate>
      <dc:creator><![CDATA[Sergei B. Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/2013/09/07/tracing-application-via-etw-in-net-4-5/</guid>
      <description><![CDATA[Starting with .NET FX 4.5, use of ETW for logging becomes really practical. The ETW has numerous...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;"><span style="font-family: Calibri;">Starting with .NET FX 4.5, use of ETW for logging becomes really practical. The ETW has numerous advantages over writing traces (logs) to text files, and over tracing options available in earlier FX versions. Not only it&rsquo;s faster than <em>anything else</em>, it&rsquo;s also reliable: you are not losing the last trace record if your application crashes. </span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">You are also not losing a single trace record, if your computer blue-screens. This options requires some setup. Other (and numerous) advantages are discussed elsewhere.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">You can also change tracing levels, tracing groups without restarting the application. The list of virtues goes on.</span></span></p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">Problem</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">There is a practical difficulty: How to start using the ETW in FX 4.5 with at least minimal functionality. Like mimic the trace records written to a log file with e.g. Console.WriteLine.</span></span></p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">Basic Tracing &ndash; Code Side</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">I want to write two lines (records, log entries, traces) to a trace (to a log), which would be the ETW-based log. I am only interested in writing strings. I don&rsquo;t care, at the moment, about setting trace levels, trace groups (markers of groups of tracing statements). Nothing special.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">How do I do this?</span></span></p>
<ol>
<li><span style="font-size: small;"><span style="font-family: Calibri;">Pick up a name for your trace method. For example, &ldquo;Trace&rdquo;. We will also need a name for the &ldquo;tracing class&rdquo; &ndash; the class, which will contain the method &ldquo;Trace&rdquo;. For example, let the class name be the &ldquo;Tracer&rdquo;.</span></span></li>
<li><span style="font-family: Calibri; font-size: small;">Now, code the tracing support class &ndash; the Tracer:<br /> <br /> </span>&nbsp;private class Tracer : EventSource</li>
</ol>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void Trace(string message)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WriteEvent(1, message);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3. Do the needed tracing in the application:<br /> <br /> </span>private void Run()</p>
<p>{</p>
<p>&nbsp;&nbsp;&nbsp; var log = new Tracer();</p>
<p>&nbsp;&nbsp;&nbsp; Console.WriteLine(log.Guid);</p>
<p>&nbsp;&nbsp;&nbsp; int testCount = 100;</p>
<p>&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; testCount; i++)</p>
<p>&nbsp;&nbsp;&nbsp; {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var data = string.Format("This is line {0}", i);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.Trace(data);</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p>}</p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">This is it. Nothing else is needed.</span></span></p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">Basic Tracing &ndash; Other Side: &ldquo;logman&rdquo;</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Run the program. Change the number or repetitions to one million. Run gain. It will be instantaneous. This is because there is no actual logging. Logging should have been activated first.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">To activate logging, in the elevated command prompt, type (in one line):<br /> </span><strong>logman create trace mytrace -p {da97437f-63db-5ccd-8c1f-2e8598d8df67} -o c:\mylogs\mytrace.etl -ets</strong></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">&lt;Here you run the tracing program again&gt;</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">To stop logging, type<br /> </span><strong>logman stop mytrace &ndash;ets</strong><strong></strong></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Now, change the number of repetition again to a million. Again, it is almost instantaneous. While the sustained rate is typically lower, it&rsquo;s still very, very fast.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The &ldquo;logman&rdquo; utility is part of the OS; no need to install it. The logman is not the only utility to control the logging &ndash; there are many other ways, including XPERF, and many more. The logman is probably the least amount of hassle. Of course, you can script the logman invocations, or control the logging from code.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Now: How to view the resulting trace?</span></span></p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">Decoding ETL File</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">There are two ways. This section describes the first way, not very convenient, but readily available in the OS.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The trace (log) result is in the binary format. Each log line not only contains your data, but, in addition, a set of items like high-resolution timestamp, process and thread identifier, log level and what was earlier named, in ETL, &ldquo;flags&rdquo; &ndash; a lot extended though.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Anyway, there is need to decode the binary ETL file &ndash; that is, to convert to a textual form.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">To convert the ETL file into textual (XML) representation, enter</span></span></p>
<p><strong>tracerpt </strong><strong>c:\mylogs\mytrace.etl</strong></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The tracerpt utility has many more options. In particular, it allows to select from a set of output formats. </span></span></p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">DecodeEtl3</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The second way [to decode ETL files] is to use a custom decoder.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">For example, there is a DecodeEtl3 utility, which can be downloaded from </span><a href="http://sergeim.azurewebsites.net/"><span style="color: #0563c1; font-family: Calibri; font-size: small;">http://sergeim.azurewebsites.net</span></a><span style="font-size: small;"><span style="font-family: Calibri;">. It can only decode the ETL &ldquo;version 3&rdquo; files &ndash; the files which we are working with (emitted by .NET FX 4.5 EventSource). Another limitation is that this utility can only decode the trace records created by the WriteEvent(1, message) overload &ndash; the one we used in the above example. The output looks like below:</span></span></p>
<p class="cc"><span style="font-size: small;"><span style="font-family: Courier New;">DecodeEtl3.exe trace3.etl</span></span></p>
<p class="cc"><span style="font-size: small;"><span style="font-family: Courier New;">08/29/2013-20:01:36.309579 PID:0x3A94 TID:0x1DBC This is line 0</span></span></p>
<p class="cc"><span style="font-size: small;"><span style="font-family: Courier New;">08/29/2013-20:01:36.309582 PID:0x3A94 TID:0x1DBC This is line 1</span></span></p>
<p class="cc"><span style="font-size: small;"><span style="font-family: Courier New;">08/29/2013-20:01:36.309584 PID:0x3A94 TID:0x1DBC This is line 2</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The DecodeEtl3 has a set of options, like &ldquo;/short&rdquo;:</span></span></p>
<p class="cc"><span style="font-size: small;"><span style="font-family: Courier New;">DecodeEtl3.exe /short trace3.etl</span></span></p>
<p class="cc"><span style="font-size: small;"><span style="font-family: Courier New;">This is line 0</span></span></p>
<p class="cc"><span style="font-size: small;"><span style="font-family: Courier New;">This is line 1</span></span></p>
<p class="cc"><span style="font-size: small;"><span style="font-family: Courier New;">This is line 2</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Custom Post-Authentication in Federated Authentication Scenarios</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/custom-post-authentication-in-federated-authentication-scenarios</link>
      <pubDate>Tue, 20 Aug 2013 12:01:00 GMT</pubDate>
      <dc:creator><![CDATA[Sergei B. Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/2013/08/20/custom-post-authentication-in-federated-authentication-scenarios/</guid>
      <description><![CDATA[With .NET Framework 4.5 the federated authentication is comparatively easy, the biggest work being...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;"><span style="font-family: Calibri;">With .NET Framework 4.5 the federated authentication is comparatively easy, the biggest work being preparation of the configuration file as a part of a setup.</span></span></p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">&ldquo;Plain&rdquo; federated authentication</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Basically, there is no need to write code, except modifications of the configuration file, and some onboarding process, which depends on authentication provider (aka identity provider, or STS)and may be very simple. Below is a short overview of what happens during federated authentication.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The application receives the first GET request from a user. The request is intercepted by the federation Http modules, then redirected to identity provider (STS), then redirected back to your application via POST from STS, where the POST carries some 50K encrypted authentication data. The federation Http modules decrypt and validate the authentication data, write authentication cookies (or references to cookies, which is the default in case of FX 4.5). Then the http authentication module triggers a redirect to itself, so that to receive almost original GET request, this time the request having been authenticated, as proved by authentication cookies. Further interaction between the client and your application goes on, for a while, without trips to STS. No code needs be developed to support the federated authentication as described above.</span></span></p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">Post authentication</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Now what if an application needs to perform additional checks, like custom validation of client certificates, or checks against the local AD (aka resource AD, or RP AD)? </span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Those post-authentication additional checks (steps) are such that if they fails, the whole authentication should be nullified. That is, the user&rsquo;s authenticated status should be annihilated, and the STS should be notified so that it will forget the user.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">By far the trickiest parts, in post-authentication, implementation-wise, are:</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">-</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">Where to insert the call to the post-authentication procedure (implementing the post-authentication checks), so that the checks will happen at the earliest possible time, when the very temporary status of being authenticated can&rsquo;t do any harm.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">-</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: small;"><span style="font-family: Calibri;">How to prevent the federation Http modules from writing the authentication cookies into the response to the client. The cookies should be suppressed, even though the STS already endorsed (authenticated) the user.</span></span></p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">Where to insert the post-authentication checks</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">As mentioned earlier, the STS authenticates the user, then redirects the auth data to the application via POST. The application receives the POST, the POST containing the set of claims from the STS. This set is packaged within an approx. 50 K blob. The only place to call post-authentication code is where the blob is decrypted (by Federation authentication infrastructure) and de-serialized. It is at this point the set of claims in clear is available to the post-authentication code.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">So, where is this place? Well, it&rsquo;s well hidden, and nearly impossible to find, unless you had the (quite a bit of) time to read most of ADFS documentation &hellip;</span></span></p>
<h2><span style="font-size: medium;"><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">Derive from WSFederationAuthenticationModule</span></span></span></h2>
<p><span style="font-family: Calibri; font-size: small;">First, derive a class from the &ldquo;</span>System.IdentityModel.Services.WSFederationAuthenticationModule<span style="font-size: small;"><span style="font-family: Calibri;">&rdquo;, let it be FedAuthenticationModule:</span></span></p>
<p>public class FedAuthenticationModule : WSFederationAuthenticationModule</p>
<h2><span style="font-size: medium;"><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">Override the OnAuthenticateRequest</span></span></span></h2>
<p><span style="font-family: Calibri; font-size: small;">Next, override the method, and, critically important, don&rsquo;t forget to call the base class:<br /> </span>protected override void OnAuthenticateRequest(object sender, EventArgs e)<br /> {<br /> &nbsp;&nbsp;&nbsp; base.OnAuthenticateRequest(sender, e);<br /> }</p>
<h2><span style="font-size: medium;"><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">Now the Magic Part</span></span></span></h2>
<p><span style="font-family: Calibri; font-size: small;">And it is here where the magic starts happening. The base.OnAuthenticateRequest calls the OnSessionSecurityTokenCreated, for which *you* also supply an override:<br /> </span>protected override void OnSessionSecurityTokenCreated(<br /> &nbsp; SessionSecurityTokenCreatedEventArgs args)</p>
<h2><span style="font-size: medium;"><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">OnSessionSecurityTokenCreated</span></span></span></h2>
<p>This override (callback, as old-timers name it) is the sweet spot to do additional authentication work. This is because it is at this point the authentication blob from the STS has been fully decrypted and deserialized into a set of claims, being now easily accessible from your supplementary post-authentication code.</p>
<p><span style="font-family: Calibri; font-size: small;">In the OnSessionSecurityTokenCreated override, you call your post-authentication code:<br /> <br /> </span>var token = args.SessionToken;<br />var success = PostAuthChecks(token);</p>
<p>Here, depending on the success of the PostAuthChecks, either accept the almost-completed authentication, or force it to fail.</p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">How to force the authentication to fail</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Now, the STS already authenticated the user. We want, however, to hard-stop the authentication procedure &ldquo;on track&rdquo;, so that the user will a) never knows about success and b) cannot take advantage of authentication success, from the STS point of view.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">In other words, we need to suppress the default behavior of the Session Authentication Module: write the authentication cookies to the response to the user.</span></span></p>
<h1><span style="color: #2e74b5;"><span style="font-family: Calibri Light;">How to Suppress Writing the Authentication Cookies</span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">If the post-authentication checks fail, the best place to suppress writing the auth cookies into the response is right in the OnSessionSecurityTokenCreated override:</span></span></p>
<p>args.WriteSessionCookie = false;</p>
<p>The full code looks like below:</p>
<p>protected override void OnSessionSecurityTokenCreated(<br /> &nbsp; SessionSecurityTokenCreatedEventArgs args)<br />&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp; Wpp.Trace(Wpp.TL_VERBOSE, Wpp.TF_COMPONENT, "OnSessionSecurityTokenCreated");<br />&nbsp;&nbsp;&nbsp;&nbsp; var token = args.SessionToken;<br />&nbsp;&nbsp;&nbsp;&nbsp; var success = PostAuthChecks (token);<br />&nbsp;&nbsp;&nbsp;&nbsp; if (success)<br />&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // one of 2 cases: 1) login and SC names match OR 2)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; names don't match, but after second connect to STS and filling in the name-<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matching SC into the<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // credentials dialog, the names became matching. Also case 3) - dev<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mode without certificate and without SC.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wpp.Trace(Wpp.TL_INFO, Wpp.TF_COMPONENT,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "User successfully authenticated, will create the FedAuth cookie shortly");<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // cases include:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 1) first connect to STS resulted in SC and login names mismatch<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 2) all failure cases, including case when user failed<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to provide credentials on second connect to STS<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wpp.Trace(Wpp.TL_WARN, Wpp.TF_COMPONENT,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "OnSessionSecurityTokenCreated: Blocking creation of FedAuth cookie");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Suppress serializing the token reference into the cookie format, <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and attaching<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the cookie to the response<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; args.WriteSessionCookie = false;<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;}</p>]]></content:encoded>
    </item>
    <item>
      <title>Amazing C++</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/amazing-c</link>
      <pubDate>Thu, 30 Jun 2011 01:52:57 GMT</pubDate>
      <dc:creator><![CDATA[Sergei Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/2011/06/30/amazing-c/</guid>
      <description><![CDATA[&#160;    Somewhat subconsciously, in a hurry, I wrote the below statement      char...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <h1></h1>  <p><font size="2">Somewhat subconsciously, in a hurry, I wrote the below statement </font></p>  <blockquote>   <p><font size="2" face="Courier New">char command[MAX_QUERY_SIZE] =        <br /></font><font color="#c0504d"><font size="2" face="Courier New">&quot;select top 300 &quot;</font>         <br /><font size="2" face="Courier New">&#160;&#160;&#160; &quot;log.InsertsType, log.Inserts, log.Id, log.ProcessId, &quot;</font>         <br /><font size="2" face="Courier New">&#160;&#160;&#160; &quot;log.ThreadId, log.Level, log.MessageNumber, &quot;</font>         <br /><font size="2" face="Courier New">&#160;&#160;&#160; &quot;log.Time, log.MessageGuid, comp.Component, &quot;</font>         <br /><font size="2" face="Courier New">&#160;&#160;&#160; &quot;pool.Fqdn as Pool, machine.Fqdn as Machine &quot;</font>         <br /><font size="2" face="Courier New">&quot;from cls.dbo.Log log, cls.dbo.Component comp, &quot;</font>         <br /><font size="2" face="Courier New">&#160;&#160;&#160; &quot;cls.dbo.Fqdn pool, cls.dbo.Fqdn machine &quot;</font>         <br /><font size="2" face="Courier New">&quot;where log.ComponentId = comp.Id and log.PoolId = pool.Id and &quot;</font>         <br /><font size="2" face="Courier New">&#160;&#160;&#160; &quot;log.MachineId = machine.Id &quot;</font>         <br /><font size="2" face="Courier New">&#160;&#160;&#160; &quot;and not (comp.Component like '%test%')&quot;;</font> </font></p> </blockquote>  <p><font size="2">built, run. All fine.</font></p>  <p><font size="2">A day later the statement caught my eye. I thought something is wrong with it; how come it even compiles? Is it really a valid statement?</font></p>  <p><font size="2">So, after a little research I found that yes, this is one of the official ways to initialize an array of characters. Albeit being used quite rarely: people reasonably prefer either “char* command” variation, OR lstrcpy[A], OR StringCchCopy[A]. But yet, the block initializer works too(!) and it is the language-compliant construction.</font></p>  <p><font size="2">So, what is the resulting machine code? Actually, it’s very, very good – I would not write better by hand. First, the text constant is copied, very efficiently, to the “command” field. This is done by hardware loop command, and at each loop iteration a block of four bytes is moved. </font></p>  <p><font size="2">Then, the remaining part of the “command” buffer is filled with zero bytes via the old good memset. Here is what is happening in detail. Just great. </font></p>  <p><font size="2">PS: This is MS C/C++ compiler, included in VS 2010.</font></p>  <p><font size="2" face="Courier New">000d4351 b967000000&#160;&#160;&#160; mov ecx,67h      <br /></font><font size="2" face="Courier New">000d4356 be786c0e00&#160;&#160;&#160; mov esi,offset clsview!`string' (000e6c78)      <br /></font><font size="2" face="Courier New">000d435b 8dbdb0fbffff&#160; lea edi,[ebp-450h]      <br /></font><font size="2" face="Courier New">000d4361 f3a5&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rep movs dword ptr es:[edi],dword ptr [esi]      <br /></font><font size="2" face="Courier New">000d4363 66a5&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; movs word ptr es:[edi],word ptr [esi]      <br /></font><font size="2" face="Courier New">000d4365 684a020000&#160;&#160;&#160; push 24Ah      <br /></font><font size="2" face="Courier New">000d436a 6a00&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; push 0      <br /></font><font size="2" face="Courier New">000d436c 8d854efdffff&#160; lea eax,[ebp-2B2h]      <br /></font><font size="2" face="Courier New">000d4372&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 50 push eax      <br /></font><font size="2" face="Courier New">000d4373 e8c3cdffff&#160;&#160;&#160; call clsview!ILT+310(_memset) (000d113b)</font></p>  <p><font size="2">Isn’t the C++ great, and the VC 12.0 compiler real great? I think yes.</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Unzip file via java.util.zip package from .NET code</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/unzip-file-via-java-util-zip-package-from-net-code</link>
      <pubDate>Sun, 05 Apr 2009 01:07:00 GMT</pubDate>
      <dc:creator><![CDATA[Sergei Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/2009/04/05/unzip-file-via-java-util-zip-package-from-net-code/</guid>
      <description><![CDATA[Unzip file via java.util.zip package from .NET code
This week I had to modify a legacy java...]]></description>
      <content:encoded><![CDATA[<FONT face=Calibri size=3>
<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 4pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; mso-element: para-border-div; mso-border-bottom-themecolor: accent1">
<P class=MsoTitle style="MARGIN: 0in 0in 15pt"><FONT face=Cambria color=#17365d size=7>Unzip file via java.util.zip package from .NET code</FONT></P></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">This week I had to modify a legacy java application that does quite a bit of unpacking of various zip files. Actually the file extensions are .EAR, .WAR, .JAR; those are all zip files. The target application will run under JRE 1.6.0_12.</P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">I had to find a way to code the logic in .NET, but still I need a number of files unzipped (then modify various manifests and descriptors and zip into .EARs again).</P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">Unfortunately, .NET/C# libraries do not have access to a direct equivalent of java.util.zip.* package. I considered few options, including new deflation namespace in .NET 3.5, a number of zlib-based options, use of J# namespace, and using interop to native code which in turn will JNDI to java.util.zip, purchasing a zip command line license, etc.</P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">Finally, I ended up with the simplest solution that works great for my needs; the needs/constraints being:</P>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore">-<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Performance hit of 100 milliseconds per unzip operation is fine</P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore">-<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Need 100% same behavior as the one that Sun’s java has</P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">The solution is:</P>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore">-<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Write small console java application, which will implement the needed unzip operations. My small java application takes </P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore">o<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN>&lt;zip file name&gt; &lt;output directory name&gt; [&lt;zip entry name&gt;]</P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore">-<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Somehow build this application</P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore">-<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Use this application from the .NET code. I set a small function for that.</P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">The following 1) briefly describes the small java application; this one is actually doing the zip/unzip operations, 2) describes how to build it and 3) shows the .NET part of the code.</P>
<H1 style="MARGIN: 24pt 0in 0pt"><FONT face=Cambria color=#365f91 size=5>The java console application which actually unzips</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">First, we define needed imports, with the zip-related ones:</P>
<P class=MsoNormal style="BACKGROUND: #e5dfec; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: accent4; mso-background-themetint: 51"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">import java.io.File;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="BACKGROUND: #e5dfec; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: accent4; mso-background-themetint: 51"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">import java.io.FileOutputStream;<o:p></o:p></SPAN></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>import java.io.InputStream;</FONT></P>
<P class=MsoNormal style="BACKGROUND: #e5dfec; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: accent4; mso-background-themetint: 51"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">import java.io.IOException;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="BACKGROUND: #e5dfec; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: accent4; mso-background-themetint: 51"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">import java.util.Enumeration;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="BACKGROUND: #e5dfec; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: accent4; mso-background-themetint: 51"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">import java.util.zip.ZipEntry;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="BACKGROUND: #e5dfec; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: accent4; mso-background-themetint: 51"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">import java.util.zip.ZipFile;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="BACKGROUND: #e5dfec; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: accent4; mso-background-themetint: 51"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">import java.util.zip.ZipInputStream;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">Next, need few variables:</P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>File fileToUnpack = <SPAN style="COLOR: blue">null</SPAN>;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>ZipFile zip = <SPAN style="COLOR: blue">null</SPAN>;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>String targetDirName = <SPAN style="COLOR: blue">null</SPAN>;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>String entryName = <SPAN style="COLOR: blue">null</SPAN>;<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// will stay null if unzip whole file<o:p></o:p></SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">Then we retrieve command-line arguments, validate them (like the zip/ear/war/jar file exists), and open the zip container. We are still in Sun’s java world.</P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">try</SPAN> </FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>zip = <SPAN style="COLOR: blue">new</SPAN> ZipFile(fileToUnpack);</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">catch</SPAN> (java.util.zip.ZipException e) </FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;</SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>log(<SPAN style="COLOR: #a31515">"Cannot open zip file: "</SPAN> + e.toString()); </FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN>;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">catch</SPAN> (java.io.IOException e) </FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>log(<SPAN style="COLOR: #a31515">"Cannot open zip file: "</SPAN> + e.toString()); </FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN>;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">In case the command line requested unzipping the whole file, the code path is below. Note few things like normalizing the output path…; if you miss this, you end up with the directory which is only partially functional. Also note the handling of the isDirectory case. The “<SPAN style="FONT-SIZE: 15pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">streamToFile</SPAN>” code will follow.</P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (entryName == <SPAN style="COLOR: blue">null</SPAN>) <SPAN style="COLOR: green">// unpack whole file<o:p></o:p></SPAN></FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Enumeration en = zip.entries();</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">while</SPAN>(en.hasMoreElements())</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>ZipEntry entry = (ZipEntry)en.nextElement();</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (entry.isDirectory())</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>log(<SPAN style="COLOR: #a31515">"directory ignored: "</SPAN> +</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>entry.toString());</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">continue</SPAN>;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>InputStream stm;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">try</SPAN> {stm = zip.getInputStream(entry);}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">catch</SPAN> (java.io.IOException e)</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>log (<SPAN style="COLOR: #a31515">"Cannot get input stream for '"</SPAN> + entry.toString() + <SPAN style="COLOR: #a31515">"' in zip file '"</SPAN> + fileToUnpack.getAbsolutePath());</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN>;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>String targetFilename = targetDirName + <SPAN style="COLOR: #a31515">"/"</SPAN> + entry.toString();</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// create dir if needed<o:p></o:p></SPAN></FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">int</SPAN> lastSlash = targetFilename.lastIndexOf(<SPAN style="COLOR: #a31515">"/"</SPAN>);</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (lastSlash &gt; 0)</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>String dirName = targetFilename.substring(0, lastSlash);</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">new</SPAN> File(dirName).mkdirs();</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Copy zip entry to output directory<o:p></o:p></SPAN></FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>targetFilename = targetFilename.replace(<SPAN style="COLOR: #a31515">'/'</SPAN>,<SPAN style="COLOR: #a31515">'\\'</SPAN>);</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>streamToFile(stm, targetFilename);</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">Now the function that actually copied a zip entry to the file.</P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> streamToFile(InputStream stm, String targetFilename)</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>FileOutputStream stmOut = <SPAN style="COLOR: blue">null</SPAN>;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">byte</SPAN>[] buffer = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">byte</SPAN>[copyBufferSize];</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">int</SPAN> bytecount;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">try</SPAN> {stmOut = <SPAN style="COLOR: blue">new</SPAN> FileOutputStream(<SPAN style="COLOR: blue">new</SPAN> File(targetFilename));}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">catch</SPAN> (java.io.IOException e) </FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>log(<SPAN style="COLOR: #a31515">"Error opening output file '"</SPAN> + targetFilename + <SPAN style="COLOR: #a31515">"': "</SPAN> + e.toString()); </FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>System.exit(101);</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">try<o:p></o:p></SPAN></FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">while</SPAN> ((bytecount = stm.read(buffer)) &gt; 0)</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>stmOut.write(buffer, 0, bytecount);</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>stmOut.close();</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">catch</SPAN> (java.io.IOException e) </FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>log(<SPAN style="COLOR: #a31515">"Error writing output file '"</SPAN> + targetFilename + <SPAN style="COLOR: #a31515">"': "</SPAN> + e.toString()); </FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>System.exit(101);</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">We are almost done with java part, but not completely. The by far the most difficult part remains, at least for me: building the executable. I chose to package the result into the file that I named “main.jar”. </P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">There is a build tool which is similar to MSBUILD. While I did not find many MSBUILD features in ant (like automatic resolution of dependencies between projects), it’s very likely I don’t know enough about ant. Anyhow, the ant works great for me.</P>
<H1 style="MARGIN: 24pt 0in 0pt"><FONT face=Cambria color=#365f91 size=5>Building java application</FONT></H1>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&lt;?<SPAN style="COLOR: #a31515">xml</SPAN> <SPAN style="COLOR: red">version</SPAN>="1.0"?&gt;</FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&lt;<SPAN style="COLOR: #a31515">project</SPAN> <SPAN style="COLOR: red">name</SPAN>="ops-tool" <SPAN style="COLOR: red">default</SPAN>="all"&gt;</FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">target</SPAN> <SPAN style="COLOR: red">name</SPAN>="set"&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">property</SPAN> <SPAN style="COLOR: red">environment</SPAN>="env"/&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">property</SPAN> <SPAN style="COLOR: red">name</SPAN>="flavor" <SPAN style="COLOR: red">value</SPAN>="retail"/&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">target</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">target</SPAN> <SPAN style="COLOR: red">name</SPAN>="init" <SPAN style="COLOR: red">depends</SPAN>="set"&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">path</SPAN> <SPAN style="COLOR: red">id</SPAN>="classpath"&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">path</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">target</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">target</SPAN> <SPAN style="COLOR: red">name</SPAN>="compile" <SPAN style="COLOR: red">depends</SPAN>="init"&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">mkdir</SPAN> <SPAN style="COLOR: red">dir</SPAN>="classes"/&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">javac</SPAN> <SPAN style="COLOR: red">srcdir</SPAN>="." <SPAN style="COLOR: red">destdir</SPAN>="classes"</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: red">classpathref</SPAN>="classpath"&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">classpath</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">pathelement</SPAN> <SPAN style="COLOR: red">location</SPAN>="${classpath}"/&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">classpath</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">javac</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">target</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">target</SPAN> <SPAN style="COLOR: red">name</SPAN>="jar" <SPAN style="COLOR: red">depends</SPAN>="compile"&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">delete</SPAN> <SPAN style="COLOR: red">dir</SPAN>="lib" <SPAN style="COLOR: red">quiet</SPAN>="yes"/&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">mkdir</SPAN><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="COLOR: red">dir</SPAN>="lib"/&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">jar<o:p></o:p></SPAN></FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp; </SPAN><SPAN style="COLOR: red">destfile</SPAN>="lib/main.jar"</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp; </SPAN><SPAN style="COLOR: red">basedir</SPAN>="classes"</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp; </SPAN><SPAN style="COLOR: red">manifest</SPAN>="MANIFEST.MF"</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp; </SPAN><SPAN style="COLOR: red">filesonly</SPAN>="yes"&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">jar</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">target</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">target</SPAN> <SPAN style="COLOR: red">name</SPAN>="all" <SPAN style="COLOR: red">depends</SPAN>="jar"/&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">target</SPAN> <SPAN style="COLOR: red">name</SPAN>="clean" <SPAN style="COLOR: red">depends</SPAN>="init"&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">delete</SPAN> <SPAN style="COLOR: red">includeEmptyDirs</SPAN>="yes" <SPAN style="COLOR: red">quiet</SPAN>="yes"&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">fileset</SPAN> <SPAN style="COLOR: red">dir</SPAN>="${lib}"/&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;<SPAN style="COLOR: #a31515">fileset</SPAN> <SPAN style="COLOR: red">dir</SPAN>="${classes}"/&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">delete</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT size=2><FONT style="BACKGROUND-COLOR: #e5dfec"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/<SPAN style="COLOR: #a31515">target</SPAN>&gt;</FONT></FONT></FONT></P>
<P class=java style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&nbsp;</FONT></o:p></P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>&lt;/<SPAN style="COLOR: #a31515">project</SPAN>&gt;</FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><FONT face=Cambria color=#365f91 size=5>Testing java application</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">I grabbed few different ZIP, JAR, EAR files and run the program from the command line test script, which I named run.cmd:</P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>m:\jdk1.6.0_12\bin\java -jar lib\main.jar utils.zip.Main %*</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">For example, I run like:</P>
<P class=java style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #e5dfec" face="Courier New" size=2>run unittest3\lib\EXML.jar unittest5</FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"><FONT size=5><FONT color=#365f91><FONT face=Cambria>Now .NET part<o:p></o:p></FONT></FONT></FONT></SPAN></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">This is by far the easiest of course. The following is simple testing code, with the procedure to actually call the java unzip as a part of it (what I am saying, this is not the final code; this works great).</P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>Declaration is:</FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>namespace J2eePack</FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>{</FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>using System;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>using System.Collections.Generic;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>using System.Diagnostics;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>using System.IO;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>using System.Linq;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>using System.Reflection;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>using System.Text;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>&nbsp;</FONT></o:p></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>class </FONT></FONT><SPAN style="COLOR: #2b91af"><FONT style="BACKGROUND-COLOR: #eaf1dd">Program<o:p></o:p></FONT></SPAN></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>private const string jzip = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #a31515">@"…"</SPAN><FONT color=#0000ff>;<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></FONT><FONT color=#0000ff>// this is the location of lib\main.jar</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>. . .</FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">Now, let’s call couple of un-zipping functions. Only the <B style="mso-bidi-font-weight: normal">bold</B> part is interesting:</P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>private const string testEar = @"I:\lm\service\se\lm8\private\service-next\private\ops\test\JZIP\unittest\deployable.ear";</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>private const string exmlJar = @"I:\lm\service\se\lm8\private\service-next\private\ops\test\J2eePack\J2eePack\unpack2\lib\EXML.jar";</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>private const string exmlOut = @"I:\lm\service\se\lm8\private\service-next\private\ops\test\J2eePack\J2eePack\unpack2\lib\EXML";</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>private const string targetSubDir = "unpack2";</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>&nbsp;</FONT></o:p></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">// Target location<o:p></o:p></SPAN></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><SPAN style="COLOR: green"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New">&nbsp;</FONT></o:p></SPAN></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>string current = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #2b91af">Assembly</SPAN><FONT color=#0000ff>.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>current = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #2b91af">Path</SPAN><FONT color=#0000ff>.GetDirectoryName(current);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>current = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #2b91af">Path</SPAN><FONT color=#0000ff>.GetDirectoryName(current);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>current = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #2b91af">Path</SPAN><FONT color=#0000ff>.GetDirectoryName(current);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>string targetDir = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #2b91af">Path</SPAN><FONT color=#0000ff>.Combine(current, targetSubDir);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">// Unpack<o:p></o:p></SPAN></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><SPAN style="COLOR: green"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New">&nbsp;</FONT></o:p></SPAN></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 14pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Unzip(testEar, targetDir);<o:p></o:p></FONT></FONT></FONT></SPAN></B></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 14pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Unzip(exmlJar, exmlOut);<o:p></o:p></FONT></FONT></FONT></SPAN></B></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">// test result<o:p></o:p></SPAN></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><SPAN style="COLOR: green"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New">&nbsp;</FONT></o:p></SPAN></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>string[] files = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #2b91af">Directory</SPAN><FONT color=#0000ff>.GetFiles(targetDir, "*", </FONT><SPAN style="COLOR: #2b91af">SearchOption</SPAN><FONT color=#0000ff>.AllDirectories);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>foreach (string file in files)</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: #2b91af">Console</SPAN><FONT color=#0000ff>.WriteLine(file);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=codec style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">The actual code that is doing all the work (by calling the java console program) is:</P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: green"> </SPAN><FONT color=#0000ff>&lt;summary&gt;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><SPAN style="COLOR: green"><FONT style="BACKGROUND-COLOR: #eaf1dd"> Build and execute %java_home%\bin\java.exe -jar [loc]\lib\main.jar utils.zip.Main<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>[file to unzip] [targetDir];<o:p></o:p></FONT></SPAN></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: green"> </SPAN><FONT color=#0000ff>&lt;/summary&gt;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: green"> </SPAN><FONT color=#0000ff>&lt;param name="jar"&gt;</FONT><SPAN style="COLOR: green">Full or relative path to the file to unzip</SPAN><FONT color=#0000ff>&lt;/param&gt;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: green"> </SPAN><FONT color=#0000ff>&lt;param name="targetDir"&gt;</FONT><SPAN style="COLOR: green">The directory to which the zip file will be unzipped to. The directory will be created if missing.</SPAN><FONT color=#0000ff>&lt;/param&gt;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: green"> </SPAN><FONT color=#0000ff>&lt;returns&gt;</FONT><SPAN style="COLOR: green">true if no erros detected.</SPAN><FONT color=#0000ff>&lt;/returns&gt;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: green"> </SPAN><FONT color=#0000ff>&lt;remarks&gt;</FONT><SPAN style="COLOR: green">Note that the example code below allows only 5 seconds for the callee to complete. Modify this to meet the <o:p></o:p></SPAN></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><SPAN style="COLOR: green"><FONT style="BACKGROUND-COLOR: #eaf1dd"> production requirements. Also, note that the below example does not check the exit code of the java proccess.<o:p></o:p></FONT></SPAN></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><SPAN style="COLOR: green"><FONT style="BACKGROUND-COLOR: #eaf1dd"> Please add a line when building the production code.<o:p></o:p></FONT></SPAN></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>///</FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: green"> </SPAN><FONT color=#0000ff>&lt;/remarks&gt;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>private static bool Unzip(string jar, string targetDir)</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">// java exec<o:p></o:p></SPAN></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><SPAN style="COLOR: green"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New">&nbsp;</FONT></o:p></SPAN></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>string javaHome = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #2b91af">Environment</SPAN><FONT color=#0000ff>.GetEnvironmentVariable(</FONT><SPAN style="COLOR: #a31515">"java_home"</SPAN><FONT color=#0000ff>);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if (javaHome == null)</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: #2b91af">Console</SPAN><FONT color=#0000ff>.WriteLine(</FONT><SPAN style="COLOR: #a31515">"cannot obtain java_home"</SPAN><FONT color=#0000ff>);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">// javaHome = @"M:\jdk1.6.0_12";<o:p></o:p></SPAN></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: #2b91af">Environment</SPAN><FONT color=#0000ff>.ExitCode = 101;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return false;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN>string java = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #2b91af">Path</SPAN><FONT color=#0000ff>.Combine(javaHome, </FONT><SPAN style="COLOR: #a31515">@"bin\java.exe"</SPAN><FONT color=#0000ff>);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>&nbsp;</FONT></o:p></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">// arguments<o:p></o:p></SPAN></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><SPAN style="COLOR: green"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New">&nbsp;</FONT></o:p></SPAN></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT face="Courier New"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>string args = </FONT></FONT><FONT style="BACKGROUND-COLOR: #eaf1dd"><SPAN style="COLOR: #a31515">" -jar "</SPAN><FONT color=#0000ff> + jzip + </FONT><SPAN style="COLOR: #a31515">@"\lib\main.jar utils.zip.Main "</SPAN><FONT color=#0000ff> + jar + </FONT><SPAN style="COLOR: #a31515">" "</SPAN><FONT color=#0000ff> + targetDir;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: #2b91af">Console</SPAN><FONT color=#0000ff>.WriteLine(args);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>&nbsp;</FONT></o:p></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">// shell out<o:p></o:p></SPAN></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><SPAN style="COLOR: green"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New">&nbsp;</FONT></o:p></SPAN></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: #2b91af">Process</SPAN><FONT color=#0000ff> shell = new </FONT><SPAN style="COLOR: #2b91af">Process</SPAN><FONT color=#0000ff>();</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>shell.StartInfo.FileName = java;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>shell.StartInfo.Arguments = args;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>shell.StartInfo.UseShellExecute = false;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>shell.Start();</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>bool ok = shell.WaitForExit(5000);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if (!ok)</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes"><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: #2b91af">Console</SPAN><FONT color=#0000ff>.WriteLine(</FONT><SPAN style="COLOR: #a31515">"Error"</SPAN><FONT color=#0000ff>);</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return false;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>&nbsp;</FONT></o:p></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return true;</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><FONT color=#0000ff><FONT style="BACKGROUND-COLOR: #eaf1dd"><FONT face="Courier New"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></FONT></FONT></P>
<P class=c3 style="MARGIN: 0in 0in 0pt"><o:p><FONT style="BACKGROUND-COLOR: #eaf1dd" face="Courier New" color=#0000ff>&nbsp;</FONT></o:p></P></FONT>]]></content:encoded>
    </item>
    <item>
      <title>Azure storage viewer</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/azure-storage-viewer</link>
      <pubDate>Wed, 24 Dec 2008 16:31:00 GMT</pubDate>
      <dc:creator><![CDATA[Sergei Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/2008/12/24/azure-storage-viewer/</guid>
      <description><![CDATA[Azure storage viewer(see http://blogs.msdn.com/sergeim for updates)
Contents
Introduction....]]></description>
      <content:encoded><![CDATA[<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 4pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; mso-element: para-border-div; mso-border-bottom-themecolor: accent1">
<P class=MsoTitle style="MARGIN: 0in 0in 15pt"><FONT face=Cambria color=#17365d size=7>Azure storage viewer</FONT></P>(see <A href="http://blogs.msdn.com/sergeim">http://blogs.msdn.com/sergeim</A> for updates)</DIV><?xml:namespace prefix = w ns = "urn:schemas-microsoft-com:office:word" /><w:Sdt id=40500278 DocPartUnique="t" DocPartType="Table of Contents" SdtDocPart="t">
<P class=MsoTocHeading style="MARGIN: 24pt 0in 0pt"><STRONG><FONT size=5><FONT color=#365f91><FONT face=Cambria>Contents<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; LINE-HEIGHT: 115%; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"><w:sdtPr></w:sdtPr></SPAN></FONT></FONT></FONT></STRONG></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866787" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866787"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Introduction</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">1</SPAN></FONT></FONT></A><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866788" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866788"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>System requirements</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">1</SPAN></FONT></FONT></A><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866789" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866789"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Sample screenshots:</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted"> </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">1</SPAN></FONT></FONT></A><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866790" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866790"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Installation</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">3</SPAN></FONT></FONT></A><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866791" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866791"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Step 1. Install and start the Viewer.</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted"> </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">3</SPAN></FONT></FONT></A><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866792" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866792"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Step 2. Modify configuration file</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">4</SPAN></FONT></FONT></A><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866793" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc217866793"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Step 3. Start browsing your storage.</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted"> </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">5</SPAN></FONT></FONT></A><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P></w:Sdt>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc217866787 name=_Toc217866787></A><FONT face=Cambria color=#365f91 size=5>Introduction</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>If you have registered for Azure Services at </FONT><A href="http://www.microsoft.com/azure/register.mspx" mce_href="http://www.microsoft.com/azure/register.mspx"><FONT face=Calibri color=#0000ff size=3>http://www.microsoft.com/azure/register.mspx</FONT></A><FONT face=Calibri size=3>, you may want to explore what is in your storage – your queues, blobs and tables. You can use the “Azure storage viewer” to browse your storage. To a limited extent, you can also add and delete objects in Azure storage (under your account, of course).</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The two screen shots below show messages in one of the queues, and contents of a small table. </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Azure storage viewer supports both mouse and keyboard navigation. It can be used as a learning tool, or as a content browser for small experimental projects.</FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc217866788 name=_Toc217866788></A><FONT face=Cambria color=#365f91 size=5>System requirements</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>I tested on Windows 2003 SP2, Vista x32 and x64, Windows 2008 x64 (Standard and DC). I was admin on all machines. Viewer doesn’t need to run elevated. </FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc217866789 name=_Toc217866789></A><FONT face=Cambria color=#365f91 size=5>Sample screenshots</FONT></H1>
<P style="MARGIN: 24pt 0in 0pt" mce_keep="true"><IMG src="http://meleshchuk.members.winisp.net/images/1.jpg" mce_src="http://meleshchuk.members.winisp.net/images/1.jpg"></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></v:path><o:lock v:ext="edit" aspectratio="t"></o:lock></v:shapetype></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3><IMG style="WIDTH: 628px; HEIGHT: 472px" height=472 src="http://meleshchuk.members.winisp.net/images/2.jpg" width=628 mce_src="http://meleshchuk.members.winisp.net/images/2.jpg">&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><v:shape id=Picture_x0020_14 style="VISIBILITY: visible; WIDTH: 468pt; HEIGHT: 351pt; mso-wrap-style: square" o:spid="_x0000_i1030" type="#_x0000_t75"><v:imagedata mce_src="file:///C:\Users\sergeim\AppData\Local\Temp\1\msohtmlclip1\01\clip_image003.png" src="file:///C:\Users\sergeim\AppData\Local\Temp\1\msohtmlclip1\01\clip_image003.png" o:title=""><FONT face=Calibri size=3></FONT></v:imagedata></v:shape></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc217866790 name=_Toc217866790></A><FONT face=Cambria color=#365f91 size=5>Installation</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc217866791 name=_Toc217866791></A><FONT face=Cambria color=#4f81bd size=3>Step 1. Install and start the Viewer.</FONT><BR style="mso-special-character: line-break"><BR style="mso-special-character: line-break"></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The installation is ClickOnce-based. Type </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>start </FONT><A href="http://meleshchuk.members.winisp.net/quince/default.htm" mce_href="http://meleshchuk.members.winisp.net/quince/default.htm"><FONT face=Calibri size=3>http://meleshchuk.members.winisp.net/quince/default.htm</FONT></A></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>in the command window (or click the URL), then click install. </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Note: if you already have .NET FX 3.5 SP1 installed, you can just start the Azure storage viewer by typing </FONT><A href="http://meleshchuk.members.winisp.net/quince/quince.application" mce_href="http://meleshchuk.members.winisp.net/quince/quince.application"><FONT face=Calibri size=3>http://meleshchuk.members.winisp.net/quince/quince.application</FONT></A><FONT face=Calibri size=3> - the IE understands the “.application” file type.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>If you don’t have FX 3.5 SP1, then you will be prompted to install it. Installation of the FX will start automatically. It takes quite a while.</FONT></P><FONT face=Calibri size=3>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt">The viewer will start and display the “credentials dialog”. Next, modify configuration file. See next step.</P></FONT>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt" mce_keep="true">&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><IMG style="WIDTH: 629px; HEIGHT: 395px" height=395 src="http://meleshchuk.members.winisp.net/quince/CredentalsDialog.jpg" width=629 mce_src="http://meleshchuk.members.winisp.net/quince/CredentalsDialog.jpg"></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"></SPAN></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc217866792 name=_Toc217866792></A><FONT face=Cambria color=#4f81bd size=3>Step 2. Modify configuration file</FONT></H3><FONT face=Calibri>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT size=3>When the viewer detects connection problem (with the storage), it brings up the “credentials dialog”. Either click “Edit credentials” or “Edit in notepad”. The first option will read configuration file and fillin the two text boxes with current values; copy-paste your account and shared key. The second option opens the configuration file, which looks like below. You can also open configuration file at any time by clicking “Edit Configuration” button.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT size=3>Change yellow entries to you account and shared key values that you received when signing up to Azure services. Save configuration file (CTRL+S) in case you selected the option to edit the configuration file. </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT size=3>Click OK. You data should be displayed now.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT size=3>Disclaimer: It is the ClickOnce install generator that placed the viewer under Microsoft group, and I did not figure out yet how to change the group name to something more modest.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"></FONT><FONT face=Calibri size=3>. Disclaimer: It is the ClickOnce install generator that placed the viewer under Microsoft group, and I did not figure out yet how to change the group name to something more modest.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;?</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">xml</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">version</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">=</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">"<SPAN style="COLOR: blue">1.0</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">encoding</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">utf-8</SPAN>"<SPAN style="COLOR: blue"> ?&gt;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">configuration</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">appSettings</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;!--</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> change 2 lines below </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">add</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">key</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> = </SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">"<SPAN style="COLOR: blue">AccountName</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="BACKGROUND: yellow; COLOR: blue; mso-highlight: yellow">sergeim</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">add</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">key</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> = </SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">"<SPAN style="COLOR: blue">AccountSharedKey</SPAN>"<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;</SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">value</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">=</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">"<SPAN style="BACKGROUND: yellow; COLOR: blue; mso-highlight: yellow">3SV+JU1S+wDiHPrNEIeOOk2b4Z…u5zPBGbB8CV+t6RfQ==</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;!--</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> no need to change </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">add</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">key</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">=</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">"<SPAN style="COLOR: blue">BlobStorageEndpoint</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">http://blob.core.windows.net</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">add</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">key</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">=</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">"<SPAN style="COLOR: blue">QueueStorageEndpoint</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">http://queue.core.windows.net</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">add</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">key</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">=</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">"<SPAN style="COLOR: blue">TableStorageEndpoint</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">http://table.core.windows.net</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">appSettings</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">&gt; <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">. . .<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc217866793 name=_Toc217866793></A><SPAN style="mso-no-proof: yes"><FONT face=Cambria color=#4f81bd size=3>Step 3. Start browsing your storage.</FONT></SPAN><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>Most of the tree view entries present a context menu when right-clicked.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Like below.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri><IMG style="WIDTH: 503px; HEIGHT: 162px" height=162 src="http://meleshchuk.members.winisp.net/images/4.jpg" width=503 mce_src="http://meleshchuk.members.winisp.net/images/4.jpg">&nbsp;</FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>Pure viewing, however, can be done by just using keyboard arrows.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>Typical screenshot of the just started viewer is shown below.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p><IMG style="WIDTH: 628px; HEIGHT: 472px" height=472 src="http://meleshchuk.members.winisp.net/images/5.jpg" width=628 mce_src="http://meleshchuk.members.winisp.net/images/5.jpg">&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>Left pane updates as the selection of the tree items changes:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p><IMG style="WIDTH: 628px; HEIGHT: 472px" height=472 src="http://meleshchuk.members.winisp.net/images/6.jpg" width=628 mce_src="http://meleshchuk.members.winisp.net/images/6.jpg">&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p><IMG style="WIDTH: 628px; HEIGHT: 472px" height=472 src="http://meleshchuk.members.winisp.net/images/7.jpg" width=628 mce_src="http://meleshchuk.members.winisp.net/images/7.jpg"></o:p></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Accessing Azure storage with Raw REST API</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/accessing-azure-storage-with-raw-rest-api</link>
      <pubDate>Wed, 10 Dec 2008 20:31:00 GMT</pubDate>
      <dc:creator><![CDATA[Sergei Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/2008/12/10/accessing-azure-storage-with-raw-rest-api/</guid>
      <description><![CDATA[Accessing Azure storage with Raw REST API
Sergei Meleshchuk - blog&nbsp;
Contents
Introduction....]]></description>
      <content:encoded><![CDATA[<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 4pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; mso-element: para-border-div; mso-border-bottom-themecolor: accent1">
<P class=MsoTitle style="MARGIN: 0in 0in 15pt"><FONT face=Cambria color=#17365d size=7>Accessing Azure storage with Raw REST API</FONT></P></DIV><?xml:namespace prefix = w ns = "urn:schemas-microsoft-com:office:word" /><w:Sdt id=50316079 DocPartUnique="t" DocPartType="Table of Contents" SdtDocPart="t">
<P class=MsoTocHeading style="MARGIN: 24pt 0in 0pt"><STRONG><FONT size=5><FONT color=#365f91><FONT face=Cambria><A href="http://blogs.msdn.com/sergeim/default.aspx"><FONT color=#000000 size=2>Sergei Meleshchuk - blog</FONT></A>&nbsp;</FONT></FONT></FONT></STRONG></P>
<P class=MsoTocHeading style="MARGIN: 24pt 0in 0pt"><STRONG><FONT size=5><FONT color=#365f91><FONT face=Cambria>Contents<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; LINE-HEIGHT: 115%; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"><w:sdtPr></w:sdtPr></SPAN></FONT></FONT></FONT></STRONG></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693512" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693512"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Introduction</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">1</SPAN></FONT></FONT></A><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-no-proof: yes; mso-fareast-theme-font: minor-fareast"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693513" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693513"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Example</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">2</SPAN></FONT></FONT></A><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-no-proof: yes; mso-fareast-theme-font: minor-fareast"><o:p></o:p></SPAN></P>
<P class=MsoToc2 style="MARGIN: 0in 0in 5pt 11pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693514" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693514"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Client code: read a message from a queue</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">2</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc2 style="MARGIN: 0in 0in 5pt 11pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693515" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693515"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Missing parts</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">3</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693516" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693516"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>QueueBase</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">3</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693517" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693517"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>ServiceEndpoint</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">3</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693518" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693518"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>BuildSignature</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">3</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693519" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693519"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>BuildUri</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted"> </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">4</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693520" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693520"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>BuildRequest</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">4</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693521" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693521"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>ExecuteRequest</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">4</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693522" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693522"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>DecodeMessages</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">5</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693523" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693523"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>CurrentMessageList</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">6</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc3 style="MARGIN: 0in 0in 5pt 22pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693524" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216693524"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>MessageBase</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">6</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P></w:Sdt>
<H1 style="MARGIN: 24pt 0in 0pt"><o:p><FONT face=Cambria color=#365f91 size=5>&nbsp;</FONT></o:p></H1>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc216693512 name=_Toc216693512></A><FONT face=Cambria color=#365f91 size=5>Introduction</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Azure SDK defines [Raw] REST API, and supplies a client library which isolates a developer from REST API. The client library is a good thing.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Sometimes, however, you may want much thinner layer (than the client library) on top of REST API. The reasons include:</FONT></P>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>You want to understand the Azure REST API, without tearing your way thru the code of the client library,</FONT></P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>You want to really understand the client library code, and need to start with a much simpler version of it.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>I describe here what is probably the thinnest possible layer on top of the Azure REST API. This “Mini storage library” is easy to learn and understand, and it can be used on its own to access the Azure storage. I am totally ignoring (in this post) the needs of table storage. I chose to concentrate on queue and blob storage operations instead.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The “mini library” a very small number of short functions, which you can completely inline if you want. The class structure is close to absent as well.</FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc216693513 name=_Toc216693513></A><FONT face=Cambria color=#365f91 size=5>Example</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>I will show how to read a message from the queue storage. The code is, sure, more lengthy then in case of using the client library. However, this code if very close “to the metal”, and you can factor out the boilerplate part very easily. I did not do this intentionally.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The code is followed by the description of the missing parts – the small set of small functions.</FONT></P>
<H2 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693514 name=_Toc216693514></A><FONT face=Cambria color=#4f81bd size=4>Client code: read a message from a queue</FONT></H2>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">void</SPAN> LibReadOne(<SPAN style="COLOR: blue">object</SPAN> sender, <SPAN style="COLOR: #2b91af">RoutedEventArgs</SPAN> e)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">TimeSpan</SPAN> elapsed;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Read configuration data: service URI, account name, access key<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> queueName = <SPAN style="COLOR: #a31515">"registration2"</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">QueueBase</SPAN> queue = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">QueueBase</SPAN>(queueName);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> date = <SPAN style="COLOR: #2b91af">DateTime</SPAN>.UtcNow.ToString(<SPAN style="COLOR: #a31515">"R"</SPAN>, <SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> method = <SPAN style="COLOR: #a31515">"GET"</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> suffix = queueName + <SPAN style="COLOR: #a31515">"/"</SPAN> + <SPAN style="COLOR: #a31515">"messages"</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> signature = BuildSignature(method, date, queue.Account, <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>queue.Key, suffix);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>suffix += <SPAN style="COLOR: #a31515">"?numofmessages=1&amp;visibilitytimeout=5"</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Uri</SPAN> uri = BuildUri(method, queue, suffix);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">HttpWebRequest</SPAN> request = BuildRequest(method, uri, queue.Account, <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>signature, date);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">DateTime</SPAN> starting = <SPAN style="COLOR: #2b91af">DateTime</SPAN>.Now;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">XmlDocument</SPAN> doc = ExecuteRequest(request, <SPAN style="COLOR: blue">out</SPAN> elapsed);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Trace(<SPAN style="COLOR: #a31515">"ExeReq time {0}\n"</SPAN>, <SPAN style="COLOR: #2b91af">DateTime</SPAN>.Now - starting);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">lock</SPAN> (CurrentMessageListLock)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">/*List&lt;MessageBase&gt;*/<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>CurrentMessageList = DecodeMessages(doc);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">//Trace("Decode time {0}\n", DateTime.Now - starting);<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (CurrentMessageList != <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">MessageBase</SPAN> mm <SPAN style="COLOR: blue">in</SPAN> CurrentMessageList)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Trace(<SPAN style="COLOR: #a31515">"[MessageText] {0}\n"</SPAN>, mm.MessageText);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">else<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Trace(<SPAN style="COLOR: #a31515">"[No messages]\n"</SPAN>);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<H2 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693515 name=_Toc216693515></A><FONT face=Cambria color=#4f81bd size=4>Missing parts</FONT></H2>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Below are all the class definition, and low-level functions, needed for the above code to work.</FONT></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693516 name=_Toc216693516></A><FONT face=Cambria color=#4f81bd size=3>QueueBase</FONT></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">QueueBase</SPAN> : <SPAN style="COLOR: #2b91af">ServiceEndpoint<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">string</SPAN> QueueName { <SPAN style="COLOR: blue">get</SPAN>; <SPAN style="COLOR: blue">set</SPAN>; }<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> QueueBase(<SPAN style="COLOR: blue">string</SPAN> queueName)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">this</SPAN>.QueueName = queueName;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">base</SPAN>.BaseUri = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">Uri</SPAN>(<SPAN style="COLOR: #2b91af">ConfigurationSettings</SPAN>.AppSettings[<SPAN style="COLOR: #a31515">"QueueStorageEndpoint"</SPAN>]);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">base</SPAN>.Account = <SPAN style="COLOR: #2b91af">ConfigurationSettings</SPAN>.AppSettings[<SPAN style="COLOR: #a31515">"AccountName"</SPAN>];<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">base</SPAN>.Base64Key = <SPAN style="COLOR: #2b91af">ConfigurationSettings</SPAN>.AppSettings[<SPAN style="COLOR: #a31515">"AccountSharedKey"</SPAN>];<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693517 name=_Toc216693517></A><SPAN style="mso-no-proof: yes"><FONT face=Cambria color=#4f81bd size=3>ServiceEndpoint</FONT></SPAN><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">ServiceEndpoint<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: #2b91af">Uri</SPAN> BaseUri { <SPAN style="COLOR: blue">get</SPAN>; <SPAN style="COLOR: blue">set</SPAN>; }<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">string</SPAN> Account { <SPAN style="COLOR: blue">get</SPAN>; <SPAN style="COLOR: blue">set</SPAN>; }<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">string</SPAN> Base64Key { <SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">get</SPAN>; <SPAN style="COLOR: blue">set</SPAN>; }<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">byte</SPAN>[] Key<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: #2b91af">Convert</SPAN>.FromBase64String(Base64Key); }<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693518 name=_Toc216693518></A><SPAN style="mso-no-proof: yes"><FONT face=Cambria color=#4f81bd size=3>BuildSignature</FONT></SPAN><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> BuildSignature(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> method,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> date,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> accountName,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">byte</SPAN>[] sharedKey,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> suffix)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> signPart1 = <SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"{0}\n{1}\n{2}\n{3}\n{4}\n/"</SPAN>,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>method,<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 0 - HTTP Method, like GET<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN>.Empty,<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 1 - "Content-MD5" header value. Leave blank.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN>.Empty,<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 2 - Content type, like MIME. Leave blank.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;</SPAN><SPAN style="COLOR: blue">string</SPAN>.Empty,<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 3 - Legacy "date" header. Leave blank.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"x-ms-date:"</SPAN> + date);<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 4 - Azure form of date header.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> signPart2 = accountName + <SPAN style="COLOR: #a31515">"/"</SPAN> + suffix;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> signatureString = signPart1 + signPart2;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">byte</SPAN>[] signBytes = System.Text.<SPAN style="COLOR: #2b91af">Encoding</SPAN>.UTF8.GetBytes(signatureString);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">byte</SPAN>[] hash = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">HMACSHA256</SPAN>(sharedKey).ComputeHash(signBytes);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> signature = System.<SPAN style="COLOR: #2b91af">Convert</SPAN>.ToBase64String(hash);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> signature;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693519 name=_Toc216693519></A><SPAN style="mso-no-proof: yes"><FONT face=Cambria color=#4f81bd size=3>BuildUri</FONT></SPAN><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Uri</SPAN> BuildUri(<SPAN style="COLOR: blue">string</SPAN> method, <SPAN style="COLOR: #2b91af">ServiceEndpoint</SPAN> svc, <SPAN style="COLOR: blue">string</SPAN> suffix)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> accountUriString = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #a31515">"{0}{1}{2}.{3}"</SPAN>,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>svc.BaseUri.Scheme,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Uri</SPAN>.SchemeDelimiter,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>svc.Account,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>svc.BaseUri.Host);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> divisorToken = suffix.Contains(<SPAN style="COLOR: #a31515">'?'</SPAN>) ? <SPAN style="COLOR: #a31515">"&amp;"</SPAN> : <SPAN style="COLOR: #a31515">"?"</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> uriString = <SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"{0}/{1}{2}{3}"</SPAN>,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>accountUriString,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>suffix,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>divisorToken,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"timeout=30"</SPAN>);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Uri</SPAN> uri = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">Uri</SPAN>(uriString);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: blue">return</SPAN> uri;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693520 name=_Toc216693520></A><SPAN style="mso-no-proof: yes"><FONT face=Cambria color=#4f81bd size=3>BuildRequest</FONT></SPAN><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: #2b91af">HttpWebRequest</SPAN> BuildRequest(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> method,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Uri</SPAN> uri,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> accountName,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> signature,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> date)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">HttpWebRequest</SPAN> request = (<SPAN style="COLOR: #2b91af">HttpWebRequest</SPAN>)<SPAN style="COLOR: #2b91af">HttpWebRequest</SPAN>.Create(uri);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>request.Timeout = 30 * 1000;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>request.ReadWriteTimeout = 30 * 1000;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>request.Method = method;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>request.ContentLength = 0;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>request.Headers.Add(<SPAN style="COLOR: #a31515">"x-ms-date"</SPAN>, date);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> AuthHeaderValue = <SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"SharedKey {0}:{1}"</SPAN>,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>accountName,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>signature);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>request.Headers.Add(<SPAN style="COLOR: #a31515">"Authorization"</SPAN>, AuthHeaderValue);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> request;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693521 name=_Toc216693521></A><SPAN style="mso-no-proof: yes"><FONT face=Cambria color=#4f81bd size=3>ExecuteRequest</FONT></SPAN><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">XmlDocument</SPAN> ExecuteRequest(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">HttpWebRequest</SPAN> request,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: blue">out</SPAN> <SPAN style="COLOR: #2b91af">TimeSpan</SPAN> elapsed)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">DateTime</SPAN> startTime = <SPAN style="COLOR: #2b91af">DateTime</SPAN>.Now;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>elapsed = <SPAN style="COLOR: #2b91af">TimeSpan</SPAN>.MinValue;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">try<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">using</SPAN> (<SPAN style="COLOR: #2b91af">HttpWebResponse</SPAN> response = (<SPAN style="COLOR: #2b91af">HttpWebResponse</SPAN>)request.GetResponse())<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (response.StatusCode == <SPAN style="COLOR: #2b91af">HttpStatusCode</SPAN>.OK)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">using</SPAN> (<SPAN style="COLOR: #2b91af">Stream</SPAN> stream = response.GetResponseStream())<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>elapsed = <SPAN style="COLOR: #2b91af">DateTime</SPAN>.Now - startTime;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">XmlDocument</SPAN> doc = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">XmlDocument</SPAN>();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">try<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">#if</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> (DIRECTPARSE)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>byte[] data = new byte[10000];<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>int length = stream.Read(data, 0, 10000);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>string dataString = Encoding.UTF8.GetString(data, 0, length);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">#endif<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>doc.Load(stream);<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// doc = output param<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>stream.Close();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>response.Close();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> doc;<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// indicate success<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">catch</SPAN> (<SPAN style="COLOR: #2b91af">XmlException</SPAN> xe)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>stream.Close();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>response.Close();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> xe;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: blue">else<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> errorMessage = response.ToString();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">InvalidOperationException</SPAN>(<SPAN style="COLOR: #a31515">"Retcode wrong "</SPAN> + errorMessage);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">catch</SPAN> (<SPAN style="COLOR: #2b91af">WebException</SPAN> we)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (we.Response != <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">HttpWebResponse</SPAN> resp = (<SPAN style="COLOR: #2b91af">HttpWebResponse</SPAN>)we.Response;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> description = resp.StatusDescription;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: blue">if</SPAN> (description != <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">InvalidOperationException</SPAN>(description);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">InvalidOperationException</SPAN>(we.ToString());<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693522 name=_Toc216693522></A><SPAN style="mso-no-proof: yes"><FONT face=Cambria color=#4f81bd size=3>DecodeMessages</FONT></SPAN><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">List</SPAN>&lt;<SPAN style="COLOR: #2b91af">MessageBase</SPAN>&gt; DecodeMessages(<SPAN style="COLOR: #2b91af">XmlDocument</SPAN> doc)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">List</SPAN>&lt;<SPAN style="COLOR: #2b91af">MessageBase</SPAN>&gt; readMessages = <SPAN style="COLOR: blue">null</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MessageBase</SPAN> msg;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">XmlNodeList</SPAN> messagesNodes = doc.SelectNodes(<SPAN style="COLOR: #a31515">"//QueueMessage"</SPAN>);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (messagesNodes.Count == 0)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: blue">null</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>readMessages = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">List</SPAN>&lt;<SPAN style="COLOR: #2b91af">MessageBase</SPAN>&gt;();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">XmlNode</SPAN> messageNode <SPAN style="COLOR: blue">in</SPAN> messagesNodes)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>msg = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">MessageBase</SPAN>();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>msg.MessageId = messageNode.SelectSingleNode(<SPAN style="COLOR: #a31515">"MessageId"</SPAN>).FirstChild.Value.Trim();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Debug</SPAN>.Assert(msg.MessageId != <SPAN style="COLOR: blue">null</SPAN>);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (messageNode.SelectSingleNode(<SPAN style="COLOR: #a31515">"PopReceipt"</SPAN>) != <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>msg.MessagePopReceipt = messageNode.SelectSingleNode(<SPAN style="COLOR: #a31515">"PopReceipt"</SPAN>).FirstChild.Value.Trim();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Debug</SPAN>.Assert(msg.MessagePopReceipt != <SPAN style="COLOR: blue">null</SPAN>);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> base64 = messageNode.SelectSingleNode(<SPAN style="COLOR: #a31515">"MessageText"</SPAN>).FirstChild.Value.Trim();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">byte</SPAN>[] messageBytes = <SPAN style="COLOR: #2b91af">Convert</SPAN>.FromBase64String(base64);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>msg.MessageText = <SPAN style="COLOR: #2b91af">Encoding</SPAN>.UTF8.GetString(messageBytes, 0, messageBytes.Length);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>readMessages.Add(msg);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> readMessages;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693523 name=_Toc216693523></A><SPAN style="mso-no-proof: yes"><FONT face=Cambria color=#4f81bd size=3>CurrentMessageList</FONT></SPAN><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">List</SPAN>&lt;<SPAN style="COLOR: #2b91af">MessageBase</SPAN>&gt; CurrentMessageList;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H3 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216693524 name=_Toc216693524></A><SPAN style="mso-no-proof: yes"><FONT face=Cambria color=#4f81bd size=3>MessageBase</FONT></SPAN><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></H3>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">MessageBase<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">string</SPAN> MessageId { <SPAN style="COLOR: blue">get</SPAN>; <SPAN style="COLOR: blue">set</SPAN>; }<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">string</SPAN> MessageText { <SPAN style="COLOR: blue">get</SPAN>; <SPAN style="COLOR: blue">set</SPAN>; }<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">string</SPAN> MessagePopReceipt { <SPAN style="COLOR: blue">get</SPAN>; <SPAN style="COLOR: blue">set</SPAN>; }<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 12pt; COLOR: #2b91af; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>]]></content:encoded>
    </item>
    <item>
      <title>How to do ETW logging from .NET application</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/how-to-do-etw-logging-from-net-application</link>
      <pubDate>Wed, 10 Dec 2008 18:39:00 GMT</pubDate>
      <dc:creator><![CDATA[Sergei Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/2008/12/10/how-to-do-etw-logging-from-net-application/</guid>
      <description><![CDATA[How to do ETW logging from .NET application
Sergei Meleshchuk -...]]></description>
      <content:encoded><![CDATA[<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 4pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; mso-element: para-border-div; mso-border-bottom-themecolor: accent1">
<P class=MsoTitle style="MARGIN: 0in 0in 15pt"><FONT face=Cambria color=#17365d size=7>How to do ETW logging from .NET application</FONT></P></DIV><?xml:namespace prefix = w ns = "urn:schemas-microsoft-com:office:word" /><w:Sdt id=44891332 DocPartUnique="t" DocPartType="Table of Contents" SdtDocPart="t">
<P class=MsoTocHeading style="MARGIN: 24pt 0in 0pt"><STRONG><FONT size=5><FONT color=#365f91><FONT face=Cambria><A href="http://blogs.msdn.com/sergeim/default.aspx" mce_href="http://blogs.msdn.com/sergeim/default.aspx"><FONT face=Cambria color=#0000ff size=5>Sergei Meleshchuk - blog</FONT></A>&nbsp;</FONT></FONT></FONT></STRONG></P>
<P class=MsoTocHeading style="MARGIN: 24pt 0in 0pt"><STRONG><FONT size=5><FONT color=#365f91><FONT face=Cambria>Contents<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; LINE-HEIGHT: 115%; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"><w:sdtPr></w:sdtPr></SPAN></FONT></FONT></FONT></STRONG></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686799" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686799"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Introduction</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">1</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoToc2 style="MARGIN: 0in 0in 5pt 11pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686800" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686800"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Sessions and providers</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">1</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686801" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686801"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Sample tracing application</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">1</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686802" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686802"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Starting tracing session</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">2</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoToc1 style="MARGIN: 0in 0in 5pt; tab-stops: right dotted 467.5pt"><A href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686803" mce_href="http://blogs.msdn.com/tiny_mce/jscripts/tiny_mce/blank.htm#_Toc216686803"><FONT size=3><FONT face=Calibri><SPAN style="mso-no-proof: yes"><FONT color=#0000ff>Stopping and decoding tracing session</FONT></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen"><SPAN style="mso-tab-count: 1 dotted">. </SPAN></SPAN><SPAN style="DISPLAY: none; COLOR: windowtext; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none; mso-hide: screen">3</SPAN></FONT></FONT></A><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P></w:Sdt>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc216686799 name=_Toc216686799></A><FONT face=Cambria color=#365f91 size=5>Introduction</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>ETW, Event tracing for Windows, provides strategic benefits like:</FONT></P>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>You can log to same file from different threads and processes,</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Extremely fast,</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Tailing log records never lost, even your application crashes without warning,</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>You can turn tracing on and off, change level or set of tracing components, without restarting the application</FONT></P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>And so on.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>There is a small penalty – namely, you have to decode trace files.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>.NET 3.5 provides tracing facilities for ETW. This post is a short reference of how to use the ETW in .NET.</FONT></P>
<H2 style="MARGIN: 10pt 0in 0pt"><A class="" title=_Toc216686800 name=_Toc216686800></A><FONT face=Cambria color=#4f81bd size=4>Sessions and providers</FONT></H2>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>You application will be the ‘trace provider’ (see example code about how to advertize the provider). Exposing provider is not enough to start tracing: you have to use one of the ETW command line utilities to actually enable tracing. Of course, this can be done from code; in the latter case you need some interop-ing and I am not writing about this here.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Now, to set up ETW tracing, you have to:</FONT></P>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Author application appropriately:</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l2 level2 lfo1; mso-add-space: auto"><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Register the listener, all as usual</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l2 level2 lfo1; mso-add-space: auto"><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Create trace session via e.g. logman utility</FONT></P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 1in; TEXT-INDENT: -0.25in; mso-list: l2 level2 lfo1; mso-add-space: auto"><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Start session</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>To decode the trace file, you have to:</FONT></P>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Close tracing session via logman utility</FONT></P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>Decode the log file via another utility, tracerpt.</FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The remaining part of this post provides details.</FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc216686801 name=_Toc216686801></A><FONT face=Cambria color=#365f91 size=5>Sample tracing application</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">using</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> System;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">using</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> System.Diagnostics;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">using</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> System.Diagnostics.Eventing;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">namespace</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> EtwSample<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">Program<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: #2b91af">Guid</SPAN> providerId = <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">Guid</SPAN>(<SPAN style="COLOR: #a31515">"{A11a0820-c24b-428c-83e2-26b41091702e}"</SPAN>);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> Main(<SPAN style="COLOR: blue">string</SPAN>[] args)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">EventProviderTraceListener</SPAN> listener = <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">EventProviderTraceListener</SPAN>(providerId.ToString());<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">TraceSource</SPAN> source = <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">TraceSource</SPAN>(<SPAN style="COLOR: #a31515">"MyProvider"</SPAN>, <SPAN style="COLOR: #2b91af">SourceLevels</SPAN>.All);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>source.Listeners.Add(listener);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>source.TraceData(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">TraceEventType</SPAN>.Warning | <SPAN style="COLOR: #2b91af">TraceEventType</SPAN>.Start, 2, <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">object</SPAN>[] { <SPAN style="COLOR: #a31515">"abc"</SPAN>, <SPAN style="COLOR: #a31515">"def"</SPAN>, <SPAN style="COLOR: blue">true</SPAN>, 123 });<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">/* Uncommen below if you want more fancy logging ...<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>source.TraceEvent(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>TraceEventType.Warning, 12, "Provider guid: {0}", <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>new object[] { providerId });<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>source.TraceInformation(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>"string {0}, bool {1}, int {2}, ushort {3}", <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>new object[] { "abc", false, 123, (UInt32)5 });<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>* */<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">for</SPAN> (<SPAN style="COLOR: blue">int</SPAN> i = 0; i &lt; 100; i++)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>source.TraceInformation(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"This is sample trace record "</SPAN> + i);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>source.Close();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc216686802 name=_Toc216686802></A><FONT face=Cambria color=#365f91 size=5>Starting tracing session</FONT></H1>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>1.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Pre-create logging directory, such as c:\logs</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>2.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>On Vista or Server 2008, open elevated command window and type:<BR><BR>logman create trace <B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: red">mysession</SPAN></B> -o c:\logs\<B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: red">mylog</SPAN></B> -p "{<B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: red">A11a0820-c24b-428c-83e2-26b41091702e</SPAN></B>}"<BR>where the GUID is the same you have in the code line<BR></FONT><SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">private</SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: #2b91af">Guid</SPAN> providerId. <BR></SPAN><SPAN style="FONT-SIZE: 12pt; LINE-HEIGHT: 115%; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"><FONT face=Calibri>Other (red) parts of the command are arbitrary names</FONT></SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.<BR style="mso-special-character: line-break"><BR style="mso-special-character: line-break"></SPAN></P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>3.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Start tracing session using the command (for example):<BR>logman start <B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: red">mysession</SPAN></B><BR style="mso-special-character: line-break"><BR style="mso-special-character: line-break"></FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><A class="" title=_Toc216686803 name=_Toc216686803></A><FONT face=Cambria color=#365f91 size=5>Stopping and decoding tracing session</FONT></H1>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo3"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>1.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Stop session via command<BR>logman stop <B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: red">mysession</SPAN></B><BR style="mso-special-character: line-break"><BR style="mso-special-character: line-break"></FONT></P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo3"><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>2.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Decode log file<BR><SPAN style="FONT-SIZE: 12pt; COLOR: black; LINE-HEIGHT: 115%; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes; mso-themecolor: text1">tracerpt c:\logs</SPAN></FONT></FONT><SPAN style="FONT-SIZE: 12pt; COLOR: green; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">\</SPAN><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 12pt; COLOR: red; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">mylog</SPAN></B><SPAN style="FONT-SIZE: 12pt; COLOR: green; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">_000001.etl</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face=Calibri size=3>As a result of the decoding, you have, in the current directory, 2 files:</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><BR><FONT face=Calibri size=3>dumpfile.xml – contains your decoded trace file</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face=Calibri size=3>Summary.txt – some statistical information</FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>Request authorization in Azure SDK</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/request-authorization-in-azure-sdk</link>
      <pubDate>Wed, 10 Dec 2008 16:07:00 GMT</pubDate>
      <dc:creator><![CDATA[Sergei Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/2008/12/10/request-authorization-in-azure-sdk/</guid>
      <description><![CDATA[Request authorization in Azure SDK
Sergei Meleshchuk - blog
Introduction
&nbsp;
Azure storage...]]></description>
      <content:encoded><![CDATA[<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 4pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; mso-element: para-border-div; mso-border-bottom-themecolor: accent1">
<P class=MsoTitle style="MARGIN: 0in 0in 15pt"><FONT face=Cambria color=#17365d size=7>Request authorization in Azure SDK</FONT></P></DIV>
<H1 style="MARGIN: 24pt 0in 0pt"><A href="http://blogs.msdn.com/sergeim/default.aspx" mce_href="http://blogs.msdn.com/sergeim/default.aspx"><FONT face=Cambria color=#0000ff size=5>Sergei Meleshchuk - blog</FONT></A><SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></H1>
<H1 style="MARGIN: 24pt 0in 0pt"><FONT face=Cambria color=#365f91 size=5>Introduction</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Azure storage requires all client REST requests be “signed”. The storage server validates the signature. The server will reject the request if it is not properly signed.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The goal of this post is to explain how the client-side signing works. That can help when troubleshooting 403 error codes. In addition, you can sign your requests entirely bypassing the client library of the Azure SDK.</FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><FONT face=Cambria color=#365f91 size=5>Shared key authentication (authorization) in Azure</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Client (that is, you) receives a “key”, in a form of Base64 string. The key is sent to you when you sign for Azure services.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The client code takes certain parts of the request in a specific order, and builds (from those parts) a string. I refer to this string as to “signature string”. This string will be the argument to the signing algorithm, the latter computes the “signature”. This computed signature is sent, along with the request, to the server. Needless to say, the shared key itself is not sent.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Thus, the client-side signing procedure is:</FONT></P>
<P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Build a “signature string”, from which the actual signature will be computed,</FONT></P>
<P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Compute signature, using the “signature string” as an argument, and using the shared key</FONT></P>
<P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT face=Calibri size=3>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Send the resulting signature in a form of additional request header.</FONT></P>
<H2 style="MARGIN: 10pt 0in 0pt"><FONT face=Cambria color=#4f81bd size=4>Building the signature string</FONT></H2>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>By far the most interesting part of the whole signing exercise are rules of building the signature string. I start by listing parts of the request, which go into signature string.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>There are two parts. </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The first part is the “suffix” of the request URL, which is everything that follows the hostname part of the URL, without the query params starting with “?”.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>For example, if the URL is</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 12pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">“</SPAN><A href="http://accountname.queue.core.windows.net/queuename/messages?numofmessages=1&amp;timeout=30" mce_href="http://accountname.queue.core.windows.net/queuename/messages?numofmessages=1&amp;timeout=30"><SPAN style="FONT-SIZE: 12pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT color=#0000ff>http://accountname.queue.core.windows.net/queuename/messages?numofmessages=1&amp;timeout=30</FONT></SPAN></A><SPAN style="FONT-SIZE: 12pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">”<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>Then the suffix part for signature is:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>“queuename/messages”.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT size=3><SPAN style="mso-no-proof: yes"><FONT face=Calibri>Part 2 is composed of HTTP request header values, but not all of them. There are two groups of headers that do participate: 1) legacy headers like date, MD5, content type, and 2) Azure-specific headers, which are headers with names starting with “</FONT></SPAN><SPAN style="FONT-SIZE: 12pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">x-ms-</SPAN><SPAN style="mso-no-proof: yes"><FONT face=Calibri>”. For example, “x-ms-date”.<o:p></o:p></FONT></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>For queue and blob storage, the first group can be ignored. <o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>The second group is, in general case, sorted by ascending header name, and concatenated. However, because in all practical cases, we only need one header (which is “x-ms-date”), I ignore the multi-header case here. The gain is extreeme simplicity of the resulting code.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>The signature string needs the value of current time, in UTC, and in standard format. The time<SPAN style="mso-tab-count: 1">&nbsp; </SPAN>is to be retrieved by the code:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">string</SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> date = <SPAN style="COLOR: #2b91af">DateTime</SPAN>.UtcNow.ToString(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"R"</SPAN>, <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>Now, here is the code that builds the signature string:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">string</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> signPart1 = <SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"{0}\n{1}\n{2}\n{3}\n{4}\n/"</SPAN>,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>method,<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 0 - HTTP Method, like GET<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>string</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Empty,<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 1 - "Content-MD5" header value. Leave blank.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>string</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Empty,<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 2 - Content type, like MIME. Leave blank.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>string</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Empty,<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 3 - Legacy "date" header. Leave blank.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>"x-ms-date:"</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> + date);<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// 4 - Azure form of date header.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">string</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> signPart2 = accountName + <SPAN style="COLOR: #a31515">"/"</SPAN> + suffix;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">string</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> signatureString = signPart1 + signPart2;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>The resulting signature string looks like below.<SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>"GET\n\n\n\nx-ms-date:Mon, 01 Dec 2008 05:17:57 GMT\n/accountname/queuename/messages"<o:p></o:p></FONT></FONT></SPAN></P>
<H2 style="MARGIN: 10pt 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=4><FONT color=#4f81bd><FONT face=Cambria>Building the signature from signature string<o:p></o:p></FONT></FONT></FONT></SPAN></H2>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>This is easy part. All the needed code is:</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">byte</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">[] signBytes = System.Text.<SPAN style="COLOR: #2b91af">Encoding</SPAN>.UTF8.GetBytes(signatureString);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">byte</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">[] hash = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">HMACSHA256</SPAN>(sharedKey).ComputeHash(signBytes);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">string</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> signature = System.<SPAN style="COLOR: #2b91af">Convert</SPAN>.ToBase64String(hash);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">return</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> signature;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>The first line converts the signature string to byte array; this is needed because the actual hash-computing code works on byte arrays.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>The second line computes the hash.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>And the third and the last line just convert the signature to Base64.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri>Note: the “sharedKey” used in line 2 is computed, once, from the Base64 shared key your received by the code like below, also straightforward:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">public</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">byte</SPAN>[] Key<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: #2b91af">Convert</SPAN>.FromBase64String(Base64Key); }<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">}</SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<H1 style="MARGIN: 24pt 0in 0pt"><FONT face=Cambria color=#365f91 size=5>How do we actually sign the HTTP request</FONT></H1>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Azure SDK uses an Azure-specific HTTP header, with the name “Authorization”. Don’t be confused by “authorization” vs. “authentication” – the actual use as per now is for authentication of the client. And authentication/authorization header value is computed as below:</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">string</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> AuthHeaderValue = <SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"SharedKey {0}:{1}"</SPAN>,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>accountName,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>signature);</SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Now we all we need to build needed headers for signed HTTP REST request:</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">request.Headers.Add(<SPAN style="COLOR: #a31515">"x-ms-date"</SPAN>, date);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">request.Headers.Add(<SPAN style="COLOR: #a31515">"Authorization"</SPAN>, AuthHeaderValue);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The End</FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>Prepare VM: Add ISO Programmatically . Hyper-V, C# version</title>
      <link>https://docs.microsoft.com/archive/blogs/sergeim/prepare-vm-add-iso-programmatically-hyper-v-c-version</link>
      <pubDate>Fri, 06 Jun 2008 05:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Sergei Meleshchuk]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sergeim/2008/06/06/prepare-vm-add-iso-programmatically-hyper-v-c-version/</guid>
      <description><![CDATA[Prepare VM: Programmatically Add ISO. Hyper-V, C# version
[Sergei Meleshchuk....]]></description>
      <content:encoded><![CDATA[<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; PADDING-LEFT: 0in; BORDER-TOP: medium none; PADDING-BOTTOM: 4pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; mso-element: para-border-div; mso-border-bottom-themecolor: accent1">
<P style="MARGIN: 0in 0in 15pt" class=MsoTitle><FONT color=#17365d><FONT face=Cambria><FONT size=7>Prepare VM: Programmatically Add ISO. </FONT><SPAN style="FONT-SIZE: 20pt; mso-bidi-font-size: 26.0pt">Hyper-V, C# version</SPAN></FONT></FONT></P></DIV>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>[Sergei Meleshchuk. http://blogs.msdn.com/sergeim/]&nbsp;</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Imagine I want prepare VM fully automatically (programmatically, via code). Say I need a fully functional VM. That is, OS and applications loaded, ready for use. Why adding (mounting) ISO is important here?</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Here is why. To set up a VM, I need 3 or 4 steps:</FONT></P>
<P style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>Create VM</FONT></P>
<P style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>Add (mount) installation disk. That is, add ISO</FONT></P>
<P style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>Boot from this ISO image</FONT></P>
<P style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>Next depends on ISO. If this is normal OS image, you will need to finish installation with some manual actions. However, ISO may contain PXE which will just do un-attended installation from say network share or via WDS (this is for future post).</FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><FONT color=#365f91 size=5 face=Cambria>About this document</FONT></H1>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>I outline steps (of adding ISO), briefly comment on implementation of each step, than provide complete code.</FONT></P>
<H2 style="MARGIN: 10pt 0in 0pt"><FONT color=#4f81bd size=4 face=Cambria>Credits</FONT></H2>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Inspired by James O’Neill’s PowerShell code. See his site.</FONT></P>
<H1 style="MARGIN: 24pt 0in 0pt"><FONT color=#365f91 size=5 face=Cambria>Steps outline</FONT></H1>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Step 1 will be grabbing an empty “template” of the ISO image. This template is pre-existent in Hyper-V WMI-based management infrastructure.</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Step 2 is to obtain management object representing our VM; the VM is likely to be just created. We only need this VM object to get access to the disk controller. To cut down number of command line parameters, we will hard-code the controller ID: it will be 1 (naturally).</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Step 3 will be obtaining the controller object. That is, the WMI object representing controller 1 on specific VM.</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Step 4, somewhat lengthy to explain. There is a pre-existing disk object for each disk controller 1 on each VM. This disk object has parent field, which is the controller’s identifier in WMI meaning of the word “identifier”. That is, the parent field is the WMI object path, usually pretty long string. Thus we will search for the disk object by scanning controllers, and comparing their Path with the parent field in each disk object. Little clumsy, yet I don’t know of another way.</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Step 5. Here important work starts. We set values on template (from step 1). There will be 2 values to set: a) path to ISO image, which we originally obtain from the command line and b) the disk object from step 4.</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Step 6 is to ask the management service to add the template (from step 4) to the VM (from step 2).</FONT></P>
<H2 style="MARGIN: 10pt 0in 0pt"><FONT color=#4f81bd size=4 face=Cambria>Step 0. Preparation</FONT></H2>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Use abbreviations and get data from command line. This is simple.</FONT></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">using</SPAN> <SPAN style="COLOR: #2b91af">MO</SPAN> = <SPAN style="COLOR: #2b91af">ManagementObject</SPAN>;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">using</SPAN> <SPAN style="COLOR: #2b91af">MBO</SPAN> = <SPAN style="COLOR: #2b91af">ManagementBaseObject</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">using</SPAN> <SPAN style="COLOR: #2b91af">MOS</SPAN> = <SPAN style="COLOR: #2b91af">ManagementObjectCollection</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>. . .</FONT></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">const</SPAN> <SPAN style="COLOR: blue">string</SPAN> CONTROLLER_ID_1 = <SPAN style="COLOR: #a31515">"1"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> vmDisplayName;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> iso;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// e.g. @"H:\ISO\Virtual Server 2008\amd64fre.iso";<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// get arguments<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (args.Length &lt; 2)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: #a31515">"usage: addiso &lt;vmElementName&gt; &lt;isoPath&gt;"</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>vmDisplayName = args[0];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>iso = args[1];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<H2 style="MARGIN: 10pt 0in 0pt"><FONT color=#4f81bd size=4 face=Cambria>Step 1. Get ISO template object</FONT></H2>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>One line:</FONT></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">MO</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> moTemplateRasd = GetISOTemplate();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>where the GetISOTemplate we have to write ourselves:</FONT></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">private</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> <SPAN style="COLOR: #2b91af">MO</SPAN> GetISOTemplate()<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> where;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> capability = GetWmiObject(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"MsVM_AllocationCapabilities"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"ResourceType = 21 and ResourceSubType = 'Microsoft Virtual CD/DVD Disk'"</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>AssertWmi(capability);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// -- MsVM_SettingsDefineCapabilities<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>where = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"valuerange=0 and Groupcomponent = \"{0}\""</SPAN>, <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>FixPath(capability.Path.Path));<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Log(capability.Path.Path);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Log(where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> define = GetWmiObject(<SPAN style="COLOR: #a31515">"MsVM_SettingsDefineCapabilities"</SPAN>, where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> partComponent = define[<SPAN style="COLOR: #a31515">"partcomponent"</SPAN>] <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: blue">string</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Log(<SPAN style="COLOR: #a31515">"*{0}"</SPAN>, partComponent);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// -- MsVM_ResourceAllocationSettingData for IDE drive (RASD/IDE)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> component = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">MO</SPAN>(partComponent);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Logc(<SPAN style="COLOR: #a31515">"COMP"</SPAN>, <SPAN style="COLOR: #a31515">"#{0}"</SPAN>, component.Path.Path);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// this ws the one we want to set parent of<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>DumpMO(<SPAN style="COLOR: #a31515">"COMP"</SPAN>, component);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> component;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<H2 style="MARGIN: 10pt 0in 0pt"><FONT color=#4f81bd size=4 face=Cambria>Step 2. Get VM object.</FONT></H2>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>This is straight:</FONT></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: #2b91af; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">MO</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> moVmComputerSystem = GetVM(vmDisplayName);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">string</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> vmGuidName = moVmComputerSystem[<SPAN style="COLOR: #a31515">"name"</SPAN>] <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: blue">string</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>with the GetVM function being:</FONT></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: #2b91af; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">MO</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> GetVM(<SPAN style="COLOR: blue">string</SPAN> vmElementName)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> where;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>where = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"elementname='{0}'"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>vmElementName);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> theVm = GetWmiObject(<SPAN style="COLOR: #a31515">"msvm_computersystem"</SPAN>, where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> theVm;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<H2 style="MARGIN: 10pt 0in 0pt"><FONT color=#4f81bd size=4 face=Cambria>Step 3. Get controller.</FONT></H2>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>This is little difficult. We look for controller, having a) VM object and b) controller ID, which is traditionally (at the time of writing) 1.</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: #2b91af; LINE-HEIGHT: 115%; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">MO</SPAN><SPAN style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> moControllerRasd = GetController(moVmComputerSystem, CONTROLLER_ID_1);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">GetController is our function that we have to write. The code is below.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: #2b91af; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">MO</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> GetController(<SPAN style="COLOR: #2b91af">MO</SPAN> theVm, <SPAN style="COLOR: blue">string</SPAN> controllerId)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> vmName = theVm[<SPAN style="COLOR: #a31515">"name"</SPAN>] <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: blue">string</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> where = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"resourceSubtype='{0}' and instanceId Like 'Microsoft:{1}%' and address='{2}'"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"Microsoft Emulated IDE Controller"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>vmName,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>controllerId);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> moControllerRasd = GetWmiObject(<SPAN style="COLOR: #a31515">"MsVM_ResourceAllocationSettingData"</SPAN>, where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> moControllerRasd;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<H2 style="MARGIN: 10pt 0in 0pt"><FONT color=#4f81bd size=4 face=Cambria>Step 4. Get disk object – child of the controller</FONT></H2>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: #2b91af; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">MO</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> moDiskRasd = GetControllerChild(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>vmGuidName, <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>moControllerRasd.Path.Path);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Again, the GetControllerChild is what we have to write:</FONT></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: #2b91af; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">MO</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> GetControllerChild(<SPAN style="COLOR: blue">string</SPAN> vmName, <SPAN style="COLOR: blue">string</SPAN> controllerPath)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> where = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"parent Like '%Microsoft:{0}%'"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>vmName);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MOS</SPAN> childrenDisks = GetWmiObjects(<SPAN style="COLOR: #2b91af">Constants</SPAN>.RASD_CLASS, where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">MO</SPAN> disk <SPAN style="COLOR: blue">in</SPAN> childrenDisks)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> parentPath = disk[<SPAN style="COLOR: #a31515">"parent"</SPAN>] <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: blue">string</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (parentPath != <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (parentPath.Equals(controllerPath, <SPAN style="COLOR: #2b91af">StringComparison</SPAN>.OrdinalIgnoreCase))<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>DumpMO(<SPAN style="COLOR: #a31515">"child"</SPAN>, disk);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> disk;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">InvalidOperationException</SPAN>(<SPAN style="COLOR: #a31515">"Cant locate child drive for controller "</SPAN> + controllerPath);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<H2 style="MARGIN: 10pt 0in 0pt"><FONT color=#4f81bd size=4 face=Cambria>Step 5. Update template</FONT></H2>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">// Step 5. Now actual work:<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">//<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>- update template with disk resource data (by setting template's parent), and<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">//<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>- set ISO location<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">moTemplateRasd[<SPAN style="COLOR: #a31515">"parent"</SPAN>] = moDiskRasd.Path.Path;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">moTemplateRasd[<SPAN style="COLOR: #a31515">"connection"</SPAN>] = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">string</SPAN>[] { iso };<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">moTemplateRasd.Put();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<H2 style="MARGIN: 10pt 0in 0pt"><FONT color=#4f81bd size=4 face=Cambria>Step 6. Ask the management service to apply filled-in template</FONT></H2>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: #2b91af; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">MO</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> moManagementService = GetMsVM_virtualSystemManagementService();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="COLOR: #2b91af">MBO</SPAN> mboCallInParams = moManagementService.GetMethodParameters(<SPAN style="COLOR: #a31515">"AddVirtualSystemResources"</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>mboCallInParams[<SPAN style="COLOR: #a31515">"TargetSystem"</SPAN>] = moVmComputerSystem;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="COLOR: blue">string</SPAN> componentText = moTemplateRasd.GetText(<SPAN style="COLOR: #2b91af">TextFormat</SPAN>.WmiDtd20);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>mboCallInParams[<SPAN style="COLOR: #a31515">"ResourceSettingData"</SPAN>] = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">string</SPAN>[] { componentText };<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="COLOR: #2b91af">ManagementBaseObject</SPAN> mboCallOutParams = moManagementService.InvokeMethod(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"AddVirtualSystemResources"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>mboCallInParams,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">null</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<H1 style="MARGIN: 24pt 0in 0pt"><FONT color=#365f91 size=5 face=Cambria>Full code</FONT></H1>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">// auth: Sergei Meleshchuk, June 2008.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">// Based in part on powershell code by James O'Naill<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">using</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> System;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">using</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> System.Management;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">using</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> System.Globalization;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">namespace</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> Hyperv.Misc<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">using</SPAN> <SPAN style="COLOR: #2b91af">MO</SPAN> = <SPAN style="COLOR: #2b91af">ManagementObject</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">using</SPAN> <SPAN style="COLOR: #2b91af">MBO</SPAN> = <SPAN style="COLOR: #2b91af">ManagementBaseObject</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">using</SPAN> <SPAN style="COLOR: #2b91af">MOS</SPAN> = <SPAN style="COLOR: #2b91af">ManagementObjectCollection</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">MainAddISO3<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> Main(<SPAN style="COLOR: blue">string</SPAN>[] args)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">AppDomain</SPAN>.CurrentDomain.UnhandledException += <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">UnhandledExceptionEventHandler</SPAN>(Oops);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MainAddISO3</SPAN> main = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">MainAddISO3</SPAN>();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>main.AddISO(args);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">void</SPAN> AddISO(<SPAN style="COLOR: blue">string</SPAN>[] args)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">const</SPAN> <SPAN style="COLOR: blue">string</SPAN> CONTROLLER_ID_1 = <SPAN style="COLOR: #a31515">"1"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> vmDisplayName;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> iso;<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// e.g. @"H:\ISO\Virtual Server 2008\6001.18000.080118-1840_amd64fre_Server_en-us_VL-KRMSXVOL_EN_DVD.iso";<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// get arguments<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (args.Length &lt; 2)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: #a31515">"usage: addiso &lt;vmElementName&gt; &lt;isoPath&gt;"</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>vmDisplayName = args[0];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>iso = args[1];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Step 1. Get template (of type: MsVM_ResourceAllocationSettingData)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> moTemplateRasd = GetISOTemplate();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Step 2. Get VM (needed when locating controller, of type msvm_ComputerSystem)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> moVmComputerSystem = GetVM(vmDisplayName);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> vmGuidName = moVmComputerSystem[<SPAN style="COLOR: #a31515">"name"</SPAN>] <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: blue">string</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Step 3. Get disk controller (of type: MsVM_ResourceAllocationSettingData)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> moControllerRasd = GetController(moVmComputerSystem, CONTROLLER_ID_1);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Step 4. Get Disk - the RASD object to which the controller is a parent<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> moDiskRasd = GetControllerChild(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>vmGuidName, <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>moControllerRasd.Path.Path);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Step 5. Now actual work:<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">//<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>- update template with disk resource data (by setting template's parent), and<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">//<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>- set ISO location<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>moTemplateRasd[<SPAN style="COLOR: #a31515">"parent"</SPAN>] = moDiskRasd.Path.Path;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>moTemplateRasd[<SPAN style="COLOR: #a31515">"connection"</SPAN>] = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">string</SPAN>[] { iso };<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>moTemplateRasd.Put();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Step 6. Now really actual work: Add actual resource from info in the template<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> moManagementService = GetMsVM_virtualSystemManagementService();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MBO</SPAN> mboCallInParams = moManagementService.GetMethodParameters(<SPAN style="COLOR: #a31515">"AddVirtualSystemResources"</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>mboCallInParams[<SPAN style="COLOR: #a31515">"TargetSystem"</SPAN>] = moVmComputerSystem;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> componentText = moTemplateRasd.GetText(<SPAN style="COLOR: #2b91af">TextFormat</SPAN>.WmiDtd20);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>mboCallInParams[<SPAN style="COLOR: #a31515">"ResourceSettingData"</SPAN>] = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">string</SPAN>[] { componentText };<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">ManagementBaseObject</SPAN> mboCallOutParams = moManagementService.InvokeMethod(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"AddVirtualSystemResources"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>mboCallInParams,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">null</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>DumpMBO(<SPAN style="COLOR: #a31515">"AddVirtualSystemResources:"</SPAN>, mboCallOutParams);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Check result here<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Main helpers<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">#region</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> helpers<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> GetVM(<SPAN style="COLOR: blue">string</SPAN> vmElementName)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> where;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>where = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"elementname='{0}'"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>vmElementName);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> theVm = GetWmiObject(<SPAN style="COLOR: #a31515">"msvm_computersystem"</SPAN>, where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> theVm;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> GetController(<SPAN style="COLOR: #2b91af">MO</SPAN> theVm, <SPAN style="COLOR: blue">string</SPAN> controllerId)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> vmName = theVm[<SPAN style="COLOR: #a31515">"name"</SPAN>] <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: blue">string</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> where = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"resourceSubtype='{0}' and instanceId Like 'Microsoft:{1}%' and address='{2}'"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"Microsoft Emulated IDE Controller"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>vmName,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>controllerId);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> moControllerRasd = GetWmiObject(<SPAN style="COLOR: #a31515">"MsVM_ResourceAllocationSettingData"</SPAN>, where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> moControllerRasd;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> GetControllerChild(<SPAN style="COLOR: blue">string</SPAN> vmName, <SPAN style="COLOR: blue">string</SPAN> controllerPath)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> where = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"parent Like '%Microsoft:{0}%'"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>vmName);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MOS</SPAN> childrenDisks = GetWmiObjects(<SPAN style="COLOR: #2b91af">Constants</SPAN>.RASD_CLASS, where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">MO</SPAN> disk <SPAN style="COLOR: blue">in</SPAN> childrenDisks)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> parentPath = disk[<SPAN style="COLOR: #a31515">"parent"</SPAN>] <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: blue">string</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (parentPath != <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (parentPath.Equals(controllerPath, <SPAN style="COLOR: #2b91af">StringComparison</SPAN>.OrdinalIgnoreCase))<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>DumpMO(<SPAN style="COLOR: #a31515">"child"</SPAN>, disk);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> disk;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">InvalidOperationException</SPAN>(<SPAN style="COLOR: #a31515">"Cant locate child drive for controller "</SPAN> + controllerPath);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: #2b91af">MO</SPAN> GetMsVM_virtualSystemManagementService()<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> GetWmiObject(<SPAN style="COLOR: #a31515">"MsVM_virtualSystemManagementService"</SPAN>, <SPAN style="COLOR: blue">null</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: #2b91af">MO</SPAN> GetISOTemplate()<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> where;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> capability = GetWmiObject(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"MsVM_AllocationCapabilities"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"ResourceType = 21 and ResourceSubType = 'Microsoft Virtual CD/DVD Disk'"</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>AssertWmi(capability);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// -- MsVM_SettingsDefineCapabilities<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>where = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"valuerange=0 and Groupcomponent = \"{0}\""</SPAN>, <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>FixPath(capability.Path.Path));<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Log(capability.Path.Path);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>Log(where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> define = GetWmiObject(<SPAN style="COLOR: #a31515">"MsVM_SettingsDefineCapabilities"</SPAN>, where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> partComponent = define[<SPAN style="COLOR: #a31515">"partcomponent"</SPAN>] <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: blue">string</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Log(<SPAN style="COLOR: #a31515">"*{0}"</SPAN>, partComponent);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// -- MsVM_ResourceAllocationSettingData for IDE drive (RASD/IDE)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> component = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">MO</SPAN>(partComponent);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Logc(<SPAN style="COLOR: #a31515">"COMP"</SPAN>, <SPAN style="COLOR: #a31515">"#{0}"</SPAN>, component.Path.Path);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// this ws the one we want to set parent of<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>DumpMO(<SPAN style="COLOR: #a31515">"COMP"</SPAN>, component);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> component;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>#endregion</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> helpers<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>#region</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> generic wmi helpers<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">string</SPAN> FixPath(<SPAN style="COLOR: blue">string</SPAN> path)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> result = path.Replace(<SPAN style="COLOR: #a31515">"\\"</SPAN>, <SPAN style="COLOR: #a31515">"\\\\"</SPAN>).Replace(<SPAN style="COLOR: #a31515">"\""</SPAN>, <SPAN style="COLOR: #a31515">"'"</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ForegroundColor = <SPAN style="COLOR: #2b91af">ConsoleColor</SPAN>.DarkYellow;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Log(<SPAN style="COLOR: #a31515">"FixPath returns\n"</SPAN> + result);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ResetColor();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> result;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: #2b91af">MO</SPAN> GetWmiObject(<SPAN style="COLOR: blue">string</SPAN> classname, <SPAN style="COLOR: blue">string</SPAN> where)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MOS</SPAN> resultset = GetWmiObjects(classname, where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (resultset.Count != 1)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">InvalidOperationException</SPAN>(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"Cannot locate {0} where {1}"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>classname,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>where));<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MOS</SPAN>.<SPAN style="COLOR: #2b91af">ManagementObjectEnumerator</SPAN> en = resultset.GetEnumerator();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>en.MoveNext();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> result = en.Current <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: #2b91af">MO</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (result == <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">InvalidOperationException</SPAN>(<SPAN style="COLOR: #a31515">"Failure retrieving "</SPAN> + classname + <SPAN style="COLOR: #a31515">" where "</SPAN> + where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> result;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: #2b91af">MOS</SPAN> GetWmiObjects(<SPAN style="COLOR: blue">string</SPAN> classname, <SPAN style="COLOR: blue">string</SPAN> where)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> query;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">ManagementScope</SPAN> scope = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ManagementScope</SPAN>(<SPAN style="COLOR: #a31515">@"root\virtualization"</SPAN>, <SPAN style="COLOR: blue">null</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (where != <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>query = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"select * from {0} where {1}"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>classname,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;</SPAN>where);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">else<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>query = <SPAN style="COLOR: blue">string</SPAN>.Format(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CultureInfo</SPAN>.InvariantCulture,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #a31515">"select * from {0}"</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>classname);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">ManagementObjectSearcher</SPAN> searcher = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ManagementObjectSearcher</SPAN>(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>scope,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ObjectQuery</SPAN>(query));<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">ManagementObjectCollection</SPAN> resultset = searcher.Get();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> resultset;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">void</SPAN> AssertWmi(<SPAN style="COLOR: #2b91af">MO</SPAN> mo)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (mo == <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">NullReferenceException</SPAN>(<SPAN style="COLOR: #a31515">"dfasd"</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">void</SPAN> AssertNotNull(<SPAN style="COLOR: blue">string</SPAN> tag, <SPAN style="COLOR: blue">object</SPAN> o)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (o == <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">NullReferenceException</SPAN>(<SPAN style="COLOR: #a31515">"AssertFailed with tag "</SPAN> + tag);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>#endregion</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> generic wmi helpers<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// -- end of main helpers<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// ---- Logging functions -----<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>#region</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> logging<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> Log(<SPAN style="COLOR: blue">string</SPAN> message, <SPAN style="COLOR: blue">params</SPAN> <SPAN style="COLOR: blue">object</SPAN>[] data)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(message, data);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> Logc(<SPAN style="COLOR: blue">string</SPAN> title, <SPAN style="COLOR: blue">string</SPAN> message, <SPAN style="COLOR: blue">params</SPAN> <SPAN style="COLOR: blue">object</SPAN>[] data)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ForegroundColor = <SPAN style="COLOR: #2b91af">ConsoleColor</SPAN>.Green;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.Write(title);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ResetColor();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(message, data);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> DumpMO(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> message, <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">MO</SPAN> mo, <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">params</SPAN> <SPAN style="COLOR: blue">object</SPAN>[] data)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ForegroundColor = <SPAN style="COLOR: #2b91af">ConsoleColor</SPAN>.White;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(message, data);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ResetColor();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">PropertyDataCollection</SPAN> props = mo.Properties;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">PropertyData</SPAN> prop <SPAN style="COLOR: blue">in</SPAN> props)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Log(<SPAN style="COLOR: #a31515">"{0:20} {1}"</SPAN>, prop.Name, prop.Value);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> DumpMBO(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> message,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">ManagementBaseObject</SPAN> mo,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">params</SPAN> <SPAN style="COLOR: blue">object</SPAN>[] data)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ForegroundColor = <SPAN style="COLOR: #2b91af">ConsoleColor</SPAN>.White;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(message, data);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ResetColor();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">PropertyDataCollection</SPAN> props = mo.Properties;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">PropertyData</SPAN> prop <SPAN style="COLOR: blue">in</SPAN> props)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Log(<SPAN style="COLOR: #a31515">"{0:20} {1}"</SPAN>, prop.Name, prop.Value);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>#endregion</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"> logging<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// expection handler<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> Oops(<SPAN style="COLOR: blue">object</SPAN> sender, <SPAN style="COLOR: #2b91af">UnhandledExceptionEventArgs</SPAN> e)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.BackgroundColor = <SPAN style="COLOR: #2b91af">ConsoleColor</SPAN>.White;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ForegroundColor = <SPAN style="COLOR: #2b91af">ConsoleColor</SPAN>.Black;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Exception</SPAN> ex = e.ExceptionObject <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: #2b91af">Exception</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Log(ex.Message);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.ResetColor();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Log(ex.ToString());<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>} <SPAN style="COLOR: green">// class MainCreateVm<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">Constants<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">internal</SPAN> <SPAN style="COLOR: blue">const</SPAN> <SPAN style="COLOR: blue">string</SPAN> DefineVirtualSystem = <SPAN style="COLOR: #a31515">"DefineVirtualSystem"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">internal</SPAN> <SPAN style="COLOR: blue">const</SPAN> <SPAN style="COLOR: blue">string</SPAN> ModifyVirtualSystem = <SPAN style="COLOR: #a31515">"ModifyVirtualSystem"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">internal</SPAN> <SPAN style="COLOR: blue">const</SPAN> <SPAN style="COLOR: blue">uint</SPAN> ERROR_SUCCESS = 0;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">internal</SPAN> <SPAN style="COLOR: blue">const</SPAN> <SPAN style="COLOR: blue">uint</SPAN> ERROR_INV_ARGUMENTS = 87;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">internal</SPAN> <SPAN style="COLOR: blue">const</SPAN> <SPAN style="COLOR: blue">string</SPAN> RASD_CLASS = <SPAN style="COLOR: #a31515">"MsVM_ResourceAllocationSettingData"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Lucida Console'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>]]></content:encoded>
    </item>
  </channel>
</rss>