public static void CreateSnapshot(CreateOptions o) { var(parent, blobs) = FileFetcher.FindBlobs( o.Files, new Fuzzy( o.ExcludePatterns, FuzzyOption.EmptyMatchesNothing)); if (blobs.Length == 0) { Console.WriteLine("Empty file list. Nothing to do!"); return; } var snapshotStore = CreateSnapshotStore(o.Repository); snapshotStore.StoreSnapshot( blobs, new Fuzzy( o.ScanPatterns, FuzzyOption.EmptyMatchesNothing), DateTime.UtcNow, blobName => File.OpenRead( Path.Combine(parent, blobName))); }
public static void PreviewSnapshot(PreviewOptions o) { var(_, blobs) = FileFetcher.FindBlobs( o.Files, new Fuzzy( o.ExcludePatterns, FuzzyOption.EmptyMatchesNothing)); if (blobs.Length == 0) { Console.WriteLine("Empty file list. Nothing to do!"); return; } var snapshotStore = CreateSnapshotStore(o.Repository); var snapshotBlobs = snapshotStore.IsEmpty ? Array.Empty <Blob>() : snapshotStore.ShowSnapshot( o.SnapshotId, Fuzzy.MatchAll) .Select(blobReference => blobReference.ToBlob()) .ToArray(); var diff = DiffSet.Create( snapshotBlobs, blobs, blob => blob.Name, (b1, b2) => b1.Equals(b2)); PrintDiff(diff); }
public void CanReadTextFilesInSearchableDirectory() { var fileFetcher = new FileFetcher(new[] { AppDomain.CurrentDomain.BaseDirectory }); var str = fileFetcher.GetText(@"\data\small.txt"); Assert.AreEqual("hi buddy", str); }
public void CanReadTextFilesRelitiveToBaseDirector() { var fileFetcher = new FileFetcher(); var str = fileFetcher.GetText(@"~\data\small.txt"); Assert.AreEqual("hi buddy", str); }
public void CanReadTextFiles() { var fileFetcher = new FileFetcher(); var str = fileFetcher.GetText(@"\data\small.txt"); Assert.AreEqual("hi buddy", str); }
public void CanReadTextFilesDirectly() { var fileFetcher = new FileFetcher(); var str = fileFetcher.GetText(AppDomain.CurrentDomain.BaseDirectory + @"\data\small.txt"); Assert.AreEqual("hi buddy", str); }
public static void ShutdownApplication() { ShutdownWindows(); Main.Closing -= WindowClosing; Help.Closing -= WindowClosing; FileFetcher.ForceStop(); IconFetcher.ForceStop(); Application.Shutdown(); }
public ExplorerViewModel() { Files = new ObservableCollection <FileViewModel>(); Navigator = new FileNavigationViewModel(); Navigator.Explorer = this; FileFetcher.Initialise(); IconFetcher.Initialise(); FileFetcher.DirectoryFetchedCallback = OnDirectoryFetched; FileFetcher.FileFetchedCallback = OnFileFetched; FileFetcher.DirectoriesFetchedCallback = FoundDirectories; FileFetcher.FilesFetchedCallback = FoundFiles; }
public void Dispose() { FileFetcher.CancelDownload(); lock (machLock) { PauseAll(); Array.ForEach(machs.Rights, x => x.Dispose()); machs.Clear(); MasterTimeSource.Dispose(); ExternalsManager.Clear(); HostMachine.Dispose(); CurrentLogger.Dispose(); BackendManager.Dispose(); } }
public void Dispose() { FileFetcher.CancelDownload(); lock (machLock) { var toDispose = machs.Rights.ToArray(); //Although a single machine does not have to be paused before its disposal, //disposing multiple entities has to ensure that all are stopped. ExternalsManager.Pause(); Array.ForEach(toDispose, x => x.Pause()); Array.ForEach(toDispose, x => x.Dispose()); machs.Clear(); ExternalsManager.Clear(); HostMachine.Dispose(); CurrentLogger.Dispose(); } }
static void Main(string[] args) { try { Parser.Default.ParseArguments <Options>(args).WithParsed(options => { Console.WriteLine($"\nRunning with following configuration. Category: {options.Category}, Directory: {options.Directory}\n"); string filename = options.Directory.Split('\\').Last(); (HashSet <string> extensions, string[] titles, Func <string, IExcelSerializer> map) = Profile.GetProfile(options.Category); IExcelSerializer[] data = FileFetcher.GetFiles(options.Directory, extensions) .SelectSkipExceptions(map) .ToArray(); ExcelWriter.WriteToExcelFile(filename, titles, data); Console.WriteLine($"\nFile Saved: {Path.Combine(options.Directory, filename)}\n"); }); } catch (Exception exception) { Console.WriteLine($"Program encountered an error: ${exception}. Please report the error on Github: https://github.com/anikait1/MusicExcelOrganizer/"); } }
public void NavigateToDirectory(string directoryPath) { FileFetcher.StopFetching(); Files.Clear(); FileFetcher.StartFetching(directoryPath); }
public void FileNotFound() { var fileFetcher = new FileFetcher(); Assert.Throws<FileNotFoundException>(() => fileFetcher.GetText(@"\does-not-exist.txt")); }
static void Main(string[] args) { FileFetcher.GatherData(); Console.ReadLine(); }