Exemplo n.º 1
0
        /// <summary>
        /// Maps a particular C++ include to a C# namespace.
        /// </summary>
        /// <param name="includeName">Name of the include.</param>
        /// <param name="assemblyName">The assembly.</param>
        /// <param name="nameSpace">The namespace.</param>
        /// <param name="outputDirectory">The output directory for the namespace.</param>
        public void MapIncludeToNamespace(string includeName, string assemblyName, string nameSpace, string outputDirectory)
        {
            var cSharpNamespace = manager.GetOrCreateNamespace(assemblyName, nameSpace);

            if (outputDirectory != null)
            {
                cSharpNamespace.OutputDirectory = outputDirectory;
            }
            _mapIncludeToNamespace.Add(includeName, cSharpNamespace);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the C# class container used to group together loose elements (i.e. functions, constants).
        /// </summary>
        /// <param name="assemblyName">Name of the assembly.</param>
        /// <param name="namespaceName">Name of the namespace.</param>
        /// <param name="className">Name of the class.</param>
        /// <returns>The C# class container</returns>
        private CsGroup CreateCsGroup(string assemblyName, string namespaceName, string className)
        {
            if (className == null)
            {
                throw new ArgumentNullException(nameof(className));
            }

            if (className.Contains("."))
            {
                namespaceName = Path.GetFileNameWithoutExtension(className);
                className     = Path.GetExtension(className).Trim('.');
            }

            var csNameSpace = assemblyManager.GetOrCreateNamespace(assemblyName, namespaceName);

            foreach (var cSharpFunctionGroup in csNameSpace.Classes)
            {
                if (cSharpFunctionGroup.Name == className)
                {
                    return(cSharpFunctionGroup);
                }
            }


            var group = new CsGroup {
                Name = className
            };

            csNameSpace.Add(group);

            groupRegistry.RegisterGroup(namespaceName + "." + className, group);

            return(group);
        }