1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2025-12-06 00:13:33 +00:00
This commit is contained in:
adnan29979
2024-07-11 14:53:17 +06:00
committed by GitHub

View File

@@ -46,6 +46,7 @@ namespace MeshCentralRouter
private FileDialogMsgForm msgForm = null; private FileDialogMsgForm msgForm = null;
private bool localSortAscending = true; private bool localSortAscending = true;
private bool remoteSortAscending = true; private bool remoteSortAscending = true;
private const int DirectoryNameCharacterLimit = 10;
// Stats // Stats
public long bytesIn = 0; public long bytesIn = 0;
@@ -118,7 +119,9 @@ namespace MeshCentralRouter
string[] parts = localFolder.FullName.Split(Path.DirectorySeparatorChar); string[] parts = localFolder.FullName.Split(Path.DirectorySeparatorChar);
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
ToolStripButton dirButton = new ToolStripButton(parts[i]); string displayText = parts[i].Length > DirectoryNameCharacterLimit ?
parts[i].Substring(0, DirectoryNameCharacterLimit) + "..." : parts[i];
ToolStripButton dirButton = new ToolStripButton(displayText);
int index = i; // Local copy for the lambda int index = i; // Local copy for the lambda
dirButton.Click += (sender, e) => LocalPathButtonClicked(parts.Take(index + 1).ToArray()); dirButton.Click += (sender, e) => LocalPathButtonClicked(parts.Take(index + 1).ToArray());
localDirectoryPath.Items.Add(dirButton); localDirectoryPath.Items.Add(dirButton);
@@ -145,7 +148,9 @@ namespace MeshCentralRouter
string[] parts = remoteFolder.Split(new char[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries); string[] parts = remoteFolder.Split(new char[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
ToolStripButton dirButton = new ToolStripButton(parts[i]); string displayText = parts[i].Length > DirectoryNameCharacterLimit ?
parts[i].Substring(0, DirectoryNameCharacterLimit) + "..." : parts[i];
ToolStripButton dirButton = new ToolStripButton(displayText);
int index = i; // Local copy for the lambda int index = i; // Local copy for the lambda
dirButton.Click += (sender, e) => RemotePathButtonClicked(parts.Take(index + 1).ToArray()); dirButton.Click += (sender, e) => RemotePathButtonClicked(parts.Take(index + 1).ToArray());
remoteDirectoryPath.Items.Add(dirButton); remoteDirectoryPath.Items.Add(dirButton);
@@ -158,7 +163,6 @@ namespace MeshCentralRouter
} }
} }
private void LocalPathButtonClicked(string[] parts) private void LocalPathButtonClicked(string[] parts)
{ {
string path = string.Join(Path.DirectorySeparatorChar.ToString(), parts); string path = string.Join(Path.DirectorySeparatorChar.ToString(), parts);
@@ -181,7 +185,6 @@ namespace MeshCentralRouter
requestRemoteFolder(path); // This will also call UpdateRemotePathDisplay requestRemoteFolder(path); // This will also call UpdateRemotePathDisplay
} }
private void LeftListView_ColumnClick(object sender, ColumnClickEventArgs e) private void LeftListView_ColumnClick(object sender, ColumnClickEventArgs e)
{ {
if (localFolder == null) return; if (localFolder == null) return;