The Dec-2019 Release introduces a change in how some of the samples do COM API upgrades.
In prior releases, the deep migration work in the samples was partially done by DLLs developed using our C-based API (gmNI). gmNI is not available for typical gmStudio users, and we wanted to rework the samples using our scripting language, gmSL. In addition, prior releases of the samples used custom COM Interface Description Files (IDFs). The custom IDFs are a convenient way to map a COM API to its .NET replacement, but they have some disadvantages from a tooling and maintainability perspective. In this release, we are going to use Refactor files to specify mapping COM APIs to their .NET replacement. In some cases, the mappings also include instructions to load gmSL scripts that perform deep migration. The gmSL scripts that are distributed as text files with the tool and the samples and they may be extended and altered by users to meet their specific upgrade needs. Note: the COM upgrade techniques demonstrated in the samples are general capabilities that may be applied to any COM API. Additional examples of COM upgrade rules are published on the gmStudio Extensions page.
Deep Migration: An upgrade requiring advanced transformations such as adding or removing logic and choosing from different replacement types and coding patterns. Deep migration goes beyond the surface migrations and alterations which can be specified with refactoring attributes on various COM API elements in an IDF.
The gmNI DLLs, ScrrunMigration.dll and MscomctlMigration.dll, are no longer distributed with gmStudio. Please apply the new approach using gmSL scripts as illustrated in the latest samples. Contact Great Migrations if you require assistance.
The ScanTool sample includes several COM API replacements. One of these, Scrrun to System.IO, requires a number of deep migrations:
* Replacing FileSystemObject operations with calls to static functions
* Migrating TextStream instances and calls to one of several .NET Streams based on usage
In prior releases of the sample, the Scripting to System.IO migration was done using a custom IDF and an associated gmNI DLL: GM.scrrun.dll.xml and ScrrunMigration.dll. These migration assets were activated using the following commands in the translation script:
<Registry type="libname" source="scrrun.dll" target="GM.scrrun.dll" /> <Registry type="idfstatus" source="GM.scrrun.dll" target="migrate" />
and in the custom IDF:
<Refactor id="[GM.scrrun.dll]" dllName="ScrrunMigration.dll" event="scrrun" >
Starting with the Dec-2019 Release, we are doing the Scripting to System.IO migration with a COM Refactor IDF file and an associated gmSL script: Refactor.Scrrun.dll.xml and Transform.Scrrun.gmsl. These migration assets are activated using the following command in the translation script:
<Registry type="MigFile" source="scrrun.dll" target="Refactor.scrrun.dll" />
and in the custom Refactor IDF File:
<gmSL NameSpace="scrrun" class="Transform" Source="Transform.Scrrun.gmsl" />
This change has several advantages:
The following files are used to direct the COM migrations for the ScanTool sample:
Additional examples of these files and other COM upgrade rules are published on the gmStudio Extensions page.
Other Samples
These changes also impact the FileExplorer, FMStocks, and WPFScanTool samples.