public void Execute(FileSystemVirtualizer fileSystemVirtualizer) { this.enlistment = Enlistment.LoadExistingEnlistment(this.EnlistmentRoot); if (this.enlistment == null) { Console.WriteLine("Error: Unable to load enlistment"); return; } Console.WriteLine(); Console.WriteLine($"Mounting {Path.GetFullPath(this.enlistment.EnlistmentRoot)}"); if (fileSystemVirtualizer.TryStartVirtualizationInstance(this.enlistment, out string error)) { Console.WriteLine("Virtualization instance started successfully"); Console.WriteLine("Press Enter to end the instance"); Console.ReadLine(); } else { Console.WriteLine("Virtualization instance failed to start: " + error); return; } fileSystemVirtualizer.Stop(); }
public void Execute(FileSystemVirtualizer fileSystemVirtualizer) { Console.WriteLine($"Cloning from {Path.GetFullPath(this.PathToMirror)} to {Path.GetFullPath(this.EnlistmentRoot)}"); if (Directory.Exists(this.EnlistmentRoot)) { Console.WriteLine($"Error: Directory {this.EnlistmentRoot} already exists"); return; } Enlistment enlistment = Enlistment.CreateNewEnlistment(this.EnlistmentRoot, this.PathToMirror); if (enlistment == null) { Console.WriteLine("Error: Unable to create enlistment"); return; } if (fileSystemVirtualizer.TryConvertVirtualizationRoot(enlistment.SrcRoot, out string error)) { Console.WriteLine($"Virtualization root created successfully at {enlistment.SrcRoot}"); } else { Console.WriteLine("Error: Failed to create virtualization root: " + error); } }
public static void Run(string[] args, FileSystemVirtualizer fileSystemVirtualizer) { new Parser( settings => { settings.CaseSensitive = false; settings.EnableDashDash = true; settings.IgnoreUnknownArguments = false; settings.HelpWriter = Console.Error; }) .ParseArguments(args, typeof(CloneVerb), typeof(MountVerb)) .WithNotParsed( errors => { if (errors.Any(error => error is TokenError)) { Environment.Exit(1); } }) .WithParsed <CloneVerb>(clone => clone.Execute(fileSystemVirtualizer)) .WithParsed <MountVerb>(mount => mount.Execute(fileSystemVirtualizer)); }