public override void Do(ActionPerformerArgs actionPerformerArgs) { PanelSet panelSet = (PanelSet)actionPerformerArgs.Sender; FileSystemInfo senderInfo = panelSet.FocusedListView.SelectedItem.Item; var source = senderInfo.FullName; PopupInput popupInput = new PopupInput(panelSet, "Enter new name:"); popupInput.Render(); string newName = popupInput.UserInputResult; var destination = Path.GetDirectoryName(source) + "\\" + newName; if (senderInfo is FileInfo) { File.Move(source, destination); } else if (senderInfo is DirectoryInfo) { Directory.Move(source, destination); } panelSet.RefreshScreen(); }
public override void Do(ActionPerformerArgs actionPerformerArgs) { PanelSet panelSet = (PanelSet)actionPerformerArgs.Sender; FileSystemInfo senderInfo = panelSet.FocusedListView.Current; FileSystemInfo sourceInfo = panelSet.CurrentItemToOperateOn.Item; var action = panelSet.CurrentAction; var source = sourceInfo.FullName; var destination = senderInfo.FullName + "\\" + sourceInfo.Name; if (sourceInfo is FileInfo) { if (action == Actions.Copy) { File.Copy(source, destination); } else if (action == Actions.Cut) { File.Move(source, destination); } } else if (sourceInfo is DirectoryInfo) { if (action == Actions.Copy) { Utility.DirectoryCopy(source, destination); } else if (action == Actions.Cut) { Directory.Move(source, destination); } } if (action == Actions.Copy) { panelSet.RefreshFocusedPanel(); } else if (action == Actions.Cut) { panelSet.RefreshScreen(); } }
public override void Do(ActionPerformerArgs actionPerformerArgs) { PanelSet panelSet = (PanelSet)actionPerformerArgs.Sender; var sourceInfo = panelSet.FocusedListView.SelectedItem.Item; StringBuilder stringBuilder = new StringBuilder(); string info = String.Empty; int readOnly = ((int)(sourceInfo.Attributes) & (int)FileAttributes.ReadOnly); stringBuilder.AppendLine("Name: " + sourceInfo.Name); stringBuilder.AppendLine("Parent direcotry: " + Path.GetDirectoryName(sourceInfo.FullName)); stringBuilder.AppendLine("Root direcotry: " + Path.GetPathRoot(sourceInfo.FullName)); stringBuilder.AppendLine("Read-only: " + ((readOnly == 1) ? "true" : "false")); stringBuilder.AppendLine("Last read time: " + sourceInfo.LastAccessTime); stringBuilder.AppendLine("Last write time: " + sourceInfo.LastWriteTime); if (sourceInfo is FileInfo fileInfo) { stringBuilder.AppendLine("Size: " + Utility.BytesToStringAsNormalizedSize(fileInfo.Length)); } else if (sourceInfo is DirectoryInfo directoryInfo) { stringBuilder.AppendLine("Size: " + Utility.BytesToStringAsNormalizedSize(directoryInfo.DirectorySize())); stringBuilder.AppendLine("Files: " + Directory.GetFiles(sourceInfo.FullName).Length); stringBuilder.AppendLine("Folders: " + Directory.GetDirectories(sourceInfo.FullName).Length); } info = stringBuilder.ToString(); PopupMessage popupMessage = new PopupMessage(panelSet, info, "Properties"); popupMessage.Render(); panelSet.RefreshScreen(); }