/// <summary> /// Обработка нажатия Enter /// </summary> private void PressEnter() { _selectedRoot = _selectedDir[_itemDirIndex]; _selectedDir = FDWorker.GetDirectory(_selectedRoot); _selectedDirName = FDWorker.GetDirectoryNames(_selectedRoot); _itemDirIndex = 0; _indexController.StartIndex = 0; _indexController.EndIndex = MAX_NUMBER_FILE_NAMES; if (_selectedRoot == "") { _selectedRoot = "Discks"; } else { _selectedRoot = Directory.GetDirectoryRoot(_selectedRoot); } }
public WindowClass( ) { Console.BackgroundColor = ConsoleColor.DarkBlue; Console.Clear(); Console.WindowHeight = WINDOW_HEIGHT; Console.SetBufferSize(Console.WindowWidth, WINDOW_HEIGHT); Console.SetWindowSize(Console.WindowWidth, WINDOW_HEIGHT); _settingWorker = new SettingWorkerJson(); _appSetting = _settingWorker.ReadJsonSetting(); _selectedDir = FDWorker.GetDirectory(_appSetting.LastPath); _selectedDirName = FDWorker.GetDirectoryNames(_appSetting.LastPath); _listInfo = new List <string> { _txtInfo }; _indexController = new CountControllerInWin(); _indexController.StartIndex = 0; _indexController.EndIndex = MAX_NUMBER_FILE_NAMES; }
/// <summary> /// Обновление окна /// </summary> private void UpdateDir() { _selectedRoot = Directory.GetParent(_selectedDir[_itemDirIndex]).FullName;; _selectedDir = FDWorker.GetDirectory(_selectedRoot); _selectedDirName = FDWorker.GetDirectoryNames(_selectedRoot); _itemDirIndex = 0; _indexController.StartIndex = 0; _indexController.EndIndex = MAX_NUMBER_FILE_NAMES; if (_selectedRoot == "") { _selectedRoot = "Discks"; } else { _selectedRoot = Directory.GetDirectoryRoot(_selectedRoot); } SetStrFieldsEmpty(); }
/// <summary> /// Копирование файла/папки в два клика /// </summary> /// <param name="path"></param> private void CopyDirOrFile(string path) { _canClearInfo = false; if (_soursePath == string.Empty) { _soursePath = path; } else { string dirName = string.Empty; string copyFullDirName = string.Empty; if (!File.Exists(_soursePath)) { DirectoryInfo dir = new DirectoryInfo(_soursePath); dirName = dir.Name; } if (File.Exists(path)) { copyFullDirName = Path.GetDirectoryName(path) + "\\" + dirName; _destPath = copyFullDirName; } else { copyFullDirName = path + "\\" + dirName; _destPath = copyFullDirName; } } _listInfo.Add($"Копировать {_soursePath} в ... *Еще раз F3 для копировать в директорию*"); if (_soursePath != string.Empty && _destPath != string.Empty) { FDWorker.CopyFileOrDirectory(_soursePath, _destPath); UpdateDir(); _canClearInfo = true; } }
/// <summary> /// Удаление файла/папки /// </summary> private void DeleteFileOrDir() { SetStrFieldsEmpty(); FDWorker.DeleteFileOrDirectory(_selectedDir[_itemDirIndex]); UpdateDir(); }
/// <summary> /// Информация о папке/файле /// </summary> private void GetInfoFileOrDir() { _listInfo.AddRange(FDWorker.InfoFileOrDirectory(_selectedDir[_itemDirIndex])); }