private static string Classes(SourceCodeFileDto sourceCodeFile)
 {
     return(string.Join(
                Environment.NewLine,
                sourceCodeFile.Classes.Select(
                    classDeclarationInfo => GenerateClass(classDeclarationInfo,
                                                          methodDeclarationInfo => GenerateMethod(methodDeclarationInfo,
                                                                                                  s => GenerateAttribute(s))))));
 }
 private SourceCodeFile ToSourceCodeFile(SourceCodeFileDto scf)
 {
     return(new SourceCodeFile(
                _ruleViolationFactory,
                scf.DeclaredNamespaces,
                scf.ParentProjectAssemblyName,
                scf.ParentProjectRootNamespace,
                scf.PathRelativeToProjectRoot,
                ToClasses(scf.Classes,
                          methodDeclarationInfos =>
                          ToMethods(methodDeclarationInfos, _ruleViolationFactory))));
 }
 public static string GenerateFrom(SourceCodeFileDto sourceCodeFile)
 {
     return(Usings(sourceCodeFile) + $"namespace {sourceCodeFile.DeclaredNamespaces.Single()}" + " {" +
            Classes(sourceCodeFile) + "}");
 }
 private static string Usings(SourceCodeFileDto sourceCodeFile)
 {
     return(string.Join(
                Environment.NewLine,
                sourceCodeFile.Usings.Select(n => $"using {n};")));
 }
Exemplo n.º 5
0
        public FileInfo PathToFileInProject(DirectoryName projectDirectoryName, SourceCodeFileDto sourceCodeFile)
        {
            var fullFilePath = _absoluteSolutionDirectoryPath + projectDirectoryName + sourceCodeFile.PathRelativeToProjectRoot;

            return(fullFilePath.Info());
        }
Exemplo n.º 6
0
 public void AddFile(SourceCodeFileDto xmlSourceCodeFile)
 {
     _xmlProject.SourceCodeFiles.Add(xmlSourceCodeFile);
 }
Exemplo n.º 7
0
 public void Add(string projectName, SourceCodeFileDto xmlSourceCodeFile)
 {
     _filesByProject[projectName].Add(xmlSourceCodeFile);
 }