public static IEnumerable <Action> GetStartMenuActions() { var factory = new FileActionFactory(); return (new[] { Find.AllFiles(new LPath(AllUsersStartMenu)), Find.AllFiles(Sidi.IO.Paths.GetFolderPath(Environment.SpecialFolder.StartMenu)), Find.AllFiles(Sidi.IO.Paths.GetFolderPath(Environment.SpecialFolder.MyDocuments).CatDir("My RoboForm Data")) .Where(_ => !_.FullName.Parts.Contains("obsolete")) } .SelectMany(_ => _) .Where(x => x.Exists) .Select(_ => factory.FromFile(_))); }
void Flatten(Operation op, LPath directory) { if (!directory.IsDirectory) { return; } var files = Find.AllFiles(directory) .Select(x => x.FullName).ToList(); foreach (var source in files) { var destination = GetNonExistingPath(directory.CatDir(source.FileName)); source.Move(destination); } op.DeleteEmptyDirectories(directory); }