コード例 #1
0
        public IEnumerable <string> GetFiles(string root, string pattern, IncludeExcludeCollection sourceFileFilters)
        {
            root = root.Trim().ToLower().Replace('/', '\\').Trim('\\') + '\\';
            var excludeIncludeElements = sourceFileFilters.Cast <IncludeExcludeElement>();

            return(Directory.GetFiles(root, pattern, SearchOption.AllDirectories).Where(fn => Filter(root, fn, excludeIncludeElements)));
        }
コード例 #2
0
        public void TestGetFiles(string includes, string excludes, int expectedCount)
        {
            var includeSplit             = includes.Split(';');
            var excludeSplit             = excludes.Split(';');
            var includeExcludeCollection = new IncludeExcludeCollection();

            Assert.AreEqual(includeSplit.Count(), excludeSplit.Count());
            for (int index = 0; index < includeSplit.Length; index++)
            {
                includeExcludeCollection.Add(new IncludeExcludeElement {
                    Include = includeSplit[index], Exclude = excludeSplit[index]
                });
            }

            string tempRoot = null;

            try
            {
                tempRoot = TestUtils.CreateFoldersAndFiles(TestUtils.MockFileSystemDefinition, "cs");
                var files = new FileSystemHelper().GetFiles(tempRoot, "*.cs", includeExcludeCollection);
                Assert.AreEqual(expectedCount, files.Count());
            }
            finally
            {
                if (tempRoot != null)
                {
                    TestUtils.DeleteFolder(tempRoot);
                }
            }
        }
コード例 #3
0
 protected TransformRule(IncludeExcludeCollection sourceFileFilters, IFileSystemHelper fileSystemHelper, string fileNamePattern = "*.cs", bool isBackupEnabled = true)
 {
     _isBackupEnabled   = isBackupEnabled;
     _fileNamePattern   = fileNamePattern;
     _fileSystemHelper  = fileSystemHelper;
     _sourceFileFilters = sourceFileFilters;
 }
コード例 #4
0
        protected RefactorRule(IncludeExcludeCollection sourceFileFilters, IFileSystemHelper fileSystemHelper, string fileNamePattern = "*.cs", bool isBackupEnabled = true)
            : base(sourceFileFilters, fileSystemHelper, fileNamePattern, isBackupEnabled)
        {
            var workspace = new CustomWorkspace();
            var solution  = workspace.CurrentSolution;

            _project  = solution.AddProject("dummyProjectName", "dummyAssemblyName", LanguageNames.CSharp);
            Parameter = new ExpandoObject();
        }
コード例 #5
0
 public ReformatRule(string optionsFilePath, IncludeExcludeCollection sourceFileFilters, IFileSystemHelper fileSystemHelper, string fileNamePattern = "*.cs", bool isBackupEnabled = true)
     : base(sourceFileFilters, fileSystemHelper, fileNamePattern, isBackupEnabled)
 {
     _options = CSharpFormattingProperties.GetOptions(optionsFilePath);
 }
コード例 #6
0
 public RenamePrivateFieldsRefactorRule(string find, string replace, IncludeExcludeCollection sourceFileFilters, IFileSystemHelper fileSystemHelper, string fileNamePattern = "*.cs", bool isBackupEnabled = true)
     : base(sourceFileFilters, fileSystemHelper, fileNamePattern, isBackupEnabled)
 {
     Parameter.Find    = find;
     Parameter.Replace = replace;
 }
コード例 #7
0
 public RemoveRedundantThisQualifierRule(IncludeExcludeCollection sourceFileFilters, IFileSystemHelper fileSystemHelper, string fileNamePattern = "*.cs", bool isBackupEnabled = true) : base(sourceFileFilters, fileSystemHelper, fileNamePattern, isBackupEnabled)
 {
 }