Ejemplo n.º 1
0
    public void MapIdl() {
        MetaDataGenerator generator = new MetaDataGenerator(GetAssemblyName(), 
                                                            m_commandLine.OutputDirectory.FullName,
                                                            m_commandLine.ReferencedAssemblies);
        if (m_commandLine.GenerateValueTypeSkeletons) {
            generator.EnableValueTypeSkeletonGeneration(m_vtSkelcodeDomProvider,
                                                        m_commandLine.ValueTypeSkeletonsTargetDir,
                                                        m_commandLine.OverwriteValueTypeSkeletons);
        }       
        generator.MapAnyToAnyContainer = m_commandLine.MapAnyToAnyContainer;
        if (m_commandLine.BaseInterface != null) {
            generator.InheritedInterface = m_commandLine.BaseInterface;
        }

        string currentDir = Directory.GetCurrentDirectory();
        for (int i = 0; i < m_commandLine.InputFileNames.Count; i++) {
            Debug.WriteLine("checking file: " + m_commandLine.InputFileNames[i] );

            string rootedPath = (string)m_commandLine.InputFileNames[i];
            if (!Path.IsPathRooted((string)m_commandLine.InputFileNames[i])) {
                rootedPath = Path.Combine(currentDir, (string)m_commandLine.InputFileNames[i]);
            }
            string searchDirectory = Path.GetDirectoryName(rootedPath);
            string fileName = Path.GetFileName(rootedPath);

            string[] expandedFiles = Directory.GetFileSystemEntries(searchDirectory, fileName);
            if (expandedFiles.Length > 0) {
                foreach (string file in expandedFiles) {
                    processFile(generator, file);
                }
            } else {
                Error("file(s) not found: " + m_commandLine.InputFileNames[i]);                
            }
        }
        // save the result to disk
        generator.SaveAssembly();
    }