public LinuxStorageRoot(LinuxStorageProvider storageProvider, string rootPath) : base(storageProvider) { RootPath = rootPath ?? throw new ArgumentNullException(nameof(rootPath)); if (!RootPath.EndsWith("/")) { RootPath += "/"; } Uri = new Uri($"file://{(RootPath == "/" ? RootPath : RootPath.TrimEnd('/'))}"); }
public override void ViewDidLoad() { base.ViewDidLoad(); NavigationItem.Title = NavigationTitle; if (RootPath.EndsWith(Path.AltDirectorySeparatorChar)) { RootPath.Substring(0, RootPath.Length - 1); } workingPath = RootPath; RefreshControl = new UIRefreshControl(); RefreshControl.ValueChanged += RefreshDirectory; CancelButton.Clicked += (o, e) => this.ShowDiscardConfirmation(); SaveButton.Clicked += SavePath; RefreshDirectory(this, EventArgs.Empty); }
private void SetDefaultPaths() { if (string.IsNullOrEmpty(FrameworkPath) || !FrameworkPath.StartsWith(RootPath)) { FrameworkPath = RootPath; } if (string.IsNullOrEmpty(TestSuiteFile) || !TestSuiteFile.StartsWith(RootPath)) { if (string.IsNullOrEmpty(TestSuiteFile)) { TestSuiteFile = RootPath; } else if (RootPath.EndsWith(Path.PathSeparator.ToString())) { TestSuiteFile = RootPath + Path.GetFileName(TestSuiteFile); } else { TestSuiteFile = RootPath + @"\" + Path.GetFileName(TestSuiteFile); } } }
internal void RenameRootFolder(RecoveryFileState state) { if (!RecoveryFolderStructure.PathIsNetworkPath(_rootPath)) { string[] shardPath = null; shardPath = RootPath.Split(new string[] { RecoveryFolderStructure.SHARD_BACKUP_FOLDER }, StringSplitOptions.RemoveEmptyEntries); switch (state) { case RecoveryFileState.Cancelled: string destination = string.Empty; if (RootPath.EndsWith(RecoveryFolderStructure.INPROGRESS)) { string[] name = RootPath.Split(RecoveryFolderStructure.INDELIMETER, StringSplitOptions.RemoveEmptyEntries); destination = name[0] + RecoveryFolderStructure.CANCELLED; if (!Directory.Exists(destination)) { Directory.CreateDirectory(destination); } destination = RootPath.Replace(RecoveryFolderStructure.INPROGRESS, RecoveryFolderStructure.CANCELLED); Directory.Move(RootPath, destination); RootPath = destination; } break; case RecoveryFileState.Completed: string[] folderName = RootPath.Split(RecoveryFolderStructure.INDELIMETER, StringSplitOptions.RemoveEmptyEntries); destination = folderName[0] + RecoveryFolderStructure.COMPLETED; if (!Directory.Exists(destination)) { Directory.CreateDirectory(destination); } destination = RootPath.Replace(RecoveryFolderStructure.INPROGRESS, RecoveryFolderStructure.COMPLETED); Directory.Move(RootPath, destination); RootPath = destination; break; case RecoveryFileState.Failed: string[] rootName = RootPath.Split(RecoveryFolderStructure.INDELIMETER, StringSplitOptions.RemoveEmptyEntries); destination = rootName[0] + RecoveryFolderStructure.FAILED; if (!Directory.Exists(destination)) { Directory.CreateDirectory(destination); } destination = RootPath.Replace(RecoveryFolderStructure.INPROGRESS, RecoveryFolderStructure.FAILED); Directory.Move(RootPath, destination); RootPath = destination; break; } if (new DirectoryInfo(shardPath[0]).GetDirectories().Count() == 0) { Directory.Delete(shardPath[0]); } } }