diff --git a/rcloneExplorer/Properties/AssemblyInfo.cs b/rcloneExplorer/Properties/AssemblyInfo.cs index 92f2423..923e34c 100644 --- a/rcloneExplorer/Properties/AssemblyInfo.cs +++ b/rcloneExplorer/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.3.9.1")] -[assembly: AssemblyFileVersion("0.3.9.1")] +[assembly: AssemblyVersion("0.4.0.1")] +[assembly: AssemblyFileVersion("0.4.0.1")] diff --git a/rcloneExplorer/obj/Debug/rcloneExplorer.application b/rcloneExplorer/obj/Debug/rcloneExplorer.application index 0a4a4c8..6f8aaa9 100644 --- a/rcloneExplorer/obj/Debug/rcloneExplorer.application +++ b/rcloneExplorer/obj/Debug/rcloneExplorer.application @@ -14,7 +14,7 @@ - QxHCymWXEp5s8ALEwZgX47caZmHjwUkbK4WrZ0Lb0Wk= + jfJapLhcjFiqZKXYbu4jNNHPAm8ky+C+I3IAG/howrw= diff --git a/rcloneExplorer/obj/Debug/rcloneExplorer.csproj.GenerateResource.Cache b/rcloneExplorer/obj/Debug/rcloneExplorer.csproj.GenerateResource.Cache index 28d1cc0..7c04c2e 100644 Binary files a/rcloneExplorer/obj/Debug/rcloneExplorer.csproj.GenerateResource.Cache and b/rcloneExplorer/obj/Debug/rcloneExplorer.csproj.GenerateResource.Cache differ diff --git a/rcloneExplorer/obj/Debug/rcloneExplorer.exe b/rcloneExplorer/obj/Debug/rcloneExplorer.exe index 161c89b..5d2a120 100644 Binary files a/rcloneExplorer/obj/Debug/rcloneExplorer.exe and b/rcloneExplorer/obj/Debug/rcloneExplorer.exe differ diff --git a/rcloneExplorer/obj/Debug/rcloneExplorer.exe.manifest b/rcloneExplorer/obj/Debug/rcloneExplorer.exe.manifest index b799529..97be53a 100644 --- a/rcloneExplorer/obj/Debug/rcloneExplorer.exe.manifest +++ b/rcloneExplorer/obj/Debug/rcloneExplorer.exe.manifest @@ -4,7 +4,7 @@ - + @@ -43,14 +43,14 @@ - - + + - KCIxNpvdIZPmtBZRPxD4ku1/dWolqz6V5OCN9QbV7xc= + FPQWiBRQYTFFkqRNL4NtUNXTze/diEwkbWlC/yBLYL4= diff --git a/rcloneExplorer/obj/Debug/rcloneExplorer.pdb b/rcloneExplorer/obj/Debug/rcloneExplorer.pdb index e555656..0ba82e3 100644 Binary files a/rcloneExplorer/obj/Debug/rcloneExplorer.pdb and b/rcloneExplorer/obj/Debug/rcloneExplorer.pdb differ diff --git a/rcloneExplorer/rcloneExplorer.Designer.cs b/rcloneExplorer/rcloneExplorer.Designer.cs index 4fc2515..bf1631e 100644 --- a/rcloneExplorer/rcloneExplorer.Designer.cs +++ b/rcloneExplorer/rcloneExplorer.Designer.cs @@ -43,25 +43,28 @@ private void InitializeComponent() this.quitKillTransfersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStripView = new System.Windows.Forms.ToolStripMenuItem(); this.menuStripToggleConsole = new System.Windows.Forms.ToolStripMenuItem(); + this.refreshToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tabMainUI = new System.Windows.Forms.TabControl(); this.tabRemote = new System.Windows.Forms.TabPage(); this.tabDownloads = new System.Windows.Forms.TabPage(); this.lstDownloads = new System.Windows.Forms.ListView(); this.colDProgress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.colDPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.ctxtDownloadContext = new System.Windows.Forms.ContextMenuStrip(this.components); - this.ctxtDownloadContext_Cancel = new System.Windows.Forms.ToolStripMenuItem(); - this.refreshToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tabUploads = new System.Windows.Forms.TabPage(); this.lstUploads = new System.Windows.Forms.ListView(); this.colUProgress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.colUPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.ctxtDownloadContext = new System.Windows.Forms.ContextMenuStrip(this.components); + this.ctxtDownloadContext_Cancel = new System.Windows.Forms.ToolStripMenuItem(); + this.ctxtUploadContext = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cancelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip.SuspendLayout(); this.tabMainUI.SuspendLayout(); this.tabRemote.SuspendLayout(); this.tabDownloads.SuspendLayout(); - this.ctxtDownloadContext.SuspendLayout(); this.tabUploads.SuspendLayout(); + this.ctxtDownloadContext.SuspendLayout(); + this.ctxtUploadContext.SuspendLayout(); this.SuspendLayout(); // // lstExplorer @@ -176,6 +179,13 @@ private void InitializeComponent() this.menuStripToggleConsole.Text = "Toggle Console"; this.menuStripToggleConsole.Click += new System.EventHandler(this.menuStripToggleConsole_Click); // + // refreshToolStripMenuItem + // + this.refreshToolStripMenuItem.Name = "refreshToolStripMenuItem"; + this.refreshToolStripMenuItem.Size = new System.Drawing.Size(162, 22); + this.refreshToolStripMenuItem.Text = "Refresh"; + this.refreshToolStripMenuItem.Click += new System.EventHandler(this.refreshToolStripMenuItem_Click); + // // tabMainUI // this.tabMainUI.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -237,27 +247,6 @@ private void InitializeComponent() // this.colDPath.Text = "Path"; // - // ctxtDownloadContext - // - this.ctxtDownloadContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.ctxtDownloadContext_Cancel}); - this.ctxtDownloadContext.Name = "ctxtDownloadContext"; - this.ctxtDownloadContext.Size = new System.Drawing.Size(115, 26); - // - // ctxtDownloadContext_Cancel - // - this.ctxtDownloadContext_Cancel.Name = "ctxtDownloadContext_Cancel"; - this.ctxtDownloadContext_Cancel.Size = new System.Drawing.Size(114, 22); - this.ctxtDownloadContext_Cancel.Text = "Cancel"; - this.ctxtDownloadContext_Cancel.Click += new System.EventHandler(this.ctxtDownloadContext_Cancel_Click); - // - // refreshToolStripMenuItem - // - this.refreshToolStripMenuItem.Name = "refreshToolStripMenuItem"; - this.refreshToolStripMenuItem.Size = new System.Drawing.Size(162, 22); - this.refreshToolStripMenuItem.Text = "Refresh"; - this.refreshToolStripMenuItem.Click += new System.EventHandler(this.refreshToolStripMenuItem_Click); - // // tabUploads // this.tabUploads.Controls.Add(this.lstUploads); @@ -284,6 +273,7 @@ private void InitializeComponent() this.lstUploads.TabIndex = 1; this.lstUploads.UseCompatibleStateImageBehavior = false; this.lstUploads.View = System.Windows.Forms.View.Details; + this.lstUploads.MouseClick += new System.Windows.Forms.MouseEventHandler(this.lstUploads_MouseClick); // // colUProgress // @@ -293,6 +283,34 @@ private void InitializeComponent() // this.colUPath.Text = "Path"; // + // ctxtDownloadContext + // + this.ctxtDownloadContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ctxtDownloadContext_Cancel}); + this.ctxtDownloadContext.Name = "ctxtDownloadContext"; + this.ctxtDownloadContext.Size = new System.Drawing.Size(115, 26); + // + // ctxtDownloadContext_Cancel + // + this.ctxtDownloadContext_Cancel.Name = "ctxtDownloadContext_Cancel"; + this.ctxtDownloadContext_Cancel.Size = new System.Drawing.Size(114, 22); + this.ctxtDownloadContext_Cancel.Text = "Cancel"; + this.ctxtDownloadContext_Cancel.Click += new System.EventHandler(this.ctxtDownloadContext_Cancel_Click); + // + // ctxtUploadContext + // + this.ctxtUploadContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cancelToolStripMenuItem}); + this.ctxtUploadContext.Name = "ctxtUploadContext"; + this.ctxtUploadContext.Size = new System.Drawing.Size(115, 26); + // + // cancelToolStripMenuItem + // + this.cancelToolStripMenuItem.Name = "cancelToolStripMenuItem"; + this.cancelToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.cancelToolStripMenuItem.Text = "Cancel"; + this.cancelToolStripMenuItem.Click += new System.EventHandler(this.cancelToolStripMenuItem_Click); + // // rcloneExplorer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -312,8 +330,9 @@ private void InitializeComponent() this.tabMainUI.ResumeLayout(false); this.tabRemote.ResumeLayout(false); this.tabDownloads.ResumeLayout(false); - this.ctxtDownloadContext.ResumeLayout(false); this.tabUploads.ResumeLayout(false); + this.ctxtDownloadContext.ResumeLayout(false); + this.ctxtUploadContext.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -347,6 +366,8 @@ private void InitializeComponent() private System.Windows.Forms.ListView lstUploads; private System.Windows.Forms.ColumnHeader colUProgress; private System.Windows.Forms.ColumnHeader colUPath; + private System.Windows.Forms.ContextMenuStrip ctxtUploadContext; + private System.Windows.Forms.ToolStripMenuItem cancelToolStripMenuItem; } } diff --git a/rcloneExplorer/rcloneExplorer.cs b/rcloneExplorer/rcloneExplorer.cs index fa95997..0eca38c 100644 --- a/rcloneExplorer/rcloneExplorer.cs +++ b/rcloneExplorer/rcloneExplorer.cs @@ -51,6 +51,7 @@ public rcloneExplorer() iniSettings = new IniFile(); iniSettings.Write("rcloneRemote", ""); iniSettings.Write("rcloneVerbose", "false"); + iniSettings.Write("refreshAfterUpload", "false"); MessageBox.Show("No ini file found!\r\n\r\nPlease add an rclone remote Name to the config ini"); Process.Start("cmd.exe", "/c rclone config"); Process.Start("notepad.exe", inipath); @@ -235,7 +236,7 @@ private void lstExplorer_MouseDoubleClick(object sender, MouseEventArgs e) //insert lstExplorer.Items.Add(new ListViewItem(temprow)); //populate lstview with new directory contents - populatelstExplorer(internalExec("lsl", iniSettings.Read("rcloneRemote") + ":" + remoteCD + "/")); + populatelstExplorer(internalExec("lsl", iniSettings.Read("rcloneRemote") + ":\"" + remoteCD + "\"")); } else if (storedFilesizeHuman == "") { @@ -300,6 +301,17 @@ private void lstDownloads_MouseClick(object sender, MouseEventArgs e) } } + private void lstUploads_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (lstUploads.FocusedItem.Bounds.Contains(e.Location) == true) + { + ctxtUploadContext.Show(Cursor.Position); + } + } + } + private static void KillProcessAndChildren(int pid) { //http://stackoverflow.com/questions/5901679/kill-process-tree-programatically-in-c-sharp/32595027 @@ -372,15 +384,18 @@ private void transferTimer_Tick(object sender, EventArgs e) } else { - if (lstUploads.Items[i].SubItems[0].Text == "Uploaded!") + if (lstUploads.Items[i].SubItems[0].Text == "Done!") { //do nothing } else { //upload complete (guessing! probs best to validate this) - lstUploads.Items[i].SubItems[0].Text = "Uploaded!"; - refreshlstExplorer(); + lstUploads.Items[i].SubItems[0].Text = "Done!"; + if (iniSettings.Read("refreshAfterUpload")=="true") + { + refreshlstExplorer(); + } } } } @@ -438,6 +453,34 @@ private void ctxtDownloadContext_Cancel_Click(object sender, EventArgs e) lstDownloads.SelectedItems[0].SubItems[1].Text = "Cancelled:" + lstDownloads.SelectedItems[0].SubItems[1].Text; } } + private void cancelToolStripMenuItem_Click(object sender, EventArgs e) + { + //find PID for current transfer (list item order should match with downloadPID list... :( ) + int PID = Convert.ToInt32(uploadingPID[lstUploads.SelectedItems[0].Index][0]); + //find filename for current transfer (easy enough to pick it from the list since it's selected) + string FN = lstUploads.SelectedItems[0].SubItems[1].Text; + //get progress of file (cant cancel 100%) + string FP = lstUploads.SelectedItems[0].SubItems[0].Text; + + //if the file process is 100%, it's done + if (FP == "Done!") + { + MessageBox.Show("ERR: Can't cancel a transferred file!"); + } + //if it's not 100%, it might still be ongoing, so check the process is no longer active + else if (!ProcessExists(PID)) + { + MessageBox.Show("ERR: Transfer already completed"); + } + //file is not 100% and the process is still active + else + { + //kill PID + KillProcessAndChildren(PID); + //mark list entry as cancelled + lstUploads.SelectedItems[0].SubItems[1].Text = "Cancelled:" + lstUploads.SelectedItems[0].SubItems[1].Text; + } + } private void quitToolStripMenuItem_Click(object sender, EventArgs e) { @@ -519,5 +562,6 @@ private void refreshlstExplorer() { populatelstExplorer(internalExec("lsl", iniSettings.Read("rcloneRemote") + ":" + remoteCD + "/")); } + } } diff --git a/rcloneExplorer/rcloneExplorer.resx b/rcloneExplorer/rcloneExplorer.resx index ab9f94a..77f7ab7 100644 --- a/rcloneExplorer/rcloneExplorer.resx +++ b/rcloneExplorer/rcloneExplorer.resx @@ -123,6 +123,9 @@ 129, 17 + + 305, 17 +