コード例 #1
0
            public static ManifestIndex FromFile(string manifestPath, string root)
            {
                ManifestIndex index = new ManifestIndex();

                foreach (string line in File.ReadAllLines(manifestPath))
                {
                    index.IndexLine(line);
                }

                return(index);
            }
コード例 #2
0
        private static List <Descriptor> CollectForDeletion(string manifest, string root)
        {
            ManifestIndex     index    = ManifestIndex.FromFile(manifest, root);
            List <Descriptor> toDelete = new List <Descriptor> ();

            foreach (string topLevel in index.TopLevel)
            {
                toDelete.AddRange(CollectForDeletion(root + topLevel, index));
            }

            return(toDelete);
        }
コード例 #3
0
        // Collects a list of files and directories that need to be deleted
        private static List <Descriptor> CollectForDeletion(string path, ManifestIndex index)
        {
            List <Descriptor> toDelete  = new List <Descriptor> ();
            DirectoryInfo     directory = new DirectoryInfo(path);

            foreach (FileInfo file in directory.GetFiles())
            {
                HandleFile(file, index, ref toDelete);
            }

            foreach (string dir in Directory.GetDirectories(path))
            {
                HandleDirectory(FileUtils.NormalizePathForPlatform(dir), index, ref toDelete);
            }

            return(toDelete);
        }
コード例 #4
0
        private static void HandleDirectory(string directory, ManifestIndex index, ref List <Descriptor> toDelete)
        {
            if (index.Ignored(directory))
            {
                Utils.Log("Ignoring {0}", directory);
                return;
            }

            if (!index.Kept(directory))
            {
                toDelete.Add(new Descriptor {
                    Path = directory,
                    Type = Descriptor.FileType.Directory
                });
            }

            toDelete.AddRange(CollectForDeletion(directory, index));
        }
コード例 #5
0
        private static void HandleFile(FileInfo file, ManifestIndex index, ref List <Descriptor> toDelete)
        {
            string absolute = FileUtils.NormalizePathForPlatform(file.FullName);

            if (index.Ignored(absolute))
            {
                Utils.Log("Ignoring {0}", absolute);
                return;
            }

            if (IsHidden(file))
            {
                return;
            }

            if (!index.Kept(absolute))
            {
                toDelete.Add(new Descriptor {
                    Path = absolute,
                    Type = Descriptor.FileType.File
                });
            }
        }
コード例 #6
0
		// Collects a list of files and directories that need to be deleted
		private static List<Descriptor> CollectForDeletion(string path, ManifestIndex index)
		{
			List<Descriptor> toDelete = new List<Descriptor> ();
			DirectoryInfo directory = new DirectoryInfo (path);
			
			foreach (FileInfo file in directory.GetFiles ()) {
				HandleFile (file, index, ref toDelete);
			}
			
			foreach (string dir in Directory.GetDirectories (path)) {
				HandleDirectory (FileUtils.NormalizePathForPlatform (dir), index, ref toDelete);
			}
			
			return toDelete;
		}
コード例 #7
0
		private static void HandleDirectory(string directory, ManifestIndex index, ref List<Descriptor> toDelete)
		{
			if (index.Ignored (directory)) {
				Utils.Log ("Ignoring {0}", directory);
				return;
			}

			if (!index.Kept (directory)) {
				toDelete.Add (new Descriptor {
					Path = directory,
					Type = Descriptor.FileType.Directory
				});
			}

			toDelete.AddRange (CollectForDeletion (directory, index));
		}
コード例 #8
0
		private static void HandleFile(FileInfo file, ManifestIndex index, ref List<Descriptor> toDelete)
		{
			string absolute = FileUtils.NormalizePathForPlatform (file.FullName);

			if (index.Ignored (absolute)) {
				Utils.Log ("Ignoring {0}", absolute);
				return;
			}

			if (IsHidden (file)) {
				return;
			}

			if (!index.Kept (absolute)) {
				toDelete.Add (new Descriptor {
					Path = absolute,
					Type = Descriptor.FileType.File
				});
			}
		}
コード例 #9
0
			public static ManifestIndex FromFile(string manifestPath, string root)
			{
				ManifestIndex index = new ManifestIndex ();
				
				foreach (string line in File.ReadAllLines (manifestPath)) {
					index.IndexLine (line);
				}
				
				return index;
			}