[mapguide-commits] r9802 - in sandbox/jng/vanilla_swig/Bindings/src: Managed/DotNet/Common Managed/DotNet/MapGuideDotNetApi Managed/DotNet/MapGuideDotNetApi/custom SwigCommon/DotNet Test/DotNet/src/TestMapGuideApi/ExternalTests Test/DotNet/src/TestMisc Tools/ClassMapGen Tools/ClassMapGen/Data/Templates
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Nov 21 07:32:08 PST 2020
Author: jng
Date: 2020-11-21 07:32:08 -0800 (Sat, 21 Nov 2020)
New Revision: 9802
Removed:
sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/custom/MgClassMap.cs
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/ExternalTests/ClassIdSanityTest.cs
Modified:
sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/Common/MgClassMap.cs
sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/MapGuideDotNetApi.csproj
sandbox/jng/vanilla_swig/Bindings/src/SwigCommon/DotNet/coreclr_compat.i
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs
sandbox/jng/vanilla_swig/Bindings/src/Tools/ClassMapGen/Data/Templates/dotnet.txt
sandbox/jng/vanilla_swig/Bindings/src/Tools/ClassMapGen/Program.cs
Log:
Rework class map setup on .net so that it mirrors its java ObjectFactory counterpart, which is that we don't build a dictionary of class id -> class name, which then requires a class id -> class name -> .net type constructor lookup at runtime.
Instead build a dictionary of class id -> .net type constructor. If we missed a class, it will manifest as an exception in MgClassMap's static ctor rather than fail later on.
By doing this, we have effectively replicated the class id sanity test (the act of successfully obtaining a .net type constructor *is* testing that said class exists in .net) and as a result that test is now redundant, so it has been removed from the .net test suite.
We also have a nice benefit of avoiding having to do repeated .net assembly/constructor lookups on every MgObjectFactory.CreateObject() invocation as that is now all cached in the auto-generated MgClassMap.
Modified: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/Common/MgClassMap.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/Common/MgClassMap.cs 2020-11-20 15:56:48 UTC (rev 9801)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/Common/MgClassMap.cs 2020-11-21 15:32:08 UTC (rev 9802)
@@ -2,242 +2,264 @@
using System;
using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
namespace OSGeo.MapGuide
{
internal static class MgClassMap
{
- //TODO: We should take a page out of the java binding and convert this to a
- //Dictionary<int, ConstructorInfo>. This would save us having to do repeated lookups
- //for this information. Also it would serve as a fail-early sanity check that we are
- //not registering class ids of classes that are not actual classes (eg. Classes with
- //constants should not be here)
- static Dictionary<int, string> classNameMap;
+ static HashSet<string> assemblyNames;
+ static Dictionary<int, ConstructorInfo> classIdCtorMap;
static Dictionary<string, int> nameClassMap;
static MgClassMap()
{
- classNameMap = new Dictionary<int, string>();
+ assemblyNames = new HashSet<string>
+ {
+ "OSGeo.MapGuide.Foundation",
+ "OSGeo.MapGuide.Geometry",
+ "OSGeo.MapGuide.PlatformBase",
+ "OSGeo.MapGuide.MapGuideCommon",
+ "OSGeo.MapGuide.Web",
+ "OSGeo.MapGuide.Portable"
+ };
+
+ classIdCtorMap = new Dictionary<int, ConstructorInfo>();
+ var classNameMap = new Dictionary<int, string>();
nameClassMap = new Dictionary<string, int>();
- classNameMap[20004] = "OSGeo.MapGuide.MgAgfReaderWriter";
- classNameMap[20005] = "OSGeo.MapGuide.MgAggregateGeometry";
- classNameMap[20006] = "OSGeo.MapGuide.MgArcSegment";
- classNameMap[1005] = "OSGeo.MapGuide.MgBatchPropertyCollection";
- classNameMap[10252] = "OSGeo.MapGuide.MgBlobProperty";
- classNameMap[10253] = "OSGeo.MapGuide.MgBooleanProperty";
- classNameMap[10254] = "OSGeo.MapGuide.MgByteProperty";
- classNameMap[1250] = "OSGeo.MapGuide.MgByteReader";
- classNameMap[1257] = "OSGeo.MapGuide.MgByteSink";
- classNameMap[1251] = "OSGeo.MapGuide.MgByteSource";
- classNameMap[11750] = "OSGeo.MapGuide.MgClassDefinition";
- classNameMap[11780] = "OSGeo.MapGuide.MgClassDefinitionCollection";
- classNameMap[10255] = "OSGeo.MapGuide.MgClobProperty";
- classNameMap[10250] = "OSGeo.MapGuide.MgColor";
- classNameMap[20003] = "OSGeo.MapGuide.MgCoordinate";
- classNameMap[20008] = "OSGeo.MapGuide.MgCoordinateCollection";
- classNameMap[20009] = "OSGeo.MapGuide.MgCoordinateIterator";
- classNameMap[20500] = "OSGeo.MapGuide.MgCoordinateSystem";
- classNameMap[20504] = "OSGeo.MapGuide.MgCoordinateSystemCatalog";
- classNameMap[20506] = "OSGeo.MapGuide.MgCoordinateSystemCategory";
- classNameMap[20510] = "OSGeo.MapGuide.MgCoordinateSystemCategoryDictionary";
- classNameMap[20507] = "OSGeo.MapGuide.MgCoordinateSystemDatum";
- classNameMap[20512] = "OSGeo.MapGuide.MgCoordinateSystemDatumDictionary";
- classNameMap[20511] = "OSGeo.MapGuide.MgCoordinateSystemDictionary";
- classNameMap[20521] = "OSGeo.MapGuide.MgCoordinateSystemDictionaryUtility";
- classNameMap[20509] = "OSGeo.MapGuide.MgCoordinateSystemEllipsoid";
- classNameMap[20513] = "OSGeo.MapGuide.MgCoordinateSystemEllipsoidDictionary";
- classNameMap[20514] = "OSGeo.MapGuide.MgCoordinateSystemEnum";
- classNameMap[20515] = "OSGeo.MapGuide.MgCoordinateSystemEnumInteger32";
- classNameMap[20501] = "OSGeo.MapGuide.MgCoordinateSystemFactory";
- classNameMap[20516] = "OSGeo.MapGuide.MgCoordinateSystemFilter";
- classNameMap[20517] = "OSGeo.MapGuide.MgCoordinateSystemFilterInteger32";
- classNameMap[20505] = "OSGeo.MapGuide.MgCoordinateSystemFormatConverter";
- classNameMap[20542] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticAnalyticalTransformDefParams";
- classNameMap[20543] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticInterpolationTransformDefParams";
- classNameMap[20544] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticMultipleRegressionTransformDefParams";
- classNameMap[20533] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticPath";
- classNameMap[20535] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticPathDictionary";
- classNameMap[20534] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticPathElement";
- classNameMap[20546] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticStandaloneTransformDefParams";
- classNameMap[20508] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformation";
- classNameMap[20536] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDef";
- classNameMap[20540] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDefDictionary";
- classNameMap[20541] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDefParams";
- classNameMap[20545] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformGridFile";
- classNameMap[20532] = "OSGeo.MapGuide.MgCoordinateSystemGridBase";
- classNameMap[20524] = "OSGeo.MapGuide.MgCoordinateSystemGridBoundary";
- classNameMap[20529] = "OSGeo.MapGuide.MgCoordinateSystemGridLine";
- classNameMap[20526] = "OSGeo.MapGuide.MgCoordinateSystemGridLineCollection";
- classNameMap[20530] = "OSGeo.MapGuide.MgCoordinateSystemGridRegion";
- classNameMap[20527] = "OSGeo.MapGuide.MgCoordinateSystemGridRegionCollection";
- classNameMap[20525] = "OSGeo.MapGuide.MgCoordinateSystemGridSpecification";
- classNameMap[20531] = "OSGeo.MapGuide.MgCoordinateSystemGridTick";
- classNameMap[20528] = "OSGeo.MapGuide.MgCoordinateSystemGridTickCollection";
- classNameMap[20518] = "OSGeo.MapGuide.MgCoordinateSystemMathComparator";
- classNameMap[20502] = "OSGeo.MapGuide.MgCoordinateSystemMeasure";
- classNameMap[20522] = "OSGeo.MapGuide.MgCoordinateSystemMgrs";
- classNameMap[20520] = "OSGeo.MapGuide.MgCoordinateSystemProjectionInformation";
- classNameMap[20503] = "OSGeo.MapGuide.MgCoordinateSystemTransform";
- classNameMap[20519] = "OSGeo.MapGuide.MgCoordinateSystemUnitInformation";
- classNameMap[20048] = "OSGeo.MapGuide.MgCoordinateXY";
- classNameMap[20051] = "OSGeo.MapGuide.MgCoordinateXYM";
- classNameMap[20049] = "OSGeo.MapGuide.MgCoordinateXYZ";
- classNameMap[20050] = "OSGeo.MapGuide.MgCoordinateXYZM";
- classNameMap[20010] = "OSGeo.MapGuide.MgCurve";
- classNameMap[20011] = "OSGeo.MapGuide.MgCurvePolygon";
- classNameMap[20047] = "OSGeo.MapGuide.MgCurvePolygonCollection";
- classNameMap[20012] = "OSGeo.MapGuide.MgCurveRing";
- classNameMap[20052] = "OSGeo.MapGuide.MgCurveRingCollection";
- classNameMap[20013] = "OSGeo.MapGuide.MgCurveSegment";
- classNameMap[20041] = "OSGeo.MapGuide.MgCurveSegmentCollection";
- classNameMap[20014] = "OSGeo.MapGuide.MgCurveString";
- classNameMap[20043] = "OSGeo.MapGuide.MgCurveStringCollection";
- classNameMap[11751] = "OSGeo.MapGuide.MgDataPropertyDefinition";
- classNameMap[11773] = "OSGeo.MapGuide.MgDataReader";
- classNameMap[1256] = "OSGeo.MapGuide.MgDateTime";
- classNameMap[10256] = "OSGeo.MapGuide.MgDateTimeProperty";
- classNameMap[11775] = "OSGeo.MapGuide.MgDeleteFeatures";
- classNameMap[2251] = "OSGeo.MapGuide.MgDisposable";
- classNameMap[1000] = "OSGeo.MapGuide.MgDisposableCollection";
- classNameMap[10257] = "OSGeo.MapGuide.MgDoubleProperty";
- classNameMap[30700] = "OSGeo.MapGuide.MgDrawingService";
- classNameMap[30901] = "OSGeo.MapGuide.MgDwfVersion";
- classNameMap[20001] = "OSGeo.MapGuide.MgEnvelope";
- classNameMap[1515] = "OSGeo.MapGuide.MgException";
- classNameMap[11772] = "OSGeo.MapGuide.MgFeatureAggregateOptions";
- classNameMap[11774] = "OSGeo.MapGuide.MgFeatureCommandCollection";
- classNameMap[31001] = "OSGeo.MapGuide.MgFeatureInformation";
- classNameMap[11764] = "OSGeo.MapGuide.MgFeatureProperty";
- classNameMap[11771] = "OSGeo.MapGuide.MgFeatureQueryOptions";
- classNameMap[11753] = "OSGeo.MapGuide.MgFeatureReader";
- classNameMap[11778] = "OSGeo.MapGuide.MgFeatureSchema";
- classNameMap[11779] = "OSGeo.MapGuide.MgFeatureSchemaCollection";
- classNameMap[11754] = "OSGeo.MapGuide.MgFeatureService";
- classNameMap[11786] = "OSGeo.MapGuide.MgFileFeatureSourceParams";
- classNameMap[20016] = "OSGeo.MapGuide.MgGeometricEntity";
- classNameMap[11756] = "OSGeo.MapGuide.MgGeometricPropertyDefinition";
- classNameMap[11757] = "OSGeo.MapGuide.MgGeometry";
- classNameMap[20020] = "OSGeo.MapGuide.MgGeometryCollection";
- classNameMap[20021] = "OSGeo.MapGuide.MgGeometryComponent";
- classNameMap[20002] = "OSGeo.MapGuide.MgGeometryFactory";
- classNameMap[11758] = "OSGeo.MapGuide.MgGeometryProperty";
- classNameMap[20054] = "OSGeo.MapGuide.MgGeometrySimplifier";
- classNameMap[11785] = "OSGeo.MapGuide.MgGeometryTypeInfo";
- classNameMap[11782] = "OSGeo.MapGuide.MgGwsFeatureReader";
- classNameMap[40000] = "OSGeo.MapGuide.MgHttpHeader";
- classNameMap[40006] = "OSGeo.MapGuide.MgHttpPrimitiveValue";
- classNameMap[40004] = "OSGeo.MapGuide.MgHttpRequest";
- classNameMap[40002] = "OSGeo.MapGuide.MgHttpRequestMetadata";
- classNameMap[40001] = "OSGeo.MapGuide.MgHttpRequestParam";
- classNameMap[40005] = "OSGeo.MapGuide.MgHttpResponse";
- classNameMap[40003] = "OSGeo.MapGuide.MgHttpResult";
- classNameMap[11776] = "OSGeo.MapGuide.MgInsertFeatures";
- classNameMap[10258] = "OSGeo.MapGuide.MgInt16Property";
- classNameMap[10259] = "OSGeo.MapGuide.MgInt32Property";
- classNameMap[10260] = "OSGeo.MapGuide.MgInt64Property";
- classNameMap[10000] = "OSGeo.MapGuide.MgIntCollection";
- classNameMap[31300] = "OSGeo.MapGuide.MgKmlService";
- classNameMap[30501] = "OSGeo.MapGuide.MgLayer";
- classNameMap[12003] = "OSGeo.MapGuide.MgLayerBase";
- classNameMap[12002] = "OSGeo.MapGuide.MgLayerCollection";
- classNameMap[12001] = "OSGeo.MapGuide.MgLayerGroup";
- classNameMap[12004] = "OSGeo.MapGuide.MgLayerGroupCollection";
- classNameMap[30904] = "OSGeo.MapGuide.MgLayout";
- classNameMap[20023] = "OSGeo.MapGuide.MgLinearRing";
- classNameMap[20053] = "OSGeo.MapGuide.MgLinearRingCollection";
- classNameMap[20024] = "OSGeo.MapGuide.MgLinearSegment";
- classNameMap[20042] = "OSGeo.MapGuide.MgLineString";
- classNameMap[20044] = "OSGeo.MapGuide.MgLineStringCollection";
- classNameMap[11766] = "OSGeo.MapGuide.MgLongTransactionReader";
- classNameMap[30500] = "OSGeo.MapGuide.MgMap";
- classNameMap[12000] = "OSGeo.MapGuide.MgMapBase";
- classNameMap[12005] = "OSGeo.MapGuide.MgMapCollection";
- classNameMap[30900] = "OSGeo.MapGuide.MgMappingService";
- classNameMap[30905] = "OSGeo.MapGuide.MgMapPlot";
- classNameMap[30906] = "OSGeo.MapGuide.MgMapPlotCollection";
- classNameMap[20027] = "OSGeo.MapGuide.MgMeasure";
- classNameMap[31003] = "OSGeo.MapGuide.MgMetatile";
- classNameMap[20029] = "OSGeo.MapGuide.MgMultiCurvePolygon";
- classNameMap[20030] = "OSGeo.MapGuide.MgMultiCurveString";
- classNameMap[20031] = "OSGeo.MapGuide.MgMultiGeometry";
- classNameMap[20032] = "OSGeo.MapGuide.MgMultiLineString";
- classNameMap[20033] = "OSGeo.MapGuide.MgMultiPoint";
- classNameMap[20034] = "OSGeo.MapGuide.MgMultiPolygon";
- classNameMap[2252] = "OSGeo.MapGuide.MgObject";
- classNameMap[11759] = "OSGeo.MapGuide.MgObjectPropertyDefinition";
- classNameMap[30604] = "OSGeo.MapGuide.MgPackageStatusInformation";
- classNameMap[11788] = "OSGeo.MapGuide.MgParameter";
- classNameMap[10004] = "OSGeo.MapGuide.MgParameterCollection";
- classNameMap[30902] = "OSGeo.MapGuide.MgPlotSpecification";
- classNameMap[20000] = "OSGeo.MapGuide.MgPoint";
- classNameMap[20045] = "OSGeo.MapGuide.MgPointCollection";
- classNameMap[20035] = "OSGeo.MapGuide.MgPolygon";
- classNameMap[20046] = "OSGeo.MapGuide.MgPolygonCollection";
- classNameMap[20055] = "OSGeo.MapGuide.MgPreparedGeometry";
- classNameMap[31400] = "OSGeo.MapGuide.MgProfilingService";
- classNameMap[2000] = "OSGeo.MapGuide.MgProperty";
- classNameMap[1002] = "OSGeo.MapGuide.MgPropertyCollection";
- classNameMap[10251] = "OSGeo.MapGuide.MgPropertyDefinition";
- classNameMap[10001] = "OSGeo.MapGuide.MgPropertyDefinitionCollection";
- classNameMap[11769] = "OSGeo.MapGuide.MgRaster";
- classNameMap[11770] = "OSGeo.MapGuide.MgRasterProperty";
- classNameMap[11768] = "OSGeo.MapGuide.MgRasterPropertyDefinition";
- classNameMap[12006] = "OSGeo.MapGuide.MgReadOnlyLayerCollection";
- classNameMap[20037] = "OSGeo.MapGuide.MgRegion";
- classNameMap[31002] = "OSGeo.MapGuide.MgRenderingOptions";
- classNameMap[31000] = "OSGeo.MapGuide.MgRenderingService";
- classNameMap[11526] = "OSGeo.MapGuide.MgResource";
- classNameMap[11500] = "OSGeo.MapGuide.MgResourceIdentifier";
- classNameMap[11501] = "OSGeo.MapGuide.MgResourceService";
- classNameMap[20038] = "OSGeo.MapGuide.MgRing";
- classNameMap[30502] = "OSGeo.MapGuide.MgSelection";
- classNameMap[12007] = "OSGeo.MapGuide.MgSelectionBase";
- classNameMap[30607] = "OSGeo.MapGuide.MgServerAdmin";
- classNameMap[11251] = "OSGeo.MapGuide.MgService";
- classNameMap[10261] = "OSGeo.MapGuide.MgSingleProperty";
- classNameMap[30605] = "OSGeo.MapGuide.MgSite";
- classNameMap[30601] = "OSGeo.MapGuide.MgSiteConnection";
- classNameMap[30608] = "OSGeo.MapGuide.MgSiteInfo";
- classNameMap[11761] = "OSGeo.MapGuide.MgSpatialContextReader";
- classNameMap[11762] = "OSGeo.MapGuide.MgSqlDataReader";
- classNameMap[1003] = "OSGeo.MapGuide.MgStringCollection";
- classNameMap[2001] = "OSGeo.MapGuide.MgStringProperty";
- classNameMap[10003] = "OSGeo.MapGuide.MgStringPropertyCollection";
- classNameMap[31200] = "OSGeo.MapGuide.MgTileService";
- classNameMap[11787] = "OSGeo.MapGuide.MgTransaction";
- classNameMap[20039] = "OSGeo.MapGuide.MgTransform";
- classNameMap[11777] = "OSGeo.MapGuide.MgUpdateFeatures";
- classNameMap[30606] = "OSGeo.MapGuide.MgUserInformation";
- classNameMap[11257] = "OSGeo.MapGuide.MgWarnings";
- classNameMap[50005] = "OSGeo.MapGuide.MgWebBufferCommand";
- classNameMap[50000] = "OSGeo.MapGuide.MgWebCommand";
- classNameMap[50012] = "OSGeo.MapGuide.MgWebCommandCollection";
- classNameMap[50015] = "OSGeo.MapGuide.MgWebCommandWidget";
- classNameMap[50025] = "OSGeo.MapGuide.MgWebContextMenu";
- classNameMap[50016] = "OSGeo.MapGuide.MgWebFlyoutWidget";
- classNameMap[50009] = "OSGeo.MapGuide.MgWebGetPrintablePageCommand";
- classNameMap[50011] = "OSGeo.MapGuide.MgWebHelpCommand";
- classNameMap[50022] = "OSGeo.MapGuide.MgWebInformationPane";
- classNameMap[50003] = "OSGeo.MapGuide.MgWebInvokeScriptCommand";
- classNameMap[50004] = "OSGeo.MapGuide.MgWebInvokeUrlCommand";
- classNameMap[50026] = "OSGeo.MapGuide.MgWebLayout";
- classNameMap[50008] = "OSGeo.MapGuide.MgWebMeasureCommand";
- classNameMap[50007] = "OSGeo.MapGuide.MgWebPrintCommand";
- classNameMap[50002] = "OSGeo.MapGuide.MgWebSearchCommand";
- classNameMap[50006] = "OSGeo.MapGuide.MgWebSelectWithinCommand";
- classNameMap[50014] = "OSGeo.MapGuide.MgWebSeparatorWidget";
- classNameMap[50023] = "OSGeo.MapGuide.MgWebTaskBar";
- classNameMap[50017] = "OSGeo.MapGuide.MgWebTaskBarWidget";
- classNameMap[50024] = "OSGeo.MapGuide.MgWebTaskPane";
- classNameMap[50021] = "OSGeo.MapGuide.MgWebToolBar";
- classNameMap[50019] = "OSGeo.MapGuide.MgWebUiPane";
- classNameMap[50020] = "OSGeo.MapGuide.MgWebUiSizablePane";
- classNameMap[50001] = "OSGeo.MapGuide.MgWebUiTargetCommand";
- classNameMap[50010] = "OSGeo.MapGuide.MgWebViewOptionsCommand";
- classNameMap[50013] = "OSGeo.MapGuide.MgWebWidget";
- classNameMap[50018] = "OSGeo.MapGuide.MgWebWidgetCollection";
- classNameMap[20040] = "OSGeo.MapGuide.MgWktReaderWriter";
+ if (HasAssemblyInAppDomain("OSGeo.MapGuide.Foundation")) {
+ classIdCtorMap[1000] = ResolveConstructor("OSGeo.MapGuide.MgDisposableCollection");
+ classIdCtorMap[1002] = ResolveConstructor("OSGeo.MapGuide.MgPropertyCollection");
+ classIdCtorMap[1003] = ResolveConstructor("OSGeo.MapGuide.MgStringCollection");
+ classIdCtorMap[1004] = ResolveConstructor("OSGeo.MapGuide.MgStringPropertyCollection");
+ classIdCtorMap[1005] = ResolveConstructor("OSGeo.MapGuide.MgBatchPropertyCollection");
+ classIdCtorMap[1250] = ResolveConstructor("OSGeo.MapGuide.MgByteReader");
+ classIdCtorMap[1251] = ResolveConstructor("OSGeo.MapGuide.MgByteSource");
+ classIdCtorMap[1256] = ResolveConstructor("OSGeo.MapGuide.MgDateTime");
+ classIdCtorMap[1257] = ResolveConstructor("OSGeo.MapGuide.MgByteSink");
+ classIdCtorMap[1515] = ResolveConstructor("OSGeo.MapGuide.MgException");
+ classIdCtorMap[2000] = ResolveConstructor("OSGeo.MapGuide.MgProperty");
+ classIdCtorMap[2001] = ResolveConstructor("OSGeo.MapGuide.MgStringProperty");
+ classIdCtorMap[2002] = ResolveConstructor("OSGeo.MapGuide.MgPropertyDefinition");
+ classIdCtorMap[2251] = ResolveConstructor("OSGeo.MapGuide.MgDisposable");
+ classIdCtorMap[2252] = ResolveConstructor("OSGeo.MapGuide.MgObject");
+ }
+ if (HasAssemblyInAppDomain("OSGeo.MapGuide.Geometry")) {
+ classIdCtorMap[20000] = ResolveConstructor("OSGeo.MapGuide.MgPoint");
+ classIdCtorMap[20001] = ResolveConstructor("OSGeo.MapGuide.MgEnvelope");
+ classIdCtorMap[20002] = ResolveConstructor("OSGeo.MapGuide.MgGeometryFactory");
+ classIdCtorMap[20003] = ResolveConstructor("OSGeo.MapGuide.MgCoordinate");
+ classIdCtorMap[20004] = ResolveConstructor("OSGeo.MapGuide.MgAgfReaderWriter");
+ classIdCtorMap[20005] = ResolveConstructor("OSGeo.MapGuide.MgAggregateGeometry");
+ classIdCtorMap[20006] = ResolveConstructor("OSGeo.MapGuide.MgArcSegment");
+ classIdCtorMap[20008] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateCollection");
+ classIdCtorMap[20009] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateIterator");
+ classIdCtorMap[20010] = ResolveConstructor("OSGeo.MapGuide.MgCurve");
+ classIdCtorMap[20011] = ResolveConstructor("OSGeo.MapGuide.MgCurvePolygon");
+ classIdCtorMap[20012] = ResolveConstructor("OSGeo.MapGuide.MgCurveRing");
+ classIdCtorMap[20013] = ResolveConstructor("OSGeo.MapGuide.MgCurveSegment");
+ classIdCtorMap[20014] = ResolveConstructor("OSGeo.MapGuide.MgCurveString");
+ classIdCtorMap[20016] = ResolveConstructor("OSGeo.MapGuide.MgGeometricEntity");
+ classIdCtorMap[20019] = ResolveConstructor("OSGeo.MapGuide.MgGeometry");
+ classIdCtorMap[20020] = ResolveConstructor("OSGeo.MapGuide.MgGeometryCollection");
+ classIdCtorMap[20021] = ResolveConstructor("OSGeo.MapGuide.MgGeometryComponent");
+ classIdCtorMap[20023] = ResolveConstructor("OSGeo.MapGuide.MgLinearRing");
+ classIdCtorMap[20024] = ResolveConstructor("OSGeo.MapGuide.MgLinearSegment");
+ classIdCtorMap[20027] = ResolveConstructor("OSGeo.MapGuide.MgMeasure");
+ classIdCtorMap[20029] = ResolveConstructor("OSGeo.MapGuide.MgMultiCurvePolygon");
+ classIdCtorMap[20030] = ResolveConstructor("OSGeo.MapGuide.MgMultiCurveString");
+ classIdCtorMap[20031] = ResolveConstructor("OSGeo.MapGuide.MgMultiGeometry");
+ classIdCtorMap[20032] = ResolveConstructor("OSGeo.MapGuide.MgMultiLineString");
+ classIdCtorMap[20033] = ResolveConstructor("OSGeo.MapGuide.MgMultiPoint");
+ classIdCtorMap[20034] = ResolveConstructor("OSGeo.MapGuide.MgMultiPolygon");
+ classIdCtorMap[20035] = ResolveConstructor("OSGeo.MapGuide.MgPolygon");
+ classIdCtorMap[20037] = ResolveConstructor("OSGeo.MapGuide.MgRegion");
+ classIdCtorMap[20038] = ResolveConstructor("OSGeo.MapGuide.MgRing");
+ classIdCtorMap[20039] = ResolveConstructor("OSGeo.MapGuide.MgTransform");
+ classIdCtorMap[20040] = ResolveConstructor("OSGeo.MapGuide.MgWktReaderWriter");
+ classIdCtorMap[20041] = ResolveConstructor("OSGeo.MapGuide.MgCurveSegmentCollection");
+ classIdCtorMap[20042] = ResolveConstructor("OSGeo.MapGuide.MgLineString");
+ classIdCtorMap[20043] = ResolveConstructor("OSGeo.MapGuide.MgCurveStringCollection");
+ classIdCtorMap[20044] = ResolveConstructor("OSGeo.MapGuide.MgLineStringCollection");
+ classIdCtorMap[20045] = ResolveConstructor("OSGeo.MapGuide.MgPointCollection");
+ classIdCtorMap[20046] = ResolveConstructor("OSGeo.MapGuide.MgPolygonCollection");
+ classIdCtorMap[20047] = ResolveConstructor("OSGeo.MapGuide.MgCurvePolygonCollection");
+ classIdCtorMap[20048] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateXY");
+ classIdCtorMap[20049] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateXYZ");
+ classIdCtorMap[20050] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateXYZM");
+ classIdCtorMap[20051] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateXYM");
+ classIdCtorMap[20052] = ResolveConstructor("OSGeo.MapGuide.MgCurveRingCollection");
+ classIdCtorMap[20053] = ResolveConstructor("OSGeo.MapGuide.MgLinearRingCollection");
+ classIdCtorMap[20054] = ResolveConstructor("OSGeo.MapGuide.MgGeometrySimplifier");
+ classIdCtorMap[20055] = ResolveConstructor("OSGeo.MapGuide.MgPreparedGeometry");
+ classIdCtorMap[20500] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystem");
+ classIdCtorMap[20501] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemFactory");
+ classIdCtorMap[20502] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemMeasure");
+ classIdCtorMap[20503] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemTransform");
+ classIdCtorMap[20504] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemCatalog");
+ classIdCtorMap[20505] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemFormatConverter");
+ classIdCtorMap[20506] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemCategory");
+ classIdCtorMap[20507] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemDatum");
+ classIdCtorMap[20508] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformation");
+ classIdCtorMap[20509] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemEllipsoid");
+ classIdCtorMap[20510] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemCategoryDictionary");
+ classIdCtorMap[20511] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemDictionary");
+ classIdCtorMap[20512] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemDatumDictionary");
+ classIdCtorMap[20513] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemEllipsoidDictionary");
+ classIdCtorMap[20514] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemEnum");
+ classIdCtorMap[20515] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemEnumInteger32");
+ classIdCtorMap[20516] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemFilter");
+ classIdCtorMap[20517] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemFilterInteger32");
+ classIdCtorMap[20518] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemMathComparator");
+ classIdCtorMap[20519] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemUnitInformation");
+ classIdCtorMap[20520] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemProjectionInformation");
+ classIdCtorMap[20521] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemDictionaryUtility");
+ classIdCtorMap[20522] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemMgrs");
+ classIdCtorMap[20524] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGridBoundary");
+ classIdCtorMap[20525] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGridSpecification");
+ classIdCtorMap[20526] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGridLineCollection");
+ classIdCtorMap[20527] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGridRegionCollection");
+ classIdCtorMap[20528] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGridTickCollection");
+ classIdCtorMap[20529] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGridLine");
+ classIdCtorMap[20530] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGridRegion");
+ classIdCtorMap[20531] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGridTick");
+ classIdCtorMap[20532] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGridBase");
+ classIdCtorMap[20533] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticPath");
+ classIdCtorMap[20534] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticPathElement");
+ classIdCtorMap[20535] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticPathDictionary");
+ classIdCtorMap[20536] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDef");
+ classIdCtorMap[20540] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDefDictionary");
+ classIdCtorMap[20541] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDefParams");
+ classIdCtorMap[20542] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticAnalyticalTransformDefParams");
+ classIdCtorMap[20543] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticInterpolationTransformDefParams");
+ classIdCtorMap[20544] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticMultipleRegressionTransformDefParams");
+ classIdCtorMap[20545] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformGridFile");
+ classIdCtorMap[20546] = ResolveConstructor("OSGeo.MapGuide.MgCoordinateSystemGeodeticStandaloneTransformDefParams");
+ }
+ if (HasAssemblyInAppDomain("OSGeo.MapGuide.PlatformBase")) {
+ classIdCtorMap[10000] = ResolveConstructor("OSGeo.MapGuide.MgIntCollection");
+ classIdCtorMap[10001] = ResolveConstructor("OSGeo.MapGuide.MgPropertyDefinitionCollection");
+ classIdCtorMap[10003] = ResolveConstructor("OSGeo.MapGuide.MgStringPropertyCollection");
+ classIdCtorMap[10004] = ResolveConstructor("OSGeo.MapGuide.MgParameterCollection");
+ classIdCtorMap[10250] = ResolveConstructor("OSGeo.MapGuide.MgColor");
+ classIdCtorMap[10251] = ResolveConstructor("OSGeo.MapGuide.MgPropertyDefinition");
+ classIdCtorMap[10252] = ResolveConstructor("OSGeo.MapGuide.MgBlobProperty");
+ classIdCtorMap[10253] = ResolveConstructor("OSGeo.MapGuide.MgBooleanProperty");
+ classIdCtorMap[10254] = ResolveConstructor("OSGeo.MapGuide.MgByteProperty");
+ classIdCtorMap[10255] = ResolveConstructor("OSGeo.MapGuide.MgClobProperty");
+ classIdCtorMap[10256] = ResolveConstructor("OSGeo.MapGuide.MgDateTimeProperty");
+ classIdCtorMap[10257] = ResolveConstructor("OSGeo.MapGuide.MgDoubleProperty");
+ classIdCtorMap[10258] = ResolveConstructor("OSGeo.MapGuide.MgInt16Property");
+ classIdCtorMap[10259] = ResolveConstructor("OSGeo.MapGuide.MgInt32Property");
+ classIdCtorMap[10260] = ResolveConstructor("OSGeo.MapGuide.MgInt64Property");
+ classIdCtorMap[10261] = ResolveConstructor("OSGeo.MapGuide.MgSingleProperty");
+ classIdCtorMap[12000] = ResolveConstructor("OSGeo.MapGuide.MgMapBase");
+ classIdCtorMap[12001] = ResolveConstructor("OSGeo.MapGuide.MgLayerGroup");
+ classIdCtorMap[12002] = ResolveConstructor("OSGeo.MapGuide.MgLayerCollection");
+ classIdCtorMap[12003] = ResolveConstructor("OSGeo.MapGuide.MgLayerBase");
+ classIdCtorMap[12004] = ResolveConstructor("OSGeo.MapGuide.MgLayerGroupCollection");
+ classIdCtorMap[12005] = ResolveConstructor("OSGeo.MapGuide.MgMapCollection");
+ classIdCtorMap[12006] = ResolveConstructor("OSGeo.MapGuide.MgReadOnlyLayerCollection");
+ classIdCtorMap[12007] = ResolveConstructor("OSGeo.MapGuide.MgSelectionBase");
+ classIdCtorMap[11251] = ResolveConstructor("OSGeo.MapGuide.MgService");
+ classIdCtorMap[11257] = ResolveConstructor("OSGeo.MapGuide.MgWarnings");
+ classIdCtorMap[11750] = ResolveConstructor("OSGeo.MapGuide.MgClassDefinition");
+ classIdCtorMap[11751] = ResolveConstructor("OSGeo.MapGuide.MgDataPropertyDefinition");
+ classIdCtorMap[11753] = ResolveConstructor("OSGeo.MapGuide.MgFeatureReader");
+ classIdCtorMap[11754] = ResolveConstructor("OSGeo.MapGuide.MgFeatureService");
+ classIdCtorMap[11756] = ResolveConstructor("OSGeo.MapGuide.MgGeometricPropertyDefinition");
+ classIdCtorMap[11757] = ResolveConstructor("OSGeo.MapGuide.MgGeometry");
+ classIdCtorMap[11758] = ResolveConstructor("OSGeo.MapGuide.MgGeometryProperty");
+ classIdCtorMap[11759] = ResolveConstructor("OSGeo.MapGuide.MgObjectPropertyDefinition");
+ classIdCtorMap[11761] = ResolveConstructor("OSGeo.MapGuide.MgSpatialContextReader");
+ classIdCtorMap[11762] = ResolveConstructor("OSGeo.MapGuide.MgSqlDataReader");
+ classIdCtorMap[11764] = ResolveConstructor("OSGeo.MapGuide.MgFeatureProperty");
+ classIdCtorMap[11766] = ResolveConstructor("OSGeo.MapGuide.MgLongTransactionReader");
+ classIdCtorMap[11768] = ResolveConstructor("OSGeo.MapGuide.MgRasterPropertyDefinition");
+ classIdCtorMap[11769] = ResolveConstructor("OSGeo.MapGuide.MgRaster");
+ classIdCtorMap[11770] = ResolveConstructor("OSGeo.MapGuide.MgRasterProperty");
+ classIdCtorMap[11771] = ResolveConstructor("OSGeo.MapGuide.MgFeatureQueryOptions");
+ classIdCtorMap[11772] = ResolveConstructor("OSGeo.MapGuide.MgFeatureAggregateOptions");
+ classIdCtorMap[11773] = ResolveConstructor("OSGeo.MapGuide.MgDataReader");
+ classIdCtorMap[11774] = ResolveConstructor("OSGeo.MapGuide.MgFeatureCommandCollection");
+ classIdCtorMap[11775] = ResolveConstructor("OSGeo.MapGuide.MgDeleteFeatures");
+ classIdCtorMap[11776] = ResolveConstructor("OSGeo.MapGuide.MgInsertFeatures");
+ classIdCtorMap[11777] = ResolveConstructor("OSGeo.MapGuide.MgUpdateFeatures");
+ classIdCtorMap[11778] = ResolveConstructor("OSGeo.MapGuide.MgFeatureSchema");
+ classIdCtorMap[11779] = ResolveConstructor("OSGeo.MapGuide.MgFeatureSchemaCollection");
+ classIdCtorMap[11780] = ResolveConstructor("OSGeo.MapGuide.MgClassDefinitionCollection");
+ classIdCtorMap[11782] = ResolveConstructor("OSGeo.MapGuide.MgGwsFeatureReader");
+ classIdCtorMap[11785] = ResolveConstructor("OSGeo.MapGuide.MgGeometryTypeInfo");
+ classIdCtorMap[11786] = ResolveConstructor("OSGeo.MapGuide.MgFileFeatureSourceParams");
+ classIdCtorMap[11787] = ResolveConstructor("OSGeo.MapGuide.MgTransaction");
+ classIdCtorMap[11788] = ResolveConstructor("OSGeo.MapGuide.MgParameter");
+ classIdCtorMap[11500] = ResolveConstructor("OSGeo.MapGuide.MgResourceIdentifier");
+ classIdCtorMap[11501] = ResolveConstructor("OSGeo.MapGuide.MgResourceService");
+ classIdCtorMap[11526] = ResolveConstructor("OSGeo.MapGuide.MgResource");
+ }
+ if (HasAssemblyInAppDomain("OSGeo.MapGuide.MapGuideCommon")) {
+ classIdCtorMap[30500] = ResolveConstructor("OSGeo.MapGuide.MgMap");
+ classIdCtorMap[30501] = ResolveConstructor("OSGeo.MapGuide.MgLayer");
+ classIdCtorMap[30502] = ResolveConstructor("OSGeo.MapGuide.MgSelection");
+ classIdCtorMap[30601] = ResolveConstructor("OSGeo.MapGuide.MgSiteConnection");
+ classIdCtorMap[30604] = ResolveConstructor("OSGeo.MapGuide.MgPackageStatusInformation");
+ classIdCtorMap[30605] = ResolveConstructor("OSGeo.MapGuide.MgSite");
+ classIdCtorMap[30606] = ResolveConstructor("OSGeo.MapGuide.MgUserInformation");
+ classIdCtorMap[30607] = ResolveConstructor("OSGeo.MapGuide.MgServerAdmin");
+ classIdCtorMap[30608] = ResolveConstructor("OSGeo.MapGuide.MgSiteInfo");
+ classIdCtorMap[30700] = ResolveConstructor("OSGeo.MapGuide.MgDrawingService");
+ classIdCtorMap[30900] = ResolveConstructor("OSGeo.MapGuide.MgMappingService");
+ classIdCtorMap[30901] = ResolveConstructor("OSGeo.MapGuide.MgDwfVersion");
+ classIdCtorMap[30902] = ResolveConstructor("OSGeo.MapGuide.MgPlotSpecification");
+ classIdCtorMap[30904] = ResolveConstructor("OSGeo.MapGuide.MgLayout");
+ classIdCtorMap[30905] = ResolveConstructor("OSGeo.MapGuide.MgMapPlot");
+ classIdCtorMap[30906] = ResolveConstructor("OSGeo.MapGuide.MgMapPlotCollection");
+ classIdCtorMap[31000] = ResolveConstructor("OSGeo.MapGuide.MgRenderingService");
+ classIdCtorMap[31001] = ResolveConstructor("OSGeo.MapGuide.MgFeatureInformation");
+ classIdCtorMap[31002] = ResolveConstructor("OSGeo.MapGuide.MgRenderingOptions");
+ classIdCtorMap[31003] = ResolveConstructor("OSGeo.MapGuide.MgMetatile");
+ classIdCtorMap[31200] = ResolveConstructor("OSGeo.MapGuide.MgTileService");
+ classIdCtorMap[31300] = ResolveConstructor("OSGeo.MapGuide.MgKmlService");
+ classIdCtorMap[31400] = ResolveConstructor("OSGeo.MapGuide.MgProfilingService");
+ }
+ if (HasAssemblyInAppDomain("OSGeo.MapGuide.Web")) {
+ classIdCtorMap[50000] = ResolveConstructor("OSGeo.MapGuide.MgWebCommand");
+ classIdCtorMap[50001] = ResolveConstructor("OSGeo.MapGuide.MgWebUiTargetCommand");
+ classIdCtorMap[50002] = ResolveConstructor("OSGeo.MapGuide.MgWebSearchCommand");
+ classIdCtorMap[50003] = ResolveConstructor("OSGeo.MapGuide.MgWebInvokeScriptCommand");
+ classIdCtorMap[50004] = ResolveConstructor("OSGeo.MapGuide.MgWebInvokeUrlCommand");
+ classIdCtorMap[50005] = ResolveConstructor("OSGeo.MapGuide.MgWebBufferCommand");
+ classIdCtorMap[50006] = ResolveConstructor("OSGeo.MapGuide.MgWebSelectWithinCommand");
+ classIdCtorMap[50007] = ResolveConstructor("OSGeo.MapGuide.MgWebPrintCommand");
+ classIdCtorMap[50008] = ResolveConstructor("OSGeo.MapGuide.MgWebMeasureCommand");
+ classIdCtorMap[50009] = ResolveConstructor("OSGeo.MapGuide.MgWebGetPrintablePageCommand");
+ classIdCtorMap[50010] = ResolveConstructor("OSGeo.MapGuide.MgWebViewOptionsCommand");
+ classIdCtorMap[50011] = ResolveConstructor("OSGeo.MapGuide.MgWebHelpCommand");
+ classIdCtorMap[50012] = ResolveConstructor("OSGeo.MapGuide.MgWebCommandCollection");
+ classIdCtorMap[50013] = ResolveConstructor("OSGeo.MapGuide.MgWebWidget");
+ classIdCtorMap[50014] = ResolveConstructor("OSGeo.MapGuide.MgWebSeparatorWidget");
+ classIdCtorMap[50015] = ResolveConstructor("OSGeo.MapGuide.MgWebCommandWidget");
+ classIdCtorMap[50016] = ResolveConstructor("OSGeo.MapGuide.MgWebFlyoutWidget");
+ classIdCtorMap[50017] = ResolveConstructor("OSGeo.MapGuide.MgWebTaskBarWidget");
+ classIdCtorMap[50018] = ResolveConstructor("OSGeo.MapGuide.MgWebWidgetCollection");
+ classIdCtorMap[50019] = ResolveConstructor("OSGeo.MapGuide.MgWebUiPane");
+ classIdCtorMap[50020] = ResolveConstructor("OSGeo.MapGuide.MgWebUiSizablePane");
+ classIdCtorMap[50021] = ResolveConstructor("OSGeo.MapGuide.MgWebToolBar");
+ classIdCtorMap[50022] = ResolveConstructor("OSGeo.MapGuide.MgWebInformationPane");
+ classIdCtorMap[50023] = ResolveConstructor("OSGeo.MapGuide.MgWebTaskBar");
+ classIdCtorMap[50024] = ResolveConstructor("OSGeo.MapGuide.MgWebTaskPane");
+ classIdCtorMap[50025] = ResolveConstructor("OSGeo.MapGuide.MgWebContextMenu");
+ classIdCtorMap[50026] = ResolveConstructor("OSGeo.MapGuide.MgWebLayout");
+ classIdCtorMap[40000] = ResolveConstructor("OSGeo.MapGuide.MgHttpHeader");
+ classIdCtorMap[40001] = ResolveConstructor("OSGeo.MapGuide.MgHttpRequestParam");
+ classIdCtorMap[40002] = ResolveConstructor("OSGeo.MapGuide.MgHttpRequestMetadata");
+ classIdCtorMap[40003] = ResolveConstructor("OSGeo.MapGuide.MgHttpResult");
+ classIdCtorMap[40004] = ResolveConstructor("OSGeo.MapGuide.MgHttpRequest");
+ classIdCtorMap[40005] = ResolveConstructor("OSGeo.MapGuide.MgHttpResponse");
+ classIdCtorMap[40006] = ResolveConstructor("OSGeo.MapGuide.MgHttpPrimitiveValue");
+ }
//Sanity check that we haven't double registered the same type name under different
@@ -254,16 +276,89 @@
}
}
- internal static IEnumerable<int> ClassIds => classNameMap.Keys;
+ internal static IEnumerable<int> ClassIds => classIdCtorMap.Keys;
- internal static string GetTypeName(int id)
+ internal static int? GetClassId(string typeName)
{
- return classNameMap.ContainsKey(id) ? classNameMap[id] : null;
+ return nameClassMap.ContainsKey(typeName) ? nameClassMap[typeName] : (int?)null;
}
- internal static int? GetClassId(string typeName)
+ internal static ConstructorInfo GetProxyConstructor(int classId)
{
- return nameClassMap.ContainsKey(typeName) ? nameClassMap[typeName] : (int?)null;
+ return classIdCtorMap.ContainsKey(classId) ? classIdCtorMap[classId] : null;
}
+
+ static bool HasAssemblyInAppDomain(string assemblyName)
+ {
+#if MONOLITHIC_ASSEMBLY
+ return true;
+#else
+ var assemblies = global::System.AppDomain.CurrentDomain.GetAssemblies();
+ foreach (var assem in assemblies)
+ {
+ var asmName = new global::System.Reflection.AssemblyName(assem.FullName);
+ if (asmName.Name == assemblyName)
+ {
+ return true;
+ }
+ }
+ return false;
+#endif
+ }
+
+ static ConstructorInfo ResolveConstructor(string typeName)
+ {
+ var type = global::System.Type.GetType(typeName);
+ if (type == null)
+ {
+ // Find the specified class in the pre-defined assemblies
+ var assemblies = global::System.AppDomain.CurrentDomain.GetAssemblies();
+ foreach (var assem in assemblies)
+ {
+ var assemblyName = new global::System.Reflection.AssemblyName(assem.FullName);
+ if (assemblyNames.Contains(assemblyName.Name))
+ {
+ type = assem.GetType(typeName, false);
+ if (type != null)
+ break;
+ }
+ }
+
+ // Fall back to finding the type in every assembly in the current appdomain
+ foreach (var assem in global::System.AppDomain.CurrentDomain.GetAssemblies())
+ {
+ type = assem.GetType(typeName, false);
+ if (type != null)
+ break;
+ }
+ }
+
+ if (type == null) //Shouldn't happen. But if it did, this would mean we didn't expose this class to SWIG
+ {
+ throw new global::System.Exception("The type " + typeName + " does not exist in the list of loaded assemblies");
+ }
+ else
+ {
+ //The constructor we require has been assigned internal visibility by SWIG. We could change it to public, but the internal
+ //visibility is the ideal one for purposes of encapulsation (this is internal use only). So instead of Activator.CreateInstance()
+ //which does not work with internal constructors, we'll find the ctor ourselves and invoke it.
+ var flags = global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance;
+ var ctors = type.GetTypeInfo().GetConstructors(flags);
+ var ctor = ctors.FirstOrDefault(ci =>
+ {
+ var parms = ci.GetParameters();
+ if (parms.Length == 2)
+ {
+ return parms[0].ParameterType == typeof(global::System.IntPtr)
+ && parms[1].ParameterType == typeof(bool);
+ }
+ return false;
+ });
+ if (ctor == null)
+ throw new global::System.Exception("Could not find required constructor among " + ctors.Length + " constructors with signature (IntPtr, bool) on type: " + type.Name);
+
+ return ctor;
+ }
+ }
}
}
\ No newline at end of file
Modified: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/MapGuideDotNetApi.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/MapGuideDotNetApi.csproj 2020-11-20 15:56:48 UTC (rev 9801)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/MapGuideDotNetApi.csproj 2020-11-21 15:32:08 UTC (rev 9802)
@@ -20,10 +20,12 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\..\..\..\packages\DotNet\Release</OutputPath>
<DocumentationFile>..\..\..\..\packages\DotNet\Release\MapGuideDotNetApi.xml</DocumentationFile>
+ <DefineConstants>TRACE;MONOLITHIC_ASSEMBLY</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\..\..\..\packages\DotNet\Debug</OutputPath>
+ <DefineConstants>MONOLITHIC_ASSEMBLY</DefineConstants>
</PropertyGroup>
<ItemGroup>
@@ -32,6 +34,10 @@
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\Common\MgClassMap.cs" Link="MgClassMap.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
<None Include="..\..\..\..\..\License.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
Deleted: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/custom/MgClassMap.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/custom/MgClassMap.cs 2020-11-20 15:56:48 UTC (rev 9801)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/custom/MgClassMap.cs 2020-11-21 15:32:08 UTC (rev 9802)
@@ -1,361 +0,0 @@
-// This file is autogenerated by ClassMapGen. DO NOT EDIT
-
-using System;
-using System.Collections.Generic;
-
-namespace OSGeo.MapGuide
-{
- internal static class MgClassMap
- {
- static Dictionary<int, string> classNameMap;
-
- static MgClassMap()
- {
- classNameMap = new Dictionary<int, string>();
-
- classNameMap[20004] = "OSGeo.MapGuide.MgAgfReaderWriter";
- classNameMap[20005] = "OSGeo.MapGuide.MgAggregateGeometry";
- classNameMap[1500] = "OSGeo.MapGuide.MgApplicationException";
- classNameMap[20006] = "OSGeo.MapGuide.MgArcSegment";
- classNameMap[1501] = "OSGeo.MapGuide.MgArgumentOutOfRangeException";
- classNameMap[10500] = "OSGeo.MapGuide.MgArrayTypeMismatchException";
- classNameMap[30000] = "OSGeo.MapGuide.MgAuthenticationFailedException";
- classNameMap[1005] = "OSGeo.MapGuide.MgBatchPropertyCollection";
- classNameMap[10252] = "OSGeo.MapGuide.MgBlobProperty";
- classNameMap[10253] = "OSGeo.MapGuide.MgBooleanProperty";
- classNameMap[10254] = "OSGeo.MapGuide.MgByteProperty";
- classNameMap[1250] = "OSGeo.MapGuide.MgByteReader";
- classNameMap[1257] = "OSGeo.MapGuide.MgByteSink";
- classNameMap[1251] = "OSGeo.MapGuide.MgByteSource";
- classNameMap[11750] = "OSGeo.MapGuide.MgClassDefinition";
- classNameMap[11780] = "OSGeo.MapGuide.MgClassDefinitionCollection";
- classNameMap[1502] = "OSGeo.MapGuide.MgClassNotFoundException";
- classNameMap[10255] = "OSGeo.MapGuide.MgClobProperty";
- classNameMap[10250] = "OSGeo.MapGuide.MgColor";
- classNameMap[1503] = "OSGeo.MapGuide.MgConfigurationException";
- classNameMap[1504] = "OSGeo.MapGuide.MgConfigurationLoadFailedException";
- classNameMap[1505] = "OSGeo.MapGuide.MgConfigurationSaveFailedException";
- classNameMap[30001] = "OSGeo.MapGuide.MgConnectionFailedException";
- classNameMap[30002] = "OSGeo.MapGuide.MgConnectionNotOpenException";
- classNameMap[20003] = "OSGeo.MapGuide.MgCoordinate";
- classNameMap[20009] = "OSGeo.MapGuide.MgCoordinateIterator";
- classNameMap[20500] = "OSGeo.MapGuide.MgCoordinateSystem";
- classNameMap[20504] = "OSGeo.MapGuide.MgCoordinateSystemCatalog";
- classNameMap[20506] = "OSGeo.MapGuide.MgCoordinateSystemCategory";
- classNameMap[20510] = "OSGeo.MapGuide.MgCoordinateSystemCategoryDictionary";
- classNameMap[21000] = "OSGeo.MapGuide.MgCoordinateSystemComputationFailedException";
- classNameMap[21001] = "OSGeo.MapGuide.MgCoordinateSystemConversionFailedException";
- classNameMap[20507] = "OSGeo.MapGuide.MgCoordinateSystemDatum";
- classNameMap[20512] = "OSGeo.MapGuide.MgCoordinateSystemDatumDictionary";
- classNameMap[20511] = "OSGeo.MapGuide.MgCoordinateSystemDictionary";
- classNameMap[20521] = "OSGeo.MapGuide.MgCoordinateSystemDictionaryUtility";
- classNameMap[20509] = "OSGeo.MapGuide.MgCoordinateSystemEllipsoid";
- classNameMap[20513] = "OSGeo.MapGuide.MgCoordinateSystemEllipsoidDictionary";
- classNameMap[20514] = "OSGeo.MapGuide.MgCoordinateSystemEnum";
- classNameMap[20515] = "OSGeo.MapGuide.MgCoordinateSystemEnumInteger32";
- classNameMap[20501] = "OSGeo.MapGuide.MgCoordinateSystemFactory";
- classNameMap[20516] = "OSGeo.MapGuide.MgCoordinateSystemFilter";
- classNameMap[20517] = "OSGeo.MapGuide.MgCoordinateSystemFilterInteger32";
- classNameMap[20505] = "OSGeo.MapGuide.MgCoordinateSystemFormatConverter";
- classNameMap[20542] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticAnalyticalTransformDefParams";
- classNameMap[20543] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticInterpolationTransformDefParams";
- classNameMap[20544] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticMultipleRegressionTransformDefParams";
- classNameMap[20533] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticPath";
- classNameMap[20535] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticPathDictionary";
- classNameMap[20534] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticPathElement";
- classNameMap[20508] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformation";
- classNameMap[20536] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDef";
- classNameMap[20540] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDefDictionary";
- classNameMap[20545] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformGridFile";
- classNameMap[20532] = "OSGeo.MapGuide.MgCoordinateSystemGridBase";
- classNameMap[20524] = "OSGeo.MapGuide.MgCoordinateSystemGridBoundary";
- classNameMap[20529] = "OSGeo.MapGuide.MgCoordinateSystemGridLine";
- classNameMap[20526] = "OSGeo.MapGuide.MgCoordinateSystemGridLineCollection";
- classNameMap[20530] = "OSGeo.MapGuide.MgCoordinateSystemGridRegion";
- classNameMap[20527] = "OSGeo.MapGuide.MgCoordinateSystemGridRegionCollection";
- classNameMap[20525] = "OSGeo.MapGuide.MgCoordinateSystemGridSpecification";
- classNameMap[20531] = "OSGeo.MapGuide.MgCoordinateSystemGridTick";
- classNameMap[20528] = "OSGeo.MapGuide.MgCoordinateSystemGridTickCollection";
- classNameMap[21002] = "OSGeo.MapGuide.MgCoordinateSystemInitializationFailedException";
- classNameMap[21003] = "OSGeo.MapGuide.MgCoordinateSystemLoadFailedException";
- classNameMap[20518] = "OSGeo.MapGuide.MgCoordinateSystemMathComparator";
- classNameMap[20502] = "OSGeo.MapGuide.MgCoordinateSystemMeasure";
- classNameMap[21004] = "OSGeo.MapGuide.MgCoordinateSystemMeasureFailedException";
- classNameMap[20522] = "OSGeo.MapGuide.MgCoordinateSystemMgrs";
- classNameMap[20520] = "OSGeo.MapGuide.MgCoordinateSystemProjectionInformation";
- classNameMap[20503] = "OSGeo.MapGuide.MgCoordinateSystemTransform";
- classNameMap[21005] = "OSGeo.MapGuide.MgCoordinateSystemTransformFailedException";
- classNameMap[20519] = "OSGeo.MapGuide.MgCoordinateSystemUnitInformation";
- classNameMap[20048] = "OSGeo.MapGuide.MgCoordinateXY";
- classNameMap[20051] = "OSGeo.MapGuide.MgCoordinateXYM";
- classNameMap[20049] = "OSGeo.MapGuide.MgCoordinateXYZ";
- classNameMap[20050] = "OSGeo.MapGuide.MgCoordinateXYZM";
- classNameMap[20010] = "OSGeo.MapGuide.MgCurve";
- classNameMap[20011] = "OSGeo.MapGuide.MgCurvePolygon";
- classNameMap[20047] = "OSGeo.MapGuide.MgCurvePolygonCollection";
- classNameMap[20012] = "OSGeo.MapGuide.MgCurveRing";
- classNameMap[20052] = "OSGeo.MapGuide.MgCurveRingCollection";
- classNameMap[20013] = "OSGeo.MapGuide.MgCurveSegment";
- classNameMap[20041] = "OSGeo.MapGuide.MgCurveSegmentCollection";
- classNameMap[20014] = "OSGeo.MapGuide.MgCurveString";
- classNameMap[20043] = "OSGeo.MapGuide.MgCurveStringCollection";
- classNameMap[11751] = "OSGeo.MapGuide.MgDataPropertyDefinition";
- classNameMap[11773] = "OSGeo.MapGuide.MgDataReader";
- classNameMap[1256] = "OSGeo.MapGuide.MgDateTime";
- classNameMap[1506] = "OSGeo.MapGuide.MgDateTimeException";
- classNameMap[10256] = "OSGeo.MapGuide.MgDateTimeProperty";
- classNameMap[30003] = "OSGeo.MapGuide.MgDbException";
- classNameMap[30004] = "OSGeo.MapGuide.MgDbXmlException";
- classNameMap[1507] = "OSGeo.MapGuide.MgDecryptionException";
- classNameMap[11775] = "OSGeo.MapGuide.MgDeleteFeatures";
- classNameMap[1508] = "OSGeo.MapGuide.MgDirectoryNotFoundException";
- classNameMap[1000] = "OSGeo.MapGuide.MgDisposableCollection";
- classNameMap[1509] = "OSGeo.MapGuide.MgDivideByZeroException";
- classNameMap[1510] = "OSGeo.MapGuide.MgDomainException";
- classNameMap[10257] = "OSGeo.MapGuide.MgDoubleProperty";
- classNameMap[30700] = "OSGeo.MapGuide.MgDrawingService";
- classNameMap[1511] = "OSGeo.MapGuide.MgDuplicateDirectoryException";
- classNameMap[1512] = "OSGeo.MapGuide.MgDuplicateFileException";
- classNameMap[30005] = "OSGeo.MapGuide.MgDuplicateGroupException";
- classNameMap[30006] = "OSGeo.MapGuide.MgDuplicateNameException";
- classNameMap[1513] = "OSGeo.MapGuide.MgDuplicateObjectException";
- classNameMap[30007] = "OSGeo.MapGuide.MgDuplicateParameterException";
- classNameMap[30008] = "OSGeo.MapGuide.MgDuplicateRepositoryException";
- classNameMap[10501] = "OSGeo.MapGuide.MgDuplicateResourceDataException";
- classNameMap[10502] = "OSGeo.MapGuide.MgDuplicateResourceException";
- classNameMap[30009] = "OSGeo.MapGuide.MgDuplicateRoleException";
- classNameMap[30010] = "OSGeo.MapGuide.MgDuplicateServerException";
- classNameMap[30011] = "OSGeo.MapGuide.MgDuplicateSessionException";
- classNameMap[30012] = "OSGeo.MapGuide.MgDuplicateUserException";
- classNameMap[30013] = "OSGeo.MapGuide.MgDwfException";
- classNameMap[30014] = "OSGeo.MapGuide.MgDwfSectionNotFoundException";
- classNameMap[30015] = "OSGeo.MapGuide.MgDwfSectionResourceNotFoundException";
- classNameMap[30901] = "OSGeo.MapGuide.MgDwfVersion";
- classNameMap[10503] = "OSGeo.MapGuide.MgEmptyFeatureSetException";
- classNameMap[1514] = "OSGeo.MapGuide.MgEncryptionException";
- classNameMap[30016] = "OSGeo.MapGuide.MgEndOfStreamException";
- classNameMap[20001] = "OSGeo.MapGuide.MgEnvelope";
- classNameMap[1515] = "OSGeo.MapGuide.MgException";
- classNameMap[10504] = "OSGeo.MapGuide.MgFdoException";
- classNameMap[11772] = "OSGeo.MapGuide.MgFeatureAggregateOptions";
- classNameMap[11774] = "OSGeo.MapGuide.MgFeatureCommandCollection";
- classNameMap[31001] = "OSGeo.MapGuide.MgFeatureInformation";
- classNameMap[11764] = "OSGeo.MapGuide.MgFeatureProperty";
- classNameMap[11771] = "OSGeo.MapGuide.MgFeatureQueryOptions";
- classNameMap[11753] = "OSGeo.MapGuide.MgFeatureReader";
- classNameMap[11778] = "OSGeo.MapGuide.MgFeatureSchema";
- classNameMap[11779] = "OSGeo.MapGuide.MgFeatureSchemaCollection";
- classNameMap[11754] = "OSGeo.MapGuide.MgFeatureService";
- classNameMap[10505] = "OSGeo.MapGuide.MgFeatureServiceException";
- classNameMap[11786] = "OSGeo.MapGuide.MgFileFeatureSourceParams";
- classNameMap[1516] = "OSGeo.MapGuide.MgFileIoException";
- classNameMap[1517] = "OSGeo.MapGuide.MgFileNotFoundException";
- classNameMap[20016] = "OSGeo.MapGuide.MgGeometricEntity";
- classNameMap[11756] = "OSGeo.MapGuide.MgGeometricPropertyDefinition";
- classNameMap[20019] = "OSGeo.MapGuide.MgGeometry";
- classNameMap[20020] = "OSGeo.MapGuide.MgGeometryCollection";
- classNameMap[20021] = "OSGeo.MapGuide.MgGeometryComponent";
- classNameMap[21006] = "OSGeo.MapGuide.MgGeometryException";
- classNameMap[20002] = "OSGeo.MapGuide.MgGeometryFactory";
- classNameMap[11758] = "OSGeo.MapGuide.MgGeometryProperty";
- classNameMap[11785] = "OSGeo.MapGuide.MgGeometryTypeInfo";
- classNameMap[30018] = "OSGeo.MapGuide.MgGroupNotFoundException";
- classNameMap[11782] = "OSGeo.MapGuide.MgGwsFeatureReader";
- classNameMap[40000] = "OSGeo.MapGuide.MgHttpHeader";
- classNameMap[40006] = "OSGeo.MapGuide.MgHttpPrimitiveValue";
- classNameMap[40004] = "OSGeo.MapGuide.MgHttpRequest";
- classNameMap[40002] = "OSGeo.MapGuide.MgHttpRequestMetadata";
- classNameMap[40001] = "OSGeo.MapGuide.MgHttpRequestParam";
- classNameMap[40005] = "OSGeo.MapGuide.MgHttpResponse";
- classNameMap[40003] = "OSGeo.MapGuide.MgHttpResult";
- classNameMap[1518] = "OSGeo.MapGuide.MgIndexOutOfRangeException";
- classNameMap[11776] = "OSGeo.MapGuide.MgInsertFeatures";
- classNameMap[10258] = "OSGeo.MapGuide.MgInt16Property";
- classNameMap[10259] = "OSGeo.MapGuide.MgInt32Property";
- classNameMap[10260] = "OSGeo.MapGuide.MgInt64Property";
- classNameMap[10000] = "OSGeo.MapGuide.MgIntCollection";
- classNameMap[1519] = "OSGeo.MapGuide.MgInvalidArgumentException";
- classNameMap[1520] = "OSGeo.MapGuide.MgInvalidCastException";
- classNameMap[21007] = "OSGeo.MapGuide.MgInvalidCoordinateSystemException";
- classNameMap[21008] = "OSGeo.MapGuide.MgInvalidCoordinateSystemTypeException";
- classNameMap[21009] = "OSGeo.MapGuide.MgInvalidCoordinateSystemUnitsException";
- classNameMap[30019] = "OSGeo.MapGuide.MgInvalidDwfPackageException";
- classNameMap[30020] = "OSGeo.MapGuide.MgInvalidDwfSectionException";
- classNameMap[30021] = "OSGeo.MapGuide.MgInvalidFeatureSourceException";
- classNameMap[30022] = "OSGeo.MapGuide.MgInvalidIpAddressException";
- classNameMap[30023] = "OSGeo.MapGuide.MgInvalidLicenseException";
- classNameMap[30024] = "OSGeo.MapGuide.MgInvalidLogEntryException";
- classNameMap[10507] = "OSGeo.MapGuide.MgInvalidMapDefinitionException";
- classNameMap[1522] = "OSGeo.MapGuide.MgInvalidOperationException";
- classNameMap[30026] = "OSGeo.MapGuide.MgInvalidPasswordException";
- classNameMap[30027] = "OSGeo.MapGuide.MgInvalidPrintLayoutFontSizeUnitsException";
- classNameMap[30028] = "OSGeo.MapGuide.MgInvalidPrintLayoutPositionUnitsException";
- classNameMap[30029] = "OSGeo.MapGuide.MgInvalidPrintLayoutSizeUnitsException";
- classNameMap[1523] = "OSGeo.MapGuide.MgInvalidPropertyTypeException";
- classNameMap[10508] = "OSGeo.MapGuide.MgInvalidRepositoryNameException";
- classNameMap[10509] = "OSGeo.MapGuide.MgInvalidRepositoryTypeException";
- classNameMap[10510] = "OSGeo.MapGuide.MgInvalidResourceDataNameException";
- classNameMap[10511] = "OSGeo.MapGuide.MgInvalidResourceDataTypeException";
- classNameMap[10512] = "OSGeo.MapGuide.MgInvalidResourceNameException";
- classNameMap[10513] = "OSGeo.MapGuide.MgInvalidResourcePathException";
- classNameMap[10514] = "OSGeo.MapGuide.MgInvalidResourcePreProcessingTypeException";
- classNameMap[10515] = "OSGeo.MapGuide.MgInvalidResourceTypeException";
- classNameMap[30031] = "OSGeo.MapGuide.MgInvalidServerNameException";
- classNameMap[1524] = "OSGeo.MapGuide.MgInvalidStreamHeaderException";
- classNameMap[1525] = "OSGeo.MapGuide.MgIoException";
- classNameMap[31300] = "OSGeo.MapGuide.MgKmlService";
- classNameMap[30501] = "OSGeo.MapGuide.MgLayer";
- classNameMap[12003] = "OSGeo.MapGuide.MgLayerBase";
- classNameMap[12002] = "OSGeo.MapGuide.MgLayerCollection";
- classNameMap[12001] = "OSGeo.MapGuide.MgLayerGroup";
- classNameMap[12004] = "OSGeo.MapGuide.MgLayerGroupCollection";
- classNameMap[10517] = "OSGeo.MapGuide.MgLayerNotFoundException";
- classNameMap[30904] = "OSGeo.MapGuide.MgLayout";
- classNameMap[1526] = "OSGeo.MapGuide.MgLengthException";
- classNameMap[30032] = "OSGeo.MapGuide.MgLicenseException";
- classNameMap[30033] = "OSGeo.MapGuide.MgLicenseExpiredException";
- classNameMap[20023] = "OSGeo.MapGuide.MgLinearRing";
- classNameMap[20053] = "OSGeo.MapGuide.MgLinearRingCollection";
- classNameMap[20024] = "OSGeo.MapGuide.MgLinearSegment";
- classNameMap[20042] = "OSGeo.MapGuide.MgLineString";
- classNameMap[20044] = "OSGeo.MapGuide.MgLineStringCollection";
- classNameMap[1527] = "OSGeo.MapGuide.MgLogicException";
- classNameMap[11766] = "OSGeo.MapGuide.MgLongTransactionReader";
- classNameMap[30500] = "OSGeo.MapGuide.MgMap";
- classNameMap[12000] = "OSGeo.MapGuide.MgMapBase";
- classNameMap[12005] = "OSGeo.MapGuide.MgMapCollection";
- classNameMap[30900] = "OSGeo.MapGuide.MgMappingService";
- classNameMap[30905] = "OSGeo.MapGuide.MgMapPlot";
- classNameMap[30906] = "OSGeo.MapGuide.MgMapPlotCollection";
- classNameMap[20029] = "OSGeo.MapGuide.MgMultiCurvePolygon";
- classNameMap[20030] = "OSGeo.MapGuide.MgMultiCurveString";
- classNameMap[20031] = "OSGeo.MapGuide.MgMultiGeometry";
- classNameMap[20032] = "OSGeo.MapGuide.MgMultiLineString";
- classNameMap[20033] = "OSGeo.MapGuide.MgMultiPoint";
- classNameMap[20034] = "OSGeo.MapGuide.MgMultiPolygon";
- classNameMap[1528] = "OSGeo.MapGuide.MgNotFiniteNumberException";
- classNameMap[1529] = "OSGeo.MapGuide.MgNotImplementedException";
- classNameMap[1530] = "OSGeo.MapGuide.MgNullArgumentException";
- classNameMap[1531] = "OSGeo.MapGuide.MgNullPropertyValueException";
- classNameMap[1532] = "OSGeo.MapGuide.MgNullReferenceException";
- classNameMap[1533] = "OSGeo.MapGuide.MgObjectNotFoundException";
- classNameMap[11759] = "OSGeo.MapGuide.MgObjectPropertyDefinition";
- classNameMap[30035] = "OSGeo.MapGuide.MgOperationProcessingException";
- classNameMap[1534] = "OSGeo.MapGuide.MgOutOfMemoryException";
- classNameMap[1535] = "OSGeo.MapGuide.MgOutOfRangeException";
- classNameMap[1536] = "OSGeo.MapGuide.MgOverflowException";
- classNameMap[30604] = "OSGeo.MapGuide.MgPackageStatusInformation";
- classNameMap[11788] = "OSGeo.MapGuide.MgParameter";
- classNameMap[10004] = "OSGeo.MapGuide.MgParameterCollection";
- classNameMap[30036] = "OSGeo.MapGuide.MgParameterNotFoundException";
- classNameMap[30037] = "OSGeo.MapGuide.MgPathTooLongException";
- classNameMap[1537] = "OSGeo.MapGuide.MgPlatformNotSupportedException";
- classNameMap[30902] = "OSGeo.MapGuide.MgPlotSpecification";
- classNameMap[20000] = "OSGeo.MapGuide.MgPoint";
- classNameMap[20045] = "OSGeo.MapGuide.MgPointCollection";
- classNameMap[20035] = "OSGeo.MapGuide.MgPolygon";
- classNameMap[20046] = "OSGeo.MapGuide.MgPolygonCollection";
- classNameMap[30039] = "OSGeo.MapGuide.MgPortNotAvailableException";
- classNameMap[30040] = "OSGeo.MapGuide.MgPrintToScaleModeNotSelectedException";
- classNameMap[31400] = "OSGeo.MapGuide.MgProfilingService";
- classNameMap[2000] = "OSGeo.MapGuide.MgProperty";
- classNameMap[1002] = "OSGeo.MapGuide.MgPropertyCollection";
- classNameMap[2002] = "OSGeo.MapGuide.MgPropertyDefinition";
- classNameMap[10001] = "OSGeo.MapGuide.MgPropertyDefinitionCollection";
- classNameMap[11769] = "OSGeo.MapGuide.MgRaster";
- classNameMap[11770] = "OSGeo.MapGuide.MgRasterProperty";
- classNameMap[11768] = "OSGeo.MapGuide.MgRasterPropertyDefinition";
- classNameMap[12006] = "OSGeo.MapGuide.MgReadOnlyLayerCollection";
- classNameMap[20037] = "OSGeo.MapGuide.MgRegion";
- classNameMap[31002] = "OSGeo.MapGuide.MgRenderingOptions";
- classNameMap[31000] = "OSGeo.MapGuide.MgRenderingService";
- classNameMap[30041] = "OSGeo.MapGuide.MgRepositoryCreationFailedException";
- classNameMap[30042] = "OSGeo.MapGuide.MgRepositoryNotFoundException";
- classNameMap[30043] = "OSGeo.MapGuide.MgRepositoryNotOpenException";
- classNameMap[30044] = "OSGeo.MapGuide.MgRepositoryOpenFailedException";
- classNameMap[11526] = "OSGeo.MapGuide.MgResource";
- classNameMap[10518] = "OSGeo.MapGuide.MgResourceBusyException";
- classNameMap[10519] = "OSGeo.MapGuide.MgResourceDataNotFoundException";
- classNameMap[11500] = "OSGeo.MapGuide.MgResourceIdentifier";
- classNameMap[10520] = "OSGeo.MapGuide.MgResourceNotFoundException";
- classNameMap[11501] = "OSGeo.MapGuide.MgResourceService";
- classNameMap[1538] = "OSGeo.MapGuide.MgResourcesException";
- classNameMap[1539] = "OSGeo.MapGuide.MgResourcesLoadFailedException";
- classNameMap[1540] = "OSGeo.MapGuide.MgResourceTagNotFoundException";
- classNameMap[20038] = "OSGeo.MapGuide.MgRing";
- classNameMap[30045] = "OSGeo.MapGuide.MgRoleNotFoundException";
- classNameMap[1541] = "OSGeo.MapGuide.MgRuntimeException";
- classNameMap[30502] = "OSGeo.MapGuide.MgSelection";
- classNameMap[12007] = "OSGeo.MapGuide.MgSelectionBase";
- classNameMap[30607] = "OSGeo.MapGuide.MgServerAdmin";
- classNameMap[30046] = "OSGeo.MapGuide.MgServerNotFoundException";
- classNameMap[30047] = "OSGeo.MapGuide.MgServerNotOnlineException";
- classNameMap[11251] = "OSGeo.MapGuide.MgService";
- classNameMap[10521] = "OSGeo.MapGuide.MgServiceNotAvailableException";
- classNameMap[10522] = "OSGeo.MapGuide.MgServiceNotSupportedException";
- classNameMap[30048] = "OSGeo.MapGuide.MgSessionExpiredException";
- classNameMap[30052] = "OSGeo.MapGuide.MgSessionNotFoundException";
- classNameMap[10261] = "OSGeo.MapGuide.MgSingleProperty";
- classNameMap[30605] = "OSGeo.MapGuide.MgSite";
- classNameMap[30601] = "OSGeo.MapGuide.MgSiteConnection";
- classNameMap[30608] = "OSGeo.MapGuide.MgSiteInfo";
- classNameMap[11761] = "OSGeo.MapGuide.MgSpatialContextReader";
- classNameMap[11762] = "OSGeo.MapGuide.MgSqlDataReader";
- classNameMap[1542] = "OSGeo.MapGuide.MgStreamIoException";
- classNameMap[1003] = "OSGeo.MapGuide.MgStringCollection";
- classNameMap[2001] = "OSGeo.MapGuide.MgStringProperty";
- classNameMap[10003] = "OSGeo.MapGuide.MgStringPropertyCollection";
- classNameMap[1543] = "OSGeo.MapGuide.MgSystemException";
- classNameMap[1544] = "OSGeo.MapGuide.MgTemporaryFileNotAvailableException";
- classNameMap[1545] = "OSGeo.MapGuide.MgThirdPartyException";
- classNameMap[31200] = "OSGeo.MapGuide.MgTileService";
- classNameMap[11787] = "OSGeo.MapGuide.MgTransaction";
- classNameMap[30049] = "OSGeo.MapGuide.MgUnauthorizedAccessException";
- classNameMap[1547] = "OSGeo.MapGuide.MgUnclassifiedException";
- classNameMap[1548] = "OSGeo.MapGuide.MgUnderflowException";
- classNameMap[30056] = "OSGeo.MapGuide.MgUnknownTileProviderException";
- classNameMap[30057] = "OSGeo.MapGuide.MgUnsupportedTileProviderException";
- classNameMap[11777] = "OSGeo.MapGuide.MgUpdateFeatures";
- classNameMap[30050] = "OSGeo.MapGuide.MgUriFormatException";
- classNameMap[30606] = "OSGeo.MapGuide.MgUserInformation";
- classNameMap[10523] = "OSGeo.MapGuide.MgUserNotFoundException";
- classNameMap[11257] = "OSGeo.MapGuide.MgWarnings";
- classNameMap[50005] = "OSGeo.MapGuide.MgWebBufferCommand";
- classNameMap[50000] = "OSGeo.MapGuide.MgWebCommand";
- classNameMap[50012] = "OSGeo.MapGuide.MgWebCommandCollection";
- classNameMap[50015] = "OSGeo.MapGuide.MgWebCommandWidget";
- classNameMap[50025] = "OSGeo.MapGuide.MgWebContextMenu";
- classNameMap[50016] = "OSGeo.MapGuide.MgWebFlyoutWidget";
- classNameMap[50009] = "OSGeo.MapGuide.MgWebGetPrintablePageCommand";
- classNameMap[50011] = "OSGeo.MapGuide.MgWebHelpCommand";
- classNameMap[50022] = "OSGeo.MapGuide.MgWebInformationPane";
- classNameMap[50003] = "OSGeo.MapGuide.MgWebInvokeScriptCommand";
- classNameMap[50004] = "OSGeo.MapGuide.MgWebInvokeUrlCommand";
- classNameMap[50026] = "OSGeo.MapGuide.MgWebLayout";
- classNameMap[50008] = "OSGeo.MapGuide.MgWebMeasureCommand";
- classNameMap[50007] = "OSGeo.MapGuide.MgWebPrintCommand";
- classNameMap[50002] = "OSGeo.MapGuide.MgWebSearchCommand";
- classNameMap[50006] = "OSGeo.MapGuide.MgWebSelectWithinCommand";
- classNameMap[50014] = "OSGeo.MapGuide.MgWebSeparatorWidget";
- classNameMap[50023] = "OSGeo.MapGuide.MgWebTaskBar";
- classNameMap[50017] = "OSGeo.MapGuide.MgWebTaskBarWidget";
- classNameMap[50024] = "OSGeo.MapGuide.MgWebTaskPane";
- classNameMap[50021] = "OSGeo.MapGuide.MgWebToolBar";
- classNameMap[50019] = "OSGeo.MapGuide.MgWebUiPane";
- classNameMap[50020] = "OSGeo.MapGuide.MgWebUiSizablePane";
- classNameMap[50001] = "OSGeo.MapGuide.MgWebUiTargetCommand";
- classNameMap[50010] = "OSGeo.MapGuide.MgWebViewOptionsCommand";
- classNameMap[50013] = "OSGeo.MapGuide.MgWebWidget";
- classNameMap[50018] = "OSGeo.MapGuide.MgWebWidgetCollection";
- classNameMap[20040] = "OSGeo.MapGuide.MgWktReaderWriter";
- classNameMap[1549] = "OSGeo.MapGuide.MgXmlException";
- classNameMap[1550] = "OSGeo.MapGuide.MgXmlParserException";
-
- }
-
- internal static string GetTypeName(int id)
- {
- return classNameMap.ContainsKey(id) ? classNameMap[id] : null;
- }
- }
-}
\ No newline at end of file
Modified: sandbox/jng/vanilla_swig/Bindings/src/SwigCommon/DotNet/coreclr_compat.i
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/SwigCommon/DotNet/coreclr_compat.i 2020-11-20 15:56:48 UTC (rev 9801)
+++ sandbox/jng/vanilla_swig/Bindings/src/SwigCommon/DotNet/coreclr_compat.i 2020-11-21 15:32:08 UTC (rev 9802)
@@ -213,71 +213,22 @@
{
clsId = $imclassname.GetClassId(objPtr);
}
- var typeName = MgClassMap.GetTypeName(clsId.Value);
- if (typeName == null) //Shouldn't happen. But if it did, this would mean we missed a spot when compiling class ids
+
+ var ctor = MgClassMap.GetProxyConstructor(clsId.Value);
+ if (ctor == null)
{
throw new global::System.Exception("Could not resolve .net type for this unmanaged pointer. The unmanaged pointer reported a class ID of: " + clsId);
}
- var type = global::System.Type.GetType(typeName);
- if (type == null)
+ var args = new object[]
{
- // Find the specified class in the pre-defined assemblies
- var assemblies = global::System.AppDomain.CurrentDomain.GetAssemblies();
- foreach (var assem in assemblies)
- {
- var assemblyName = new global::System.Reflection.AssemblyName(assem.FullName);
- if (assemblyNameMap.ContainsKey(assemblyName.Name))
- {
- type = assem.GetType(typeName, false);
- if (type != null)
- break;
- }
- }
-
- // Fall back to finding the type in every assembly in the current appdomain
- foreach (var assem in global::System.AppDomain.CurrentDomain.GetAssemblies())
- {
- type = assem.GetType(typeName, false);
- if (type != null)
- break;
- }
- }
+ objPtr,
+ true /* ownMemory */
+ };
- if (type == null) //Shouldn't happen. But if it did, this would mean we didn't expose this class to SWIG
- {
- throw new global::System.Exception("The type " + typeName + " does not exist. The unmanaged pointer reported a class ID of: " + clsId);
- }
- else
- {
- var args = new object[]
- {
- objPtr,
- true /* ownMemory */
- };
-
- //The constructor we require has been assigned internal visibility by SWIG. We could change it to public, but the internal
- //visibility is the ideal one for purposes of encapulsation (this is internal use only). So instead of Activator.CreateInstance()
- //which does not work with internal constructors, we'll find the ctor ourselves and invoke it.
- var flags = global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance;
- var ctors = type.GetTypeInfo().GetConstructors(flags);
- var ctor = ctors.FirstOrDefault(ci =>
- {
- var parms = ci.GetParameters();
- if (parms.Length == 2)
- {
- return parms[0].ParameterType == typeof(global::System.IntPtr)
- && parms[1].ParameterType == typeof(bool);
- }
- return false;
- });
- if (ctor == null)
- throw new global::System.Exception("Could not find required constructor among " + ctors.Length + " constructors with signature (IntPtr, bool) on type: " + type.Name);
-
- obj = ctor.Invoke(args) as T;
- if (obj == null)
- throw new global::System.Exception("Could not create an instance of type " + typeof(T).Name + " (concrete type: " + type.Name + "). The unmanaged pointer reported a class ID of: " + clsId);
- }
+ obj = ctor.Invoke(args) as T;
+ if (obj == null)
+ throw new global::System.Exception("Could not create an instance of type " + typeof(T).Name + " (concrete type: " + ctor.DeclaringType.Name + "). The unmanaged pointer reported a class ID of: " + clsId);
return obj;
}
}
Deleted: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/ExternalTests/ClassIdSanityTest.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/ExternalTests/ClassIdSanityTest.cs 2020-11-20 15:56:48 UTC (rev 9801)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/ExternalTests/ClassIdSanityTest.cs 2020-11-21 15:32:08 UTC (rev 9802)
@@ -1,26 +0,0 @@
-using OSGeo.MapGuide.Test.Common;
-using System;
-using System.Linq;
-
-namespace TestMapGuideApi.ExternalTests
-{
- public class ClassIdSanityTest : IExternalTest
- {
- public void Execute(IPlatformFactory factory, ITestLogger logger)
- {
- var missing = 0;
- var mgAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(asm => asm.FullName.Contains("OSGeo.MapGuide"));
- foreach (var clsId in OSGeo.MapGuide.MgClassMap.ClassIds)
- {
- var typeName = OSGeo.MapGuide.MgClassMap.GetTypeName(clsId);
- var types = mgAssemblies.Select(asm => asm.GetType(typeName, false));
- if (!types.Any())
- {
- logger.WriteLine($"ERROR: .net proxy class ({typeName}, id: {clsId} does not exist");
- missing++;
- }
- }
- Assert.AreEqual(0, missing);
- }
- }
-}
Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs 2020-11-20 15:56:48 UTC (rev 9801)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs 2020-11-21 15:32:08 UTC (rev 9802)
@@ -14,8 +14,6 @@
mentorDictionaryPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, mentorDictionaryPath));
Environment.SetEnvironmentVariable("MENTOR_DICTIONARY_PATH", mentorDictionaryPath, EnvironmentVariableTarget.Process);
- ClassIdSanityTest();
-
var csFactory = new MgCoordinateSystemFactory();
var csCat = csFactory.GetCatalog();
csCat.SetDictionaryDir(mentorDictionaryPath);
@@ -140,47 +138,6 @@
Console.WriteLine("*********** ALL OK ****************");
}
- private static void ClassIdSanityTest()
- {
- var missing = 0;
- var mgAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(asm => asm.FullName.Contains("OSGeo.MapGuide"));
- foreach (var clsId in OSGeo.MapGuide.MgClassMap.ClassIds)
- {
- var typeName = OSGeo.MapGuide.MgClassMap.GetTypeName(clsId);
- var types = mgAssemblies.Select(asm => asm.GetType(typeName, false))
- .Where(t => t != null)
- .ToList();
- if (types.Count == 0)
- {
- Console.WriteLine($"ERROR: .net proxy class ({typeName}, id: {clsId}) does not exist");
- missing++;
- }
- }
-
- if (missing > 0)
- throw new Exception($"{missing} .net proxy class(es) could not be found");
-
- /*
- missing = 0;
- //Now check in reverse
- foreach (var type in mgAssemblies.SelectMany(asm => asm.ExportedTypes.Where(t => t.Name.StartsWith("Mg"))))
- {
- if (type.IsClass && !IsConstantClass(type))
- {
- var id = MgClassMap.GetClassId(type.FullName);
- if (!id.HasValue)
- {
- Console.WriteLine($".net proxy class ({type.FullName}) does not have a known corresponding class id");
- missing++;
- }
- }
- }
-
- if (missing > 0)
- throw new Exception($"{missing} .net proxy class(es) are missing class ids");
- */
- }
-
private static bool IsConstantClass(Type type)
{
if (type.IsClass)
Modified: sandbox/jng/vanilla_swig/Bindings/src/Tools/ClassMapGen/Data/Templates/dotnet.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Tools/ClassMapGen/Data/Templates/dotnet.txt 2020-11-20 15:56:48 UTC (rev 9801)
+++ sandbox/jng/vanilla_swig/Bindings/src/Tools/ClassMapGen/Data/Templates/dotnet.txt 2020-11-21 15:32:08 UTC (rev 9802)
@@ -2,22 +2,31 @@
using System;
using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
namespace OSGeo.MapGuide
{
internal static class MgClassMap
{
- //TODO: We should take a page out of the java binding and convert this to a
- //Dictionary<int, ConstructorInfo>. This would save us having to do repeated lookups
- //for this information. Also it would serve as a fail-early sanity check that we are
- //not registering class ids of classes that are not actual classes (eg. Classes with
- //constants should not be here)
- static Dictionary<int, string> classNameMap;
+ static HashSet<string> assemblyNames;
+ static Dictionary<int, ConstructorInfo> classIdCtorMap;
static Dictionary<string, int> nameClassMap;
static MgClassMap()
{
- classNameMap = new Dictionary<int, string>();
+ assemblyNames = new HashSet<string>
+ {
+ "OSGeo.MapGuide.Foundation",
+ "OSGeo.MapGuide.Geometry",
+ "OSGeo.MapGuide.PlatformBase",
+ "OSGeo.MapGuide.MapGuideCommon",
+ "OSGeo.MapGuide.Web",
+ "OSGeo.MapGuide.Portable"
+ };
+
+ classIdCtorMap = new Dictionary<int, ConstructorInfo>();
+ var classNameMap = new Dictionary<int, string>();
nameClassMap = new Dictionary<string, int>();
$CLASS_NAME_MAP_BODY$
@@ -36,16 +45,89 @@
}
}
- internal static IEnumerable<int> ClassIds => classNameMap.Keys;
+ internal static IEnumerable<int> ClassIds => classIdCtorMap.Keys;
- internal static string GetTypeName(int id)
+ internal static int? GetClassId(string typeName)
{
- return classNameMap.ContainsKey(id) ? classNameMap[id] : null;
+ return nameClassMap.ContainsKey(typeName) ? nameClassMap[typeName] : (int?)null;
}
- internal static int? GetClassId(string typeName)
+ internal static ConstructorInfo GetProxyConstructor(int classId)
{
- return nameClassMap.ContainsKey(typeName) ? nameClassMap[typeName] : (int?)null;
+ return classIdCtorMap.ContainsKey(classId) ? classIdCtorMap[classId] : null;
}
+
+ static bool HasAssemblyInAppDomain(string assemblyName)
+ {
+#if MONOLITHIC_ASSEMBLY
+ return true;
+#else
+ var assemblies = global::System.AppDomain.CurrentDomain.GetAssemblies();
+ foreach (var assem in assemblies)
+ {
+ var asmName = new global::System.Reflection.AssemblyName(assem.FullName);
+ if (asmName.Name == assemblyName)
+ {
+ return true;
+ }
+ }
+ return false;
+#endif
+ }
+
+ static ConstructorInfo ResolveConstructor(string typeName)
+ {
+ var type = global::System.Type.GetType(typeName);
+ if (type == null)
+ {
+ // Find the specified class in the pre-defined assemblies
+ var assemblies = global::System.AppDomain.CurrentDomain.GetAssemblies();
+ foreach (var assem in assemblies)
+ {
+ var assemblyName = new global::System.Reflection.AssemblyName(assem.FullName);
+ if (assemblyNames.Contains(assemblyName.Name))
+ {
+ type = assem.GetType(typeName, false);
+ if (type != null)
+ break;
+ }
+ }
+
+ // Fall back to finding the type in every assembly in the current appdomain
+ foreach (var assem in global::System.AppDomain.CurrentDomain.GetAssemblies())
+ {
+ type = assem.GetType(typeName, false);
+ if (type != null)
+ break;
+ }
+ }
+
+ if (type == null) //Shouldn't happen. But if it did, this would mean we didn't expose this class to SWIG
+ {
+ throw new global::System.Exception("The type " + typeName + " does not exist in the list of loaded assemblies");
+ }
+ else
+ {
+ //The constructor we require has been assigned internal visibility by SWIG. We could change it to public, but the internal
+ //visibility is the ideal one for purposes of encapulsation (this is internal use only). So instead of Activator.CreateInstance()
+ //which does not work with internal constructors, we'll find the ctor ourselves and invoke it.
+ var flags = global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance;
+ var ctors = type.GetTypeInfo().GetConstructors(flags);
+ var ctor = ctors.FirstOrDefault(ci =>
+ {
+ var parms = ci.GetParameters();
+ if (parms.Length == 2)
+ {
+ return parms[0].ParameterType == typeof(global::System.IntPtr)
+ && parms[1].ParameterType == typeof(bool);
+ }
+ return false;
+ });
+ if (ctor == null)
+ throw new global::System.Exception("Could not find required constructor among " + ctors.Length + " constructors with signature (IntPtr, bool) on type: " + type.Name);
+
+ return ctor;
+ }
+ }
}
}
\ No newline at end of file
Modified: sandbox/jng/vanilla_swig/Bindings/src/Tools/ClassMapGen/Program.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Tools/ClassMapGen/Program.cs 2020-11-20 15:56:48 UTC (rev 9801)
+++ sandbox/jng/vanilla_swig/Bindings/src/Tools/ClassMapGen/Program.cs 2020-11-21 15:32:08 UTC (rev 9802)
@@ -7,6 +7,7 @@
using CommandLine;
using System.Xml;
using NCalc;
+using System.Collections.Concurrent;
namespace ClassMapGen
{
@@ -57,46 +58,18 @@
MasterClassMap clsMap = ReadFromSwigXml(opts.SwigXmlFile);
- var foundation = clsMap.Modules.FirstOrDefault(m => m.Name == "Foundation");
- var geometry = clsMap.Modules.FirstOrDefault(m => m.Name == "Geometry");
- var platform = clsMap.Modules.FirstOrDefault(m => m.Name == "PlatformBase");
- var mapguide = clsMap.Modules.FirstOrDefault(m => m.Name == "MapGuideCommon");
- var web = clsMap.Modules.FirstOrDefault(m => m.Name == "Web");
-
- int foundationAdded = 0;
- int geometryAdded = 0;
- int platformAdded = 0;
- int mapguideAdded = 0;
- int webAdded = 0;
-
var classMapMaster = new Dictionary<int, string>();
var classMapMasterReverse = new SortedDictionary<string, int>();
+ var addedStats = new ConcurrentDictionary<string, int>();
- foreach (var kvp in foundation.Classes)
+ foreach (var mod in clsMap.Modules)
{
- if (classMapMaster.TryAdd(kvp.Key, kvp.Value))
- foundationAdded++;
+ foreach (var kvp in mod.Classes)
+ {
+ if (classMapMaster.TryAdd(kvp.Key, kvp.Value))
+ addedStats.AddOrUpdate(mod.Name, k => 1, (k, cv) => cv + 1);
+ }
}
- foreach (var kvp in geometry.Classes)
- {
- if (classMapMaster.TryAdd(kvp.Key, kvp.Value))
- geometryAdded++;
- }
- foreach (var kvp in platform.Classes)
- {
- if (classMapMaster.TryAdd(kvp.Key, kvp.Value))
- platformAdded++;
- }
- foreach (var kvp in mapguide.Classes)
- {
- if (classMapMaster.TryAdd(kvp.Key, kvp.Value))
- mapguideAdded++;
- }
- foreach (var kvp in web.Classes)
- {
- if (classMapMaster.TryAdd(kvp.Key, kvp.Value))
- webAdded++;
- }
//Now populate reverse map
foreach (var kvp in classMapMaster)
@@ -104,11 +77,10 @@
classMapMasterReverse[kvp.Value] = kvp.Key;
}
- Console.WriteLine($"Foundation: {foundationAdded} classes added");
- Console.WriteLine($"Geometry: {geometryAdded} classes added");
- Console.WriteLine($"PlatformBase: {platformAdded} classes added");
- Console.WriteLine($"MapGuideCommon: {mapguideAdded} classes added");
- Console.WriteLine($"Web: {webAdded} classes added");
+ foreach (var kvp in addedStats)
+ {
+ Console.WriteLine($"{kvp.Key}: {kvp.Value} classes added");
+ }
Console.WriteLine($"Class map has {classMapMaster.Count} classes");
@@ -125,25 +97,32 @@
phpTpl.Replace("$CLASS_NAME_MAP_BODY$", phpClassMaps.ToString());
- var dotNetClassMaps = new StringBuilder();
+ var javaClassMaps = new StringBuilder();
- //.net
+ //Java
foreach (var kvp in classMapMasterReverse)
{
- dotNetClassMaps.AppendLine($"{DOTNET_INDENT}classNameMap[{kvp.Value}] = \"OSGeo.MapGuide.{kvp.Key}\";");
+ javaClassMaps.AppendLine($"{JAVA_INDENT}classMap.put(new Integer({kvp.Value}), getSWIGCtor(\"{kvp.Key}\"));");
}
- dotNetTpl.Replace("$CLASS_NAME_MAP_BODY$", dotNetClassMaps.ToString());
+ javaTpl.Replace("$CLASS_NAME_MAP_BODY$", javaClassMaps.ToString());
- var javaClassMaps = new StringBuilder();
+ var dotNetClassMaps = new StringBuilder();
- //Java
- foreach (var kvp in classMapMasterReverse)
+ //.net
+ foreach (var mod in clsMap.Modules)
{
- javaClassMaps.AppendLine($"{JAVA_INDENT}classMap.put(new Integer({kvp.Value}), getSWIGCtor(\"{kvp.Key}\"));");
+ dotNetClassMaps.AppendLine($"{DOTNET_INDENT}if (HasAssemblyInAppDomain(\"OSGeo.MapGuide.{mod.Name}\")) {{");
+
+ foreach (var kvp in mod.Classes)
+ {
+ dotNetClassMaps.AppendLine($"{DOTNET_INDENT} classIdCtorMap[{kvp.Key}] = ResolveConstructor(\"OSGeo.MapGuide.{kvp.Value}\");");
+ }
+
+ dotNetClassMaps.AppendLine($"{DOTNET_INDENT}}}");
}
- javaTpl.Replace("$CLASS_NAME_MAP_BODY$", javaClassMaps.ToString());
+ dotNetTpl.Replace("$CLASS_NAME_MAP_BODY$", dotNetClassMaps.ToString());
File.WriteAllText(phpOut, phpTpl.ToString());
Console.WriteLine($"Written: {phpOut}");
More information about the mapguide-commits
mailing list