Exemple #1
0
        private static string GenerateListOfDependencies(IClass @class, string operation)
        {
            var builder = new StringBuilder();
            var types   = @class.AllReferencedTypes();

            foreach (var type in types)
            {
                string name = type.BareName;
                string from = "";
                if (type.IsEnum)
                {
                    from = "enums";
                }
                if (name.EndsWith("DTO"))
                {
                    from = "dtos";
                }
                if (!String.IsNullOrEmpty(from))
                {
                    if (operation == "import")
                    {
                        builder.AppendLine($"import {{ {name} }} from \"../{from}/{type.Namespace}.{name}\";");
                    }
                    if (operation == "export")
                    {
                        builder.AppendLine($"export * from \"../{from}/{type.Namespace}.{name}\";");
                    }
                }
            }

            return(builder.ToString());
        }