[commit] r2031 - in trunk: Install/Build Tools/DumpWMF Tools/DumpWMF/Properties

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Mon Aug 27 11:45:06 CDT 2012


Author: ksmyth
Date: Mon Aug 27 11:45:06 2012
New Revision: 2031

Log:
DumpWMF project

Added:
   trunk/Tools/DumpWMF/
   trunk/Tools/DumpWMF/DumpWMF.cs
   trunk/Tools/DumpWMF/DumpWMF.csproj
   trunk/Tools/DumpWMF/DumpWMF.sln
   trunk/Tools/DumpWMF/Properties/
   trunk/Tools/DumpWMF/Properties/AssemblyInfo.cs
Modified:
   trunk/Install/Build/build.py

Modified: trunk/Install/Build/build.py
==============================================================================
--- trunk/Install/Build/build.py	Mon Aug 27 11:44:53 2012	(r2030)
+++ trunk/Install/Build/build.py	Mon Aug 27 11:45:06 2012	(r2031)
@@ -204,6 +204,9 @@
     sln_file = os.path.join(GME_ROOT, "SDK", "DotNet", "CSharpComponentWizard", "CSharpComponentWizard.sln")
     tools.build_VS( sln_file, "Release" )
 
+    sln_file = os.path.join(GME_ROOT, "Tools", "DumpWMF", "DumpWMF.sln")
+    tools.build_VS( sln_file, "Release" )
+
 def compile_samples():
     "Compile sample components"
     

Added: trunk/Tools/DumpWMF/DumpWMF.cs
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/Tools/DumpWMF/DumpWMF.cs	Mon Aug 27 11:45:06 2012	(r2031)
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.InteropServices;
+using GME.MGA;
+using GME.MGA.Meta;
+using System.IO;
+using System.Text.RegularExpressions;
+
+namespace DumpWMF
+{
+    // Dump all
+    // import win32com.client; win32com.client.DispatchEx("MGA.DumpWMF").DumpWMFs(r'C:\Users\ksmyth\Desktop\tmp', gme)
+    // Dump under opened model
+    // import win32com.client; win32com.client.DispatchEx("MGA.DumpWMF").DumpWMFs(r'C:\Users\ksmyth\Desktop\tmp', gme.oleit.MgaModel)
+    // Dump under selected node in Tree Browser
+    // import win32com.client; win32com.client.DispatchEx("MGA.DumpWMF").DumpWMFs(r'C:\Users\ksmyth\Desktop\tmp', [panel for panel in gme.Panels if panel.Name == 'Browser'][0].Interface.GetSelectedMgaObjects().Item(1))
+
+    [ComVisible(true),
+    ProgId("MGA.DumpWMF")]
+    public class DumpWMF
+    {
+        public void DumpWMFs(string outdir, object obj)
+        {
+            GME.IGMEOLEApp app;
+            IMgaObject root;
+            if (obj is IMgaObject)
+            {
+                root = obj as IMgaObject;
+                app = (GME.IGMEOLEApp)root.Project.GetClientByName("GME.Application").OLEServer;
+                root.Project.BeginTransactionInNewTerr(transactiontype_enum.TRANSACTION_NON_NESTED);
+            }
+            else
+            {
+                app = obj as GME.IGMEOLEApp;
+                app.MgaProject.BeginTransactionInNewTerr(transactiontype_enum.TRANSACTION_NON_NESTED);
+                root = app.MgaProject.RootFolder;
+            }
+            Dictionary<IMgaModel, string> models = new Dictionary<IMgaModel, string>();
+            try
+            {
+                Queue<IMgaObject> objects = new Queue<IMgaObject>();
+                objects.Enqueue(root);
+                while (objects.Count > 0)
+                {
+                    IMgaObject o = objects.Dequeue();
+                    if (o.ObjType == objtype_enum.OBJTYPE_FOLDER)
+                    {
+                        foreach (var i in (o as IMgaFolder).ChildObjects)
+                            objects.Enqueue(i as IMgaObject);
+                    }
+                    else if (o.ObjType == objtype_enum.OBJTYPE_MODEL)
+                    {
+                        foreach (var i in (o as IMgaModel).ChildFCOs)
+                            objects.Enqueue(i as IMgaFCO);
+                        if ((o as IMgaModel).ChildFCOs.Count > 0)
+                            models.Add(o as IMgaModel, o.Name + " " + o.ID);
+                    }
+                }
+            }
+            finally
+            {
+                root.Project.AbortTransaction();
+            }
+            foreach (var ent in models)
+            {
+                app.ShowFCO(ent.Key as MgaFCO);
+                app.OleIt.DumpWindowsMetaFile(Path.Combine(outdir, RemoveInvalidFilePathCharacters(ent.Value, "")) + ".wmf");
+                app.OleIt.Close();
+            }
+        }
+
+        public static string RemoveInvalidFilePathCharacters(string filename, string replaceChar)
+        {
+            string regexSearch = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
+            Regex r = new Regex(string.Format("[{0}]", Regex.Escape(regexSearch)));
+            return r.Replace(filename, replaceChar);
+        }
+    }
+}

Added: trunk/Tools/DumpWMF/DumpWMF.csproj
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/Tools/DumpWMF/DumpWMF.csproj	Mon Aug 27 11:45:06 2012	(r2031)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{1510BA68-6F69-4B2A-AEA3-191999DEB44B}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>DumpWMF</RootNamespace>
+    <AssemblyName>DumpWMF</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <RegisterForComInterop>true</RegisterForComInterop>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="GME, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
+    <Reference Include="GME.MGA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
+    <Reference Include="GME.MGA.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
+    <Reference Include="GME.MGA.Meta, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
+    <Reference Include="GME.MGA.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
+    <Reference Include="GME.Util, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="DumpWMF.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Added: trunk/Tools/DumpWMF/DumpWMF.sln
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/Tools/DumpWMF/DumpWMF.sln	Mon Aug 27 11:45:06 2012	(r2031)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DumpWMF", "DumpWMF.csproj", "{1510BA68-6F69-4B2A-AEA3-191999DEB44B}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{1510BA68-6F69-4B2A-AEA3-191999DEB44B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{1510BA68-6F69-4B2A-AEA3-191999DEB44B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{1510BA68-6F69-4B2A-AEA3-191999DEB44B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{1510BA68-6F69-4B2A-AEA3-191999DEB44B}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Added: trunk/Tools/DumpWMF/Properties/AssemblyInfo.cs
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/Tools/DumpWMF/Properties/AssemblyInfo.cs	Mon Aug 27 11:45:06 2012	(r2031)
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("DumpWMF")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("DumpWMF")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("2f397c1f-e148-4918-affc-43c8905697d8")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// 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.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]


More information about the gme-commit mailing list