Ejemplo n.º 1
0
        private Dictionary <string, List <Type> > GetFilesToGenerate(Assembly assembly)
        {
            var typesPerNamespace = new Dictionary <string, List <Type> >();

            foreach (var type in TypeUtils.GetAssemblyTypes(assembly))
            {
                if (ShouldTypeBeGenerated(type))
                {
                    var namespaceName = TypeBuilder.GetTypescriptNamespace(type);
                    if (string.IsNullOrEmpty(namespaceName))
                    {
                        Console.Error.WriteLine($"The type {type.FullName} is marked to generate TypeScript definition but no TypeScript namespace could be found for it");
                        continue;
                    }

                    if (!typesPerNamespace.ContainsKey(namespaceName))
                    {
                        typesPerNamespace.Add(namespaceName, new List <Type>());
                    }

                    typesPerNamespace[namespaceName].Add(type);
                }
            }

            return(typesPerNamespace);
        }