private async Task <bool> _commandPwdAsync() { if (!HomePath.NullEmpty()) { return(true); } storeResponse = true; if (await executeCommandAsync("PWD") == 257) { try { string path = tmpResponsed.Split('"')[1].Trim(); tmpResponsed = null; if (!path.NullEmpty()) { PathHelper.AddEndningSlash(ref path); BrowsedPath = HomePath = path; return(true); } } catch (Exception exp) { ExceptionHelper.Log(exp); } } return(false); }
private async void ButtonNewFolder_Click(object sender, RoutedEventArgs e) { TreeSmartItem sItem = TreeViewFolders.SelectedItem as TreeSmartItem; if ((sItem == null) || sItem.HasError) { return; } NewFolderWindow NFW = new NewFolderWindow(this, false); if (!(bool)NFW.ShowDialog() || NFW.newFolder.NullEmpty()) { return; } //item.Expanded = true; TreeSmartItem item; if (sItem.Parent != null) { item = sItem.Parent; } else { item = sItem; } if (item.HasDummy) { item.Items.Clear(); item.HasDummy = false; } string path = item.FullName; PathHelper.AddEndningSlash(ref path); TreeSmartItem folder = new TreeSmartItem(NFW.newFolder, path); item.Items.Add(folder); folder.OptColor = SolidColors.DarkGreen; folder.Operation = AppLanguage.Get("LangOperationCreating"); if (await ClientHelper.NewFolder(NFW.newFolder, path)) { folder.Selected = true; folder.OptColor = SolidColors.SolidBlue; folder.Operation = AppLanguage.Get("LangOperationCreated"); } else { folder.Items.Clear(); folder.HasError = true; folder.OptColor = SolidColors.DarkRed; folder.Operation = AppLanguage.Get("LangOperationCreateError"); folder.Items.Add(new TreeSmartItem(AppLanguage.Get("LangTextNoFoldersInside"), dummyIcon)); } }
internal override async Task <SmartItem[]> GetServerFoldersAsync(string path) { PathHelper.AddEndningSlash(ref path); int code = (IsMLSD) ? await commandMlsdAsync(path) : await commandListAsync(path); if ((code == 150) || (code == 125) || (code == 226)) { return(await this.ParseFoldersAsync(path, await receiveDataAsync(code != 226))); } else if (await retryAsync()) { return(await GetServerFoldersAsync(path)); } return(null); }
protected override async Task <SmartItem[]> getServerItemsAsync(string path, bool setCurrentPath = false) { PathHelper.AddEndningSlash(ref path); int code = (IsMLSD) ? await commandMlsdAsync(path) : await commandListAsync(path); if ((code == 150) || (code == 125) || (code == 226)) { if (setCurrentPath) { BrowsedPath = path; } return(await this.ParseAsync(path, await receiveDataAsync(code != 226))); } else if (await retryAsync()) { return(await getServerItemsAsync(path, setCurrentPath)); } return(null); }
private void ButtonSelect_Click(object sender, RoutedEventArgs e) { TreeSmartItem sItem = TreeViewFolders.SelectedItem as TreeSmartItem; if ((sItem == null) || sItem.HasError) { return; } TreeSmartItem item; if (sItem.Parent != null) { item = sItem.Parent; } else { item = sItem; } string toPath = item.FullName; PathHelper.AddEndningSlash(ref toPath); if (MessageWindow.Show(this, AppLanguage.Get("LangMBMove").FormatC(System.Environment.NewLine + toPath), AppLanguage.Get("LangMBMoveTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) != MessageBoxResult.Yes) { return; } ClientHelper.MoveAsync(selectedItems, toPath); this.Close(); }