mirror of https://github.com/quasar/Quasar.git
Improved File Manager
This commit is contained in:
parent
3b53a5c799
commit
473ec94532
|
@ -120,7 +120,7 @@ namespace xClient.Core.Commands
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
new Packets.ClientPackets.DoDownloadFileResponse(command.ID, "", new byte[0], -1, -1, ex.Message)
|
new Packets.ClientPackets.DoDownloadFileResponse(command.ID, Path.GetFileName(command.RemotePath), new byte[0], -1, -1, ex.Message)
|
||||||
.Execute(client);
|
.Execute(client);
|
||||||
}
|
}
|
||||||
_limitThreads.Release();
|
_limitThreads.Release();
|
||||||
|
@ -132,7 +132,6 @@ namespace xClient.Core.Commands
|
||||||
if (!_canceledDownloads.ContainsKey(command.ID))
|
if (!_canceledDownloads.ContainsKey(command.ID))
|
||||||
{
|
{
|
||||||
_canceledDownloads.Add(command.ID, "canceled");
|
_canceledDownloads.Add(command.ID, "canceled");
|
||||||
new Packets.ClientPackets.DoDownloadFileResponse(command.ID, "", new byte[0], -1, -1, "Canceled").Execute(client);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,7 @@ namespace xServer.Core.Commands
|
||||||
client.Value.ProcessingDirectory = true;
|
client.Value.ProcessingDirectory = true;
|
||||||
|
|
||||||
client.Value.FrmFm.ClearFileBrowser();
|
client.Value.FrmFm.ClearFileBrowser();
|
||||||
|
client.Value.FrmFm.AddItemToFileBrowser("..", "", PathType.Back, 0);
|
||||||
ListViewItem lviBack = new ListViewItem(new string[] { "..", "", "" })
|
|
||||||
{
|
|
||||||
Tag = PathType.Back,
|
|
||||||
ImageIndex = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Value.FrmFm.AddItemToFileBrowser(lviBack);
|
|
||||||
|
|
||||||
if (packet.Folders != null && packet.Folders.Length != 0 && client.Value.ProcessingDirectory)
|
if (packet.Folders != null && packet.Folders.Length != 0 && client.Value.ProcessingDirectory)
|
||||||
{
|
{
|
||||||
|
@ -61,16 +54,10 @@ namespace xServer.Core.Commands
|
||||||
{
|
{
|
||||||
if (packet.Folders[i] != DELIMITER)
|
if (packet.Folders[i] != DELIMITER)
|
||||||
{
|
{
|
||||||
ListViewItem lvi = new ListViewItem(new string[] { packet.Folders[i], "", PathType.Directory.ToString() })
|
|
||||||
{
|
|
||||||
Tag = PathType.Directory,
|
|
||||||
ImageIndex = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
if (client.Value == null || client.Value.FrmFm == null || !client.Value.ProcessingDirectory)
|
if (client.Value == null || client.Value.FrmFm == null || !client.Value.ProcessingDirectory)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
client.Value.FrmFm.AddItemToFileBrowser(lvi);
|
client.Value.FrmFm.AddItemToFileBrowser(packet.Folders[i], "", PathType.Directory, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,17 +68,12 @@ namespace xServer.Core.Commands
|
||||||
{
|
{
|
||||||
if (packet.Files[i] != DELIMITER)
|
if (packet.Files[i] != DELIMITER)
|
||||||
{
|
{
|
||||||
ListViewItem lvi =
|
|
||||||
new ListViewItem(new string[] { packet.Files[i], FileHelper.GetDataSize(packet.FilesSize[i]), PathType.File.ToString() })
|
|
||||||
{
|
|
||||||
Tag = PathType.File,
|
|
||||||
ImageIndex = FileHelper.GetFileIcon(Path.GetExtension(packet.Files[i]))
|
|
||||||
};
|
|
||||||
|
|
||||||
if (client.Value == null || client.Value.FrmFm == null || !client.Value.ProcessingDirectory)
|
if (client.Value == null || client.Value.FrmFm == null || !client.Value.ProcessingDirectory)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
client.Value.FrmFm.AddItemToFileBrowser(lvi);
|
client.Value.FrmFm.AddItemToFileBrowser(packet.Files[i],
|
||||||
|
FileHelper.GetDataSize(packet.FilesSize[i]), PathType.File,
|
||||||
|
FileHelper.GetFileIcon(Path.GetExtension(packet.Files[i])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace xServer.Forms
|
||||||
this.stripLblStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
this.stripLblStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.contextMenuStripTransfers = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.contextMenuStripTransfers = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.cancelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.cancelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.imgListTransfers = new System.Windows.Forms.ImageList(this.components);
|
this.imgListTransfers = new System.Windows.Forms.ImageList(this.components);
|
||||||
this.TabControlFileManager = new xServer.Controls.DotNetBarTabControl();
|
this.TabControlFileManager = new xServer.Controls.DotNetBarTabControl();
|
||||||
this.tabFileExplorer = new System.Windows.Forms.TabPage();
|
this.tabFileExplorer = new System.Windows.Forms.TabPage();
|
||||||
|
@ -66,8 +66,10 @@ namespace xServer.Forms
|
||||||
this.btnOpenDLFolder = new System.Windows.Forms.Button();
|
this.btnOpenDLFolder = new System.Windows.Forms.Button();
|
||||||
this.lstTransfers = new xServer.Controls.AeroListView();
|
this.lstTransfers = new xServer.Controls.AeroListView();
|
||||||
this.hID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.hID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
|
this.hTransferType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.hStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.hStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.hFilename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.hFilename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
|
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.contextMenuStripDirectory.SuspendLayout();
|
this.contextMenuStripDirectory.SuspendLayout();
|
||||||
this.statusStrip.SuspendLayout();
|
this.statusStrip.SuspendLayout();
|
||||||
this.contextMenuStripTransfers.SuspendLayout();
|
this.contextMenuStripTransfers.SuspendLayout();
|
||||||
|
@ -91,7 +93,7 @@ namespace xServer.Forms
|
||||||
this.refreshToolStripMenuItem,
|
this.refreshToolStripMenuItem,
|
||||||
this.openDirectoryInShellToolStripMenuItem});
|
this.openDirectoryInShellToolStripMenuItem});
|
||||||
this.contextMenuStripDirectory.Name = "ctxtMenu";
|
this.contextMenuStripDirectory.Name = "ctxtMenu";
|
||||||
this.contextMenuStripDirectory.Size = new System.Drawing.Size(240, 220);
|
this.contextMenuStripDirectory.Size = new System.Drawing.Size(240, 198);
|
||||||
//
|
//
|
||||||
// downloadToolStripMenuItem
|
// downloadToolStripMenuItem
|
||||||
//
|
//
|
||||||
|
@ -208,25 +210,26 @@ namespace xServer.Forms
|
||||||
//
|
//
|
||||||
this.contextMenuStripTransfers.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.contextMenuStripTransfers.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.cancelToolStripMenuItem,
|
this.cancelToolStripMenuItem,
|
||||||
this.removeToolStripMenuItem});
|
this.toolStripMenuItem1,
|
||||||
|
this.clearToolStripMenuItem});
|
||||||
this.contextMenuStripTransfers.Name = "ctxtMenu2";
|
this.contextMenuStripTransfers.Name = "ctxtMenu2";
|
||||||
this.contextMenuStripTransfers.Size = new System.Drawing.Size(118, 48);
|
this.contextMenuStripTransfers.Size = new System.Drawing.Size(150, 54);
|
||||||
//
|
//
|
||||||
// cancelToolStripMenuItem
|
// cancelToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.cancelToolStripMenuItem.Image = global::xServer.Properties.Resources.cancel;
|
this.cancelToolStripMenuItem.Image = global::xServer.Properties.Resources.cancel;
|
||||||
this.cancelToolStripMenuItem.Name = "cancelToolStripMenuItem";
|
this.cancelToolStripMenuItem.Name = "cancelToolStripMenuItem";
|
||||||
this.cancelToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
this.cancelToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||||
this.cancelToolStripMenuItem.Text = "Cancel";
|
this.cancelToolStripMenuItem.Text = "Cancel";
|
||||||
this.cancelToolStripMenuItem.Click += new System.EventHandler(this.cancelToolStripMenuItem_Click);
|
this.cancelToolStripMenuItem.Click += new System.EventHandler(this.cancelToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// removeToolStripMenuItem
|
// clearToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.removeToolStripMenuItem.Image = global::xServer.Properties.Resources.delete;
|
this.clearToolStripMenuItem.Image = global::xServer.Properties.Resources.broom;
|
||||||
this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
|
this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
|
||||||
this.removeToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
this.clearToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||||
this.removeToolStripMenuItem.Text = "Remove";
|
this.clearToolStripMenuItem.Text = "Clear transfers";
|
||||||
this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click);
|
this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// imgListTransfers
|
// imgListTransfers
|
||||||
//
|
//
|
||||||
|
@ -387,6 +390,7 @@ namespace xServer.Forms
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.lstTransfers.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
this.lstTransfers.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||||
this.hID,
|
this.hID,
|
||||||
|
this.hTransferType,
|
||||||
this.hStatus,
|
this.hStatus,
|
||||||
this.hFilename});
|
this.hFilename});
|
||||||
this.lstTransfers.ContextMenuStrip = this.contextMenuStripTransfers;
|
this.lstTransfers.ContextMenuStrip = this.contextMenuStripTransfers;
|
||||||
|
@ -405,15 +409,25 @@ namespace xServer.Forms
|
||||||
this.hID.Text = "ID";
|
this.hID.Text = "ID";
|
||||||
this.hID.Width = 128;
|
this.hID.Width = 128;
|
||||||
//
|
//
|
||||||
|
// hTransferType
|
||||||
|
//
|
||||||
|
this.hTransferType.Text = "Transfer Type";
|
||||||
|
this.hTransferType.Width = 93;
|
||||||
|
//
|
||||||
// hStatus
|
// hStatus
|
||||||
//
|
//
|
||||||
this.hStatus.Text = "Status";
|
this.hStatus.Text = "Status";
|
||||||
this.hStatus.Width = 201;
|
this.hStatus.Width = 173;
|
||||||
//
|
//
|
||||||
// hFilename
|
// hFilename
|
||||||
//
|
//
|
||||||
this.hFilename.Text = "Filename";
|
this.hFilename.Text = "Filename";
|
||||||
this.hFilename.Width = 337;
|
this.hFilename.Width = 289;
|
||||||
|
//
|
||||||
|
// toolStripMenuItem1
|
||||||
|
//
|
||||||
|
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||||
|
this.toolStripMenuItem1.Size = new System.Drawing.Size(146, 6);
|
||||||
//
|
//
|
||||||
// FrmFileManager
|
// FrmFileManager
|
||||||
//
|
//
|
||||||
|
@ -477,11 +491,13 @@ namespace xServer.Forms
|
||||||
private AeroListView lstDirectory;
|
private AeroListView lstDirectory;
|
||||||
private AeroListView lstTransfers;
|
private AeroListView lstTransfers;
|
||||||
private System.Windows.Forms.StatusStrip statusStrip;
|
private System.Windows.Forms.StatusStrip statusStrip;
|
||||||
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel stripLblStatus;
|
private System.Windows.Forms.ToolStripStatusLabel stripLblStatus;
|
||||||
private System.Windows.Forms.Label lblPath;
|
private System.Windows.Forms.Label lblPath;
|
||||||
private System.Windows.Forms.TextBox txtPath;
|
private System.Windows.Forms.TextBox txtPath;
|
||||||
private System.Windows.Forms.Button btnRefresh;
|
private System.Windows.Forms.Button btnRefresh;
|
||||||
private System.Windows.Forms.ToolStripMenuItem uploadToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem uploadToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ColumnHeader hTransferType;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,6 +22,10 @@ namespace xServer.Forms
|
||||||
private readonly Semaphore _limitThreads = new Semaphore(2, 2); // maximum simultaneous file uploads
|
private readonly Semaphore _limitThreads = new Semaphore(2, 2); // maximum simultaneous file uploads
|
||||||
public Dictionary<int, string> CanceledUploads = new Dictionary<int, string>();
|
public Dictionary<int, string> CanceledUploads = new Dictionary<int, string>();
|
||||||
|
|
||||||
|
private const int TRANSFER_ID = 0;
|
||||||
|
private const int TRANSFER_TYPE = 1;
|
||||||
|
private const int TRANSFER_STATUS = 2;
|
||||||
|
|
||||||
public FrmFileManager(Client c)
|
public FrmFileManager(Client c)
|
||||||
{
|
{
|
||||||
_connectClient = c;
|
_connectClient = c;
|
||||||
|
@ -94,7 +98,7 @@ namespace xServer.Forms
|
||||||
{
|
{
|
||||||
new Core.Packets.ServerPackets.DoDownloadFile(path, id).Execute(_connectClient);
|
new Core.Packets.ServerPackets.DoDownloadFile(path, id).Execute(_connectClient);
|
||||||
|
|
||||||
AddTransfer(id, "Downloading...", files.SubItems[0].Text);
|
AddTransfer(id, "Download", "Pending...", files.SubItems[0].Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +126,7 @@ namespace xServer.Forms
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path)) return;
|
if (string.IsNullOrEmpty(path)) return;
|
||||||
|
|
||||||
AddTransfer(id, "Uploading...", Path.GetFileName(path));
|
AddTransfer(id, "Upload", "Pending...", Path.GetFileName(path));
|
||||||
|
|
||||||
int index = GetTransferIndex(id);
|
int index = GetTransferIndex(id);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
|
@ -150,7 +154,13 @@ namespace xServer.Forms
|
||||||
|
|
||||||
if (CanceledUploads.ContainsKey(id))
|
if (CanceledUploads.ContainsKey(id))
|
||||||
{
|
{
|
||||||
UpdateTransferStatus(index, "Canceled", 0);
|
_limitThreads.Release();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
index = GetTransferIndex(id);
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
_limitThreads.Release();
|
_limitThreads.Release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -311,42 +321,48 @@ namespace xServer.Forms
|
||||||
|
|
||||||
private void btnOpenDLFolder_Click(object sender, EventArgs e)
|
private void btnOpenDLFolder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Directory.Exists(_connectClient.Value.DownloadDirectory))
|
if (!Directory.Exists(_connectClient.Value.DownloadDirectory))
|
||||||
Process.Start(_connectClient.Value.DownloadDirectory);
|
Directory.CreateDirectory(_connectClient.Value.DownloadDirectory);
|
||||||
else
|
|
||||||
MessageBox.Show("No files downloaded yet!", "File Manager", MessageBoxButtons.OK,
|
Process.Start(_connectClient.Value.DownloadDirectory);
|
||||||
MessageBoxIcon.Information);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelToolStripMenuItem_Click(object sender, EventArgs e)
|
private void cancelToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
foreach (ListViewItem transfer in lstTransfers.SelectedItems)
|
foreach (ListViewItem transfer in lstTransfers.SelectedItems)
|
||||||
{
|
{
|
||||||
if (transfer.SubItems[1].Text.StartsWith("Downloading"))
|
if (!transfer.SubItems[TRANSFER_STATUS].Text.StartsWith("Downloading") &&
|
||||||
|
!transfer.SubItems[TRANSFER_STATUS].Text.StartsWith("Uploading") &&
|
||||||
|
!transfer.SubItems[TRANSFER_STATUS].Text.StartsWith("Pending")) continue;
|
||||||
|
|
||||||
|
int id = int.Parse(transfer.SubItems[TRANSFER_ID].Text);
|
||||||
|
|
||||||
|
if (transfer.SubItems[TRANSFER_TYPE].Text == "Download")
|
||||||
{
|
{
|
||||||
int id = int.Parse(transfer.SubItems[0].Text);
|
if (_connectClient != null)
|
||||||
|
new Core.Packets.ServerPackets.DoDownloadFileCancel(id).Execute(_connectClient);
|
||||||
if (!CommandHandler.CanceledDownloads.ContainsKey(id))
|
if (!CommandHandler.CanceledDownloads.ContainsKey(id))
|
||||||
CommandHandler.CanceledDownloads.Add(id, "canceled");
|
CommandHandler.CanceledDownloads.Add(id, "canceled");
|
||||||
if (_connectClient != null)
|
if (CommandHandler.RenamedFiles.ContainsKey(id))
|
||||||
new Core.Packets.ServerPackets.DoDownloadFileCancel(int.Parse(transfer.Text)).Execute(
|
CommandHandler.RenamedFiles.Remove(id);
|
||||||
_connectClient);
|
|
||||||
CommandHandler.RenamedFiles.Remove(id);
|
|
||||||
UpdateTransferStatus(transfer.Index, "Canceled", 0);
|
UpdateTransferStatus(transfer.Index, "Canceled", 0);
|
||||||
}
|
}
|
||||||
else if (transfer.SubItems[1].Text.StartsWith("Uploading"))
|
else if (transfer.SubItems[TRANSFER_TYPE].Text == "Upload")
|
||||||
{
|
{
|
||||||
int id = int.Parse(transfer.SubItems[0].Text);
|
|
||||||
if (!CanceledUploads.ContainsKey(id))
|
if (!CanceledUploads.ContainsKey(id))
|
||||||
CanceledUploads.Add(id, "canceled");
|
CanceledUploads.Add(id, "canceled");
|
||||||
|
UpdateTransferStatus(transfer.Index, "Canceled", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
|
private void clearToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
foreach (ListViewItem transfer in lstTransfers.SelectedItems)
|
foreach (ListViewItem transfer in lstTransfers.Items)
|
||||||
{
|
{
|
||||||
if (transfer.SubItems[1].Text.StartsWith("Downloading") || transfer.SubItems[1].Text.StartsWith("Uploading")) continue;
|
if (transfer.SubItems[TRANSFER_STATUS].Text.StartsWith("Downloading") ||
|
||||||
|
transfer.SubItems[TRANSFER_STATUS].Text.StartsWith("Uploading") ||
|
||||||
|
transfer.SubItems[TRANSFER_STATUS].Text.StartsWith("Pending")) continue;
|
||||||
transfer.Remove();
|
transfer.Remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,7 +390,7 @@ namespace xServer.Forms
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path)) return;
|
if (string.IsNullOrEmpty(path)) return;
|
||||||
|
|
||||||
AddTransfer(id, "Uploading...", Path.GetFileName(path));
|
AddTransfer(id, "Upload", "Pending...", Path.GetFileName(path));
|
||||||
|
|
||||||
int index = GetTransferIndex(id);
|
int index = GetTransferIndex(id);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
|
@ -407,6 +423,13 @@ namespace xServer.Forms
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
index = GetTransferIndex(id);
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
_limitThreads.Release();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
decimal progress =
|
decimal progress =
|
||||||
Math.Round((decimal)((double)(currentBlock + 1) / (double)srcFile.MaxBlocks * 100.0), 2);
|
Math.Round((decimal)((double)(currentBlock + 1) / (double)srcFile.MaxBlocks * 100.0), 2);
|
||||||
|
|
||||||
|
@ -482,10 +505,16 @@ namespace xServer.Forms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddItemToFileBrowser(ListViewItem lvi)
|
public void AddItemToFileBrowser(string name, string size, PathType type, int imageIndex)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ListViewItem lvi = new ListViewItem(new string[] { name, size, (type != PathType.Back) ? type.ToString() : string.Empty })
|
||||||
|
{
|
||||||
|
Tag = type,
|
||||||
|
ImageIndex = imageIndex
|
||||||
|
};
|
||||||
|
|
||||||
lstDirectory.Invoke((MethodInvoker)delegate
|
lstDirectory.Invoke((MethodInvoker)delegate
|
||||||
{
|
{
|
||||||
lstDirectory.Items.Add(lvi);
|
lstDirectory.Items.Add(lvi);
|
||||||
|
@ -496,14 +525,15 @@ namespace xServer.Forms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTransfer(int id, string status, string filename)
|
public void AddTransfer(int id, string type, string status, string filename)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ListViewItem lvi =
|
||||||
|
new ListViewItem(new string[] {id.ToString(), type, status, filename});
|
||||||
|
|
||||||
lstDirectory.Invoke((MethodInvoker)delegate
|
lstDirectory.Invoke((MethodInvoker)delegate
|
||||||
{
|
{
|
||||||
ListViewItem lvi =
|
|
||||||
new ListViewItem(new string[] { id.ToString(), status, filename });
|
|
||||||
lstTransfers.Items.Add(lvi);
|
lstTransfers.Items.Add(lvi);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -521,7 +551,7 @@ namespace xServer.Forms
|
||||||
{
|
{
|
||||||
lstTransfers.Invoke((MethodInvoker)delegate
|
lstTransfers.Invoke((MethodInvoker)delegate
|
||||||
{
|
{
|
||||||
foreach (ListViewItem lvi in lstTransfers.Items.Cast<ListViewItem>().Where(lvi => lvi != null && strId.Equals(lvi.SubItems[0].Text)))
|
foreach (ListViewItem lvi in lstTransfers.Items.Cast<ListViewItem>().Where(lvi => lvi != null && strId.Equals(lvi.SubItems[TRANSFER_ID].Text)))
|
||||||
{
|
{
|
||||||
index = lvi.Index;
|
index = lvi.Index;
|
||||||
break;
|
break;
|
||||||
|
@ -540,9 +570,9 @@ namespace xServer.Forms
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lstTransfers.Invoke((MethodInvoker)delegate
|
lstTransfers.Invoke((MethodInvoker) delegate
|
||||||
{
|
{
|
||||||
lstTransfers.Items[index].SubItems[1].Text = status;
|
lstTransfers.Items[index].SubItems[TRANSFER_STATUS].Text = status;
|
||||||
if (imageIndex >= 0)
|
if (imageIndex >= 0)
|
||||||
lstTransfers.Items[index].ImageIndex = imageIndex;
|
lstTransfers.Items[index].ImageIndex = imageIndex;
|
||||||
});
|
});
|
||||||
|
@ -550,6 +580,9 @@ namespace xServer.Forms
|
||||||
catch (InvalidOperationException)
|
catch (InvalidOperationException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAW
|
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3R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