An open source tool for arranging .NET source code
  • RSS
  • Add To My MSN
  • Add To Windows Live
  • Add To My Yahoo
  • Add To Google

Statistics

  • Entries (3)
  • Comments (2)

NArrange Mentioned in MSDN 

Friday, August 28, 2009 1:26:57 AM

NArrange was recently mentioned in Scott Mitchell's Toolbox article of MSDN (August 2009 issue).  What an honor, thanks Scott!  Read More



re: NArrange Mentioned in MSDN

Wednesday, September 2, 2009 3:13:31 AM James Nies

Hi, saw the atticle, tried it out. There is a small problem - it reorders methods tagged with the ComImport interop, hence breaking the COM contract. Otherwise it is a very nice bit of work!
 

Thanks John!  Yeah, the ComImport is an interesting scenario and something I hadn't yet come across.  However, NArrange already handles a similar scenario for StructLayout and a change to your custom configuration file should remedy it.  In the default config file, we have:

<Region Name="Fixed Fields">
    <Elements>
        <Element Type="Field">
            <Elements />
            <Filter Condition="$(Parent.Attributes) : 'StructLayout'" />
        </Element>
    </Elements>
</Region>
<Region Name="Fields">
     <Elements>
          <Element Type="Field">
              <Elements />
              <Group By="Access" SeparatorType="NewLine" />
              <Sort By="Name" />
         </Element>
      </Elements>
</Region>
 

In this example, a separate "Fixed Fields" region is created for fields whose parent class (or in this case structure) has the StructLayout attribute.  Also notice that within the fixed field region, no sorting is applied, so fields that fall into this filter will just be directly output to the file in the same order they were encountered.

The same thing should work if you were to add a "Fixed Methods" region prior to the "Methods" declaration in the DefaultInterface configuration.  However, you'd be filtering for the ComImport attribute on the parent and it would apply to methods instead of fields.

Hope I understood the problem and that this helps!  However, I must admit I'm not well-versed in ComImport usage/syntax.


re: NArrange Mentioned in MSDN

Wednesday, September 2, 2009 1:55:46 AM John

Hi, saw the atticle, tried it out.  There is a small problem - it reorders methods tagged with the ComImport interop, hence breaking the COM contract.  Otherwise it is a very nice bit of work!


Comments are closed on this post.

Site Map | Printable View | © 2008 - 2017 NArrange | Powered by mojoPortal | XHTML 1.0 | CSS | Site provided by Astral Softworks, LLC