Esempio n. 1
0
        public MountTests(FileSystemServices fsServices)
        {
            var serviceScopeFactory = fsServices.ServiceProvider.GetRequiredService <IServiceScopeFactory>();

            _serviceScope = serviceScopeFactory.CreateScope();
            FileSystem    = _serviceScope.ServiceProvider.GetRequiredService <IFileSystem>();
        }
Esempio n. 2
0
 public void SetGitInfo(string rootRepositoryPath)
 {
     IsGitRepo = FileSystemServices.IsDirectoryWithGitRepository(rootRepositoryPath);
     if (IsGitRepo)
     {
         SetRepository(rootRepositoryPath);
     }
 }
Esempio n. 3
0
        public void LoadRepository()
        {
            EditorVM.SelectedFile    = null;
            EditorVM.SelectedCsvFile = null;

            EditorVM.RootRepositoryPath = FileSystemServices.QueryUserForRootRepositoryPath(Constants.SELECT_PROJECT_ROOT_DIRECTORY);

            EditorVM.GitVM.SetGitInfo(EditorVM.RootRepositoryPath);

            EditorVM.CsvFilesStructure.Clear();

            new LoadDirectoriesWithCsvWorker(EditorVM).RunAsync(EditorVM.RootRepositoryPath);
        }
        protected override void _DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = (BackgroundWorker)sender;

            VM.AsyncVM.WorkingStatus = WorkStatus.Working;

            worker.ReportProgress(VM.AsyncVM.WorkProgress + 100); // +100 to always trigger change for progress value >=100
            var path = e.Argument as string;

            var directories = new List <string> {
                path
            };
            var foundDirectories = FileSystemServices.GetDirectoriesFromRootPath(path, worker);

            if (worker.CancellationPending == true || foundDirectories == null)
            {
                e.Cancel = true;
                return;
            }

            directories = directories.Concat(foundDirectories).ToList();

            Console.WriteLine($"BW finished loading directories. Directories found: {directories.Count}");

            worker.ReportProgress(25);

            double progressStep    = (100d / (double)directories.Count);
            double currentProgress = 0;

            directories.ForEach(directory =>
            {
                if (worker.CancellationPending == true)
                {
                    e.Cancel = true;
                    return;
                }
                else
                {
                    currentProgress          += progressStep;
                    var foundDirectoryWithCsv = FileSystemServices.ScanDirectory(path, directory);
                    if (foundDirectoryWithCsv != null)
                    {
                        worker.ReportProgress((int)currentProgress, foundDirectoryWithCsv);
                    }
                    else
                    {
                        worker.ReportProgress((int)currentProgress);
                    }
                }
            });
        }