private string ReplaceTypeToken(string currentCode, GenerationData data)
        {
            var instance      = _factory.Create(data.Type);
            var generatedCode = instance.Generate(data.Data);
            var typeToken     = $"[{data.Type.FormatTypeName(false)}]";

            currentCode = RemoveSection(currentCode, typeToken);

            return(currentCode.Replace(typeToken, generatedCode));
        }
Exemple #2
0
        private string ReplaceTypeToken(string currentCode, GenerationData data)
        {
            var objectsData   = (IEnumerable <object>)data.Data;
            var generatedCode = string.Join(string.Empty,
                                            objectsData.Select(o => $"{(string) o}{Environment.NewLine}"));
            var typeToken = $"[{data.Type.FormatTypeName(false)}]";

            currentCode = RemoveSection(currentCode, typeToken);

            return(currentCode.Replace(typeToken, generatedCode));
        }