예제 #1
0
 public bool IsSpecDirectory(DirectorySpec spec, string dirPath)
 {
     if (spec.PathNameExcludes.Count > 0)
     {
         var relDir   = RelativeDirectory(dirPath);
         var dirnames = DirectoryParts(relDir);
         if (dirnames.Length > 0)
         {
             for (int i = 0; i < dirnames.Length; i++)
             {
                 if (spec.PathNameExcludes.Contains("\\" + dirnames[i]))
                 {
                     return(false);
                 }
             }
         }
     }
     if (spec.PathRelativeExcludes.Count > 0)
     {
         var relDir = RelativeDirectory(dirPath);
         if (spec.PathRelativeExcludes.Contains(relDir))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #2
0
 public SlynchyDirectoryTree(string name, string rootPath)
 {
     Spec = new DirectorySpec();
     Name = name;
     RootDirectoryPath = rootPath;
     if (!String.IsNullOrEmpty(RootDirectoryPath))
     {
         ScanTree();
     }
 }
예제 #3
0
        public SlynchyDirectory(DirectorySpec spec, string rootDirectory, SlynchyDirectory parent, string path)
        {
            Spec          = spec;
            RootDirectory = rootDirectory;
            IsRoot        = false;

            Info = new DirectoryInfo(path);
            GetDirectoryFiles();

            //recursive directory and file object tree here
            GetSubDirectoryInfo();
        }
예제 #4
0
        public SlynchyDirectory(DirectorySpec spec, string rootDirectory, string directoryPath)
        {
            //This is the root directory Info, ParentDirectoryInfo is null
            Spec          = spec;
            RootDirectory = rootDirectory;
            IsRoot        = true;

            if (!String.IsNullOrEmpty(directoryPath))
            {
                Info = new DirectoryInfo(directoryPath);
                GetDirectoryFiles();

                //Start recursive directory and file object tree here
                GetSubDirectoryInfo();

                //Made sure subdirectories and files of excluded directories are excluded
                ExcludeFilesInExcludedDirs();
            }
        }
예제 #5
0
        public bool IsSpecFile(DirectorySpec spec, SlynchyFile info)
        {
            if (spec.IncludedFileExtensions.Count > 0)
            {
                if (spec.IncludedFileExtensions.Contains(info.Info.Extension))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            if (spec.FileNameExcludes.Count > 0)
            {
                if (spec.FileNameExcludes.Contains(info.Info.Name))
                {
                    return(false);
                }
            }
            if (spec.FilePathExcludes.Count > 0)
            {
                if (spec.FilePathExcludes.Contains(info.Info.FullName))
                {
                    return(false);
                }
            }
            if (spec.DirFileExcludes.Count > 0)
            {
                var relDir      = RelativeDirectory(info.Info.DirectoryName);
                var relPathFile = Path.Combine(relDir, info.Info.Name);
                if (spec.DirFileExcludes.Contains(relPathFile))
                {
                    return(false);
                }
            }

            return(true);
        }