Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Vb6
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
...
Sleep 500

We want no declaration and calls like this:

...
System.Threading.Thread.Sleep(500);

To make things more interesting this Declare was in a module that was shared throughout the system;  the declaration is being moved into a host project using the Shared

Code Block
<Compile Condition="%SrcName%=='AppCommon'">
   <Refactor>
      <Migrate id="GlobalDeclarations.Sleep" nPram="2" migName="System.Threading.Thread.Sleep" migStatus="external" />
   </Refactor>
</Compile>

Changes the calls in AppCommon as expected

...

Code Block
FromCode\AppCommon.dll.xml

      <method id="Sleep" migName="System.Threading.Thread.Sleep" type="Void">
         <argument id="dwMilliseconds" type="Integer" status="ByVal"/>
      </method>

The migName attribute alters calls made to the method the codes that reference AppCommon.DLL.

...

Code Block
<Author Condition="%SrcName%=='AppCommon'">
<Fix host="%SrcName%" name="PostEdit">
   <Replace name="Remove GlobalDeclaration.Sleep">
   <OldBlock><![CDATA[
         [DllImport("kernel32")]
         public static extern void System.Threading.Thread.Sleep(int dwMilliseconds);
   ]]></OldBlock>      
   </Replace>
</Fix>

...