Example #1
0
 /// <summary>
 /// Instantiates a <c>BuilderVisitor</c> object.
 /// </summary>
 /// <param name="filter">The list of filters to pass in.</param>
 /// <param name="typeConflicts">A list to keep track of invalid type conflicts.</param>
 /// <param name="progress">A progress object to keep track of the progress.</param>
 public BuilderVisitor(List<Filter> filter, List<string> typeConflicts, Progress progress)
 {
     _filter = filter;
     _filterChain = new FilterChain();
     _typeConflicts = typeConflicts;
     _progress = progress;
 }
Example #2
0
 private MonitorLayer()
 {
     watchers = new List<ExtendedFileSystemWatcher>();
     monitoredPaths = new List<string>();
     rootWatchers = new List<FileSystemWatcher>();
     rootsAndParent = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
     filtering = new FilterChain();
     filterList = new List<Filter>();
     filterList.Add(FilterFactory.CreateArchiveFilter(SyncConfig.Instance.ArchiveName)); // filter of syncless archive folder
     filterList.Add(FilterFactory.CreateArchiveFilter(SyncConfig.Instance.ConflictDir)); // filter of syncless conflict folder
 }
Example #3
0
        /// <summary>
        /// Find the similar path for a particular file/folder.
        /// </summary>
        /// <param name="filePath">The path to search</param>
        /// <returns>The list of similar paths</returns>
        private List<string> FindSimilarSeamlessPathForFile(string filePath)
        {
            /* 2 path is consider similiar in the following case.
             *  i.e Folder A is tagged to Folder B.
             *   FolderA/1.txt is considered similiar to FolderB/1.txt
             *   
             * This is use to find similiar when a file change is detected during seamless mode.
             * 
             */

            //Convert the path to logical path
            string logicalid = TaggingHelper.GetLogicalID(filePath);

            List<string> pathList = new List<string>();
            // Get a list of that tag that contain the logical id.
            List<Tag> matchingTag = TaggingLayer.Instance.RetrieveTagByLogicalId(logicalid);
            FilterChain chain = new FilterChain();
            // Only find the tag if the tag is seamless mode.
            foreach (Tag tag in matchingTag)
            {
                if (!tag.IsSeamless)
                {
                    continue;
                }
                //Create the default filter 
                List<Filter> tempFilters = new List<Filter>
                                               {
                                                   FilterFactory.CreateArchiveFilter("_synclessArchive"),
                                                   FilterFactory.CreateConfigurationFilter()
                                               };
                tempFilters.AddRange(tag.Filters);

                string appendedPath;
                string trailingPath = tag.CreateTrailingPath(filePath);
                if (trailingPath != null)
                {
                    foreach (TaggedPath p in tag.FilteredPathList)
                    {
                        appendedPath = PathHelper.RemoveTrailingSlash((p.Append(trailingPath)));
                        if (!pathList.Contains(appendedPath) && !appendedPath.Equals(filePath))
                        {
                            string physicalAddress = ProfilingLayer.Instance.ConvertLogicalToPhysical(appendedPath);
                            if (physicalAddress != null && chain.ApplyFilter(tempFilters, physicalAddress))
                                pathList.Add(PathHelper.RemoveTrailingSlash(physicalAddress));
                        }
                    }
                }
            }


            return pathList;
        }