Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Commit

Permalink
Upload cancellation + fixed folder space bug
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewiankidd authored Oct 2, 2016
1 parent e256892 commit 9aba017
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 37 deletions.
4 changes: 2 additions & 2 deletions rcloneExplorer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
2 changes: 1 addition & 1 deletion rcloneExplorer/obj/Debug/rcloneExplorer.application
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>QxHCymWXEp5s8ALEwZgX47caZmHjwUkbK4WrZ0Lb0Wk=</dsig:DigestValue>
<dsig:DigestValue>jfJapLhcjFiqZKXYbu4jNNHPAm8ky+C+I3IAG/howrw=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
Expand Down
Binary file not shown.
Binary file modified rcloneExplorer/obj/Debug/rcloneExplorer.exe
Binary file not shown.
8 changes: 4 additions & 4 deletions rcloneExplorer/obj/Debug/rcloneExplorer.exe.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description asmv2:iconFile="rcloneExplorer.ico" xmlns="urn:schemas-microsoft-com:asm.v1" />
<application />
<entryPoint>
<assemblyIdentity name="rcloneExplorer" version="0.3.9.1" language="neutral" processorArchitecture="msil" />
<assemblyIdentity name="rcloneExplorer" version="0.4.0.1" language="neutral" processorArchitecture="msil" />
<commandLine file="rcloneExplorer.exe" parameters="" />
</entryPoint>
<trustInfo>
Expand Down Expand Up @@ -43,14 +43,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="rcloneExplorer.exe" size="1140672">
<assemblyIdentity name="rcloneExplorer" version="0.3.9.1" language="neutral" processorArchitecture="msil" />
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="rcloneExplorer.exe" size="1141696">
<assemblyIdentity name="rcloneExplorer" version="0.4.0.1" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>KCIxNpvdIZPmtBZRPxD4ku1/dWolqz6V5OCN9QbV7xc=</dsig:DigestValue>
<dsig:DigestValue>FPQWiBRQYTFFkqRNL4NtUNXTze/diEwkbWlC/yBLYL4=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
Expand Down
Binary file modified rcloneExplorer/obj/Debug/rcloneExplorer.pdb
Binary file not shown.
73 changes: 47 additions & 26 deletions rcloneExplorer/rcloneExplorer.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 48 additions & 4 deletions rcloneExplorer/rcloneExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 == "<up>")
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
}
}
}
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -519,5 +562,6 @@ private void refreshlstExplorer()
{
populatelstExplorer(internalExec("lsl", iniSettings.Read("rcloneRemote") + ":" + remoteCD + "/"));
}

}
}
3 changes: 3 additions & 0 deletions rcloneExplorer/rcloneExplorer.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<metadata name="ctxtDownloadContext.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>129, 17</value>
</metadata>
<metadata name="ctxtUploadContext.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>305, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down

0 comments on commit 9aba017

Please sign in to comment.