Beispiel #1
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);
        }
Beispiel #2
0
 public void RegisterGroup(string className, CsGroup group)
 {
     _mapRegisteredFunctionGroup.Add(className, group);
 }