Beispiel #1
0
        ///
        ///	 <summary> * list all direct child directories
        ///	 *  </summary>
        ///	 * <param name="dir"> the directory to search
        ///	 *  </param>
        ///	 * <returns> Files[] the matching directories, null if none are found </returns>
        ///
        public static DirectoryInfo[] listDirectories(DirectoryInfo dir)
        {
            if (dir == null)
            {
                return(null);
            }
            DirectoryInfo[]      checkFiles = dir.GetDirectories();
            List <DirectoryInfo> files      = new List <DirectoryInfo>();
            DirectoryFileFilter  dff        = new DirectoryFileFilter();

            foreach (DirectoryInfo checkFile in checkFiles)
            {
                if (dff.accept(checkFile))
                {
                    files.Add(checkFile);
                }
            }
            if (files.Count == 0)
            {
                return(null);
            }
            else
            {
                return(files.ToArray());
            }
        }
Beispiel #2
0
        private void LoadBxlSources(IBSharpContext context)
        {
            var bxlparser = new BxlParser();

            if (null != Project.Definition)
            {
                Project.Log.Debug(Project.SrcClass.Compiled.ToString());
            }
            var filter = DirectoryFileFilter.Create(Project);

            PrintDebugFilter(filter);
            foreach (var file in filter.Collect().ToArray())
            {
                try {
                    var xml = bxlparser.Parse(null, file);
                    Project.Sources.Add(xml);
                    Project.Log.Debug("add src from " + file);
                } catch (Exception ex) {
                    context.RegisterError(BSharpErrors.Generic(ex));
                    Project.Log.Fatal("cannot load src from " + file + " : " + ex.Message);
                }
            }
        }
Beispiel #3
0
 private void PrintDebugFilter(DirectoryFileFilter filter)
 {
     Project.Log.Debug("Sources:");
     Project.Log.Debug("\troots:");
     foreach (var root in filter.Roots)
     {
         Project.Log.Debug("\t\t" + root);
     }
     Project.Log.Debug("\tmasks:");
     foreach (var root in filter.SearchMasks)
     {
         Project.Log.Debug("\t\t" + root);
     }
     Project.Log.Debug("\tincludes:");
     foreach (var root in filter.Includes)
     {
         Project.Log.Debug("\t\t" + root);
     }
     Project.Log.Debug("\texcludes:");
     foreach (var root in filter.Excludes)
     {
         Project.Log.Debug("\t\t" + root);
     }
 }