Example #1
0
        public ReactiveFile BuildFileTree(string path)
        {
            ReactiveFile file = null;

            if (Directory.Exists(path))
            {
                file = new ReactiveFile
                {
                    Path        = new DirectoryInfo(path).FullName,
                    Name        = new DirectoryInfo(path).Name,
                    IsDirectory = true,
                    Files       = new ReactiveFileCollection()
                };

                var dirs = Directory.EnumerateDirectories(path);

                foreach (var child in dirs)
                {
                    file.Files.Add(BuildFileTree(child));
                }

                var groups = Directory.EnumerateFiles(path)
                             .Where(f => f.EndsWith(".env") || f.EndsWith(".req"))
                             .GroupBy(GetGroupingFilename)
                             .OrderBy(g => g.Key);

                foreach (var group in groups)
                {
                    var files = group.OrderBy(f => f.Length).ToArray();

                    var file1 = BuildFileTree(files[0]);

                    if (files.Length > 1)
                    {
                        var file2 = BuildFileTree(files[1]);

                        file1.Files = new ReactiveFileCollection();
                        file1.Files.Add(file2);
                    }

                    file.Files.Add(file1);
                }
            }
            else if (File.Exists(path))
            {
                file = new ReactiveFile
                {
                    Path = new FileInfo(path).FullName,
                    Name = new FileInfo(path).Name
                };
            }

            return(file);
        }
Example #2
0
 void ObserveFileSelection(ReactiveFile file)
 {
     navigator.Select(file);
 }
Example #3
0
 void ObserveOpening(ReactiveFile file)
 {
     RootFiles = new ReactiveFileCollection();
     RootFiles.Add(file);
 }
Example #4
0
        public Task Open(ReactiveFile file)
        {
            Opened?.Invoke(this, file);

            return(Task.CompletedTask);
        }
Example #5
0
        public Task Select(ReactiveFile file)
        {
            Selected?.Invoke(this, file);

            return(Task.CompletedTask);
        }