Exemple #1
0
        public IEnumerable <IProjectFile> GetProjectFiles()
        {
            ITypeElement declaredType = this.GetDeclaredType();

            if (declaredType == null)
            {
                return(EmptyArray <IProjectFile> .Instance);
            }

            return(declaredType.GetSourceFiles().Select(x => x.ToProjectFile()));
        }
Exemple #2
0
 public static string GetControllerArea([CanBeNull] ITypeElement controller)
 {
     if (controller == null)
     {
         return(null);
     }
     return
         ((
              from sourceFile in controller.GetSourceFiles()
              let project = sourceFile.GetProject()
                            where project != null
                            let location = sourceFile.GetLocation()
                                           let areasFolder = project.Location.Combine(AreasFolder)
                                                             where areasFolder.IsPrefixOf(location)
                                                             select location.ConvertToRelativePath(areasFolder).GetPathComponents().FirstOrDefault()
              )
          .WhereNotNull()
          .FirstOrDefault());
 }