[commit] r2115 - in trunk/SDK/DotNet/DsmlGenerator: CSharpDsmlGenerator CSharpDsmlGenerator/Generator CSharpDsmlGenerator/Properties ISIS.GME.Common ISIS.GME.Common/Properties

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Thu Dec 6 11:41:04 CST 2012


Author: lattmann
Date: Thu Dec  6 11:41:04 2012
New Revision: 2115

Log:
Handle src/dst endpoints correctly for the generated API
Fix: referencedBy exception in ISIS.GME.Common.dll

Modified:
   trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/CSharpDSMLGenerator.cs
   trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoHelper.cs
   trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs
   trunk/SDK/DotNet/DsmlGenerator/ISIS.GME.Common/Properties/AssemblyInfo.cs
   trunk/SDK/DotNet/DsmlGenerator/ISIS.GME.Common/Utils.cs

Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/CSharpDSMLGenerator.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/CSharpDSMLGenerator.cs	Tue Nov 27 11:14:30 2012	(r2114)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/CSharpDSMLGenerator.cs	Thu Dec  6 11:41:04 2012	(r2115)
@@ -136,6 +136,21 @@
             List<MgaObject> all = new List<MgaObject>();
             CodeCompileUnit compileunit = new CodeCompileUnit();
 
+            // TODO: add version
+            //var fileVersion = new CodeAttributeDeclaration() {
+            //    Name = "AssemblyFileVersionAttribute",
+            //};
+            
+            //var version = new CodeAttributeDeclaration()
+            //{
+            //    Name = "AssemblyVersion"
+            //};
+            //fileVersion.Arguments.Add(new CodeAttributeArgument("AssemblyFileVersionAttribute", new CodeSnippetExpression("1.0.0.*")));
+            //version.Arguments.Add(new CodeAttributeArgument(new CodeSnippetExpression("1.0.0.*")));
+
+            //compileunit.AssemblyCustomAttributes.Add(fileVersion);
+            //compileunit.AssemblyCustomAttributes.Add(version);
+
             all.AddRange(
                 FlattenMga<IMgaObject>(project.RootFolder, x => x.ChildObjects.Cast<MgaObject>()).
                 Cast<MgaObject>());
@@ -267,8 +282,11 @@
 					Assembly.GetAssembly(typeof(ISIS.GME.Common.Utils)).Location,
 				};
 
-                CompilerParameters cp = new CompilerParameters(referenceAssemblies,
-                                                                                                             dllFile, false);
+                CompilerParameters cp = new CompilerParameters(
+                    referenceAssemblies,
+                    dllFile,
+                    false);
+
                 // Generate a DLL file.
                 cp.GenerateExecutable = false;
 

Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoHelper.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoHelper.cs	Tue Nov 27 11:14:30 2012	(r2114)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoHelper.cs	Thu Dec  6 11:41:04 2012	(r2115)
@@ -521,7 +521,9 @@
 				MgaSimpleConnection simple = cp.Owner as MgaSimpleConnection;
 				if (simple != null)
 				{
-					if (simple.MetaBase.Name == "ConnectorToDestination")
+					if (simple.MetaBase.Name == "ConnectorToDestination" ||
+                        (simple.MetaBase.Name == "SourceToConnector" &&
+                        string.IsNullOrEmpty(simple.StrAttrByName["srcRolename"])))
 					{
 						MgaFCO connector = simple.Src;
 						foreach (MgaConnPoint cpConnector in connector.PartOfConns)
@@ -570,7 +572,9 @@
 				MgaSimpleConnection simple = cp.Owner as MgaSimpleConnection;
 				if (simple != null)
 				{
-					if (simple.MetaBase.Name == "SourceToConnector")
+					if (simple.MetaBase.Name == "SourceToConnector" ||
+                        (simple.MetaBase.Name == "ConnectorToDestination" &&
+                        string.IsNullOrEmpty(simple.StrAttrByName["dstRolename"])))
 					{
 						MgaFCO connector = simple.Dst;
 						foreach (MgaConnPoint cpConnector in connector.PartOfConns)
@@ -638,7 +642,7 @@
 							MgaSimpleConnection simpleConn = cpConnector.Owner as MgaSimpleConnection;
 							if (simpleConn != null)
 							{
-								if (simpleConn.MetaBase.Name == "SourceToConnector")
+                                if (simpleConn.MetaBase.Name == "SourceToConnector")
 								{
 									if (simpleConn.Src is MgaReference)
 									{
@@ -665,6 +669,34 @@
 										}
 									}
 								}
+                                else if (simpleConn.MetaBase.Name == "ConnectorToDestination" &&
+                                         string.IsNullOrEmpty(simpleConn.StrAttrByName["dstRolename"]))
+                                {
+                                    if (simpleConn.Dst is MgaReference)
+                                    {
+                                        yield return (simpleConn.Dst as MgaReference).Referred;
+
+                                        if (includeDerived)
+                                        {
+                                            foreach (MgaFCO derivedClass in GetDerivedClasses((simpleConn.Dst as MgaReference).Referred))
+                                            {
+                                                yield return derivedClass;
+                                            }
+                                        }
+                                    }
+                                    else
+                                    {
+                                        yield return simpleConn.Dst;
+
+                                        if (includeDerived)
+                                        {
+                                            foreach (MgaFCO derivedClass in GetDerivedClasses(simpleConn.Dst))
+                                            {
+                                                yield return derivedClass;
+                                            }
+                                        }
+                                    }
+                                }
 							}
 						}
 					}
@@ -697,7 +729,7 @@
 							MgaSimpleConnection simpleConn = cpConnector.Owner as MgaSimpleConnection;
 							if (simpleConn != null)
 							{
-								if (simpleConn.MetaBase.Name == "ConnectorToDestination")
+                                if (simpleConn.MetaBase.Name == "ConnectorToDestination")
 								{
 									if (simpleConn.Dst is MgaReference)
 									{
@@ -724,6 +756,34 @@
 										}
 									}
 								}
+                                else if (simpleConn.MetaBase.Name == "SourceToConnector" &&
+                                         string.IsNullOrEmpty(simpleConn.StrAttrByName["srcRolename"]))
+                                {
+                                    if (simpleConn.Src is MgaReference)
+                                    {
+                                        yield return (simpleConn.Src as MgaReference).Referred;
+
+                                        if (includeDerived)
+                                        {
+                                            foreach (MgaFCO derivedClass in GetDerivedClasses((simpleConn.Src as MgaReference).Referred))
+                                            {
+                                                yield return derivedClass;
+                                            }
+                                        }
+                                    }
+                                    else
+                                    {
+                                        yield return simpleConn.Src;
+
+                                        if (includeDerived)
+                                        {
+                                            foreach (MgaFCO derivedClass in GetDerivedClasses(simpleConn.Src))
+                                            {
+                                                yield return derivedClass;
+                                            }
+                                        }
+                                    }
+                                }
 							}
 						}
 					}

Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs	Tue Nov 27 11:14:30 2012	(r2114)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs	Thu Dec  6 11:41:04 2012	(r2115)
@@ -32,6 +32,6 @@
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.4.0")]
-[assembly: AssemblyFileVersion("1.0.4.0")]
+[assembly: AssemblyVersion("1.0.5.0")]
+[assembly: AssemblyFileVersion("1.0.5.0")]
 // also change GME_SDK.wxs

Modified: trunk/SDK/DotNet/DsmlGenerator/ISIS.GME.Common/Properties/AssemblyInfo.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/ISIS.GME.Common/Properties/AssemblyInfo.cs	Tue Nov 27 11:14:30 2012	(r2114)
+++ trunk/SDK/DotNet/DsmlGenerator/ISIS.GME.Common/Properties/AssemblyInfo.cs	Thu Dec  6 11:41:04 2012	(r2115)
@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.2.0")]
-[assembly: AssemblyFileVersion("1.0.2.0")]
+[assembly: AssemblyVersion("1.0.3.0")]
+[assembly: AssemblyFileVersion("1.0.3.0")]

Modified: trunk/SDK/DotNet/DsmlGenerator/ISIS.GME.Common/Utils.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/ISIS.GME.Common/Utils.cs	Tue Nov 27 11:14:30 2012	(r2114)
+++ trunk/SDK/DotNet/DsmlGenerator/ISIS.GME.Common/Utils.cs	Thu Dec  6 11:41:04 2012	(r2115)
@@ -1053,8 +1053,18 @@
                 try
                 {
                     metaRef = item.MetaBase.MetaRef;
-                    fco = Activator.CreateInstance(dictionary[metaRef]) as ISIS.GME.Common.Interfaces.FCO;
-                    (fco as ISIS.GME.Common.Classes.FCO).Impl = item as IMgaObject;
+                    Type type = null;
+                    if (dictionary.TryGetValue(metaRef, out type))
+                    {
+                        // can be casted to the requested type
+                        fco = Activator.CreateInstance(type) as ISIS.GME.Common.Interfaces.FCO;
+                        (fco as ISIS.GME.Common.Classes.FCO).Impl = item as IMgaObject;
+                    }
+                    else
+                    {
+                        // cannot be casted to DSML types
+                        continue;
+                    }
                 }
                 catch (Exception ex)
                 {


More information about the gme-commit mailing list